From 08e3e950ebb29a2bcd3d8ad0a48b2b92d5a48d32 Mon Sep 17 00:00:00 2001 From: Matias Godoy Date: Wed, 23 Feb 2022 11:02:59 +0100 Subject: [PATCH] Fixed setting volume bug. Bumped version to 1.4.3 --- README.md | 5 +++++ package.json | 5 +++-- src/extension.ts | 40 +++++++++++++++++++++------------------- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index d71486e..b893f0e 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,11 @@ Any pull request is welcome. ## Release Notes +### 1.4.3 + +- Fixed bug in which manually setting the volume went always to minimum or maximum. +- Redacted some of the messages. + ### 1.4.2 - Minor fixes diff --git a/package.json b/package.json index 641ac5f..17709f0 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "publisher": "mattogodoy", "displayName": "Hacker Sounds", "description": "This extension automatically turns you into a very skilled hacker by playing movie-like sounds while you write code.", - "version": "1.4.2", + "version": "1.4.3", "engines": { "vscode": "^1.40.0" }, @@ -58,7 +58,8 @@ "esbuild-base": "esbuild ./src/extension.js --bundle --outfile=out/extension.js --external:vscode --format=cjs --platform=node", "esbuild": "npm run -S esbuild-base -- --sourcemap", "esbuild-watch": "npm run -S esbuild-base -- --sourcemap --watch", - "test-compile": "tsc -p ./" + "test-compile": "tsc -p ./", + "watch": "tsc -watch -p ./" }, "devDependencies": { "@types/glob": "^7.1.1", diff --git a/src/extension.ts b/src/extension.ts index 5ecf47b..8dfb016 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -143,22 +143,23 @@ export function activate(context: vscode.ExtensionContext) { vscode.commands.registerCommand('hacker_sounds.setVolume', async () => { let input = await vscode.window.showInputBox() let newVol = toInteger(input); + switch (process.platform) { case 'darwin': if (newVol > 10) { - vscode.window.showInformationMessage("Volume has been increased to 10 which is the maximum volume") + vscode.window.showInformationMessage("Volume increased to maximum") config.macVol = 10; - } - else if (newVol < 10) { - vscode.window.showInformationMessage("Volume has been decreased to 1 which is the minimum volume") + } else if (newVol < 1) { + vscode.window.showInformationMessage("Volume decreased to minimum") config.macVol = 1 } else { if (config.macVol < newVol) - vscode.window.showInformationMessage("Volume has been increased to " + newVol) + vscode.window.showInformationMessage("Volume increased to " + newVol) else if (config.macVol > newVol) - vscode.window.showInformationMessage("Volume has been decreased to " + newVol) + vscode.window.showInformationMessage("Volume decreased to " + newVol) else - vscode.window.showWarningMessage("Volume is always at " + newVol); + vscode.window.showWarningMessage("Volume already at " + newVol); + config.macVol = newVol; } @@ -167,19 +168,20 @@ export function activate(context: vscode.ExtensionContext) { case 'win32': if (newVol > 100) { - vscode.window.showInformationMessage("Volume has been increased to 100 which is the maximum volume") + vscode.window.showInformationMessage("Volume increased to maximum") config.winVol = 100; } else if (newVol < 10) { - vscode.window.showInformationMessage("Volume has been decreased to 10 which is the minimum volume") + vscode.window.showInformationMessage("Volume decreased to minimum") config.winVol = 10 } else { if (config.winVol < newVol) - vscode.window.showInformationMessage("Volume has been increased to " + newVol) + vscode.window.showInformationMessage("Volume increased to " + newVol) else if (config.winVol > newVol) - vscode.window.showInformationMessage("Volume has been decreased to " + newVol) + vscode.window.showInformationMessage("Volume decreased to " + newVol) else - vscode.window.showWarningMessage("Volume is always at " + newVol); + vscode.window.showWarningMessage("Volume already at " + newVol); + config.winVol = newVol; } @@ -188,19 +190,19 @@ export function activate(context: vscode.ExtensionContext) { case 'linux': if (newVol > 10) { - vscode.window.showInformationMessage("Volume has been increased to 10 which is the maximum volume") + vscode.window.showInformationMessage("Volume increased to maximum") config.linuxVol = 10; - } - else if (newVol < 1) { - vscode.window.showInformationMessage("Volume has been decreased to 1 which is the minimum volume") + } else if (newVol < 1) { + vscode.window.showInformationMessage("Volume decreased to minimum") config.linuxVol = 1 } else { if (config.linuxVol < newVol) - vscode.window.showInformationMessage("Volume has been increased to " + newVol) + vscode.window.showInformationMessage("Volume increased to " + newVol) else if (config.linuxVol > newVol) - vscode.window.showInformationMessage("Volume has been decreased to " + newVol) + vscode.window.showInformationMessage("Volume decreased to " + newVol) else - vscode.window.showWarningMessage("Volume is always at " + newVol); + vscode.window.showWarningMessage("Volume already at " + newVol); + config.linuxVol = newVol; }