Use EMPTY send event listeners

This commit is contained in:
AsamK 2021-09-04 13:26:52 +02:00
parent 891c05210e
commit 35622ac684

View file

@ -44,30 +44,6 @@ public class SendHelper {
private final GroupProvider groupProvider;
private final RecipientRegistrationRefresher recipientRegistrationRefresher;
private final SignalServiceMessageSender.IndividualSendEvents sendEvents = new SignalServiceMessageSender.IndividualSendEvents() {
@Override
public void onMessageEncrypted() {
}
@Override
public void onMessageSent() {
}
@Override
public void onSyncMessageSent() {
}
};
private final SignalServiceMessageSender.LegacyGroupEvents legacyGroupEvents = new SignalServiceMessageSender.LegacyGroupEvents() {
@Override
public void onMessageSent() {
}
@Override
public void onSyncMessageSent() {
}
};
public SendHelper(
final SignalAccount account,
final SignalDependencies dependencies,
@ -277,7 +253,7 @@ public class SendHelper {
isRecipientUpdate,
ContentHint.DEFAULT,
message,
legacyGroupEvents,
SignalServiceMessageSender.LegacyGroupEvents.EMPTY,
sendResult -> logger.trace("Partial message send result: {}", sendResult.isSuccess()),
() -> false);
} catch (org.whispersystems.signalservice.api.crypto.UntrustedIdentityException e) {
@ -297,14 +273,14 @@ public class SendHelper {
unidentifiedAccessHelper.getAccessFor(recipientId),
ContentHint.DEFAULT,
message,
sendEvents);
SignalServiceMessageSender.IndividualSendEvents.EMPTY);
} catch (UnregisteredUserException e) {
final var newRecipientId = recipientRegistrationRefresher.refreshRecipientRegistration(recipientId);
return messageSender.sendDataMessage(addressResolver.resolveSignalServiceAddress(newRecipientId),
unidentifiedAccessHelper.getAccessFor(newRecipientId),
ContentHint.DEFAULT,
message,
sendEvents);
SignalServiceMessageSender.IndividualSendEvents.EMPTY);
}
} catch (org.whispersystems.signalservice.api.crypto.UntrustedIdentityException e) {
return SendMessageResult.identityFailure(address, e.getIdentityKey());