Browse Source

Cambios hochos por Gilberto para traer los ExpoPushTokens de las partes en una cita y que la aplicación pueda eviar notificaciones a uno y otro.

ErnestoOrtiz2 3 years ago
parent
commit
e41e512e58
3 changed files with 32 additions and 14 deletions
  1. 8
    3
      screens/main/Calendar.js
  2. 8
    6
      screens/main/Search.js
  3. 16
    5
      screens/main/StateTime.js

+ 8
- 3
screens/main/Calendar.js View File

10
       selectedStartDate: null,
10
       selectedStartDate: null,
11
       interpreter_id : this.props.route.params.Intereprete_id,
11
       interpreter_id : this.props.route.params.Intereprete_id,
12
       mapflag : this.props.route.params.Flag,
12
       mapflag : this.props.route.params.Flag,
13
+      i_token: this.props.route.params.I_Token,
14
+      u_token: this.props.route.params.U_Token
13
     };
15
     };
14
     this.onDateChange = this.onDateChange.bind(this);
16
     this.onDateChange = this.onDateChange.bind(this);
15
     
17
     
23
     console.log(this.props.route.params.Flag)
25
     console.log(this.props.route.params.Flag)
24
     
26
     
25
     if(this.state.mapflag == false){
27
     if(this.state.mapflag == false){
26
-      this.props.navigation.navigate('StateTime', {Appointment_Date: date._d, int_id : this.state.interpreter_id, Flag: this.state.mapflag});
28
+      this.props.navigation.navigate('StateTime', {Appointment_Date: date._d, int_id : this.state.interpreter_id, Flag: this.state.mapflag, I_Token: this.state.i_token, U_Token: this.state.u_token});
27
     }
29
     }
28
     else{
30
     else{
29
-      this.props.navigation.navigate('Map', {Appointment_Date: date._d, int_id : this.state.interpreter_id, Flag: this.state.mapflag});
31
+      this.props.navigation.navigate('Map', {Appointment_Date: date._d, int_id : this.state.interpreter_id, Flag: this.state.mapflag, I_Token: this.state.i_token, U_Token: this.state.u_token});
30
     }
32
     }
31
   }
33
   }
32
   
34
   
58
     backgroundColor: '#FFFFFF',
60
     backgroundColor: '#FFFFFF',
59
     marginTop: 100,
61
     marginTop: 100,
60
   },
62
   },
61
-});
63
+});
64
+   
65
+  
66
+

+ 8
- 6
screens/main/Search.js View File

81
 
81
 
82
 
82
 
83
 
83
 
84
-function Search({ navigation }) {
84
+function Search({route, navigation }) {
85
 
85
 
86
+  const u_token = route.params.U_Token;
87
+  console.log("U__token: ", u_token)
86
   
88
   
87
   const [users, setUsers] = useState([])
89
   const [users, setUsers] = useState([])
88
   const [selectedTags, setSelectedTags] = useState([])
90
   const [selectedTags, setSelectedTags] = useState([])
113
       //check which tags where called in the search 
115
       //check which tags where called in the search 
114
       if (tags[i].id === 'PL') {
116
       if (tags[i].id === 'PL') {
115
         console.log('Presencial')
117
         console.log('Presencial')
116
-        query = query.where('Modalidad.Presencial', '==', true)
118
+        query = query.where('face_to_face', '==', true)
117
         mapflag = true
119
         mapflag = true
118
       }
120
       }
119
       if (tags[i].id == 'ON') {
121
       if (tags[i].id == 'ON') {
250
             <View style={{ flexDirection: "row", paddingBottom: 20, paddingTop: 20,  justifyContent: "space-between" }}>
252
             <View style={{ flexDirection: "row", paddingBottom: 20, paddingTop: 20,  justifyContent: "space-between" }}>
251
               <Text>{item.data.name}</Text>
253
               <Text>{item.data.name}</Text>
252
               <Text>{item.data.Precio}</Text>
254
               <Text>{item.data.Precio}</Text>
253
-              <Button title='Buscar' onPress={() => { dothing(item.id) }}/>
255
+              <Button title='Buscar' onPress={() => { dothing(item.id, item.data.push_token, u_token) }}/>
254
             </View>
256
             </View>
255
             <View style={{ borderBottomColor: 'black', borderBottomWidth: 1 }} />
257
             <View style={{ borderBottomColor: 'black', borderBottomWidth: 1 }} />
256
           </View>
258
           </View>
266
     return (item) => setSelectedTags(xorBy(selectedTags, [item], 'id'))
268
     return (item) => setSelectedTags(xorBy(selectedTags, [item], 'id'))
267
   }
269
   }
268
   
270
   
269
-  function dothing(item) {
270
-    console.log('This is the item id: ', item)
271
-    navigation.navigate('Calendar', {Intereprete_id: item, Flag: mapflag})
271
+  function dothing(item, i_token, u_token) {
272
+    console.log('This is the item id: ', item, "With i_token: ", i_token, " u_token : ", u_token)
273
+    navigation.navigate('Calendar', {Intereprete_id: item, Flag: mapflag, I_Token: i_token, U_Token: u_token})
272
   } 
274
   } 
273
 
275
 
274
 }
276
 }

