This commit is contained in:
Hamza-Ayed
2023-09-23 16:39:05 +03:00
parent 9bc121f07a
commit 92b0713811
4 changed files with 43 additions and 16 deletions

View File

@@ -112,7 +112,12 @@ class FirebasMessagesController extends GetxController {
'body': message.notification!.body
});
} else if (message.notification!.title!.contains('Apply Ride')) {
// MapController().rideConfirm = true;
// MapController mapController = Get.put(MapController());
// mapController.rideConfirm = false;
// print('-----------------------------rideConfirm===' +
// mapController.rideConfirm.toString());
// update();
var passengerList = message.data['passengerList'];
print(passengerList);
print('9999999999999my Apply Ride 999999999999999');

View File

@@ -151,7 +151,7 @@ class MapController extends GetxController {
"price": totalPassenger.toString(),
"passenger_id": box.read(BoxName.pasengerID).toString(),
"driver_id": dataCarsLocationByPassenger['message'][0]['id'].toString(),
"status": "active",
"status": "waiting",
"price_for_driver": totalDriver.toString(),
"price_for_passenger": totaME.toString(),
"distance": distance.toString()
@@ -194,25 +194,24 @@ class MapController extends GetxController {
}
void delayAndFetchRideStatus(String rideId) {
Timer(const Duration(seconds: 3), () async {
Timer(const Duration(seconds: 1), () async {
if (shouldFetch) {
// print('shouldFetch is =$shouldFetch');
var res = await CRUD()
.get(link: AppLink.getRideStatus, payload: {'order_id': rideId});
var decod = jsonDecode(res);
// print(' 0000000000000000000000000000000000000000000000000');
// print(decod['data']);
print(' 0000000000000000000000000000000000000000000000000');
print(decod['data']);
if (decod['data'].toString() == 'Apply' ||
decod['data'].toString() == 'Refused') {
shouldFetch = false; // Stop further fetches
rideConfirm = false;
update();
startTimer();
update();
} else {
shouldFetch = true;
delayAndFetchRideStatus(
rideId); // Repeat the delay and fetch operation
update();
// delayAndFetchRideStatus(
// rideId); // Repeat the delay and fetch operation
}
}
});