mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-30 02:50:39 +00:00
Use if instead of switch
This commit is contained in:
parent
5414a18081
commit
854116ecaa
1 changed files with 9 additions and 6 deletions
|
@ -1284,15 +1284,18 @@ public class ManagerImpl implements Manager {
|
||||||
public boolean trustIdentityVerified(
|
public boolean trustIdentityVerified(
|
||||||
RecipientIdentifier.Single recipient, IdentityVerificationCode verificationCode
|
RecipientIdentifier.Single recipient, IdentityVerificationCode verificationCode
|
||||||
) throws UnregisteredRecipientException {
|
) throws UnregisteredRecipientException {
|
||||||
return switch (verificationCode) {
|
if (verificationCode == IdentityVerificationCode.Fingerprint) {
|
||||||
case IdentityVerificationCode.Fingerprint fingerprint -> trustIdentity(recipient,
|
return trustIdentity(recipient,
|
||||||
r -> context.getIdentityHelper().trustIdentityVerified(r, fingerprint.fingerprint()));
|
r -> context.getIdentityHelper().trustIdentityVerified(r, fingerprint.fingerprint()));
|
||||||
case IdentityVerificationCode.SafetyNumber safetyNumber -> trustIdentity(recipient,
|
} else if (verificationCode == IdentityVerificationCode.SafetyNumber) {
|
||||||
|
return trustIdentity(recipient,
|
||||||
r -> context.getIdentityHelper().trustIdentityVerifiedSafetyNumber(r, safetyNumber.safetyNumber()));
|
r -> context.getIdentityHelper().trustIdentityVerifiedSafetyNumber(r, safetyNumber.safetyNumber()));
|
||||||
case IdentityVerificationCode.ScannableSafetyNumber safetyNumber -> trustIdentity(recipient,
|
} else if (verificationCode == IdentityVerificationCode.ScannableSafetyNumber) {
|
||||||
|
return trustIdentity(recipient,
|
||||||
r -> context.getIdentityHelper().trustIdentityVerifiedSafetyNumber(r, safetyNumber.safetyNumber()));
|
r -> context.getIdentityHelper().trustIdentityVerifiedSafetyNumber(r, safetyNumber.safetyNumber()));
|
||||||
case null, default -> throw new AssertionError("Invalid verification code type");
|
} else {
|
||||||
};
|
throw new AssertionError("Invalid verification code type")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue