mirror of https://github.com/tooot-app/app
Fix #489
This commit is contained in:
parent
eda77fd7fc
commit
75800598c2
|
@ -5,7 +5,9 @@ import { TabMeStackNavigationProp } from '@utils/navigation/navigators'
|
||||||
import addInstance from '@utils/slices/instances/add'
|
import addInstance from '@utils/slices/instances/add'
|
||||||
import { checkInstanceFeature } from '@utils/slices/instancesSlice'
|
import { checkInstanceFeature } from '@utils/slices/instancesSlice'
|
||||||
import * as AuthSession from 'expo-auth-session'
|
import * as AuthSession from 'expo-auth-session'
|
||||||
|
import * as WebBrowser from 'expo-web-browser'
|
||||||
import React, { useEffect } from 'react'
|
import React, { useEffect } from 'react'
|
||||||
|
import { Platform } from 'react-native'
|
||||||
import { useQueryClient } from 'react-query'
|
import { useQueryClient } from 'react-query'
|
||||||
import { useSelector } from 'react-redux'
|
import { useSelector } from 'react-redux'
|
||||||
|
|
||||||
|
@ -24,14 +26,11 @@ const InstanceAuth = React.memo(
|
||||||
useProxy: false
|
useProxy: false
|
||||||
})
|
})
|
||||||
|
|
||||||
const navigation =
|
const navigation = useNavigation<TabMeStackNavigationProp<'Tab-Me-Root' | 'Tab-Me-Switch'>>()
|
||||||
useNavigation<TabMeStackNavigationProp<'Tab-Me-Root' | 'Tab-Me-Switch'>>()
|
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const dispatch = useAppDispatch()
|
const dispatch = useAppDispatch()
|
||||||
|
|
||||||
const deprecateAuthFollow = useSelector(
|
const deprecateAuthFollow = useSelector(checkInstanceFeature('deprecate_auth_follow'))
|
||||||
checkInstanceFeature('deprecate_auth_follow')
|
|
||||||
)
|
|
||||||
const [request, response, promptAsync] = AuthSession.useAuthRequest(
|
const [request, response, promptAsync] = AuthSession.useAuthRequest(
|
||||||
{
|
{
|
||||||
clientId: appData.clientId,
|
clientId: appData.clientId,
|
||||||
|
@ -48,7 +47,15 @@ const InstanceAuth = React.memo(
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
;(async () => {
|
;(async () => {
|
||||||
if (request?.clientId) {
|
if (request?.clientId) {
|
||||||
await promptAsync()
|
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))
|
||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
}, [request])
|
}, [request])
|
||||||
|
|
Loading…
Reference in New Issue