Skip to content

Fixes #2888: Use Dexter for requesting location permissions #2925

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

Merged
merged 2 commits into from
Jun 8, 2019

Conversation

maskaravivek
Copy link
Member

Description (required)

Fixes #2888

nearby

Copy link
Collaborator

@ashishkumar468 ashishkumar468 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, @maskaravivek. Works fine for me

@neslihanturan neslihanturan changed the title Use dexter to ask for location permissions Fixes #2888: First time ever tapping "Nearby": Tab does not show with dexter Apr 25, 2019
Copy link
Collaborator

@neslihanturan neslihanturan left a comment

Choose a reason for hiding this comment

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

Thanks @maskaravivek , I have tested this. Tabs works fine but nearby doesn't load on API26 device.
Screenshot from 2019-04-25 10-48-00

@neslihanturan
Copy link
Collaborator

One more issue: if I send the app to background while nearby tab is selected, then disable the permission, when I come back to the app it does not request permission. Even more if I switch to contributions tab and come back to nearby tab, it still doesn't request for permission.

@maskaravivek
Copy link
Member Author

Thanks @maskaravivek , I have tested this. Tabs works fine but nearby doesn't load on API26 device.
Screenshot from 2019-04-25 10-48-00

Is there any error in the logs?

@neslihanturan
Copy link
Collaborator

No, there is just an error about SettingsActivity which seems irrelevant.

@neslihanturan
Copy link
Collaborator

These are the logs I see after seeing loading screen for long time and switching back to contribution tab and come back to nearby tab:

2019-04-25 10:50:36.496 6366-6366/fr.free.nrw.commons.beta D/MainActivity: Contributions activity notifications menu item is visible
2019-04-25 10:50:38.478 1443-1492/? D/hwcomposer: hw_composer sent 50 syncs in 398s
2019-04-25 10:50:38.480 6366-6366/fr.free.nrw.commons.beta D/MainActivity: Nearby tab selected
2019-04-25 10:50:38.486 6366-6366/fr.free.nrw.commons.beta D/MainActivity: Contributions activity list sheet menu item is visible
2019-04-25 10:50:38.487 6366-6366/fr.free.nrw.commons.beta D/NearbyFragment: On nearby tab selected
2019-04-25 10:50:38.599 1537-1657/? D/AudioFlinger: mixer(0xa6b83480) throttle end: throttle time(5)

@codecov-io
Copy link

codecov-io commented May 6, 2019

Codecov Report

Merging #2925 into master will increase coverage by 0.04%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2925      +/-   ##
=========================================
+ Coverage    3.69%   3.73%   +0.04%     
=========================================
  Files         249     249              
  Lines       12270   12135     -135     
  Branches     1090    1076      -14     
=========================================
  Hits          453     453              
+ Misses      11782   11647     -135     
  Partials       35      35
Impacted Files Coverage Δ
...r/free/nrw/commons/contributions/MainActivity.java 0% <ø> (ø) ⬆️
...e/nrw/commons/location/LocationServiceManager.java 0% <ø> (ø) ⬆️
...ava/fr/free/nrw/commons/nearby/NearbyFragment.java 0% <0%> (ø) ⬆️
...ava/fr/free/nrw/commons/utils/PermissionUtils.java 0% <0%> (ø) ⬆️
...w/commons/contributions/ContributionsFragment.java 0% <0%> (ø) ⬆️
...fr/free/nrw/commons/mwapi/OkHttpJsonApiClient.java 0.84% <0%> (-0.01%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 67e43ef...e8d0c67. Read the comment docs.

@maskaravivek maskaravivek changed the title Fixes #2888: First time ever tapping "Nearby": Tab does not show with dexter Fixes #2888: Use Dexter for requesting location permissions Jun 3, 2019
Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

✅ A review job has been created and sent to the PullRequest network.


@maskaravivek you can click here to see the review status or cancel the code review job.

@maskaravivek
Copy link
Member Author

@neslihanturan I have fixed the pending issues with this PR and its ready for review now. :)

PFA the attached video for various scenarios.

https://drive.google.com/file/d/1aCuegxzwD4NUY0f5xzyT_g0VQ1YkNuyh/view?usp=sharing

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

No issues found in the PR. Please consider the readability suggestions.


Reviewed with ❤️ by PullRequest

@@ -194,7 +195,7 @@ private void initBottomSheetBehaviour() {

@Override
public void onStateChanged(View bottomSheet, int newState) {
Copy link

Choose a reason for hiding this comment

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

To let other collaborators know that newState is intentionally unused: rename to unusedNewState.

@@ -120,6 +119,10 @@ public static void checkPermissionsAndPerformAction(Activity activity, String pe
@Override
public void onPermissionRationaleShouldBeShown(PermissionRequest permission,
PermissionToken token) {
if (rationaleTitle == -1 && rationaleMessage == -1) {
Copy link

Choose a reason for hiding this comment

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

It seems that you are trying to silently request permission here. The magic number of -1 is not clear from the caller's perspective.

Add function level comments in both checkPermissionsAndPerformAction that rationaleTitle and rationaleMessage can be invalid @StringRes and the meaning of -1, -1.

* @param isContributionsListFragment true when contribution fragment should be visible, false
* means user clicked to MediaDetails
*/
private void updateContributionFragmentTabContent(boolean isContributionsListFragment) {
Copy link

Choose a reason for hiding this comment

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

Is this change relevant to "Use Dexter for requesting location permissions"? If not, I think it would be better to be in a seperate PR.

@neslihanturan neslihanturan merged commit 8971743 into commons-app:master Jun 8, 2019
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.

First time ever tapping "Nearby": Tab does not show
4 participants