|
@@ -37,6 +37,8 @@ export function Home_page({navigation}) {
|
37
|
37
|
const notificationListener = useRef();
|
38
|
38
|
const responseListener = useRef();
|
39
|
39
|
|
|
40
|
+ //const [oneApp, setOneApp] = useState('')
|
|
41
|
+
|
40
|
42
|
|
41
|
43
|
useEffect(() => {
|
42
|
44
|
registerForPushNotificationsAsync().then(token => setExpoPushToken(token));
|
|
@@ -62,28 +64,36 @@ export function Home_page({navigation}) {
|
62
|
64
|
});
|
63
|
65
|
|
64
|
66
|
setThreads(threads);
|
65
|
|
- console.log(threads);
|
|
67
|
+ //console.log(threads);
|
66
|
68
|
|
67
|
69
|
if(loading){
|
68
|
70
|
setLoading(false);
|
69
|
71
|
}
|
70
|
72
|
});
|
71
|
73
|
|
72
|
|
- const cita = firebase.firestore().collection('APPOINTMENTS').where('Day', '==', 8).onSnapshot(snapShot => {
|
|
74
|
+ const cita = firebase.firestore().collection('APPOINTMENTS').where("participantes", "array-contains", 'qj5xBCSRNoaRMik4UULmslSktLp1').onSnapshot(snapShot => {
|
73
|
75
|
const appointments = snapShot.docs.map(docSnap => {
|
74
|
76
|
return{
|
75
|
77
|
_id:docSnap.id,
|
76
|
78
|
Day:'',
|
77
|
79
|
Month:'',
|
78
|
80
|
Time:'',
|
79
|
|
- i_id:'',
|
80
|
|
- uid1:'',
|
|
81
|
+ i_token:'',
|
|
82
|
+ u_token:'',
|
81
|
83
|
...docSnap.data()
|
82
|
84
|
};
|
83
|
85
|
});
|
84
|
86
|
setAppointments(appointments);
|
85
|
|
- console.log(appointments);
|
|
87
|
+ console.log("appointment", appointments);
|
|
88
|
+ //console.log(appointments.Day);
|
86
|
89
|
});
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+ const day = firebase.firestore().collection('APPOINTMENTS').where('Day', '==', 8).get().then((res) => {
|
|
93
|
+ console.log(`Day is ${res.docs[0].get('Day')}.`);
|
|
94
|
+ //const dia = return{`${res.doc[0].get('Day')}`};
|
|
95
|
+ });
|
|
96
|
+ //console.log("Day", dia);
|
87
|
97
|
|
88
|
98
|
return () => {
|
89
|
99
|
Notifications.removeNotificationSubscription(notificationListener.current);
|
|
@@ -96,6 +106,8 @@ export function Home_page({navigation}) {
|
96
|
106
|
if (loading) {
|
97
|
107
|
return <Loading />;
|
98
|
108
|
}
|
|
109
|
+
|
|
110
|
+
|
99
|
111
|
|
100
|
112
|
|
101
|
113
|
function handleButtonPress() {
|
|
@@ -236,6 +248,29 @@ export function Home_page({navigation}) {
|
236
|
248
|
</TouchableOpacity>
|
237
|
249
|
)}
|
238
|
250
|
/>
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+ <FlatList style={{
|
|
254
|
+ flex: 1,
|
|
255
|
+ width: screenWidth,
|
|
256
|
+ }}
|
|
257
|
+ data={appointments}
|
|
258
|
+ keyExtractor = {item => item._id}
|
|
259
|
+ ItemSeparatorComponent={() => <Divider />}
|
|
260
|
+ renderItem={({ item }) => {
|
|
261
|
+ return (
|
|
262
|
+ <Button
|
|
263
|
+ title ='Send notification'
|
|
264
|
+ onPress={ async () => {
|
|
265
|
+ await sendPushNotification(item.i_token);
|
|
266
|
+ }
|
|
267
|
+ }
|
|
268
|
+ />
|
|
269
|
+ )
|
|
270
|
+ }}
|
|
271
|
+ />
|
|
272
|
+
|
|
273
|
+
|
239
|
274
|
<Button
|
240
|
275
|
title ='Send notification'
|
241
|
276
|
onPress={async () => {
|
|
@@ -246,6 +281,10 @@ export function Home_page({navigation}) {
|
246
|
281
|
title ='Availability'
|
247
|
282
|
onPress= {() => navigation.navigate('Availability')}
|
248
|
283
|
/>
|
|
284
|
+ <Button
|
|
285
|
+ title ='Mapa'
|
|
286
|
+ onPress= {() => navigation.navigate('Map')}
|
|
287
|
+ />
|
249
|
288
|
<Button
|
250
|
289
|
title ='Logout'
|
251
|
290
|
onPress= {() => firebase.auth().signOut()}
|