From 33191a673c83650f4d69c2352b052aa05f94cba8 Mon Sep 17 00:00:00 2001 From: Ziad Saab Date: Tue, 7 Jan 2025 14:31:03 -0500 Subject: [PATCH] Introduce feature flag for new browsing experience --- .js.env.example | 3 +++ app/core/AppConstants.ts | 1 + app/util/browser/index.ts | 3 +++ 3 files changed, 7 insertions(+) diff --git a/.js.env.example b/.js.env.example index 325ee52559d..3be7b01c545 100644 --- a/.js.env.example +++ b/.js.env.example @@ -107,3 +107,6 @@ export MM_MULTICHAIN_V1_ENABLED="" # Permissions Settings feature flag specific to UI changes export MM_PERMISSIONS_SETTINGS_V1_ENABLED="" + +# Temporary feature flag to enable new browsing/explore experience. Set to "true" to enable. +export MM_NEW_BROWSING_EXPERIENCE_ENABLED="" \ No newline at end of file diff --git a/app/core/AppConstants.ts b/app/core/AppConstants.ts index 7d132663576..81bab3ae32c 100644 --- a/app/core/AppConstants.ts +++ b/app/core/AppConstants.ts @@ -222,4 +222,5 @@ export default { BASE_URL: 'https://client-config.api.cx.metamask.io', VERSION: 'v1', }, + MM_NEW_BROWSING_EXPERIENCE_ENABLED: process.env.MM_NEW_BROWSING_EXPERIENCE_ENABLED === 'true', } as const; diff --git a/app/util/browser/index.ts b/app/util/browser/index.ts index 2965bdd8ed4..b71b8100a22 100644 --- a/app/util/browser/index.ts +++ b/app/util/browser/index.ts @@ -2,6 +2,7 @@ import { Linking } from 'react-native'; import isUrl from 'is-url'; import Url from 'url-parse'; import { regex, hasProtocol } from '../../util/regex'; +import AppConstants from '../../core/AppConstants'; /** * Returns URL prefixed with protocol @@ -155,3 +156,5 @@ export const allowLinkOpen = (url: string) => .catch((e) => { console.warn(`Error opening URL: ${e}`); }); + +export const isNewBrowsingExperienceEnabled = () => AppConstants.MM_NEW_BROWSING_EXPERIENCE_ENABLED;