This commit is contained in:
Hamza-Ayed
2023-10-06 12:02:34 +03:00
parent edc3a4348d
commit 54e948e93b
14 changed files with 505 additions and 75 deletions

View File

@@ -96,8 +96,11 @@ class FirebaseMessagesController extends GetxController {
Future getToken() async {
fcmToken.getToken().then((token) {
box.write(BoxName.tokenFCM, token);
box.write(BoxName.tokenDriver, token);
if (box.read(BoxName.email) == null) {
box.write(BoxName.tokenDriver, token);
} else {
box.write(BoxName.tokenFCM, token);
}
print(token);
});
@@ -184,7 +187,7 @@ class FirebaseMessagesController extends GetxController {
);
} else if (message.notification!.title!.contains('Promo')) {
Get.to(const PromosPassengerPage());
} else if (message.notification!.title!.contains('BeginTrip')) {
} else if (message.notification!.title!.contains('RideIsBegin')) {
// MapDirection mapDirection = Get.find<MapDirection>();
// mapDirection.clearPolyline();
print('jjjjjjjjjjjjjjjjjjjjjjjjjjj');
@@ -371,6 +374,15 @@ class FirebaseMessagesController extends GetxController {
);
} else if (message.notification!.title!.contains('Promo')) {
Get.to(const PromosPassengerPage());
} else if (message.notification!.title!.contains('RideIsBegin')) {
// MapDirection mapDirection = Get.find<MapDirection>();
// mapDirection.clearPolyline();
print('jjjjjjjjjjjjjjjjjjjjjjjjjjj');
Get.defaultDialog(
title: 'The Ride is Begin'.tr,
backgroundColor: AppColor.greenColor,
);
MapDirection().clearPolyline();
}
});
}
@@ -442,7 +454,7 @@ class FirebaseMessagesController extends GetxController {
// }
// }
void sendNotificanToPassengerToken(
void sendNotificationToPassengerToken(
String title, body, token, List<String> map) async {
try {
final response = await http.post(
@@ -479,7 +491,7 @@ class FirebaseMessagesController extends GetxController {
}
}
void sendNotificationToDriverId(
void sendNotificationToAnyWithoutData(
String title, String body, String token) async {
try {
final response = await http.post(
@@ -494,7 +506,11 @@ class FirebaseMessagesController extends GetxController {
'body': body,
'sound': 'true'
},
'data': {},
'data': <String, dynamic>{
'click_action': 'FLUTTER_NOTIFICATION_CLICK',
'id': '1',
'status': 'done'
},
'priority': 'high',
'to': token,
}),