Skip to content
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

Fix the issue where album assets cannot be retrieved when selecting only and video or only and image conditions #1229

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions ohos/src/main/ets/components/plugin/handlers/AlbumHandler.ets
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,18 @@ export class AlbumHandler extends HandlerBase implements MethodCallHandlerBase {
if (!(await PermissionHandler.permissionReadCheck())) {
return [];
}
if (onlyAll) {
return [await AlbumHandler.getAllAlbum(RequestType.all)];
}

let requestType: RequestType = new RequestType(args.get('type'));

if (!(requestType.containsImage() && requestType.containsVideo())) {
if (requestType.containsImage()) {
return [await AlbumHandler.getAllAlbum(RequestType.image)];
}
else if (requestType.containsVideo()) {
return [await AlbumHandler.getAllAlbum(RequestType.video)];
if (onlyAll || !(requestType.containsImage() && requestType.containsVideo())) {
if (!(requestType.containsImage() && requestType.containsVideo())) {
if (requestType.containsImage()) {
return [await AlbumHandler.getAllAlbum(RequestType.image)];
} else if (requestType.containsVideo()) {
return [await AlbumHandler.getAllAlbum(RequestType.video)];
}
} else {
return [await AlbumHandler.getAllAlbum(RequestType.all)];
}
}

// hasAll 返回的列表里有一个代表所有的相册
// onlyAll 只返回这个代表所有的相册
// 在鸿蒙这边 这个相册 应该是 从 system 这个类型里面获取到的相册的集合
Expand Down