-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix #493: Fix erroneous no location reminder #5145
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 #493: Fix erroneous no location reminder #5145
Conversation
A tangential question but I noticed that apps-android-commons/app/src/main/java/fr/free/nrw/commons/upload/UploadActivity.java Lines 460 to 471 in c88ce14
this method is implemented in |
About showAlertDialog: Feel free to create a new issue about it, and then feel free to send a pull request for it if you want. Thanks for noticing! 🙂 |
app/src/main/java/fr/free/nrw/commons/upload/UploadPresenter.java
Outdated
Show resolved
Hide resolved
} | ||
} | ||
boolean hasManyConsecutiveUploadsWithoutLocation = defaultKvStore.getInt( | ||
COUNTER_OF_CONSECUTIVE_UPLOADS_WITHOUT_COORDINATES, 0) >= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is indeed much better to not do this in the Activity, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain what probled or mechanism you think was causing the bug? Thanks! 🙂
Yea sure! I believe the app records some metadata under The problem occurs as the actual reminder mechanism is done one step before in So this would explain how after you've uploaded many items without location, there is no reminder. Then the next image uploaded with location still has a reminder because the app looks at the count, sees that it is >= threshold and sends the reminder without reviewing the items that are about to be uploaded. This change now includes both the consecutive count and the current items to decide if it should show a reminder. |
Understood, thanks a lot! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested:
1 upload with location
9 uploads without location
1 upload with location. no message, which is correct.
4 uploads without location
4 uploads without location
1 upload without location
1 upload without location. no message.
9 uploads without location. message appears.
In other words, the bug is fixed. Thanks a lot! 🙂
Description (required)
Fixes #4936
What changes did you make and why?
Moved the logic of handling the decision to show the reminder from
UploadActivity
toUploadPresenter
. If I understood the MVP pattern correctly, I believe that it would be more appropriate forUploadPresenter
to make the decision to show the reminder given it has direct access to the items being uploaded to check for location.The above requires that the
UploadContract.View
also include a method to show the dialog. Two test cases were also added, one for when an image is uploaded without location and one when an image is uploaded with location.Tests performed (required)
Tested Build Variant: Tested BetaDebug on Pixel XL with API level 30.
Additionally, did the following test on debug build:
Screenshots (for UI changes only)
Need help? See https://support.google.com/android/answer/9075928
Note: Please ensure that you have read CONTRIBUTING.md if this is your first pull request.