This commit is contained in:
Hamza-Ayed
2024-06-30 12:35:55 +03:00
parent 6fb79baab4
commit d423cc0831
27 changed files with 517 additions and 452 deletions

View File

@@ -222,7 +222,8 @@ class MapDriverController extends GetxController {
FirebaseMessagesController().sendNotificationToAnyWithoutData(
'DriverIsGoingToPassenger',
box.read(BoxName.name).toString(),
tokenPassenger);
tokenPassenger,
'start.wav');
if (box.read(BoxName.googlaMapApp) == true) {
await openGoogleMapFromDriverToPassenger();
}
@@ -288,7 +289,10 @@ class MapDriverController extends GetxController {
});
FirebaseMessagesController().sendNotificationToAnyWithoutData(
'RideIsBegin', box.read(BoxName.name).toString(), tokenPassenger);
'RideIsBegin',
box.read(BoxName.name).toString(),
tokenPassenger,
'start.wav');
rideIsBeginPassengerTimer();
// var d = jsonDecode(res);
@@ -352,6 +356,7 @@ class MapDriverController extends GetxController {
}
calculateDistanceBetweenDriverAndPassengerLocation() {
Get.put(LocationController());
double distance2 = Geolocator.distanceBetween(
latLngPassengerLocation.latitude,
latLngPassengerLocation.longitude,
@@ -533,19 +538,19 @@ class MapDriverController extends GetxController {
});
Future.delayed(const Duration(milliseconds: 300));
FirebaseMessagesController().sendNotificationToPassengerToken(
'Driver Finish Trip',
'${'you will pay to Driver'.tr} $paymentAmount \$',
tokenPassenger,
[
box.read(BoxName.driverID),
rideId,
box.read(BoxName.tokenDriver),
// carType == 'Comfort' || carType == 'Mashwari'
// ? price.toStringAsFixed(2)
// : totalPassenger
paymentAmount.toString()
],
);
'Driver Finish Trip',
'${'you will pay to Driver'.tr} $paymentAmount \$',
tokenPassenger,
[
box.read(BoxName.driverID),
rideId,
box.read(BoxName.tokenDriver),
// carType == 'Comfort' || carType == 'Mashwari'
// ? price.toStringAsFixed(2)
// : totalPassenger
paymentAmount.toString()
],
'ding.wav');
Get.to(() => RatePassenger(), arguments: {
'passengerId': passengerId,
'rideId': rideId,

View File

@@ -95,21 +95,29 @@ class OrderRequestController extends GetxController {
List<Map<String, dynamic>> results = await sql.getCustomQuery(customQuery);
}
void startTimer(String driverID, orderID) async {
for (int i = 0; i <= duration; i++) {
bool _timerActive = false;
Future<void> startTimer(String driverID, String orderID) async {
_timerActive = true;
for (int i = 0; i <= duration && _timerActive; i++) {
await Future.delayed(const Duration(seconds: 1));
progress = i / duration;
remainingTime = duration - i;
update();
}
if (remainingTime == 0) {
if (remainingTime == 0 && _timerActive) {
if (applied == false) {
endTimer();
refuseOrder(orderID);
}
}
}
void endTimer() {
_timerActive = false;
}
void startTimerSpeed(String driverID, orderID) async {
for (int i = 0; i <= durationSpeed; i++) {
await Future.delayed(const Duration(seconds: 1));
@@ -144,15 +152,16 @@ class OrderRequestController extends GetxController {
});
// applied = true;
sql.insertData({
'order_id': orderID,
'created_at': DateTime.now().toString(),
'driver_id': box.read(BoxName.driverID).toString(),
}, TableName.driverOrdersRefuse);
getRefusedOrderByCaptain();
if (box.read(BoxName.gender).toString() != 'Female') {
sql.insertData({
'order_id': orderID,
'created_at': DateTime.now().toString(),
'driver_id': box.read(BoxName.driverID).toString(),
}, TableName.driverOrdersRefuse);
getRefusedOrderByCaptain();
}
update();
Get.back();
// Get.back();
// Get.offAll(HomeCaptain());
}

View File

@@ -223,12 +223,12 @@ class CaptainWalletController extends GetxController {
});
if (res1 != 'failure') {
FirebaseMessagesController().sendNotificationToDriverMAP(
'Transfer',
'${'You have transfer to your wallet from'.tr}'
'${box.read(BoxName.nameDriver)}',
amountToNewDriverMap[0]['token'].toString(),
[],
);
'Transfer',
'${'You have transfer to your wallet from'.tr}'
'${box.read(BoxName.nameDriver)}',
amountToNewDriverMap[0]['token'].toString(),
[],
'order1.wav');
await addSeferWallet('payout fee', '5');
Get.defaultDialog(