Fix bug where SN change dialog appeared unnecessarily.
This commit is contained in:
parent
761de1318e
commit
5ced1a775c
4 changed files with 22 additions and 3 deletions
|
@ -2393,7 +2393,7 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
|||
|
||||
if ((recipient.isMmsGroup() || recipient.getEmail().isPresent()) && !isMmsEnabled) {
|
||||
handleManualMmsRequired();
|
||||
} else if (!forceSms && (identityRecords.isUnverified() || identityRecords.isUntrusted())) {
|
||||
} else if (!forceSms && (identityRecords.isUnverified(true) || identityRecords.isUntrusted(true))) {
|
||||
handleRecentSafetyNumberChange();
|
||||
} else if (isMediaMessage) {
|
||||
sendMediaMessage(forceSms, expiresIn, false, subscriptionId, initiating);
|
||||
|
|
|
@ -44,6 +44,7 @@ public final class SafetyNumberChangeDialog extends DialogFragment implements Sa
|
|||
|
||||
public static @NonNull SafetyNumberChangeDialog create(List<IdentityDatabase.IdentityRecord> identityRecords) {
|
||||
List<String> ids = Stream.of(identityRecords)
|
||||
.filterNot(IdentityDatabase.IdentityRecord::isFirstUse)
|
||||
.map(record -> record.getRecipientId().serialize())
|
||||
.distinct()
|
||||
.toList();
|
||||
|
|
|
@ -180,7 +180,7 @@ public class IdentityDatabase extends Database {
|
|||
boolean statusMatches = keyMatches && hasMatchingStatus(id, identityKey, verifiedStatus);
|
||||
|
||||
if (!keyMatches || !statusMatches) {
|
||||
saveIdentityInternal(id, identityKey, verifiedStatus, false, System.currentTimeMillis(), true);
|
||||
saveIdentityInternal(id, identityKey, verifiedStatus, !hadEntry, System.currentTimeMillis(), true);
|
||||
Optional<IdentityRecord> record = getIdentity(id);
|
||||
if (record.isPresent()) EventBus.getDefault().post(record.get());
|
||||
}
|
||||
|
|
|
@ -56,8 +56,26 @@ public final class IdentityRecordList {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isUntrusted() {
|
||||
public boolean isUnverified(boolean excludeFirstUse) {
|
||||
for (IdentityRecord identityRecord : identityRecords) {
|
||||
if (excludeFirstUse && identityRecord.isFirstUse()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (identityRecord.getVerifiedStatus() == VerifiedStatus.UNVERIFIED) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isUntrusted(boolean excludeFirstUse) {
|
||||
for (IdentityRecord identityRecord : identityRecords) {
|
||||
if (excludeFirstUse && identityRecord.isFirstUse()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isUntrusted(identityRecord)) {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue