Skip to content

Leave the notification center alone until Flutwire has run - #11

Merged
tonytonycoder11 merged 2 commits into
mainfrom
inert-until-enabled
Oct 24, 2026
Merged

tonytonycoder11 merged 2 commits into
mainfrom
inert-until-enabled

Conversation

@tonytonycoder11

Copy link
Copy Markdown
Contributor

On iOS and macOS the plugin made itself the app's notification delegate as soon as the app launched, in every build, even when the app never started Flutwire. An app that keeps Flutwire in its production build with init switched off, which is the only option when just some flavors should record, had its notification handling routed through the plugin without asking for it.

Now the plugin does nothing until Flutwire has run in that build. initialize, which Dart calls only when Flutwire is recording, adopts the delegate and writes the version and build number of the app. At the next launch of the same build the plugin adopts the delegate at registration, so that a tap on the notification after the app was killed still finds it in place. A notification can only exist if Flutwire ran before, so nothing is lost. A build that never starts Flutwire never writes the mark and never touches the delegate.

It also forwards userNotificationCenter(_:openSettingsFor:) to the delegate it replaced. The plugin passed on the other two delegate calls and dropped this one.

I checked it on the iOS simulator with the example app and a probe that logged UNUserNotificationCenter.current().delegate:

  • Fresh install with Flutwire off: the delegate stays nil, nothing is written to disk.
  • Same install with Flutwire on: the delegate becomes the plugin and the mark is written.
  • Same build launched with Flutwire off afterwards: the plugin adopts the delegate early, because the mark is there. That is the one case left, a device where that very build ran Flutwire before.

The example also builds for macOS. Android was already idle until Dart asks: it creates a channel and waits.

The package README gets a short section on recording in test builds only.

Targets 0.2.0.

On iOS and macOS the plugin made itself the app's notification delegate as
soon as the app launched, in every build, even when the app never started
Flutwire. It now waits until Flutwire has run in that build, and remembers
it did, by the version and build number of the app, so that a tap on the
notification after the app was killed still finds the delegate in place.

It also passes the call that opens the system's notification settings on to
the delegate it replaced, as it already did for the other two.
@tonytonycoder11 tonytonycoder11 moved this to In progress in Flutwire Oct 24, 2026
@trueup-by-nacode-studios

Copy link
Copy Markdown

This pull request adds no capability the code did not already have.

4 files read · 2642 ms · against 36d8943 · engine 1.4.1

@tonytonycoder11
tonytonycoder11 merged commit 03c25e3 into main Oct 24, 2026
6 checks passed
@tonytonycoder11
tonytonycoder11 deleted the inert-until-enabled branch October 24, 2026 10:40
@tonytonycoder11 tonytonycoder11 moved this from In progress to Shipped in Flutwire Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Shipped

Development

Successfully merging this pull request may close these issues.

1 participant