|
@@ -15,7 +15,6 @@ import { fetchUser } from '../../redux/actions/index'
|
15
|
15
|
import Constants from 'expo-constants';
|
16
|
16
|
import * as Notifications from 'expo-notifications';
|
17
|
17
|
|
18
|
|
-
|
19
|
18
|
Notifications.setNotificationHandler({
|
20
|
19
|
handleNotification: async () => ({
|
21
|
20
|
shouldShowAlert: true,
|
|
@@ -29,17 +28,12 @@ export function Home_page({navigation}) {
|
29
|
28
|
const [threads, setThreads] = useState([]);
|
30
|
29
|
const [loading, setLoading] = useState(true);
|
31
|
30
|
const [appointments, setAppointments] = useState([]);
|
32
|
|
-
|
33
|
|
- const [roomName, setRoomName] = useState('');
|
34
|
|
-
|
35
|
|
-
|
36
|
31
|
|
37
|
32
|
const [expoPushToken, setExpoPushToken] = useState('');
|
38
|
33
|
const [notification, setNotification] = useState(false);
|
39
|
34
|
const notificationListener = useRef();
|
40
|
35
|
const responseListener = useRef();
|
41
|
36
|
|
42
|
|
-
|
43
|
37
|
useEffect(() => {
|
44
|
38
|
registerForPushNotificationsAsync().then(token => setExpoPushToken(token));
|
45
|
39
|
notificationListener.current = Notifications.addNotificationReceivedListener(notification => {
|
|
@@ -77,15 +71,15 @@ export function Home_page({navigation}) {
|
77
|
71
|
Day:'',
|
78
|
72
|
Month:'',
|
79
|
73
|
Time:'',
|
|
74
|
+ i_id:'',
|
|
75
|
+ uid1:'',
|
80
|
76
|
...docSnap.data()
|
81
|
77
|
};
|
82
|
78
|
});
|
83
|
79
|
setAppointments(appointments);
|
84
|
80
|
console.log(appointments);
|
85
|
81
|
});
|
86
|
|
-
|
87
|
82
|
|
88
|
|
- //return () => fire();
|
89
|
83
|
return () => {
|
90
|
84
|
Notifications.removeNotificationSubscription(notificationListener.current);
|
91
|
85
|
Notifications.removeNotificationSubscription(responseListener.current);
|
|
@@ -98,24 +92,6 @@ export function Home_page({navigation}) {
|
98
|
92
|
return <Loading />;
|
99
|
93
|
}
|
100
|
94
|
|
101
|
|
- const sendMessage = (token) => {
|
102
|
|
- fetch('https://exp.host/--/api/v2/push/send', {
|
103
|
|
- method: 'POST',
|
104
|
|
- headers: {
|
105
|
|
- Accept: 'application/json',
|
106
|
|
- 'Accept-encoding': 'gzip, deflate',
|
107
|
|
- 'Content-type': 'application/json',
|
108
|
|
- },
|
109
|
|
- body: JSON.stringify({
|
110
|
|
- to: token,
|
111
|
|
- title: 'Ernesto',
|
112
|
|
- body: 'Freehand message',
|
113
|
|
- data: { data: 'goes here' },
|
114
|
|
- _displayInForeground: true,
|
115
|
|
- }),
|
116
|
|
- });
|
117
|
|
- }
|
118
|
|
-
|
119
|
95
|
|
120
|
96
|
function handleButtonPress() {
|
121
|
97
|
firebase.firestore()
|
|
@@ -127,9 +103,6 @@ export function Home_page({navigation}) {
|
127
|
103
|
'02yOZHxFcGUX4MNwjeEbAlCShdu1'
|
128
|
104
|
]
|
129
|
105
|
})
|
130
|
|
- //.then(() => {
|
131
|
|
- //navigation.navigate('allChats');
|
132
|
|
- //});
|
133
|
106
|
}
|
134
|
107
|
|
135
|
108
|
const dimensions = Dimensions.get('window');
|