Show instance version

This commit is contained in:
Zhiyuan Zheng 2022-05-01 00:03:52 +02:00
parent dc91f3edeb
commit 902d4e6c3a
2 changed files with 22 additions and 11 deletions

View File

@ -267,7 +267,8 @@
"heading": "Help us improve",
"description": "Collecting only non-user relative usage"
},
"version": "Version v{{version}}"
"version": "Version v{{version}}",
"instanceVersion": "Mastodon version v{{version}}"
},
"switch": {
"existing": "Choose from logged in",

View File

@ -1,5 +1,6 @@
import { MenuContainer, MenuRow } from '@components/Menu'
import { useAppDispatch } from '@root/store'
import { getInstanceVersion } from '@utils/slices/instancesSlice'
import {
changeAnalytics,
getSettingsAnalytics
@ -9,7 +10,7 @@ import { useTheme } from '@utils/styles/ThemeManager'
import Constants from 'expo-constants'
import React from 'react'
import { useTranslation } from 'react-i18next'
import { StyleSheet, Text } from 'react-native'
import { Text } from 'react-native'
import { useSelector } from 'react-redux'
const SettingsAnalytics: React.FC = () => {
@ -18,6 +19,7 @@ const SettingsAnalytics: React.FC = () => {
const { t } = useTranslation('screenTabs')
const settingsAnalytics = useSelector(getSettingsAnalytics)
const instanceVersion = useSelector(getInstanceVersion, () => true)
return (
<MenuContainer>
@ -29,19 +31,27 @@ const SettingsAnalytics: React.FC = () => {
dispatch(changeAnalytics(!settingsAnalytics))
}
/>
<Text style={[styles.version, { color: colors.secondary }]}>
<Text
style={{
textAlign: 'center',
...StyleConstants.FontStyle.S,
marginTop: StyleConstants.Spacing.S,
color: colors.secondary
}}
>
{t('me.settings.version', { version: Constants.manifest?.version })}
</Text>
<Text
style={{
textAlign: 'center',
...StyleConstants.FontStyle.S,
color: colors.secondary
}}
>
{t('me.settings.instanceVersion', { version: instanceVersion })}
</Text>
</MenuContainer>
)
}
const styles = StyleSheet.create({
version: {
textAlign: 'center',
...StyleConstants.FontStyle.S,
marginTop: StyleConstants.Spacing.M
}
})
export default SettingsAnalytics