Repository navigation
feat(app): iOS Home Screen widgets: Battery for every wearable, Up next and Latest - #19252
Conversation
…xt and Latest (BasedHardware#19251) - Battery gains a small Home Screen size: each paired wearable's picture, charge and state, with page dots to switch (iOS 17); never the phone. - Up next (medium, Lock Screen rectangular and inline): the next three open tasks with when they are due, today's first and then upcoming ones, so a task shows ahead of its day (BasedHardware#5080), and how many are open. - Latest (small): the latest kept conversation, its time, tasks and length. The app publishes three JSON documents to the App Group only when one changes (debounced; at once when leaving the app), publishes charging state, and clears them on sign-out. Widget taps open To do, the conversation, the Conversations tab or device settings through HomeNavigation. Widget strings in all 49 app languages.
9447844 to
5010892
Compare
Git-on-my-level
left a comment
There was a problem hiding this comment.
Reviewed the full diff at 5010892. This is a genuinely well-built feature — clean separation between the pure payload builders (HomeWidgetsPayload) and the write path, and the extension side degrades gracefully everywhere. Notes by area:
App side (Flutter)
app/lib/services/home_widgets_service.dart—HomeWidgetsService.publishwrites through the existingcom.omi.battery_widgetchannel only when the JSON actually changed, and rolls back its dedup cache on failure so a retry can happen. Nice touch.app/lib/pages/home/home_widgets_publisher.dart— the 800 ms debounce plus a flush oninactive/pausedis the right shape for widget budget;publishNowcorrectly waits fortasks.hasLoadedso an unloaded list isn't shown as "All caught up". Publisher is disposed inHomePage.dispose(page.dart), so no listener leak.app/lib/core/app_shell.dart—omi://app/<route>is confined to a 4-entry allowlist (action-items,conversation,conversations,settings) and unknown hosts/routes fall through to the pre-existing handling. Good containment.app/lib/utils/auth/clear_user_state.dart— signing out clears all three widget documents, so no task titles or conversation titles linger on the Home Screen after logout. Thanks for thinking about that.app/test/unit/home_widgets_payload_test.dart— good coverage of the ordering rules (connected-first, battery only where live,pendantfallback) and the up-next picking; the Latest-filtering tests (skip discarded/unfinished) are exactly the cases I'd want.
Extension side (Swift)
AppDelegate.swift—updateWidgetDatavalidates the key against a strict three-key map and returnsUNKNOWN_WIDGET_KEYotherwise; a missingjsonremoves the key rather than writing garbage. Correct.BatteryWidget/SharedDefaults.swift—SharedWidgetStore.readusestry?decoding, so malformed App Group data yields the "Open Omi to continue" state instead of a crash. The fallback to the legacy single-device battery keys keeps the widget working before the app ever publishes.BatteryWidget/OmiHomeWidgets.swift—NextDeviceIntentcycles correctly with modulo; the Up next timeline scheduling entries at each shown task's due time plus midnight (so "5:00 PM" flips to "Overdue" without an app launch) is a thoughtful detail. Lock Screen task title is.privacySensitive()— good.Localizable.xcstrings— 12 user-facing widget strings across 49 languages; product-surface localization, which is the accepted scope.- I verified
AUTH_CALLBACK_SCHEMEis defined inapp/ios/Flutter/Base.xcconfig(project-wide), so the extension's$(AUTH_CALLBACK_SCHEME)resolves, andomiWidgetURLadditionally falls back to"omi"— the deep links won't silently break.
For the maintainer (non-blocking):
- This adds a new user-facing surface: conversation titles and open-task counts rendered on the Home Screen. The Lock Screen accessory redacts via
.privacySensitive(), but the Latest widget is Home-Screen-only where that modifier has no effect — worth a product eye on whether titles should show there in all cases. - Documented overlap with #18887 (same
OmiCaptureURLSchemeplist entry, plusAppDelegate/bundle/pbxproj): whichever lands second needs the small rebase described in the PR body. - No iOS CI runs on this repo, so verification rests on the PR's documented simulator builds/tests and static review; the payload logic is the part covered by tests, which is the right split.
Leaving for human maintainer review before merge: product sign-off on the new widget surface (incl. conversation titles on the Home Screen) and the #18887 landing-order coordination. No blocking issues found in review.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
The widget drew the pendant as a glossy orb from the v2 design, which does not look like the device or the photo the app shows. It now uses the app's pendant photo (omi-without-rope) and, while disconnected, its lights-off photo, as the device page does. Other wearables keep their photos, and the drawn orb is gone.
… their photo Up next is a Home Screen widget only; its Lock Screen sizes are removed. The Battery widget keeps the Lock Screen sizes it already had. A disconnected device's photo is no longer faded, as on the app's device page; the pendant still shows its lights-off photo.
|
@Git-on-my-level could you take a look? Following up on your question about the pendant: the Battery widget now shows the pendant's real photo, the same one the app uses (and its lights-off photo while disconnected), instead of the drawn orb. I also dropped the Lock Screen version of Up next. The screenshot in the description is from my iPhone running this branch. |
kodjima33
left a comment
There was a problem hiding this comment.
Mobile/iOS feature (Home Screen widgets) — approve only, not merging (feature; CI green).
What changed and why
This adds iOS Home Screen widgets, and nothing else. It is based on
mainand separate from the v2restyle (#19249) and the Live Activity (#18887). Closes #19251.
AppIntent). Never the phone.App side.
HomeWidgetsPayloadbuilds three JSON documents as pure functions.HomeWidgetsServicewrites oneto the App Group only when it changed, through the existing
com.omi.battery_widgetchannel.HomeWidgetsPublisherfollows the device, task and conversation providers. It debounces for 800 ms, writes at once when the app goes to
the background, and waits for the first task load before publishing Up next. Charging state is published, and
signing out clears the documents. Widget links (
<scheme>://app/<route>) open through the existingHomeNavigation.Extension side.
OmiHomeWidgets.swiftholds Up next, Latest and the next-device intent.BatteryWidget.swiftgains the small size.
SharedDefaults.swiftgains the documents.Localizable.xcstringsholds the widget stringsin all 49 app languages, and the app's product photos, including the Omi pendant and its lights-off photo, are
added as
device-*assets.Refs #5080 (Up next shows upcoming tasks before their day). Related, not addressed: #7150 (Android widget) and
#6929 (Control Center toggle).
Overlap with #18887: both add the same
OmiCaptureURLSchemeInfo.plist line and touchBatteryWidgetBundle.swift,AppDelegate.swiftand the project file. Whichever lands second needs a small rebase, and its Live Activitystrings then move into this target's
Localizable.xcstrings(oneLocalizabletable per target).Screenshots
Battery, Latest and Up next on an iPhone 15 Pro Max, from a build of this branch:
Product invariants affected
none
How it was verified
xcodebuild -target BatteryWidget -configuration Debug-dev -sdk iphonesimulator CODE_SIGNING_ALLOWED=NO SWIFT_OBJC_BRIDGING_HEADER=:BUILD SUCCEEDED. The
.appexholds 49.lprojstring tables and the 12device-*images. The bridgingheader override is needed only because the extension inherits the Runner's Flutter bridging header when built
alone.
swiftc -parseon every changed Swift file: passed.TZ=UTC bash app/test.sh: 138 + 3295 tests passed. Three backend-fixture tests needbackend/in a sparsecheckout; with it they pass.
bash app/scripts/analyze_ratchet.sh: passed.dart formatandgit diff --check: clean.make mobile-verify ARGS="fast --all": 23 of 23 hermetic journeys passed.scripts/pr-preflight --pr-body-fileagainstmainat 8ee1e8c: all 29 selected manifest checks passed.flutter build ios --config-only --profile --flavor prod, thenxcodebuild) and installed. It was signed under a personal preview bundle id and App Group, a build-only changethat is not in this PR. The widgets update from the app, and the Battery widget shows the pendant's photo
(screenshot above).
flutter analyzeon its Dartfiles (no issues), a
swiftcbuild of the widget views for the iOS 18 Simulator, and the iPhone build above. TheLock Screen removal and unfaded photos (89103d0) change only Swift and were checked with the same
swiftcbuild. The full-suite runs in this list are from 5010892.
Tests
test/unit/home_widgets_payload_test.dartcovers:device
test/widgets/home/home_navigation_test.dart:/conversationsselects its tab (the Latest widget's link whenthere is nothing yet).
Failure class (fixes)
Failure-Class: none