Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix quick settings back press #129

Merged
merged 2 commits into from
Mar 4, 2024
Merged

Conversation

davidjiagoogle
Copy link
Collaborator

Make it so pressing back button in quick settings screen would navigate back instead of closing the app.

Added two more tests in NavigationTest

@davidjiagoogle davidjiagoogle enabled auto-merge (squash) March 4, 2024 21:55
// Press the device's back button
uiDevice.pressBack()

// Assert we're on PreviewScreen by finding the capture button
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the capture button also shows in the quick settings screen. Maybe assert on the flip camera button being visible?

Comment on lines +86 to +89
when (shouldShowQuickSetting) {
IsExpandedQuickSetting.NONE -> toggleIsOpen()
else -> shouldShowQuickSetting = IsExpandedQuickSetting.NONE
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Can you just put this inline in BackHandler?

BackHandler {
    when (shouldShowQuickSetting) {
        IsExpandedQuickSetting.NONE -> toggleIsOpen()
        else -> shouldShowQuickSetting = IsExpandedQuickSetting.NONE
    }
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

onBack is used again below so I made it into a val

Copy link
Collaborator

Choose a reason for hiding this comment

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

I only see it being used in the BackHandler below. Where else is it being used?

@davidjiagoogle davidjiagoogle merged commit 9127847 into main Mar 4, 2024
4 checks passed
@davidjiagoogle davidjiagoogle deleted the david/quickSettingBackButton branch March 4, 2024 22:02
@temcguir temcguir linked an issue Mar 5, 2024 that may be closed by this pull request
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.

Navigating back from quick settings shouldn't exit app
2 participants