mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-22 16:56:19 +01:00
Use const whenever possible
This commit is contained in:
parent
2dcfe4a261
commit
2f4adeafa5
2 changed files with 5 additions and 3 deletions
|
@ -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);
|
||||
|
|
|
@ -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<void> setRemoteToken(
|
||||
FileRepo fileRepo, Account account, File file, String? token) async {
|
||||
_log.info(
|
||||
|
|
Loading…
Reference in a new issue