1
0
mirror of https://github.com/tooot-app/app synced 2025-01-09 08:03:31 +01:00

Partially fix #237

This commit is contained in:
Zhiyuan Zheng 2022-02-22 23:38:08 +01:00
parent 46386cb579
commit 0a35aff8ef
2 changed files with 21 additions and 0 deletions

View File

@ -67,6 +67,9 @@
"settings": { "settings": {
"name": "App Settings" "name": "App Settings"
}, },
"webSettings": {
"name": "More Account Settings"
},
"switch": { "switch": {
"name": "Switch Account" "name": "Switch Account"
} }

View File

@ -1,11 +1,16 @@
import { MenuContainer, MenuRow } from '@components/Menu' import { MenuContainer, MenuRow } from '@components/Menu'
import { useNavigation } from '@react-navigation/native' import { useNavigation } from '@react-navigation/native'
import { getInstanceActive, getInstanceUrl } from '@utils/slices/instancesSlice'
import * as WebBrowser from 'expo-web-browser'
import React from 'react' import React from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { useSelector } from 'react-redux'
const Settings: React.FC = () => { const Settings: React.FC = () => {
const { t } = useTranslation('screenTabs') const { t } = useTranslation('screenTabs')
const navigation = useNavigation<any>() const navigation = useNavigation<any>()
const instanceActive = useSelector(getInstanceActive)
const url = useSelector(getInstanceUrl)
return ( return (
<MenuContainer> <MenuContainer>
@ -15,6 +20,19 @@ const Settings: React.FC = () => {
title={t('me.stacks.settings.name')} title={t('me.stacks.settings.name')}
onPress={() => navigation.navigate('Tab-Me-Settings')} onPress={() => navigation.navigate('Tab-Me-Settings')}
/> />
{instanceActive !== -1 ? (
<MenuRow
iconFront='Sliders'
iconBack='ExternalLink'
title={t('me.stacks.webSettings.name')}
onPress={() =>
WebBrowser.openAuthSessionAsync(
`https://${url}/settings/preferences`,
''
)
}
/>
) : null}
</MenuContainer> </MenuContainer>
) )
} }