diff --git a/suite-native/accounts/package.json b/suite-native/accounts/package.json index 160af400fc0b..a4b22205d470 100644 --- a/suite-native/accounts/package.json +++ b/suite-native/accounts/package.json @@ -24,6 +24,7 @@ "@suite-common/wallet-utils": "workspace:*", "@suite-native/atoms": "workspace:*", "@suite-native/ethereum-tokens": "workspace:*", + "@suite-native/feature-flags": "workspace:*", "@suite-native/fiat-rates": "workspace:*", "@suite-native/formatters": "workspace:*", "@suite-native/forms": "workspace:*", diff --git a/suite-native/accounts/src/components/AddAccountsButton.tsx b/suite-native/accounts/src/components/AddAccountsButton.tsx index f29a9214f63f..80090ecfa4ed 100644 --- a/suite-native/accounts/src/components/AddAccountsButton.tsx +++ b/suite-native/accounts/src/components/AddAccountsButton.tsx @@ -11,9 +11,12 @@ import { } from '@suite-native/navigation'; import { IconButton } from '@suite-native/atoms'; import { selectIsPortfolioTrackerDevice } from '@suite-common/wallet-core'; +import { FeatureFlag, useFeatureFlag } from '@suite-native/feature-flags'; export const AddAccountButton = () => { const isSelectedDevicePortfolioTracker = useSelector(selectIsPortfolioTrackerDevice); + const [isAddCoinAccountEnabled] = useFeatureFlag(FeatureFlag.IsAddCoinAccountEnabled); + const [isDeviceConnectEnabled] = useFeatureFlag(FeatureFlag.IsDeviceConnectEnabled); const navigation = useNavigation>(); @@ -23,13 +26,16 @@ export const AddAccountButton = () => { }); }; - const navigateToAddCoinAccount = () => - navigation.navigate(RootStackRoutes.AddCoinAccountStack, { - screen: AddCoinAccountStackRoutes.AddCoinAccount, - params: { - flowType: 'accounts', - }, - }); + const navigateToAddCoinAccount = () => { + if (isDeviceConnectEnabled && isAddCoinAccountEnabled) { + navigation.navigate(RootStackRoutes.AddCoinAccountStack, { + screen: AddCoinAccountStackRoutes.AddCoinAccount, + params: { + flowType: 'accounts', + }, + }); + } + }; return ( { @@ -72,6 +77,13 @@ export const SearchableAccountsListScreenHeader = ({ }; }; + const shouldShowAddAccountButton = + isSelectedDevicePortfolioTracker || + (isAddCoinAccountEnabled && + isDeviceConnectEnabled && + !areAllDevicesDisconnectedOrAccountless && + !discovery); + return ( {isSearchActive ? ( @@ -86,10 +98,7 @@ export const SearchableAccountsListScreenHeader = ({ > - } + rightIcon={shouldShowAddAccountButton && } leftIcon={ = [ FeatureFlag.IsDeviceConnectEnabled, FeatureFlag.IsPassphraseEnabled, + FeatureFlag.IsAddCoinAccountEnabled, ]; export const featureFlagsSlice = createSlice({ diff --git a/suite-native/module-dev-utils/src/components/FeatureFlags.tsx b/suite-native/module-dev-utils/src/components/FeatureFlags.tsx index c9c64d46b179..1857ee565a09 100644 --- a/suite-native/module-dev-utils/src/components/FeatureFlags.tsx +++ b/suite-native/module-dev-utils/src/components/FeatureFlags.tsx @@ -4,6 +4,7 @@ import { FeatureFlag as FeatureFlagEnum, useFeatureFlag } from '@suite-native/fe const featureFlagsTitleMap = { [FeatureFlagEnum.IsDeviceConnectEnabled]: 'Connect device', [FeatureFlagEnum.IsPassphraseEnabled]: 'Passphrase', + [FeatureFlagEnum.IsAddCoinAccountEnabled]: 'Add account', } as const satisfies Record; const FeatureFlag = ({ featureFlag }: { featureFlag: FeatureFlagEnum }) => { diff --git a/yarn.lock b/yarn.lock index 6ce87a682e09..6d1dc66687dd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7765,6 +7765,7 @@ __metadata: "@suite-common/wallet-utils": "workspace:*" "@suite-native/atoms": "workspace:*" "@suite-native/ethereum-tokens": "workspace:*" + "@suite-native/feature-flags": "workspace:*" "@suite-native/fiat-rates": "workspace:*" "@suite-native/formatters": "workspace:*" "@suite-native/forms": "workspace:*"