Skip to content

feat(system): add the Sessions home screen widget - #349

Open
Tarquinen wants to merge 2 commits into
widgets-redesignfrom
widgets-sessions
Open

Tarquinen wants to merge 2 commits into
widgets-redesignfrom
widgets-sessions

Conversation

@Tarquinen

Copy link
Copy Markdown
Member

Adds the Sessions widget: the current server's sessions, needs you first, each row opening its session, from a 2x2 up to a scrolling 4x3 and taller. Because nothing pushes when a session starts working, it can refresh itself, from the header's refresh button and about every 30 minutes on a network while one is placed. A failed refresh shows the header as "Offline · ", and a working row older than two minutes reads "Last seen working".

Sizes, light and dark (180×180, 360×180, 360×330):

Sizes

Offline and stale; empty and not paired:

Offline and stale
Empty and not paired

One session, narrow and tall, and font scale 1.3:

Narrow and font scale

On the home screen against session-lab: published by the app, refreshed with the app force-stopped (now Working), redrawn as stale about 3 minutes later, refreshed with the lab stopped (Offline). The third picture was taken before the header stopped counting stale rows as working. The last picture shows resizing on the launcher.

Refresh on the home screen
Resizing on the launcher

  • Badge colours: a refresh keeps the saved colours, a new session takes the colours of a saved session in the same project, and otherwise the default. ProjectAvatarPalette stays in :feature:drawer.
  • A refresh keeps a saved Unread or Failed status while the session is still idle, and skips while the app is in the foreground.
  • Verified with scripts/check.sh :feature:system on the VM, plus the lab and emulator checks above.

Not included: diff counts, the current step and spinners from the mockup (the data doesn't have them; the status is a static dot or word), and the loading skeleton (the widget uses the shared loading layout).

Part of #287

The Sessions widget lists the current server's sessions from the saved widget data,
needs you first, then working, then newest, and each row opens its session. It sizes
from a 2x2 (the top session with counts around it) through a 4x2 (header and as many
rows as fit, then "+N more") to 4x3 and taller (a scrolling list). The header has a
summary, a refresh and a New Session control, dropped before text when narrow.

Nothing pushes when a session starts working, so this widget can read the list itself:
from the header's refresh, and about every 30 minutes on a network while one is placed
(scheduled in onEnabled, cancelled in onDisabled). It skips while the app is in the
foreground. A refresh keeps saved badge colours (a new session takes those of a saved
session in the same project, otherwise the default; the palette stays in :feature:drawer)
and keeps a saved Unread or Failed status for a session that is still idle. A failed
read records refreshFailedAt and the header shows "Offline · <time>". A working row
older than two minutes reads "Last seen working", and a one-time job redraws the widget
when that happens.

Verified: scripts/check.sh :feature:system on the VM; the lab at 130x130 to 400x480,
light and dark, font 1.3, with the busy, stale, empty, caught-up, unpaired, offline and
single fixtures; and on the emulator's home screen against session-lab: placed the
widget, changed the lab's checkpoint, force-stopped the app and tapped refresh (Needs
your input -> Working), saw it turn "Last seen working" about 3 minutes later, then
stopped the lab and tapped refresh (Offline · 1:06 AM). Resized on the launcher.
Turning the Home Screen Widgets experiment off disables the receiver
without onDisabled, so the periodic refresh kept waking the app every
30 minutes. The worker now cancels its work when no Sessions widget is
placed.

Verified on the emulator: placed a widget, periodic job enqueued; turned
the experiment off (getGlanceIds returned [] while the receiver was
disabled), ran the worker, and the periodic job was cancelled. With the
experiment on, the placed widget's refresh still ran the worker and
showed the row as Working. vm.sh check :feature:system passes.

This branch has not been deployed

No deployments
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