From 46fca056f2d2bf0e819dcc6bc9b544e21bd9c9e3 Mon Sep 17 00:00:00 2001 From: Anirudha SM Date: Thu, 4 Jun 2026 11:48:39 +0530 Subject: [PATCH 1/2] MOEN-45163: Added userNotificationCenter willPresent forwarding to SampleApp AppDelegates so foreground push displays a banner --- SampleApp/ios/SampleApp/AppDelegate.mm | 25 +++++++++++++++++ .../ios/SampleSwiftApp/AppDelegate.swift | 27 +++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/SampleApp/ios/SampleApp/AppDelegate.mm b/SampleApp/ios/SampleApp/AppDelegate.mm index 28455284..1530873f 100644 --- a/SampleApp/ios/SampleApp/AppDelegate.mm +++ b/SampleApp/ios/SampleApp/AppDelegate.mm @@ -103,4 +103,29 @@ - (UISceneConfiguration *)application:(UIApplication *)application return config; } +#pragma mark - UNUserNotificationCenterDelegate (MOEN-45163) +// +// Mirrors the canonical pattern in MoEngageTestApp/AppDelegate.swift:241-245 — forwards +// the notification to the MoEngage SDK for analytics + inbox + impression tracking, then +// tells iOS what to display in foreground via `completionHandler`. Without these methods +// iOS suppresses the foreground banner because the SDK's proxy default is `[]`. + +- (void)userNotificationCenter:(UNUserNotificationCenter *)center + willPresentNotification:(UNNotification *)notification + withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler { + [[MoEngageSDKMessaging sharedInstance] userNotificationCenter:center + willPresent:notification]; + completionHandler(UNNotificationPresentationOptionAlert + | UNNotificationPresentationOptionSound + | UNNotificationPresentationOptionBadge); +} + +- (void)userNotificationCenter:(UNUserNotificationCenter *)center +didReceiveNotificationResponse:(UNNotificationResponse *)response + withCompletionHandler:(void (^)(void))completionHandler { + [[MoEngageSDKMessaging sharedInstance] userNotificationCenter:center + didReceive:response]; + completionHandler(); +} + @end diff --git a/SampleApp/ios/SampleSwiftApp/AppDelegate.swift b/SampleApp/ios/SampleSwiftApp/AppDelegate.swift index c211626c..8d13b630 100644 --- a/SampleApp/ios/SampleSwiftApp/AppDelegate.swift +++ b/SampleApp/ios/SampleSwiftApp/AppDelegate.swift @@ -98,3 +98,30 @@ class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate { #endif } } + +// MARK: - UNUserNotificationCenterDelegate (MOEN-45163) +// +// Mirrors the canonical pattern in MoEngageTestApp/AppDelegate.swift:241-245 — forwards +// the notification to the MoEngage SDK for analytics + inbox + impression tracking, then +// tells iOS what to display in foreground via `completionHandler`. Without these methods +// iOS suppresses the foreground banner because the SDK's proxy default is `[]`. +extension AppDelegate { + + func userNotificationCenter( + _ center: UNUserNotificationCenter, + willPresent notification: UNNotification, + withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void + ) { + MoEngageSDKMessaging.sharedInstance.userNotificationCenter(center, willPresent: notification) + completionHandler([.alert, .sound, .badge]) + } + + func userNotificationCenter( + _ center: UNUserNotificationCenter, + didReceive response: UNNotificationResponse, + withCompletionHandler completionHandler: @escaping () -> Void + ) { + MoEngageSDKMessaging.sharedInstance.userNotificationCenter(center, didReceive: response) + completionHandler() + } +} From f80b4dd2059e25e2ffd66b7422c184f6fc741e95 Mon Sep 17 00:00:00 2001 From: Anirudha SM Date: Thu, 4 Jun 2026 12:46:02 +0530 Subject: [PATCH 2/2] MOEN-45163: removed ticket number mention --- SampleApp/ios/SampleApp/AppDelegate.mm | 2 +- SampleApp/ios/SampleSwiftApp/AppDelegate.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SampleApp/ios/SampleApp/AppDelegate.mm b/SampleApp/ios/SampleApp/AppDelegate.mm index 1530873f..392a1f88 100644 --- a/SampleApp/ios/SampleApp/AppDelegate.mm +++ b/SampleApp/ios/SampleApp/AppDelegate.mm @@ -103,7 +103,7 @@ - (UISceneConfiguration *)application:(UIApplication *)application return config; } -#pragma mark - UNUserNotificationCenterDelegate (MOEN-45163) +#pragma mark - UNUserNotificationCenterDelegate // // Mirrors the canonical pattern in MoEngageTestApp/AppDelegate.swift:241-245 — forwards // the notification to the MoEngage SDK for analytics + inbox + impression tracking, then diff --git a/SampleApp/ios/SampleSwiftApp/AppDelegate.swift b/SampleApp/ios/SampleSwiftApp/AppDelegate.swift index 8d13b630..81fbab5d 100644 --- a/SampleApp/ios/SampleSwiftApp/AppDelegate.swift +++ b/SampleApp/ios/SampleSwiftApp/AppDelegate.swift @@ -99,7 +99,7 @@ class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate { } } -// MARK: - UNUserNotificationCenterDelegate (MOEN-45163) +// MARK: - UNUserNotificationCenterDelegate // // Mirrors the canonical pattern in MoEngageTestApp/AppDelegate.swift:241-245 — forwards // the notification to the MoEngage SDK for analytics + inbox + impression tracking, then