diff --git a/packages/node-mimimi/src/importer_api.rs b/packages/node-mimimi/src/importer_api.rs index e66a931f906..8c742a53c94 100644 --- a/packages/node-mimimi/src/importer_api.rs +++ b/packages/node-mimimi/src/importer_api.rs @@ -231,7 +231,6 @@ impl ImporterApi { match locked_local_state { Some(local_import_state) => { - let logged_in_sdk = ImporterApi::create_sdk(tuta_credentials).await?; let mut local_import_state = local_import_state.lock().await; local_import_state.import_progress_action = import_progress_action; @@ -240,6 +239,7 @@ impl ImporterApi { ImportProgressAction::Pause => { local_import_state.current_status = ImportStatus::Paused; + let logged_in_sdk = ImporterApi::create_sdk(tuta_credentials).await?; Importer::mark_remote_final_state(&logged_in_sdk, &local_import_state) .await?; @@ -249,6 +249,7 @@ impl ImporterApi { ImportProgressAction::Stop => { let previous_status = local_import_state.current_status; local_import_state.current_status = ImportStatus::Canceled; + let logged_in_sdk = ImporterApi::create_sdk(tuta_credentials).await?; Importer::mark_remote_final_state(&logged_in_sdk, &local_import_state) .await?; diff --git a/src/common/desktop/mailimport/DesktopMailImportFacade.ts b/src/common/desktop/mailimport/DesktopMailImportFacade.ts index 25c809df46f..8506a347087 100644 --- a/src/common/desktop/mailimport/DesktopMailImportFacade.ts +++ b/src/common/desktop/mailimport/DesktopMailImportFacade.ts @@ -64,7 +64,7 @@ export class DesktopMailImportFacade implements NativeMailImportFacade { } async setProgressAction(mailboxId: string, apiUrl: string, unencTutaCredentials: UnencryptedCredentials, progressAction: number) { - return ImporterApi.setProgressAction(mailboxId, this.createTutaCredentials(unencTutaCredentials, apiUrl), progressAction, this.configDirectory) + return await ImporterApi.setProgressAction(mailboxId, this.createTutaCredentials(unencTutaCredentials, apiUrl), progressAction, this.configDirectory) } async getResumeableImport(mailboxId: string): Promise { @@ -80,16 +80,7 @@ export class DesktopMailImportFacade implements NativeMailImportFacade { listId: listIdPart(importStateId), elementId: elementIdPart(importStateId), } - const tutaCredentials: TutaCredentials = { - accessToken: unencTutaCredentials?.accessToken, - isInternalCredential: unencTutaCredentials.credentialInfo.type === CredentialType.Internal, - encryptedPassphraseKey: unencTutaCredentials.encryptedPassphraseKey ? Array.from(unencTutaCredentials.encryptedPassphraseKey) : [], - login: unencTutaCredentials.credentialInfo.login, - userId: unencTutaCredentials.credentialInfo.userId, - apiUrl: apiUrl, - clientVersion: env.versionNumber, - } - + const tutaCredentials = this.createTutaCredentials(unencTutaCredentials, apiUrl) await ImporterApi.resumeFileImport(mailboxId, tutaCredentials, importMailStateId, this.configDirectory) } }