diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 528e5c0..b4ad5b3 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -14,7 +14,6 @@ import flutter_local_notifications FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { (registry) in GeneratedPluginRegistrant.register(with: registry) } - if #available(iOS 10.0, *) { UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate } diff --git a/lib/classes/notifications.dart b/lib/classes/notifications.dart index cebf76d..0773575 100644 --- a/lib/classes/notifications.dart +++ b/lib/classes/notifications.dart @@ -60,7 +60,7 @@ class AppNotifications { } void _handleMessage(RemoteMessage message) { - Utils.saveStringFromPrefs("isAppOpendByChat", "true"); + Utils.saveStringFromPrefs("isAppOpendByChat", "false"); } void _handleOpenApp(RemoteMessage message) { @@ -77,7 +77,6 @@ AndroidNotificationChannel channel = const AndroidNotificationChannel( Future backgroundMessageHandler(RemoteMessage message) async { await Firebase.initializeApp(); - Utils.saveStringFromPrefs("isAppOpendByChat", "true"); - logger.w(message.data["user_chat_history_response"]); + Utils.saveStringFromPrefs("isAppOpendByChat", "false"); Utils.saveStringFromPrefs("notificationData", message.data["user_chat_history_response"].toString()); } diff --git a/lib/provider/chat_provider_model.dart b/lib/provider/chat_provider_model.dart index 08b148d..56001d6 100644 --- a/lib/provider/chat_provider_model.dart +++ b/lib/provider/chat_provider_model.dart @@ -1451,12 +1451,11 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { } void openChatByNoti(BuildContext context) async { - SingleUserChatModel nUser = SingleUserChatModel.fromJson( - jsonDecode(await Utils.getStringFromPrefs("notificationData")), - ); Utils.saveStringFromPrefs("isAppOpendByChat", "false"); + SingleUserChatModel nUser = SingleUserChatModel.fromJson(jsonDecode(await Utils.getStringFromPrefs("notificationData"))); Utils.saveStringFromPrefs("notificationData", "null"); - Future.delayed(const Duration(seconds: 1)); + logger.w(jsonEncode(nUser)); + Future.delayed(const Duration(seconds: 2)); for (ChatUser user in searchedChats!) { if (user.id == nUser.targetUserId) { Navigator.pushNamed(context, AppRoutes.chatDetailed, arguments: ChatDetailedScreenParams(user, false));