apps-android-commons icon indicating copy to clipboard operation
apps-android-commons copied to clipboard

Convert nearby package to kotlin

Open psh opened this issue 3 months ago • 7 comments

Parent issue: #5928

I believe this converts the last remaining Java files to Kotlin in the project. Submitting as a Draft PR for now, as I know it's a little on the large size, and happy to break it into pieces for review and merging, or, convert to actual PR if you prefer.

Tested on Pixel 9 pro XL, all unit tests pass.

psh avatar Nov 26 '25 02:11 psh

https://github.com/user-attachments/assets/95ec2743-df9d-4819-9de7-4c821a21bfa5

nicolas-raoul avatar Nov 26 '25 11:11 nicolas-raoul

On the opposite, on branch main, pins load to red or green and stay as such.

nicolas-raoul avatar Nov 26 '25 12:11 nicolas-raoul

Thanks for the feedback - I'll dig into that!

psh avatar Nov 27 '25 21:11 psh

I am getting this crash when trying to upload via Nearby:

https://github.com/user-attachments/assets/15a85281-3b1f-4425-ae63-f1cea5bbca0f

STACK_TRACE=java.lang.NullPointerException: Attempt to invoke virtual method 'double fr.free.nrw.commons.location.LatLng.getLatitude()' on a null object reference
at fr.free.nrw.commons.nearby.presenter.NearbyParentFragmentPresenter.searchCloseToCurrentLocation(NearbyParentFragmentPresenter.kt:610)

In branch main, the same picture's metadata is loaded fine, and caption is correctly filled with the selected item's label.

Would you mind checking? 🙂

nicolas-raoul avatar Nov 30 '25 10:11 nicolas-raoul

There's an up-coming PR (https://github.com/commons-app/apps-android-commons/pull/6579) that I believe addresses this same issue in the existing Java code. I'll convert this PR to draft and let you merge that Java one, and I'll re-convert the Java afterwards so that we are starting from a definite fix for an existing problem.

Dont worry - not abandoning this PR - just making space for the other once to come through and not get lost in the shuffle!

psh avatar Dec 14 '25 15:12 psh

Understood, I started testing pull request https://github.com/commons-app/apps-android-commons/pull/6579

By any chance, would you mind reviewing its code changes? I think you are a better judge than me. :-) Context: https://github.com/commons-app/apps-android-commons/issues/6538

nicolas-raoul avatar Dec 15 '25 14:12 nicolas-raoul

✅ Generated APK variants!

github-actions[bot] avatar Dec 19 '25 09:12 github-actions[bot]