review: rename deviceConnected to canControlDevices

This commit is contained in:
Valere
2025-12-02 16:39:26 +01:00
parent 59d21d2421
commit 44980a2744

View File

@@ -61,7 +61,7 @@ export class MuteState<Label, Selected> {
this.handler$.next(defaultHandler); this.handler$.next(defaultHandler);
} }
private readonly devicesConnected$ = combineLatest([ private readonly canControlDevices$ = combineLatest([
this.device.available$, this.device.available$,
this.forceMute$, this.forceMute$,
]).pipe( ]).pipe(
@@ -71,17 +71,17 @@ export class MuteState<Label, Selected> {
); );
private readonly data$ = this.scope.behavior<MuteStateData>( private readonly data$ = this.scope.behavior<MuteStateData>(
this.devicesConnected$.pipe( this.canControlDevices$.pipe(
distinctUntilChanged(), distinctUntilChanged(),
withLatestFrom( withLatestFrom(
this.enabledByDefault$, this.enabledByDefault$,
(devicesConnected, enabledByDefault) => { (canControlDevices, enabledByDefault) => {
logger.info( logger.info(
`MuteState: devices connected: ${devicesConnected}, enabled by default: ${enabledByDefault}`, `MuteState: canControlDevices: ${canControlDevices}, enabled by default: ${enabledByDefault}`,
); );
if (!devicesConnected) { if (!canControlDevices) {
logger.info( logger.info(
`MuteState: devices connected: ${devicesConnected}, disabling`, `MuteState: devices connected: ${canControlDevices}, disabling`,
); );
// We need to sync the mute state with the handler // We need to sync the mute state with the handler
// to ensure nothing is beeing published. // to ensure nothing is beeing published.