feat(app): allow users to rename their Omi device (#2824)#5952
feat(app): allow users to rename their Omi device (#2824)#5952eulicesl wants to merge 1 commit intoBasedHardware:mainfrom
Conversation
efd1a90 to
0199da8
Compare
|
This PR is now ready for review. A few notes to make the review path unambiguous:
User-visible behavior covered by this PR:
I kept this branch intentionally tight so the review surface matches the actual feature scope. |
Greptile SummaryThis PR adds device-rename support to the Omi app. Users can now tap the device name in settings to open a rename dialog; the custom name is persisted locally via a new Key observations:
Confidence Score: 4/5Safe to merge after fixing the invisible validation error snackbar; everything else is style/localization cleanup. One P1 UX defect: the empty-name validation fires a snackbar that renders behind the open dialog, giving users no visible feedback. The underlying rename logic and persistence mechanism are sound. Two hardcoded fallback strings and untranslated non-English locales are P2 polish items that don't block the feature but should be addressed. app/lib/pages/settings/device_settings.dart — the rename dialog's error-feedback path and hardcoded fallback strings need attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Device connects] --> B{updateDeviceNameOnConnect}
B --> C{deviceNameDeviceId empty?}
C -- Yes --> D[Set deviceName = hardwareName]
C -- No --> E{Same device ID?}
E -- No --> F[Set deviceName = hardwareName]
E -- Yes --> G{deviceName empty?}
G -- Yes --> H[Set deviceName = hardwareName]
G -- No --> I[Keep custom name]
D --> J[Set deviceNameDeviceId = newId]
F --> J
H --> J
I --> J
K[User taps device name row] --> L[_showRenameDeviceDialog]
L --> M{User saves}
M -- Empty name --> N[AppSnackbar.showSnackbarError
⚠️ shown BEHIND dialog]
M -- Valid name --> O[Save deviceName to prefs]
O --> P{device != null?}
P -- Yes --> Q[Save deviceNameDeviceId = device.id]
P -- No --> R[deviceNameDeviceId NOT updated]
Q --> S[Pop dialog + setState + success snackbar]
R --> S
T[Forget / Unpair] --> U[Clear deviceName]
U --> V[Clear deviceNameDeviceId]
|
|
Addressed the two open rename-device issues on this branch:
Additional cleanup while landing the fix:
Validation I ran:
Keeping this PR in draft until the review surface is actually quiet and maintainer-ready. |
|
Final readiness note for maintainers:
This PR is the canonical rename-device review path and is ready for maintainer review. |
ba021cb to
8af6fea
Compare
There was a problem hiding this comment.
Pull request overview
Adds local device renaming support and preserves a user-defined device name across reconnects by tracking which physical device “owns” the custom name.
Changes:
- Centralized “set device name on connect” behavior in
SharedPreferencesUtil.updateDeviceNameOnConnect()using a newdeviceNameDeviceIdownership key. - Updated connect flows (onboarding + device provider) to use the new update method instead of overwriting
deviceNamedirectly. - Added a rename-device dialog entry point in Device Settings, plus new English l10n strings.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| app/lib/providers/onboarding_provider.dart | Uses updateDeviceNameOnConnect() during onboarding connect instead of overwriting deviceName. |
| app/lib/providers/device_provider.dart | Uses updateDeviceNameOnConnect() when establishing/refreshing connections. |
| app/lib/pages/settings/device_settings.dart | Adds rename dialog + device name row interaction; clears rename ownership on disconnect/forget. |
| app/lib/pages/home/device.dart | Clears deviceNameDeviceId on unpair/forget flow. |
| app/lib/l10n/app_en.arb | Adds new user-facing strings for rename flow. |
| app/lib/backend/preferences.dart | Adds deviceNameDeviceId and updateDeviceNameOnConnect() to preserve/reset custom names across device switches. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e1a7f4a to
e597492
Compare
fe3fc89 to
ec43494
Compare
ec43494 to
7307415
Compare
Summary
Linked Issue / Bounty
Root Cause
How It Works
SharedPreferencesUtil.updateDeviceNameOnConnect()tracks the current device ID alongside the custom name — if a different device connects, the name resets to hardware default_showRenameDeviceDialog()in device settings presents a modal text field; saves to SharedPreferences on confirmdeviceNameanddeviceNameDeviceIdto prevent stale stateapp_en.arbChange Type
Scope
Security Impact
Testing
flutter test test/providers/device_provider_test.dart)flutter analyzeclean on touched filesHuman Verification
Evidence
Demo recording: https://github.com/user-attachments/assets/b6802017-8ad2-4470-86e6-cc91bed9e7af
Docs
Performance, Privacy, and Reliability
No impact — SharedPreferences read/write only, no network calls added
Migration / Backward Compatibility
Risks and Mitigations
deviceNameDeviceIdcould become stale if the device ID format changes upstream — mitigated by always falling back to hardware name when ID mismatch occursAI Disclosure
🤖 Built with Claude Code