Skip to content

feat(app): add offline-recordings auto-sync toggle to device settings#7707

Open
mdmohsin7 wants to merge 8 commits into
mainfrom
dino/device-auto-sync-toggle
Open

feat(app): add offline-recordings auto-sync toggle to device settings#7707
mdmohsin7 wants to merge 8 commits into
mainfrom
dino/device-auto-sync-toggle

Conversation

@mdmohsin7

Copy link
Copy Markdown
Member

What

Adds a Auto-Sync toggle in device settings that lets users enable or disable automatic syncing of offline recordings to Omi. Shown only for Omi devices (DeviceType.omi). Defaults to on.

Why

#7691 stopped auto-syncing offline recordings for custom-STT users (those files can only be transcribed on Omi's servers, counting toward their limit). This adds explicit user control of the same automatic behavior for everyone else: some users prefer to back up offline recordings manually rather than have them auto-sync and transcribe on connect.

Default is true so existing behavior is unchanged — the toggle is opt-out, introduced alongside the feature.

How

  • Preference (backend/preferences.dart): new autoSyncOfflineRecordings bool, getBool default true.
  • Gating: an early-return on the preference is added next to each existing useCustomStt exemption, covering all four automatic entry points:
    • capture_provider._autoSyncSessionWals (post-session)
    • capture_provider.recoverOrphanedWals (startup/reconnect recovery)
    • sync_provider._autoUploadPendingPhoneFiles (in-provider auto-upload)
    • home/page offline-data-detected trigger
  • Manual sync is intentionally unaffected — turning the toggle off disables only the automatic path; users can still sync on demand.
  • UI (settings/device_settings.dart): a Switch row under "Offline Sync", gated to DeviceType.omi. The shared row helper _buildProfileStyleItem gains optional subtitle and trailing parameters.
  • l10n: autoSync + autoSyncDescription added to the template and translated across all 48 non-English locales; flutter gen-l10n reports zero untranslated.

Verification

  • Analyzer clean on all changed files.
  • capture_provider test suite passes.
  • flutter gen-l10n — zero untranslated messages.

Notes

  • Scope is intentionally DeviceType.omi only, not the wider Omi family (openglass/friendPendant) which also support WAL sync.
  • Generated l10n bindings are committed in gen-l10n's native formatting to match repo convention and avoid reformat churn.

mdmohsin7 added 8 commits June 8, 2026 15:01
Adds the autoSync title and autoSyncDescription subtitle strings used by
the new offline-recordings auto-sync toggle in device settings.
Stores the user's choice to auto-sync offline recordings to Omi when the
device connects. Defaults to true so existing behavior is unchanged.
Skip post-session auto-sync and startup orphan-WAL recovery when the user
has turned auto-sync off. Manual sync is unaffected.
Honors the autoSyncOfflineRecordings preference in the in-provider
auto-upload path.
Respects the autoSyncOfflineRecordings preference at the home-page
offline-data-detected entry point.
Adds a switch under Offline Sync, shown only for Omi devices, that lets
users enable or disable automatic syncing of offline recordings. Extends
the settings row helper to support a subtitle and trailing widget.
@mdmohsin7

Copy link
Copy Markdown
Member Author

@greptile-apps review

@greptile-apps

greptile-apps Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds an Auto-Sync toggle to device settings that lets users opt out of having offline recordings automatically synced to Omi when the device connects. The preference defaults to true so existing behavior is unchanged, and all four automatic sync entry points are gated behind it.

  • Preference & UI: A new autoSyncOfflineRecordings bool (default true) is stored in SharedPreferences, and a Switch row is added under "Offline Sync" in device settings, visible only for DeviceType.omi devices.
  • Provider gating: Early-return guards are added to _autoSyncSessionWals, recoverOrphanedWals, _autoUploadPendingPhoneFiles, and the home/page onOfflineDataDetected callback — all parallel to the existing useCustomStt exemption pattern.
  • l10n: autoSync and autoSyncDescription keys are added to the template and generated across all 48 non-English locales.

Confidence Score: 3/5

