Skip to content

Commit

Permalink
Clean up code comments and behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
neilenns committed Jan 23, 2025
1 parent c54f881 commit 5779ed8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
12 changes: 8 additions & 4 deletions src/events/streamDeck/stationStatus/stationStatusLongPress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,21 @@ export const handleStationStatusLongPress = (action: KeyAction) => {
// Mute if that's the requested action.
if (foundAction.toggleMuteOnLongPress) {
foundAction.toggleMute();
return;
}

// Speaker if that's the requested action.
if (foundAction.toggleSpeakerOnLongPress) {
foundAction.toggleSpeaker();
return;
}

// If mute or speaker toggle isn't enabled, refresh the station state.
foundAction.reset();
trackAudioManager.refreshStationState(foundAction.callsign);
if (
!foundAction.toggleMuteOnLongPress &&
!foundAction.toggleSpeakerOnLongPress
) {
foundAction.reset();
trackAudioManager.refreshStationState(foundAction.callsign);
}

action.showOk().catch((error: unknown) => {
handleAsyncException("Unable to show OK on station status button:", error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ export const handleStationStatusShortPress = (action: KeyAction) => {
// Mute if that's the requested action.
if (foundAction.toggleMuteOnPress) {
foundAction.toggleMute();
return;
}

// Toggle speaker if that's the requested action.
if (foundAction.toggleSpeakerOnPress) {
foundAction.toggleSpeaker();
return;
}

// If mute or speaker isn't set then toggle listenTo.
foundAction.toggleListenTo();
if (!foundAction.toggleMuteOnPress && !foundAction.toggleSpeakerOnPress) {
foundAction.toggleListenTo();
}
};

0 comments on commit 5779ed8

Please sign in to comment.