This commit is contained in:
Hamza-Ayed
2024-02-09 02:56:37 +03:00
parent d4d4592944
commit 8c61a79de3
15 changed files with 397 additions and 71 deletions

View File

@@ -20,6 +20,7 @@ import '../../views/home/Captin/home_captain/home_captin.dart';
import '../../views/home/profile/promos_passenger_page.dart';
import '../../views/home/Captin/orderCaptin/order_request_page.dart';
import '../home/map_passenger_controller.dart';
import '../home/payment/captain_wallet_controller.dart';
class FirebaseMessagesController extends GetxController {
final fcmToken = FirebaseMessaging.instance;
@@ -102,15 +103,15 @@ class FirebaseMessagesController extends GetxController {
});
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
if (message.notification != null && message.data.isNotEmpty) {
fireBaseTitles(message);
}
// if (message.notification != null && message.data.isNotEmpty) {
// fireBaseTitles(message);
// }
// If the app is in the background or terminated, show a system tray message
RemoteNotification? notification = message.notification;
AndroidNotification? android = notification?.android;
// if (notification != null && android != null) {
if (message.data.isNotEmpty) {
if (message.data.isNotEmpty && message.notification != null) {
fireBaseTitles(message);
}
});
@@ -221,6 +222,14 @@ class FirebaseMessagesController extends GetxController {
'passenger_id': box.read(BoxName.passengerID).toString(),
'balance': ((-1) * tip).toString()
});
await CRUD().post(link: AppLink.addDriversWallet, payload: {
'driverID': driverList[0].toString(),
'paymentID': '${Get.find<MapPassengerController>().rideId}tip',
'amount': (tip * 100).toString(),
'paymentMethod': 'visa-tip',
});
if (res != 'failure') {
FirebaseMessagesController().sendNotificationToAnyWithoutData(
'You Have Tips',
@@ -238,8 +247,10 @@ class FirebaseMessagesController extends GetxController {
cancel: MyElevatedButton(
title: 'No,I want'.tr,
onPressed: () {
Get.back();
Get.off(() => RateCaptainFromPassenger());
Get.to(() => RateCaptainFromPassenger(), arguments: {
'driverId': driverList[0].toString(),
'rideId': driverList[1].toString(),
});
},
kolor: AppColor.redColor,
));