Skip to content

Add app version display to Wear Settings Screen#148

Merged
aadishsamir123 merged 2 commits into
mainfrom
v1.1.1-wear-add-settingsversioninfo
Dec 5, 2025
Merged

Add app version display to Wear Settings Screen#148
aadishsamir123 merged 2 commits into
mainfrom
v1.1.1-wear-add-settingsversioninfo

Conversation

@aadishsamir123

@aadishsamir123 aadishsamir123 commented Dec 5, 2025

Copy link
Copy Markdown
Member

This pull request enhances the WearSettingsScreen by adding an "About" section that displays the app version information. The app version is dynamically loaded using the package_info_plus package and shown in a new card within the settings UI.

New "About" Section and App Version Display:

  • Imported package_info_plus to retrieve app version details.
  • Added _appVersion state and asynchronous logic to load the app version in initState.
  • Introduced a new "About" section and a card UI to display the app version in the settings screen.

Summary by CodeRabbit

  • New Features

    • Shows app version and build number in the settings About section on wear devices.
  • Chores

    • Localization approach adjusted: translations are currently not being injected and some strings are provided as hardcoded text.

✏️ Tip: You can customize this high-level summary in your review settings.

@aadishsamir123 aadishsamir123 added this to the v1.1.1-wear milestone Dec 5, 2025
@coderabbitai

coderabbitai Bot commented Dec 5, 2025

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

Walkthrough

Adds app version retrieval and display to the Wear settings screen using package_info_plus, plus a localization guidance update in the repo instructions indicating hardcoded strings instead of AppLocalizations.

Changes

Cohort / File(s) Summary
App Version Display
lib/wear/screens/wear_settings_screen.dart
Adds package_info_plus import, _appVersion state variable, _loadAppVersion (with error handling) invoked from initState, and an "About" section containing an App Version card that shows the loaded version/build string with WearMode-adaptive styling.
Repository Guidance
.github/copilot-instructions.md
Updates the Localization guidance to state that translations are not being added and that strings should be hardcoded, replacing earlier guidance that referenced AppLocalizations.of(context).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Review focus: lib/wear/screens/wear_settings_screen.dart for async PackageInfo usage, state initialization, and UI insertion.
  • Check error-handling string paths and appearance across WearMode/shape variations.
  • Verify .github/copilot-instructions.md change for intended guidance.

Poem

🐰 I hopped in code with nimble cheer,
Found version bytes both far and near,
A tiny card now tells the tale,
Of build and number on the trail,
✨📦

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding app version display to the Wear Settings Screen, which directly matches the changeset.
Description check ✅ Passed The description provides clear context about the enhancement, explains the implementation approach, and details all key changes made to the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0babee0 and 4a470f2.

📒 Files selected for processing (1)
  • .github/copilot-instructions.md (1 hunks)

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot added enhancement New feature or request semver-minor Minor Updates labels Dec 5, 2025

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
lib/wear/screens/wear_settings_screen.dart (1)

5-36: Guard async setState with mounted and localize all user-visible strings

The version-loading flow via PackageInfo.fromPlatform() is correctly initialized in initState, but has two issues:

  • setState is called after an await without checking mounted, which can throw setState() called after dispose() if the screen is closed before the future completes.
  • The 'Error loading version' string is hardcoded; per project guidelines, all user-visible text in lib/wear/screens/**/*.dart must use AppLocalizations.of(context).

Additionally, the file contains other hardcoded strings ('Settings', 'About', 'App Version', 'Account', 'Actions', 'Sign Out') that should also be localized.

Fix the immediate lifecycle issue like this:

 Future<void> _loadAppVersion() async {
   try {
     final packageInfo = await PackageInfo.fromPlatform();
+    if (!mounted) return;
     setState(() {
       _appVersion = '${packageInfo.version} (${packageInfo.buildNumber})';
     });
   } catch (e) {
+    if (!mounted) return;
     setState(() {
-      _appVersion = 'Error loading version';
+      _appVersion = AppLocalizations.of(context).errorLoadingVersion;
     });
   }
 }

Then route all user-visible strings through AppLocalizations throughout the file.

🧹 Nitpick comments (2)
lib/wear/screens/wear_settings_screen.dart (2)

95-115: Localize the new “About” section header

The new “About” header is a user-visible string in a screen that otherwise should follow the localization guideline. Please switch 'About' to AppLocalizations.of(context)... rather than a hardcoded literal, in line with the existing i18n approach.

As per coding guidelines, all text in lib/wear/screens/**/*.dart should be sourced from AppLocalizations.of(context).


116-179: Localize “App Version” label and consider a non-empty placeholder for _appVersion

The App Version card integrates nicely with the existing Wear UI, but two small tweaks would help:

  • Replace the 'App Version' label with a value from AppLocalizations.of(context) instead of a hardcoded string.
  • Since _appVersion starts as '', the value row will render blank until the async load completes; consider using a short placeholder (e.g., a localized “Loading…” or “Unknown”) to avoid an empty-looking row.

These keep the UI consistent with your localization and UX guidelines.