Safe to merge for single-device users (the majority), but multi-device users pairing an Omi with a friendPendant or openglass could have auto-sync permanently blocked with no UI recourse.

All four auto-sync entry points are guarded by a global autoSyncOfflineRecordings flag, but the UI to flip that flag is gated exclusively to DeviceType.omi. The PR notes that friendPendant and openglass also support WAL sync — so a user who disables the toggle on their Omi and then connects one of those devices will silently lose auto-sync on it with no way to re-enable it from the UI. The default is true so the happy path is unaffected, but the cross-device state bleed is a real breakage for the multi-device minority.

app/lib/providers/capture_provider.dart and app/lib/providers/sync_provider.dart — the preference guards need a device-type condition (or the preference needs to be scoped per device type) to avoid silently disabling auto-sync on non-Omi WAL devices.

Important Files Changed

Filename Overview
app/lib/backend/preferences.dart Adds autoSyncOfflineRecordings bool preference (default true); clean getter/setter pair.
app/lib/pages/settings/device_settings.dart Adds Auto-Sync Switch row gated to DeviceType.omi; extends _buildProfileStyleItem with optional subtitle/trailing. Toggle is UI-gated to Omi only but writes a global preference that affects all WAL-capable device types.
app/lib/providers/capture_provider.dart Gates _autoSyncSessionWals and recoverOrphanedWals behind the new preference; preference is checked globally without device-type filtering, creating bleed across device types.
app/lib/providers/sync_provider.dart Gates _autoUploadPendingPhoneFiles behind the new preference; same global-scope concern as capture_provider.
app/lib/pages/home/page.dart Adds autoSyncOfflineRecordings guard to onOfflineDataDetected; same global-scope concern applies here too.
app/lib/l10n/app_en.arb Adds autoSync and autoSyncDescription keys with metadata; entries are inserted between the offlineSync value and its @offlinesync annotation, splitting that key from its metadata in the file.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Device Connects / Offline Data Detected] --> B{useCustomStt?}
    B -- Yes --> C[Skip auto-sync\nManual only]
    B -- No --> D{autoSyncOfflineRecordings?}
    D -- false --> E[Skip auto-sync\nUser opt-out]
    D -- true --> F[Proceed with auto-sync]
    F --> G[_autoSyncSessionWals\ncapture_provider]
    F --> H[recoverOrphanedWals\ncapture_provider]
    F --> I[_autoUploadPendingPhoneFiles\nsync_provider]
    F --> J[onOfflineDataDetected\nhome/page]
    K[Device Settings UI\nDeviceType.omi only] -->|writes| L[(SharedPreferences\nautoSyncOfflineRecordings)]
    L -->|read by| D
    style C fill:#555,color:#fff
    style E fill:#555,color:#fff
    style K fill:#8B5CF6,color:#fff
Loading

Reviews (1): Last reviewed commit: "feat(app): add Auto-Sync toggle to devic..." | Re-trigger Greptile

Comment on lines +1710 to +1713
if (!SharedPreferencesUtil().autoSyncOfflineRecordings) {
Logger.debug('Orphan WAL recovery skipped: auto-sync disabled by user');
return;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Global preference silently disables sync for non-Omi WAL devices

The autoSyncOfflineRecordings preference is checked unconditionally in all four auto-sync paths (_autoSyncSessionWals, recoverOrphanedWals, _autoUploadPendingPhoneFiles, and the home/page callback), but the UI toggle to control it is shown only for DeviceType.omi. Since friendPendant and openglass also support WAL sync (as noted in the PR description), a user who sets their Omi to off will have auto-sync silently disabled for any non-Omi WAL device they also use — with no UI control to restore it on that device. Each provider check would need to also gate on the connected device's type, or the preference should be per-device-type to avoid this cross-device bleed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Auto-sync of offline recordings is an Omi-only feature — no other device type (openglass, friendPendant, etc.) auto-syncs — so the global autoSyncOfflineRecordings preference can't disable sync on a non-Omi device, and the Omi-only toggle is the correct and only control surface. No cross-device bleed in practice. Resolving as non-issue.

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