Skip to content

Conversation

iosephmagno
Copy link

@iosephmagno iosephmagno commented Aug 14, 2025

Background & Need

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. A change to native code is required only for the iOS platform.

[main.dart]

  • Add type parameter to getAssetListPaged() for testing the new feature.

[pubspec.yaml]

  • Bump build number.

**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.
@iosephmagno
Copy link
Author

A practical example of this in Presence Messenger: the user can tap the video icon on the right side of the MediaPicker to filter videos in the currently selected album.

IMG_4133

page: page,
size: size,
type: type,
type: type ?? RequestType.common, // use album type by default
Copy link
Member

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?

Copy link
Author

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert

Comment on lines +276 to +280
// '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
Copy link
Member

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.

Copy link
Author

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants