From 251e183d1d36fde0d5fb3789718d9ecf85983846 Mon Sep 17 00:00:00 2001 From: Carson Y Date: Tue, 27 Sep 2022 05:57:46 +0800 Subject: [PATCH] feat: remember path set on import page (#1063) --- add-on/src/popup/quick-import.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/add-on/src/popup/quick-import.js b/add-on/src/popup/quick-import.js index f152bc3d0..bde895ef0 100644 --- a/add-on/src/popup/quick-import.js +++ b/add-on/src/popup/quick-import.js @@ -61,6 +61,11 @@ function quickImportStore (state, emitter) { emitter.on('fileInputChange', event => processFiles(state, emitter, event.target.files)) + // update companion preference + emitter.on('optionChange', ({ key, value }) => { + browser.storage.local.set({ [key]: value }) + }) + // drag & drop anywhere drop(document.body, files => processFiles(state, emitter, files)) } @@ -138,6 +143,10 @@ async function processFiles (state, emitter, files) { copyShareLink(results) preloadFilesAtPublicGateway(results) + // update preferred import dir if user specified one while importing + if (state.userChangedImportDir) { + emitter.emit('optionChange', { key: 'importDir', value: state.importDir }) + } // present result to the user using the beast available way if (!state.openViaWebUI || state.ipfsNodeType.startsWith('embedded')) { await openFilesAtGateway(importDir)