Merge pull request #816 from ente-io/clear_cache_on_logout

Clear the cache of upload URLs once the user logs out
This commit is contained in:
Vishnu Mohandas 2023-01-24 22:20:53 +05:30 committed by GitHub
commit 118f29e4f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -30,6 +30,7 @@ import 'package:photos/services/memories_service.dart';
import 'package:photos/services/search_service.dart';
import 'package:photos/services/sync_service.dart';
import 'package:photos/utils/crypto_util.dart';
import 'package:photos/utils/file_uploader.dart';
import 'package:photos/utils/validator_util.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:uuid/uuid.dart';
@ -162,6 +163,7 @@ class Configuration {
await UploadLocksDB.instance.clearTable();
await IgnoredFilesService.instance.reset();
await TrashDB.instance.clearTable();
FileUploader.instance.clearCachedUploadURLs();
if (!autoLogout) {
CollectionsService.instance.clearCache();
FavoritesService.instance.clearCache();

View file

@ -176,6 +176,10 @@ class FileUploader {
_totalCountInUploadSession = 0;
}
void clearCachedUploadURLs() {
_uploadURLs.clear();
}
void removeFromQueueWhere(final bool Function(File) fn, final Error reason) {
final List<String> uploadsToBeRemoved = [];
_queue.entries