Remove GV1 migration support.

This commit is contained in:
Cody Henthorne
2023-11-17 14:07:21 -05:00
committed by Greyson Parrelli
parent 213d996168
commit 34a228f85e
30 changed files with 42 additions and 928 deletions

View File

@@ -126,21 +126,17 @@ public final class MessageRequestRepository {
}
} else if (!RecipientUtil.isLegacyProfileSharingAccepted(recipient) && isLegacyThread(recipient)) {
if (recipient.isGroup()) {
return MessageRequestState.LEGACY_GROUP_V1;
return MessageRequestState.DEPRECATED_GROUP_V1;
} else {
return MessageRequestState.LEGACY_INDIVIDUAL;
}
} else if (recipient.isPushV1Group()) {
if (RecipientUtil.isMessageRequestAccepted(context, threadId)) {
if (recipient.getParticipantIds().size() > FeatureFlags.groupLimits().getHardLimit()) {
return MessageRequestState.DEPRECATED_GROUP_V1_TOO_LARGE;
} else {
return MessageRequestState.DEPRECATED_GROUP_V1;
}
return MessageRequestState.DEPRECATED_GROUP_V1;
} else if (!recipient.isActiveGroup()) {
return MessageRequestState.NONE;
} else {
return MessageRequestState.GROUP_V1;
return MessageRequestState.DEPRECATED_GROUP_V1;
}
} else {
if (RecipientUtil.isMessageRequestAccepted(context, threadId)) {

View File

@@ -19,18 +19,9 @@ public enum MessageRequestState {
/** An individual conversation that existed pre-message-requests but doesn't have profile sharing enabled */
LEGACY_INDIVIDUAL,
/** A V1 group conversation that existed pre-message-requests but doesn't have profile sharing enabled */
LEGACY_GROUP_V1,
/** A V1 group conversation that is no longer allowed, because we've forced GV2 on. */
DEPRECATED_GROUP_V1,
/** A V1 group conversation that is no longer allowed, because we've forced GV2 on, but it's also too large to migrate. Nothing we can do. */
DEPRECATED_GROUP_V1_TOO_LARGE,
/** A message request is needed for a V1 group */
GROUP_V1,
/** An invite response is needed for a V2 group */
GROUP_V2_INVITE,

View File

@@ -4,9 +4,9 @@ import android.content.Context;
import android.content.res.ColorStateList;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Button;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.Group;
import androidx.core.text.HtmlCompat;
@@ -17,7 +17,6 @@ import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.util.CommunicationActions;
import org.thoughtcrime.securesms.util.Debouncer;
import org.thoughtcrime.securesms.util.FeatureFlags;
import org.thoughtcrime.securesms.util.HtmlUtil;
import org.thoughtcrime.securesms.util.views.LearnMoreTextView;
@@ -29,7 +28,6 @@ public class MessageRequestsBottomView extends ConstraintLayout {
private LearnMoreTextView question;
private MaterialButton accept;
private MaterialButton gv1Continue;
private MaterialButton block;
private MaterialButton delete;
private MaterialButton bigDelete;
@@ -38,8 +36,7 @@ public class MessageRequestsBottomView extends ConstraintLayout {
private Group normalButtons;
private Group blockedButtons;
private Group gv1MigrationButtons;
private Group activeGroup;
private @Nullable Group activeGroup;
public MessageRequestsBottomView(Context context) {
super(context);
@@ -66,10 +63,8 @@ public class MessageRequestsBottomView extends ConstraintLayout {
delete = findViewById(R.id.message_request_delete);
bigDelete = findViewById(R.id.message_request_big_delete);
bigUnblock = findViewById(R.id.message_request_big_unblock);
gv1Continue = findViewById(R.id.message_request_gv1_migration);
normalButtons = findViewById(R.id.message_request_normal_buttons);
blockedButtons = findViewById(R.id.message_request_blocked_buttons);
gv1MigrationButtons = findViewById(R.id.message_request_gv1_migration_buttons);
busyIndicator = findViewById(R.id.message_request_busy_indicator);
setWallpaperEnabled(false);
@@ -89,67 +84,49 @@ public class MessageRequestsBottomView extends ConstraintLayout {
question.setText(HtmlCompat.fromHtml(getContext().getString(message,
HtmlUtil.bold(recipient.getShortDisplayName(getContext()))), 0));
setActiveInactiveGroups(blockedButtons, normalButtons, gv1MigrationButtons);
setActiveInactiveGroups(blockedButtons, normalButtons);
break;
case BLOCKED_GROUP:
question.setText(R.string.MessageRequestBottomView_unblock_this_group_and_share_your_name_and_photo_with_its_members);
setActiveInactiveGroups(blockedButtons, normalButtons, gv1MigrationButtons);
setActiveInactiveGroups(blockedButtons, normalButtons);
break;
case LEGACY_INDIVIDUAL:
question.setText(getContext().getString(R.string.MessageRequestBottomView_continue_your_conversation_with_s_and_share_your_name_and_photo, recipient.getShortDisplayName(getContext())));
question.setLearnMoreVisible(true);
question.setOnLinkClickListener(v -> CommunicationActions.openBrowserLink(getContext(), getContext().getString(R.string.MessageRequestBottomView_legacy_learn_more_url)));
setActiveInactiveGroups(normalButtons, blockedButtons, gv1MigrationButtons);
accept.setText(R.string.MessageRequestBottomView_continue);
break;
case LEGACY_GROUP_V1:
question.setText(R.string.MessageRequestBottomView_continue_your_conversation_with_this_group_and_share_your_name_and_photo);
question.setLearnMoreVisible(true);
question.setOnLinkClickListener(v -> CommunicationActions.openBrowserLink(getContext(), getContext().getString(R.string.MessageRequestBottomView_legacy_learn_more_url)));
setActiveInactiveGroups(normalButtons, blockedButtons, gv1MigrationButtons);
setActiveInactiveGroups(normalButtons, blockedButtons);
accept.setText(R.string.MessageRequestBottomView_continue);
break;
case DEPRECATED_GROUP_V1:
question.setText(R.string.MessageRequestBottomView_upgrade_this_group_to_activate_new_features);
setActiveInactiveGroups(gv1MigrationButtons, normalButtons, blockedButtons);
gv1Continue.setVisibility(VISIBLE);
break;
case DEPRECATED_GROUP_V1_TOO_LARGE:
question.setText(getContext().getString(R.string.MessageRequestBottomView_this_legacy_group_can_no_longer_be_used, FeatureFlags.groupLimits().getHardLimit() - 1));
setActiveInactiveGroups(gv1MigrationButtons, normalButtons, blockedButtons);
gv1Continue.setVisibility(GONE);
break;
case GROUP_V1:
question.setText(R.string.MessageRequestBottomView_do_you_want_to_join_this_group_they_wont_know_youve_seen_their_messages_until_you_accept);
setActiveInactiveGroups(normalButtons, blockedButtons, gv1MigrationButtons);
accept.setText(R.string.MessageRequestBottomView_accept);
setActiveInactiveGroups(null, normalButtons, blockedButtons);
break;
case GROUP_V2_INVITE:
question.setText(R.string.MessageRequestBottomView_do_you_want_to_join_this_group_you_wont_see_their_messages);
setActiveInactiveGroups(normalButtons, blockedButtons, gv1MigrationButtons);
setActiveInactiveGroups(normalButtons, blockedButtons);
accept.setText(R.string.MessageRequestBottomView_accept);
break;
case GROUP_V2_ADD:
question.setText(R.string.MessageRequestBottomView_join_this_group_they_wont_know_youve_seen_their_messages_until_you_accept);
setActiveInactiveGroups(normalButtons, blockedButtons, gv1MigrationButtons);
setActiveInactiveGroups(normalButtons, blockedButtons);
accept.setText(R.string.MessageRequestBottomView_accept);
break;
case INDIVIDUAL:
question.setText(HtmlCompat.fromHtml(getContext().getString(R.string.MessageRequestBottomView_do_you_want_to_let_s_message_you_they_wont_know_youve_seen_their_messages_until_you_accept,
HtmlUtil.bold(recipient.getShortDisplayName(getContext()))), 0));
setActiveInactiveGroups(normalButtons, blockedButtons, gv1MigrationButtons);
setActiveInactiveGroups(normalButtons, blockedButtons);
accept.setText(R.string.MessageRequestBottomView_accept);
break;
case INDIVIDUAL_HIDDEN:
question.setText(HtmlCompat.fromHtml(getContext().getString(R.string.MessageRequestBottomView_do_you_want_to_let_s_message_you_you_removed_them_before,
HtmlUtil.bold(recipient.getShortDisplayName(getContext()))), 0));
setActiveInactiveGroups(normalButtons, blockedButtons, gv1MigrationButtons);
setActiveInactiveGroups(normalButtons, blockedButtons);
accept.setText(R.string.MessageRequestBottomView_accept);
break;
}
}
private void setActiveInactiveGroups(@NonNull Group activeGroup, @NonNull Group... inActiveGroups) {
private void setActiveInactiveGroups(@Nullable Group activeGroup, @NonNull Group... inActiveGroups) {
int initialVisibility = this.activeGroup != null ? this.activeGroup.getVisibility() : VISIBLE;
this.activeGroup = activeGroup;
@@ -158,7 +135,9 @@ public class MessageRequestsBottomView extends ConstraintLayout {
inactive.setVisibility(GONE);
}
activeGroup.setVisibility(initialVisibility);
if (activeGroup != null) {
activeGroup.setVisibility(initialVisibility);
}
}
public void showBusy() {
@@ -179,7 +158,7 @@ public class MessageRequestsBottomView extends ConstraintLayout {
public void setWallpaperEnabled(boolean isEnabled) {
MessageRequestBarColorTheme theme = MessageRequestBarColorTheme.resolveTheme(isEnabled);
Stream.of(delete, bigDelete, block, bigUnblock, accept, gv1Continue).forEach(button -> {
Stream.of(delete, bigDelete, block, bigUnblock, accept).forEach(button -> {
button.setBackgroundTintList(ColorStateList.valueOf(theme.getButtonBackgroundColor(getContext())));
});
@@ -187,7 +166,7 @@ public class MessageRequestsBottomView extends ConstraintLayout {
button.setTextColor(theme.getButtonForegroundDenyColor(getContext()));
});
Stream.of(accept, bigUnblock, gv1Continue).forEach(button -> {
Stream.of(accept, bigUnblock).forEach(button -> {
button.setTextColor(theme.getButtonForegroundAcceptColor(getContext()));
});
@@ -210,8 +189,4 @@ public class MessageRequestsBottomView extends ConstraintLayout {
public void setUnblockOnClickListener(OnClickListener unblockOnClickListener) {
bigUnblock.setOnClickListener(unblockOnClickListener);
}
public void setGroupV1MigrationContinueListener(OnClickListener acceptOnClickListener) {
gv1Continue.setOnClickListener(acceptOnClickListener);
}
}