Skip to content

fix: Fix selected settings item in tablet mode#630

Open
LunarX wants to merge 1 commit intomainfrom
fix-selected-settings-item
Open

fix: Fix selected settings item in tablet mode#630
LunarX wants to merge 1 commit intomainfrom
fix-selected-settings-item

Conversation

@LunarX
Copy link
Copy Markdown
Contributor

@LunarX LunarX commented Apr 28, 2026

The tablet selection did not recognize nested navigations as being part of the "Settings" item

@LunarX LunarX requested a review from NicolasBourdin88 April 28, 2026 11:28
@LunarX LunarX self-assigned this Apr 28, 2026
Copilot AI review requested due to automatic review settings April 28, 2026 11:28
@LunarX LunarX added the bug Something isn't working label Apr 28, 2026
@LunarX LunarX enabled auto-merge April 28, 2026 11:28
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes the “Settings” list item selection in tablet/two-pane mode so it remains selected when navigating to nested Settings sub-screens.

Changes:

  • Update selection logic in MyAccountScreenWrapper to use a predicate-based match for the selected navigation item.
  • Extend MyAccountSettingAction.Navigation with an isSelected predicate and adjust the Settings entry to match nested settings destinations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/MyAccountScreenWrapper.kt Uses the new isSelected(...) predicate to resolve the currently selected settings navigation entry.
app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/MyAccountScreen.kt Adds an isSelected predicate to navigation actions and updates Settings to be selected across nested settings destinations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

val destination: SettingsOptionScreens,
val isSelected: (SettingsOptionScreens?) -> Boolean,
) : MyAccountSettingAction(null) {
data object Settings : Navigation(SettingsOptionScreens.SETTINGS, { it is SettingsOptionScreens })
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

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

Navigation.Settings uses isSelected = { it is SettingsOptionScreens }, but the predicate parameter is already typed as SettingsOptionScreens?, so this check is effectively just it != null. Using an explicit non-null check (or a clearly named helper like isInSettingsSubtree) would make the selection rule easier to understand and maintain.

Suggested change
data object Settings : Navigation(SettingsOptionScreens.SETTINGS, { it is SettingsOptionScreens })
data object Settings : Navigation(SettingsOptionScreens.SETTINGS, { it != null })

Copilot uses AI. Check for mistakes.
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants