File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
src/lib/store/runtimeConfig Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import { useAppSelector } from '../hooks';
22import {
33 selectClientId ,
44 selectDeviceInterfaceSupport ,
5+ selectDeviceSupportsInterface ,
6+ selectInterfacesForDevice ,
57 selectIsTouchpanel ,
68 selectRoomKey ,
79 selectRuntimeInfo ,
@@ -33,3 +35,11 @@ export const useIsTouchpanel = () => useAppSelector(selectIsTouchpanel);
3335
3436export const useDeviceInterfaceSupport = ( ) =>
3537 useAppSelector ( selectDeviceInterfaceSupport ) ;
38+
39+ export const useInterfacesForDevice = ( deviceKey : string ) =>
40+ useAppSelector ( selectInterfacesForDevice ( deviceKey ) ) ;
41+
42+ export const useDeviceSupportsInterface = (
43+ deviceKey : string ,
44+ interfaceToCheck : string
45+ ) => useAppSelector ( selectDeviceSupportsInterface ( deviceKey , interfaceToCheck ) ) ;
Original file line number Diff line number Diff line change @@ -52,3 +52,17 @@ export const selectDeviceInterfaceSupport = createSelector(
5252 runtimeState ,
5353 ( state ) => state . roomData . deviceInterfaceSupport
5454) ;
55+
56+ export const selectInterfacesForDevice = ( deviceKey : string ) =>
57+ createSelector (
58+ selectDeviceInterfaceSupport ,
59+ ( devices ) => devices ?. [ deviceKey ] ?. interfaces ?? [ ]
60+ ) ;
61+
62+ export const selectDeviceSupportsInterface = (
63+ deviceKey : string ,
64+ interfaceToCheck : string
65+ ) =>
66+ createSelector ( selectInterfacesForDevice ( deviceKey ) , ( interfaces ) =>
67+ interfaces . includes ( interfaceToCheck )
68+ ) ;
You can’t perform that action at this time.
0 commit comments