Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: save "Path to store imported files" preference from import page #1063

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions add-on/src/popup/quick-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down Expand Up @@ -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)
Expand Down