Implement full auth flow in iOS
This commit is contained in:
parent
81441c3c26
commit
07b92a2180
4 changed files with 76 additions and 25 deletions
|
@ -1,4 +1,5 @@
|
|||
import {isIOS, isAndroid} from './detection'
|
||||
import {Linking} from 'react-native'
|
||||
import {isIOS, isAndroid, isNative, isWeb} from './detection'
|
||||
|
||||
export function makeAppUrl(path = '') {
|
||||
if (isIOS) {
|
||||
|
@ -10,3 +11,27 @@ export function makeAppUrl(path = '') {
|
|||
return `${window.location.origin}${path}`
|
||||
}
|
||||
}
|
||||
|
||||
export function extractHashFragment(url: string): string {
|
||||
return url.split('#')[1] || ''
|
||||
}
|
||||
|
||||
export async function getInitialURL(): Promise<string> {
|
||||
if (isNative) {
|
||||
const url = await Linking.getInitialURL()
|
||||
if (url) {
|
||||
return url
|
||||
}
|
||||
return makeAppUrl()
|
||||
} else {
|
||||
// @ts-ignore window exists -prf
|
||||
return window.location.toString()
|
||||
}
|
||||
}
|
||||
|
||||
export function clearHash() {
|
||||
if (isWeb) {
|
||||
// @ts-ignore window exists -prf
|
||||
window.location.hash = ''
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue