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