Skip to content

Commit

Permalink
Update AppDownloadLinks.tsx
Browse files Browse the repository at this point in the history
Amended openAppDownloadLink and downloadLink in DownloadMenuItem back to action and link.

Returned to original, simplified logic for Navigation.goBack()
  • Loading branch information
hkopser99 authored Feb 14, 2024
1 parent 472f3d7 commit a3fbb23
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/pages/settings/AppDownloadLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ import * as ReportActionContextMenu from '@pages/home/report/ContextMenu/ReportA
import * as Link from '@userActions/Link';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import ROUTES from '@src/ROUTES';

type DownloadMenuItem = MenuItemProps & {
translationKey: TranslationPaths;
openAppDownloadLink: () => void;
downloadLink: string;
action: () => void;
link: string;
};

function AppDownloadLinksPage() {
Expand All @@ -29,28 +28,28 @@ function AppDownloadLinksPage() {
const menuItems: DownloadMenuItem[] = [
{
translationKey: 'initialSettingsPage.appDownloadLinks.android.label',
openAppDownloadLink: () => {
action: () => {
Link.openExternalLink(CONST.APP_DOWNLOAD_LINKS.ANDROID);
},
downloadLink: CONST.APP_DOWNLOAD_LINKS.ANDROID,
link: CONST.APP_DOWNLOAD_LINKS.ANDROID,
icon: Expensicons.Android,
iconRight: Expensicons.NewWindow,
},
{
translationKey: 'initialSettingsPage.appDownloadLinks.ios.label',
openAppDownloadLink: () => {
action: () => {
Link.openExternalLink(CONST.APP_DOWNLOAD_LINKS.IOS, true);
},
downloadLink: CONST.APP_DOWNLOAD_LINKS.IOS,
link: CONST.APP_DOWNLOAD_LINKS.IOS,
icon: Expensicons.Apple,
iconRight: Expensicons.NewWindow,
},
{
translationKey: 'initialSettingsPage.appDownloadLinks.desktop.label',
openAppDownloadLink: () => {
action: () => {
Link.openExternalLink(CONST.APP_DOWNLOAD_LINKS.DESKTOP);
},
downloadLink: CONST.APP_DOWNLOAD_LINKS.DESKTOP,
link: CONST.APP_DOWNLOAD_LINKS.DESKTOP,
icon: Expensicons.Monitor,
iconRight: Expensicons.NewWindow,
},
Expand All @@ -60,14 +59,14 @@ function AppDownloadLinksPage() {
<ScreenWrapper testID={AppDownloadLinksPage.displayName}>
<HeaderWithBackButton
title={translate('initialSettingsPage.aboutPage.appDownloadLinks')}
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_ABOUT)}
onBackButtonPress={() => Navigation.goBack()}
/>
<ScrollView style={[styles.mt3]}>
{menuItems.map((item: DownloadMenuItem) => (
<MenuItem
key={item.translationKey}
onPress={item.openAppDownloadLink}
onSecondaryInteraction={(e) => ReportActionContextMenu.showContextMenu(CONST.CONTEXT_MENU_TYPES.LINK, e, item.downloadLink, popoverAnchor.current)}
onPress={item.action}
onSecondaryInteraction={(e) => ReportActionContextMenu.showContextMenu(CONST.CONTEXT_MENU_TYPES.LINK, e, item.link, popoverAnchor.current)}
ref={popoverAnchor}
title={translate(item.translationKey)}
icon={item.icon}
Expand Down

0 comments on commit a3fbb23

Please sign in to comment.