mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 09:20:19 +01:00
Fix identity key update failure when profile key verification failed.
This commit is contained in:
@@ -508,7 +508,7 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
|
||||
db.runPostSuccessfulTransaction {
|
||||
if (result.affectedIds.isNotEmpty()) {
|
||||
result.affectedIds.forEach { AppDependencies.databaseObserver.notifyRecipientChanged(it) }
|
||||
RetrieveProfileJob.enqueue(result.affectedIds)
|
||||
RetrieveProfileJob.enqueue(result.affectedIds, skipDebounce = true)
|
||||
}
|
||||
|
||||
if (result.oldIds.isNotEmpty()) {
|
||||
@@ -1653,6 +1653,35 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the profile key.
|
||||
*
|
||||
* It clears out the profile key credential and resets the unidentified access mode.
|
||||
*/
|
||||
fun clearProfileKeyData(id: RecipientId) {
|
||||
val selection = "$ID = ?"
|
||||
val args = arrayOf(id.serialize())
|
||||
|
||||
val valuesToCompare = contentValuesOf(
|
||||
PROFILE_KEY to null
|
||||
)
|
||||
|
||||
val valuesToSet = contentValuesOf(
|
||||
PROFILE_KEY to null,
|
||||
EXPIRING_PROFILE_KEY_CREDENTIAL to null,
|
||||
SEALED_SENDER_MODE to SealedSenderAccessMode.UNKNOWN.mode,
|
||||
LAST_PROFILE_FETCH to 0
|
||||
)
|
||||
|
||||
val updateQuery = SqlUtil.buildTrueUpdateQuery(selection, args, valuesToCompare)
|
||||
|
||||
if (update(updateQuery, valuesToSet)) {
|
||||
rotateStorageId(id)
|
||||
AppDependencies.databaseObserver.notifyRecipientChanged(id)
|
||||
StorageSyncHelper.scheduleSyncForDataChange()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the profile key iff currently null.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user