Update libsignal to 0.65.0

This commit is contained in:
Greyson Parrelli
2025-01-09 11:39:34 -05:00
parent ef71410eaf
commit 6487fbe687
415 changed files with 181 additions and 167 deletions

View File

@@ -522,7 +522,8 @@ object BackupRepository {
BackupInfo(
version = VERSION,
backupTimeMs = exportState.backupTime,
mediaRootBackupKey = SignalStore.backup.mediaRootBackupKey.value.toByteString()
mediaRootBackupKey = SignalStore.backup.mediaRootBackupKey.value.toByteString(),
firstAppVersion = SignalStore.backup.firstAppVersion
)
)
frameCount++
@@ -899,6 +900,8 @@ object BackupRepository {
AppDependencies.jobManager.addAll(groupJobs)
stopwatch.split("group-jobs")
SignalStore.backup.firstAppVersion = header.firstAppVersion
Log.d(TAG, "[import] Finished! ${eventTimer.stop().summary}")
stopwatch.stop(TAG)

View File

@@ -55,7 +55,7 @@ class ChatArchiveExporter(private val cursor: Cursor, private val db: SignalData
id = cursor.requireLong(ThreadTable.ID),
recipientId = cursor.requireLong(ThreadTable.RECIPIENT_ID),
archived = cursor.requireBoolean(ThreadTable.ARCHIVED),
pinnedOrder = cursor.requireInt(ThreadTable.PINNED),
pinnedOrder = cursor.requireInt(ThreadTable.PINNED).takeIf { it > 0 },
expirationTimerMs = cursor.requireLong(RecipientTable.MESSAGE_EXPIRATION_TIME).seconds.inWholeMilliseconds.takeIf { it > 0 },
expireTimerVersion = cursor.requireInt(RecipientTable.MESSAGE_EXPIRATION_TIME_VERSION),
muteUntilMs = cursor.requireLong(RecipientTable.MUTE_UNTIL).takeIf { it > 0 }?.clampToValidBackupRange(),

View File

@@ -605,7 +605,7 @@ private fun CallTable.Call.toRemoteCallUpdate(db: SignalDatabase, messageRecord:
ringerRecipientId = this.ringerRecipient?.toLong(),
startedCallRecipientId = ACI.parseOrNull(groupCallUpdateDetails.startedCallUuid)?.let { db.recipientTable.getByAci(it).getOrNull()?.toLong() },
startedCallTimestamp = this.timestamp.clampToValidBackupRange(),
endedCallTimestamp = groupCallUpdateDetails.endedCallTimestamp.clampToValidBackupRange(),
endedCallTimestamp = groupCallUpdateDetails.endedCallTimestamp.clampToValidBackupRange().takeIf { it > 0 },
read = messageRecord.read
)
)
@@ -766,32 +766,32 @@ private fun BackupMessageRecord.toRemoteContactMessage(mediaArchiveEnabled: Bool
ContactAttachment(
name = it.name.toRemote(),
avatar = (it.avatar?.attachment as? DatabaseAttachment)?.toRemoteMessageAttachment(mediaArchiveEnabled)?.pointer,
organization = it.organization,
organization = it.organization ?: "",
number = it.phoneNumbers.map { phone ->
ContactAttachment.Phone(
value_ = phone.number,
type = phone.type.toRemote(),
label = phone.label
label = phone.label ?: ""
)
},
email = it.emails.map { email ->
ContactAttachment.Email(
value_ = email.email,
label = email.label,
label = email.label ?: "",
type = email.type.toRemote()
)
},
address = it.postalAddresses.map { address ->
ContactAttachment.PostalAddress(
type = address.type.toRemote(),
label = address.label,
street = address.street,
pobox = address.poBox,
neighborhood = address.neighborhood,
city = address.city,
region = address.region,
postcode = address.postalCode,
country = address.country
label = address.label ?: "",
street = address.street ?: "",
pobox = address.poBox ?: "",
neighborhood = address.neighborhood ?: "",
city = address.city ?: "",
region = address.region ?: "",
postcode = address.postalCode ?: "",
country = address.country ?: ""
)
}
)
@@ -802,14 +802,24 @@ private fun BackupMessageRecord.toRemoteContactMessage(mediaArchiveEnabled: Bool
)
}
private fun Contact.Name.toRemote(): ContactAttachment.Name {
private fun Contact.Name.toRemote(): ContactAttachment.Name? {
if (givenName.isNullOrEmpty() &&
familyName.isNullOrEmpty() &&
prefix.isNullOrEmpty() &&
suffix.isNullOrEmpty() &&
middleName.isNullOrEmpty() &&
nickname.isNullOrEmpty()
) {
return null
}
return ContactAttachment.Name(
givenName = givenName,
familyName = familyName,
prefix = prefix,
suffix = suffix,
middleName = middleName,
nickname = nickname
givenName = givenName ?: "",
familyName = familyName ?: "",
prefix = prefix ?: "",
suffix = suffix ?: "",
middleName = middleName ?: "",
nickname = nickname ?: ""
)
}

View File

@@ -356,7 +356,7 @@ public class Contact implements Parcelable {
return type;
}
public @NonNull String getLabel() {
public @Nullable String getLabel() {
return label;
}

View File

@@ -34,7 +34,7 @@ public final class GroupCallUpdateDetailsUtil {
GroupCallUpdateDetails details = new GroupCallUpdateDetails.Builder()
.startedCallUuid(Objects.toString(startedCallAci, ""))
.startedCallTimestamp(groupCallChatUpdate.startedCallTimestamp)
.endedCallTimestamp(groupCallChatUpdate.endedCallTimestamp)
.endedCallTimestamp(groupCallChatUpdate.endedCallTimestamp != null ? groupCallChatUpdate.endedCallTimestamp : 0)
.isCallFull(false)
.isRingingOnLocalDevice(false)
.build();

View File

@@ -39,6 +39,7 @@ class BackupValues(store: KeyValueStore) : SignalStoreValues(store) {
private const val KEY_LATEST_BACKUP_TIER = "backup.latestBackupTier"
private const val KEY_LAST_CHECK_IN_MILLIS = "backup.lastCheckInMilliseconds"
private const val KEY_LAST_CHECK_IN_SNOOZE_MILLIS = "backup.lastCheckInSnoozeMilliseconds"
private const val KEY_FIRST_APP_VERSION = "backup.firstAppVersion"
private const val KEY_NEXT_BACKUP_TIME = "backup.nextBackupTime"
private const val KEY_LAST_BACKUP_TIME = "backup.lastBackupTime"
@@ -120,6 +121,11 @@ class BackupValues(store: KeyValueStore) : SignalStoreValues(store) {
*/
var lastCheckInSnoozeMillis: Long by longValue(KEY_LAST_CHECK_IN_SNOOZE_MILLIS, 0)
/**
* The first app version to make a backup. Persisted across backup/restores to help indicate backup age.
*/
var firstAppVersion: String by stringValue(KEY_FIRST_APP_VERSION, "")
/**
* Key used to backup messages.
*/