chore: prevent shortcuts from invoking recording when in shortcut recording state

This commit is contained in:
haritabh-z01 2025-07-06 14:49:55 +05:30
parent fd7f4bff49
commit 3f8ea518f6
5 changed files with 60 additions and 2 deletions

View file

@ -26,6 +26,7 @@ export class ShortcutManager extends EventEmitter {
};
private settingsService: SettingsService;
private swiftIOBridge: SwiftIOBridge | null = null;
private isRecordingShortcut: boolean = false;
constructor(settingsService: SettingsService) {
super();
@ -52,6 +53,11 @@ export class ShortcutManager extends EventEmitter {
await this.loadShortcuts();
}
setIsRecordingShortcut(isRecording: boolean) {
this.isRecordingShortcut = isRecording;
log.info("Shortcut recording state changed", { isRecording });
}
private setupEventListeners() {
if (!this.swiftIOBridge) {
log.warn("SwiftIOBridge not available, shortcuts will not work");
@ -139,6 +145,11 @@ export class ShortcutManager extends EventEmitter {
}
private checkShortcuts() {
// Skip shortcut detection when recording shortcuts
if (this.isRecordingShortcut) {
return;
}
// Check PTT shortcut
const isPTTPressed = this.isPTTShortcutPressed();
this.emit("ptt-state-changed", isPTTPressed);