Add disable GV2 creation option to internal preferences UI.
This commit is contained in:
parent
d02d506b13
commit
833ca8cce9
9 changed files with 30 additions and 39 deletions
|
@ -271,11 +271,7 @@ public final class ContactSelectionListFragment extends LoggingFragment
|
|||
RecyclerViewConcatenateAdapterStickyHeader concatenateAdapter = new RecyclerViewConcatenateAdapterStickyHeader();
|
||||
|
||||
if (listCallback != null) {
|
||||
if (FeatureFlags.groupsV2create() && FeatureFlags.internalUser()) {
|
||||
headerAdapter = new FixedViewsAdapter(createNewGroupItem(listCallback), createNewGroupsV1GroupItem(listCallback));
|
||||
} else {
|
||||
headerAdapter = new FixedViewsAdapter(createNewGroupItem(listCallback));
|
||||
}
|
||||
headerAdapter = new FixedViewsAdapter(createNewGroupItem(listCallback));
|
||||
headerAdapter.hide();
|
||||
concatenateAdapter.addAdapter(headerAdapter);
|
||||
}
|
||||
|
@ -316,13 +312,6 @@ public final class ContactSelectionListFragment extends LoggingFragment
|
|||
return view;
|
||||
}
|
||||
|
||||
private View createNewGroupsV1GroupItem(@NonNull ListCallback listCallback) {
|
||||
View view = LayoutInflater.from(requireContext())
|
||||
.inflate(R.layout.contact_selection_new_group_v1_item, (ViewGroup) requireView(), false);
|
||||
view.setOnClickListener(v -> listCallback.onNewGroup(true));
|
||||
return view;
|
||||
}
|
||||
|
||||
private void initializeNoContactsPermission() {
|
||||
swipeRefresh.setVisibility(View.GONE);
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ final class GroupManagerV2 {
|
|||
GroupCandidate self = groupCandidateHelper.recipientIdToCandidate(Recipient.self().getId());
|
||||
Set<GroupCandidate> candidates = new HashSet<>(groupCandidateHelper.recipientIdsToCandidates(members));
|
||||
|
||||
if (SignalStore.internalValues().forceGv2Invites()) {
|
||||
if (SignalStore.internalValues().gv2ForceInvites()) {
|
||||
candidates = GroupCandidate.withoutProfileKeyCredentials(candidates);
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ final class GroupManagerV2 {
|
|||
|
||||
Set<GroupCandidate> groupCandidates = groupCandidateHelper.recipientIdsToCandidates(new HashSet<>(newMembers));
|
||||
|
||||
if (SignalStore.internalValues().forceGv2Invites()) {
|
||||
if (SignalStore.internalValues().gv2ForceInvites()) {
|
||||
groupCandidates = GroupCandidate.withoutProfileKeyCredentials(groupCandidates);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||
|
||||
public class CreateGroupActivity extends ContactSelectionActivity {
|
||||
|
||||
private static String TAG = Log.tag(CreateGroupActivity.class);
|
||||
private static final String TAG = Log.tag(CreateGroupActivity.class);
|
||||
|
||||
private static final int MINIMUM_GROUP_SIZE = 1;
|
||||
private static final short REQUEST_CODE_ADD_DETAILS = 17275;
|
||||
|
|
|
@ -4,6 +4,7 @@ import org.thoughtcrime.securesms.util.FeatureFlags;
|
|||
|
||||
public final class InternalValues extends SignalStoreValues {
|
||||
|
||||
public static final String GV2_DO_NOT_CREATE_GV2 = "internal.gv2.do_not_create_gv2";
|
||||
public static final String GV2_FORCE_INVITES = "internal.gv2.force_invites";
|
||||
public static final String GV2_IGNORE_SERVER_CHANGES = "internal.gv2.ignore_server_changes";
|
||||
public static final String GV2_IGNORE_P2P_CHANGES = "internal.gv2.ignore_p2p_changes";
|
||||
|
@ -16,7 +17,17 @@ public final class InternalValues extends SignalStoreValues {
|
|||
void onFirstEverAppLaunch() {
|
||||
}
|
||||
|
||||
public synchronized boolean forceGv2Invites() {
|
||||
/**
|
||||
* Do not attempt to create GV2 groups, i.e. will force creation of GV1 or MMS groups.
|
||||
*/
|
||||
public synchronized boolean gv2DoNotCreateGv2Groups() {
|
||||
return FeatureFlags.internalUser() && getBoolean(GV2_DO_NOT_CREATE_GV2, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Members will not be added directly to a GV2 even if they could be.
|
||||
*/
|
||||
public synchronized boolean gv2ForceInvites() {
|
||||
return FeatureFlags.internalUser() && getBoolean(GV2_FORCE_INVITES, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,8 @@ public class InternalOptionsPreferenceFragment extends CorrectedPreferenceFragme
|
|||
|
||||
PreferenceDataStore preferenceDataStore = SignalStore.getPreferenceDataStore();
|
||||
|
||||
initializeSwitchPreference(preferenceDataStore, InternalValues.GV2_FORCE_INVITES, SignalStore.internalValues().forceGv2Invites());
|
||||
initializeSwitchPreference(preferenceDataStore, InternalValues.GV2_DO_NOT_CREATE_GV2, SignalStore.internalValues().gv2DoNotCreateGv2Groups());
|
||||
initializeSwitchPreference(preferenceDataStore, InternalValues.GV2_FORCE_INVITES, SignalStore.internalValues().gv2ForceInvites());
|
||||
initializeSwitchPreference(preferenceDataStore, InternalValues.GV2_IGNORE_SERVER_CHANGES, SignalStore.internalValues().gv2IgnoreServerChanges());
|
||||
initializeSwitchPreference(preferenceDataStore, InternalValues.GV2_IGNORE_P2P_CHANGES, SignalStore.internalValues().gv2IgnoreP2PChanges());
|
||||
|
||||
|
|
|
@ -200,9 +200,11 @@ public final class FeatureFlags {
|
|||
return getBoolean(GROUPS_V2, false);
|
||||
}
|
||||
|
||||
/** Groups v2 send and receive. */
|
||||
/** Attempt groups v2 creation. */
|
||||
public static boolean groupsV2create() {
|
||||
return groupsV2() && getBoolean(GROUPS_V2_CREATE, false);
|
||||
return groupsV2() &&
|
||||
getBoolean(GROUPS_V2_CREATE, false) &&
|
||||
!SignalStore.internalValues().gv2DoNotCreateGv2Groups();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
style="@style/Signal.Text.Body"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/contact_selection_item_height"
|
||||
android:drawablePadding="16dp"
|
||||
android:ellipsize="marquee"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:gravity="center_vertical|start"
|
||||
android:labelFor="@id/action_icon"
|
||||
android:paddingStart="@dimen/selection_item_header_width"
|
||||
android:singleLine="true"
|
||||
android:text="@string/contact_selection_activity__new_gv1_group"
|
||||
android:textAlignment="viewStart"
|
||||
app:drawableStartCompat="?attr/contact_selection_new_group_icon"
|
||||
tools:ignore="RtlSymmetry" />
|
|
@ -1431,8 +1431,6 @@
|
|||
<string name="contact_selection_activity__enter_name_or_number">Enter name or number</string>
|
||||
<string name="contact_selection_activity__invite_to_signal">Invite to Signal</string>
|
||||
<string name="contact_selection_activity__new_group">New group</string>
|
||||
<!-- temporary for internal testing -->
|
||||
<string name="contact_selection_activity__new_gv1_group" translatable="false">New old style group (GV1)</string>
|
||||
|
||||
<!-- contact_filter_toolbar -->
|
||||
<string name="contact_filter_toolbar__clear_entered_text_description">Clear entered text</string>
|
||||
|
@ -1961,6 +1959,8 @@
|
|||
<!-- Internal only preferences -->
|
||||
<string name="preferences__internal_preferences" translatable="false">Internal Preferences</string>
|
||||
<string name="preferences__internal_preferences_groups_v2" translatable="false">Groups V2</string>
|
||||
<string name="preferences__internal_do_not_create_gv2" translatable="false">Do not create GV2 groups</string>
|
||||
<string name="preferences__internal_do_not_create_gv2_description" translatable="false">Do not attempt to create GV2 groups, i.e. will force creation of GV1 or MMS groups.</string>
|
||||
<string name="preferences__internal_force_gv2_invites" translatable="false">Force Invites</string>
|
||||
<string name="preferences__internal_force_gv2_invites_description" translatable="false">Members will not be added directly to a GV2 even if they could be.</string>
|
||||
<string name="preferences__internal_ignore_gv2_server_changes" translatable="false">Ignore server changes</string>
|
||||
|
|
|
@ -37,6 +37,12 @@
|
|||
android:key="internal_groupsV2"
|
||||
android:title="@string/preferences__internal_preferences_groups_v2">
|
||||
|
||||
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="internal.gv2.do_not_create_gv2"
|
||||
android:summary="@string/preferences__internal_do_not_create_gv2_description"
|
||||
android:title="@string/preferences__internal_do_not_create_gv2" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="internal.gv2.force_invites"
|
||||
|
|
Loading…
Add table
Reference in a new issue