diff --git a/lib/entity/file/data_source.dart b/lib/entity/file/data_source.dart index d49fd7e2..83bffcf2 100644 --- a/lib/entity/file/data_source.dart +++ b/lib/entity/file/data_source.dart @@ -428,7 +428,7 @@ class FileCachedDataSource implements FileDataSource { await _cacheResult(account, f, remote); if (shouldCheckCache) { // update our local touch token to match the remote one - final tokenManager = TouchTokenManager(); + const tokenManager = TouchTokenManager(); try { await tokenManager.setLocalToken( account, f, cacheManager.remoteTouchToken); @@ -500,7 +500,7 @@ class FileCachedDataSource implements FileDataSource { // generate a new random token final token = const Uuid().v4().replaceAll("-", ""); - final tokenManager = TouchTokenManager(); + const tokenManager = TouchTokenManager(); final dir = File(path: path.dirname(f.path)); await tokenManager.setLocalToken(account, dir, token); final fileRepo = FileRepo(this); @@ -739,7 +739,7 @@ class _CacheManager { final touchPath = "${remote_storage_util.getRemoteTouchDir(account)}/${f.strippedPath}"; final fileRepo = FileRepo(FileCachedDataSource(appDb)); - final tokenManager = TouchTokenManager(); + const tokenManager = TouchTokenManager(); String? remoteToken; try { remoteToken = await tokenManager.getRemoteToken(fileRepo, account, f); diff --git a/lib/touch_token_manager.dart b/lib/touch_token_manager.dart index 689a6722..20823eb3 100644 --- a/lib/touch_token_manager.dart +++ b/lib/touch_token_manager.dart @@ -22,6 +22,8 @@ import 'package:nc_photos/use_case/remove.dart'; /// token requires downloading a file from the server so you may want to avoid /// doing it on every query class TouchTokenManager { + const TouchTokenManager(); + Future setRemoteToken( FileRepo fileRepo, Account account, File file, String? token) async { _log.info(