Update to libsignal 0.60.0

This commit is contained in:
Greyson Parrelli
2024-10-25 16:09:03 -04:00
parent 4282d88191
commit 22148550dc
353 changed files with 33 additions and 5 deletions

View File

@@ -8,6 +8,8 @@ package org.thoughtcrime.securesms.backup.v2
import androidx.annotation.WorkerThread
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import okio.ByteString
import okio.ByteString.Companion.toByteString
import org.greenrobot.eventbus.EventBus
import org.signal.core.util.Base64
import org.signal.core.util.EventTimer
@@ -365,7 +367,8 @@ object BackupRepository {
writer.write(
BackupInfo(
version = VERSION,
backupTimeMs = exportState.backupTime
backupTimeMs = exportState.backupTime,
mediaRootBackupKey = SignalStore.backup.mediaRootBackupKey?.toByteString() ?: ByteString.EMPTY
)
)
frameCount++
@@ -554,6 +557,8 @@ object BackupRepository {
return ImportResult.Failure
}
SignalStore.backup.mediaRootBackupKey = header.mediaRootBackupKey.toByteArray()
// Add back self after clearing data
val selfId: RecipientId = SignalDatabase.recipients.getAndPossiblyMerge(selfData.aci, selfData.pni, selfData.e164, pniVerified = true, changeSelf = true)
SignalDatabase.recipients.setProfileKey(selfId, selfData.profileKey)
@@ -736,7 +741,7 @@ object BackupRepository {
return initBackupAndFetchAuth(backupKey)
.map { credential ->
val zkCredential = SignalNetwork.archive.getZkCredential(backupKey, aci, credential)
if (zkCredential.backupLevel == BackupLevel.MEDIA) {
if (zkCredential.backupLevel == BackupLevel.PAID) {
MessageBackupTier.PAID
} else {
MessageBackupTier.FREE

View File

@@ -980,6 +980,7 @@ class ChatItemArchiveImporter(
}
private fun Quote.QuotedAttachment.toLocalAttachment(): Attachment? {
// TODO [backup] quote status not passed through?
val thumbnail = this.thumbnail?.toLocalAttachment()
if (thumbnail != null) {
@@ -990,6 +991,7 @@ class ChatItemArchiveImporter(
return null
}
// TODO [backup] Need to do the normal ArchiveAttachment thing -- not sure why the conversion to a pointer
return PointerAttachment.forPointer(
quotedAttachment = DataMessage.Quote.QuotedAttachment(
contentType = this.contentType,

View File

@@ -50,6 +50,8 @@ class BackupValues(store: KeyValueStore) : SignalStoreValues(store) {
private const val KEY_BACKUP_FAIL_ACKNOWLEDGED_SNOOZE_TIME = "backup.failed.acknowledged.snooze.time"
private const val KEY_BACKUP_FAIL_ACKNOWLEDGED_SNOOZE_COUNT = "backup.failed.acknowledged.snooze.count"
private const val KEY_MEDIA_ROOT_BACKUP_KEY = "backup.mediaRootBackupKey"
private val cachedCdnCredentialsExpiresIn: Duration = 12.hours
}
@@ -72,6 +74,8 @@ class BackupValues(store: KeyValueStore) : SignalStoreValues(store) {
var lastMediaSyncTime: Long by longValue(KEY_LAST_BACKUP_MEDIA_SYNC_TIME, -1)
var backupFrequency: BackupFrequency by enumValue(KEY_BACKUP_FREQUENCY, BackupFrequency.MANUAL, BackupFrequency.Serializer)
var mediaRootBackupKey: ByteArray? by nullableBlobValue(KEY_MEDIA_ROOT_BACKUP_KEY, null)
/**
* This is the 'latest' backup tier. This isn't necessarily the user's current backup tier, so this should only ever
* be used to display backup tier information to the user in the settings fragments, not to check whether the user