Skip to content

feat(app): preserve multiple saved devices - #9311

Merged
undivisible merged 3 commits into
BasedHardware:mainfrom
moni11811:agent/omi4meta-multi-device-support
Jul 24, 2026
Merged

undivisible merged 3 commits into
BasedHardware:mainfrom
moni11811:agent/omi4meta-multi-device-support

Conversation

@moni11811

@moni11811 moni11811 commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Theory
Multi-device support failed because the app persisted one active BLE device and the onboarding scanner rendered only live scan results. A second saved device displaced the first, and offline saved devices disappeared from the connect flow.

Scope

  • Adds SharedPreferencesUtil.btDevices list storage with legacy btDevice fallback.
  • Keeps btDeviceSet updating active device while preserving unique saved devices.
  • Adds OnboardingProvider.savedDeviceList and visibleDeviceList.
  • Updates Find Devices UI to render saved offline devices and replace them with live scan data when seen.

Cut from #9084

  • Meta glasses provider/page/runtime.
  • On-device transcription.
  • Android/iOS native recording churn.
  • Docs/plugin examples/auth changes.

Tests

  • Red first: flutter test test/providers/onboarding_provider_multi_device_test.dart failed on missing btDevices, savedDeviceList, and visibleDeviceList.
  • Green: flutter test test/providers/onboarding_provider_multi_device_test.dart.
  • Green: dart analyze lib/backend/preferences.dart lib/providers/onboarding_provider.dart lib/pages/onboarding/find_device/found_devices.dart test/providers/onboarding_provider_multi_device_test.dart.

Notes

Review in cubic

@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks for pulling this into a much smaller, focused slice. Preserving multiple saved devices while keeping the active btDevice fallback is directionally useful, and the added provider/preferences regression tests cover the core dedupe + live-scan replacement behavior.

A couple of things I’d want checked before this moves out of draft / before maintainer merge review:

  • The UI now counts saved offline devices in the same devicesFoundNearby(...) text and renders them in the scan list. Please verify the intended UX here: an offline saved device may not actually be nearby/advertising, and tapping it should have a clear failure/retry path rather than looking like a live nearby device.
  • Please make sure the targeted Flutter test and analyzer results are available on the final, non-draft PR head. I couldn’t rely on CI here because this draft currently has no status check summary.

I’m not formally approving while this is draft and checks are unavailable, but this looks like a coherent and reviewable app-side improvement rather than the broad mixed scope from the earlier branch.

@Git-on-my-level Git-on-my-level added the needs-maintainer-review Needs a human maintainer to sign off before merge label Jul 9, 2026
@moni11811

Copy link
Copy Markdown
Contributor Author

Addressed draft review in 247950c.

Changes:

  • Nearby count now uses live scan devices only, not saved offline devices.
  • Saved offline devices still render, but show Offline instead of looking nearby.
  • Tapping an offline saved device now stops before connection and shows an Offline snackbar with Retry action.
  • Added provider regression for nearby count + online/offline state.

Local checks:

  • flutter test test/providers/onboarding_provider_multi_device_test.dart
  • dart analyze lib/backend/preferences.dart lib/providers/onboarding_provider.dart lib/pages/onboarding/find_device/found_devices.dart test/providers/onboarding_provider_multi_device_test.dart

@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks for this clean, well-scoped slice — preserving multiple paired devices while keeping the legacy single-device fallback is the right architectural direction, and the migration path (empty list falls back to btDevice) is well thought through.

A few observations for you and the maintainer team:

  1. UX product question (for human maintainer): Offline saved devices now render in the Find Devices scan list with an "Offline" badge and tap-to-retry snackbar. Please confirm with the product team that showing offline devices in the onboarding/connect flow is the intended experience — vs. only surfacing them in a "saved devices" or device-management screen. The tap-block with retry is a reasonable failure path either way.

  2. btDeviceRemove is added to SharedPreferencesUtil but I don't see it called anywhere in this PR. If it's intended for a follow-up device-management screen, that's fine — just flagging it as currently unused.

  3. The getBool(prefKey) change on firmware_warning_acknowledged (removing ?? false) is a harmless drive-by since the getter already defaults to false, but it's unrelated to multi-device persistence. Consider reverting it to keep the diff focused.

  4. The _didNotMakeItTimer nullable conversion (late Timer → Timer?) and the ?.cancel() calls are a good defensive improvement.

The unit tests covering upsert dedupe, visibleDeviceList merge with live-scan replacement, and nearby-count-vs-saved-device semantics are solid. Once this moves out of draft with CI passing, it should be a smooth human review.

Not formally approving while this is draft and no CI checks are available, but this looks like a coherent and reviewable app-side improvement.

@moni11811

Copy link
Copy Markdown
Contributor Author

Addressed review follow-up in d1db0d9c2:

  • Removed the unused btDeviceRemove API.
  • Kept the non-null getBool(prefKey) form: restoring ?? false produces DEAD_NULL_AWARE_EXPRESSION because this getter already returns bool.
  • Re-ran the 3 focused multi-device tests and targeted analyzer; both pass.

The onboarding placement of offline saved devices remains an explicit product/maintainer decision. PR stays draft.

@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks for trimming this into a focused multi-device persistence/onboarding slice.

I did a static maintainer pass on the current draft. The approach looks reasonable to me: btDevices keeps a unique saved-device list with a legacy fallback, visibleDeviceList cleanly overlays saved/offline devices with live scan data, and the new provider tests cover preserving multiple saved devices, replacing saved entries with live scan data, and keeping the nearby count limited to advertising devices.

I do not see a blocker in this diff. Before maintainer merge review, please make sure the targeted flutter test test/providers/onboarding_provider_multi_device_test.dart and the scoped dart analyze commands from the PR body are passing in CI or are posted as fresh verification logs, then undraft when ready.

Leaving this for human maintainer review rather than formal approval because the PR is still draft, checks are not available in the review context, and it changes onboarding device persistence/UX.

@moni11811
moni11811 marked this pull request as ready for review July 13, 2026 02:59

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mobile feature: preserve multiple saved devices — approve only (feature, per policy Nik decides the merge).

@undivisible
undivisible merged commit 4bb6a15 into BasedHardware:main Jul 24, 2026
1 check passed
@moni11811
moni11811 deleted the agent/omi4meta-multi-device-support branch August 19, 2026 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-maintainer-review Needs a human maintainer to sign off before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants