mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-02 06:46:22 +01:00
Refactor: relocate function
This commit is contained in:
parent
92bfaaa639
commit
cd3476f9e8
3 changed files with 6 additions and 4 deletions
|
@ -6,6 +6,7 @@ import 'package:nc_photos/app_db.dart';
|
|||
import 'package:nc_photos/entity/album.dart';
|
||||
import 'package:nc_photos/entity/file.dart';
|
||||
import 'package:nc_photos/entity/file/data_source.dart';
|
||||
import 'package:nc_photos/entity/file_util.dart' as file_util;
|
||||
import 'package:nc_photos/entity/share.dart';
|
||||
import 'package:nc_photos/entity/share/data_source.dart';
|
||||
import 'package:nc_photos/event/event.dart';
|
||||
|
@ -193,7 +194,7 @@ class ListAlbumBloc extends Bloc<ListAlbumBlocEvent, ListAlbumBlocState> {
|
|||
// no data in this bloc, ignore
|
||||
return;
|
||||
}
|
||||
if (isAlbumFile(ev.account, ev.file)) {
|
||||
if (file_util.isAlbumFile(ev.account, ev.file)) {
|
||||
_refreshThrottler.trigger(
|
||||
maxResponceTime: const Duration(seconds: 3),
|
||||
maxPendingCount: 10,
|
||||
|
|
|
@ -26,9 +26,6 @@ import 'package:nc_photos/use_case/put_file_binary.dart';
|
|||
import 'package:quiver/iterables.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
bool isAlbumFile(Account account, File file) =>
|
||||
file.path.startsWith(remote_storage_util.getRemoteAlbumsDir(account));
|
||||
|
||||
/// Immutable object that represents an album
|
||||
class Album with EquatableMixin {
|
||||
Album({
|
||||
|
|
|
@ -2,6 +2,7 @@ import 'package:nc_photos/account.dart';
|
|||
import 'package:nc_photos/api/api_util.dart' as api_util;
|
||||
import 'package:nc_photos/entity/file.dart';
|
||||
import 'package:nc_photos/platform/k.dart' as platform_k;
|
||||
import 'package:nc_photos/remote_storage_util.dart' as remote_storage_util;
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
bool isSupportedMime(String mime) => _supportedFormatMimes.contains(mime);
|
||||
|
@ -20,6 +21,9 @@ bool isMetadataSupportedFormat(File file) =>
|
|||
bool isTrash(Account account, File file) =>
|
||||
file.path.startsWith(api_util.getTrashbinPath(account));
|
||||
|
||||
bool isAlbumFile(Account account, File file) =>
|
||||
file.path.startsWith(remote_storage_util.getRemoteAlbumsDir(account));
|
||||
|
||||
/// For a path "remote.php/dav/files/foo/bar.jpg", return foo
|
||||
String getUserDirName(File file) {
|
||||
if (file.path.startsWith("remote.php/dav/files/")) {
|
||||
|
|
Loading…
Reference in a new issue