Skip to content

Fixes #2888 : First time ever tapping "Nearby": Tab does not show #2903

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

Closed
wants to merge 6 commits into from

Conversation

ahmedmamdouh13
Copy link

Steps to reproduce:

Install app on new phone
Log in
Tap "nearby"
Location permission popup appear, accept
Nearby tab is not opened (nearest location bar is shown, though)

Workaround: Tap on "Nearby" again.

Fixes #2888 : First time ever tapping "Nearby": Tab does not show

took requesting location permission off the main thread to stop delaying UI elements

Tested on Huawei P9 lite API level 24 | Nexus 5 with API level 25.

untitled

Copy link
Member

@maskaravivek maskaravivek left a comment

Choose a reason for hiding this comment

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

Can you briefly explain why you are using a new thread?

@ahmedmamdouh13
Copy link
Author

because opening the tab while requesting permission is a lot on the main thread to handle, especially when the app is freshly installed requesting permission for the first time from the OS takes longer than usual , doing so on the main thread causes this lag which is viewpager not responding to Tab clicking.

@maskaravivek
Copy link
Member

I don't think threading the issue in this case. Check out NearbyFragment. My guess is that the fragment is returning early if the location is not present.

@ahmedmamdouh13
Copy link
Author

okay but let me tell you what i tried , i tried to do not request permission at all , what happened was that everything went smoothly and Nearby tab opened with no bug , another thing is that even when requesting the permission on another thread their was an obvious delay of 1 second or less which explains why it was causing the bug.

@@ -209,6 +209,7 @@ public void next() {
void setCurrentTitleAndDescriptions(Title title, List<Description> descriptions) {
setCurrentUploadTitle(title);
setCurrentUploadDescriptions(descriptions);
store.putString("Title", title.toString());
Copy link
Member

Choose a reason for hiding this comment

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

Is this change related?

Copy link
Author

Choose a reason for hiding this comment

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

no , this change of another issue , i didn't know that every pull request needs a new branch , i'll try to fix it.

@@ -602,7 +604,13 @@ private void registerLocationUpdates() {
*/
private void requestLocationPermissions() {
if (!getActivity().isFinishing()) {
locationManager.requestPermissions(getActivity());
new Single<Object>(){
Copy link
Member

Choose a reason for hiding this comment

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

Dispose of the single

Copy link
Author

Choose a reason for hiding this comment

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

okay got it.

@codecov-io
Copy link

Codecov Report

Merging #2903 into master will increase coverage by 0.23%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2903      +/-   ##
=========================================
+ Coverage    3.39%   3.62%   +0.23%     
=========================================
  Files         246     246              
  Lines       12212   12217       +5     
  Branches     1080    1078       -2     
=========================================
+ Hits          414     443      +29     
+ Misses      11768   11740      -28     
- Partials       30      34       +4
Impacted Files Coverage Δ
...ava/fr/free/nrw/commons/nearby/NearbyFragment.java 0% <0%> (ø) ⬆️
...r/free/nrw/commons/contributions/MainActivity.java 0% <0%> (ø) ⬆️
...ommons/bookmarks/pictures/BookmarkPicturesDao.java 0% <0%> (ø) ⬆️
...ee/nrw/commons/media/MediaDetailPagerFragment.java 0% <0%> (ø) ⬆️
...s/bookmarks/pictures/BookmarkPicturesFragment.java 0% <0%> (ø) ⬆️
app/src/main/java/fr/free/nrw/commons/Media.java 6.89% <0%> (+6.2%) ⬆️
...n/java/fr/free/nrw/commons/bookmarks/Bookmark.java 40% <0%> (+40%) ⬆️
...bookmarks/pictures/BookmarkPicturesController.java 84.21% <0%> (+84.21%) ⬆️

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 a003e97...4db28e8. Read the comment docs.

@maskaravivek
Copy link
Member

@ahmedmamdouh13 I discussed with @neslihanturan and @ashishkumar468 and we feel that the root cause of the issue is that either the lifecycle events are not handled properly or some method is returning early.

Can I take up this issue and spend a couple of days trying to figure out the root cause? I suggest that you take up another beginner-friendly issue for the time being. :)

@ahmedmamdouh13
Copy link
Author

@maskaravivek yes of course , i know it was not an ideal solution but it's their if the problem persists , thank you for informing me 🙏☺️

@neslihanturan
Copy link
Collaborator

Hi @maskaravivek , seems like this issue is solved by a technically better approach at #2925 . Please join the discussion there if you want to. Thanks for your contribution.

Copy link

@akkizle akkizle left a comment

Choose a reason for hiding this comment

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

What isvthis

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
5 participants