This commit is contained in:
Hamza-Ayed
2024-06-15 21:10:06 +03:00
parent e04b594860
commit 03cd18dae0
30 changed files with 710 additions and 158 deletions

View File

@@ -1,5 +1,6 @@
import 'dart:convert';
import 'dart:io';
import 'package:SEFER/views/home/HomePage/trip_monitor/trip_monitor.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -138,6 +139,15 @@ class FirebaseMessagesController extends GetxController {
NotificationController()
.showNotification('Promo', 'Show latest promo'.tr, 'promo');
Get.to(const PromosPassengerPage());
} else if (message.notification!.title! == 'Trip Monitoring') {
NotificationController().showNotification(
'Trip Monitoring'.tr, 'Show latest promo'.tr, 'iphone_ringtone');
var myListString = message.data['passengerList'];
var myList = jsonDecode(myListString) as List<dynamic>;
Get.to(const TripMonitor(), arguments: {
'rideId': myList[0].toString(),
'driverId': myList[1].toString(),
});
} else if (message.notification!.title! == 'token change') {
NotificationController()
.showNotification('token change', 'token change', 'cancel');
@@ -186,16 +196,23 @@ class FirebaseMessagesController extends GetxController {
box.write(BoxName.passengerWalletTotal, 0);
}
Get.find<MapPassengerController>().tripFinishedFromDriver();
// if (Get.find<PaymentController>().isCashChecked == false &&
// Get.find<PaymentController>().isWalletChecked == true) {
// // driverFinishTripDialoge(driverList);
// } else {
Get.to(() => RateDriverFromPassenger(), arguments: {
'driverId': driverList[0].toString(),
'rideId': driverList[1].toString(),
'price': driverList[3].toString()
});
// }
} else if (message.notification!.title! == "Finish Monitor") {
Get.defaultDialog(
titleStyle: AppStyle.title,
title: 'Trip finished '.tr,
middleText: '',
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
Get.offAll(() => const MapPagePassenger());
}));
} else if (message.notification!.title! == 'Call Income') {
try {
var myListString = message.data['passengerList'];
@@ -265,6 +282,8 @@ class FirebaseMessagesController extends GetxController {
.tr,
'cancel');
}
box.write(BoxName.parentTripSelected, false);
box.remove(BoxName.tokenParent);
Get.find<MapPassengerController>().restCounter();
Get.offAll(const MapPagePassenger());