Skip to content

Commit

Permalink
Fixed setting volume bug. Bumped version to 1.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mattop4d committed Feb 23, 2022
1 parent aaabca8 commit 08e3e95
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 21 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down Expand Up @@ -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",
Expand Down
40 changes: 21 additions & 19 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
}

Expand Down

0 comments on commit 08e3e95

Please sign in to comment.