9/19/1
This commit is contained in:
@@ -1017,10 +1017,10 @@ class MapPassengerController extends GetxController {
|
||||
late String make = '';
|
||||
late String licensePlate = '';
|
||||
confirmRideForFirstDriver() async {
|
||||
startCarLocationSearch(box.read(BoxName.carType));
|
||||
// startCarLocationSearch(box.read(BoxName.carType));
|
||||
// await getCarsLocationByPassengerAndReloadMarker(
|
||||
// box.read(BoxName.carType), 7000);
|
||||
await getNearestDriverByPassengerLocationAPIGOOGLE();
|
||||
// box.read(BoxName.carType), 7000);
|
||||
// await getNearestDriverByPassengerLocationAPIGOOGLE();
|
||||
Log.print('dataCarsLocationByPassenger: ${dataCarsLocationByPassenger}');
|
||||
if (dataCarsLocationByPassenger != 'failure' ||
|
||||
dataCarsLocationByPassenger != null) {
|
||||
@@ -1258,12 +1258,8 @@ class MapPassengerController extends GetxController {
|
||||
];
|
||||
Log.print('body: ${body}');
|
||||
for (var i = 1; i < driversToken.length; i++) {
|
||||
FirebaseMessagesController().sendNotificationToDriverMapPolyline(
|
||||
'OrderSpeed',
|
||||
rideId.toString(),
|
||||
driversToken[i],
|
||||
body,
|
||||
polylineCoordinates.toString());
|
||||
FirebaseMessagesController().sendNotificationToDriverMAP('OrderSpeed',
|
||||
rideId.toString(), driversToken[i], body, 'order.wav');
|
||||
}
|
||||
|
||||
(rideId);
|
||||
@@ -1291,6 +1287,8 @@ class MapPassengerController extends GetxController {
|
||||
if (res.toString() == 'waiting' && tick >= 15) {
|
||||
timer.cancel(); // Stop the current timer
|
||||
showAndResearchForCaptain();
|
||||
//TODO add to wait
|
||||
confirmRideForAllDriverAvailable();
|
||||
// delayAndFetchRideStatusForAllDriverAvailable(rideId);
|
||||
} else if (res.toString() == 'Apply') {
|
||||
// todo play sound
|
||||
@@ -1314,7 +1312,9 @@ class MapPassengerController extends GetxController {
|
||||
// No need to recall delayAndFetchRideStatus as Timer.periodic is already running
|
||||
update();
|
||||
// }
|
||||
tick++;
|
||||
if (tick < 19) {
|
||||
tick++;
|
||||
}
|
||||
} else {
|
||||
timer.cancel();
|
||||
// Stop the timer if remainingTimeToPassengerFromDriverAfterApplied <= 0
|
||||
@@ -1343,7 +1343,7 @@ class MapPassengerController extends GetxController {
|
||||
Log.print('tick delayAndFetchRideStatusForAllDriverAvailable: ${tick}');
|
||||
|
||||
void fetchRideStatus() async {
|
||||
if (attemptCounter < maxAttempts && !isApplied && tick < 20) {
|
||||
if (attemptCounter < maxAttempts && !isApplied || tick < 20) {
|
||||
attemptCounter++;
|
||||
tick++;
|
||||
var res = await getRideStatus(rideId);
|
||||
@@ -1760,7 +1760,7 @@ class MapPassengerController extends GetxController {
|
||||
'northeastLon': bounds.northeast.longitude.toString(),
|
||||
});
|
||||
break;
|
||||
case 'Delivery':
|
||||
case 'Scooter':
|
||||
res = await CRUD()
|
||||
.get(link: AppLink.getCarsLocationByPassengerDelivery, payload: {
|
||||
'southwestLat': bounds.southwest.latitude.toString(),
|
||||
@@ -1778,6 +1778,15 @@ class MapPassengerController extends GetxController {
|
||||
'northeastLon': bounds.northeast.longitude.toString(),
|
||||
});
|
||||
break;
|
||||
case 'Pink Bike':
|
||||
res = await CRUD()
|
||||
.get(link: AppLink.getCarsLocationByPassengerPinkBike, payload: {
|
||||
'southwestLat': bounds.southwest.latitude.toString(),
|
||||
'southwestLon': bounds.southwest.longitude.toString(),
|
||||
'northeastLat': bounds.northeast.latitude.toString(),
|
||||
'northeastLon': bounds.northeast.longitude.toString(),
|
||||
});
|
||||
break;
|
||||
default:
|
||||
res = await CRUD()
|
||||
.get(link: AppLink.getCarsLocationByPassenger, payload: {
|
||||
@@ -1796,11 +1805,29 @@ class MapPassengerController extends GetxController {
|
||||
} else {
|
||||
noCarString = false;
|
||||
dataCarsLocationByPassenger = jsonDecode(res);
|
||||
driverId = dataCarsLocationByPassenger['message'][carsOrder]
|
||||
['driver_id']
|
||||
.toString();
|
||||
gender = dataCarsLocationByPassenger['message'][carsOrder]['gender']
|
||||
.toString();
|
||||
|
||||
// Check if 'message' is present and not null
|
||||
if (dataCarsLocationByPassenger['message'] != null &&
|
||||
dataCarsLocationByPassenger['message'].isNotEmpty) {
|
||||
// Check if carsOrder is within bounds
|
||||
if (carsOrder < dataCarsLocationByPassenger['message'].length) {
|
||||
driverId = dataCarsLocationByPassenger['message'][carsOrder]
|
||||
['driver_id']
|
||||
.toString();
|
||||
gender = dataCarsLocationByPassenger['message'][carsOrder]['gender']
|
||||
.toString();
|
||||
driverToken = dataCarsLocationByPassenger['message'][carsOrder]
|
||||
['token']
|
||||
.toString();
|
||||
} else {
|
||||
print('carsOrder is out of bounds for message array');
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// Get.defaultDialog(title: 'No cars available ');
|
||||
print('No cars available or message is null');
|
||||
return false;
|
||||
}
|
||||
|
||||
carsLocationByPassenger.clear(); // Clear existing markers
|
||||
|
||||
|
||||
Reference in New Issue
Block a user