Skip to content

fix(android): preserve structured notification payloads across the bridge - #1978

Merged
fadi-george merged 5 commits into
OneSignal:mainfrom
OskarEichler:codex/onesignal-android-notification-data
Aug 31, 2026
Merged

fix(android): preserve structured notification payloads across the bridge#1978
fadi-george merged 5 commits into
OneSignal:mainfrom
OskarEichler:codex/onesignal-android-notification-data

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

Description

One Line Summary

Convert action buttons and grouped notifications into bridge-compatible maps instead of passing native objects that turn into null. Retain explicit JSON null values in additionalData.

Compatibility and observable changes

Observable payload correction: actionButtons/groupedNotifications now contain objects rather than null entries, and explicit-null additionalData fields remain present. Consumers relying on the broken omissions should adjust. No method signatures or native dependency versions change.

Details

Motivation

The source audit reproduced the failure paths described below. This PR contains only the associated fix; unrelated audit changes are in separate PRs.

Scope

  • android/src/main/java/com/onesignal/rnonesignalandroid/RNUtils.java

Testing

Six compiled Java serialization cases using actual RNUtils methods, org.json, and native/bridge doubles; three reproduce baseline data loss and all pass fixed.

Each code/tooling fix was also applied independently to upstream commit a70312207cf094ac361eaa9196c317acb175c2cd and passed its targeted external actual-source diagnostics. Documentation snippets were checked separately. Native diagnostic harnesses use bridge/SDK doubles and are not an end-to-end push test.

On the combined audit branch:

  • Existing SDK suite: 5 files, 262 tests pass; unchanged 95% coverage thresholds pass.
  • vp check: formatting, lint and type checks pass; native Spotless check passes.
  • Both example apps: Android Debug and unsigned iOS Simulator builds pass.
  • Both example apps: iOS and Android production Metro bundles pass.

No checked-in test files were added or modified; regression evidence comes from external diagnostic harnesses and the existing suite. No physical-device, live notification delivery, Appium/BrowserStack, or release-workflow execution is claimed. The no-location example's stale native lock was updated locally to resolve the current SDK for verification; generated locks are not part of this PR.

Checklist

  • Required description sections completed.
  • Scope and observable/API behavior explained.
  • Diff reviewed and targeted regression checks run.
  • Automated checks and device-testing limitations documented.

@OskarEichler
OskarEichler requested a review from a team as a code owner August 27, 2026 23:47
fadi-george

This comment was marked as duplicate.

@fadi-george fadi-george left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the pr.
I would also add groupedNotifications to AndroidNotificationData interface and OSNotification class property and in the constructor e.g. this.groupedNotifications = receivedEvent.groupedNotifications;

@fadi-george

fadi-george commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Seems a useful property (mostly for click listener) I'll check with the team if that should done for android and other wrapper sdks.

@OskarEichler

Copy link
Copy Markdown
Contributor Author

Added groupedNotifications to the Android input type, OSNotification property, and constructor as requested, plus a constructor regression assertion. I also rechecked the Android bridge conversion for nested notifications, action buttons, and null JSON values. Targeted type-aware lint passes with no findings and the Vite+ suite passes all 262 tests.

@fadi-george fadi-george left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The requested groupedNotifications exposure is now included, and the bridge conversions preserve nested notifications, action buttons, and explicit JSON nulls. Tests, scoped source checks, and Android formatting pass.

@fadi-george
fadi-george force-pushed the codex/onesignal-android-notification-data branch from bec6860 to d5ef0d4 Compare August 31, 2026 19:07

@fadi-george fadi-george left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Rebased on main and added android_group: 'demo-group', for testing

@fadi-george
fadi-george merged commit 826f2ce into OneSignal:main Aug 31, 2026
2 checks passed
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