mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 10:20:25 +01:00
Add remote config for GIF keyboard page.
This commit is contained in:
@@ -291,6 +291,7 @@ import org.thoughtcrime.securesms.util.Debouncer
|
||||
import org.thoughtcrime.securesms.util.DeleteDialog
|
||||
import org.thoughtcrime.securesms.util.Dialogs
|
||||
import org.thoughtcrime.securesms.util.DrawableUtil
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags
|
||||
import org.thoughtcrime.securesms.util.FullscreenHelper
|
||||
import org.thoughtcrime.securesms.util.MediaUtil
|
||||
import org.thoughtcrime.securesms.util.MessageConstraintsUtil
|
||||
@@ -1658,7 +1659,7 @@ class ConversationFragment :
|
||||
val keyboardPage = when (keyboardMode) {
|
||||
TextSecurePreferences.MediaKeyboardMode.EMOJI -> if (isSystemEmojiPreferred) KeyboardPage.STICKER else KeyboardPage.EMOJI
|
||||
TextSecurePreferences.MediaKeyboardMode.STICKER -> KeyboardPage.STICKER
|
||||
TextSecurePreferences.MediaKeyboardMode.GIF -> KeyboardPage.GIF
|
||||
TextSecurePreferences.MediaKeyboardMode.GIF -> if (FeatureFlags.gifSearchAvailable()) KeyboardPage.GIF else KeyboardPage.STICKER
|
||||
}
|
||||
|
||||
inputPanel.setMediaKeyboardToggleMode(keyboardPage)
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.thoughtcrime.securesms.providers.BlobProvider;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags;
|
||||
import org.thoughtcrime.securesms.util.MediaUtil;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.thoughtcrime.securesms.util.views.SimpleProgressDialog;
|
||||
@@ -59,6 +60,9 @@ public class GiphyActivity extends PassphraseRequiredActivity implements Keyboar
|
||||
@SuppressLint("MissingInflatedId")
|
||||
@Override
|
||||
public void onCreate(Bundle bundle, boolean ready) {
|
||||
if (!FeatureFlags.gifSearchAvailable()) {
|
||||
finish();
|
||||
}
|
||||
setContentView(R.layout.giphy_activity);
|
||||
|
||||
final boolean forMms = getIntent().getBooleanExtra(EXTRA_IS_MMS, false);
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.signal.core.util.ThreadUtil
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.stickers.StickerSearchRepository
|
||||
import org.thoughtcrime.securesms.util.DefaultValueLiveData
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags
|
||||
|
||||
class KeyboardPagerViewModel : ViewModel() {
|
||||
|
||||
@@ -18,6 +19,11 @@ class KeyboardPagerViewModel : ViewModel() {
|
||||
if (SignalStore.settings().isPreferSystemEmoji) {
|
||||
startingPages.remove(KeyboardPage.EMOJI)
|
||||
}
|
||||
|
||||
if (!FeatureFlags.gifSearchAvailable()) {
|
||||
startingPages.remove(KeyboardPage.GIF)
|
||||
}
|
||||
|
||||
pages = DefaultValueLiveData(startingPages)
|
||||
page = DefaultValueLiveData(startingPages.first())
|
||||
|
||||
|
||||
@@ -119,6 +119,7 @@ public final class FeatureFlags {
|
||||
private static final String NOTIFICATION_THUMBNAIL_BLOCKLIST = "android.notificationThumbnailProductBlocklist";
|
||||
private static final String CALLING_RAISE_HAND = "android.calling.raiseHand";
|
||||
private static final String USE_ACTIVE_CALL_MANAGER = "android.calling.useActiveCallManager";
|
||||
private static final String GIF_SEARCH = "global.gifSearch";
|
||||
|
||||
/**
|
||||
* We will only store remote values for flags in this set. If you want a flag to be controllable
|
||||
@@ -190,7 +191,8 @@ public final class FeatureFlags {
|
||||
NOTIFICATION_THUMBNAIL_BLOCKLIST,
|
||||
CALLING_RAISE_HAND,
|
||||
PHONE_NUMBER_PRIVACY,
|
||||
USE_ACTIVE_CALL_MANAGER
|
||||
USE_ACTIVE_CALL_MANAGER,
|
||||
GIF_SEARCH
|
||||
);
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -686,6 +688,11 @@ public final class FeatureFlags {
|
||||
return getBoolean(USE_ACTIVE_CALL_MANAGER, false);
|
||||
}
|
||||
|
||||
/** Whether the in-app GIF search is available for use. */
|
||||
public static boolean gifSearchAvailable() {
|
||||
return getBoolean(GIF_SEARCH, true);
|
||||
}
|
||||
|
||||
/** Only for rendering debug info. */
|
||||
public static synchronized @NonNull Map<String, Object> getMemoryValues() {
|
||||
return new TreeMap<>(REMOTE_VALUES);
|
||||
|
||||
Reference in New Issue
Block a user