use of org.thoughtcrime.securesms.groups.v2.GroupInviteLinkUrl in project Signal-Android by signalapp.
the class GroupLinkInviteRepository method enableGroupInviteLink.
void enableGroupInviteLink(boolean requireMemberApproval, @NonNull AsynchronousCallback.WorkerThread<GroupInviteLinkUrl, EnableInviteLinkError> callback) {
SignalExecutors.UNBOUNDED.execute(() -> {
try {
GroupInviteLinkUrl groupInviteLinkUrl = GroupManager.setGroupLinkEnabledState(context, groupId, requireMemberApproval ? GroupManager.GroupLinkState.ENABLED_WITH_APPROVAL : GroupManager.GroupLinkState.ENABLED);
if (groupInviteLinkUrl == null) {
throw new AssertionError();
}
callback.onComplete(groupInviteLinkUrl);
} catch (IOException e) {
callback.onError(EnableInviteLinkError.NETWORK_ERROR);
} catch (GroupChangeBusyException e) {
callback.onError(EnableInviteLinkError.BUSY);
} catch (GroupChangeFailedException e) {
callback.onError(EnableInviteLinkError.FAILED);
} catch (GroupInsufficientRightsException e) {
callback.onError(EnableInviteLinkError.INSUFFICIENT_RIGHTS);
} catch (GroupNotAMemberException e) {
callback.onError(EnableInviteLinkError.NOT_IN_GROUP);
}
});
}
Aggregations