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

Rotated+uploaded pic not considered uploaded by custom picker

Open nicolas-raoul opened this issue 2 years ago • 11 comments

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.

nicolas-raoul avatar Nov 13 '23 10:11 nicolas-raoul

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?

srishti-R avatar Nov 22 '23 12:11 srishti-R

@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! :-)

nicolas-raoul avatar Nov 22 '23 14:11 nicolas-raoul

@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?

srishti-R avatar Nov 23 '23 07:11 srishti-R

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

nicolas-raoul avatar Nov 23 '23 08:11 nicolas-raoul

@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.

srishti-R avatar Dec 01 '23 09:12 srishti-R

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.

nicolas-raoul avatar Dec 01 '23 13:12 nicolas-raoul

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.

srishti-R avatar Dec 14 '23 13:12 srishti-R

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

nicolas-raoul avatar Dec 14 '23 14:12 nicolas-raoul

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

mshdabiola avatar Feb 15 '24 15:02 mshdabiola

@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 avatar Aug 20 '24 07:08 nicolas-raoul

@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. :-)

nicolas-raoul avatar Aug 26 '24 02:08 nicolas-raoul