25-10-5/1
This commit is contained in:
@@ -24,6 +24,7 @@ import '../../../print.dart';
|
||||
import '../../../views/Rate/rate_passenger.dart';
|
||||
import '../../../views/home/Captin/home_captain/home_captin.dart';
|
||||
import '../../firebase/firbase_messge.dart';
|
||||
import '../../firebase/notification_service.dart';
|
||||
import '../../functions/crud.dart';
|
||||
import '../../functions/encrypt_decrypt.dart';
|
||||
import '../../functions/location_controller.dart';
|
||||
@@ -195,13 +196,23 @@ class MapDriverController extends GetxController {
|
||||
cancelTripFromDriverAfterApplied() async {
|
||||
if (formKeyCancel.currentState!.validate()) {
|
||||
box.write(BoxName.statusDriverLocation, 'off');
|
||||
Get.find<FirebaseMessagesController>().sendNotificationToDriverMAP(
|
||||
"Cancel Trip from driver",
|
||||
"Trip Cancelled from driver. We are looking for a new driver. Please wait."
|
||||
.tr,
|
||||
tokenPassenger,
|
||||
[],
|
||||
'cancel.wav',
|
||||
// Get.find<FirebaseMessagesController>().sendNotificationToDriverMAP(
|
||||
// "Cancel Trip from driver",
|
||||
// "Trip Cancelled from driver. We are looking for a new driver. Please wait."
|
||||
// .tr,
|
||||
// tokenPassenger,
|
||||
// [],
|
||||
// 'cancel.wav',
|
||||
// );
|
||||
NotificationService.sendNotification(
|
||||
target: tokenPassenger.toString(),
|
||||
title: "Cancel Trip from driver".tr,
|
||||
body:
|
||||
"Trip Cancelled from driver. We are looking for a new driver. Please wait."
|
||||
.tr,
|
||||
isTopic: false, // Important: this is a token
|
||||
tone: 'cancel',
|
||||
driverList: [],
|
||||
);
|
||||
await CRUD().post(
|
||||
link: "${AppLink.seferCairoServer}/ride/rides/update.php",
|
||||
@@ -334,12 +345,20 @@ class MapDriverController extends GetxController {
|
||||
|
||||
// Get.find<HomeCaptainController>().changeToAppliedRide('Applied');
|
||||
|
||||
Get.find<FirebaseMessagesController>().sendNotificationToDriverMAP(
|
||||
'Driver Is Going To Passenger',
|
||||
box.read(BoxName.nameDriver).toString(), //todo name driver
|
||||
tokenPassenger,
|
||||
[],
|
||||
'start.wav');
|
||||
// Get.find<FirebaseMessagesController>().sendNotificationToDriverMAP(
|
||||
// 'Driver Is Going To Passenger',
|
||||
// box.read(BoxName.nameDriver).toString(), //todo name driver
|
||||
// tokenPassenger,
|
||||
// [],
|
||||
// 'start.wav');
|
||||
NotificationService.sendNotification(
|
||||
target: tokenPassenger.toString(),
|
||||
title: 'Driver Is Going To Passenger'.tr,
|
||||
body: box.read(BoxName.nameDriver).toString(),
|
||||
isTopic: false, // Important: this is a token
|
||||
tone: 'start',
|
||||
driverList: [],
|
||||
);
|
||||
}
|
||||
|
||||
bool isSocialPressed = false;
|
||||
@@ -427,15 +446,15 @@ class MapDriverController extends GetxController {
|
||||
'order_id': (rideId).toString(),
|
||||
'status': 'Begin'
|
||||
});
|
||||
final fcm = Get.isRegistered<FirebaseMessagesController>()
|
||||
? Get.find<FirebaseMessagesController>()
|
||||
: Get.put(FirebaseMessagesController());
|
||||
fcm.sendNotificationToDriverMAP(
|
||||
'Trip is Begin',
|
||||
box.read(BoxName.nameDriver).toString(),
|
||||
tokenPassenger,
|
||||
[],
|
||||
'start.wav');
|
||||
|
||||
NotificationService.sendNotification(
|
||||
target: tokenPassenger.toString(),
|
||||
title: 'Trip is Begin',
|
||||
body: box.read(BoxName.nameDriver).toString(),
|
||||
isTopic: false, // Important: this is a token
|
||||
tone: 'start',
|
||||
driverList: [],
|
||||
);
|
||||
rideIsBeginPassengerTimer();
|
||||
|
||||
update();
|
||||
@@ -752,17 +771,30 @@ class MapDriverController extends GetxController {
|
||||
Get.put(DriverBehaviorController())
|
||||
.sendSummaryToServer(driverId, rideId);
|
||||
|
||||
Get.find<FirebaseMessagesController>().sendNotificationToDriverMAP(
|
||||
"Driver Finish Trip",
|
||||
'${'you will pay to Driver'.tr} $paymentAmount \$',
|
||||
tokenPassenger,
|
||||
[
|
||||
box.read(BoxName.driverID),
|
||||
rideId,
|
||||
box.read(BoxName.tokenDriver),
|
||||
paymentAmount.toString()
|
||||
],
|
||||
'ding.wav');
|
||||
// Get.find<FirebaseMessagesController>().sendNotificationToDriverMAP(
|
||||
// "Driver Finish Trip",
|
||||
// '${'you will pay to Driver'.tr} $paymentAmount \$',
|
||||
// tokenPassenger,
|
||||
// [
|
||||
// box.read(BoxName.driverID),
|
||||
// rideId,
|
||||
// box.read(BoxName.tokenDriver),
|
||||
// paymentAmount.toString()
|
||||
// ],
|
||||
// 'ding.wav');
|
||||
NotificationService.sendNotification(
|
||||
target: tokenPassenger.toString(),
|
||||
title: "Driver Finish Trip",
|
||||
body: '${'you will pay to Driver'.tr} $paymentAmount \$'.tr,
|
||||
isTopic: false, // Important: this is a token
|
||||
tone: 'ding',
|
||||
driverList: [
|
||||
box.read(BoxName.driverID),
|
||||
rideId,
|
||||
box.read(BoxName.tokenDriver),
|
||||
paymentAmount.toString()
|
||||
],
|
||||
);
|
||||
|
||||
Get.to(() => RatePassenger(), arguments: {
|
||||
'passengerId': passengerId,
|
||||
@@ -1617,17 +1649,30 @@ class MapDriverController extends GetxController {
|
||||
|
||||
if (distance < 300) {
|
||||
// 300 متر قبل الوجهة
|
||||
Get.find<FirebaseMessagesController>().sendNotificationToDriverMAP(
|
||||
"You are near the destination",
|
||||
"You are near the destination".tr,
|
||||
tokenPassenger,
|
||||
[
|
||||
// Get.find<FirebaseMessagesController>().sendNotificationToDriverMAP(
|
||||
// "You are near the destination",
|
||||
// "You are near the destination".tr,
|
||||
// tokenPassenger,
|
||||
// [
|
||||
// box.read(BoxName.driverID),
|
||||
// rideId,
|
||||
// box.read(BoxName.tokenDriver),
|
||||
// paymentAmount.toString()
|
||||
// ],
|
||||
// 'ding.wav',
|
||||
// );
|
||||
NotificationService.sendNotification(
|
||||
target: tokenPassenger.toString(),
|
||||
title: "You are near the destination",
|
||||
body: "You are near the destination".tr,
|
||||
isTopic: false, // Important: this is a token
|
||||
tone: 'ding',
|
||||
driverList: [
|
||||
box.read(BoxName.driverID),
|
||||
rideId,
|
||||
box.read(BoxName.tokenDriver),
|
||||
paymentAmount.toString()
|
||||
],
|
||||
'ding.wav',
|
||||
);
|
||||
// يمكن إضافة أي إجراء آخر هنا عند الاقتراب من الوجهة
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user