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.
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
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];
|
|
|
|
const getHasFollowSystemThemeEnabled = (state: StateType) =>
|
|
state.settings.settingsBools[SettingsKey.hasFollowSystemThemeEnabled];
|
|
|
|
const getHasShiftSendEnabled = (state: StateType) =>
|
|
state.settings.settingsBools[SettingsKey.hasShiftSendEnabled];
|
|
|
|
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);
|
|
};
|
|
|
|
export const useHasFollowSystemThemeEnabled = () => {
|
|
const value = useSelector(getHasFollowSystemThemeEnabled);
|
|
return Boolean(value);
|
|
};
|
|
|
|
export const useHasEnterSendEnabled = () => {
|
|
const value = useSelector(getHasShiftSendEnabled);
|
|
|
|
return Boolean(value);
|
|
};
|