mirror of
https://github.com/twofas/2fas-android.git
synced 2024-11-21 09:49:54 +01:00
Bump backup schema
This commit is contained in:
parent
0d5b902ba8
commit
e97f1a1040
@ -31,6 +31,7 @@ internal class GoogleDriveImpl(
|
||||
|
||||
companion object {
|
||||
private val backupVersions = listOf(
|
||||
"2fas-backup-v4.json",
|
||||
"2fas-backup-v3.json",
|
||||
"2fas-backup-v2.json",
|
||||
"2fas-backup.json"
|
||||
@ -46,10 +47,11 @@ internal class GoogleDriveImpl(
|
||||
?: return@withContext GoogleDriveFileResult.Failure(error = GoogleDriveError.CredentialsNotFound)
|
||||
|
||||
val drive = getDrive(credentials)
|
||||
val backupFileId = getFiles(drive)
|
||||
val backupFile = getFiles(drive)
|
||||
?.filter { backupVersions.contains(it.name) }
|
||||
?.firstOrNull()
|
||||
?.id
|
||||
|
||||
val backupFileId = backupFile?.id
|
||||
|
||||
if (backupFileId != null) {
|
||||
val fileContent = drive.files()[backupFileId]?.executeMediaAsInputStream()?.use { inputStream ->
|
||||
@ -57,6 +59,7 @@ internal class GoogleDriveImpl(
|
||||
reader.readText()
|
||||
}
|
||||
}
|
||||
Timber.d("GetFile <- ${backupFile.name}")
|
||||
Timber.d("GetFile <- \"$fileContent\"")
|
||||
Timber.d("GetFile <- Success")
|
||||
|
||||
|
@ -27,7 +27,7 @@ data class BackupContent(
|
||||
val reference: String? = null,
|
||||
) {
|
||||
companion object {
|
||||
const val CurrentSchema = 3
|
||||
const val CurrentSchema = 4
|
||||
|
||||
const val Reference =
|
||||
"tRViSsLKzd86Hprh4ceC2OP7xazn4rrt4xhfEUbOjxLX8Rc3mkISXE0lWbmnWfggogbBJhtYgpK6fMl1D6mtsy92R3HkdGfwuXbzLebqVFJsR7IZ2w58t938iymwG4824igYy1wi6n2WDpO1Q1P69zwJGs2F5a1qP4MyIiDSD7NCV2OvidXQCBnDlGfmz0f1BQySRkkt4ryiJeCjD2o4QsveJ9uDBUn8ELyOrESv5R5DMDkD4iAF8TXU7KyoJujd"
|
||||
|
@ -27,8 +27,6 @@ data class RemoteBackup(
|
||||
val reference: String? = null,
|
||||
) {
|
||||
companion object {
|
||||
const val CURRENT_SCHEMA = 3
|
||||
|
||||
fun createEmpty() = RemoteBackup()
|
||||
const val CURRENT_SCHEMA = 4
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user