Summary
Within the LocationPickerActivity.kt file, when a user tries to delete a location for an image, the removeLocationFromImage() function makes a network call asynchronously via RxJava. Nevertheless, it instantly invokes setResult(RESULT_OK) and finish(), which destroy the activity and hence nullify the compositeDisposable object, cancelling the ongoing network call. Consequently, the deletion operation silently fails, leading to the UI returning back to the previous activity as if the operation was successful, while in reality, no coordinates were ever deleted.
Steps to reproduce
- Navigate to an existing uploaded image that already has location/GPS coordinates attached to it.
- Tap the edit location option to open the map view
- Tap the option to Remove Location
- the map screen closes instantly and returns to the previous screen without any loading state.
5.Update the image information or visit the image at the Wikimedia Commons website the location information is still there since the API request was terminated.
Expected behaviour
LocationPickerActivity should wait for the makeCoordinatesEdit stream from RxJava until it completes before ending its operation by displaying a loader to prevent UI from updating while making a network call.
Actual behaviour
finish() is called immediately after starting the RxJava chain, destroying LocationPickerActivity, clearing compositeDisposable, and dropping the network request.
Device name
Pixel 9
Android version
Android 16
Commons app version
6.5.0-debug
Device logs
No response
Screenshots
Would you like to work on the issue?
Yes
Summary
Within the LocationPickerActivity.kt file, when a user tries to delete a location for an image, the removeLocationFromImage() function makes a network call asynchronously via RxJava. Nevertheless, it instantly invokes setResult(RESULT_OK) and finish(), which destroy the activity and hence nullify the compositeDisposable object, cancelling the ongoing network call. Consequently, the deletion operation silently fails, leading to the UI returning back to the previous activity as if the operation was successful, while in reality, no coordinates were ever deleted.
Steps to reproduce
5.Update the image information or visit the image at the Wikimedia Commons website the location information is still there since the API request was terminated.
Expected behaviour
LocationPickerActivity should wait for the makeCoordinatesEdit stream from RxJava until it completes before ending its operation by displaying a loader to prevent UI from updating while making a network call.
Actual behaviour
finish() is called immediately after starting the RxJava chain, destroying LocationPickerActivity, clearing compositeDisposable, and dropping the network request.
Device name
Pixel 9
Android version
Android 16
Commons app version
6.5.0-debug
Device logs
No response
Screenshots
Would you like to work on the issue?
Yes