-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(mobile): add album preview images in backup selection #14950
base: main
Are you sure you want to change the base?
Conversation
@@ -15,7 +16,9 @@ class AlbumMediaRepository implements IAlbumMediaRepository { | |||
await PhotoManager.getAssetPathList( | |||
hasAll: true, | |||
); | |||
return assetPathEntities.map(_toAlbum).toList(); | |||
return assetPathEntities.map(_toAlbum).sortedBy((a) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be sorted from the page that needs the sorted info
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't think of any examples where you wouldn't want the album's in a "sane/expected order", hence putting it here. There's no real performance impact (since it's a cheap operation).
Let me know if you disagree and I'll move it.
final isDarkTheme = context.isDarkTheme; | ||
|
||
final previewAsset = useState<Asset?>(null); | ||
getPreviewAsset() async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we extract this logic using a helper method to avoid duplicated code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, but wasn't sure where best to extract to. Where do you recommend for these bits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nm, consolidated into a single file (there was enough duplication of business logic as well as display logic to justify this imo).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR. I left a few comments
Can you help test with an empty album as well? regarding the album thumbnail behavior
Co-authored-by: Alex <[email protected]>
Co-authored-by: Alex <[email protected]>
Will do, although in Android i think an album is literally defined by a folder with at least one image or video in it - so not sure this is possible. If you scroll quickly, you can see the null/empty case before the preview image loads which results in the fallback image. Will try to test on iOS simulator too. |
…at handles both to cut down on repeated code and reduce risk.
I've just tested on iOS, and it crashes when I access the page, I think it is due to some empty album |
Hi, don't know if I should say it here but I think it would be at least a great option for users to be able to switch between list or grid view. |
This PR adds album preview images in the backup selection pages.
For the grid layout (wide-screen, >600px), the only real change is to use the first image in the album.
For the list layout (<=600px), I've removed the icon and made adjustments to make it more similar to the grid view (to facilitate the preview) - however, this work did raise the question: should we just always use a grid view? (since it looks fine on mobile).
Grid (note, this was on mobile since I don't have a tablet handy):
List:
I also: