5/2/passnew
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
|
||||
import 'package:SEFER/controller/home/captin/map_driver_controller.dart';
|
||||
import 'package:SEFER/views/home/Captin/home_captain/widget/call_page.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -18,14 +15,10 @@ import '../../constant/links.dart';
|
||||
import '../../constant/style.dart';
|
||||
import '../../main.dart';
|
||||
import '../../views/Rate/rate_captain.dart';
|
||||
import '../../views/home/Captin/home_captain/home_captin.dart';
|
||||
import '../../views/home/Captin/orderCaptin/order_speed_request.dart';
|
||||
import '../../views/home/map_page_passenger.dart';
|
||||
import '../../views/home/map_widget.dart/call_passenger_page.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 '../payment/payment_controller.dart';
|
||||
import 'local_notification.dart';
|
||||
|
||||
class FirebaseMessagesController extends GetxController {
|
||||
@@ -121,25 +114,6 @@ class FirebaseMessagesController extends GetxController {
|
||||
|
||||
void fireBaseTitles(RemoteMessage message) {
|
||||
if (message.notification!.title! == 'Order') {
|
||||
if (Platform.isAndroid) {
|
||||
NotificationController().showNotification('Order', '', 'order');
|
||||
}
|
||||
var myListString = message.data['DriverList'];
|
||||
// var points = message.data['PolylineJson'];
|
||||
|
||||
var myList = jsonDecode(myListString) as List<dynamic>;
|
||||
// var myPoints = jsonDecode(points) as List<dynamic>;
|
||||
driverToken = myList[14].toString();
|
||||
// This is for location using and uploading status
|
||||
Get.put(HomeCaptainController()).changeRideId();
|
||||
update();
|
||||
// print('driverToken==============$driverToken');
|
||||
Get.to(() => OrderRequestPage(), arguments: {
|
||||
'myListString': myListString,
|
||||
'DriverList': myList,
|
||||
// 'PolylineJson': myPoints,
|
||||
'body': message.notification!.body
|
||||
});
|
||||
} else if (message.notification!.title! == 'Apply Ride') {
|
||||
var passengerList = message.data['passengerList'];
|
||||
|
||||
@@ -153,10 +127,6 @@ class FirebaseMessagesController extends GetxController {
|
||||
NotificationController()
|
||||
.showNotification('Promo', 'Show latest promo'.tr, 'promo');
|
||||
Get.to(const PromosPassengerPage());
|
||||
} else if (message.notification!.title == 'Cancel Trip') {
|
||||
NotificationController().showNotification(
|
||||
'Cancel Trip'.tr, 'Passenger Cancel Trip'.tr, 'cancel');
|
||||
cancelTripDialog();
|
||||
} else if (message.notification!.title! == 'DriverIsGoingToPassenger') {
|
||||
Get.find<MapPassengerController>().isDriverInPassengerWay = true;
|
||||
Get.find<MapPassengerController>().update();
|
||||
@@ -227,26 +197,6 @@ class FirebaseMessagesController extends GetxController {
|
||||
} catch (e) {
|
||||
print('Error navigating to PassengerCallPage: $e');
|
||||
}
|
||||
} else if (message.notification!.title! == 'Call Income from Passenger') {
|
||||
try {
|
||||
var myListString = message.data['passengerList'];
|
||||
var driverList = jsonDecode(myListString) as List<dynamic>;
|
||||
// if (Platform.isAndroid) {
|
||||
NotificationController().showNotification(
|
||||
'Call Income'.tr,
|
||||
message.notification!.body!,
|
||||
'iphone_ringtone',
|
||||
);
|
||||
// }
|
||||
// Assuming GetMaterialApp is initialized and context is valid for navigation
|
||||
Get.to(() => CallPage(
|
||||
// channelName: driverList[1].toString(),
|
||||
// token: driverList[0].toString(),
|
||||
// remoteID: driverList[2].toString(),
|
||||
));
|
||||
} catch (e) {
|
||||
print('Error navigating to PassengerCallPage: $e');
|
||||
}
|
||||
} else if (message.notification!.title! == 'Call End') {
|
||||
try {
|
||||
var myListString = message.data['passengerList'];
|
||||
@@ -259,7 +209,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
);
|
||||
}
|
||||
// Assuming GetMaterialApp is initialized and context is valid for navigation
|
||||
Get.off(const CallPage());
|
||||
// Get.off(const CallPage());
|
||||
} catch (e) {
|
||||
print('Error navigating to PassengerCallPage: $e');
|
||||
}
|
||||
@@ -288,21 +238,6 @@ class FirebaseMessagesController extends GetxController {
|
||||
backgroundColor: AppColor.yellowColor,
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
} else if (message.notification!.title! == 'OrderSpeed') {
|
||||
var myListString = message.data['DriverList'];
|
||||
// var points = message.data['PolylineJson'];
|
||||
|
||||
var myList = jsonDecode(myListString) as List<dynamic>;
|
||||
// var myPoints = jsonDecode(points) as List<dynamic>;
|
||||
driverToken = myList[14].toString();
|
||||
update();
|
||||
// print('driverToken==============$driverToken');
|
||||
Get.to(() => OrderSpeedRequest(), arguments: {
|
||||
'myListString': myListString,
|
||||
'DriverList': myList,
|
||||
// 'PolylineJson': myPoints,
|
||||
'body': message.notification!.body
|
||||
});
|
||||
} else if (message.notification!.title! == 'Order Applied') {
|
||||
NotificationController().showNotification(
|
||||
'The order Accepted by another Driver'.tr,
|
||||
@@ -334,18 +269,6 @@ class FirebaseMessagesController extends GetxController {
|
||||
);
|
||||
}
|
||||
|
||||
Future<dynamic> cancelTripDialog() {
|
||||
return Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
title: 'Passenger Cancel Trip'.tr,
|
||||
middleText: '',
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok'.tr,
|
||||
onPressed: () {
|
||||
Get.offAll(HomeCaptain());
|
||||
}));
|
||||
}
|
||||
|
||||
Future<dynamic> driverArrivePassengerDialoge() {
|
||||
return Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
|
||||
Reference in New Issue
Block a user