feat: home screen widgets for iOS and Android - #54
Open
neooriginal wants to merge 1 commit into
Open
Conversation
Adds Quick Connect, Server Status and Snippets widgets on both platforms,
plus a Snippets shortcut in the Hosts header.
Widgets never talk to the server: the app publishes a JSON snapshot into
shared storage (App Group UserDefaults on iOS, SharedPreferences on
Android) and the widget renders only that. No credentials leave the app,
and a corrupt or future-versioned payload falls back to the signed-out
card instead of breaking the launcher.
Tapping a host opens a terminal session on it. Tapping a snippet resolves
it in the app and asks which host to run it on, then executes it through
the existing /snippets/execute endpoint; the last target is remembered and
offered first. Only the snippet id travels in the deep link.
- app/widgets payload contract, snapshot builder,
publisher, preferences, deep links, run sheet
- modules/termix-widgets native bridge, WidgetKit extension sources,
Android providers and layouts
- plugins/withTermixWidgets creates the iOS extension target on prebuild
- scripts/verify-widget-contract.cjs
fails when the TypeScript, Swift and Kotlin
decoders drift apart
Settings gains a Widgets section (publish on/off, show addresses, include
offline, pinned only, snippets, command preview). Signing out clears the
snapshot. Sort and filter move beside the Hosts search field to make room
for the new shortcut.
The iOS extension targets iOS 16 and needs the group.<bundleId>.widgets
App Group enabled on both identifiers.
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.
Overview
Home screen widgets for iOS and Android, plus a Snippets shortcut in the Hosts header.
Settings → Widgetsdisplay/privacy controlsChanges Made
Widgets never talk to the server. The app publishes a JSON snapshot into shared storage (App Group
UserDefaultson iOS,SharedPreferenceson Android) and the widget renders only that — no credentials leave the app, and a corrupt payload falls back to the signed-out card.A snippet has no host of its own, so a tap opens Termix and asks where to run it, then executes it through the existing
/snippets/executeendpoint. The last target is remembered and offered first, so the common case is two taps — which doubles as the confirmation a home-screen tap otherwise lacks. Only the snippet id travels in the deep link.app/widgets/— payload contract, snapshot builder, publisher, preferences, deep links, run sheetmodules/termix-widgets/— native bridge, WidgetKit extension sources, Android providers and layoutsplugins/withTermixWidgets.js— creates the iOS extension target on prebuild (Android needs no plugin; the library manifest merges the receivers)scripts/verify-widget-contract.cjs— fails when the TypeScript, Swift and Kotlin decoders drift apartSigning out clears the snapshot, so host names can't linger on the home screen.
Checklist
Notes
iOS build requirements: the App Group
group.<bundleId>.widgetsmust be enabled on bothcom.karmaa.termixandcom.karmaa.termix.widgets, and the extension needs its own provisioning profile (run one interactiveeas buildfirst). The extension targets iOS 16 while the app stays at 15.1, because it uses WidgetKit layout APIs introduced there.Verified: prebuild on both platforms, generated Xcode target structure, podspec, autolinking, decoder contract agreement, snapshot builder behaviour, deep-link parsing. Not verified: Swift/Kotlin compilation — needs a device build.
Pre-existing on
main(not from this branch):format:check,tsc --noEmitandverify:android-network-securityalready fail.🤖 AI assisted code using Claude Code