Просмотр исходного кода

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 лет назад
Родитель
Сommit
e41e512e58
3 измененных файлов: 32 добавлений и 14 удалений
  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 Просмотреть файл

@@ -10,6 +10,8 @@ export default class Calendario extends Component {
10 10
       selectedStartDate: null,
11 11
       interpreter_id : this.props.route.params.Intereprete_id,
12 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 16
     this.onDateChange = this.onDateChange.bind(this);
15 17
     
@@ -23,10 +25,10 @@ export default class Calendario extends Component {
23 25
     console.log(this.props.route.params.Flag)
24 26
     
25 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 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,4 +60,7 @@ const styles = StyleSheet.create({
58 60
     backgroundColor: '#FFFFFF',
59 61
     marginTop: 100,
60 62
   },
61
-});
63
+});
64
+   
65
+  
66
+

+ 8
- 6
screens/main/Search.js Просмотреть файл

@@ -81,8 +81,10 @@ const Days = [
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 89
   const [users, setUsers] = useState([])
88 90
   const [selectedTags, setSelectedTags] = useState([])
@@ -113,7 +115,7 @@ function Search({ navigation }) {
113 115
       //check which tags where called in the search 
114 116
       if (tags[i].id === 'PL') {
115 117
         console.log('Presencial')
116
-        query = query.where('Modalidad.Presencial', '==', true)
118
+        query = query.where('face_to_face', '==', true)
117 119
         mapflag = true
118 120
       }
119 121
       if (tags[i].id == 'ON') {
@@ -250,7 +252,7 @@ function Search({ navigation }) {
250 252
             <View style={{ flexDirection: "row", paddingBottom: 20, paddingTop: 20,  justifyContent: "space-between" }}>
251 253
               <Text>{item.data.name}</Text>
252 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 256
             </View>
255 257
             <View style={{ borderBottomColor: 'black', borderBottomWidth: 1 }} />
256 258
           </View>
@@ -266,9 +268,9 @@ function Search({ navigation }) {
266 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 Просмотреть файл

@@ -16,7 +16,9 @@ export default class Time extends Component{
16 16
       Appointment : this.props.route.params.Appointment_Date,
17 17
       int2_id : this.props.route.params.int_id,
18 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 23
     console.log(this.props.route.params)
22 24
     this.time_assignment = this.time_assignment.bind(this);
@@ -119,11 +121,14 @@ export default class Time extends Component{
119 121
   
120 122
   
121 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 126
     const user = firebase.auth().currentUser;
125 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 132
     const month = date.month();
128 133
     const day = date.date();
129 134
     const _time_ = selectedTime;
@@ -145,6 +150,8 @@ export default class Time extends Component{
145 150
       Month : month,
146 151
       Day: day,
147 152
       Time: _time_,
153
+      u_token : u_token,
154
+      i_token : i_token,
148 155
       Pin: [
149 156
         lat,
150 157
         lon,
@@ -155,7 +162,9 @@ export default class Time extends Component{
155 162
   else{
156 163
     const user = firebase.auth().currentUser
157 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 168
     const month = date.month()
160 169
     const day = date.date()
161 170
     const _time_ = selectedTime
@@ -172,6 +181,8 @@ export default class Time extends Component{
172 181
       Month : month,
173 182
       Day: day,
174 183
       Time: _time_,
184
+      u_token : u_token,
185
+      i_token : i_token,
175 186
       })
176 187
 
177 188
   }