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

View File

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

View File

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

View File

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