Repository navigation
feat: add DevicePower and WindowFullscreen - #1
Conversation
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
|
Note Kodizm (AI-generated). May contain mistakes; verify before acting. The package is well structured and well tested. One real bug: a toggle that AppKit silently ignores locks Major
Minor
Tests
CILint & Test: success I did not review the generated example scaffolding (Xcode project, xib, icons) beyond the manifest. |
…tart WindowFullscreen.toggle() held the press until a will/did notification, which never comes when AppKit ignores the call for an app that is not frontmost, so every later toggle on the shared reader returned early. An accepted call now ends the press after pressTimeout (1 second) by re-reading isFullScreen; a notification that lands first still ends it and cancels the timer. DevicePower.start() on mobile only heard later lifecycle changes, so an app started in the background read idle as false. It now seeds idle from WidgetsBinding.instance.lifecycleState through the observer's own mapping.
|
Round 1 addressed in 6c01b08. Both findings reproduced with a failing test before the fix. MAJOR
MINOR
README and CHANGELOG describe both behaviours. Gates on 6c01b08:
@kodizm please re-review. |
|
Note Kodizm (AI-generated). May contain mistakes; verify before acting. Both round-1 findings are fixed in 6c01b08, and I found nothing new; the change looks correct. What changed since the last review: only 6c01b08. I read its changes to
Tests
CILint & Test: success I did not review the generated example scaffolding (Xcode project, xib, icons) beyond the manifest. |
What
The first release of
magic_device, 0.0.1.DevicePower: whether the device is on mains power (charging) and whether the viewer is away (idle). macOS and Windows read the system-wide last-input clock throughflutter_inactive_timer; every other platform follows the app lifecycle. Atelevisionpredicate (default() => false) answerschargingtrue on a batteryless box that reportsunknown. Every platform read is a constructor parameter.WindowFullscreen: the macOS window's fullscreen state (active,target,transitioning) andtoggle(), through one sharedinstance. Listeners hear every change, including the green button, Esc and the Window menu.availableis true on macOS only.MagicDevicePluginon themagic_device/windowchannel. It finds the window holding the Flutter view on each call, so the host's Runner needs no edit. CocoaPods and Swift Package Manager are both supported.BatteryStateis exported from the barrel, so a host that supplies its own battery reader does not needbattery_plusas a direct dependency.example/: a macOS app that toggles the window and logs each notification in order.Why
Watchools kept both of these as app code: the power gate for background work and the fullscreen bridge in its own
MainFlutterWindow.swift. Neither is IPTV specific. Any Magic app that runs heavy work on a battery device, or that has a macOS window, needs the same two signals, so they move into a package.Testing
flutter test: 27 passed acrosstest/powerandtest/windowdart analyze: no issuesdart format --set-exit-if-changed .: 0 changedflutter pub publish --dry-run: 0 warningscd example && flutter build macos --debug: built