diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/app-info.ts | 15 | ||||
-rw-r--r-- | src/lib/app-info.web.ts | 14 | ||||
-rw-r--r-- | src/view/screens/Settings/index.tsx | 30 |
3 files changed, 37 insertions, 22 deletions
diff --git a/src/lib/app-info.ts b/src/lib/app-info.ts index af265bfcb..47c57d171 100644 --- a/src/lib/app-info.ts +++ b/src/lib/app-info.ts @@ -4,7 +4,16 @@ export const BUILD_ENV = process.env.EXPO_PUBLIC_ENV export const IS_DEV = process.env.EXPO_PUBLIC_ENV === 'development' export const IS_TESTFLIGHT = process.env.EXPO_PUBLIC_ENV === 'testflight' -const UPDATES_CHANNEL = IS_TESTFLIGHT ? 'testflight' : 'production' -export const appVersion = `${nativeApplicationVersion} (${nativeBuildVersion}, ${ - IS_DEV ? 'development' : UPDATES_CHANNEL +// This is the commit hash that the current bundle was made from. The user can see the commit hash in the app's settings +// along with the other version info. Useful for debugging/reporting. +export const BUNDLE_IDENTIFIER = process.env.EXPO_PUBLIC_COMMIT_HASH ?? 'dev' + +// This will always be in the format of YYMMDD, so that it always increases for each build. This should only be used +// for Statsig reporting and shouldn't be used to identify a specific bundle. +export const BUNDLE_DATE = + IS_TESTFLIGHT || IS_DEV ? 0 : Number(process.env.EXPO_PUBLIC_BUNDLE_DATE) + +export const appVersion = `${nativeApplicationVersion}.${nativeBuildVersion}` +export const bundleInfo = `${BUNDLE_IDENTIFIER} (${ + IS_DEV ? 'dev' : IS_TESTFLIGHT ? 'tf' : 'prod' })` diff --git a/src/lib/app-info.web.ts b/src/lib/app-info.web.ts index 5739b8783..9a83953c1 100644 --- a/src/lib/app-info.web.ts +++ b/src/lib/app-info.web.ts @@ -1,2 +1,16 @@ import {version} from '../../package.json' + +export const IS_DEV = process.env.EXPO_PUBLIC_ENV === 'development' + +// This is the commit hash that the current bundle was made from. The user can see the commit hash in the app's settings +// along with the other version info. Useful for debugging/reporting. +export const BUNDLE_IDENTIFIER = process.env.EXPO_PUBLIC_COMMIT_HASH ?? 'dev' + +// This will always be in the format of YYMMDD, so that it always increases for each build. This should only be used +// for Statsig reporting and shouldn't be used to identify a specific bundle. +export const BUNDLE_DATE = IS_DEV + ? 0 + : Number(process.env.EXPO_PUBLIC_BUNDLE_DATE) + export const appVersion = version +export const bundleInfo = `${BUNDLE_IDENTIFIER} (${IS_DEV ? 'dev' : 'prod'})` diff --git a/src/view/screens/Settings/index.tsx b/src/view/screens/Settings/index.tsx index 6c8208351..c3864e5a9 100644 --- a/src/view/screens/Settings/index.tsx +++ b/src/view/screens/Settings/index.tsx @@ -1,6 +1,5 @@ import React from 'react' import { - Linking, Platform, Pressable, StyleSheet, @@ -40,7 +39,7 @@ import { import {useLoggedOutViewControls} from '#/state/shell/logged-out' import {useCloseAllActiveElements} from '#/state/util' import {useAnalytics} from 'lib/analytics/analytics' -import * as AppInfo from 'lib/app-info' +import {appVersion, BUNDLE_DATE, bundleInfo} from 'lib/app-info' import {STATUS_PAGE_URL} from 'lib/constants' import {useAccountSwitcher} from 'lib/hooks/useAccountSwitcher' import {useCustomPalette} from 'lib/hooks/useCustomPalette' @@ -256,7 +255,7 @@ export function SettingsScreen({}: Props) { const onPressBuildInfo = React.useCallback(() => { setStringAsync( - `Build version: ${AppInfo.appVersion}; Platform: ${Platform.OS}`, + `Build version: ${appVersion}; Bundle info: ${bundleInfo}; Bundle date: ${BUNDLE_DATE}; Platform: ${Platform.OS}`, ) Toast.show(_(msg`Copied build version to clipboard`)) }, [_]) @@ -293,10 +292,6 @@ export function SettingsScreen({}: Props) { navigation.navigate('AccessibilitySettings') }, [navigation]) - const onPressStatusPage = React.useCallback(() => { - Linking.openURL(STATUS_PAGE_URL) - }, []) - const onPressBirthday = React.useCallback(() => { birthdayControl.open() }, [birthdayControl]) @@ -870,17 +865,9 @@ export function SettingsScreen({}: Props) { accessibilityRole="button" onPress={onPressBuildInfo}> <Text type="sm" style={[styles.buildInfo, pal.textLight]}> - <Trans>Version {AppInfo.appVersion}</Trans> - </Text> - </TouchableOpacity> - <Text type="sm" style={[pal.textLight]}> - · - </Text> - <TouchableOpacity - accessibilityRole="button" - onPress={onPressStatusPage}> - <Text type="sm" style={[styles.buildInfo, pal.textLight]}> - <Trans>Status page</Trans> + <Trans> + Version {appVersion} {bundleInfo} + </Trans> </Text> </TouchableOpacity> </View> @@ -902,6 +889,12 @@ export function SettingsScreen({}: Props) { href="https://bsky.social/about/support/privacy-policy" text={_(msg`Privacy Policy`)} /> + <TextLink + type="md" + style={pal.link} + href={STATUS_PAGE_URL} + text={_(msg`Status Page`)} + /> </View> <View style={s.footerSpacer} /> </ScrollView> @@ -1047,7 +1040,6 @@ const styles = StyleSheet.create({ footer: { flex: 1, flexDirection: 'row', - alignItems: 'center', paddingLeft: 18, }, }) |