This commit is contained in:
xmflsct 2023-04-17 23:57:23 +02:00
parent 91596a46c4
commit a4152a5bb6
4 changed files with 9 additions and 23 deletions

View File

@ -22,7 +22,6 @@ import * as AuthSession from 'expo-auth-session'
import * as Crypto from 'expo-crypto'
import { Image } from 'expo-image'
import * as Linking from 'expo-linking'
import * as WebBrowser from 'expo-web-browser'
import { debounce } from 'lodash'
import React, { RefObject, useCallback, useState } from 'react'
import { Trans, useTranslation } from 'react-i18next'
@ -30,6 +29,7 @@ import { Alert, KeyboardAvoidingView, Platform, TextInput, View } from 'react-na
import { ScrollView } from 'react-native-gesture-handler'
import { fromByteArray } from 'react-native-quick-base64'
import CustomText from '../Text'
import openLink from '@components/openLink'
export interface Props {
scrollViewRef?: RefObject<ScrollView>
@ -386,20 +386,12 @@ const ComponentInstance: React.FC<Props> = ({
<CustomText
accessible
style={{ color: colors.blue }}
onPress={async () =>
WebBrowser.openBrowserAsync('https://tooot.app/privacy-policy', {
...(await browserPackage())
})
}
onPress={async () => openLink('https://tooot.app/privacy-policy')}
/>,
<CustomText
accessible
style={{ color: colors.blue }}
onPress={async () =>
WebBrowser.openBrowserAsync('https://tooot.app/terms-of-service', {
...(await browserPackage())
})
}
onPress={async () => openLink('https://tooot.app/terms-of-service')}
/>
]}
/>

View File

@ -8,6 +8,7 @@ import { QueryKeyStatus } from '@utils/queryHooks/status'
import { getGlobalStorage } from '@utils/storage/actions'
import * as Linking from 'expo-linking'
import * as WebBrowser from 'expo-web-browser'
import { WebBrowserPresentationStyle } from 'expo-web-browser'
const openLink = async (url: string, navigation?: any) => {
const handleNavigation = (page: 'Tab-Shared-Toot' | 'Tab-Shared-Account', options: any) => {
@ -74,6 +75,7 @@ const openLink = async (url: string, navigation?: any) => {
default:
await WebBrowser.openBrowserAsync(url.trim(), {
dismissButtonStyle: 'close',
presentationStyle: WebBrowserPresentationStyle.AUTOMATIC,
enableBarCollapsing: true,
...(await browserPackage())
}).catch(() => Linking.openURL(url.trim()))

View File

@ -3,11 +3,11 @@ import Icon from '@components/Icon'
import { Loading } from '@components/Loading'
import { MenuContainer, MenuRow } from '@components/Menu'
import { displayMessage } from '@components/Message'
import openLink from '@components/openLink'
import CustomText from '@components/Text'
import * as Sentry from '@sentry/react-native'
import apiInstance from '@utils/api/instance'
import apiTooot, { TOOOT_API_DOMAIN } from '@utils/api/tooot'
import browserPackage from '@utils/helpers/browserPackage'
import { PUSH_ADMIN, PUSH_DEFAULT, setChannels } from '@utils/push/constants'
import { updateExpoToken } from '@utils/push/updateExpoToken'
import { useAppsQuery } from '@utils/queryHooks/apps'
@ -18,7 +18,6 @@ import layoutAnimation from '@utils/styles/layoutAnimation'
import { useTheme } from '@utils/styles/ThemeManager'
import * as Crypto from 'expo-crypto'
import * as Notifications from 'expo-notifications'
import * as WebBrowser from 'expo-web-browser'
import React, { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { AppState, Linking, Platform, ScrollView, View } from 'react-native'
@ -271,11 +270,7 @@ const TabMePush: React.FC = () => {
<MenuRow
title={t('me.push.howitworks')}
iconBack='external-link'
onPress={async () =>
WebBrowser.openBrowserAsync('https://tooot.app/how-push-works', {
...(await browserPackage())
})
}
onPress={async () => openLink('https://tooot.app/how-push-works')}
/>
</MenuContainer>
<MenuContainer children={alerts()} />

View File

@ -1,13 +1,12 @@
import Icon from '@components/Icon'
import { MenuContainer, MenuRow } from '@components/Menu'
import openLink from '@components/openLink'
import { useNavigation } from '@react-navigation/native'
import browserPackage from '@utils/helpers/browserPackage'
import { getAccountStorage, useGlobalStorage } from '@utils/storage/actions'
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import Constants from 'expo-constants'
import * as Linking from 'expo-linking'
import * as WebBrowser from 'expo-web-browser'
import React from 'react'
import { useTranslation } from 'react-i18next'
import { Platform } from 'react-native'
@ -60,9 +59,7 @@ const SettingsTooot: React.FC = () => {
']'
})
} else {
WebBrowser.openBrowserAsync('https://social.xmflsct.com/@tooot', {
...(await browserPackage())
})
openLink('https://social.xmflsct.com/@tooot')
}
}}
/>