Skip to content

Commit

Permalink
fix(airpods-noise-control): main function fixed and 'off' mode added (r…
Browse files Browse the repository at this point in the history
  • Loading branch information
iamyeizi authored Feb 7, 2024
1 parent a103c16 commit 9c83112
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 20 deletions.
4 changes: 4 additions & 0 deletions extensions/airpods-noise-control/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# AirPods Noise Control Changelog

## [Improvements] - 2024-01-03
- Added `Off` Mode
- Main function fixed

## [New Additions] - 2023-11-28

- Added adaptive option in noise control
Expand Down
32 changes: 20 additions & 12 deletions extensions/airpods-noise-control/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://www.raycast.com/schemas/extension.json",
"name": "airpods-noise-control",
"title": "AirPods Noise Control",
"description": "Switch between Noise Cancellation, Transparency or Adaptive on your AirPods. Toggle Conversation Awareness on AirPods that support it.",
"description": "Switch between Off, Transparency, Adaptive or Noise Cancellation on your AirPods. Toggle Conversation Awareness on AirPods that support it.",
"icon": "extension_icon.png",
"author": "chrahe",
"contributors": [
Expand All @@ -17,8 +17,8 @@
{
"name": "index",
"title": "Switch Noise Control Mode",
"subtitle": "Transparency ↔ Adaptive ↔ Noise Cancellation",
"description": "This command will switch Noise Cancellation, Transparency or Adaptive if AirPods are connected to your device.",
"subtitle": "Off ↔ Transparency ↔ Adaptive ↔ Noise Cancellation",
"description": "This command will switch Off, Transparency, Adaptive or Noise Cancellation if AirPods are connected to your device.",
"mode": "no-view",
"keywords": [
"airpods",
Expand All @@ -30,24 +30,28 @@
"adaptive"
],
"preferences": [
{
{
"name": "optionOne",
"title": "Option One 🔵",
"description": "First option to switch between.",
"type": "dropdown",
"default": "Noise Cancellation",
"data": [
{
"title": "Noise Cancellation",
"value": "Noise Cancellation"
"title": "Off",
"value": "Off"
},
{
"title": "Transparency",
"value": "Transparency"
},
{
"title": "Adaptive",
"title": "Adaptive (only if you have)",
"value": "Adaptive"
},
{
"title": "Noise Cancellation",
"value": "Noise Cancellation"
}
],
"required": true
Expand All @@ -60,16 +64,20 @@
"default": "Transparency",
"data": [
{
"title": "Noise Cancellation",
"value": "Noise Cancellation"
"title": "Off",
"value": "Off"
},
{
"title": "Transparency",
"value": "Transparency"
},
{
"title": "Adaptive",
"title": "Adaptive (only if you have)",
"value": "Adaptive"
},
{
"title": "Noise Cancellation",
"value": "Noise Cancellation"
}
],
"required": true
Expand Down Expand Up @@ -142,7 +150,7 @@
"@raycast/utils": "^1.10.1"
},
"devDependencies": {
"@raycast/eslint-config": "^1.0.8",
"@raycast/eslint-config": "^1.0.8",
"@types/node": "18.8.3",
"@types/react": "18.0.9",
"eslint": "^8.54.0",
Expand All @@ -156,4 +164,4 @@
"lint": "ray lint",
"publish": "ray publish"
}
}
}
22 changes: 14 additions & 8 deletions extensions/airpods-noise-control/src/airpods-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,29 @@ export async function execAirPodsMenu(
set AirPodsIndex to ${airpodsIndex}
set ToggleOption to "${toggleOption}"
on getOptionIndex(Option)
if Option is equal to "Transparency"
set OptionIndex to 2
else if Option is equal to "Adaptive"
on getOptionIndex(Opt1, Opt2)
if Opt1 is equal to "Off" then
set OptionIndex to 1
else if Opt1 is equal to "Transparency" then
set OptionIndex to 2
else if Opt1 is equal to "Adaptive" or Opt2 is equal to "Adaptive" then
if Opt1 is equal to "Adaptive" then
set OptionIndex to 3
else
else if Opt1 is equal to "Noise Cancellation" then
set OptionIndex to 4
end if
return OptionIndex
else if Opt1 is equal to "Noise Cancellation" then
set OptionIndex to 3
end if
return OptionIndex
end getOptionIndex
if ToggleOption is "noise-control"
set OptionOne to "${optionOne}"
set OptionTwo to "${optionTwo}"
set IndexOne to AirPodsIndex + getOptionIndex(OptionOne)
set IndexTwo to AirPodsIndex + getOptionIndex(OptionTwo)
set IndexOne to AirPodsIndex + getOptionIndex(OptionOne, OptionTwo)
set IndexTwo to AirPodsIndex + getOptionIndex(OptionTwo, OptionOne)
else
set OptionOne to "Off"
set OptionTwo to "On"
Expand Down

0 comments on commit 9c83112

Please sign in to comment.