-
Notifications
You must be signed in to change notification settings - Fork 3k
/
Copy pathAboutPage.js
156 lines (150 loc) · 7.2 KB
/
AboutPage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import _ from 'underscore';
import React from 'react';
import {ScrollView, View} from 'react-native';
import DeviceInfo from 'react-native-device-info';
import HeaderWithBackButton from '../../../components/HeaderWithBackButton';
import Navigation from '../../../libs/Navigation/Navigation';
import ROUTES from '../../../ROUTES';
import styles from '../../../styles/styles';
import Text from '../../../components/Text';
import TextLink from '../../../components/TextLink';
import CONST from '../../../CONST';
import * as Expensicons from '../../../components/Icon/Expensicons';
import ScreenWrapper from '../../../components/ScreenWrapper';
import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize';
import withWindowDimensions, {windowDimensionsPropTypes} from '../../../components/withWindowDimensions';
import MenuItem from '../../../components/MenuItem';
import Logo from '../../../../assets/images/new-expensify.svg';
import pkg from '../../../../package.json';
import * as Report from '../../../libs/actions/Report';
import * as Link from '../../../libs/actions/Link';
import compose from '../../../libs/compose';
import * as ReportActionContextMenu from '../../home/report/ContextMenu/ReportActionContextMenu';
import {CONTEXT_MENU_TYPES} from '../../home/report/ContextMenu/ContextMenuActions';
import * as KeyboardShortcuts from '../../../libs/actions/KeyboardShortcuts';
import * as Environment from '../../../libs/Environment/Environment';
const propTypes = {
...withLocalizePropTypes,
...windowDimensionsPropTypes,
};
function getFlavor() {
const bundleId = DeviceInfo.getBundleId();
if (bundleId.includes('dev')) {
return ' Develop';
}
if (bundleId.includes('adhoc')) {
return ' Ad-Hoc';
}
return '';
}
function AboutPage(props) {
let popoverAnchor;
const menuItems = [
{
translationKey: 'initialSettingsPage.aboutPage.appDownloadLinks',
icon: Expensicons.Link,
action: () => {
Navigation.navigate(ROUTES.SETTINGS_APP_DOWNLOAD_LINKS);
},
},
{
translationKey: 'initialSettingsPage.aboutPage.viewKeyboardShortcuts',
icon: Expensicons.Keyboard,
action: KeyboardShortcuts.showKeyboardShortcutModal,
},
{
translationKey: 'initialSettingsPage.aboutPage.viewTheCode',
icon: Expensicons.Eye,
iconRight: Expensicons.NewWindow,
action: () => {
Link.openExternalLink(CONST.GITHUB_URL);
},
link: CONST.GITHUB_URL,
},
{
translationKey: 'initialSettingsPage.aboutPage.viewOpenJobs',
icon: Expensicons.MoneyBag,
iconRight: Expensicons.NewWindow,
action: () => {
Link.openExternalLink(CONST.UPWORK_URL);
},
link: CONST.UPWORK_URL,
},
{
translationKey: 'initialSettingsPage.aboutPage.reportABug',
icon: Expensicons.Bug,
action: Report.navigateToConciergeChat,
},
];
return (
<ScreenWrapper includeSafeAreaPaddingBottom={false}>
{({safeAreaPaddingBottomStyle}) => (
<>
<HeaderWithBackButton
title={props.translate('initialSettingsPage.about')}
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS)}
/>
<ScrollView contentContainerStyle={[styles.flexGrow1, styles.flexColumn, styles.justifyContentBetween, safeAreaPaddingBottomStyle]}>
<View style={[styles.flex1]}>
<View style={styles.pageWrapper}>
<View style={[styles.settingsPageBody, styles.mb6, styles.alignItemsCenter]}>
<Logo
height={80}
width={80}
/>
<Text
selectable
style={[styles.textLabel, styles.alignSelfCenter, styles.mt6, styles.mb2, styles.colorMuted]}
>
v{Environment.isInternalTestBuild() ? `${pkg.version} PR:${CONST.PULL_REQUEST_NUMBER}${getFlavor()}` : `${pkg.version}${getFlavor()}`}
</Text>
<Text style={[styles.baseFontStyle, styles.mv5]}>{props.translate('initialSettingsPage.aboutPage.description')}</Text>
</View>
</View>
{_.map(menuItems, (item) => (
<MenuItem
key={item.translationKey}
title={props.translate(item.translationKey)}
icon={item.icon}
iconRight={item.iconRight}
onPress={() => item.action()}
shouldBlockSelection={Boolean(item.link)}
onSecondaryInteraction={
!_.isEmpty(item.link) ? (e) => ReportActionContextMenu.showContextMenu(CONTEXT_MENU_TYPES.LINK, e, item.link, popoverAnchor) : undefined
}
ref={(el) => (popoverAnchor = el)}
shouldShowRightIcon
/>
))}
</View>
<View style={[styles.sidebarFooter]}>
<Text
style={[styles.chatItemMessageHeaderTimestamp]}
numberOfLines={1}
>
{props.translate('initialSettingsPage.readTheTermsAndPrivacy.phrase1')}{' '}
<TextLink
style={[styles.textMicroSupporting, styles.link]}
href={CONST.TERMS_URL}
>
{props.translate('initialSettingsPage.readTheTermsAndPrivacy.phrase2')}
</TextLink>{' '}
{props.translate('initialSettingsPage.readTheTermsAndPrivacy.phrase3')}{' '}
<TextLink
style={[styles.textMicroSupporting, styles.link]}
href={CONST.PRIVACY_URL}
>
{props.translate('initialSettingsPage.readTheTermsAndPrivacy.phrase4')}
</TextLink>
.
</Text>
</View>
</ScrollView>
</>
)}
</ScreenWrapper>
);
}
AboutPage.propTypes = propTypes;
AboutPage.displayName = 'AboutPage';
export default compose(withLocalize, withWindowDimensions)(AboutPage);