π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
reset download manager on logout
Abhinav97ce52a72874
diff --git a/apps/photos/src/services/download/index.ts b/apps/photos/src/services/download/index.tsindex 2bb1bc6bdf..181d7e290e 100644--- a/apps/photos/src/services/download/index.ts+++ b/apps/photos/src/services/download/index.ts@@ -19,6 +19,7 @@ import { PhotosDownloadClient } from './clients/photos';import { PublicAlbumsDownloadClient } from './clients/publicAlbums';import isElectron from 'is-electron';import { isInternalUser } from 'utils/user';+import { Events, eventBus } from '@ente/shared/events';export type LivePhotoSourceURL = {image: () => Promise<string>;@@ -89,12 +90,29 @@ class DownloadManagerImpl {this.diskFileCache = isElectron() && (await openDiskFileCache());this.cryptoWorker = await ComlinkCryptoWorker.getInstance();this.ready = true;+ eventBus.on(Events.LOGOUT, this.logoutHandler.bind(this), this);} catch (e) {logError(e, 'DownloadManager init failed');throw e;}}+ private async logoutHandler() {+ try {+ addLogLine('downloadManger logoutHandler started');+ this.ready = false;+ this.cryptoWorker = null;+ this.fileObjectURLPromises.clear();+ this.fileConversionPromises.clear();+ this.thumbnailObjectURLPromises.clear();+ this.fileDownloadProgress.clear();+ this.progressUpdater = () => {};+ addLogLine('downloadManager logoutHandler completed');+ } catch (e) {+ logError(e, 'downloadManager logoutHandler failed');+ }+ }+updateToken(token: string, passwordToken?: string) {this.downloadClient.updateTokens(token, passwordToken);}