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

Rotated+uploaded pic not considered uploaded by custom picker #5384

Open nicolas-raoul opened 12 months ago

nicolas-raoul commented 12 months ago

Steps:

  1. Find an encyclopedia-worthy pic which needs to be rotated (ask me if you want some).
  2. Start upload it.
  3. At the caption step, rotate it to correct angle (tap Edit image then Rotate then Save).
  4. After upload, open the folder in the custom picker.
  5. Custom picker shows already uploaded pictures with a Commons overlay icon. Problem: Pic does not have this overlay applied.

Ideally the app would insert the "already uploaded" info into the local database.

srishti-R commented 11 months ago

Tried replicating this by changing screen orientation to landscape from portrait at the caption step, it showed correctly for me then after upload is finished in custom picker. Anything I am missing here?

nicolas-raoul commented 11 months ago

@srishti-R Do you mean it shows with the Commons logo icon at the bottom of the thumbnail? If not sure would you mind posting a screenshot and precise which pic you uploaded with rotation? Thanks! :-)

srishti-R commented 11 months ago

@nicolas-raoul Here's the screen capture. https://github.com/commons-app/apps-android-commons/assets/53987325/614ac2a8-aaaa-4c64-a0f9-1afd04a822b9

oh did this mean rotating the image as in when editing the image and not the screen orientation?

nicolas-raoul commented 11 months ago

Sorry yes, you have to tap Edit image then Rotate then Save, I will edit the description to make it unambiguous. Thanks! :-)

srishti-R commented 11 months ago

@nicolas-raoul I tried to attempt this by making LLJTran write the rotated bitmap to the source file instead of creating a separate file. Even when it does, the SHA of the image that is fetched from commons server tells the custom selector that the unrotated image is not the one that was uploaded. Is SHA stored on server dependent on bitmap or the file that was uploaded? If its bitmap, cant do much, since the bitmap was changed and not the file.

nicolas-raoul commented 11 months ago

We have a local table containing SHA1 of uploaded files, which we use as a cache. For this issue, it would be enough to just add the SHA1 of both unmodified and modified files to that local cache table.

This cache unfortunately disappears when reinstalling the app, but the solution proposed here is a lower-hanging fruit than the solution proposed at #5295, and probably good enough for most users.

srishti-R commented 11 months ago

Could you point me to the file where the local cache of SHA1s is present? All I could find out was the code that is checking if the image exists on server using APIs.

nicolas-raoul commented 11 months ago

You mean we don't call UploadedDao.insertUploaded to modify uploaded_table after uploading?

mshdabiola commented 8 months ago

can you assign this issue to me, i think it is related to #5363 issue i just fixed

nicolas-raoul commented 2 months ago

@mshdabiola Did you get a chance to check my feedback on your pull request at https://github.com/commons-app/apps-android-commons/pull/5569#pullrequestreview-1893148253 ? Thanks a lot! :-)

nicolas-raoul commented 2 months ago

@mshdabiola I unassign for now, but if you are you still working on this, please let us know. If no answer, someone else may be assigned to it. Thanks a lot. :-)