fluttercandies / flutter_photo_manager

A Flutter plugin that provides images, videos, and audio abstraction management APIs without interface integration, available on Android, iOS, macOS and OpenHarmony.
https://pub.dev/packages/photo_manager
Apache License 2.0
671 stars 305 forks source link

[BUG] Duplicate images on iOS are sorted differently from ios "Photos" app #603

Closed iosephmagno closed 2 years ago

iosephmagno commented 2 years ago

Describe the bug Sometime users duplicate images in their albums (eg. to apply different effects to the same pic). Noticed that all duplicated images are not loaded by photomanager.

To Reproduce Steps to reproduce the behavior:

  1. Load Recents album via photomanager
  2. Duplicate an image via native photos app
  3. Load album again via photomanager and see that duplicated image is neglected

Tested on iOS, it might affect android as well.

Expected behavior Albums in photomanager should be an exact copy of what they are in native photos app.

Flutter version

Smartphone (please complete the following information):

Log

If applicable, add logs to help explain your problem.

AlexV525 commented 2 years ago

Could you tell me how to get an iOS 17 device? I'm really curious about it.

iosephmagno commented 2 years ago

Typo :) It’s 14.7.1

AlexV525 commented 2 years ago

Versions, code snippets, screenshots/screenrecordings, and whether you've granted full permissions or not.

iosephmagno commented 2 years ago

How to reproduce issue on iphone XS, iOS 14.7.1, full permissions enabled, video/photos available below:

  1. Open wechat assets picker
  2. Load recents album
  3. Switch to iOS photos and duplicate a photo (not the last one)
  4. Switch back to wechat assets picker
  5. Load recents album
  6. Duplicate photo in point 3 is ignored in the picker’s grid.

Video: https://www.dropbox.com/s/irws5adivc8exzv/Wechatsassetspicker.MP4?dl=0

Photos: --- --- --- --- ---
828AC7C5-6B1A-4216-AFE2-49B17BBBE353 8E6CB3CB-2E54-466A-83B8-89AAEC117868 766C28A3-D987-4061-A014-34038DAAB39D F2B7B305-66E4-4EE2-91A5-E348CF60734D BBDBBCC2-8269-4BCD-BC86-C6C0737C7E11
iosephmagno commented 2 years ago

Noticed by chance that duplicate photo is not ignored, it is instead placed in the wrong place (see pic below, red “X” mark vs “check mark”). Check mark is the right chronological position (as in iOS photos app). This means there is a problem with duplicate photos’ timestamp. Not sure whether it depends on iOS or photomanager.

D8ABA064-20C9-4493-92C9-5E14809EEB13

AlexV525 commented 2 years ago

Can you verify if the #606 solve your problem?

iosephmagno commented 2 years ago

Will verify soon and let you know. Since then I also discovered that pics transferred via airplay (eg. from macbook to iphone) seem to be ignored by photomanager. Not sure if it is linked to sorting, will open a separate issue.

AlexV525 commented 2 years ago

See the description in #620 for the detailed behavior about the "Photos" app.

iosephmagno commented 2 years ago

Tried with last version of wechat asset picker and this problem is still there, same as described above.

iosephmagno commented 2 years ago

A duplicate pic is placed soon after origin pic instead of being displayed as the most recent pic in the gallery. See pic below.

4B23F430-FCB6-4FCF-904E-6A825DE07B02

AlexV525 commented 2 years ago

The photo gallery placed the duplicate photo at the most recent place? What if you completely kill the photo app and check again?

iosephmagno commented 2 years ago

I’m not sure I get what you mean. Iphone’s photo gallery places it at most recent place. This is common behaviour: user might duplicate some very old pics with the goal of having them at hand in most recent places (or maybe edit them). Wechat picker gallery places it soon after the origin one (as pic above) even after kill/restart

iosephmagno commented 2 years ago

This is same gallery from iphone app. Duplicate pic is at most recent place. Origin pic is not visible (it is up in the grid).

1EA8E94B-8943-40BF-9D55-368272D27A8F

AlexV525 commented 2 years ago

Sure. I just want to confirm if the "Photos" app will keep these positions after it's been kill/restart, since last time photos that have been airdropped are re-positioned after the "Photos" app restart.

AlexV525 commented 2 years ago

So we use the creationDate key as the default sort condition on iOS, which means duplicate photos might have the same creation date from the system, but gallery handles them differently.

iosephmagno commented 2 years ago

Maybe that was a temporarily bug from ios. Iphone’s photos stores new pics at most recent position (airdropped files included) and doesn’t change sorting after kill/restart.

iosephmagno commented 2 years ago

@AlexV525 any updates on this?

AlexV525 commented 2 years ago

@AlexV525 any updates on this?

Sorry that I'm personally busying in preparing for the DevFest next month, and these issues are all scheduled for further investigations.

iosephmagno commented 2 years ago

Thx for letting me know it. I will ping you again later on

iosephmagno commented 2 years ago

Hi Alex, any news on this?

AlexV525 commented 2 years ago

cc @moyusword

iosephmagno commented 2 years ago

@AlexV525 @moyusword same issue occurs with airdropped files. If we send files over aidrop they don’t get placed as most recent in the Recents album’s grid. Also, airdropped videos aren’t listed at all in Recents album, they only appear in Video album.

Tested on both ios 14 and 15. Bug is reproducible on wechat assets picker.

AlexV525 commented 2 years ago

If you're indicating airdropped files too, I'm pretty sure it's the same issue that #620 is trying to fix, which is typically an iOS bug when new files are dropped and not following the creation date sort.

Closing as it seems to be resolved already, or cannot be solved until iOS fix this.

iosephmagno commented 2 years ago

I have read #620. Here are the differences I notice: 1) 620 says photos are positioned well when app is open yet and repositioned wrongly after it closes. We don’t experience this with Duplicate photos (they are positioned wrongly in both cases). 2) Airdropped videos are not placed in Recents album, either when app is open or after it is closed.

If you guys converge all ios sorting issues in #620, please check these differences.

AlexV525 commented 2 years ago

I'll leave this open until we get more responses from iOS developers.

AlexV525 commented 2 years ago

Also please file a separate issue for videos.

AlexV525 commented 2 years ago

Please verify if #659 solves this problem.

iosephmagno commented 2 years ago

We will check soon and let you know here. Thx!

iosephmagno commented 2 years ago

Hi @AlexV525, we tested #659 and it doesn't fix this issue on iOS. Duplicate photos are still placed soon after original ones, and not as most recent ones in Recent's album grid

AlexV525 commented 2 years ago

Can you make a screenrecord with the whole process?

iosephmagno commented 2 years ago

Checking this again. A team mate tested with an old iphone

iosephmagno commented 2 years ago

Is this fix also available in 1.3.10?

AlexV525 commented 2 years ago

Is this fix also available in 1.3.10?

Of course not...It's available through direct dependency or the 2.0.0-dev.1 version.

iosephmagno commented 2 years ago

Bug is fixed in 2.0.0 👍