1/13/1
This commit is contained in:
@@ -96,105 +96,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
|
||||
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
|
||||
if (message.data.isNotEmpty) {
|
||||
if (message.notification!.title!.contains('Order')) {
|
||||
var myListString = message.data['DriverList'];
|
||||
print(myListString);
|
||||
print('9999999999999myListString999999999999999');
|
||||
var myList = jsonDecode(myListString) as List<dynamic>;
|
||||
driverToken = myList[14].toString();
|
||||
update();
|
||||
print('driverToken==============$driverToken');
|
||||
Get.to(() => OrderRequestPage(), arguments: {
|
||||
'myListString': myListString,
|
||||
'DriverList': myList,
|
||||
'body': message.notification!.body
|
||||
});
|
||||
} else if (message.notification!.title!.contains('Apply Ride')) {
|
||||
var passengerList = message.data['passengerList'];
|
||||
print(passengerList);
|
||||
print('9999999999999my Apply Ride 999999999999999');
|
||||
var myList = jsonDecode(passengerList) as List<dynamic>;
|
||||
driverID = myList[2].toString();
|
||||
|
||||
Get.snackbar(
|
||||
'Captain Applied the Ride for You'.tr,
|
||||
'message',
|
||||
colorText: AppColor.greenColor,
|
||||
duration: const Duration(seconds: 11),
|
||||
instantInit: true,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
titleText: Text(
|
||||
'Applied'.tr,
|
||||
style: const TextStyle(color: AppColor.redColor),
|
||||
),
|
||||
messageText: Text(
|
||||
'Captain Applied the Ride for You'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
icon: const Icon(Icons.approval),
|
||||
shouldIconPulse: true,
|
||||
maxWidth: double.infinity,
|
||||
margin: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
borderRadius: 8,
|
||||
borderColor: AppColor.primaryColor,
|
||||
borderWidth: 2,
|
||||
backgroundColor: AppColor.secondaryColor,
|
||||
leftBarIndicatorColor: AppColor.greenColor,
|
||||
boxShadows: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.25),
|
||||
blurRadius: 4,
|
||||
spreadRadius: 2,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
],
|
||||
backgroundGradient: const LinearGradient(
|
||||
colors: [AppColor.greenColor, AppColor.accentColor],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
onTap: (GetSnackBar snackBar) {
|
||||
// Do something when the snackbar is tapped.
|
||||
// MapController().rideConfirm = false;
|
||||
// update();
|
||||
},
|
||||
isDismissible: true,
|
||||
showProgressIndicator: false,
|
||||
dismissDirection: DismissDirection.up,
|
||||
progressIndicatorController: null,
|
||||
progressIndicatorBackgroundColor: Colors.transparent,
|
||||
progressIndicatorValueColor: null,
|
||||
snackStyle: SnackStyle.GROUNDED,
|
||||
forwardAnimationCurve: Curves.easeInToLinear,
|
||||
reverseAnimationCurve: Curves.easeInOut,
|
||||
animationDuration: const Duration(milliseconds: 4000),
|
||||
barBlur: 8,
|
||||
overlayBlur: 0,
|
||||
snackbarStatus: null,
|
||||
overlayColor: AppColor.primaryColor.withOpacity(0.5),
|
||||
userInputForm: null,
|
||||
);
|
||||
} else if (message.notification!.title!.contains('Promo')) {
|
||||
Get.to(const PromosPassengerPage());
|
||||
} else if (message.notification!.title!
|
||||
.contains('DriverIsGoingToPassenger')) {
|
||||
Get.snackbar('Driver is Going To Passenger', '',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
} else if (message.notification!.title!.contains('RideIsBegin')) {
|
||||
// MapPassengerController mapController = Get.put(MapPassengerController());
|
||||
Get.snackbar('RideIsBegin', '', backgroundColor: AppColor.greenColor);
|
||||
// mapController.driverArrivePassenger();
|
||||
update();
|
||||
} else if (message.notification!.title!
|
||||
.contains('Captain Finish Trip')) {
|
||||
// MapPassengerController mapController =
|
||||
// Get.find<MapPassengerController>();
|
||||
Get.snackbar('Ride Finished'.tr, '',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
// mapController.isRideFinished = true;//todo fix that for dfinish ride in passenger app
|
||||
update();
|
||||
}
|
||||
firebasetitles(message);
|
||||
}
|
||||
// If the app is in the background or terminated, show a system tray message
|
||||
RemoteNotification? notification = message.notification;
|
||||
@@ -203,106 +105,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
if (notification != null && android != null) {
|
||||
// print('onMessageOpenedApp: ${notification.title} ${notification.body}');
|
||||
if (message.data.isNotEmpty) {
|
||||
if (message.notification!.title!.contains('Order')) {
|
||||
var myListString = message.data['DriverList'];
|
||||
// print(myListString);
|
||||
// print('9999999999999myListString999999999999999');
|
||||
var myList = jsonDecode(myListString) as List<dynamic>;
|
||||
driverToken = myList[14].toString();
|
||||
update();
|
||||
// print('driverToken==============$driverToken');
|
||||
Get.to(() => OrderRequestPage(), arguments: {
|
||||
'myListString': myListString,
|
||||
'DriverList': myList,
|
||||
'body': message.notification!.body
|
||||
});
|
||||
} else if (message.notification!.title!.contains('Apply Ride')) {
|
||||
var passengerList = message.data['passengerList'];
|
||||
// print(passengerList);
|
||||
// print('9999999999999my Apply Ride 999999999999999');
|
||||
var myList = jsonDecode(passengerList) as List<dynamic>;
|
||||
driverID = myList[2].toString();
|
||||
|
||||
Get.snackbar(
|
||||
'Captain Applied the Ride for You'.tr,
|
||||
'message',
|
||||
colorText: AppColor.greenColor,
|
||||
duration: const Duration(seconds: 11),
|
||||
instantInit: true,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
titleText: Text(
|
||||
'Applied'.tr,
|
||||
style: const TextStyle(color: AppColor.redColor),
|
||||
),
|
||||
messageText: Text(
|
||||
'Captain Applied the Ride for You'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
icon: const Icon(Icons.approval),
|
||||
shouldIconPulse: true,
|
||||
maxWidth: double.infinity,
|
||||
margin: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
borderRadius: 8,
|
||||
borderColor: AppColor.primaryColor,
|
||||
borderWidth: 2,
|
||||
backgroundColor: AppColor.secondaryColor,
|
||||
leftBarIndicatorColor: AppColor.greenColor,
|
||||
boxShadows: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.25),
|
||||
blurRadius: 4,
|
||||
spreadRadius: 2,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
],
|
||||
backgroundGradient: const LinearGradient(
|
||||
colors: [AppColor.greenColor, AppColor.accentColor],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
onTap: (GetSnackBar snackBar) {
|
||||
// Do something when the snackbar is tapped.
|
||||
// MapController().rideConfirm = false;
|
||||
// update();
|
||||
},
|
||||
isDismissible: true,
|
||||
showProgressIndicator: false,
|
||||
dismissDirection: DismissDirection.up,
|
||||
progressIndicatorController: null,
|
||||
progressIndicatorBackgroundColor: Colors.transparent,
|
||||
progressIndicatorValueColor: null,
|
||||
snackStyle: SnackStyle.GROUNDED,
|
||||
forwardAnimationCurve: Curves.easeInToLinear,
|
||||
reverseAnimationCurve: Curves.easeInOut,
|
||||
animationDuration: const Duration(milliseconds: 4000),
|
||||
barBlur: 8,
|
||||
overlayBlur: 0,
|
||||
snackbarStatus: null,
|
||||
overlayColor: AppColor.primaryColor.withOpacity(0.5),
|
||||
userInputForm: null,
|
||||
);
|
||||
} else if (message.notification!.title!.contains('Promo')) {
|
||||
Get.to(const PromosPassengerPage());
|
||||
} else if (message.notification!.title!
|
||||
.contains('DriverIsGoingToPassenger')) {
|
||||
Get.snackbar('Driver is Going To Passenger', '',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
} else if (message.notification!.title!.contains('RideIsBegin')) {
|
||||
// MapPassengerController mapController = Get.put(MapPassengerController());
|
||||
Get.snackbar('RideIsBegin', '',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
// mapController.driverArrivePassenger();
|
||||
update();
|
||||
} else if (message.notification!.title!
|
||||
.contains('Captain Finish Trip')) {
|
||||
// MapPassengerController mapController =
|
||||
// Get.find<MapPassengerController>();
|
||||
Get.snackbar('Ride Finished'.tr, '',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
// mapController.isRideFinished = true;//todo fix that for dfinish ride in passenger app
|
||||
update();
|
||||
}
|
||||
firebasetitles(message);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -311,110 +114,71 @@ class FirebaseMessagesController extends GetxController {
|
||||
// print(
|
||||
// 'onMessageOpenedApp: ${message.notification!.title} ${message.notification!.body}');
|
||||
RemoteNotification? notification = message.notification;
|
||||
if (message.data.isNotEmpty) {
|
||||
if (notification!.title!.contains('Order')) {
|
||||
var myListString = message.data['DriverList'];
|
||||
// print(myListString);
|
||||
// print('9999999999999myListString999999999999999');
|
||||
var myList = jsonDecode(myListString) as List<dynamic>;
|
||||
driverToken = myList[14].toString();
|
||||
update();
|
||||
// print('driverToken==============$driverToken');
|
||||
Get.to(() => OrderRequestPage(), arguments: {
|
||||
'myListString': myListString,
|
||||
'DriverList': myList,
|
||||
'body': message.notification!.body
|
||||
});
|
||||
} else if (message.notification!.title!.contains('Apply Ride')) {
|
||||
var passengerList = message.data['passengerList'];
|
||||
// print(passengerList);
|
||||
// print('9999999999999my Apply Ride 999999999999999');
|
||||
var myList = jsonDecode(passengerList) as List<dynamic>;
|
||||
driverID = myList[2].toString();
|
||||
|
||||
Get.snackbar(
|
||||
'Captain Applied the Ride for You'.tr,
|
||||
'message',
|
||||
colorText: AppColor.greenColor,
|
||||
duration: const Duration(seconds: 11),
|
||||
instantInit: true,
|
||||
snackPosition: SnackPosition.TOP,
|
||||
titleText: Text(
|
||||
'Applied'.tr,
|
||||
style: const TextStyle(color: AppColor.redColor),
|
||||
),
|
||||
messageText: Text(
|
||||
'Captain Applied the Ride for You'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
icon: const Icon(Icons.approval),
|
||||
shouldIconPulse: true,
|
||||
maxWidth: double.infinity,
|
||||
margin: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
borderRadius: 8,
|
||||
borderColor: AppColor.primaryColor,
|
||||
borderWidth: 2,
|
||||
backgroundColor: AppColor.secondaryColor,
|
||||
leftBarIndicatorColor: AppColor.greenColor,
|
||||
boxShadows: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.25),
|
||||
blurRadius: 4,
|
||||
spreadRadius: 2,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
],
|
||||
backgroundGradient: const LinearGradient(
|
||||
colors: [AppColor.greenColor, AppColor.accentColor],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
onTap: (GetSnackBar snackBar) {
|
||||
// Do something when the snackbar is tapped.
|
||||
// MapController().rideConfirm = false;
|
||||
// update();
|
||||
},
|
||||
isDismissible: true,
|
||||
showProgressIndicator: false,
|
||||
dismissDirection: DismissDirection.up,
|
||||
progressIndicatorController: null,
|
||||
progressIndicatorBackgroundColor: Colors.transparent,
|
||||
progressIndicatorValueColor: null,
|
||||
snackStyle: SnackStyle.GROUNDED,
|
||||
forwardAnimationCurve: Curves.easeInToLinear,
|
||||
reverseAnimationCurve: Curves.easeInOut,
|
||||
animationDuration: const Duration(milliseconds: 4000),
|
||||
barBlur: 8,
|
||||
overlayBlur: 0,
|
||||
snackbarStatus: null,
|
||||
overlayColor: AppColor.primaryColor.withOpacity(0.5),
|
||||
userInputForm: null,
|
||||
);
|
||||
} else if (message.notification!.title!.contains('Promo')) {
|
||||
Get.to(const PromosPassengerPage());
|
||||
} else if (message.notification!.title!
|
||||
.contains('DriverIsGoingToPassenger')) {
|
||||
Get.snackbar('Driver is Going To Passenger', '',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
} else if (message.notification!.title!.contains('RideIsBegin')) {
|
||||
// MapPassengerController mapController = Get.put(MapPassengerController());
|
||||
Get.snackbar('RideIsBegin', '', backgroundColor: AppColor.greenColor);
|
||||
// mapController.driverArrivePassenger();
|
||||
update();
|
||||
} else if (message.notification!.title!
|
||||
.contains('Captain Finish Trip')) {
|
||||
// MapPassengerController mapController =
|
||||
// Get.find<MapPassengerController>();
|
||||
Get.snackbar('Ride Finished'.tr, '',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
// mapController.isRideFinished = true;//todo fix that for dfinish ride in passenger app
|
||||
update();
|
||||
}
|
||||
}
|
||||
firebasetitles(message);
|
||||
});
|
||||
}
|
||||
|
||||
void firebasetitles(RemoteMessage message) {
|
||||
if (message.notification!.title!.contains('Order')) {
|
||||
var myListString = message.data['DriverList'];
|
||||
print(myListString);
|
||||
print('9999999999999myListString999999999999999');
|
||||
var myList = jsonDecode(myListString) as List<dynamic>;
|
||||
driverToken = myList[14].toString();
|
||||
update();
|
||||
print('driverToken==============$driverToken');
|
||||
Get.to(() => OrderRequestPage(), arguments: {
|
||||
'myListString': myListString,
|
||||
'DriverList': myList,
|
||||
'body': message.notification!.body
|
||||
});
|
||||
} else if (message.notification!.title!.contains('Apply Ride')) {
|
||||
var passengerList = message.data['passengerList'];
|
||||
print(passengerList);
|
||||
print('9999999999999my Apply Ride 999999999999999');
|
||||
var myList = jsonDecode(passengerList) as List<dynamic>;
|
||||
driverID = myList[2].toString();
|
||||
|
||||
Get.snackbar(
|
||||
'Captain Applied the Ride for You'.tr,
|
||||
'message',
|
||||
colorText: AppColor.greenColor,
|
||||
duration: const Duration(seconds: 11),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
titleText: Text(
|
||||
'Applied'.tr,
|
||||
style: const TextStyle(color: AppColor.redColor),
|
||||
),
|
||||
messageText: Text(
|
||||
'Captain Applied the Ride for You'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
icon: const Icon(Icons.approval),
|
||||
shouldIconPulse: true,
|
||||
margin: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
);
|
||||
} else if (message.notification!.title!.contains('Promo')) {
|
||||
Get.to(const PromosPassengerPage());
|
||||
} else if (message.notification!.title!
|
||||
.contains('DriverIsGoingToPassenger')) {
|
||||
Get.snackbar('Driver is Going To Passenger', '',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
} else if (message.notification!.title!.contains('RideIsBegin')) {
|
||||
// MapPassengerController mapController = Get.put(MapPassengerController());
|
||||
Get.snackbar('RideIsBegin', '', backgroundColor: AppColor.greenColor);
|
||||
// mapController.driverArrivePassenger();
|
||||
update();
|
||||
} else if (message.notification!.title!.contains('Captain Finish Trip')) {
|
||||
// MapPassengerController mapController =
|
||||
// Get.find<MapPassengerController>();
|
||||
Get.snackbar('Ride Finished'.tr, '',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
// mapController.isRideFinished = true;//todo fix that for dfinish ride in passenger app
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void sendNotificationAll(String title, body) async {
|
||||
// Get the token you want to subtract.
|
||||
String token = box.read(BoxName.tokenFCM);
|
||||
|
||||
Reference in New Issue
Block a user