You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-desktop/ts/state/selectors/settings.ts

28 lines
936 B
TypeScript

import { useSelector } from 'react-redux';
import { SettingsKey } from '../../data/settings-key';
import { StateType } from '../reducer';
const getLinkPreviewEnabled = (state: StateType) =>
state.settings.settingsBools[SettingsKey.settingsLinkPreview];
const getHasDeviceOutdatedSyncing = (state: StateType) =>
state.settings.settingsBools[SettingsKey.someDeviceOutdatedSyncing];
const getHasBlindedMsgRequestsEnabled = (state: StateType) =>
state.settings.settingsBools[SettingsKey.hasBlindedMsgRequestsEnabled];
export const useHasLinkPreviewEnabled = () => {
const value = useSelector(getLinkPreviewEnabled);
return Boolean(value);
};
export const useHasDeviceOutdatedSyncing = () => {
const value = useSelector(getHasDeviceOutdatedSyncing);
return Boolean(value);
};
export const useHasBlindedMsgRequestsEnabled = () => {
const value = useSelector(getHasBlindedMsgRequestsEnabled);
return Boolean(value);
};