Fix bug where SN change dialog appeared unnecessarily.
parent
761de1318e
commit
5ced1a775c
|
@ -2393,7 +2393,7 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
||||||
|
|
||||||
if ((recipient.isMmsGroup() || recipient.getEmail().isPresent()) && !isMmsEnabled) {
|
if ((recipient.isMmsGroup() || recipient.getEmail().isPresent()) && !isMmsEnabled) {
|
||||||
handleManualMmsRequired();
|
handleManualMmsRequired();
|
||||||
} else if (!forceSms && (identityRecords.isUnverified() || identityRecords.isUntrusted())) {
|
} else if (!forceSms && (identityRecords.isUnverified(true) || identityRecords.isUntrusted(true))) {
|
||||||
handleRecentSafetyNumberChange();
|
handleRecentSafetyNumberChange();
|
||||||
} else if (isMediaMessage) {
|
} else if (isMediaMessage) {
|
||||||
sendMediaMessage(forceSms, expiresIn, false, subscriptionId, initiating);
|
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) {
|
public static @NonNull SafetyNumberChangeDialog create(List<IdentityDatabase.IdentityRecord> identityRecords) {
|
||||||
List<String> ids = Stream.of(identityRecords)
|
List<String> ids = Stream.of(identityRecords)
|
||||||
|
.filterNot(IdentityDatabase.IdentityRecord::isFirstUse)
|
||||||
.map(record -> record.getRecipientId().serialize())
|
.map(record -> record.getRecipientId().serialize())
|
||||||
.distinct()
|
.distinct()
|
||||||
.toList();
|
.toList();
|
||||||
|
|
|
@ -180,7 +180,7 @@ public class IdentityDatabase extends Database {
|
||||||
boolean statusMatches = keyMatches && hasMatchingStatus(id, identityKey, verifiedStatus);
|
boolean statusMatches = keyMatches && hasMatchingStatus(id, identityKey, verifiedStatus);
|
||||||
|
|
||||||
if (!keyMatches || !statusMatches) {
|
if (!keyMatches || !statusMatches) {
|
||||||
saveIdentityInternal(id, identityKey, verifiedStatus, false, System.currentTimeMillis(), true);
|
saveIdentityInternal(id, identityKey, verifiedStatus, !hadEntry, System.currentTimeMillis(), true);
|
||||||
Optional<IdentityRecord> record = getIdentity(id);
|
Optional<IdentityRecord> record = getIdentity(id);
|
||||||
if (record.isPresent()) EventBus.getDefault().post(record.get());
|
if (record.isPresent()) EventBus.getDefault().post(record.get());
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,8 +56,26 @@ public final class IdentityRecordList {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUntrusted() {
|
public boolean isUnverified(boolean excludeFirstUse) {
|
||||||
for (IdentityRecord identityRecord : identityRecords) {
|
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)) {
|
if (isUntrusted(identityRecord)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue