about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAnsh <anshnanda10@gmail.com>2023-06-08 12:40:20 -0700
committerGitHub <noreply@github.com>2023-06-08 14:40:20 -0500
commit6a967cce000b2f289460d6ab78e1de27e10ec6c7 (patch)
treed021213c380baef91dc19f09d014bb664d04babe
parentb3e78017963934d32539c884d435a37aa1447974 (diff)
downloadvoidsky-6a967cce000b2f289460d6ab78e1de27e10ec6c7.tar.zst
make build version text copy on press (#862)
-rw-r--r--src/view/screens/Settings.tsx19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/view/screens/Settings.tsx b/src/view/screens/Settings.tsx
index 52be35a48..9b9a3deea 100644
--- a/src/view/screens/Settings.tsx
+++ b/src/view/screens/Settings.tsx
@@ -1,6 +1,7 @@
 import React from 'react'
 import {
   ActivityIndicator,
+  Platform,
   Pressable,
   StyleSheet,
   TextStyle,
@@ -39,6 +40,7 @@ import {isDesktopWeb} from 'platform/detection'
 import {pluralize} from 'lib/strings/helpers'
 import {formatCount} from 'view/com/util/numeric/format'
 import {isColorMode} from 'state/models/ui/shell'
+import Clipboard from '@react-native-clipboard/clipboard'
 
 type Props = NativeStackScreenProps<CommonNavigatorParams, 'Settings'>
 export const SettingsScreen = withAuthRequired(
@@ -148,6 +150,13 @@ export const SettingsScreen = withAuthRequired(
       Toast.show('Preferences reset')
     }, [store])
 
+    const onPressBuildInfo = React.useCallback(() => {
+      Clipboard.setString(
+        `Build version: ${AppInfo.appVersion}; Platform: ${Platform.OS}`,
+      )
+      Toast.show('Copied build version to clipboard')
+    }, [])
+
     return (
       <View style={[s.hContentRegion]} testID="settingsScreen">
         <ViewHeader title="Settings" />
@@ -444,9 +453,13 @@ export const SettingsScreen = withAuthRequired(
               </Text>
             </Link>
           ) : null}
-          <Text type="sm" style={[styles.buildInfo, pal.textLight]}>
-            Build version {AppInfo.appVersion} {AppInfo.updateChannel}
-          </Text>
+          <TouchableOpacity
+            accessibilityRole="button"
+            onPress={onPressBuildInfo}>
+            <Text type="sm" style={[styles.buildInfo, pal.textLight]}>
+              Build version {AppInfo.appVersion} {AppInfo.updateChannel}
+            </Text>
+          </TouchableOpacity>
           <View style={s.footerSpacer} />
         </ScrollView>
       </View>