|
@@ -24,6 +24,10 @@ Notifications.setNotificationHandler({
|
24
|
24
|
});
|
25
|
25
|
|
26
|
26
|
|
|
27
|
+let x = "x";
|
|
28
|
+console.log(x);
|
|
29
|
+
|
|
30
|
+
|
27
|
31
|
export function Home_page({navigation}) {
|
28
|
32
|
|
29
|
33
|
const [threads, setThreads] = useState([]);
|
|
@@ -47,9 +51,9 @@ export function Home_page({navigation}) {
|
47
|
51
|
});
|
48
|
52
|
|
49
|
53
|
responseListener.current = Notifications.addNotificationResponseReceivedListener(response => {
|
50
|
|
- console.log("response", response);
|
51
|
54
|
if (response.notification.request.content.body == 'Le solicitan una cita'){
|
52
|
|
- navigation.navigate('Confirm');
|
|
55
|
+ console.log("response appointments ", appointments[0])
|
|
56
|
+ navigation.navigate('Confirm',{x})
|
53
|
57
|
}
|
54
|
58
|
});
|
55
|
59
|
|
|
@@ -94,25 +98,6 @@ export function Home_page({navigation}) {
|
94
|
98
|
});
|
95
|
99
|
|
96
|
100
|
|
97
|
|
- const fire = firebase.firestore()
|
98
|
|
- .collection('THREADS')
|
99
|
|
- .where("members", "array-contains", firebase.auth().currentUser.uid)
|
100
|
|
- .onSnapshot(querySnapshot => {
|
101
|
|
- const threads = querySnapshot.docs.map(documentSnapshot => {
|
102
|
|
- return{
|
103
|
|
- _id:documentSnapshot.id,
|
104
|
|
- name:'',
|
105
|
|
- ...documentSnapshot.data()
|
106
|
|
- };
|
107
|
|
- });
|
108
|
|
-
|
109
|
|
- setThreads(threads);
|
110
|
|
-
|
111
|
|
- if(loading){
|
112
|
|
- setLoading(false);
|
113
|
|
- }
|
114
|
|
- });
|
115
|
|
-
|
116
|
101
|
const cita = firebase.firestore().collection('APPOINTMENTS').where("participantes", "array-contains", firebase.auth().currentUser.uid).onSnapshot(snapShot => {
|
117
|
102
|
const appointments = snapShot.docs.map(docSnap => {
|
118
|
103
|
return{
|
|
@@ -130,14 +115,13 @@ export function Home_page({navigation}) {
|
130
|
115
|
};
|
131
|
116
|
});
|
132
|
117
|
setAppointments(appointments);
|
133
|
|
- console.log("appointment", appointments);
|
|
118
|
+ //console.log("appointment", appointments);
|
134
|
119
|
});
|
135
|
120
|
|
136
|
121
|
|
137
|
122
|
return () => {
|
138
|
123
|
Notifications.removeNotificationSubscription(notificationListener.current);
|
139
|
124
|
Notifications.removeNotificationSubscription(responseListener.current);
|
140
|
|
- fire();
|
141
|
125
|
cita();
|
142
|
126
|
Iuser_data();
|
143
|
127
|
user_data();
|
|
@@ -185,7 +169,7 @@ export function Home_page({navigation}) {
|
185
|
169
|
|
186
|
170
|
|
187
|
171
|
check_user_type_INT();
|
188
|
|
- console.log("interpreter", interpreter);
|
|
172
|
+ //console.log("interpreter", interpreter);
|
189
|
173
|
|
190
|
174
|
|
191
|
175
|
if(interpreter == false){
|
|
@@ -202,7 +186,7 @@ export function Home_page({navigation}) {
|
202
|
186
|
renderItem = {({item}) => (
|
203
|
187
|
<TouchableOpacity
|
204
|
188
|
onPress={async () => {
|
205
|
|
- console.log("item._id, home, client", item.Pin)
|
|
189
|
+ //console.log("item._id, home, client", item.Pin)
|
206
|
190
|
navigation.navigate('Cita',{tag: item, Pin: item})
|
207
|
191
|
}}
|
208
|
192
|
>
|
|
@@ -223,7 +207,7 @@ export function Home_page({navigation}) {
|
223
|
207
|
descriptionNumberOfLines={1}
|
224
|
208
|
/>
|
225
|
209
|
<List.Item
|
226
|
|
- title='Día'
|
|
210
|
+ title='Día:'
|
227
|
211
|
description={item.Day}
|
228
|
212
|
titleNumberOfLines={1}
|
229
|
213
|
titleStyle={styles.listTitle}
|
|
@@ -256,6 +240,7 @@ export function Home_page({navigation}) {
|
256
|
240
|
onPress={ async () => {
|
257
|
241
|
await sendPushNotification(item.i_token);
|
258
|
242
|
citaId(item._id);
|
|
243
|
+ x = item._id;
|
259
|
244
|
}
|
260
|
245
|
}
|
261
|
246
|
/>
|
|
@@ -288,7 +273,7 @@ export function Home_page({navigation}) {
|
288
|
273
|
renderItem = {({item}) => (
|
289
|
274
|
<TouchableOpacity
|
290
|
275
|
onPress={async () => {
|
291
|
|
- console.log("item._id, home, interpreter", item)
|
|
276
|
+ //console.log("item._id, home, interpreter", item)
|
292
|
277
|
navigation.navigate('Cita',{tag: item, Pin: item})
|
293
|
278
|
}}
|
294
|
279
|
>
|
|
@@ -309,7 +294,7 @@ export function Home_page({navigation}) {
|
309
|
294
|
descriptionNumberOfLines={1}
|
310
|
295
|
/>
|
311
|
296
|
<List.Item
|
312
|
|
- title='Día'
|
|
297
|
+ title='Día:'
|
313
|
298
|
description={item.Day}
|
314
|
299
|
titleNumberOfLines={1}
|
315
|
300
|
titleStyle={styles.listTitle}
|
|
@@ -326,31 +311,7 @@ export function Home_page({navigation}) {
|
326
|
311
|
/>
|
327
|
312
|
</TouchableOpacity>
|
328
|
313
|
)}
|
329
|
|
- />
|
330
|
|
-
|
331
|
|
-
|
332
|
|
- <FlatList style={{
|
333
|
|
- flex: 1,
|
334
|
|
- width: screenWidth,
|
335
|
|
- }}
|
336
|
|
- data={appointments}
|
337
|
|
- keyExtractor = {item => item._id}
|
338
|
|
- renderItem={({ item }) => {
|
339
|
|
- if(item.new == 'true'){
|
340
|
|
- return (
|
341
|
|
- <Button
|
342
|
|
- title ='Pedir Cita'
|
343
|
|
- onPress={ async () => {
|
344
|
|
- await sendPushNotification(item.i_token);
|
345
|
|
- citaId(item._id);
|
346
|
|
- }
|
347
|
|
- }
|
348
|
|
- />
|
349
|
|
- )
|
350
|
|
- }}}
|
351
|
|
- />
|
352
|
|
-
|
353
|
|
-
|
|
314
|
+ />
|
354
|
315
|
<Button
|
355
|
316
|
title ='Availability'
|
356
|
317
|
onPress= {() => navigation.navigate('Availability')}
|
|
@@ -398,7 +359,7 @@ async function registerForPushNotificationsAsync() {
|
398
|
359
|
return;
|
399
|
360
|
}
|
400
|
361
|
token = (await Notifications.getExpoPushTokenAsync()).data;
|
401
|
|
- console.log('Token:', token)
|
|
362
|
+ //console.log('Token:', token)
|
402
|
363
|
} else {
|
403
|
364
|
alert('Must use physical device for Push Notifications');
|
404
|
365
|
}
|