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

@ -625,7 +625,16 @@
"name":"org.asamk.signal.commands.ListIdentitiesCommand$JsonIdentity", "name":"org.asamk.signal.commands.ListIdentitiesCommand$JsonIdentity",
"allDeclaredFields":true, "allDeclaredFields":true,
"allDeclaredMethods":true, "allDeclaredMethods":true,
"allDeclaredConstructors":true "allDeclaredConstructors":true,
"methods":[
{"name":"addedTimestamp","parameterTypes":[] },
{"name":"fingerprint","parameterTypes":[] },
{"name":"number","parameterTypes":[] },
{"name":"safetyNumber","parameterTypes":[] },
{"name":"scannableSafetyNumber","parameterTypes":[] },
{"name":"trustLevel","parameterTypes":[] },
{"name":"uuid","parameterTypes":[] }
]
}, },
{ {
"name":"org.asamk.signal.commands.ListStickerPacksCommand$JsonStickerPack", "name":"org.asamk.signal.commands.ListStickerPacksCommand$JsonStickerPack",

View file

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