Repository navigation
chore: [SDK-5619] standardize push subscription UI in the demo apps - #76
Conversation
…emos Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Multi-model review (Opus 5.5, GPT 5.6 Sol, Grok 4.7) of this demo-only Status / Opted In / language-picker change.
The two copies stay aligned, test IDs are preserved, and Status is derived the way the spec describes. Two correctness gaps are worth fixing:
- Language picker can go stale on user switch. Logout resets via
setLanguage(''), butloginUser(and stored-id login at startup) leave the cached picker value. Native starts a new user with no language, so the dropdown can show the previous choice while the SDK uses device default or a backend value. - The picker commits even when native does not.
setLanguagefire-and-forgets the SDK call and always writes preferences + React state. If iOS drops the call under missing privacy consent, or the promise rejects, the UI stays wrong across restarts because language is never re-sent at launch.
Also consider: setPushEnabled still updates isPushEnabled immediately, so the new Status row can flash Subscribed before opt-in succeeds; and adding getTokenAsync() to the existing Promise.all in load() means one reject skips isReady / the push prompt.
Sent by Cursor Automation: PR Reviews
abdulraqeeb33
left a comment
There was a problem hiding this comment.
No issues found.
The language list, empty-string reset, and logout-only cache clear match the Android and iOS demos. push_enabled_toggle is unchanged, and the shared Appium spec selects that id.
The picker staying as-is across login is the same behavior those demos ship. I would leave it.
useOneSignal.ts (both demos) repeats the empty-code reset already stated in examples/build.md.
There was a problem hiding this comment.
Superseded by my earlier review. Fadi's inline replies confirm the picker/login behavior is intentional cross-demo parity (per sdk-shared/demo/build.md); dropping these nits. GitHub won't let me self-dismiss the approval.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…etLanguage Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>


Description
One Line Summary
Standardize the demo push subscription UI and add a language selector.
Details
Motivation
SDK-5619, part of SDK-5300 (standardize push subscription UI across SDK demo apps). Matches the Android demo (OneSignal/OneSignal-Android-SDK#2760) and the Cordova demo (OneSignal/OneSignal-Cordova-SDK#1216). Spec:
sdk-shared/demo/build.md.Scope
Demo apps only:
examples/demoandexamples/demo_pods, which each have their ownsrc, so the change is applied to both. SDK unchanged.demo_cap7,demo-nxanddemo-no-locationhave no Push or User section.push_subscription_status, same as Android.user_language_dropdown). It callssetLanguage(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.IonSelectpopover with a single down chevron (toggleIcon={chevronDown}), the value right-aligned next to it, and the open menu widened to 280px and capped at half the screen height (.language-popover).Testing
Unit testing
No unit tests; demo UI reading existing SDK state.
Manual testing
vp run lint,vp test run,tsc --noEmitandvp run buildpass for both demos (vp fmt --checkflags onlyREADME.md, already unformatted on main). Ranexamples/demoon an Android emulator and an iOS 26.5 simulator: Status switches between Subscribed and Unsubscribed with the toggle, and selecting Spanish then Device Default works (the native SDK sendses, then the device language).Affected code checklist
Checklist
Overview
Testing
Final pass
🤖 Generated with Claude Code