mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Fix Android browser package
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import Button from '@components/Button'
|
||||
import Icon from '@components/Icon'
|
||||
import browserPackage from '@helpers/browserPackage'
|
||||
import { useAppsQuery } from '@utils/queryHooks/apps'
|
||||
import { useInstanceQuery } from '@utils/queryHooks/instance'
|
||||
import { getInstances } from '@utils/slices/instancesSlice'
|
||||
@ -254,13 +255,19 @@ const ComponentInstance: React.FC<Props> = ({
|
||||
<CustomText
|
||||
accessible
|
||||
style={{ color: colors.blue }}
|
||||
onPress={() => WebBrowser.openBrowserAsync('https://tooot.app/privacy-policy')}
|
||||
onPress={async () =>
|
||||
WebBrowser.openBrowserAsync('https://tooot.app/privacy-policy', {
|
||||
browserPackage: await browserPackage()
|
||||
})
|
||||
}
|
||||
/>,
|
||||
<CustomText
|
||||
accessible
|
||||
style={{ color: colors.blue }}
|
||||
onPress={() =>
|
||||
WebBrowser.openBrowserAsync('https://tooot.app/terms-of-service')
|
||||
onPress={async () =>
|
||||
WebBrowser.openBrowserAsync('https://tooot.app/terms-of-service', {
|
||||
browserPackage: await browserPackage()
|
||||
})
|
||||
}
|
||||
/>
|
||||
]}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import browserPackage from '@helpers/browserPackage'
|
||||
import { useNavigation } from '@react-navigation/native'
|
||||
import { useAppDispatch } from '@root/store'
|
||||
import { InstanceLatest } from '@utils/migrations/instances/migration'
|
||||
@ -5,9 +6,7 @@ import { TabMeStackNavigationProp } from '@utils/navigation/navigators'
|
||||
import addInstance from '@utils/slices/instances/add'
|
||||
import { checkInstanceFeature } from '@utils/slices/instancesSlice'
|
||||
import * as AuthSession from 'expo-auth-session'
|
||||
import * as WebBrowser from 'expo-web-browser'
|
||||
import React, { useEffect } from 'react'
|
||||
import { Platform } from 'react-native'
|
||||
import { useQueryClient } from 'react-query'
|
||||
import { useSelector } from 'react-redux'
|
||||
|
||||
@ -47,15 +46,7 @@ const InstanceAuth = React.memo(
|
||||
useEffect(() => {
|
||||
;(async () => {
|
||||
if (request?.clientId) {
|
||||
let browserPackage: string | undefined
|
||||
if (Platform.OS === 'android') {
|
||||
const tabsSupportingBrowsers = await WebBrowser.getCustomTabsSupportingBrowsersAsync()
|
||||
browserPackage =
|
||||
tabsSupportingBrowsers?.preferredBrowserPackage ||
|
||||
tabsSupportingBrowsers.browserPackages[0] ||
|
||||
tabsSupportingBrowsers.servicePackages[0]
|
||||
}
|
||||
await promptAsync({ browserPackage }).catch(e => console.log(e))
|
||||
await promptAsync({ browserPackage: await browserPackage() }).catch(e => console.log(e))
|
||||
}
|
||||
})()
|
||||
}, [request])
|
||||
|
@ -1,4 +1,5 @@
|
||||
import apiInstance from '@api/instance'
|
||||
import browserPackage from '@helpers/browserPackage'
|
||||
import navigationRef from '@helpers/navigationRef'
|
||||
import { matchAccount, matchStatus } from '@helpers/urlMatcher'
|
||||
import { store } from '@root/store'
|
||||
@ -91,7 +92,8 @@ const openLink = async (url: string, navigation?: any) => {
|
||||
case 'internal':
|
||||
await WebBrowser.openBrowserAsync(encodeURI(url), {
|
||||
dismissButtonStyle: 'close',
|
||||
enableBarCollapsing: true
|
||||
enableBarCollapsing: true,
|
||||
browserPackage: await browserPackage()
|
||||
})
|
||||
break
|
||||
case 'external':
|
||||
|
Reference in New Issue
Block a user