Add better ux when group limit reached when joining via link.

This commit is contained in:
Cody Henthorne
2025-12-17 13:49:32 -05:00
committed by jeffrey-signal
parent eb4540600e
commit b7d671dcbd
4 changed files with 17 additions and 2 deletions
@@ -183,6 +183,7 @@ public final class GroupJoinBottomSheetDialogFragment extends BottomSheetDialogF
case GROUP_LINK_NOT_ACTIVE: return getString(R.string.GroupJoinBottomSheetDialogFragment_this_group_link_is_not_active);
case BANNED : return getString(R.string.GroupJoinBottomSheetDialogFragment_you_cant_join_this_group_via_the_group_link_because_an_admin_removed_you);
case NETWORK_ERROR : return getString(R.string.GroupJoinBottomSheetDialogFragment_encountered_a_network_error);
case LIMIT_REACHED : return getString(R.string.GroupJoinBottomSheetDialogFragment_group_limit_reached);
default : return getString(R.string.GroupJoinBottomSheetDialogFragment_unable_to_join_group_please_try_again_later);
}
}
@@ -18,6 +18,7 @@ import org.thoughtcrime.securesms.groups.v2.GroupInviteLinkUrl;
import org.thoughtcrime.securesms.jobs.AvatarGroupsV2DownloadJob;
import org.thoughtcrime.securesms.util.AsynchronousCallback;
import org.whispersystems.signalservice.api.groupsv2.GroupLinkNotActiveException;
import org.whispersystems.signalservice.internal.push.exceptions.GroupPatchNotAcceptedException;
import java.io.IOException;
@@ -68,9 +69,19 @@ final class GroupJoinRepository {
} catch (GroupLinkNotActiveException e) {
Log.w(TAG, "Inactive group error", e);
callback.onError(e.getReason() == GroupLinkNotActiveException.Reason.BANNED ? JoinGroupError.BANNED : JoinGroupError.GROUP_LINK_NOT_ACTIVE);
} catch (GroupChangeFailedException | MembershipNotSuitableForV2Exception e) {
Log.w(TAG, "Change failed", e);
} catch (MembershipNotSuitableForV2Exception e) {
Log.w(TAG, "Membership not suitable", e);
callback.onError(JoinGroupError.FAILED);
} catch (GroupChangeFailedException e) {
Log.w(TAG, "Group change failed", e);
JoinGroupError error = JoinGroupError.FAILED;
if (e.getCause() instanceof GroupPatchNotAcceptedException) {
String message = e.getCause().getMessage();
if (message != null && message.contains("group size cannot exceed")) {
error = JoinGroupError.LIMIT_REACHED;
}
}
callback.onError(error);
}
});
}
@@ -5,5 +5,6 @@ enum JoinGroupError {
GROUP_LINK_NOT_ACTIVE,
BANNED,
FAILED,
LIMIT_REACHED,
NETWORK_ERROR,
}
+2
View File
@@ -1640,6 +1640,8 @@
<string name="GroupJoinBottomSheetDialogFragment_unable_to_join_group_please_try_again_later">Unable to join group. Please try again later</string>
<string name="GroupJoinBottomSheetDialogFragment_encountered_a_network_error">Encountered a network error.</string>
<string name="GroupJoinBottomSheetDialogFragment_this_group_link_is_not_active">This group link is not active</string>
<!-- Toast message shown when trying to join a group by link but the group is full -->
<string name="GroupJoinBottomSheetDialogFragment_group_limit_reached">Group limit reached, unable to join group</string>
<!-- Title shown when there was an known issue getting group information from a group link -->
<string name="GroupJoinBottomSheetDialogFragment_cant_join_group">Can\'t join group</string>
<!-- Message shown when you try to get information for a group via link but an admin has removed you -->