|
@@ -24,6 +24,8 @@ Notifications.setNotificationHandler({
|
24
|
24
|
});
|
25
|
25
|
|
26
|
26
|
|
|
27
|
+const double = [];
|
|
28
|
+
|
27
|
29
|
export function Home_page({navigation}) {
|
28
|
30
|
|
29
|
31
|
const [threads, setThreads] = useState([]);
|
|
@@ -47,11 +49,11 @@ export function Home_page({navigation}) {
|
47
|
49
|
});
|
48
|
50
|
|
49
|
51
|
responseListener.current = Notifications.addNotificationResponseReceivedListener(response => {
|
50
|
|
- console.log("response", response);
|
51
|
|
- console.log("response date", response.notification.date);
|
52
|
|
- const idDate = response.notification.date;
|
|
52
|
+ //console.log("response", response);
|
53
|
53
|
if (response.notification.request.content.body == 'Le solicitan una cita'){
|
54
|
|
- navigation.navigate('Confirm');
|
|
54
|
+ //console.log("en pedir response", {appointments});
|
|
55
|
+ //console.log("el id", appointments[0]._id);
|
|
56
|
+ navigation.navigate('Confirm',{tag: appointments[0]})
|
55
|
57
|
}
|
56
|
58
|
});
|
57
|
59
|
|
|
@@ -96,25 +98,6 @@ export function Home_page({navigation}) {
|
96
|
98
|
});
|
97
|
99
|
|
98
|
100
|
|
99
|
|
- const fire = firebase.firestore()
|
100
|
|
- .collection('THREADS')
|
101
|
|
- .where("members", "array-contains", firebase.auth().currentUser.uid)
|
102
|
|
- .onSnapshot(querySnapshot => {
|
103
|
|
- const threads = querySnapshot.docs.map(documentSnapshot => {
|
104
|
|
- return{
|
105
|
|
- _id:documentSnapshot.id,
|
106
|
|
- name:'',
|
107
|
|
- ...documentSnapshot.data()
|
108
|
|
- };
|
109
|
|
- });
|
110
|
|
-
|
111
|
|
- setThreads(threads);
|
112
|
|
-
|
113
|
|
- if(loading){
|
114
|
|
- setLoading(false);
|
115
|
|
- }
|
116
|
|
- });
|
117
|
|
-
|
118
|
101
|
const cita = firebase.firestore().collection('APPOINTMENTS').where("participantes", "array-contains", firebase.auth().currentUser.uid).onSnapshot(snapShot => {
|
119
|
102
|
const appointments = snapShot.docs.map(docSnap => {
|
120
|
103
|
return{
|
|
@@ -139,7 +122,6 @@ export function Home_page({navigation}) {
|
139
|
122
|
return () => {
|
140
|
123
|
Notifications.removeNotificationSubscription(notificationListener.current);
|
141
|
124
|
Notifications.removeNotificationSubscription(responseListener.current);
|
142
|
|
- fire();
|
143
|
125
|
cita();
|
144
|
126
|
Iuser_data();
|
145
|
127
|
user_data();
|
|
@@ -331,25 +313,28 @@ export function Home_page({navigation}) {
|
331
|
313
|
/>
|
332
|
314
|
|
333
|
315
|
|
334
|
|
- <FlatList style={{
|
|
316
|
+ <FlatList style={{
|
335
|
317
|
flex: 1,
|
336
|
318
|
width: screenWidth,
|
337
|
|
- }}
|
338
|
|
- data={appointments}
|
339
|
|
- keyExtractor = {item => item._id}
|
340
|
|
- renderItem={({ item }) => {
|
|
319
|
+ }}
|
|
320
|
+ data={appointments}
|
|
321
|
+ keyExtractor = {item => item._id}
|
|
322
|
+ ItemSeparatorComponent={() => <Divider />}
|
|
323
|
+ renderItem={({ item }) => {
|
341
|
324
|
if(item.new == 'true'){
|
342
|
325
|
return (
|
343
|
326
|
<Button
|
344
|
|
- title ='Pedir Cita'
|
345
|
|
- onPress={ async () => {
|
346
|
|
- await sendPushNotification(item.i_token);
|
347
|
|
- citaId(item._id);
|
348
|
|
- }
|
|
327
|
+ title ='Pedir Cita'
|
|
328
|
+ onPress={ async () => {
|
|
329
|
+ await sendPushNotification(item.i_token);
|
|
330
|
+ citaId(item._id);
|
|
331
|
+ console.log("appointment", appointments);
|
|
332
|
+ double = appointments.map((number) => number);
|
349
|
333
|
}
|
350
|
|
- />
|
|
334
|
+ }
|
|
335
|
+ />
|
351
|
336
|
)
|
352
|
|
- }}}
|
|
337
|
+ }}}
|
353
|
338
|
/>
|
354
|
339
|
|
355
|
340
|
|