mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-15 15:02:49 +01:00
refactor
Signed-off-by: KaiserBh <kaiserbh@proton.me>
This commit is contained in:
parent
f02a9de4db
commit
6d0dbf1c56
@ -151,14 +151,13 @@ class GoogleDriveSyncService(context: Context, json: Json, syncPreferences: Sync
|
|||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun pushSyncData(syncData: SyncData) {
|
override suspend fun pushSyncData(syncData: SyncData) {
|
||||||
|
val jsonData = json.encodeToString(syncData)
|
||||||
val drive = googleDriveService.driveService
|
val drive = googleDriveService.driveService
|
||||||
?: throw Exception(context.stringResource(MR.strings.google_drive_not_signed_in))
|
?: throw Exception(context.stringResource(MR.strings.google_drive_not_signed_in))
|
||||||
|
|
||||||
val fileList = getAppDataFileList(drive)
|
val fileList = getAppDataFileList(drive)
|
||||||
val byteArrayOutputStream = ByteArrayOutputStream()
|
val byteArrayOutputStream = ByteArrayOutputStream()
|
||||||
|
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
val jsonData = json.encodeToString(syncData)
|
|
||||||
val gzipOutputStream = GZIPOutputStream(byteArrayOutputStream)
|
val gzipOutputStream = GZIPOutputStream(byteArrayOutputStream)
|
||||||
gzipOutputStream.write(jsonData.toByteArray(Charsets.UTF_8))
|
gzipOutputStream.write(jsonData.toByteArray(Charsets.UTF_8))
|
||||||
gzipOutputStream.close()
|
gzipOutputStream.close()
|
||||||
|
Loading…
Reference in New Issue
Block a user