Search in sources :

Example 6 with GroupInviteLinkUrl

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);
        }
    });
}
Also used : GroupChangeFailedException(org.thoughtcrime.securesms.groups.GroupChangeFailedException) GroupChangeBusyException(org.thoughtcrime.securesms.groups.GroupChangeBusyException) GroupNotAMemberException(org.thoughtcrime.securesms.groups.GroupNotAMemberException) GroupInviteLinkUrl(org.thoughtcrime.securesms.groups.v2.GroupInviteLinkUrl) GroupInsufficientRightsException(org.thoughtcrime.securesms.groups.GroupInsufficientRightsException) IOException(java.io.IOException)

Aggregations

GroupInviteLinkUrl (org.thoughtcrime.securesms.groups.v2.GroupInviteLinkUrl)6 IOException (java.io.IOException)4 Bitmap (android.graphics.Bitmap)2 ExecutionException (java.util.concurrent.ExecutionException)2 DecryptedGroupJoinInfo (org.signal.storageservice.protos.groups.local.DecryptedGroupJoinInfo)2 VerificationFailedException (org.signal.zkgroup.VerificationFailedException)2 GroupMasterKey (org.signal.zkgroup.groups.GroupMasterKey)2 Attachment (org.thoughtcrime.securesms.attachments.Attachment)2 UriAttachment (org.thoughtcrime.securesms.attachments.UriAttachment)2 GroupDatabase (org.thoughtcrime.securesms.database.GroupDatabase)2 GroupChangeBusyException (org.thoughtcrime.securesms.groups.GroupChangeBusyException)2 GroupChangeFailedException (org.thoughtcrime.securesms.groups.GroupChangeFailedException)2 GroupId (org.thoughtcrime.securesms.groups.GroupId)2 GroupInsufficientRightsException (org.thoughtcrime.securesms.groups.GroupInsufficientRightsException)2 GroupNotAMemberException (org.thoughtcrime.securesms.groups.GroupNotAMemberException)2 Recipient (org.thoughtcrime.securesms.recipients.Recipient)2 GroupLinkNotActiveException (org.whispersystems.signalservice.api.groupsv2.GroupLinkNotActiveException)2