Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mpfau committed Jan 9, 2025
1 parent d632b67 commit c636d43
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
3 changes: 2 additions & 1 deletion packages/node-mimimi/src/importer_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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?;

Expand All @@ -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?;

Expand Down
13 changes: 2 additions & 11 deletions src/common/desktop/mailimport/DesktopMailImportFacade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ResumableImport> {
Expand All @@ -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)
}
}

0 comments on commit c636d43

Please sign in to comment.