commons-app / apps-android-commons

The Wikimedia Commons Android app allows users to upload pictures from their Android phone/tablet to Wikimedia Commons
https://commons-app.github.io/
Apache License 2.0
1.03k stars 1.23k forks source link

refactoring opportunity - duplicated code #5836

Closed tristan81 closed 1 month ago

tristan81 commented 1 month ago

Duplicated onscroll event code for Nearby and Explore map viewers, could be refactored to remove duplication.

ExploreMapFragment

image

NearbyParentFragment

image
RitikaPahwa4444 commented 1 month ago

Thanks for spotting this! Linking an older issue for anyone planning to take this one up as previous attempts to remove redundant code didn't turn out as intended: https://github.com/commons-app/apps-android-commons/issues/5256. Taking a look at the merged PR might help as several cases were covered in it and would save a lot of time as we would be aware of the changes that might break the code.

tristan81 commented 1 month ago

the code between Explore and Nearby has diverged now so the duplicate code displayed no longer exists

nicolas-raoul commented 1 month ago

@tristan81 has the code diverged recently? If the changes can benefit both nearby and explore, then it would still make sense to de-duplicate. 🙂

tristan81 commented 1 month ago

The changes to refresh Nearby OnScroll without any distance thresholds mean this example of duplication no longer exists in the code.

nicolas-raoul commented 1 month ago

The changes to refresh Nearby OnScroll without any distance thresholds, should ideally be implemented in all maps of the app.

Deduplicating would allow all maps to benefit from such improvements. 🙂