From c29b1106b5eb242aab8e83dcba0bfb5763fe3b0a Mon Sep 17 00:00:00 2001 From: Ming Ming Date: Mon, 19 Jul 2021 01:22:02 +0800 Subject: [PATCH] Refactoring --- lib/bloc/list_album.dart | 2 +- lib/entity/album.dart | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/bloc/list_album.dart b/lib/bloc/list_album.dart index 10d3ccdc..dc520775 100644 --- a/lib/bloc/list_album.dart +++ b/lib/bloc/list_album.dart @@ -159,7 +159,7 @@ class ListAlbumBloc extends Bloc { // no data in this bloc, ignore return; } - if (isAlbumFile(ev.file)) { + if (isAlbumFile(ev.account, ev.file)) { add(_ListAlbumBlocExternalEvent()); } } diff --git a/lib/entity/album.dart b/lib/entity/album.dart index f3da22e0..22d24c06 100644 --- a/lib/entity/album.dart +++ b/lib/entity/album.dart @@ -21,12 +21,11 @@ import 'package:nc_photos/remote_storage_util.dart' as remote_storage_util; import 'package:nc_photos/use_case/get_file_binary.dart'; import 'package:nc_photos/use_case/ls.dart'; import 'package:nc_photos/use_case/put_file_binary.dart'; -import 'package:path/path.dart' as path; import 'package:quiver/iterables.dart'; import 'package:tuple/tuple.dart'; -bool isAlbumFile(File file) => - path.dirname(file.path).endsWith(".com.nkming.nc_photos/albums"); +bool isAlbumFile(Account account, File file) => + file.path.startsWith(remote_storage_util.getRemoteAlbumsDir(account)); /// Immutable object that represents an album class Album with EquatableMixin {