-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an option to toggle speaker on press #403
Conversation
Warning Rate limit exceeded@neilenns has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 19 minutes and 28 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (2)
WalkthroughThis pull request introduces new functionality for managing station audio settings in a Stream Deck plugin. The changes add two new checkbox options for toggling speaker behavior on press and long press actions. The implementation includes updates to the HTML configuration, TypeScript interfaces, and controller methods to support these new toggle features. Additionally, a new word has been added to the spell checker configuration. The changes enhance user control over audio interactions by providing more granular options for managing station audio states. Changes
Possibly related PRs
Suggested Labels
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Build for this pull request: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
src/events/streamDeck/stationStatus/stationStatusShortPress.ts (1)
35-35
: Consider enhancing the comment clarity.The comment could be more descriptive about the fallback behavior.
- // If mute or speaker isn't set then toggle listenTo. + // Fallback: If neither mute nor speaker toggle is enabled, toggle the listenTo state.src/controllers/stationStatus.ts (2)
548-601
: Consider applying DRY principles to toggle methods.The three toggle methods share similar message structure and could potentially be refactored to reduce code duplication.
Consider creating a helper method to handle the common message structure:
private sendToggleMessage(toggleType: 'mute' | 'speaker' | 'listenTo', value?: string) { const message = { type: "kSetStationState", value: { frequency: this.frequency, isOutputMuted: toggleType === 'mute' ? 'toggle' : undefined, headset: toggleType === 'speaker' ? 'toggle' : undefined, rx: toggleType === 'listenTo' && this.listenTo === 'rx' ? 'toggle' : undefined, tx: toggleType === 'listenTo' && this.listenTo === 'tx' ? 'toggle' : undefined, xc: toggleType === 'listenTo' && this.listenTo === 'xc' ? 'toggle' : undefined, xca: toggleType === 'listenTo' && this.listenTo === 'xca' ? 'toggle' : undefined, }, }; trackAudioManager.sendMessage(message); }This would allow simplifying the toggle methods:
public toggleMute() { this.sendToggleMessage('mute'); } public toggleSpeaker() { this.sendToggleMessage('speaker'); } public toggleListenTo() { this.sendToggleMessage('listenTo'); }
549-551
: Maintain consistent documentation style.The new methods use XML-style comments (
///
) while the rest of the codebase uses JSDoc style (/**
). Consider maintaining consistency.- /// <summary> - /// Toggles the mute state of the station. - /// </summary> + /** + * Toggles the mute state of the station. + */Also applies to: 567-569, 585-587
com.neil-enns.trackaudio.sdPlugin/pi/stationStatus.html (1)
57-70
: Consider specifying default values for the new toggles.Unlike some other checkboxes in the file (e.g.,
showTitle
), these new toggles don't specify default values. Consider addingdefault="false"
to maintain consistent behavior across all instances.<sdpi-checkbox setting="toggleSpeakerOnPress" label="Toggle speaker on press" + default="false" ></sdpi-checkbox> <sdpi-checkbox setting="toggleSpeakerOnLongPress" label="Toggle speaker on long press" + default="false" ></sdpi-checkbox>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
.vscode/settings.json
(1 hunks)com.neil-enns.trackaudio.sdPlugin/pi/stationStatus.html
(1 hunks)src/actions/stationStatus.ts
(1 hunks)src/controllers/stationStatus.ts
(2 hunks)src/events/streamDeck/stationStatus/stationStatusLongPress.ts
(1 hunks)src/events/streamDeck/stationStatus/stationStatusShortPress.ts
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- .vscode/settings.json
🔇 Additional comments (6)
src/events/streamDeck/stationStatus/stationStatusShortPress.ts (1)
30-33
: LGTM! Clean implementation of speaker toggle.The speaker toggle implementation follows a clear order of operations with early returns to prevent multiple actions from executing.
src/events/streamDeck/stationStatus/stationStatusLongPress.ts (1)
26-29
: LGTM! Consistent implementation with short press handler.The long press implementation maintains consistency with the short press handler, following the same patterns and structure.
src/actions/stationStatus.ts (1)
107-108
: LGTM! Well-structured interface additions.The new settings properties follow existing naming conventions and are properly typed as optional booleans.
src/controllers/stationStatus.ts (1)
256-270
: LGTM! Well-documented getter methods.The new getter methods follow existing patterns and include proper JSDoc documentation.
com.neil-enns.trackaudio.sdPlugin/pi/stationStatus.html (2)
57-70
: LGTM! The implementation follows existing patterns.The new checkbox elements are well-structured and consistently implemented, following the same pattern as the existing mute toggles.
57-70
: Verify interaction with auto speaker mode.These new toggle options might interact with the existing "Automatically enable speaker mode" setting in advanced options. Please verify that these settings work together as intended and don't create conflicting behaviors.
✅ Verification successful
No conflicts found between auto speaker mode and toggle features
The implementation shows these features work independently and complement each other:
- Auto speaker mode sets initial state on connection
- Toggle features provide manual override capability regardless of initial state
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for speaker-related logic in the codebase rg -l "autoSetSpk|toggleSpeaker" --type tsLength of output: 254
Script:
#!/bin/bash # Search for auto speaker mode implementation and toggle speaker logic rg -A 10 "autoSetSpk|toggleSpeaker" --type tsLength of output: 6776
Build for this pull request: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/controllers/stationStatus.ts (1)
548-565
: LGTM! Consider adding documentation about the speaker/headset relationship.The
toggleMute
andtoggleSpeaker
methods are well-implemented, following a consistent pattern of explicitly setting undefined for unaffected states. However, it would be helpful to document why the speaker state is controlled via the "headset" property.Add a comment explaining the relationship:
/** * Toggles the speaker state of the station. + * @remarks The speaker state is controlled via the "headset" property in the TrackAudio protocol. */ public toggleSpeaker() {
Also applies to: 567-583
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/controllers/stationStatus.ts
(2 hunks)
🔇 Additional comments (3)
src/controllers/stationStatus.ts (3)
256-270
: LGTM! Well-implemented getter methods.The new getter methods for speaker toggle settings follow the established patterns in the codebase, with proper TypeScript syntax, consistent naming, and appropriate default values.
585-601
: LGTM! Well-implemented toggle logic.The
toggleListenTo
method correctly handles the conditional toggling of different listen states based on the currentlistenTo
value.
548-604
: LGTM! Well-organized code structure.The new methods are properly organized in a dedicated "Websocket messages" region and integrate well with the existing codebase, maintaining clean separation of concerns.
Build for this pull request: |
Fixes #402
Summary by CodeRabbit
Release Notes
New Features
Improvements
User Interface
Spell Checker