Skip to content

feat: [SDK-5588] refresh the demo UI with a button grid, new dialogs and updated styles - #2860

Open
fadi-george wants to merge 41 commits into
mainfrom
fadi/sdk-5588-demo-ui-button-grid-dialogs
Open

fadi-george wants to merge 41 commits into
mainfrom
fadi/sdk-5588-demo-ui-button-grid-dialogs

Conversation

@fadi-george

@fadi-george fadi-george commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Description

One Line Summary

Refresh the Android demo app UI (button grid, reworked dialogs, new type and color system) to serve as the reference for the shared demo spec.

image image

Details

Motivation

The demo apps across SDKs are being aligned on one spec (sdk-shared demo/styles.md and demo/build.md, OneSignal/sdk-shared#76). This PR is the Android reference implementation that the spec was written against.

Scope

Changes are limited to examples/demo. No SDK code changes.

Layout and components

  • Section buttons in a two-column grid, with Primary (red fill) and Secondary (outlined) styles, title case 13sp medium labels, radius 10, darker pressed ripple.
  • Section headers 15sp semibold title case, 20dp section spacing, guidance banner above the App card (default App ID only).
  • Copy buttons on identifier rows. No snackbar on API 33+, where the OS shows its own clipboard preview.
  • List rows with no padding of their own and an optically centered divider. Log View header Logs, tabular timestamps, 1.5 line spacing.
  • Google Sans Flex for all text, bundled as static instances (OFL license in assets/licenses).
  • New palette in Theme.kt, #F7F7F7 background. Unused colors and strings removed from res/values.

Dialogs and User section

  • Dialogs anchored to the top and stable with the keyboard. Backdrop covers the system bars. Compact radio and checkbox rows.
  • Composite login (Login With Profile) with subscription status selects and optional tag and alias rows. A half-filled row blocks submit.
  • Update User JWT stacked like Login and prefilled, shown only when logged in. Identity verification toggle removed; the user fetch is picked automatically.
  • User Status row removed. addUserJwtInvalidatedListener logs JWT invalidated: {externalId}.
  • Shorter notification logs: Notif willDisplay: and Notif click:.

Testing

Unit testing

None. Demo app UI only.

Manual testing

Built with ./gradlew :app:installGmsDebug -PSDK_VERSION=5.11.0 from OneSignalSDK/ and checked on an Android 17 emulator: every section, the dialogs, copy buttons, log view and secondary screen. The Appium changes for the renamed logs and removed Status row are in OneSignal/sdk-shared#76.

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

🤖 Generated with Claude Code

fadi-george and others added 30 commits November 24, 2026 15:34
Sections with two or more buttons use a shared ButtonGrid per sdk-shared
styles.md: odd last button spans, hidden buttons reflow, labels scale down
to fit on one line. Shortens ADD ALIASES / ADD TAGS / ADD TRIGGERS and the
Triggers CLEAR ALL label.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ith the keyboard

All dialogs share a DemoDialog that sits below the safe area plus a 24dp
inset and stays put when the keyboard opens, so Appium element frames stay
accurate. Height is bounded and content scrolls on overflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the current user

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The External ID row already shows logged-in vs anonymous.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ser fetch automatically

The toggle only switched the demo's own REST lookup; identity verification
is set per app in the dashboard. A logged-in user with a cached JWT is now
fetched by external_id with a Bearer token, otherwise by onesignal_id.
Updating the JWT refetches the user, and logout clears the cached token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er Id

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… field

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>
One tag and one alias row exercise the rest of OneSignalUserProfile,
including the foreign-alias failure. A half-filled row is not sent.
The dialog now hands a single CompositeLoginRequest down instead of six
positional arguments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lf filled

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tional

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It navigates rather than calling the SDK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DemoLayout.scrollTopPadding was defined but never applied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sections ending in buttons got 4dp more space below them than sections
ending in a card, and card-to-button gaps were 12 instead of 8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Buttons 48 -> 40, section spacing 24 -> 16, and toggle rows drop
Material's 48dp tap-target padding. Dialog inputs use a compact outlined
field (~44 instead of the 56 minimum) with 12dp between fields, and
dialog padding goes 24 -> 20.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Material3's CenterAlignedTopAppBar in this BOM is fixed at 64dp, so the
bar is a plain centered layout that keeps the status-bar insets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drop Material's 48dp touch target so the controls align with the dialog
content, and make each whole row tappable instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The dialog window stops at the system bars, so a backdrop drawn inside it
left them undimmed. The system dim at osBackdrop's 0.54 covers the whole
display.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There is no identified user to refresh a token for until login.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only the top inset pads the page; the bottom inset sits at the end of the
scroll content so the last item still scrolls clear of the bar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… app

Builds with their own ONESIGNAL_APP_ID (including Appium runs) no longer
show a nudge to add one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…isplay:"

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Monospace made long IDs and notification titles wrap onto two lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each log entry is a single-line Text, so the default line-height trim
dropped all of the extra height; turn the trim off so 1.5 applies. Seven
entries now fill the log exactly. The LOGS header uses the same font as
the entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fadi-george and others added 10 commits November 25, 2026 15:47
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ated:"

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Section headers stay uppercase, so title case buttons read as buttons
and match the dialog actions.

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>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rows lose their own vertical padding so the card padding sets the list
edges. Dividers get 5 above and 1 below: the row above ends in descender
space and the row below starts with ascender space, so equal padding read
closer to the row above.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

📊 Diff Coverage Report

✓ Coverage check passed (no source files changed)

📥 View workflow run

@nan-li nan-li 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.

Blocking note: I left 1 note on something that happens often in MainViewModel.loginUserWithProfile for Identity Verification apps. Everything else looks good or really minor.

Nit, there are some restated comments: ActionButton.kt:43 (restates ButtonStyle.colors and border), CardKvRow.kt:71 (restates copyable and EMPTY_VALUE).

viewModelScope.launch(Dispatchers.IO) {
val result =
repository.loginUserWithProfile(externalUserId, email, sms, jwtToken, emailEnabled, smsEnabled)
val result = repository.loginUserWithProfile(request)

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.

On Identity Verification apps, this hits a timing bug deterministically.

Unlike regular loginUser, OneSignal.login(externalId, profile, jwt) waits for the network call and fires onUserStateChange before this line returns. That means fetchUserDataFromApi() runs before lines 307 to 309 set _externalUserId and cache the new JWT.

On Identity Verification apps, this breaks deterministically:

  • From anonymous, the fetch runs without a JWT and leaves the profile cards empty.
  • On a user switch, the fetch loads the previous user and overwrites _externalUserId back to the old ID.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, confirmed. Fixed in 0f8bcfb: the new external ID and JWT are cached before login, so the observer fetch signs as the new user. If the login fails without switching users, it restores the previous ones, and it refetches once login returns. Also removed the two restated comments.

OneSignal.login(externalId, profile, jwt) returns only after the user
switch, so onUserStateChange fetched the user with the previous external
ID and JWT. Cache the new identity first, restore it if the login fails
without switching, and refetch once login returns. Also drop two comments
that restated the code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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