feat: app version in settings
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import React from 'react'
|
||||
import { View } from 'react-native'
|
||||
import Constants from 'expo-constants'
|
||||
import * as Updates from 'expo-updates'
|
||||
import { Text, View } from 'react-native'
|
||||
import { SheetManager } from 'react-native-actions-sheet'
|
||||
import { responsiveHeight } from 'react-native-responsive-dimensions'
|
||||
import { background } from '../../assets'
|
||||
@@ -45,6 +47,17 @@ const SETTINGS = [
|
||||
},
|
||||
]
|
||||
|
||||
const getVersionLabel = () => {
|
||||
const appVersion = Constants.expoConfig?.version || 'inconnue'
|
||||
const updateId = typeof Updates.updateId === 'string' ? Updates.updateId.slice(0, 8) : null
|
||||
|
||||
if (updateId) {
|
||||
return `Version ${appVersion} · mise à jour ${updateId}`
|
||||
}
|
||||
|
||||
return `Version ${appVersion} · ${__DEV__ ? 'développement' : 'intégrée'}`
|
||||
}
|
||||
|
||||
const Settings = () => {
|
||||
const { onSignOut } = useUserData()
|
||||
|
||||
@@ -84,6 +97,18 @@ const Settings = () => {
|
||||
}}
|
||||
onPress={() => SheetManager.show('DeleteAccount')}
|
||||
/>
|
||||
<Text
|
||||
selectable
|
||||
style={{
|
||||
paddingTop: 8,
|
||||
color: Palette.white,
|
||||
fontSize: 11,
|
||||
opacity: 0.7,
|
||||
textAlign: 'center',
|
||||
}}
|
||||
>
|
||||
{getVersionLabel()}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
</Page>
|
||||
|
||||
Reference in New Issue
Block a user