feat: Fetch assets by specific type within an album
Background & Need
- The GitHub issue ”[Filter Resource By Type] How to use
RequestTypeto filter inside a specific album? #1257” confirms the lack of this feature. - Currently, developers can specify a
RequestTypeglobally, but not when fetching assets from a specific album.
Proposed Enhancement:
- Add an optional
RequestType?requestTypeparameter to album-scoped methods likegetAssetListPaged. - If
requestTypeis provided, pass it to native code; otherwise, fallback toRequestType.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
typeparameter togetAssetListPaged()for testing the new feature.
[pubspec.yaml]
- Bump build number.
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.
I was not able to push to your PR branch, so please make modifications and confirm if they are working properly.
I also initially updated only the Dart side, but on iOS it was not working without changes at Darwin (tested on iPhone 17 pro, iOS 18.6). No native changes were required on Android.
Aside from using a hardcoded type (I was not aware of utils to convert numbers into native enums), the code works correctly.
@AlexV525 we tested it in production with Presence Messenger https://apps.apple.com/app/presence-messenger/id6504456930
Here's a video showcasing the feature - user taps the video icon to fetch video-only media within a specific album.
https://github.com/user-attachments/assets/67307048-8c18-4f2f-ba75-976b487031a2
Since the code change is small, I think you could merge it and then replace the hardcoded enums afterward.