Refactoring

This commit is contained in:
Ming Ming 2021-07-19 01:22:02 +08:00
parent 7d078b5a8d
commit c29b1106b5
2 changed files with 3 additions and 4 deletions

View file

@ -159,7 +159,7 @@ class ListAlbumBloc extends Bloc<ListAlbumBlocEvent, ListAlbumBlocState> {
// no data in this bloc, ignore
return;
}
if (isAlbumFile(ev.file)) {
if (isAlbumFile(ev.account, ev.file)) {
add(_ListAlbumBlocExternalEvent());
}
}

View file

@ -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 {