Page MenuHomePhabricator

[native] Remove `sortBy` property from `fetchPhotos`
ClosedPublic

Authored by abosh on Aug 15 2022, 1:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 25, 5:43 PM
Unknown Object (File)
Mon, Nov 25, 3:39 PM
Unknown Object (File)
Fri, Nov 22, 6:54 PM
Unknown Object (File)
Sun, Nov 10, 6:26 AM
Unknown Object (File)
Sat, Nov 9, 12:02 PM
Unknown Object (File)
Sat, Nov 9, 12:02 PM
Unknown Object (File)
Tue, Nov 5, 2:08 AM
Unknown Object (File)
Oct 2 2024, 9:37 PM
Subscribers

Details

Summary

Relevant Linear issue here. I left detailed research for this diff in my comment there. This diff sorts out (no pun intended) issues with MediaGalleryKeyboard displaying images in a weird order and instead mirrors the "default sorting provided by the platform" (from the Expo docs).

In summary, photos are now displayed in the same order as on a user's Camera Roll.

Test Plan

Tested on physical iOS device and Android simulator and works as expected.

One notable thing I tested was setting the creationTime of a photo to the future and making sure that it wasn't pushed to the front of the photos displayed on MediaGalleryKeyboard. This was the main bug with using creationTime.

Photo set to the future:

image.png (1×828 px, 1 MB)

What Camera Roll looks like (photo from the future is still behind last photo, which is from today):
image.png (1×828 px, 1 MB)

What MediaGalleryKeyboard displays (photo from the future still stays behind last photo in Camera Roll, mirroring the ordering of photos in Camera Roll):
image.png (1×828 px, 817 KB)

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

abosh edited the summary of this revision. (Show Details)

Makes sense!

Does this mean the MediaGallery component could look different on iOS/Android for the "same" photo gallery (images, time created, time modified, etc) depending on how they order things? I guess that's fine because it'll match whatever pattern the OS uses throughout (assuming they aren't just exactly the same).

This revision is now accepted and ready to land.Aug 16 2022, 7:25 AM

@abosh you should always respond to questions before landing, even if the diff is accepted

Sorry! My bad, in the rush of trying to get the issue marked as done before the dev sync I forgot to respond. Definitely won’t do that again. I know the importance of “accepting with comments” so I should have been more diligent.

In response to your comment, @atul, yes I suppose the components could look different. But when I tested this on the Android Emulator, it ordered them in the same way as the Android Photos app did. I figure being symmetric with the user’s platform (Android or iOS) is better than trying to make the gallery look the same across all platforms.

But from what I can tell Android and iOS order photos the same way, so it shouldn’t be a big deal.