Skip to content

feat: iOS-style popup: battery rings, still render and scene transitions - #239

Open
akhmadqasim wants to merge 3 commits into
SpriteOvO:mainfrom
akhmadqasim:feat/ios-popup-visuals
Open

akhmadqasim wants to merge 3 commits into
SpriteOvO:mainfrom
akhmadqasim:feat/ios-popup-visuals

Conversation

@akhmadqasim

Copy link
Copy Markdown

Builds on #238 (the first two commits are that PR; only the last commit is new here). Happy to split or drop parts — this is a visual redesign, so it depends on whether the project wants to follow the iPhone sheet this closely.

What changes

Battery rings. Widget::Battery gains a Ring shape (the tray icon and taskbar keep the bar): thin track, progress arc from twelve o'clock, bolt inside while charging, percentage below with an L/R badge or the case glyph. Both pods resting in the case — or reporting the same level and charge state — collapse into one unlabelled ring, and the case glyph is dropped while both pods are inside, like on iOS.

Scenes from pod placement. A per-pod isInCase is derived from the advertisement: "both in case", or a pod that charges while not in an ear. MainWindowPresentation maps that to a Scene:

  • PodsInCase — the turntable video keeps playing;
  • OnePodOut — freezes into the still render with the pods spread, both rings labelled;
  • BothPodsOut — keeps turning;
  • PodsOnly — after 15 s with both pods out, the case leaves the picture and one centred ring remains.

Transitions. Widget::DeviceImage slices the still render into pods and case by its transparent gaps and recomposes them per scene. Widget::FadeOverlay carries a snapshot of the battery row while the widgets underneath are rearranged. One scene fade drives picture and battery row together: the outgoing view fades out (the video keeps playing meanwhile), then the incoming scene fades in; a change landing mid-fade resumes from what is on screen. Slide-in stays 500 ms, slide-out is 250 ms, and the window itself never fades.

Tests

Domain: MergesMatchingPodBatteries, PresentsScenesFromPodPlacement, badge assertions in the existing presentation tests. UI: DeviceImageSlicesAndRearrangesPods, MainWindowDissolvesTheBatteryRow, MainWindowCentresTheLonePodsRing, MainWindowRendersBatteryRings (writes UiValidation/main-window-battery-rings-*.png).

Verified on hardware (AirPods Pro 2 USB-C, Windows 11, 100 %/125 %/150 % scaling). The preview GIFs in Assets/ are not regenerated yet; I can do that if the direction is welcome.

The 10 s auto-hide no longer applies while both pods sit in the opened
case; the popup leaves when the pods come out, the lid closes or the
device disconnects, with a 60 s safety cap.
Only a lid actually seen closed (pods inside), a disconnect or the 90 s
safety cap dismisses it; removing one or both pods does not.
The popup now follows the AirPods sheet on iPhone:

- Battery rings instead of bars (`Widget::Battery` gains a `Ring` shape;
  the tray/taskbar keep the bar): thin track, progress arc from twelve
  o'clock, bolt inside while charging, percentage below with an L/R badge
  or the case glyph. Both pods resting in the case (or reporting the same
  level and charge state) collapse into one unlabelled ring; the case
  glyph is dropped while both pods are inside.
- Per-pod `isInCase`, derived from the advertisement: "both in case", or
  a pod that charges while not in an ear. The presentation maps that to a
  `Scene`: PodsInCase (turntable video), OnePodOut (still render, the
  pods spread), BothPodsOut (keeps turning), PodsOnly (after 15 s the
  case leaves the picture and one centred ring remains).
- `Widget::DeviceImage` slices the still render into pods and case by its
  transparent gaps and recomposes them per scene; `Widget::FadeOverlay`
  carries a snapshot of the battery row while the widgets underneath are
  rearranged.
- One scene fade for picture and battery row: the outgoing view fades out
  (the video keeps playing meanwhile), then the incoming scene fades in.
  A change landing mid-fade resumes from what is on screen.
- Slide-in stays 500 ms; slide-out is now 250 ms, and the window itself
  never fades.

Tests: `MergesMatchingPodBatteries`, `PresentsScenesFromPodPlacement`
(domain), `DeviceImageSlicesAndRearrangesPods`,
`MainWindowDissolvesTheBatteryRow`, `MainWindowCentresTheLonePodsRing`,
`MainWindowRendersBatteryRings` (UI).
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.

1 participant