Skip to content

fix: [SDK-5161] normalize notification payloads across platforms - #1994

Merged
fadi-george merged 7 commits into
mainfrom
fadi/sdk-5161
Sep 9, 2026
Merged

fix: [SDK-5161] normalize notification payloads across platforms#1994
fadi-george merged 7 commits into
mainfrom
fadi/sdk-5161

Conversation

@fadi-george

Copy link
Copy Markdown
Collaborator

Description

One Line Summary

Align notification payload types with native values and add iOS demo action-button icon resources.

Details

Motivation

Android previously exposed rawPayload as a JSON string while iOS exposed an object. This aligns Android with iOS and the public TypeScript API. It also corrects lockScreenVisibility to the numeric value supplied by the Android SDK and adds demo resources for testing notification action-button icons.

Scope

  • Convert Android rawPayload JSON into a React Native object.
  • Fall back to an empty object for empty or malformed raw payloads so notification and click events are not dropped.
  • Correct the public lockScreenVisibility type from string to number.
  • Add bookmark and share action-button icons to the iOS demo app and notification service extension.

Apps that parse Android rawPayload with JSON.parse should consume it directly as an object instead.

Testing

Unit testing

  • Added Android coverage for nested, empty, and malformed raw payload conversion.
  • Updated OSNotification tests for object payloads and numeric lock-screen visibility.
  • vp test passes.
  • ./gradlew :react-native-onesignal:testDebugUnitTest passes.

Manual testing

Not performed. Automated tests cover the payload conversion and TypeScript model changes; the demo README documents manual action-icon verification.

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
  • I have reviewed this PR myself, ensuring it meets each checklist item

@fadi-george
fadi-george requested a review from a team as a code owner September 9, 2026 22:26

@sherwinski sherwinski left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good, just three comments.

Comment thread android/src/main/java/com/onesignal/rnonesignalandroid/RNUtils.java
Comment thread src/OSNotification.ts
Comment thread examples/demo/ios/Podfile.lock Outdated
Co-authored-by: Cursor <cursoragent@cursor.com>
@fadi-george
fadi-george merged commit 85d61bf into main Sep 9, 2026
2 checks passed
@fadi-george
fadi-george deleted the fadi/sdk-5161 branch September 9, 2026 23:44
@fadi-george fadi-george changed the title fix: [SDK-5161] align notification payload handling fix: [SDK-5161] normalize notification payloads across platforms Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants