Merge branch 'sync-part-final' into feat/add-sync-triggers-experimental

This commit is contained in:
KaiserBh 2024-01-10 21:08:15 +11:00
commit 3464262f75
No known key found for this signature in database
GPG Key ID: 14D73B142042BBA9

View File

@ -151,14 +151,13 @@ class GoogleDriveSyncService(context: Context, json: Json, syncPreferences: Sync
}
override suspend fun pushSyncData(syncData: SyncData) {
val jsonData = json.encodeToString(syncData)
val drive = googleDriveService.driveService
?: throw Exception(context.stringResource(MR.strings.google_drive_not_signed_in))
val fileList = getAppDataFileList(drive)
val byteArrayOutputStream = ByteArrayOutputStream()
withContext(Dispatchers.IO) {
val jsonData = json.encodeToString(syncData)
val gzipOutputStream = GZIPOutputStream(byteArrayOutputStream)
gzipOutputStream.write(jsonData.toByteArray(Charsets.UTF_8))
gzipOutputStream.close()