tooot/src/screens/Tabs/Me/Settings/Tooot.tsx

71 lines
2.5 KiB
TypeScript
Raw Normal View History

2021-01-27 00:35:34 +01:00
import Icon from '@components/Icon'
import { MenuContainer, MenuRow } from '@components/Menu'
2023-04-17 23:57:23 +02:00
import openLink from '@components/openLink'
2021-01-27 00:35:34 +01:00
import { useNavigation } from '@react-navigation/native'
import { getAccountStorage, useGlobalStorage } from '@utils/storage/actions'
2021-01-27 00:35:34 +01:00
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import Constants from 'expo-constants'
2021-01-27 00:35:34 +01:00
import * as Linking from 'expo-linking'
import React from 'react'
import { useTranslation } from 'react-i18next'
2022-11-17 21:48:22 +01:00
import { Platform } from 'react-native'
2021-01-27 00:35:34 +01:00
const SettingsTooot: React.FC = () => {
2021-08-29 15:25:38 +02:00
const navigation = useNavigation<any>()
2022-02-12 14:51:01 +01:00
const { colors } = useTheme()
2021-03-28 23:31:10 +02:00
const { t } = useTranslation('screenTabs')
2021-01-27 00:35:34 +01:00
const [accountActive] = useGlobalStorage.string('account.active')
const [expoToken] = useGlobalStorage.string('app.expo_token')
2022-11-17 21:48:22 +01:00
2021-01-27 00:35:34 +01:00
return (
<MenuContainer>
2022-12-08 00:11:03 +01:00
<MenuRow
title={t('me.settings.support.heading')}
content={<Icon name='heart' size={StyleConstants.Font.Size.M} color={colors.red} />}
iconBack='chevron-right'
2022-12-08 00:11:03 +01:00
onPress={() => Linking.openURL('https://www.buymeacoffee.com/xmflsct')}
/>
2022-02-10 22:42:46 +01:00
<MenuRow
title={t('me.settings.feedback.heading')}
content={
<Icon name='message-square' size={StyleConstants.Font.Size.M} color={colors.secondary} />
2022-02-10 22:42:46 +01:00
}
iconBack='chevron-right'
2022-11-29 23:44:11 +01:00
onPress={() => Linking.openURL('https://feedback.tooot.app/feature-requests')}
2022-02-10 22:42:46 +01:00
/>
2021-01-27 00:35:34 +01:00
<MenuRow
2021-03-28 23:31:10 +02:00
title={t('me.settings.contact.heading')}
content={<Icon name='mail' size={StyleConstants.Font.Size.M} color={colors.secondary} />}
iconBack='chevron-right'
2022-12-04 00:35:13 +01:00
onPress={async () => {
if (accountActive) {
2021-01-30 01:29:15 +01:00
navigation.navigate('Screen-Compose', {
2021-01-27 00:35:34 +01:00
type: 'conversation',
2022-11-17 21:48:22 +01:00
accts: ['tooot@xmflsct.com'],
2022-12-04 13:26:36 +01:00
visibility: 'direct',
2022-11-17 21:48:22 +01:00
text:
'[' +
`${Platform.OS}/${Platform.Version}` +
' - ' +
(Constants.expoConfig?.version ? `t/${Constants.expoConfig?.version}` : '') +
' - ' +
`m/${getAccountStorage.string('version')}` +
2022-11-17 21:48:22 +01:00
' - ' +
(expoToken?.length
2022-11-17 21:48:22 +01:00
? `e/${expoToken.replace(/^ExponentPushToken\[/, '').replace(/\]$/, '')}`
: '') +
']'
2021-01-27 00:35:34 +01:00
})
} else {
2023-04-17 23:57:23 +02:00
openLink('https://social.xmflsct.com/@tooot')
2021-01-27 00:35:34 +01:00
}
}}
/>
</MenuContainer>
)
}
export default SettingsTooot