From 1a328b2a6dae0fb5ba94ee479912d00f144d7b9b Mon Sep 17 00:00:00 2001 From: Ming Ming Date: Mon, 7 Feb 2022 20:50:52 +0800 Subject: [PATCH] Refactor: rename fn argument --- lib/entity/file.dart | 4 ++-- lib/entity/file/data_source.dart | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/entity/file.dart b/lib/entity/file.dart index 491f1f83..340bfb2f 100644 --- a/lib/entity/file.dart +++ b/lib/entity/file.dart @@ -609,8 +609,8 @@ class FileRepo { } abstract class FileDataSource { - /// List all files under [f] - Future> list(Account account, File f); + /// List all files under [dir] + Future> list(Account account, File dir); /// List a single file [f] Future listSingle(Account account, File f); diff --git a/lib/entity/file/data_source.dart b/lib/entity/file/data_source.dart index 9b9efc3d..05cd8f3b 100644 --- a/lib/entity/file/data_source.dart +++ b/lib/entity/file/data_source.dart @@ -27,12 +27,12 @@ class FileWebdavDataSource implements FileDataSource { @override list( Account account, - File f, { + File dir, { int? depth, }) async { - _log.fine("[list] ${f.path}"); + _log.fine("[list] ${dir.path}"); final response = await Api(account).files().propfind( - path: f.path, + path: dir.path, depth: depth, getlastmodified: 1, resourcetype: 1, @@ -409,7 +409,7 @@ class FileCachedDataSource implements FileDataSource { }) : _appDbSrc = FileAppDbDataSource(appDb); @override - list(Account account, File f) async { + list(Account account, File dir) async { final cacheManager = _CacheManager( appDb: appDb, appDbSrc: _appDbSrc, @@ -417,21 +417,21 @@ class FileCachedDataSource implements FileDataSource { shouldCheckCache: shouldCheckCache, forwardCacheManager: forwardCacheManager, ); - final cache = await cacheManager.list(account, f); + final cache = await cacheManager.list(account, dir); if (cacheManager.isGood) { return cache!; } // no cache or outdated try { - final remote = await _remoteSrc.list(account, f); - await _cacheResult(account, f, remote); + final remote = await _remoteSrc.list(account, dir); + await _cacheResult(account, dir, remote); if (shouldCheckCache) { // update our local touch token to match the remote one const tokenManager = TouchTokenManager(); try { await tokenManager.setLocalToken( - account, f, cacheManager.remoteTouchToken); + account, dir, cacheManager.remoteTouchToken); } catch (e, stacktrace) { _log.shout("[list] Failed while setLocalToken", e, stacktrace); // ignore error @@ -444,8 +444,8 @@ class FileCachedDataSource implements FileDataSource { return remote; } on ApiException catch (e) { if (e.response.statusCode == 404) { - _log.info("[list] File removed: $f"); - _appDbSrc.remove(account, f); + _log.info("[list] File removed: $dir"); + _appDbSrc.remove(account, dir); return []; } else { rethrow;