make build version text copy on press (#862)

zio/stable
Ansh 2023-06-08 12:40:20 -07:00 committed by GitHub
parent b3e7801796
commit 6a967cce00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 3 deletions

View File

@ -1,6 +1,7 @@
import React from 'react' import React from 'react'
import { import {
ActivityIndicator, ActivityIndicator,
Platform,
Pressable, Pressable,
StyleSheet, StyleSheet,
TextStyle, TextStyle,
@ -39,6 +40,7 @@ import {isDesktopWeb} from 'platform/detection'
import {pluralize} from 'lib/strings/helpers' import {pluralize} from 'lib/strings/helpers'
import {formatCount} from 'view/com/util/numeric/format' import {formatCount} from 'view/com/util/numeric/format'
import {isColorMode} from 'state/models/ui/shell' import {isColorMode} from 'state/models/ui/shell'
import Clipboard from '@react-native-clipboard/clipboard'
type Props = NativeStackScreenProps<CommonNavigatorParams, 'Settings'> type Props = NativeStackScreenProps<CommonNavigatorParams, 'Settings'>
export const SettingsScreen = withAuthRequired( export const SettingsScreen = withAuthRequired(
@ -148,6 +150,13 @@ export const SettingsScreen = withAuthRequired(
Toast.show('Preferences reset') Toast.show('Preferences reset')
}, [store]) }, [store])
const onPressBuildInfo = React.useCallback(() => {
Clipboard.setString(
`Build version: ${AppInfo.appVersion}; Platform: ${Platform.OS}`,
)
Toast.show('Copied build version to clipboard')
}, [])
return ( return (
<View style={[s.hContentRegion]} testID="settingsScreen"> <View style={[s.hContentRegion]} testID="settingsScreen">
<ViewHeader title="Settings" /> <ViewHeader title="Settings" />
@ -444,9 +453,13 @@ export const SettingsScreen = withAuthRequired(
</Text> </Text>
</Link> </Link>
) : null} ) : null}
<Text type="sm" style={[styles.buildInfo, pal.textLight]}> <TouchableOpacity
Build version {AppInfo.appVersion} {AppInfo.updateChannel} accessibilityRole="button"
</Text> onPress={onPressBuildInfo}>
<Text type="sm" style={[styles.buildInfo, pal.textLight]}>
Build version {AppInfo.appVersion} {AppInfo.updateChannel}
</Text>
</TouchableOpacity>
<View style={s.footerSpacer} /> <View style={s.footerSpacer} />
</ScrollView> </ScrollView>
</View> </View>