-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
106 lines (76 loc) · 2.12 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import React, { useEffect, useState } from 'react';
import AsyncStorage from '@react-native-async-storage/async-storage';
import moment, { unix } from 'moment/moment';
import * as Linking from'expo-linking';
import { AuthContext, AuthProvider } from './helpers/AuthStatus';
import AuthModalScreen from './screens/AuthModal.screen';
import MainScreen from './MainScreen';
import { Text } from 'react-native';
// const prefix1 = Linking.createURL('/')
// const prefix2 = "https://"
// const linking = {
// prefixes: [prefix1, prefix2],
// config: {
// screens: {
// VerifyEmail: {
// path: 'verify-email:token'
// }
// }
// }
// }
const checkers = async() => {
try{
let jsonVal = await AsyncStorage.getItem('userInfo');
return jsonVal != null ? JSON.parse(jsonVal) : false;
} catch(err) {
//
}
}
const userAccessExist = (memur) => {
if(memur && memur !== "false") {
if(!memur.tokens.access.expires) {
return false;
}
else if (memur.tokens.access.expires <= moment().unix()){
return false;
}
else {
return true;
}
}
else {
return false;
}
}
const determineAccess = checkers().then((data) => {
return userAccessExist(data);
})
.catch((err) => {
console.warn(err)
}
);
export default function App() {
// const [deeepLink, setDeeepLink] = useState();
// const handleDeepLink = (event) => {
// let data = Linking.parse(event.url)
// setDeeepLink(data);
// }
// useEffect(() => {
// async function getInitialURL() {
// const initialURL = await Linking.getInitialURL();
// if(initialURL) setDeeepLink(Linking.parse(initialURL));
// }
// Linking.addEventListener("url", handleDeepLink)
// if(!deeepLink) {
// getInitialURL();
// }
// }, [])
// console.warn("tada",deeepLink, "tada")
return (
<AuthProvider>
{/* <Text>{deeepLink}</Text> */}
<AuthModalScreen />
<MainScreen />
</AuthProvider>
);
}