mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-21 19:48:29 +00:00
Put the default message timer behind a feature flag.
This commit is contained in:
@@ -138,22 +138,24 @@ class PrivacySettingsFragment : DSLSettingsFragment(R.string.preferences__privac
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
dividerPref()
|
if (FeatureFlags.defaultMessageTimer()) {
|
||||||
|
dividerPref()
|
||||||
|
|
||||||
sectionHeaderPref(R.string.PrivacySettingsFragment__disappearing_messages)
|
sectionHeaderPref(R.string.PrivacySettingsFragment__disappearing_messages)
|
||||||
|
|
||||||
customPref(
|
customPref(
|
||||||
ValueClickPreference(
|
ValueClickPreference(
|
||||||
value = DSLSettingsText.from(ExpirationUtil.getExpirationAbbreviatedDisplayValue(requireContext(), state.universalExpireTimer)),
|
value = DSLSettingsText.from(ExpirationUtil.getExpirationAbbreviatedDisplayValue(requireContext(), state.universalExpireTimer)),
|
||||||
clickPreference = ClickPreference(
|
clickPreference = ClickPreference(
|
||||||
title = DSLSettingsText.from(R.string.PrivacySettingsFragment__default_timer_for_new_changes),
|
title = DSLSettingsText.from(R.string.PrivacySettingsFragment__default_timer_for_new_changes),
|
||||||
summary = DSLSettingsText.from(R.string.PrivacySettingsFragment__set_a_default_disappearing_message_timer_for_all_new_chats_started_by_you),
|
summary = DSLSettingsText.from(R.string.PrivacySettingsFragment__set_a_default_disappearing_message_timer_for_all_new_chats_started_by_you),
|
||||||
onClick = {
|
onClick = {
|
||||||
NavHostFragment.findNavController(this@PrivacySettingsFragment).navigate(R.id.action_privacySettingsFragment_to_disappearingMessagesTimerSelectFragment)
|
NavHostFragment.findNavController(this@PrivacySettingsFragment).navigate(R.id.action_privacySettingsFragment_to_disappearingMessagesTimerSelectFragment)
|
||||||
}
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
}
|
||||||
|
|
||||||
dividerPref()
|
dividerPref()
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
|||||||
import org.thoughtcrime.securesms.preferences.widgets.NotificationPrivacyPreference;
|
import org.thoughtcrime.securesms.preferences.widgets.NotificationPrivacyPreference;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
import org.thoughtcrime.securesms.storage.StorageSyncHelper;
|
import org.thoughtcrime.securesms.storage.StorageSyncHelper;
|
||||||
|
import org.thoughtcrime.securesms.util.FeatureFlags;
|
||||||
import org.thoughtcrime.securesms.util.SingleLiveEvent;
|
import org.thoughtcrime.securesms.util.SingleLiveEvent;
|
||||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||||
import org.signal.core.util.logging.Log;
|
import org.signal.core.util.logging.Log;
|
||||||
@@ -380,7 +381,11 @@ public final class SettingsValues extends SignalStoreValues {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getUniversalExpireTimer() {
|
public int getUniversalExpireTimer() {
|
||||||
return getInteger(UNIVERSAL_EXPIRE_TIMER, 0);
|
if (FeatureFlags.defaultMessageTimer()) {
|
||||||
|
return getInteger(UNIVERSAL_EXPIRE_TIMER, 0);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private @Nullable Uri getUri(@NonNull String key) {
|
private @Nullable Uri getUri(@NonNull String key) {
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ public final class FeatureFlags {
|
|||||||
private static final String MP4_GIF_SEND_SUPPORT = "android.mp4GifSendSupport";
|
private static final String MP4_GIF_SEND_SUPPORT = "android.mp4GifSendSupport";
|
||||||
private static final String MEDIA_QUALITY_LEVELS = "android.mediaQuality.levels";
|
private static final String MEDIA_QUALITY_LEVELS = "android.mediaQuality.levels";
|
||||||
private static final String GROUPS_V2_DESCRIPTION_VERSION = "android.groupsv2.descriptionVersion";
|
private static final String GROUPS_V2_DESCRIPTION_VERSION = "android.groupsv2.descriptionVersion";
|
||||||
|
private static final String DEFAULT_MESSAGE_TIMER = "android.defaultMessageTimer";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We will only store remote values for flags in this set. If you want a flag to be controllable
|
* We will only store remote values for flags in this set. If you want a flag to be controllable
|
||||||
@@ -115,7 +116,8 @@ public final class FeatureFlags {
|
|||||||
NOTIFICATION_REWRITE,
|
NOTIFICATION_REWRITE,
|
||||||
MP4_GIF_SEND_SUPPORT,
|
MP4_GIF_SEND_SUPPORT,
|
||||||
MEDIA_QUALITY_LEVELS,
|
MEDIA_QUALITY_LEVELS,
|
||||||
GROUPS_V2_DESCRIPTION_VERSION
|
GROUPS_V2_DESCRIPTION_VERSION,
|
||||||
|
DEFAULT_MESSAGE_TIMER
|
||||||
);
|
);
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -162,7 +164,8 @@ public final class FeatureFlags {
|
|||||||
NOTIFICATION_REWRITE,
|
NOTIFICATION_REWRITE,
|
||||||
MP4_GIF_SEND_SUPPORT,
|
MP4_GIF_SEND_SUPPORT,
|
||||||
MEDIA_QUALITY_LEVELS,
|
MEDIA_QUALITY_LEVELS,
|
||||||
GROUPS_V2_DESCRIPTION_VERSION
|
GROUPS_V2_DESCRIPTION_VERSION,
|
||||||
|
DEFAULT_MESSAGE_TIMER
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -366,6 +369,10 @@ public final class FeatureFlags {
|
|||||||
return getVersionFlag(GROUPS_V2_DESCRIPTION_VERSION) == VersionFlag.ON;
|
return getVersionFlag(GROUPS_V2_DESCRIPTION_VERSION) == VersionFlag.ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean defaultMessageTimer() {
|
||||||
|
return getBoolean(DEFAULT_MESSAGE_TIMER, false);
|
||||||
|
}
|
||||||
|
|
||||||
/** Only for rendering debug info. */
|
/** Only for rendering debug info. */
|
||||||
public static synchronized @NonNull Map<String, Object> getMemoryValues() {
|
public static synchronized @NonNull Map<String, Object> getMemoryValues() {
|
||||||
return new TreeMap<>(REMOTE_VALUES);
|
return new TreeMap<>(REMOTE_VALUES);
|
||||||
|
|||||||
Reference in New Issue
Block a user