5196: Fix in-app camera location loss (#5249)

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
This commit is contained in:
Ritika Pahwa 2023-09-01 12:15:50 +05:30 committed by GitHub
parent 1cab938d81
commit 5073ca08c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 537 additions and 92 deletions

View file

@ -19,13 +19,6 @@
<PreferenceCategory
android:title="@string/preference_category_general">
<SwitchPreference
android:defaultValue="true"
android:key="useExternalStorage"
app:singleLineTitle="false"
android:summary="@string/use_external_storage_summary"
android:title="@string/use_external_storage" />
<Preference
android:key="appUiDefaultLanguagePref"
app:useSimpleSummaryProvider="true"
@ -38,19 +31,6 @@
app:singleLineTitle="false"
android:title="@string/default_description_language" />
<SwitchPreference
android:key="useAuthorName"
app:singleLineTitle="false"
android:summary="@string/preference_author_name_toggle_summary"
android:title="@string/preference_author_name_toggle" />
<EditTextPreference
android:key="authorName"
app:singleLineTitle="false"
app:dependency="useAuthorName"
app:useSimpleSummaryProvider="true"
android:title="@string/preference_author_name" />
<SwitchPreference
android:defaultValue="true"
android:key="displayNearbyCardView"
@ -71,11 +51,43 @@
android:summary="@string/display_campaigns_explanation"
android:title="@string/display_campaigns" />
</PreferenceCategory>
<PreferenceCategory
android:title="Uploads">
<SwitchPreference
android:defaultValue="true"
android:key="openDocumentPhotoPickerPref"
android:summary="@string/open_document_photo_picker_explanation"
android:title="@string/open_document_photo_picker_title"/>
android:defaultValue="true"
android:key="useExternalStorage"
app:singleLineTitle="false"
android:summary="@string/use_external_storage_summary"
android:title="@string/use_external_storage" />
<SwitchPreference
android:key="inAppCameraLocationPref"
android:title="@string/in_app_camera_location_permission_title"
android:summary="@string/in_app_camera_location_switch_pref_summary"/>
<SwitchPreference
android:defaultValue="true"
android:key="openDocumentPhotoPickerPref"
android:summary="@string/open_document_photo_picker_explanation"
android:title="@string/open_document_photo_picker_title"/>
<SwitchPreference
android:key="useAuthorName"
app:singleLineTitle="false"
android:summary="@string/preference_author_name_toggle_summary"
android:title="@string/preference_author_name_toggle" />
<EditTextPreference
android:key="authorName"
app:singleLineTitle="false"
app:dependency="useAuthorName"
app:useSimpleSummaryProvider="true"
android:title="@string/preference_author_name" />
</PreferenceCategory>
<PreferenceCategory
@ -88,6 +100,7 @@
app:singleLineTitle="false"
android:summary="@string/manage_exif_tags_summary"
android:title="@string/manage_exif_tags" />
</PreferenceCategory>
<!-- The key 'allowGps' was used before and has since been removed based on the discussion at #1599.
@ -109,4 +122,4 @@
android:title="@string/send_log_file" />
</PreferenceCategory>
</PreferenceScreen>
</PreferenceScreen>