Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide Subscriptions menu item on iOS and Android native #35953

Merged
merged 11 commits into from
Feb 6, 2024
8 changes: 8 additions & 0 deletions src/libs/ShouldShowSubscriptionsMenu/index.native.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type ShouldShowSubscriptionsMenu from './types';

/**
* Indicates whether the subscription menu should show in the all settings screen
*/
const shouldShowSubscriptionsMenu: ShouldShowSubscriptionsMenu = () => false;
eucool marked this conversation as resolved.
Show resolved Hide resolved

export default shouldShowSubscriptionsMenu;
8 changes: 8 additions & 0 deletions src/libs/ShouldShowSubscriptionsMenu/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type ShouldShowSubscriptionsMenu from './types';

/**
* Indicates whether the subscription menu should show in the all settings screen
*/
const shouldShowSubscriptionsMenu: ShouldShowSubscriptionsMenu = () => true;
eucool marked this conversation as resolved.
Show resolved Hide resolved

export default shouldShowSubscriptionsMenu;
3 changes: 3 additions & 0 deletions src/libs/ShouldShowSubscriptionsMenu/types.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type ShouldShowSubscriptionsMenu = () => boolean;
eucool marked this conversation as resolved.
Show resolved Hide resolved

export default ShouldShowSubscriptionsMenu;
5 changes: 3 additions & 2 deletions src/pages/home/sidebar/AllSettingsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type {TranslationPaths} from '@src/languages/types';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type {Policy, PolicyMembers} from '@src/types/onyx';
import shouldShowSubscriptionsMenu from '@libs/ShouldShowSubscriptionsMenu';

type AllSettingsScreenOnyxProps = {
policies: OnyxCollection<Policy>;
Expand Down Expand Up @@ -49,7 +50,7 @@ function AllSettingsScreen({policies, policyMembers}: AllSettingsScreenProps) {
focused: !isSmallScreenWidth,
brickRoadIndicator: hasGlobalWorkspaceSettingsRBR(policies, policyMembers) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined,
},
{
...(shouldShowSubscriptionsMenu() ? [{
eucool marked this conversation as resolved.
Show resolved Hide resolved
translationKey: 'allSettingsScreen.subscriptions',
icon: Expensicons.MoneyBag,
action: () => {
Expand All @@ -58,7 +59,7 @@ function AllSettingsScreen({policies, policyMembers}: AllSettingsScreenProps) {
shouldShowRightIcon: true,
iconRight: Expensicons.NewWindow,
link: CONST.OLDDOT_URLS.ADMIN_POLICIES_URL,
},
}] : []),
{
translationKey: 'allSettingsScreen.cardsAndDomains',
icon: Expensicons.CardsAndDomains,
Expand Down
Loading