Skip to content
This repository has been archived by the owner on Feb 26, 2021. It is now read-only.

Commit

Permalink
Delete open intent and update show itent with "open" command.
Browse files Browse the repository at this point in the history
  • Loading branch information
maitrella committed Jan 16, 2020
1 parent ce3f7c7 commit 6afa143
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
25 changes: 1 addition & 24 deletions extension/intents/saving/saving.js
Expand Up @@ -37,7 +37,7 @@ this.intents.saving = (function() {
description: "Shows the last downloaded file in its containing folder",
examples: ["Show download"],
match: `
(show | view | find) (download | file)
(show | view | find | open) (download | file)
`,
async run(context) {
const downloadItems = await browser.downloads.search({
Expand All @@ -55,29 +55,6 @@ this.intents.saving = (function() {
},
});

this.intentRunner.registerIntent({
name: "saving.openLastDownload",
description: "Opens the last downloaded file",
examples: ["Open download"],
match: `
(open | launch) (download | file)
`,
async run(context) {
const downloadItems = await browser.downloads.search({
limit: 1,
orderBy: ["-startTime"],
});
if (downloadItems.length > 0) {
const lastestDownloadId = downloadItems[0].id;
await browser.downloads.open(lastestDownloadId);
} else {
const e = new Error("No downloaded items found:");
e.displayMessage = "No downloaded items found";
throw e;
}
},
});

async function downloadData(body, contentType, filename) {
if (contentType !== "image/png" && contentType !== "image/jpeg") {
contentType = "image/png";
Expand Down
1 change: 0 additions & 1 deletion extension/manifest.json.ejs
Expand Up @@ -75,7 +75,6 @@
"clipboardWrite",
"bookmarks",
"downloads",
"downloads.open",
"browserSettings",
"search",
"tabHide"
Expand Down

0 comments on commit 6afa143

Please sign in to comment.