+ 16
- 5
screens/main/StateTime.js View File

16
       Appointment : this.props.route.params.Appointment_Date,
16
       Appointment : this.props.route.params.Appointment_Date,
17
       int2_id : this.props.route.params.int_id,
17
       int2_id : this.props.route.params.int_id,
18
       mapflag: this.props.route.params.mapflag,
18
       mapflag: this.props.route.params.mapflag,
19
-      Pin: this.props.route.params.Pin
19
+      Pin: this.props.route.params.Pin,
20
+      i_token: this.props.route.params.I_Token,
21
+      u_token: this.props.route.params.U_Token
20
     }
22
     }
21
     console.log(this.props.route.params)
23
     console.log(this.props.route.params)
22
     this.time_assignment = this.time_assignment.bind(this);
24
     this.time_assignment = this.time_assignment.bind(this);
119
   
121
   
120
   
122
   
121
   if(this.state.mapflag == true){
123
   if(this.state.mapflag == true){
122
-    console.log("Pin is: ")
123
-    console.log(this.state.Pin)
124
+    console.log("UToken is: ")
125
+    console.log(this.state.u_token)
124
     const user = firebase.auth().currentUser;
126
     const user = firebase.auth().currentUser;
125
     const uid = user.uid;
127
     const uid = user.uid;
126
-    const date = this.state.Appointment;
128
+    const u_token = this.state.u_token;
129
+    const i_token = this.state.i_token;
130
+    const date = moment(this.state.Appointment);
131
+    console.log("date: ", date)
127
     const month = date.month();
132
     const month = date.month();
128
     const day = date.date();
133
     const day = date.date();
129
     const _time_ = selectedTime;
134
     const _time_ = selectedTime;
145
       Month : month,
150
       Month : month,
146
       Day: day,
151
       Day: day,
147
       Time: _time_,
152
       Time: _time_,
153
+      u_token : u_token,
154
+      i_token : i_token,
148
       Pin: [
155
       Pin: [
149
         lat,
156
         lat,
150
         lon,
157
         lon,
155
   else{
162
   else{
156
     const user = firebase.auth().currentUser
163
     const user = firebase.auth().currentUser
157
     const uid = user.uid
164
     const uid = user.uid
158
-    const date = moment(this.state.Appointment)
165
+    const u_token = user.push_token
166
+    const i_token = this.state.i_token
167
+    const date = this.state.Appointment
159
     const month = date.month()
168
     const month = date.month()
160
     const day = date.date()
169
     const day = date.date()
161
     const _time_ = selectedTime
170
     const _time_ = selectedTime
172
       Month : month,
181
       Month : month,
173
       Day: day,
182
       Day: day,
174
       Time: _time_,
183
       Time: _time_,
184
+      u_token : u_token,
185
+      i_token : i_token,
175
       })
186
       })
176
 
187
 
177
   }
188
   }