-
Notifications
You must be signed in to change notification settings - Fork 360
feat: Fetch assets by specific type within an album #1305
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
base: main
Are you sure you want to change the base?
feat: Fetch assets by specific type within an album #1305
Conversation
**Background & Need** - The GitHub issue ”[Filter Resource By Type] How to use RequestType to filter inside a specific album? fluttercandies#1257” confirms the lack of this feature. - Currently, developers can specify a RequestType globally, but not when fetching assets from a specific album. Proposed Enhancement: - Add an optional RequestType? requestType parameter to album-scoped methods like getAssetListPaged. - If requestType is provided, pass it to native code; otherwise, fallback to RequestType.common. [entity.dart] - Allow overriding album type per call, enabling filtering for a specific asset type within an album. [PMManager.m] - Enforce type filtering. [main.dart] - Add type parameter to getAssetListPaged() for testing the new feature. [pubspec.yaml] - Bump build number.
page: page, | ||
size: size, | ||
type: type, | ||
type: type ?? RequestType.common, // use album type by default |
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.
Shouldn't this be type ?? this.type
?
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.
It should, I don't remember why I forced a fallback.
description: A Flutter plugin that provides album assets abstraction management APIs on Android, iOS, macOS, and OpenHarmony. | ||
repository: https://github.com/fluttercandies/flutter_photo_manager | ||
version: 3.7.1 | ||
version: 3.7.2 |
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.
Please revert
// 'type' here is a bitmask based on PhotoManager's RequestType enum: | ||
// 1 = image | ||
// 2 = video | ||
// 3 = common (image + video) <-- THIS IS THE "COMMON" CASE | ||
// 4 = audio |
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.
IIRC we have utils to convert these numbers into specific native enums. Is it true? The code here seems to be a bit of hard-coded also.
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.
Oh, I didnt know about Utils. We should definitely use them.
Would you be so kind as to make these minor changes? I won't be able to work on this for a while.
I quickly added this feat to our fork and is the only difference compared to the official repo.
final List<AssetEntity> entities = await _path!.getAssetListPaged( | ||
page: 0, | ||
size: _sizePerPage, | ||
type: RequestType.common, // Switch to .video or .image to filter album assets by format |
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.
If we imply the type from the path, then these are unnecessary.
Background & Need
RequestType
to filter inside a specific album? [Filter Resource By Type] How to use RequestType to filter inside a specific album? #1257” confirms the lack of this feature.RequestType
globally, but not when fetching assets from a specific album.Proposed Enhancement:
RequestType
?requestType
parameter to album-scoped methods likegetAssetListPaged
.requestType
is provided, pass it to native code; otherwise, fallback toRequestType.common
.[entity.dart]
[PMManager.m]
[main.dart]
type
parameter togetAssetListPaged()
for testing the new feature.[pubspec.yaml]