Skip to content

fix: [SDK-5608] reset language with '' on Android and standardize demo push UI - #1194

Merged
fadi-george merged 4 commits into
mainfrom
fadi/sdk-5608
Oct 27, 2026
Merged

fadi-george merged 4 commits into
mainfrom
fadi/sdk-5608

Conversation

@fadi-george

@fadi-george fadi-george commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Description

One Line Summary

Fix setLanguage('') on Android so it resets to the device language, and standardize the demo push UI.

flutter_android_01_push-status-subscribed flutter_android_02_push-status-unsubscribed flutter_android_03_language-row-closed flutter_android_04_language-dropdown-open flutter_android_05_language-spanish-selected flutter_android_06_language-reset-device-default flutter_ios_01_push-status-subscribed flutter_ios_02_push-status-unsubscribed flutter_ios_03_language-row-closed flutter_ios_04_language-dropdown-open flutter_ios_05_language-spanish-selected flutter_ios_06_language-reset-device-default flutter_ios_07_language-dropdown-capped

Details

Motivation

The Android bridge turned '' into null, but native setLanguage(value: String) rejects null, so setLanguage('') likely crashed with a NullPointerException instead of resetting to the device language as the Dart docs say. iOS already passed '' through. The demos need this for their Device Default language option. Part of SDK-5300 (standardize push subscription UI across SDK demo apps). Matches the Android demo (OneSignal/OneSignal-Android-SDK#2760).

Scope

SDK fix: OneSignalUser.java passes '' through to native. Native Android has resolved '' to the device language since 5.10.1; this plugin ships 5.10.2. No other bridge behavior changes.

Demo (examples/demo and examples/demo-pods):

  • Push section: new read-only Status row above the toggle. It shows Subscribed only when the user is opted in, notification permission is granted, and a push token is present; otherwise Unsubscribed. It updates from the existing subscription and permission observers, and the push token is now tracked too.
  • The toggle label changes from "Enabled" to Opted In. The existing test ID is unchanged, so Appium selectors still work. The status row uses push_subscription_status, same as Android.
  • User section: new Language row after External ID with Device Default plus the same 43 languages, in the same order, as Android and iOS (user_language_dropdown). It calls setLanguage(code), and Device Default sends '', which the native SDK resolves to the device language. The choice is saved only so the picker shows it after a restart; it is not re-sent at launch, since native keeps its own value. Logout resets it to Device Default, as Android and iOS do.

Testing

Unit testing

Root flutter test: 272 passed, coverage 98.2%. No new Dart test: the Dart side was already correct and the bug was in the Java bridge, which has no unit test harness.

Manual testing

flutter analyze (root clean; demos only show 2 warnings that were already there), Java spotless check passes, and the examples/demo debug APK builds. Not yet run on a device or simulator.

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
    • If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
  • 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.
    • Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
  • I have reviewed this PR myself, ensuring it meets each checklist item
    • WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.

🤖 Generated with Claude Code

fadi-george and others added 2 commits October 26, 2026 19:38
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ndroid

The Android bridge turned '' into null, which the native non-null
setLanguage rejects. Pass it through so the native SDK resolves the device
language, matching iOS and the documented Dart behavior. The demos now send
'' for Device Default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fadi-george
fadi-george requested a review from a team as a code owner October 27, 2026 02:53

@abdulraqeeb33 abdulraqeeb33 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.

Bridge fix checks out: native core 5.10.1+ resolves '' to the device language and the plugin pins 5.10.2. Demo changes match the other SDKs.

fadi-george and others added 2 commits October 27, 2026 10:50
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fadi-george
fadi-george merged commit 0baf109 into main Oct 27, 2026
2 checks passed
@fadi-george
fadi-george deleted the fadi/sdk-5608 branch October 27, 2026 18:13
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