25-10-5/1
This commit is contained in:
@@ -69,7 +69,9 @@ class FirebaseMessagesController extends GetxController {
|
||||
}
|
||||
|
||||
NotificationController notificationController =
|
||||
Get.put(NotificationController());
|
||||
Get.isRegistered<NotificationController>()
|
||||
? Get.find<NotificationController>()
|
||||
: Get.put(NotificationController());
|
||||
|
||||
Future getTokens() async {
|
||||
String? basicAuthCredentials =
|
||||
@@ -96,7 +98,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
|
||||
Future getToken() async {
|
||||
fcmToken.getToken().then((token) {
|
||||
Log.print('fcmToken: ${token}');
|
||||
// Log.print('fcmToken: ${token}');
|
||||
box.write(BoxName.tokenFCM, (token.toString()));
|
||||
});
|
||||
|
||||
@@ -125,16 +127,17 @@ class FirebaseMessagesController extends GetxController {
|
||||
|
||||
Future<void> fireBaseTitles(RemoteMessage message) async {
|
||||
if (message.notification!.title! == 'Order'.tr) {
|
||||
Log.print('message: ${message}');
|
||||
if (Platform.isAndroid) {
|
||||
notificationController.showNotification(
|
||||
'Order', message.notification!.body!, 'Order');
|
||||
'Order'.tr, message.notification!.body!, 'Order');
|
||||
}
|
||||
} else if (message.notification!.title! == 'Accepted Ride') {
|
||||
if (Platform.isAndroid) {
|
||||
notificationController.showNotification(
|
||||
'Accepted Ride'.tr, 'Driver Accepted the Ride for You'.tr, 'ding');
|
||||
}
|
||||
var passengerList = message.data['DriverList'];
|
||||
var passengerList = message.data['passengerList'];
|
||||
|
||||
var myList = jsonDecode(passengerList) as List<dynamic>;
|
||||
Log.print('myList: ${myList}');
|
||||
@@ -513,7 +516,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
// 'DriverList': jsonEncode(data),
|
||||
// },
|
||||
'android': {
|
||||
'priority': 'high', // Set priority to high
|
||||
'priority': 'HIGH ', // Set priority to high
|
||||
'notification': {
|
||||
'sound': tone,
|
||||
},
|
||||
@@ -549,7 +552,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
// 'body': body,
|
||||
// 'sound': 'true'
|
||||
// },
|
||||
// 'priority': 'high',
|
||||
// 'priority': 'HIGH ',
|
||||
// 'data': <String, dynamic>{
|
||||
// 'click_action': 'FLUTTER_NOTIFICATION_CLICK',
|
||||
// 'id': '1',
|
||||
@@ -581,7 +584,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
|
||||
Future<void> sendNotificationToDriverMAP(
|
||||
String title, String body, String token, List<String> data, String tone,
|
||||
{int retryCount = 2}) async {
|
||||
{int retryCount = 1}) async {
|
||||
try {
|
||||
if (serviceAccountKeyJson.isEmpty) {
|
||||
print("🔴 Error: Service Account Key is empty");
|
||||
@@ -590,8 +593,8 @@ class FirebaseMessagesController extends GetxController {
|
||||
|
||||
// Initialize AccessTokenManager
|
||||
final accessTokenManager = AccessTokenManager(serviceAccountKeyJson);
|
||||
Log.print(
|
||||
'accessTokenManager: ${accessTokenManager.serviceAccountJsonKey}');
|
||||
// Log.print(
|
||||
// 'accessTokenManager: ${accessTokenManager.serviceAccountJsonKey}');
|
||||
|
||||
// Obtain an OAuth 2.0 access token
|
||||
final accessToken = await accessTokenManager.getAccessToken();
|
||||
@@ -616,7 +619,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
'DriverList': jsonEncode(data),
|
||||
},
|
||||
'android': {
|
||||
'priority': 'high', // Set priority to high
|
||||
'priority': 'HIGH ', // Set priority to high
|
||||
'notification': {
|
||||
'sound': tone,
|
||||
},
|
||||
@@ -693,7 +696,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
'body': body,
|
||||
},
|
||||
'android': {
|
||||
'priority': 'high', // Set priority to high
|
||||
'priority': 'HIGH ', // Set priority to high
|
||||
'notification': {
|
||||
'sound': tone,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user