25-10-5/1

This commit is contained in:
Hamza-Ayed
2025-10-08 13:14:07 +03:00
parent 1cc66029a3
commit 482c1296bc
22 changed files with 770 additions and 559 deletions

View File

@@ -9,7 +9,9 @@ import 'package:sefer_driver/views/widgets/elevated_btn.dart';
import '../../../../constant/box_name.dart';
import '../../../../constant/style.dart';
import '../../../../controller/firebase/notification_service.dart';
import '../../../../main.dart';
import '../../../../print.dart';
// Changed: إعادة تصميم كاملة لتصبح شريط معلومات علوي مدمج
class PassengerInfoWindow extends StatelessWidget {
@@ -154,12 +156,23 @@ class PassengerInfoWindow extends StatelessWidget {
if (await controller
.calculateDistanceBetweenDriverAndPassengerLocation() <
140) {
fcm.sendNotificationToDriverMAP(
'Hi ,I Arrive your site',
'I Arrive at your site'.tr,
controller.tokenPassenger,
[],
'ding.wav',
// fcm.sendNotificationToDriverMAP(
// 'Hi ,I Arrive your site',
// 'I Arrive at your site'.tr,
// controller.tokenPassenger,
// [],
// 'ding.wav',
// );
Log.print(
'controller.tokenPassenger: ${controller.tokenPassenger}');
NotificationService.sendNotification(
target: controller.tokenPassenger.toString(),
title: 'Hi ,I Arrive your site'.tr,
body: 'I Arrive at your site'.tr,
isTopic: false, // Important: this is a token
tone: 'ding',
driverList: [],
);
controller.startTimerToShowDriverWaitPassengerDuration();
controller.isArrivedSend = false;
@@ -239,13 +252,22 @@ class PassengerInfoWindow extends StatelessWidget {
kolor: AppColor.deepPurpleAccent,
onPressed: () {
MyDialog().getDialog('Are you sure to cancel?'.tr, '', () async {
fcm.sendNotificationToDriverMAP(
'Driver Cancelled Your Trip',
'You will need to pay the cost to the driver, or it will be deducted from your next trip'
.tr,
controller.tokenPassenger,
[],
'cancel.wav');
// fcm.sendNotificationToDriverMAP(
// 'Driver Cancelled Your Trip',
// 'You will need to pay the cost to the driver, or it will be deducted from your next trip'
// .tr,
// controller.tokenPassenger,
// [],
// 'cancel.wav');
NotificationService.sendNotification(
target: controller.tokenPassenger.toString(),
title: 'Driver Cancelled Your Trip',
body:
'You will need to pay the cost to the driver, or it will be deducted from your next trip',
isTopic: false, // Important: this is a token
tone: 'cancel',
driverList: [],
);
box.write(BoxName.rideStatus, 'Cancel');
await controller.addWaitingTimeCostFromPassengerToDriverWallet();
controller.isdriverWaitTimeEnd = false;

View File

@@ -201,6 +201,7 @@ import '../../../../constant/box_name.dart';
import '../../../../constant/colors.dart';
import '../../../../constant/style.dart';
import '../../../../controller/firebase/firbase_messge.dart';
import '../../../../controller/firebase/notification_service.dart';
import '../../../../controller/functions/launch.dart';
import '../../../../controller/home/captin/map_driver_controller.dart';
import '../../../../main.dart';
@@ -339,23 +340,39 @@ class SosConnect extends StatelessWidget {
_buildMessageTile(
text: "Where are you, sir?".tr,
onTap: () {
fcm.sendNotificationToDriverMAP(
'message From Driver',
"Where are you, sir?".tr,
controller.tokenPassenger,
[],
'ding.wav');
// fcm.sendNotificationToDriverMAP(
// 'message From Driver',
// "Where are you, sir?".tr,
// controller.tokenPassenger,
// [],
// 'ding');
NotificationService.sendNotification(
target: controller.tokenPassenger.toString(),
title: 'message From Driver'.tr,
body: "Where are you, sir?".tr,
isTopic: false, // Important: this is a token
tone: 'ding',
driverList: [],
);
Get.back();
}),
_buildMessageTile(
text: "I've been trying to reach you but your phone is off.".tr,
onTap: () {
fcm.sendNotificationToDriverMAP(
'message From Driver',
"I've been trying to reach you but your phone is off.".tr,
controller.tokenPassenger,
[],
'ding.wav');
// fcm.sendNotificationToDriverMAP(
// 'message From Driver',
// "I've been trying to reach you but your phone is off.".tr,
// controller.tokenPassenger,
// [],
// 'ding');
NotificationService.sendNotification(
target: controller.tokenPassenger.toString(),
title: 'message From Driver'.tr,
body: "I've been trying to reach you but your phone is off.".tr,
isTopic: false, // Important: this is a token
tone: 'ding',
driverList: [],
);
Get.back();
}),
const SizedBox(height: 16),
@@ -374,12 +391,20 @@ class SosConnect extends StatelessWidget {
),
IconButton(
onPressed: () {
fcm.sendNotificationToDriverMAP(
'message From Driver',
controller.messageToPassenger.text,
controller.tokenPassenger,
[],
'ding.wav');
// fcm.sendNotificationToDriverMAP(
// 'message From Driver',
// controller.messageToPassenger.text,
// controller.tokenPassenger,
// [],
// 'ding');
NotificationService.sendNotification(
target: controller.tokenPassenger.toString(),
title: 'message From Driver'.tr,
body: 'change device'.tr,
isTopic: false, // Important: this is a token
tone: 'cancel',
driverList: [],
);
controller.messageToPassenger.clear();
Get.back();
},