As per coding guidelines, user-facing strings in lib/wear/screens/**/*.dart should be localized via AppLocalizations.of(context).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dcbeb35 and 0babee0.

📒 Files selected for processing (1)
  • lib/wear/screens/wear_settings_screen.dart (3 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
lib/{screens,widgets,wear/screens}/**/*.dart

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

lib/{screens,widgets,wear/screens}/**/*.dart: Use StreamBuilder<QuerySnapshot> and StreamBuilder<DocumentSnapshot> for real-time Firebase sync instead of Provider/ChangeNotifier
Use AppLocalizations.of(context) for all text translations instead of hardcoded strings
Use SingleTickerProviderStateMixin with AnimationController for animations in StatefulWidgets

Files:

  • lib/wear/screens/wear_settings_screen.dart
lib/**/*.dart

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

lib/**/*.dart: Use kDebugMode checks for debug print statements
Use snake_case for file names, PascalCase for class names, and camelCase for variable names

Files:

  • lib/wear/screens/wear_settings_screen.dart
lib/wear/{screens,widgets}/**/*.dart

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use rotary_scrollbar package for rotary scroll support on WearOS

Files:

  • lib/wear/screens/wear_settings_screen.dart
lib/wear/**/*.dart

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use wear_plus package for ambient mode support on WearOS

Files:

  • lib/wear/screens/wear_settings_screen.dart
🧠 Learnings (7)
📓 Common learnings
Learnt from: aadishsamir123
Repo: ASDev-Official/shopsync PR: 147
File: android/app/build.gradle:51-58
Timestamp: 2025-12-05T14:08:57.988Z
Learning: For android/app/build.gradle in the shopsync repository: Use version code format `XXYYYYYYY` where XX=platform (30=phone, 40=wear), YYYYYYY=versionCode. Phone uses base 300000000, wear uses base 400000000.
Learnt from: CR
Repo: ASDev-Official/shopsync PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-05T14:12:33.756Z
Learning: Use version code format `XXYYYYYYY` where XX=platform (30=phone, 40=wear) and YYYYYYY=versionCode
Learnt from: CR
Repo: ASDev-Official/shopsync PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-05T14:12:33.756Z
Learning: Applies to lib/wear/**/*.dart : Use `wear_plus` package for ambient mode support on WearOS
📚 Learning: 2025-12-05T14:12:33.756Z
Learnt from: CR
Repo: ASDev-Official/shopsync PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-05T14:12:33.756Z
Learning: Applies to lib/wear/**/*.dart : Use `wear_plus` package for ambient mode support on WearOS

Applied to files:

  • lib/wear/screens/wear_settings_screen.dart
📚 Learning: 2025-12-05T14:12:33.756Z
Learnt from: CR
Repo: ASDev-Official/shopsync PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-05T14:12:33.756Z
Learning: Applies to lib/wear/{screens,widgets}/**/*.dart : Use `rotary_scrollbar` package for rotary scroll support on WearOS

Applied to files:

  • lib/wear/screens/wear_settings_screen.dart
📚 Learning: 2025-12-05T14:12:33.756Z
Learnt from: CR
Repo: ASDev-Official/shopsync PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-05T14:12:33.756Z
Learning: Applies to lib/{screens,widgets,wear/screens}/**/*.dart : Use `AppLocalizations.of(context)` for all text translations instead of hardcoded strings

Applied to files:

  • lib/wear/screens/wear_settings_screen.dart
📚 Learning: 2025-12-05T14:12:33.756Z
Learnt from: CR
Repo: ASDev-Official/shopsync PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-05T14:12:33.756Z
Learning: Applies to lib/{screens,widgets,wear/screens}/**/*.dart : Use `SingleTickerProviderStateMixin` with `AnimationController` for animations in StatefulWidgets

Applied to files:

  • lib/wear/screens/wear_settings_screen.dart
📚 Learning: 2025-12-05T14:12:33.756Z
Learnt from: CR
Repo: ASDev-Official/shopsync PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-05T14:12:33.756Z
Learning: Applies to lib/{screens,widgets,wear/screens}/**/*.dart : Use `StreamBuilder<QuerySnapshot>` and `StreamBuilder<DocumentSnapshot>` for real-time Firebase sync instead of Provider/ChangeNotifier

Applied to files:

  • lib/wear/screens/wear_settings_screen.dart
📚 Learning: 2025-12-05T14:12:33.756Z
Learnt from: CR
Repo: ASDev-Official/shopsync PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-05T14:12:33.756Z
Learning: Place WearOS-specific UI in `lib/wear/screens/` with circular layouts and rotary support

Applied to files:

  • lib/wear/screens/wear_settings_screen.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: CI-Code Check

@aadishsamir123 aadishsamir123 merged commit 280262b into main Dec 5, 2025
3 of 4 checks passed
@aadishsamir123 aadishsamir123 deleted the v1.1.1-wear-add-settingsversioninfo branch December 5, 2025 14:59
@coderabbitai coderabbitai Bot mentioned this pull request Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request semver-minor Minor Updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant