use of org.whispersystems.signalservice.internal.push.exceptions.GroupPatchNotAcceptedException in project Signal-Android by WhisperSystems.
the class MessageRequestRepository method deleteMessageRequest.
void deleteMessageRequest(@NonNull LiveRecipient recipient, long threadId, @NonNull Runnable onMessageRequestDeleted, @NonNull GroupChangeErrorCallback error) {
executor.execute(() -> {
Recipient resolved = recipient.resolve();
if (resolved.isGroup() && resolved.requireGroupId().isPush()) {
try {
GroupManager.leaveGroupFromBlockOrMessageRequest(context, resolved.requireGroupId().requirePush());
} catch (GroupChangeException | GroupPatchNotAcceptedException e) {
if (SignalDatabase.groups().isCurrentMember(resolved.requireGroupId().requirePush(), Recipient.self().getId())) {
Log.w(TAG, "Failed to leave group, and we're still a member.", e);
error.onError(GroupChangeFailureReason.fromException(e));
return;
} else {
Log.w(TAG, "Failed to leave group, but we're not a member, so ignoring.");
}
} catch (IOException e) {
Log.w(TAG, e);
error.onError(GroupChangeFailureReason.fromException(e));
return;
}
}
if (TextSecurePreferences.isMultiDevice(context)) {
ApplicationDependencies.getJobManager().add(MultiDeviceMessageRequestResponseJob.forDelete(recipient.getId()));
}
ThreadDatabase threadDatabase = SignalDatabase.threads();
threadDatabase.deleteConversation(threadId);
onMessageRequestDeleted.run();
});
}
use of org.whispersystems.signalservice.internal.push.exceptions.GroupPatchNotAcceptedException in project Signal-Android by signalapp.
the class MessageRequestRepository method deleteMessageRequest.
void deleteMessageRequest(@NonNull LiveRecipient recipient, long threadId, @NonNull Runnable onMessageRequestDeleted, @NonNull GroupChangeErrorCallback error) {
executor.execute(() -> {
Recipient resolved = recipient.resolve();
if (resolved.isGroup() && resolved.requireGroupId().isPush()) {
try {
GroupManager.leaveGroupFromBlockOrMessageRequest(context, resolved.requireGroupId().requirePush());
} catch (GroupChangeException | GroupPatchNotAcceptedException e) {
if (SignalDatabase.groups().isCurrentMember(resolved.requireGroupId().requirePush(), Recipient.self().getId())) {
Log.w(TAG, "Failed to leave group, and we're still a member.", e);
error.onError(GroupChangeFailureReason.fromException(e));
return;
} else {
Log.w(TAG, "Failed to leave group, but we're not a member, so ignoring.");
}
} catch (IOException e) {
Log.w(TAG, e);
error.onError(GroupChangeFailureReason.fromException(e));
return;
}
}
if (TextSecurePreferences.isMultiDevice(context)) {
ApplicationDependencies.getJobManager().add(MultiDeviceMessageRequestResponseJob.forDelete(recipient.getId()));
}
ThreadDatabase threadDatabase = SignalDatabase.threads();
threadDatabase.deleteConversation(threadId);
onMessageRequestDeleted.run();
});
}
Aggregations