Skip to content

chore: [SDK-5526] add sticky log view to demo app - #1192

Merged
fadi-george merged 6 commits into
mainfrom
fadi/sdk-5526
Oct 20, 2026
Merged

fadi-george merged 6 commits into
mainfrom
fadi/sdk-5526

Conversation

@fadi-george

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

Copy link
Copy Markdown
Collaborator

Description

One Line Summary

Add a logcat-style log view to the demo app that shows SDK listener events, so E2E tests can assert Dart events.

Screenshot 2026-10-16 at 5 02 32 PM Screenshot 2026-10-16 at 5 03 21 PM

Details

Motivation

The shared Appium suite (sdk-shared) checks that listeners fire, e.g. that a notification click fires exactly once after a cold-start or background tap. The demo shows these events on screen so Appium can read them. Follows sdk-shared/demo/build.md (Prompt 1.5, 2.0, 6.2) and styles.md (Log View), matching the Capacitor (OneSignal/OneSignal-Capacitor-SDK#74) and React Native demos.

Depends on OneSignal/sdk-shared#60 for the Android log assertions (Flutter exposes text as content-desc).

Scope

Demo app only; no SDK changes.

  • services/log_service.dart: in-memory log store (max 100 entries, never persisted). LogService.show() and error() add to the view, info() is console only; all write [OneSignal] {message} to the console
  • widgets/log_view.dart: sticky panel under the app bar with entry count, clear and collapse buttons, auto-scroll to newest
  • main.dart, app_viewmodel.dart: SDK listeners use LogService.show(), login/logout failures error(), other actions info(); notification click and foregroundWillDisplay now include notificationId
  • home_screen.dart: log view above the scroll view (most of the diff is re-indentation)
  • theme.dart: replace unused log colors with osLogBackground / osLogText from the spec
  • Semantics ids: log_view, log_entry_{index}, log_clear_button, log_toggle_button

Spec divergence: collapsing removes the log_entry_* nodes, unlike the "entries stay in the view hierarchy while collapsed" line in build.md Prompt 2.0. This matches the RN and Capacitor demos. A zero-height clip drops the semantics nodes, and Visibility(maintainSemantics: true) needs maintainSize, which would keep the 100px body.

Testing

Unit testing

No new unit tests; demo UI only. flutter analyze reports no new issues.

Manual testing

Ran sdk-shared run-local --sdk=flutter with OneSignal/sdk-shared#60, log assertions executed (not skipped):

  • Android 16 emulator: --spec=02 3/3, --spec=13 2/2
  • iPhone 17 simulator (iOS 26.2): --spec=02 3/3, --spec=13 2/2

Checked the UI hierarchy on Android: entries show the expected foregroundWillDisplay and click messages with matching notification ids.

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

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 16, 2026 23:53

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Multi-model review (Claude Opus 5.5, GPT 5.6 Sol, Grok 4.7) of the demo sticky log view. Demo-only; isolate updates, listener lifecycle, and the 100-entry copy are fine.

Act on

  • Incomplete [OneSignal] migration: init and missing-API-key still debugPrint in main.dart (~111, 121). All three models flagged this. Route those two through LogService.log so testers see them on screen.
  • Header Clear/Collapse targets are ~14–18px in a 24px bar (2 models). Clear is destructive. excludeSemantics: true also likely strips the screen-reader activate action.

Consider

  • Auto-scroll always jumps to the end, interrupting testers reading older lines.
  • Fixed ~124px panel can overflow a short body (keyboard / landscape).
  • Timestamp osGrey600 on #1E1E1E is under WCAG AA.

Noted / dismissed

  • Secondary screen has no panel (home stays mounted; buffer still updates).
  • Other demo variants / build.md not updated.
  • Optional mounted guard on the post-frame scroll callback.
  • Thread safety, listener pairing, collapsed scroll: not defects.
Open in Web View Automation 

Sent by Cursor Automation: PR Reviews

Comment thread examples/demo/lib/widgets/log_view.dart
Comment thread examples/demo/lib/widgets/log_view.dart
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fadi-george

fadi-george commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator Author

Thanks. Keeping init and missing API key as console-only to match Capacitor and RN, where the log view only shows listener events. Skipping the short body overflow and timestamp contrast since the panel size and colors come from the shared demo spec.

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

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

Approve. One contract note on collapse, on the line. Spec 02 and 13 leave the panel expanded, so they still pass.

Comment thread examples/demo/lib/widgets/log_view.dart
fadi-george and others added 3 commits October 20, 2026 12:01
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ubuntu-latest now defaults to a JDK that Gradle 8.7 cannot run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fadi-george
fadi-george merged commit d19cc07 into main Oct 20, 2026
4 checks passed
@fadi-george
fadi-george deleted the fadi/sdk-5526 branch October 20, 2026 21:04
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