Merging as this is a great improvement, additional issues/bugs can be filed as GitHub issues.
* fix in-app camera location loss
* fix failing unit tests
* UploadMediaDetailFragmentUnitTest: modify testOnActivityResultAddLocationDialog to have null location
* reintroduce removed variable
* enable prePopulateCategoriesAndDepictionsBy for current user location
* add relevant comment and fix failing test
* modify dialog and disable location tag redaction from EXIF
* modify in-app camera dialog flow and change location to inAppPictureLocation
* change location to inAppPictureLocation
* fix location flow
* preferences.xml: remove redundant default value
* inform users about location loss happening for first upload
* FileProcessor.kt: remove commented-out code
* prevent user location from getting attached to images with no EXIF location in normal and custom selector
* handle onPermissionDenied for location permission
* remove last location when the user turns the GPS off
* disable photo picker and in app camera preferences in settings for logged-out users
* remove debug statements and add toast inside runnables
* photo picker: toggle behaviour of switch and adjust phrasing for better UX
The enable state used to trigger the GET_CONTENT intent. Alter the flow
such that the GET_CONTENT intent is triggered when switch is disabled.
Adjust default value and other parts of code naming to reflect this.
The existing phrasing had a lot of tech jargon in it which could
result in the non-technical users being confused. Tweak the phrasing
to avoid such phrases.
The documentation in the website could also use some follow up
improvements.
* Adjust strings to clearly convey that location loss is a "risk"
* Removed comma separator from file descriptions
* Removed a redundant line that deleted the last comma of the descriptions
* Added a line to formatDescriptions that replaces every instance of "}}, " with "}}" to remove the comma between descriptions.
* Specified separator as an empty string instead of default value ", " for .joinToString method. Deleted previous fix using .replace method.
* Restored buffer.replace() in updateDescription
On taking a look at the following stack trace:
java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference
at fr.free.nrw.commons.nearby.fragments.NearbyParentFragment.updatePlaceList(NearbyParentFragment.java:777)
at fr.free.nrw.commons.nearby.fragments.NearbyParentFragment.lambda$initFilterChips$10$NearbyParentFragment(NearbyParentFragment.java:730)
at fr.free.nrw.commons.nearby.fragments.-$$Lambda$NearbyParentFragment$AGol6SoJlvIYd45Vbz6tTjDiWU4.onCheckedChanged(Unknown Source:2)
at android.widget.CompoundButton.setChecked(CompoundButton.java:235)
at com.google.android.material.chip.Chip.setChecked(Chip.java:665)
at android.widget.CompoundButton.toggle(CompoundButton.java:150)
...
... it seems clear the 'places' list is trying to be iterated
in the updatePlaceList method when it is empty. This is resulting
in an NPE and consequently an app crash.
Avoid the same by ensuring it is always initialized to an empty list.
Commit 0f0358f22 (Bump minSdk to 29, 2023-04-30) bumped the minSdk to
29 since it was found to be necessary for publishing the app to Play
Store.
On futher analysis[1], it seems like that might actually not be necessary.
The crux is:
1. We (rightly) answer "No" to the Play Console question:
"Does your app access location in the background in APKs or
app bundles targeting Android 9 (Pie) or older (SDK level 28 or lower)?"
2. We do not request for the ACCESS_BACKGROUND_LOCATION permission.
So, it should be safe for us to have the minSdkVersion as 21 itself. If
again we face any rejection of the app update, let us handle it at that
point. I clearly am not able to see any valid reason for Play store to
reject the app update.
[1]: https://github.com/commons-app/apps-android-commons/issues/5223#issuecomment-1569554999
Co-authored-by: Kaartic Sivaraam <kaartic.sn@zohocorp.com>
* MainActivity: add ACCESS_MEDIA_LOCATION permission check to retain location info in EXIF metadata
* remove redundant permission check and optimise imports
* FilePicker: switch to ACTION_OPEN_DOCUMENT intent for opening image files
* add a comment explaining the change
* implement GET_CONTENT photo picker toggle switch
* add location loss warning pop up
* SettingsFragment: modify the comment about GET_CONTENT takeover for more clarity