Skip to content

Commit 381dce2

Browse files
committed
RU-T47 PR#221 fixes
1 parent 9150ddc commit 381dce2

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/components/settings/bluetooth-device-selection-bottom-sheet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function BluetoothDeviceSelectionBottomSheet({ isOpen, onClose }: Bluetoo
3737
const connectionError = useBluetoothAudioStore((s) => s.connectionError);
3838
const [hasScanned, setHasScanned] = useState(false);
3939
const [connectingDeviceId, setConnectingDeviceId] = useState<string | null>(null);
40-
const preferredDeviceDisplayName = preferredDevice?.id === 'system-audio' ? t('bluetooth.system_audio') : preferredDevice?.name;
40+
const preferredDeviceDisplayName = preferredDevice?.id === 'system-audio' ? t('bluetooth.system_audio') : preferredDevice?.name || t('bluetooth.unknown_device');
4141

4242
const startScan = React.useCallback(async () => {
4343
try {

src/services/bluetooth-audio.service.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class BluetoothAudioService {
5151
private monitoringStartedAt: number | null = null;
5252
private monitoringWatchdogInterval: ReturnType<typeof setInterval> | null = null;
5353
private readPollingInterval: ReturnType<typeof setInterval> | null = null;
54+
private isReadPollingInFlight: boolean = false;
5455
private monitoredReadCharacteristics: { serviceUuid: string; characteristicUuid: string; lastHexValue: string | null }[] = [];
5556
private mediaButtonEventListener: { remove: () => void } | null = null;
5657
private mediaButtonListeningActive: boolean = false;
@@ -1466,7 +1467,14 @@ class BluetoothAudioService {
14661467
return;
14671468
}
14681469

1469-
void this.pollReadCharacteristics(deviceId);
1470+
if (this.isReadPollingInFlight) {
1471+
return;
1472+
}
1473+
1474+
this.isReadPollingInFlight = true;
1475+
void this.pollReadCharacteristics(deviceId).finally(() => {
1476+
this.isReadPollingInFlight = false;
1477+
});
14701478
}, 700);
14711479
}
14721480

@@ -1507,6 +1515,8 @@ class BluetoothAudioService {
15071515
clearInterval(this.readPollingInterval);
15081516
this.readPollingInterval = null;
15091517
}
1518+
1519+
this.isReadPollingInFlight = false;
15101520
}
15111521

15121522
private hasReadCapability(properties: unknown): boolean {

0 commit comments

Comments
 (0)