From 5dd4c5c9c850de32bf1646b972cef8f52868e515 Mon Sep 17 00:00:00 2001 From: Carson Locke Ross Date: Sat, 26 Feb 2022 17:56:27 +0800 Subject: [PATCH] feat: save "Path to store imported files" preference from import page --- 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)