Remove duplicate address resolving

This commit is contained in:
AsamK 2023-06-03 16:11:21 +02:00
parent 106af6a801
commit c62a1e829f
2 changed files with 14 additions and 8 deletions

View file

@ -94,10 +94,8 @@ public class IdentityHelper {
private boolean trustIdentity(
RecipientId recipientId, BiFunction<ServiceId, IdentityKey, Boolean> verifier, TrustLevel trustLevel
) {
final var serviceId = account.getRecipientAddressResolver()
.resolveRecipientAddress(recipientId)
.serviceId()
.orElse(null);
final var address = account.getRecipientAddressResolver().resolveRecipientAddress(recipientId);
final var serviceId = address.serviceId().orElse(null);
if (serviceId == null) {
return false;
}
@ -112,9 +110,8 @@ public class IdentityHelper {
account.getIdentityKeyStore().setIdentityTrustLevel(serviceId, identity.getIdentityKey(), trustLevel);
try {
final var address = context.getRecipientHelper()
.resolveSignalServiceAddress(account.getRecipientResolver().resolveRecipient(serviceId));
context.getSyncHelper().sendVerifiedMessage(address, identity.getIdentityKey(), trustLevel);
context.getSyncHelper()
.sendVerifiedMessage(address.toSignalServiceAddress(), identity.getIdentityKey(), trustLevel);
} catch (IOException e) {
logger.warn("Failed to send verification sync message: {}", e.getMessage());
}