mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 20:48:43 +00:00
Add backupVersion to RegistrationProvisioning.proto
This commit is contained in:
@@ -179,7 +179,7 @@ import kotlin.time.Duration.Companion.seconds
|
||||
object BackupRepository {
|
||||
|
||||
private val TAG = Log.tag(BackupRepository::class.java)
|
||||
private const val VERSION = 1L
|
||||
const val VERSION = 1L
|
||||
private const val REMOTE_MAIN_DB_SNAPSHOT_NAME = "remote-signal-snapshot"
|
||||
private const val REMOTE_KEYVALUE_DB_SNAPSHOT_NAME = "remote-signal-key-value-snapshot"
|
||||
private const val LOCAL_MAIN_DB_SNAPSHOT_NAME = "local-signal-snapshot"
|
||||
|
||||
@@ -212,6 +212,7 @@ class BackupMessagesJob private constructor(
|
||||
}
|
||||
|
||||
ArchiveUploadProgress.onMessageBackupCreated(tempBackupFile.length())
|
||||
SignalStore.backup.lastBackupProtoVersion = BackupRepository.VERSION
|
||||
|
||||
this.syncTime = currentTime
|
||||
this.dataFile = tempBackupFile.path
|
||||
|
||||
@@ -54,6 +54,7 @@ class BackupValues(store: KeyValueStore) : SignalStoreValues(store) {
|
||||
private const val KEY_LAST_ATTACHMENT_RECONCILIATION_TIME = "backup.lastBackupMediaSyncTime"
|
||||
private const val KEY_TOTAL_RESTORABLE_ATTACHMENT_SIZE = "backup.totalRestorableAttachmentSize"
|
||||
private const val KEY_BACKUP_FREQUENCY = "backup.backupFrequency"
|
||||
private const val KEY_LAST_BACKUP_PROTO_VERSION = "backup.lastBackupProtoVersion"
|
||||
|
||||
private const val KEY_CDN_MEDIA_PATH = "backup.cdn.mediaPath"
|
||||
|
||||
@@ -147,6 +148,9 @@ class BackupValues(store: KeyValueStore) : SignalStoreValues(store) {
|
||||
clearMessageBackupFailureSheetWatermark()
|
||||
}
|
||||
|
||||
/** The version of the backup file we last successfully made. */
|
||||
var lastBackupProtoVersion: Long by longValue(KEY_LAST_BACKUP_PROTO_VERSION, -1)
|
||||
|
||||
val daysSinceLastBackup: Int get() = (System.currentTimeMillis().milliseconds - lastBackupTime.milliseconds).inWholeDays.toInt()
|
||||
|
||||
var lastAttachmentReconciliationTime: Long by longValue(KEY_LAST_ATTACHMENT_RECONCILIATION_TIME, -1)
|
||||
|
||||
@@ -92,7 +92,8 @@ object QuickRegistrationRepository {
|
||||
aciIdentityKeyPublic = SignalStore.account.aciIdentityKey.publicKey.serialize().toByteString(),
|
||||
aciIdentityKeyPrivate = SignalStore.account.aciIdentityKey.privateKey.serialize().toByteString(),
|
||||
pniIdentityKeyPublic = SignalStore.account.pniIdentityKey.publicKey.serialize().toByteString(),
|
||||
pniIdentityKeyPrivate = SignalStore.account.pniIdentityKey.privateKey.serialize().toByteString()
|
||||
pniIdentityKeyPrivate = SignalStore.account.pniIdentityKey.privateKey.serialize().toByteString(),
|
||||
backupVersion = SignalStore.backup.lastBackupProtoVersion
|
||||
)
|
||||
)
|
||||
.successOrThrow()
|
||||
|
||||
@@ -32,4 +32,5 @@ message RegistrationProvisionMessage {
|
||||
bytes aciIdentityKeyPrivate = 11;
|
||||
bytes pniIdentityKeyPublic = 12;
|
||||
bytes pniIdentityKeyPrivate = 13;
|
||||
uint64 backupVersion = 14;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user