From 24b8b198b2f134d231b2c73ba109846b0fcf901c Mon Sep 17 00:00:00 2001 From: Sergei Semko <28645140+justSmK@users.noreply.github.com> Date: Tue, 25 Nov 2025 18:08:56 +0300 Subject: [PATCH 1/2] WMSDK-552: Update Example with new public push permission refresh method --- example/flutter_example/lib/view_model/view_model.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/flutter_example/lib/view_model/view_model.dart b/example/flutter_example/lib/view_model/view_model.dart index f613f3e..980db72 100644 --- a/example/flutter_example/lib/view_model/view_model.dart +++ b/example/flutter_example/lib/view_model/view_model.dart @@ -66,8 +66,8 @@ class ViewModel { var status = await Permission.notification.status; if (!status.isGranted) { status = await Permission.notification.request(); - Mindbox.instance - .updateNotificationPermissionStatus(granted: status.isGranted); + print("Permission status: $status"); + Mindbox.instance.refreshNotificationPermissionStatus(); } } From 8944cee5c8fa4bdda913c6d215038946bd7e33e7 Mon Sep 17 00:00:00 2001 From: Sergei Semko <28645140+justSmK@users.noreply.github.com> Date: Tue, 25 Nov 2025 18:37:09 +0300 Subject: [PATCH 2/2] WMSDK-552: Remove native push permission request from Example --- .../ios/Runner/AppDelegate.swift | 35 ++++++------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/example/flutter_example/ios/Runner/AppDelegate.swift b/example/flutter_example/ios/Runner/AppDelegate.swift index f67d7af..f0b1572 100644 --- a/example/flutter_example/ios/Runner/AppDelegate.swift +++ b/example/flutter_example/ios/Runner/AppDelegate.swift @@ -13,10 +13,7 @@ import UserNotifications didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { - UIApplication.shared.registerForRemoteNotifications() - - // Calling the notification request method - registerForRemoteNotifications() + UNUserNotificationCenter.current().delegate = self // tracking sources of referrals to the application via push notifications Mindbox.shared.track(.launch(launchOptions)) @@ -72,27 +69,15 @@ import UserNotifications override func userNotificationCenter( _ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, - withCompletionHandler completionHandler: @escaping () -> Void) { - // Send click to Mindbox - Mindbox.shared.pushClicked(response: response) - - // Sending the fact that the application was opened when switching to push notification - Mindbox.shared.track(.push(response)) - completionHandler() - super.userNotificationCenter(center, didReceive: response, withCompletionHandler: completionHandler) - } - - func registerForRemoteNotifications() { - UNUserNotificationCenter.current().delegate = self - DispatchQueue.main.async { - UNUserNotificationCenter.current().requestAuthorization(options: [ .alert, .sound, .badge]) { granted, error in - print("Permission granted: \(granted)") - if let error = error { - print("NotificationsRequestAuthorization failed with error: \(error.localizedDescription)") - } - Mindbox.shared.notificationsRequestAuthorization(granted: granted) - } - } + withCompletionHandler completionHandler: @escaping () -> Void + ) { + // Send click to Mindbox + Mindbox.shared.pushClicked(response: response) + + // Sending the fact that the application was opened when switching to push notification + Mindbox.shared.track(.push(response)) + completionHandler() + super.userNotificationCenter(center, didReceive: response, withCompletionHandler: completionHandler) } func notifyFlutterNewData() {