magic_device 1.0.2
magic_device: ^1.0.2 copied to clipboard
Gate background work in Flutter: detect mains power (charging), viewer idle and macOS window fullscreen. One import, no setup, no Runner edits.
Changelog #
All notable changes to this project will be documented in this file.
[Unreleased] #
1.0.2 - 2026-11-16 #
Fixed #
- pub.dev tags the package for every platform it runs on. The pubspec declared only macOS (the native
WindowFullscreenplugin), so the package page showed a macOS-only package althoughDevicePoweris plain Dart overbattery_plus. A top-levelplatforms:key now declares Android, iOS, Linux, macOS and Windows. Web is left out on purpose: declaring it makes pana's WASM check fail and costs 10 points, while the code itself still runs on the web. (pubspec.yaml,README.md,llms.txt)
1.0.1 - 2026-11-15 #
Changed #
- The package page is
https://anilcancakir.com/magic/deviceand the documentation links sit underhttps://anilcancakir.com/magic/docs/device.
Fixed #
- The docs and the agent skill now say "native macOS and Windows" where they said "macOS and Windows": a web build on a Mac attaches the lifecycle observer too, because the system-wide idle clock is read only on native macOS and Windows.
- The agent skill's recipes (the power gate, the fullscreen button, the test) now compile as written, with their imports, and its
WindowFullscreenrules and test notes no longer repeat the docs word for word.
1.0.0 - 2026-11-14 #
Changed #
- First stable release: version 1.0.0 follows 0.0.2 with no API change beyond what is listed below.
- The analyzer no longer suppresses
unintended_html_in_doc_comment; the package analyzes clean without it. - Doc page leads are one sentence that says what the page is (the docs site copies it into its generated
llms.txt), and the samples that useisTelevisionsay it is the host's own detection.
0.0.2 - 2026-11-13 #
Changed #
-
The repository moved to
anilcancakir/magic_device.homepage(the package landing),repositoryandissue_trackerinpubspec.yamlpoint at the new owner, and thedocumentationkey is gone (the landing links the docs, as for wind and magic), and the LICENSE holder is now Anılcan Çakır. The package name, the API and the version line are unchanged. -
The default branch is
master, protected: a pull request and greenLint & TestandChangelogchecks are required, force pushes and deletion are blocked. -
The publish workflow validates more and releases itself. It runs
flutter pub publish --dry-runand requires a matching CHANGELOG section before publishing, then creates the GitHub Release from that section once pub.dev accepts the tag. Every action is pinned by commit SHA and the workflows run with read-only permissions by default. -
The release workflow checks its own inputs. The tag must sit on master and name the same version as
pubspec.yaml, the podspec and the agent skill, and the package must score the full 160 points on pana before anything is published. -
Every change keeps the docs in step. The post-change checklist in
CLAUDE.mdand the pull request template now require the changelog, README,llms.txt,doc/pages and the agent skill to match the change. -
The pub.dev description and topics are written for search and for agents. The description leads with the job ("Gate background work in Flutter") and the three signals; the topics are
battery,idle,power,fullscreenandmagic, all existing pub.dev topics. -
The package is no longer marked alpha. The README banner and the SECURITY note are gone; the version line continues as
0.0.x.
Added #
doc/: installation,DevicePower,WindowFullscreenand testing pages in the repository's docs standard, checked bytool/check-docs.pyand theDocs Link Checkworkflow on every pull request.SECURITY.md, issue forms for bugs and feature requests, and a pull request template.- A
Changelogcheck: a pull request that changeslib/ormacos/must also changeCHANGELOG.md. Dependabot,release:pull requests and theskip-changeloglabel are exempt. llms.txt: the package for an AI coding agent, with setup, the API, platform support and the rules an agent must follow.skills/magic-device: an agent skill for the package, installed withnpx skills add anilcancakir/magic_device. It stays out of the pub.dev archive.- The README opens with the Magic logo (
.github/magic-logo.svg) and the centered header every Magic package uses.
0.0.1 - 2026-10-29 #
Added #
DevicePower: whether the device is on mains power (charging) and whether the viewer is away (idle). Desktop idle polls the OS last-input clock; mobile idle follows the app lifecycle, seeded from the current lifecycle state atstart()so an app started in the background reads idle at once.televisionis an injectable predicate that defaults to() => false.WindowFullscreen: whether the macOS window is fullscreen (active), where it is going (target, moved by AppKit's will-notification) and whether it is animating (transitioning), withtoggle()to flip it. A press that the window never answers (AppKit ignores the call for an app that is not frontmost) ends afterpressTimeoutand re-reads the window, so it cannot hold every later toggle. One sharedinstance; listeners hear each change, whether it came fromtoggle(), the window's green button, Esc or the Window menu.availableis true on macOS only. The native half is a macOS plugin (MagicDevicePlugin, channelmagic_device/window) that finds the window holding the Flutter view on each call, so the host's Runner needs no edit.BatteryStateis exported from the barrel.DevicePower'sbatteryStatereader returns it, so a host that supplies its own reader names the type without addingbattery_plusas a direct dependency.