Add backupVersion to RegistrationProvisioning.proto

This commit is contained in:
Greyson Parrelli
2025-09-03 11:41:57 -04:00
parent b44cd5d4c4
commit 1166b99d01
5 changed files with 9 additions and 2 deletions

View File

@@ -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"

View File

@@ -212,6 +212,7 @@ class BackupMessagesJob private constructor(
}
ArchiveUploadProgress.onMessageBackupCreated(tempBackupFile.length())
SignalStore.backup.lastBackupProtoVersion = BackupRepository.VERSION
this.syncTime = currentTime
this.dataFile = tempBackupFile.path

View File

@@ -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)

View File

@@ -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()

View File

@@ -32,4 +32,5 @@ message RegistrationProvisionMessage {
bytes aciIdentityKeyPrivate = 11;
bytes pniIdentityKeyPublic = 12;
bytes pniIdentityKeyPrivate = 13;
uint64 backupVersion = 14;
}