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

Live Location Sharing - Background permission #5565

Merged
merged 7 commits into from
Mar 18, 2022

Conversation

onurays
Copy link
Contributor

@onurays onurays commented Mar 17, 2022

Fixes #5536.

Background location permission behavior started to vary with API 29 as follows:

"<10" -> background location permission is automatically granted by the system
"=10" -> The system permission dialog includes "Allow all the time" to grant the background location permission
">10" -> The system permission dialog DOES NOT include "Allow all time". Users need to enable it in settings

@github-actions
Copy link

github-actions bot commented Mar 17, 2022

Unit Test Results

102 files  ±0  102 suites  ±0   1m 11s ⏱️ +2s
182 tests ±0  182 ✔️ ±0  0 💤 ±0  0 ±0 
598 runs  ±0  598 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit a13ba13. ± Comparison against base commit 36564d3.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@mnaturel mnaturel left a comment

Choose a reason for hiding this comment

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

I have just small improvement suggestions we could do. Tested on different Android versions (9, 10, 11).

import android.app.Activity
import im.vector.app.core.utils.openAppSettingsPage

class DefaultLocationSharingSettingsNavigator constructor(val activity: Activity?) : LocationSharingSettingsNavigator {
Copy link
Contributor

@mnaturel mnaturel Mar 17, 2022

Choose a reason for hiding this comment

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

Should we name it DefaultLocationSharingNavigator instead? In fact, it is intended to handle all navigation cases for the location sharing screen and not only for the settings case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, done.


package im.vector.app.features.location

interface LocationSharingSettingsNavigator {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comments about the name, should we rename it to LocationSharingNavigator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

PERMISSIONS_FOR_BACKGROUND_LOCATION_SHARING,
requireActivity(),
backgroundLocationResultLauncher,
R.string.location_in_background_missing_permission_dialog_content
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think we could add a .setNegativeButton(R.string.action_not_now, null) inside the implementation of the checkPermissions method for the dialog which is displayed when a message should be displayed? Right now the user is forced to go to the permission settings screen and there is no way to disable the dialog.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice idea, done.

override fun goToAppSettings() {
activity?.let {
goingToAppSettings = true
openAppSettingsPage(it)
Copy link
Contributor

Choose a reason for hiding this comment

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

I have seen we can use the ActivityResultLauncher to go directly to the screen of the related missing permission which would be better than going to the app general settings. I would try to see and test if we can change the implementation of this method.

Copy link
Contributor

Choose a reason for hiding this comment

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

In fact ActivityResultLauncher does not work as I expected on Android 10 for example. It requests permission as usual with dialog inside the app. So let's keep the current implementation.

@onurays onurays requested a review from mnaturel March 17, 2022 15:31
@onurays onurays requested a review from mnaturel March 18, 2022 10:56
@mnaturel mnaturel merged commit 3547c5a into develop Mar 18, 2022
@mnaturel mnaturel deleted the feature/mna/PSF-664-5536-permissions branch March 18, 2022 11:06
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.

[Location sharing] - Live location permission dialog
2 participants