-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathApp.tsx
More file actions
139 lines (115 loc) · 3.09 KB
/
App.tsx
File metadata and controls
139 lines (115 loc) · 3.09 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
*/
import React, {useState} from 'react';
import type {PropsWithChildren} from 'react';
import {
Alert,
PermissionsAndroid,
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
Text,
useColorScheme,
View,
} from 'react-native';
import {
Colors,
DebugInstructions,
Header,
LearnMoreLinks,
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
import SplashScreen from 'react-native-splash-screen';
import AnimatedViewBirthday from './AnimatedViewBirthday';
import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import AsyncStorage from '@react-native-async-storage/async-storage';
import realm from './src/localDB/document';
import * as repository from './src/localDB/document';
import messaging from '@react-native-firebase/messaging';
import PushNotification from "react-native-push-notification";
import Main from './Main'
import { create } from 'react-test-renderer';
//import {requestUserPermission, notificationListener} from "./src/utils/PushNotification";
import * as Sentry from '@sentry/react-native';
const Stack = createNativeStackNavigator();
/**
* AsyncStorage, Realm 초기화
*/
const initiailze = () => {
AsyncStorage.removeItem('@UserInfo:isRegistered');
const deleteAll = () => {
realm.deleteAll(); // 얘는 웬만하면 사용 안하는걸로 ..! 여기만 예외적으로 사용할 가능성이 있슴다
console.log("delete all finished");
}
realm.write(() => {
deleteAll();
});
}
function App(): JSX.Element {
const [isRegistered, setIsRegistered] = useState(false);
const isDarkMode = useColorScheme() === 'dark';
const backgroundStyle = {
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
};
//initiailze(); //처음에는 주석 해제하고 실행해서 초기화 한 다음에 바로 껐다가, 주석 처리하고 다시 실행합시다!
AsyncStorage.getItem('@UserInfo:isRegistered',(err,result)=>{
if(result!==null)
{
setIsRegistered(true);
}
});
(async () => {
// Do something before delay
await new Promise(f => setTimeout(f, 300));
SplashScreen.hide();
// Do something after
}
)();
if (isRegistered) {
repository.updatePushedStampCount(); // db 4->5 migration
console.log("isRegistered: " + isRegistered);
return (
<SafeAreaView style={styles.container}>
<Main/>
</SafeAreaView>
);
}
else
{
return (
<SafeAreaView style={styles.container}>
<AnimatedViewBirthday/>
</SafeAreaView>
);
}
}
const styles = StyleSheet.create({
sectionContainer: {
marginTop: 32,
paddingHorizontal: 24,
backgroundColor:"#FFFFFF",
},
sectionTitle: {
fontSize: 24,
fontWeight: '600',
},
sectionDescription: {
marginTop: 8,
fontSize: 18,
fontWeight: '400',
},
highlight: {
fontWeight: '700',
},
container: {
flex: 1,
},
});
// export default App;
export default Sentry.wrap(App);