diff --git a/CHANGELOG.md b/CHANGELOG.md index e0f0a6a7dc..8f0148021b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Changed ### Fixed +- Display the toast after successful key import. diff --git a/src/renderer/components/dialogs/Settings-ManageKeys.tsx b/src/renderer/components/dialogs/Settings-ManageKeys.tsx index 78ff0026a0..a6b3deb04a 100644 --- a/src/renderer/components/dialogs/Settings-ManageKeys.tsx +++ b/src/renderer/components/dialogs/Settings-ManageKeys.tsx @@ -5,7 +5,6 @@ import type { OpenDialogOptions } from 'electron' import { runtime } from '../../runtime' import { BackendRemote } from '../../backend-com' import { selectedAccountId } from '../../ScreenController' -import { DcEventType } from '@deltachat/jsonrpc-client' async function onKeysImport() { const tx = window.static_translate @@ -25,24 +24,17 @@ async function onKeysImport() { message: tx('pref_managekeys_import_explain', filename), confirmLabel: tx('yes'), cancelLabel: tx('no'), - cb: (yes: boolean) => { + cb: async (yes: boolean) => { if (!yes) { return } const text = tx('pref_managekeys_secret_keys_imported_from_x', filename) - const onImexProgress = ({ progress }: DcEventType<'ImexProgress'>) => { - if (progress !== 1000) { - return - } - window.__userFeedback({ type: 'success', text }) - } - const emitter = BackendRemote.getContextEvents(selectedAccountId()) - emitter.on('ImexProgress', onImexProgress) - BackendRemote.rpc - .importSelfKeys(selectedAccountId(), filename, null) - .finally(() => { - emitter.off('ImexProgress', onImexProgress) - }) + await BackendRemote.rpc.importSelfKeys( + selectedAccountId(), + filename, + null + ) + window.__userFeedback({ type: 'success', text }) }, }) }