Fix bug where SN change dialog appeared unnecessarily.

This commit is contained in:
Cody Henthorne
2020-08-12 11:18:14 -04:00
committed by Greyson Parrelli
parent 761de1318e
commit 5ced1a775c
4 changed files with 22 additions and 3 deletions

View File

@@ -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());
}

View File

@@ -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;
}