Repository navigation
Move to protocol version 8: application icons and session details - #15
Draft
Wavesonics wants to merge 21 commits into
Draft
Wavesonics wants to merge 21 commits into
Wavesonics wants to merge 21 commits into
Conversation
The periphery Homebrew tap cask no longer installs on current Homebrew. Also cancel superseded CI runs.
Lines with defaultDevice are full states, lines with icon are icon replies, and anything else is ignored instead of ending the connection. The full state decodes the v8 features list and per-session iconId. Framing now searches only new bytes, drops a trailing CR, skips blank lines and discards lines over 4 MiB.
An undecodable full state ends the connection as before; other unrecognized lines are still ignored. Treat any non-null icon error and empty icon data as no image, discard overlong lines completed within one read, reuse one JSON decoder, and merge edited sessions without rebuilding every field.
When the server lists the icons feature, ids that are not cached are requested in batches of at most 32 with at most 64 outstanding. Ids the server has no image for are not asked for again until the user connects anew. Icons are decoded off the main thread and cached in memory and in Caches, and each session row shows its icon or a placeholder of the same size.
Cache icons by id and requested pixel size so a larger Dynamic Type size fetches sharper icons, and share one sizing function between the row and the request. Request more ids whenever a full batch fits, drop replies that were not asked for, keep ids being decoded from being requested again, ignore lookups and decodes that finished after a size change or disconnect, load cached icons in one batch, and evict the disk cache only when its maintained count exceeds the bound.
Polling every 10 ms missed the 0.1 s reconnecting phase whenever the main thread was busy for longer, which failed the test on CI.
Mark an undecodable icon unavailable even when the drawn size changed meanwhile, reset outstanding icon ids when going to the background (the stream ends there), wait for the reconnect test's final state with an expectation and assert the exact status sequence, and describe the reconnect-on-bad-state and features behaviour accurately.
Decode the optional v8 session detail and show it beneath the name or alias on one line, in a smaller and dimmer style. Every row reserves the detail line so heights stay fixed as details come and go, changes are not animated, and VoiceOver reads the detail after the name. Details are display only: aliases, saved order and outgoing updates are unchanged.
Order same-named sessions by id, trim details before showing them, name the detail in the rename prompt, share line styling with the hidden height reservation, and skip widget and saved-order writes for states that change neither. The outgoing-update test now goes through the view model.
Drop the widget write skip, which needed per-path resets and could leave the widget stale after returning to the foreground. Read the saved order once per state, sort same-named sessions by id with numbers compared numerically, capture the detail when the rename prompt opens, keep a single order write path, and add the new prompt string to the catalog.
Send protocolVersion 8 in every message and reject a full state of another version before decoding the rest: the app disconnects without reconnecting and says whether the server or the app needs updating. Drop the features list and request icons for any unknown icon id. Session updates go to the current default device instead of a device id searched for in the opaque session id. Point the setup guide and README to PcVolumeControlServer.
Stop parsing session ids for purpose suffixes (ids are opaque and no server sends them), make the in-app server copy platform neutral, drop the unused synchronous session update and the protocol version alias, and fix a stale comment.
The version bump changed only the expected line, not the split chunk feeding it.
Firewall advice names the port and mDNS instead of Windows Firewall only, step 3 points to the server's Status page, and the README intro no longer says Windows only.
ServersRepository takes a transport factory so tests can drive MainViewModel with a scripted transport: an older or newer server is left with the right message and no reconnect.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves the app to protocol version 8 and adds what it brings: application icons and session details (such as a browser tab title) in each row.
Breaking: this version of the app speaks protocol version 8 only. It does not work with the original C# PcVolumeControlWindows server (version 7) and needs PcVolumeControlServer. Against an older server it disconnects and tells the user to update the server.
Left as a draft on purpose: two test-host crashes on earlier commits of this branch are still unexplained (see Testing).
What it changes
protocolVersion8. A full state with another version is rejected before the rest is decoded; the app disconnects without reconnecting and shows a localised message: a lower version means the server needs updating, a higher one means the app does.featureslist. Icons are requested for any unknowniconId; a server without icons simply never sends one and rows keep the placeholder.defaultDevice.deviceIdinstead of a device id searched for inside the session id. The old parsing of|PCVC#purpose suffixes out of session ids is gone too.defaultDeviceis a full state,iconan icon reply, anything else ignored).LineFramerhandles split reads and icon lines of several hundred KiB, drops a trailing CR, skips blank lines and discards lines over 4 MiB. A full state that cannot be decoded ends the connection and goes through the normal reconnect path.IconRequestPlanner(pure) requests only ids neither cached nor outstanding, at most 32 per request and 64 outstanding, at the row's pixel size (points times display scale, clamped to 16..256). Ids with no usable image are not asked for again until the user connects anew; outstanding ids reset when the connection drops or the app goes to the background.IconRepository(actor, decodes off the main thread, bounded memory cache) sits overIconDiskCacheDataSource(Caches/AppIcons, keyed by id and size, count bounded, ids validated before use in a path).SessionIconViewbeside the name (icon or a same-size placeholder, scales with Dynamic Type, hidden from VoiceOver).ServersRepositorytakes a transport factory (defaulting to the socket transport) so tests can driveMainViewModelwith a scripted server.CI changes
main, which does not exist; it now also triggers formaster.test-diagnostics(kept 7 days).Testing
Developed without a local build: compiled and tested only by CI (
testandperipheryjobs). It has not been run on a device or simulator by hand, and has not been connected to a real server from the app.The final commit (
7681fab) passed both jobs on the first attempt, without reruns: 93 tests, no failures, no test-host crash. Unit tests cover:examples/full-state.json);notFound), framing (split reads, one-byte reads, a 1.5 MB line, overlong lines);Test-host crashes: two test-host crashes happened on earlier commits, in older
MainViewModelSimpleTeststests (testReconnectGoesThroughReconnectingStateandtestDeinitCleansUpObservers). They have not recurred in any of the runs since the diagnostics upload was added, so there is no crash report and their cause is unknown. One of those tests was also timing sensitive; it now records every status change instead of polling.Not verified: the look of rows with icons, placeholders and details; VoiceOver output; the mismatch alert and navigation on screen; real connections to a version 8 or version 7 server.
Manual test (needs a Mac)