From f82043f85be25246736e8bf63e795632efbcc873 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Tue, 6 Oct 2026 10:37:57 +0300 Subject: [PATCH] improvements --- .../notification/firebase_notification_manger.dart | 6 ++---- lib/modules/cx_module/chat/calling/call_provider.dart | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/controllers/notification/firebase_notification_manger.dart b/lib/controllers/notification/firebase_notification_manger.dart index 9ae872d6..4822ab32 100644 --- a/lib/controllers/notification/firebase_notification_manger.dart +++ b/lib/controllers/notification/firebase_notification_manger.dart @@ -31,7 +31,6 @@ import 'package:test_sa/modules/tm_module/gas_refill/gas_refill_details.dart'; import 'package:test_sa/new_views/common_widgets/default_app_bar.dart'; import 'package:test_sa/views/widgets/loaders/no_data_found.dart'; - @pragma('vm:entry-point') Future firebaseMessagingBackgroundHandler(RemoteMessage message) async { if (message.notification == null && message.data != null) { @@ -62,6 +61,7 @@ Future onBackgroundMessage(CallEvent event) async { /// Tells the caller the call was declined (same signalling as `_handleCallDeclined` in land_page.dart). Future notifyCallerDeclined(Map extra, {String? reason}) async { + print("notifyCallerDeclined:$extra"); final callee = extra["calleeEmployeeNumber"]?.toString() ?? ''; final caller = extra["callerEmployeeNumber"]?.toString() ?? ''; if (callee.isEmpty || caller.isEmpty) return; @@ -93,6 +93,7 @@ class FirebaseNotificationManger { try { final value = await FlutterCallkitIncoming.getDevicePushTokenVoIP(); if (value != null && value.isNotEmpty) voipToken = value; + print("voipToken:$voipToken"); } catch (_) {} } @@ -112,7 +113,6 @@ class FirebaseNotificationManger { static FirebaseNotificationManger getInstance() => _instance; - static Future getToken() async { NotificationSettings settings = await messaging.requestPermission(alert: true, announcement: false, badge: true, carPlay: false, criticalAlert: false, provisional: false, sound: true); @@ -487,7 +487,6 @@ Future handleDataMessage(Map messageData, bool isFromBack ), ); - await FlutterCallkitIncoming.requestNotificationPermission({ // // "title": "Notification permission", // // "rationaleMessagePermission": "Notification permission is required, to show notification.", @@ -605,4 +604,3 @@ String _uuidV4() { final h = b.map((x) => x.toRadixString(16).padLeft(2, '0')).join(); return '${h.substring(0, 8)}-${h.substring(8, 12)}-${h.substring(12, 16)}-${h.substring(16, 20)}-${h.substring(20)}'; } - diff --git a/lib/modules/cx_module/chat/calling/call_provider.dart b/lib/modules/cx_module/chat/calling/call_provider.dart index 5bab2d28..23e1adef 100644 --- a/lib/modules/cx_module/chat/calling/call_provider.dart +++ b/lib/modules/cx_module/chat/calling/call_provider.dart @@ -7,6 +7,7 @@ import 'package:signalr_netcore/hub_connection.dart'; import 'package:signalr_netcore/hub_connection_builder.dart'; import 'package:signalr_netcore/itransport.dart'; import 'package:test_sa/controllers/api_routes/urls.dart'; +import 'package:test_sa/controllers/notification/firebase_notification_manger.dart'; import 'package:test_sa/modules/cx_module/chat/api_client.dart'; import 'package:http/http.dart' as http; import 'package:test_sa/modules/cx_module/chat/calling/webrtc_service.dart'; @@ -216,7 +217,7 @@ class CallProvider with ChangeNotifier, DiagnosticableTreeMixin { final http.Response response = await ApiClient().postJsonForResponse( URLs.chatSdkToken, - {"apiKey": URLs.chatApiKey, "employeeNumber": employeeNumber, "voIPToken": null}, + {"apiKey": URLs.chatApiKey, "employeeNumber": employeeNumber, "voIPToken": FirebaseNotificationManger.voipToken}, ); if (response.statusCode != 200) { if (kDebugMode) print('Call token request failed: HTTP ${response.statusCode}');