Skip to content

fix: Ask permission only first open and rationale == true#155

Merged
baillyjamy merged 5 commits intomainfrom
fix-permission-rationale
Apr 30, 2026
Merged

fix: Ask permission only first open and rationale == true#155
baillyjamy merged 5 commits intomainfrom
fix-permission-rationale

Conversation

@baillyjamy
Copy link
Copy Markdown
Contributor

Ask permission only first open and rationale == true

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

Updates the app’s notification permission flow to only prompt on the first open and to re-prompt only when Android reports that a rationale should be shown.

Changes:

  • Adjusted navigation conditions around the notification permission screen.
  • Introduced a PermissionPreferences store and exposed it via MainViewModel as a StateFlow.
  • Updated MainScreen permission-routing logic to use the new preference + rationale status.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
app/src/main/kotlin/com/infomaniak/auth/ui/screen/permission/NotificationPermissionScreen.kt Changes when the permission screen auto-navigates away based on permission status.
app/src/main/kotlin/com/infomaniak/auth/ui/screen/main/MainViewModel.kt Adds preference-backed StateFlow and a setter to mark permission as asked.
app/src/main/kotlin/com/infomaniak/auth/ui/screen/main/MainScreen.kt Reworks permission-routing logic to use preference state + shouldShowRationale.
app/src/main/kotlin/com/infomaniak/auth/data/preferences/PermissionPreferences.kt Adds a new Splitties preferences wrapper for notification permission “asked” state.

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

Comment thread app/src/main/kotlin/com/infomaniak/auth/ui/screen/main/MainViewModel.kt Outdated
Comment thread app/src/main/kotlin/com/infomaniak/auth/data/preferences/PermissionPreferences.kt Outdated
Comment thread app/src/main/kotlin/com/infomaniak/auth/ui/screen/main/MainScreen.kt Outdated
@tevincent tevincent self-requested a review April 30, 2026 13:36
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

Updates the notification permission onboarding flow to avoid re-prompting after the first display, while allowing re-display when Android indicates a rationale should be shown again.

Changes:

  • Added a persisted hasTriggeredNotificationPermission flag via PermissionPreferences.
  • Exposed/updated that flag from MainViewModel as a StateFlow and setter method.
  • Reworked navigation decision logic in MainScreen and refactored NotificationPermissionScreen to use the persisted flag.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
app/src/main/kotlin/com/infomaniak/auth/ui/screen/permission/NotificationPermissionScreen.kt Adds persistence-aware permission screen behavior and refactors UI vs side-effects.
app/src/main/kotlin/com/infomaniak/auth/ui/screen/main/MainViewModel.kt Introduces flow + setter for persisted “notification permission was triggered” state.
app/src/main/kotlin/com/infomaniak/auth/ui/screen/main/MainScreen.kt Updates routing logic to decide whether to navigate to the permission screen.
app/src/main/kotlin/com/infomaniak/auth/data/preferences/PermissionPreferences.kt New Splitties preferences storage for the persisted trigger flag.
Comments suppressed due to low confidence (1)

app/src/main/kotlin/com/infomaniak/auth/ui/screen/permission/NotificationPermissionScreen.kt:116

  • Tapping "Later" navigates home but does not call onNotificationPermissionTriggered(), so hasTriggeredNotificationPermission stays false and the permission screen will keep being shown on subsequent launches. Consider marking the permission flow as triggered when the user skips (or when the screen is first shown).
                LargeButton(
                    modifier = Modifier.fillMaxWidth(),
                    title = stringResource(R.string.laterButton),
                    style = ButtonStyle.Tertiary,
                    onClick = navigateToHome
                )

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

Comment thread app/src/main/kotlin/com/infomaniak/auth/ui/screen/main/MainScreen.kt Outdated
@baillyjamy baillyjamy enabled auto-merge April 30, 2026 14:44
@sonarqubecloud
Copy link
Copy Markdown

@baillyjamy baillyjamy merged commit 0adb805 into main Apr 30, 2026
9 checks passed
@baillyjamy baillyjamy deleted the fix-permission-rationale branch April 30, 2026 14:46
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.

3 participants