From 7acb9ab2849b2c60757a7628e78f964be334af5a Mon Sep 17 00:00:00 2001 From: Fadi George Date: Wed, 2 Sep 2026 19:30:49 -0700 Subject: [PATCH 1/7] chore(demo): add iOS action button icon assets --- examples/demo/README.md | 12 ++++++++++++ examples/demo/ios/demo.xcodeproj/project.pbxproj | 12 ++++++++++++ examples/demo/ios/demo/template-bookmark-icon.png | Bin 0 -> 312 bytes examples/demo/ios/demo/template-share-icon.png | Bin 0 -> 309 bytes 4 files changed, 24 insertions(+) create mode 100644 examples/demo/ios/demo/template-bookmark-icon.png create mode 100644 examples/demo/ios/demo/template-share-icon.png diff --git a/examples/demo/README.md b/examples/demo/README.md index 3e2c3f85..9cd7000a 100644 --- a/examples/demo/README.md +++ b/examples/demo/README.md @@ -73,6 +73,18 @@ When you want to forcefully reload, for example to reset the state of your app, - **Android**: Press the R key twice or select **"Reload"** from the **Dev Menu**, accessed via Ctrl + M (Windows/Linux) or Cmd ⌘ + M (macOS). - **iOS**: Press R in iOS Simulator. +## Testing iOS Action Button Icons + +The iOS demo bundles shared action button icons in both the `demo` and +`OneSignalNotificationServiceExtension` targets. Create an image notification +in the OneSignal dashboard with these action buttons: + +- **Save Story** with icon `template-bookmark-icon` +- **Share** with icon `template-share-icon` + +Enter the icon names without the `.png` extension. On an iOS 15 or newer +physical device, expand the notification to verify that both icons render. + ## Congratulations! :tada: You've successfully run and modified your React Native App. :partying_face: diff --git a/examples/demo/ios/demo.xcodeproj/project.pbxproj b/examples/demo/ios/demo.xcodeproj/project.pbxproj index 8246a9ca..1a7dfaf2 100644 --- a/examples/demo/ios/demo.xcodeproj/project.pbxproj +++ b/examples/demo/ios/demo.xcodeproj/project.pbxproj @@ -21,6 +21,10 @@ A10000000000000000000007 /* libPods-OneSignalWidgetExtension.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A20000000000000000000010 /* libPods-OneSignalWidgetExtension.a */; }; A10000000000000000000008 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A20000000000000000000009 /* WidgetKit.framework */; }; A10000000000000000000009 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2000000000000000000000A /* SwiftUI.framework */; }; + B10000000000000000000001 /* template-bookmark-icon.png in Resources */ = {isa = PBXBuildFile; fileRef = B20000000000000000000001 /* template-bookmark-icon.png */; }; + B10000000000000000000002 /* template-share-icon.png in Resources */ = {isa = PBXBuildFile; fileRef = B20000000000000000000002 /* template-share-icon.png */; }; + B10000000000000000000003 /* template-bookmark-icon.png in Resources */ = {isa = PBXBuildFile; fileRef = B20000000000000000000001 /* template-bookmark-icon.png */; }; + B10000000000000000000004 /* template-share-icon.png in Resources */ = {isa = PBXBuildFile; fileRef = B20000000000000000000002 /* template-share-icon.png */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -82,6 +86,8 @@ A2000000000000000000000F /* libPods-OneSignalNotificationServiceExtension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OneSignalNotificationServiceExtension.a"; sourceTree = BUILT_PRODUCTS_DIR; }; A20000000000000000000010 /* libPods-OneSignalWidgetExtension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OneSignalWidgetExtension.a"; sourceTree = BUILT_PRODUCTS_DIR; }; A20000000000000000000011 /* demo.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = demo.entitlements; path = demo/demo.entitlements; sourceTree = ""; }; + B20000000000000000000001 /* template-bookmark-icon.png */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = image.png; name = "template-bookmark-icon.png"; path = "demo/template-bookmark-icon.png"; sourceTree = ""; }; + B20000000000000000000002 /* template-share-icon.png */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = image.png; name = "template-share-icon.png"; path = "demo/template-share-icon.png"; sourceTree = ""; }; ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ @@ -124,6 +130,8 @@ 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */, 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */, A20000000000000000000011 /* demo.entitlements */, + B20000000000000000000001 /* template-bookmark-icon.png */, + B20000000000000000000002 /* template-share-icon.png */, ); name = demo; sourceTree = ""; @@ -317,6 +325,8 @@ 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */, 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 5F8F7D5C84F8947D278D5B06 /* PrivacyInfo.xcprivacy in Resources */, + B10000000000000000000001 /* template-bookmark-icon.png in Resources */, + B10000000000000000000002 /* template-share-icon.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -324,6 +334,8 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + B10000000000000000000003 /* template-bookmark-icon.png in Resources */, + B10000000000000000000004 /* template-share-icon.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/examples/demo/ios/demo/template-bookmark-icon.png b/examples/demo/ios/demo/template-bookmark-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..99281835ab36dd51c94f0a6681923ae2d81e85b9 GIT binary patch literal 312 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjZ#`WcLn;{GOu5L}Y#`9K)uN#` zyr8x3ftu{Xy9?$nxVvDrg_HS-W+%C~42-|$tFV473hdIKG-3bVn18$Z`A#a{tavN3 zVC%YD+hnhGWbMe@tZZ~lH;P@ z|GIXqtKM;(|D*Pen^GU)>fdX5vD*0dY8XPCcxc=#c& z;EGRs7nS%6F{U)U+g8|HamQl*0+H92YAy2e51MDqn&n`A6{16>#Z9${A^?lbS_C`Nx)9~j$m5%3^`}Zp{J-@>x`EuoK1x9_r z8qYG5r~A7V7@6h>?DlkNV*4S`>EV#!wKDqjGKuA`Ovz`gd?#Oxy3ff{#__PpxT`Qq z#o?jNdH)wNYqqYx^ZZTMf$I9+>iXx0M4wx32#kIf#!~pjedd+d+q1Npn7V(5s)%Tt z&UK!i{$w-DlntTsERWc}Z&kV@)^Ve3+J^Os}GRD2J$sCgTv!?!^P)zopr E0G6P9v;Y7A literal 0 HcmV?d00001 From b1d041221ca0d0505394f052227c622f59081840 Mon Sep 17 00:00:00 2001 From: Fadi George Date: Wed, 2 Sep 2026 22:31:56 -0700 Subject: [PATCH 2/7] fix(android): normalize rawPayload to object type --- .../onesignal/rnonesignalandroid/RNUtils.java | 2 +- src/OSNotification.test.ts | 24 ++----------------- src/OSNotification.ts | 4 ++-- 3 files changed, 5 insertions(+), 25 deletions(-) diff --git a/android/src/main/java/com/onesignal/rnonesignalandroid/RNUtils.java b/android/src/main/java/com/onesignal/rnonesignalandroid/RNUtils.java index e6494daf..a69f738b 100644 --- a/android/src/main/java/com/onesignal/rnonesignalandroid/RNUtils.java +++ b/android/src/main/java/com/onesignal/rnonesignalandroid/RNUtils.java @@ -126,7 +126,7 @@ public static HashMap convertNotificationToMap(INotification not } notificationHash.put("actionButtons", actionButtons); } - notificationHash.put("rawPayload", notification.getRawPayload()); + notificationHash.put("rawPayload", convertJSONObjectToHashMap(new JSONObject(notification.getRawPayload()))); return notificationHash; } diff --git a/src/OSNotification.test.ts b/src/OSNotification.test.ts index 75e0aac5..e552aadc 100644 --- a/src/OSNotification.test.ts +++ b/src/OSNotification.test.ts @@ -40,7 +40,7 @@ describe('OSNotification', () => { test('should initialize with optional common properties as undefined', () => { const notificationData = { body: 'Test body', - rawPayload: '', + rawPayload: {}, notificationId: 'id-123', }; const notification = new OSNotification(notificationData); @@ -198,7 +198,7 @@ describe('OSNotification', () => { }); }); - describe('rawPayload types', () => { + describe('rawPayload', () => { test('should accept object as rawPayload', () => { const notificationData = { ...baseNotificationData, @@ -212,16 +212,6 @@ describe('OSNotification', () => { }); }); - test('should accept string as rawPayload', () => { - const notificationData = { - ...baseNotificationData, - rawPayload: '{"key":"value"}', - }; - const notification = new OSNotification(notificationData); - - expect(notification.rawPayload).toBe('{"key":"value"}'); - }); - test('should accept empty object as rawPayload', () => { const notificationData = { ...baseNotificationData, @@ -231,15 +221,5 @@ describe('OSNotification', () => { expect(notification.rawPayload).toEqual({}); }); - - test('should accept empty string as rawPayload', () => { - const notificationData = { - ...baseNotificationData, - rawPayload: '', - }; - const notification = new OSNotification(notificationData); - - expect(notification.rawPayload).toBe(''); - }); }); }); diff --git a/src/OSNotification.ts b/src/OSNotification.ts index 646f8a29..33867c0a 100644 --- a/src/OSNotification.ts +++ b/src/OSNotification.ts @@ -8,7 +8,7 @@ export interface BaseNotificationData { sound?: string; title?: string; launchURL?: string; - rawPayload: object | string; // platform bridges return different types + rawPayload: object; actionButtons?: object[]; additionalData?: object; notificationId: string; @@ -52,7 +52,7 @@ export default class OSNotification { sound?: string; title?: string; launchURL?: string; - rawPayload: object | string; // platform bridges return different types + rawPayload: object; actionButtons?: object[]; additionalData?: object; notificationId: string; From cbff19985d39f5a599337772e3507966beff9b6c Mon Sep 17 00:00:00 2001 From: Fadi George Date: Wed, 9 Sep 2026 13:28:49 -0700 Subject: [PATCH 3/7] fix: [SDK-5191] correct lock screen visibility type Co-authored-by: Cursor --- src/OSNotification.test.ts | 4 ++-- src/OSNotification.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/OSNotification.test.ts b/src/OSNotification.test.ts index e552aadc..a64080f2 100644 --- a/src/OSNotification.test.ts +++ b/src/OSNotification.test.ts @@ -77,7 +77,7 @@ describe('OSNotification', () => { collapseId: 'collapse-1', fromProjectNumber: '123456789', smallIconAccentColor: 'FFFF0000', - lockScreenVisibility: '1', + lockScreenVisibility: 1, androidNotificationId: 456, }; const notification = new OSNotification(androidData); @@ -93,7 +93,7 @@ describe('OSNotification', () => { expect(notification.collapseId).toBe('collapse-1'); expect(notification.fromProjectNumber).toBe('123456789'); expect(notification.smallIconAccentColor).toBe('FFFF0000'); - expect(notification.lockScreenVisibility).toBe('1'); + expect(notification.lockScreenVisibility).toBe(1); expect(notification.androidNotificationId).toBe(456); }); diff --git a/src/OSNotification.ts b/src/OSNotification.ts index 33867c0a..d7363b3a 100644 --- a/src/OSNotification.ts +++ b/src/OSNotification.ts @@ -26,7 +26,7 @@ interface AndroidNotificationData extends BaseNotificationData { collapseId?: string; fromProjectNumber?: string; smallIconAccentColor?: string; - lockScreenVisibility?: string; + lockScreenVisibility?: number; androidNotificationId?: number; } @@ -68,7 +68,7 @@ export default class OSNotification { collapseId?: string; fromProjectNumber?: string; smallIconAccentColor?: string; - lockScreenVisibility?: string; + lockScreenVisibility?: number; androidNotificationId?: number; // ios only badge?: string; From 24fa843204512ca5aa44cfa1a6f5eb1e6ea34845 Mon Sep 17 00:00:00 2001 From: Fadi George Date: Wed, 9 Sep 2026 15:25:44 -0700 Subject: [PATCH 4/7] fix(android): guard raw payload conversion Co-authored-by: Cursor --- android/build.gradle | 1 + .../onesignal/rnonesignalandroid/RNUtils.java | 12 +++++- .../rnonesignalandroid/RNUtilsTest.java | 41 +++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 android/src/test/java/com/onesignal/rnonesignalandroid/RNUtilsTest.java diff --git a/android/build.gradle b/android/build.gradle index 50df5d1f..1d594620 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -66,4 +66,5 @@ dependencies { } testImplementation 'junit:junit:4.12' + testImplementation 'org.json:json:20240303' } diff --git a/android/src/main/java/com/onesignal/rnonesignalandroid/RNUtils.java b/android/src/main/java/com/onesignal/rnonesignalandroid/RNUtils.java index a69f738b..060259e1 100644 --- a/android/src/main/java/com/onesignal/rnonesignalandroid/RNUtils.java +++ b/android/src/main/java/com/onesignal/rnonesignalandroid/RNUtils.java @@ -126,11 +126,21 @@ public static HashMap convertNotificationToMap(INotification not } notificationHash.put("actionButtons", actionButtons); } - notificationHash.put("rawPayload", convertJSONObjectToHashMap(new JSONObject(notification.getRawPayload()))); + notificationHash.put("rawPayload", convertRawPayloadToHashMap(notification.getRawPayload())); return notificationHash; } + static HashMap convertRawPayloadToHashMap(String rawPayload) { + if (rawPayload == null || rawPayload.trim().isEmpty()) return new HashMap<>(); + + try { + return convertJSONObjectToHashMap(new JSONObject(rawPayload)); + } catch (JSONException exception) { + return new HashMap<>(); + } + } + private static HashMap convertInAppMessageToMap(IInAppMessage message) { HashMap hash = new HashMap<>(); hash.put("messageId", message.getMessageId()); diff --git a/android/src/test/java/com/onesignal/rnonesignalandroid/RNUtilsTest.java b/android/src/test/java/com/onesignal/rnonesignalandroid/RNUtilsTest.java new file mode 100644 index 00000000..a0f24ad5 --- /dev/null +++ b/android/src/test/java/com/onesignal/rnonesignalandroid/RNUtilsTest.java @@ -0,0 +1,41 @@ +package com.onesignal.rnonesignalandroid; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.HashMap; +import java.util.List; +import org.junit.Test; + +public class RNUtilsTest { + @Test + public void convertRawPayloadToHashMapConvertsNestedJson() { + HashMap payload = RNUtils.convertRawPayloadToHashMap( + "{\"message\":\"hello\",\"count\":2,\"enabled\":true,\"nested\":{\"value\":\"inside\"}," + + "\"items\":[1,{\"name\":\"item\"}]}"); + + assertEquals("hello", payload.get("message")); + assertEquals(2, payload.get("count")); + assertEquals(true, payload.get("enabled")); + + HashMap nested = (HashMap) payload.get("nested"); + assertEquals("inside", nested.get("value")); + + List items = (List) payload.get("items"); + assertEquals(1, items.get(0)); + assertEquals("item", ((HashMap) items.get(1)).get("name")); + } + + @Test + public void convertRawPayloadToHashMapReturnsEmptyMapForEmptyPayload() { + assertTrue(RNUtils.convertRawPayloadToHashMap("").isEmpty()); + assertTrue(RNUtils.convertRawPayloadToHashMap(" ").isEmpty()); + assertTrue(RNUtils.convertRawPayloadToHashMap(null).isEmpty()); + } + + @Test + public void convertRawPayloadToHashMapReturnsEmptyMapForInvalidPayload() { + assertTrue(RNUtils.convertRawPayloadToHashMap("not-json").isEmpty()); + assertTrue(RNUtils.convertRawPayloadToHashMap("[1, 2]").isEmpty()); + } +} From 6729133595d7924fe8d8843abbfde3b9fba7da80 Mon Sep 17 00:00:00 2001 From: Fadi George Date: Wed, 9 Sep 2026 15:27:34 -0700 Subject: [PATCH 5/7] chore(demo): add debug comments to notification handlers --- examples/demo/src/hooks/useOneSignal.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/examples/demo/src/hooks/useOneSignal.ts b/examples/demo/src/hooks/useOneSignal.ts index b7ee9932..06177ef6 100644 --- a/examples/demo/src/hooks/useOneSignal.ts +++ b/examples/demo/src/hooks/useOneSignal.ts @@ -191,15 +191,35 @@ function useOneSignalState(): UseOneSignalReturn { const handleNotificationClick = (e: NotificationClickEvent) => { console.log(`Notification click: ${e.notification.title ?? ''}`); + + // uncomment to see the full event object + // console.log('[OneSignal] click event: ', e); }; const handleForegroundWillDisplay = (e: NotificationWillDisplayEvent) => { console.log(`Notification foregroundWillDisplay: ${e.getNotification().title ?? ''}`); + + // uncomment to see the full event object + // console.log('[OneSignal] will display event: ', e.getNotification()); + // uncomment to test preventing the default display behavior // e.preventDefault(); // can call this after preventDefault (within ~25 seconds) to force display of notification // e.getNotification().display(); + + // example with a delay (assumes preventDefault was called) + // console.log('[OneSignal] forcing display of notification in x seconds'); + // let seconds = 24; + // const interval = setInterval(() => { + // seconds--; + // console.log(`[OneSignal] displaying notification in ${seconds} seconds`); + // if (seconds <= 0) { + // console.log('[OneSignal] displaying notification'); + // e.getNotification().display(); + // clearInterval(interval); + // } + // }, 1000); }; const pushSubHandler = (event: PushSubscriptionChangedState) => { From d79d755a4383ce2450ed4a96c9d64be428a2fb81 Mon Sep 17 00:00:00 2001 From: Fadi George Date: Wed, 9 Sep 2026 15:43:21 -0700 Subject: [PATCH 6/7] chore(demo): update lock file checksums --- examples/demo/bun.lock | 2 +- examples/demo/ios/Podfile.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/demo/bun.lock b/examples/demo/bun.lock index 01127819..058e57f8 100644 --- a/examples/demo/bun.lock +++ b/examples/demo/bun.lock @@ -1006,7 +1006,7 @@ "react-native-dotenv": ["react-native-dotenv@3.4.11", "", { "dependencies": { "dotenv": "^16.4.5" }, "peerDependencies": { "@babel/runtime": "^7.20.6" } }, "sha512-6vnIE+WHABSeHCaYP6l3O1BOEhWxKH6nHAdV7n/wKn/sciZ64zPPp2NUdEUf1m7g4uuzlLbjgr+6uDt89q2DOg=="], - "react-native-onesignal": ["react-native-onesignal@../../react-native-onesignal.tgz", { "dependencies": { "invariant": "^2.2.4" }, "peerDependencies": { "react-native": ">=0.79.0" } }, "sha512-UiPEj1EY1ghqHM/iUrcAIFr5YRnVqKQsOVLl2G7Y/Dq8BxE8S8jkPeMJpyFCgjZzQgKk9B3yCuWwTqECucaQAg=="], + "react-native-onesignal": ["react-native-onesignal@../../react-native-onesignal.tgz", { "dependencies": { "invariant": "^2.2.4" }, "peerDependencies": { "react-native": ">=0.79.0" } }, "sha512-GitSpK1jeWw44O5Uyh+U2C7xNGIXmOgTgOE0e8lVJeKQYSkte7HULSzWgcGWsTECAVkdBrglhOB6DTnA6faaSA=="], "react-native-safe-area-context": ["react-native-safe-area-context@5.7.0", "", { "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-/9/MtQz8ODphjsLdZ+GZAIcC/RtoqW9EeShf7Uvnfgm/pzYrJ75y3PV/J1wuAV1T5Dye5ygq4EAW20RoBq0ABQ=="], diff --git a/examples/demo/ios/Podfile.lock b/examples/demo/ios/Podfile.lock index a80fee17..8fb637fc 100644 --- a/examples/demo/ios/Podfile.lock +++ b/examples/demo/ios/Podfile.lock @@ -2314,7 +2314,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: FBLazyVector: c12d2108050e27952983d565a232f6f7b1ad5e69 - hermes-engine: 431876dbea22ba6821b0e999131ecbf5d706c8d2 + hermes-engine: 177322198264d50dc281084c48e1ed80ea14884c OneSignalXCFramework: c38d48069949912d19e7c64d2ff30f5c9edba1ee RCTDeprecation: 3280799c14232a56e5a44f92981a8ee33bc69fd9 RCTRequired: 9854a51b0f65ccf43ea0b744df4d70fce339db32 @@ -2324,7 +2324,7 @@ SPEC CHECKSUMS: React: 7ef36630d07638043a134a7dd2ec17e0be10fc3c React-callinvoker: af4e8fe1d60ab63dd8d74c2a68988064c2848954 React-Core: c609976c034ba9556bef9850a571a71bd458d73f - React-Core-prebuilt: 5e3e0e5fe0a22af7fb36c5b593882da759f395c9 + React-Core-prebuilt: f4df078355bf9605a0d0278aa5c63fcd4b764a1d React-CoreModules: 0ea85f3b3f4b8cbfb3afacd2ed85458fb878517a React-cxxreact: 6752bab77c0599d6136e2b8b9b64b4a7d316d401 React-debug: 38389b86e3570558ec73dd4cbc0cd2f2eec47a51 @@ -2387,7 +2387,7 @@ SPEC CHECKSUMS: ReactAppDependencyProvider: 6b7e8d8d974ed13fb66698d82c30c5e70c1f7d3a ReactCodegen: c5e5343f6691b0cd76913b9be5e89e5a83ff3315 ReactCommon: 92b53b0bd7f7d86154dc9f512c1ea5dee717cc72 - ReactNativeDependencies: f822e1f0812f671d9bfe99225d09dc144fa6f02b + ReactNativeDependencies: eaebe8c9533ec2c41b08a02844af461bfff10540 RNCAsyncStorage: 3a4f5e2777dae1688b781a487923a08569e27fe4 RNScreens: 6cb648bdad8fe9bee9259fe144df95b6d1d5b707 RNSVG: c69f7709226108f5eb89b5aa8833c17a36345468 From 70d6b18e85400da92b55d494df2b4b57ff3ea7ef Mon Sep 17 00:00:00 2001 From: Fadi George Date: Wed, 9 Sep 2026 16:29:53 -0700 Subject: [PATCH 7/7] fix: [SDK-5161] address review feedback Co-authored-by: Cursor --- MIGRATION_GUIDE.md | 4 ++++ .../main/java/com/onesignal/rnonesignalandroid/RNUtils.java | 2 ++ examples/demo/ios/Podfile.lock | 6 +++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/MIGRATION_GUIDE.md b/MIGRATION_GUIDE.md index 7f3c2703..812d77ca 100644 --- a/MIGRATION_GUIDE.md +++ b/MIGRATION_GUIDE.md @@ -4,6 +4,10 @@ `react-native-onesignal` `5.4.x` registers its iOS TurboModule through the `codegenConfig.ios.modulesProvider` field, which was introduced in React Native `0.79`. Apps on React Native `0.76`–`0.78` (including Expo SDK `52`) will hit `Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'OneSignal' could not be found` at runtime when the New Architecture is enabled. Stay on `5.3.x` until you can move to React Native `0.79+` (Expo SDK `53+`); `5.3.x` uses the legacy bridge module and works on the New Architecture via the interop layer. +#### Notification `rawPayload` on Android + +Notification `rawPayload` is now an object on Android, matching iOS. Remove any `JSON.parse(notification.rawPayload)` calls and access its properties directly. + #### ⚠️ Migration Advisory for current OneSignal customers Our new [user-centric APIs and v5.x.x SDKs](https://onesignal.com/blog/unify-your-users-across-channels-and-devices/) offer an improved user and data management experience. However, they may not be at 1:1 feature parity with our previous versions yet. diff --git a/android/src/main/java/com/onesignal/rnonesignalandroid/RNUtils.java b/android/src/main/java/com/onesignal/rnonesignalandroid/RNUtils.java index 060259e1..d2027583 100644 --- a/android/src/main/java/com/onesignal/rnonesignalandroid/RNUtils.java +++ b/android/src/main/java/com/onesignal/rnonesignalandroid/RNUtils.java @@ -7,6 +7,7 @@ import com.facebook.react.bridge.ReadableType; import com.facebook.react.bridge.WritableArray; import com.facebook.react.bridge.WritableMap; +import com.onesignal.debug.internal.logging.Logging; import com.onesignal.inAppMessages.IInAppMessage; import com.onesignal.inAppMessages.IInAppMessageClickEvent; import com.onesignal.inAppMessages.IInAppMessageClickResult; @@ -137,6 +138,7 @@ static HashMap convertRawPayloadToHashMap(String rawPayload) { try { return convertJSONObjectToHashMap(new JSONObject(rawPayload)); } catch (JSONException exception) { + Logging.error("Failed to parse notification raw payload", exception); return new HashMap<>(); } } diff --git a/examples/demo/ios/Podfile.lock b/examples/demo/ios/Podfile.lock index 8fb637fc..a80fee17 100644 --- a/examples/demo/ios/Podfile.lock +++ b/examples/demo/ios/Podfile.lock @@ -2314,7 +2314,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: FBLazyVector: c12d2108050e27952983d565a232f6f7b1ad5e69 - hermes-engine: 177322198264d50dc281084c48e1ed80ea14884c + hermes-engine: 431876dbea22ba6821b0e999131ecbf5d706c8d2 OneSignalXCFramework: c38d48069949912d19e7c64d2ff30f5c9edba1ee RCTDeprecation: 3280799c14232a56e5a44f92981a8ee33bc69fd9 RCTRequired: 9854a51b0f65ccf43ea0b744df4d70fce339db32 @@ -2324,7 +2324,7 @@ SPEC CHECKSUMS: React: 7ef36630d07638043a134a7dd2ec17e0be10fc3c React-callinvoker: af4e8fe1d60ab63dd8d74c2a68988064c2848954 React-Core: c609976c034ba9556bef9850a571a71bd458d73f - React-Core-prebuilt: f4df078355bf9605a0d0278aa5c63fcd4b764a1d + React-Core-prebuilt: 5e3e0e5fe0a22af7fb36c5b593882da759f395c9 React-CoreModules: 0ea85f3b3f4b8cbfb3afacd2ed85458fb878517a React-cxxreact: 6752bab77c0599d6136e2b8b9b64b4a7d316d401 React-debug: 38389b86e3570558ec73dd4cbc0cd2f2eec47a51 @@ -2387,7 +2387,7 @@ SPEC CHECKSUMS: ReactAppDependencyProvider: 6b7e8d8d974ed13fb66698d82c30c5e70c1f7d3a ReactCodegen: c5e5343f6691b0cd76913b9be5e89e5a83ff3315 ReactCommon: 92b53b0bd7f7d86154dc9f512c1ea5dee717cc72 - ReactNativeDependencies: eaebe8c9533ec2c41b08a02844af461bfff10540 + ReactNativeDependencies: f822e1f0812f671d9bfe99225d09dc144fa6f02b RNCAsyncStorage: 3a4f5e2777dae1688b781a487923a08569e27fe4 RNScreens: 6cb648bdad8fe9bee9259fe144df95b6d1d5b707 RNSVG: c69f7709226108f5eb89b5aa8833c17a36345468