Skip to content

feat(notifications): drive the push hint from the backend provisioning flag#83

Merged
anilcancakir merged 2 commits into
mainfrom
feat/preferences-push-provisioned
Jul 25, 2026
Merged

feat(notifications): drive the push hint from the backend provisioning flag#83
anilcancakir merged 2 commits into
mainfrom
feat/preferences-push-provisioned

Conversation

@anilcancakir

Copy link
Copy Markdown
Contributor

What

MagicStarterNotificationController now reads meta.push_provisioned off both preference responses into pushProvisionedNotifier, and the preferences view renders the push heads-up while it is false. MagicStarterNotificationPreferencesView.pushProvisioned becomes bool? and means OVERRIDE: null (the default) reads the backend flag.

Why

#82 shipped the param with no producer. A host had to resolve push provisioning itself, and the most likely host could not even pass it: /settings/notifications is served by the starter's own route registration, so nothing constructs the view. The flag belongs with the data it describes, so magic-starter-laravel now returns it (fluttersdk/magic-starter-laravel#14) and every host gets the hint with no wiring and no extra request.

Degradation

The flag starts true and only moves on a response that actually carries a bool, so a backend that predates meta.push_provisioned (or a degraded payload) never renders a false "push not configured" claim. Against an older backend the hint simply never shows.

Notes

  • The matrix and the flag ride one response, so _buildMatrixSettings listens to both notifiers merged rather than the matrix alone; a flag that changes on a save now rebuilds the toggles too.
  • pushProvisionedNotifier is disposed with matrixNotifier.
  • 4 view tests (backend false / backend true / no flag in payload / host override wins) + 3 controller tests (publish, keep-last-known, republish on save). Suite 1169 green, analyze clean, dart format clean.
  • Requires magic-starter-laravel#14 to be useful; independent of it to be safe.

…g flag

The pushProvisioned param shipped with no producer: a host had to resolve
push provisioning itself, and uptizm could not even pass it (the starter's
own route builds the view). Meanwhile magic-starter-laravel now reports
meta.push_provisioned on both preference responses.

The controller reads that flag into pushProvisionedNotifier and the view
renders the hint while it is false. The flag starts true and only moves on
a response that actually carries a bool, so a backend that predates it
never reads as 'push not configured'. The view param becomes bool? and
means override: null (the default) reads the backend flag.

The matrix and the flag ride one response, so the matrix builder now
listens to both notifiers merged instead of the matrix alone; a flag that
changes on a save rebuilds the toggles too.
Copilot AI review requested due to automatic review settings July 25, 2026 23:02

Copilot AI 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.

Pull request overview

This PR updates the notifications preferences flow so the “push not yet configured” heads-up is driven by a backend provisioning flag (meta.push_provisioned) instead of requiring host wiring, aligning the hint with the data source that owns the truth.

Changes:

  • Add pushProvisionedNotifier to MagicStarterNotificationController and publish meta.push_provisioned from both fetch (GET) and update (PUT) preference responses.
  • Update MagicStarterNotificationPreferencesView so pushProvisioned becomes a nullable host override (bool?), defaulting to the backend-driven notifier, and rebuild the matrix UI when either the matrix or provisioning flag changes.
  • Expand controller + view test coverage for backend-true/false, missing flag degradation behavior, and host override precedence; update changelog entry accordingly.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
lib/src/http/controllers/magic_starter_notification_controller.dart Publishes meta.push_provisioned into a new pushProvisionedNotifier and disposes it with the controller.
lib/src/ui/views/notifications/magic_starter_notification_preferences_view.dart Renders the push hint based on backend flag by default; supports host override via nullable pushProvisioned; listens to merged notifiers for rebuilds.
test/http/controllers/magic_starter_notification_controller_test.dart Adds tests ensuring provisioning flag is published, retained when absent, and republished on save.
test/ui/views/notifications/magic_starter_notification_preferences_view_test.dart Adds widget tests for backend flag true/false, degraded payload behavior, and override precedence.
CHANGELOG.md Updates the unreleased entry to describe backend-driven provisioning behavior and the override semantics.

Comment thread lib/src/http/controllers/magic_starter_notification_controller.dart Outdated
@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…he brand

The lowercase 'onesignal' read like a misspelled brand name. It is the
backend feature-flag identifier, so code-quote it and spell the brand
properly where the docblock means the product.
@anilcancakir
anilcancakir merged commit 740d7d2 into main Jul 25, 2026
2 checks passed
@anilcancakir
anilcancakir deleted the feat/preferences-push-provisioned branch July 25, 2026 23:15
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