mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1import {Linking} from 'react-native'
2
3import {isNative, isWeb} from './detection'
4
5export async function getInitialURL(): Promise<string | undefined> {
6 if (isNative) {
7 const url = await Linking.getInitialURL()
8 if (url) {
9 return url
10 }
11 return undefined
12 } else {
13 // @ts-ignore window exists -prf
14 if (window.location.pathname !== '/') {
15 return window.location.pathname
16 }
17 return undefined
18 }
19}
20
21export function clearHash() {
22 if (isWeb) {
23 // @ts-ignore window exists -prf
24 window.location.hash = ''
25 }
26}