mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-03-24 16:04:43 +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);
|
await _cacheResult(account, f, remote);
|
||||||
if (shouldCheckCache) {
|
if (shouldCheckCache) {
|
||||||
// update our local touch token to match the remote one
|
// update our local touch token to match the remote one
|
||||||
final tokenManager = TouchTokenManager();
|
const tokenManager = TouchTokenManager();
|
||||||
try {
|
try {
|
||||||
await tokenManager.setLocalToken(
|
await tokenManager.setLocalToken(
|
||||||
account, f, cacheManager.remoteTouchToken);
|
account, f, cacheManager.remoteTouchToken);
|
||||||
|
@ -500,7 +500,7 @@ class FileCachedDataSource implements FileDataSource {
|
||||||
|
|
||||||
// generate a new random token
|
// generate a new random token
|
||||||
final token = const Uuid().v4().replaceAll("-", "");
|
final token = const Uuid().v4().replaceAll("-", "");
|
||||||
final tokenManager = TouchTokenManager();
|
const tokenManager = TouchTokenManager();
|
||||||
final dir = File(path: path.dirname(f.path));
|
final dir = File(path: path.dirname(f.path));
|
||||||
await tokenManager.setLocalToken(account, dir, token);
|
await tokenManager.setLocalToken(account, dir, token);
|
||||||
final fileRepo = FileRepo(this);
|
final fileRepo = FileRepo(this);
|
||||||
|
@ -739,7 +739,7 @@ class _CacheManager {
|
||||||
final touchPath =
|
final touchPath =
|
||||||
"${remote_storage_util.getRemoteTouchDir(account)}/${f.strippedPath}";
|
"${remote_storage_util.getRemoteTouchDir(account)}/${f.strippedPath}";
|
||||||
final fileRepo = FileRepo(FileCachedDataSource(appDb));
|
final fileRepo = FileRepo(FileCachedDataSource(appDb));
|
||||||
final tokenManager = TouchTokenManager();
|
const tokenManager = TouchTokenManager();
|
||||||
String? remoteToken;
|
String? remoteToken;
|
||||||
try {
|
try {
|
||||||
remoteToken = await tokenManager.getRemoteToken(fileRepo, account, f);
|
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
|
/// token requires downloading a file from the server so you may want to avoid
|
||||||
/// doing it on every query
|
/// doing it on every query
|
||||||
class TouchTokenManager {
|
class TouchTokenManager {
|
||||||
|
const TouchTokenManager();
|
||||||
|
|
||||||
Future<void> setRemoteToken(
|
Future<void> setRemoteToken(
|
||||||
FileRepo fileRepo, Account account, File file, String? token) async {
|
FileRepo fileRepo, Account account, File file, String? token) async {
|
||||||
_log.info(
|
_log.info(
|
||||||
|
|
Loading…
Add table
Reference in a new issue