Add a stories toggle to Preferences

This commit is contained in:
Josh Perez 2022-07-19 20:47:05 -04:00 committed by GitHub
parent 4d67c6b056
commit 0d2e6493f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 199 additions and 110 deletions

View File

@ -7169,6 +7169,14 @@
"message": "Sending reaction...", "message": "Sending reaction...",
"description": "Toast message" "description": "Toast message"
}, },
"Stories__settings-toggle--title": {
"message": "Share & View Stories",
"description": "Select box title for the stories on/off toggle"
},
"Stories__settings-toggle--description": {
"message": "You will no longer be able to share or view Stories when this option is turned off.",
"description": "Select box description for the stories on/off toggle"
},
"StoryViewer__pause": { "StoryViewer__pause": {
"message": "Pause", "message": "Pause",
"description": "Aria label for pausing a story" "description": "Aria label for pausing a story"

View File

@ -1,16 +1,17 @@
// Copyright 2021 Signal Messenger, LLC // Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
import type { Meta, Story } from '@storybook/react';
import React from 'react'; import React from 'react';
import { action } from '@storybook/addon-actions';
import enMessages from '../../_locales/en/messages.json'; import enMessages from '../../_locales/en/messages.json';
import type { PropsType } from './Preferences'; import type { PropsDataType, PropsType } from './Preferences';
import { Preferences } from './Preferences'; import { Preferences } from './Preferences';
import { setupI18n } from '../util/setupI18n'; import { setupI18n } from '../util/setupI18n';
import { DEFAULT_CONVERSATION_COLOR } from '../types/Colors'; import { DEFAULT_CONVERSATION_COLOR } from '../types/Colors';
import { PhoneNumberSharingMode } from '../util/phoneNumberSharingMode'; import { PhoneNumberSharingMode } from '../util/phoneNumberSharingMode';
import { PhoneNumberDiscoverability } from '../util/phoneNumberDiscoverability'; import { PhoneNumberDiscoverability } from '../util/phoneNumberDiscoverability';
import { objectMap } from '../util/objectMap';
const i18n = setupI18n('en', enMessages); const i18n = setupI18n('en', enMessages);
@ -42,7 +43,7 @@ const availableSpeakers = [
}, },
]; ];
const createProps = (): PropsType => ({ const getDefaultArgs = (): PropsDataType => ({
availableCameras: [ availableCameras: [
{ {
deviceId: deviceId:
@ -73,6 +74,7 @@ const createProps = (): PropsType => ({
hasCallNotifications: true, hasCallNotifications: true,
hasCallRingtoneNotification: false, hasCallRingtoneNotification: false,
hasCountMutedConversations: false, hasCountMutedConversations: false,
hasCustomTitleBar: true,
hasHideMenuBar: false, hasHideMenuBar: false,
hasIncomingCallNotifications: true, hasIncomingCallNotifications: true,
hasLinkPreviews: true, hasLinkPreviews: true,
@ -85,38 +87,9 @@ const createProps = (): PropsType => ({
hasReadReceipts: true, hasReadReceipts: true,
hasRelayCalls: false, hasRelayCalls: false,
hasSpellCheck: true, hasSpellCheck: true,
hasStoriesEnabled: true,
hasTypingIndicators: true, hasTypingIndicators: true,
lastSyncTime: Date.now(),
notificationContent: 'name',
selectedCamera:
'dfbe6effe70b0611ba0fdc2a9ea3f39f6cb110e6687948f7e5f016c111b7329c',
selectedMicrophone: availableMicrophones[0],
selectedSpeaker: availableSpeakers[1],
themeSetting: 'system',
universalExpireTimer: 3600,
whoCanFindMe: PhoneNumberDiscoverability.Discoverable,
whoCanSeeMe: PhoneNumberSharingMode.Everybody,
zoomFactor: 1,
addCustomColor: action('addCustomColor'),
closeSettings: action('closeSettings'),
doDeleteAllData: action('doDeleteAllData'),
doneRendering: action('doneRendering'),
editCustomColor: action('editCustomColor'),
getConversationsWithCustomColor: () => Promise.resolve([]),
initialSpellCheckSetting: true, initialSpellCheckSetting: true,
makeSyncRequest: () => {
action('makeSyncRequest');
return Promise.resolve();
},
removeCustomColor: action('removeCustomColor'),
removeCustomColorOnConversations: action('removeCustomColorOnConversations'),
resetAllChatColors: action('resetAllChatColors'),
resetDefaultChatColor: action('resetDefaultChatColor'),
setGlobalDefaultConversationColor: action(
'setGlobalDefaultConversationColor'
),
isAudioNotificationsSupported: true, isAudioNotificationsSupported: true,
isAutoDownloadUpdatesSupported: true, isAutoDownloadUpdatesSupported: true,
isAutoLaunchSupported: true, isAutoLaunchSupported: true,
@ -125,62 +98,95 @@ const createProps = (): PropsType => ({
isPhoneNumberSharingSupported: false, isPhoneNumberSharingSupported: false,
isSyncSupported: true, isSyncSupported: true,
isSystemTraySupported: true, isSystemTraySupported: true,
lastSyncTime: Date.now(),
notificationContent: 'name',
selectedCamera:
'dfbe6effe70b0611ba0fdc2a9ea3f39f6cb110e6687948f7e5f016c111b7329c',
selectedMicrophone: availableMicrophones[0],
selectedSpeaker: availableSpeakers[1],
shouldShowStoriesSettings: true,
themeSetting: 'system',
universalExpireTimer: 3600,
whoCanFindMe: PhoneNumberDiscoverability.Discoverable,
whoCanSeeMe: PhoneNumberSharingMode.Everybody,
zoomFactor: 1,
});
onAudioNotificationsChange: action('onAudioNotificationsChange'), const defaultArgTypes: Record<string, { defaultValue: unknown }> = {};
onAutoDownloadUpdateChange: action('onAutoDownloadUpdateChange'), objectMap(getDefaultArgs(), (key, defaultValue) => {
onAutoLaunchChange: action('onAutoLaunchChange'), defaultArgTypes[key] = { defaultValue };
onCallNotificationsChange: action('onCallNotificationsChange'),
onCallRingtoneNotificationChange: action('onCallRingtoneNotificationChange'),
onCountMutedConversationsChange: action('onCountMutedConversationsChange'),
onHideMenuBarChange: action('onHideMenuBarChange'),
onIncomingCallNotificationsChange: action(
'onIncomingCallNotificationsChange'
),
onLastSyncTimeChange: action('onLastSyncTimeChange'),
onMediaCameraPermissionsChange: action('onMediaCameraPermissionsChange'),
onMediaPermissionsChange: action('onMediaPermissionsChange'),
onMinimizeToAndStartInSystemTrayChange: action(
'onMinimizeToAndStartInSystemTrayChange'
),
onMinimizeToSystemTrayChange: action('onMinimizeToSystemTrayChange'),
onNotificationAttentionChange: action('onNotificationAttentionChange'),
onNotificationContentChange: action('onNotificationContentChange'),
onNotificationsChange: action('onNotificationsChange'),
onRelayCallsChange: action('onRelayCallsChange'),
onSelectedCameraChange: action('onSelectedCameraChange'),
onSelectedMicrophoneChange: action('onSelectedMicrophoneChange'),
onSelectedSpeakerChange: action('onSelectedSpeakerChange'),
onSpellCheckChange: action('onSpellCheckChange'),
onThemeChange: action('onThemeChange'),
onUniversalExpireTimerChange: action('onUniversalExpireTimerChange'),
onZoomFactorChange: action('onZoomFactorChange'),
i18n,
executeMenuRole: action('executeMenuRole'),
hasCustomTitleBar: true,
}); });
export default { export default {
title: 'Components/Preferences', title: 'Components/Preferences',
component: Preferences,
argTypes: {
// ...defaultArgTypes,
i18n: {
defaultValue: i18n,
},
addCustomColor: { action: true },
closeSettings: { action: true },
doDeleteAllData: { action: true },
doneRendering: { action: true },
editCustomColor: { action: true },
executeMenuRole: { action: true },
getConversationsWithCustomColor: { action: true },
makeSyncRequest: { action: true },
onAudioNotificationsChange: { action: true },
onAutoDownloadUpdateChange: { action: true },
onAutoLaunchChange: { action: true },
onCallNotificationsChange: { action: true },
onCallRingtoneNotificationChange: { action: true },
onCountMutedConversationsChange: { action: true },
onHasStoriesEnabledChanged: { action: true },
onHideMenuBarChange: { action: true },
onIncomingCallNotificationsChange: { action: true },
onLastSyncTimeChange: { action: true },
onMediaCameraPermissionsChange: { action: true },
onMediaPermissionsChange: { action: true },
onMinimizeToAndStartInSystemTrayChange: { action: true },
onMinimizeToSystemTrayChange: { action: true },
onNotificationAttentionChange: { action: true },
onNotificationContentChange: { action: true },
onNotificationsChange: { action: true },
onRelayCallsChange: { action: true },
onSelectedCameraChange: { action: true },
onSelectedMicrophoneChange: { action: true },
onSelectedSpeakerChange: { action: true },
onSpellCheckChange: { action: true },
onThemeChange: { action: true },
onUniversalExpireTimerChange: { action: true },
onZoomFactorChange: { action: true },
removeCustomColor: { action: true },
removeCustomColorOnConversations: { action: true },
resetAllChatColors: { action: true },
resetDefaultChatColor: { action: true },
setGlobalDefaultConversationColor: { action: true },
},
} as Meta;
const Template: Story<PropsType> = args => <Preferences {...args} />;
export const _Preferences = Template.bind({});
_Preferences.args = getDefaultArgs();
export const Blocked1 = Template.bind({});
Blocked1.args = {
blockedCount: 1,
}; };
export const _Preferences = (): JSX.Element => ( export const BlockedMany = Template.bind({});
<Preferences {...createProps()} /> BlockedMany.args = {
); blockedCount: 55,
};
export const Blocked1 = (): JSX.Element => (
<Preferences {...createProps()} blockedCount={1} />
);
export const BlockedMany = (): JSX.Element => (
<Preferences {...createProps()} blockedCount={55} />
);
export const CustomUniversalExpireTimer = (): JSX.Element => (
<Preferences {...createProps()} universalExpireTimer={9000} />
);
export const CustomUniversalExpireTimer = Template.bind({});
CustomUniversalExpireTimer.args = {
universalExpireTimer: 9000,
};
CustomUniversalExpireTimer.story = { CustomUniversalExpireTimer.story = {
name: 'Custom universalExpireTimer', name: 'Custom universalExpireTimer',
}; };

View File

@ -44,7 +44,7 @@ import { useTheme } from '../hooks/useTheme';
type CheckboxChangeHandlerType = (value: boolean) => unknown; type CheckboxChangeHandlerType = (value: boolean) => unknown;
type SelectChangeHandlerType<T = string | number> = (value: T) => unknown; type SelectChangeHandlerType<T = string | number> = (value: T) => unknown;
export type PropsType = { export type PropsDataType = {
// Settings // Settings
blockedCount: number; blockedCount: number;
customColors: Record<string, CustomColorType>; customColors: Record<string, CustomColorType>;
@ -68,6 +68,7 @@ export type PropsType = {
hasReadReceipts: boolean; hasReadReceipts: boolean;
hasRelayCalls?: boolean; hasRelayCalls?: boolean;
hasSpellCheck: boolean; hasSpellCheck: boolean;
hasStoriesEnabled: boolean;
hasTypingIndicators: boolean; hasTypingIndicators: boolean;
lastSyncTime?: number; lastSyncTime?: number;
notificationContent: NotificationSettingType; notificationContent: NotificationSettingType;
@ -80,16 +81,37 @@ export type PropsType = {
whoCanSeeMe: PhoneNumberSharingMode; whoCanSeeMe: PhoneNumberSharingMode;
zoomFactor: ZoomFactorType; zoomFactor: ZoomFactorType;
// Other props
hasCustomTitleBar: boolean;
initialSpellCheckSetting: boolean;
shouldShowStoriesSettings: boolean;
// Limited support features
isAudioNotificationsSupported: boolean;
isAutoDownloadUpdatesSupported: boolean;
isAutoLaunchSupported: boolean;
isHideMenuBarSupported: boolean;
isNotificationAttentionSupported: boolean;
isPhoneNumberSharingSupported: boolean;
isSyncSupported: boolean;
isSystemTraySupported: boolean;
availableCameras: Array<
Pick<MediaDeviceInfo, 'deviceId' | 'groupId' | 'kind' | 'label'>
>;
} & Omit<MediaDeviceSettings, 'availableCameras'>;
type PropsFunctionType = {
// Other props // Other props
addCustomColor: (color: CustomColorType) => unknown; addCustomColor: (color: CustomColorType) => unknown;
closeSettings: () => unknown; closeSettings: () => unknown;
doDeleteAllData: () => unknown; doDeleteAllData: () => unknown;
doneRendering: () => unknown; doneRendering: () => unknown;
editCustomColor: (colorId: string, color: CustomColorType) => unknown; editCustomColor: (colorId: string, color: CustomColorType) => unknown;
executeMenuRole: ExecuteMenuRoleType;
getConversationsWithCustomColor: ( getConversationsWithCustomColor: (
colorId: string colorId: string
) => Promise<Array<ConversationType>>; ) => Promise<Array<ConversationType>>;
initialSpellCheckSetting: boolean;
makeSyncRequest: () => unknown; makeSyncRequest: () => unknown;
removeCustomColor: (colorId: string) => unknown; removeCustomColor: (colorId: string) => unknown;
removeCustomColorOnConversations: (colorId: string) => unknown; removeCustomColorOnConversations: (colorId: string) => unknown;
@ -102,18 +124,6 @@ export type PropsType = {
value: CustomColorType; value: CustomColorType;
} }
) => unknown; ) => unknown;
hasCustomTitleBar: boolean;
executeMenuRole: ExecuteMenuRoleType;
// Limited support features
isAudioNotificationsSupported: boolean;
isAutoDownloadUpdatesSupported: boolean;
isAutoLaunchSupported: boolean;
isHideMenuBarSupported: boolean;
isNotificationAttentionSupported: boolean;
isPhoneNumberSharingSupported: boolean;
isSyncSupported: boolean;
isSystemTraySupported: boolean;
// Change handlers // Change handlers
onAudioNotificationsChange: CheckboxChangeHandlerType; onAudioNotificationsChange: CheckboxChangeHandlerType;
@ -122,6 +132,7 @@ export type PropsType = {
onCallNotificationsChange: CheckboxChangeHandlerType; onCallNotificationsChange: CheckboxChangeHandlerType;
onCallRingtoneNotificationChange: CheckboxChangeHandlerType; onCallRingtoneNotificationChange: CheckboxChangeHandlerType;
onCountMutedConversationsChange: CheckboxChangeHandlerType; onCountMutedConversationsChange: CheckboxChangeHandlerType;
onHasStoriesEnabledChanged: SelectChangeHandlerType<boolean>;
onHideMenuBarChange: CheckboxChangeHandlerType; onHideMenuBarChange: CheckboxChangeHandlerType;
onIncomingCallNotificationsChange: CheckboxChangeHandlerType; onIncomingCallNotificationsChange: CheckboxChangeHandlerType;
onLastSyncTimeChange: (time: number) => unknown; onLastSyncTimeChange: (time: number) => unknown;
@ -141,13 +152,11 @@ export type PropsType = {
onUniversalExpireTimerChange: SelectChangeHandlerType<number>; onUniversalExpireTimerChange: SelectChangeHandlerType<number>;
onZoomFactorChange: SelectChangeHandlerType<ZoomFactorType>; onZoomFactorChange: SelectChangeHandlerType<ZoomFactorType>;
availableCameras: Array<
Pick<MediaDeviceInfo, 'deviceId' | 'groupId' | 'kind' | 'label'>
>;
// Localization // Localization
i18n: LocalizerType; i18n: LocalizerType;
} & Omit<MediaDeviceSettings, 'availableCameras'>; };
export type PropsType = PropsDataType & PropsFunctionType;
enum Page { enum Page {
// Accessible through left nav // Accessible through left nav
@ -218,6 +227,7 @@ export const Preferences = ({
hasReadReceipts, hasReadReceipts,
hasRelayCalls, hasRelayCalls,
hasSpellCheck, hasSpellCheck,
hasStoriesEnabled,
hasTypingIndicators, hasTypingIndicators,
i18n, i18n,
initialSpellCheckSetting, initialSpellCheckSetting,
@ -239,6 +249,7 @@ export const Preferences = ({
onCallNotificationsChange, onCallNotificationsChange,
onCallRingtoneNotificationChange, onCallRingtoneNotificationChange,
onCountMutedConversationsChange, onCountMutedConversationsChange,
onHasStoriesEnabledChanged,
onHideMenuBarChange, onHideMenuBarChange,
onIncomingCallNotificationsChange, onIncomingCallNotificationsChange,
onLastSyncTimeChange, onLastSyncTimeChange,
@ -265,12 +276,14 @@ export const Preferences = ({
selectedMicrophone, selectedMicrophone,
selectedSpeaker, selectedSpeaker,
setGlobalDefaultConversationColor, setGlobalDefaultConversationColor,
shouldShowStoriesSettings,
themeSetting, themeSetting,
universalExpireTimer = 0, universalExpireTimer = 0,
whoCanFindMe, whoCanFindMe,
whoCanSeeMe, whoCanSeeMe,
zoomFactor, zoomFactor,
}: PropsType): JSX.Element => { }: PropsType): JSX.Element => {
const storiesId = useUniqueId();
const themeSelectId = useUniqueId(); const themeSelectId = useUniqueId();
const zoomSelectId = useUniqueId(); const zoomSelectId = useUniqueId();
@ -947,6 +960,39 @@ export const Preferences = ({
} }
/> />
</SettingsRow> </SettingsRow>
{shouldShowStoriesSettings && (
<SettingsRow title={i18n('Stories__title')}>
<Control
left={
<label htmlFor={storiesId}>
<div>{i18n('Stories__settings-toggle--title')}</div>
<div className="Preferences__description">
{i18n('Stories__settings-toggle--description')}
</div>
</label>
}
right={
<Select
id={storiesId}
onChange={value => {
onHasStoriesEnabledChanged(value === 'true');
}}
options={[
{
text: i18n('on'),
value: 'true',
},
{
text: i18n('off'),
value: 'false',
},
]}
value={String(hasStoriesEnabled)}
/>
}
/>
</SettingsRow>
)}
<SettingsRow> <SettingsRow>
<Control <Control
left={ left={

View File

@ -61,6 +61,7 @@ export class SettingsChannel extends EventEmitter {
this.installCallback('isPrimary'); this.installCallback('isPrimary');
this.installCallback('syncRequest'); this.installCallback('syncRequest');
this.installCallback('isPhoneNumberSharingEnabled'); this.installCallback('isPhoneNumberSharingEnabled');
this.installCallback('shouldShowStoriesSettings');
// Getters only. These are set by the primary device // Getters only. These are set by the primary device
this.installSetting('blockedCount', { setter: false }); this.installSetting('blockedCount', { setter: false });
@ -103,6 +104,7 @@ export class SettingsChannel extends EventEmitter {
this.installSetting('lastSyncTime'); this.installSetting('lastSyncTime');
this.installSetting('universalExpireTimer'); this.installSetting('universalExpireTimer');
this.installSetting('hasStoriesEnabled');
this.installSetting('zoomFactor'); this.installSetting('zoomFactor');
installPermissionsHandler({ session, userConfig }); installPermissionsHandler({ session, userConfig });

View File

@ -64,10 +64,12 @@ export const getUsernamesEnabled = createSelector(
); );
export const getStoriesEnabled = createSelector( export const getStoriesEnabled = createSelector(
getItems,
getRemoteConfig, getRemoteConfig,
(remoteConfig: ConfigMapType): boolean => (state: ItemsStateType, remoteConfig: ConfigMapType): boolean =>
isRemoteConfigFlagEnabled(remoteConfig, 'desktop.internalUser') || state.hasStoriesEnabled !== false &&
isRemoteConfigFlagEnabled(remoteConfig, 'desktop.stories') (isRemoteConfigFlagEnabled(remoteConfig, 'desktop.internalUser') ||
isRemoteConfigFlagEnabled(remoteConfig, 'desktop.stories'))
); );
export const getDefaultConversationColor = createSelector( export const getDefaultConversationColor = createSelector(

View File

@ -65,6 +65,7 @@ export type StorageAccessType = {
customColors: CustomColorsItemType; customColors: CustomColorsItemType;
device_name: string; device_name: string;
hasRegisterSupportForUnauthenticatedDelivery: boolean; hasRegisterSupportForUnauthenticatedDelivery: boolean;
hasStoriesEnabled: boolean;
identityKeyMap: IdentityKeyMap; identityKeyMap: IdentityKeyMap;
lastHeartbeat: number; lastHeartbeat: number;
lastStartup: number; lastStartup: number;

View File

@ -4,6 +4,7 @@
import { webFrame } from 'electron'; import { webFrame } from 'electron';
import type { AudioDevice } from 'ringrtc'; import type { AudioDevice } from 'ringrtc';
import * as React from 'react'; import * as React from 'react';
import * as RemoteConfig from '../RemoteConfig';
import type { ZoomFactorType } from '../types/Storage.d'; import type { ZoomFactorType } from '../types/Storage.d';
import type { import type {
@ -47,6 +48,7 @@ export type IPCEventsValuesType = {
callRingtoneNotification: boolean; callRingtoneNotification: boolean;
callSystemNotification: boolean; callSystemNotification: boolean;
countMutedConversations: boolean; countMutedConversations: boolean;
hasStoriesEnabled: boolean;
hideMenuBar: boolean | undefined; hideMenuBar: boolean | undefined;
incomingCallNotification: boolean; incomingCallNotification: boolean;
lastSyncTime: number | undefined; lastSyncTime: number | undefined;
@ -111,6 +113,7 @@ export type IPCEventsCallbacksType = {
color: ConversationColorType, color: ConversationColorType,
customColor?: { id: string; value: CustomColorType } customColor?: { id: string; value: CustomColorType }
) => void; ) => void;
shouldShowStoriesSettings: () => boolean;
getDefaultConversationColor: () => DefaultConversationColorType; getDefaultConversationColor: () => DefaultConversationColorType;
persistZoomFactor: (factor: number) => Promise<void>; persistZoomFactor: (factor: number) => Promise<void>;
}; };
@ -175,6 +178,10 @@ export function createIPCEvents(
webFrame.setZoomFactor(zoomFactor); webFrame.setZoomFactor(zoomFactor);
}, },
getHasStoriesEnabled: () => window.storage.get('hasStoriesEnabled', true),
setHasStoriesEnabled: (value: boolean) =>
window.storage.put('hasStoriesEnabled', value),
getPreferredAudioInputDevice: () => getPreferredAudioInputDevice: () =>
window.storage.get('preferred-audio-input-device'), window.storage.get('preferred-audio-input-device'),
setPreferredAudioInputDevice: device => setPreferredAudioInputDevice: device =>
@ -331,6 +338,9 @@ export function createIPCEvents(
isPhoneNumberSharingEnabled: () => isPhoneNumberSharingEnabled(), isPhoneNumberSharingEnabled: () => isPhoneNumberSharingEnabled(),
isPrimary: () => window.textsecure.storage.user.getDeviceId() === 1, isPrimary: () => window.textsecure.storage.user.getDeviceId() === 1,
shouldShowStoriesSettings: () =>
RemoteConfig.isEnabled('desktop.internalUser') ||
RemoteConfig.isEnabled('desktop.stories'),
syncRequest: () => syncRequest: () =>
new Promise<void>((resolve, reject) => { new Promise<void>((resolve, reject) => {
const FIVE_MINUTES = 5 * durations.MINUTE; const FIVE_MINUTES = 5 * durations.MINUTE;

View File

@ -39,23 +39,26 @@ installSetting('typingIndicatorSetting', {
setter: false, setter: false,
}); });
installCallback('isPhoneNumberSharingEnabled');
installCallback('isPrimary');
installCallback('shouldShowStoriesSettings');
installCallback('syncRequest');
installSetting('alwaysRelayCalls'); installSetting('alwaysRelayCalls');
installSetting('audioNotification'); installSetting('audioNotification');
installSetting('autoDownloadUpdate'); installSetting('autoDownloadUpdate');
installSetting('autoLaunch'); installSetting('autoLaunch');
installSetting('countMutedConversations');
installSetting('callRingtoneNotification'); installSetting('callRingtoneNotification');
installSetting('callSystemNotification'); installSetting('callSystemNotification');
installSetting('countMutedConversations');
installSetting('deviceName'); installSetting('deviceName');
installSetting('hasStoriesEnabled');
installSetting('hideMenuBar'); installSetting('hideMenuBar');
installSetting('incomingCallNotification'); installSetting('incomingCallNotification');
installCallback('isPhoneNumberSharingEnabled'); installSetting('lastSyncTime');
installCallback('isPrimary');
installCallback('syncRequest');
installSetting('notificationDrawAttention'); installSetting('notificationDrawAttention');
installSetting('notificationSetting'); installSetting('notificationSetting');
installSetting('spellCheck'); installSetting('spellCheck');
installSetting('lastSyncTime');
installSetting('systemTraySetting'); installSetting('systemTraySetting');
installSetting('themeSetting'); installSetting('themeSetting');
installSetting('universalExpireTimer'); installSetting('universalExpireTimer');

View File

@ -50,6 +50,7 @@ const settingSystemTraySetting = createSetting('systemTraySetting');
const settingLastSyncTime = createSetting('lastSyncTime'); const settingLastSyncTime = createSetting('lastSyncTime');
const settingHasStoriesEnabled = createSetting('hasStoriesEnabled');
const settingZoomFactor = createSetting('zoomFactor'); const settingZoomFactor = createSetting('zoomFactor');
// Getters only. // Getters only.
@ -84,6 +85,9 @@ const ipcGetCustomColors = createCallback('getCustomColors');
const ipcIsSyncNotSupported = createCallback('isPrimary'); const ipcIsSyncNotSupported = createCallback('isPrimary');
const ipcMakeSyncRequest = createCallback('syncRequest'); const ipcMakeSyncRequest = createCallback('syncRequest');
const ipcPNP = createCallback('isPhoneNumberSharingEnabled'); const ipcPNP = createCallback('isPhoneNumberSharingEnabled');
const ipcShouldShowStoriesSettings = createCallback(
'shouldShowStoriesSettings'
);
// ChatColorPicker redux hookups // ChatColorPicker redux hookups
// The redux actions update over IPC through a preferences re-render // The redux actions update over IPC through a preferences re-render
@ -146,6 +150,7 @@ const renderPreferences = async () => {
hasReadReceipts, hasReadReceipts,
hasRelayCalls, hasRelayCalls,
hasSpellCheck, hasSpellCheck,
hasStoriesEnabled,
hasTypingIndicators, hasTypingIndicators,
isPhoneNumberSharingSupported, isPhoneNumberSharingSupported,
lastSyncTime, lastSyncTime,
@ -162,8 +167,9 @@ const renderPreferences = async () => {
availableIODevices, availableIODevices,
customColors, customColors,
isSyncNotSupported,
defaultConversationColor, defaultConversationColor,
isSyncNotSupported,
shouldShowStoriesSettings,
} = await awaitObject({ } = await awaitObject({
blockedCount: settingBlockedCount.getValue(), blockedCount: settingBlockedCount.getValue(),
deviceName: settingDeviceName.getValue(), deviceName: settingDeviceName.getValue(),
@ -182,6 +188,7 @@ const renderPreferences = async () => {
hasReadReceipts: settingReadReceipts.getValue(), hasReadReceipts: settingReadReceipts.getValue(),
hasRelayCalls: settingRelayCalls.getValue(), hasRelayCalls: settingRelayCalls.getValue(),
hasSpellCheck: settingSpellCheck.getValue(), hasSpellCheck: settingSpellCheck.getValue(),
hasStoriesEnabled: settingHasStoriesEnabled.getValue(),
hasTypingIndicators: settingTypingIndicators.getValue(), hasTypingIndicators: settingTypingIndicators.getValue(),
isPhoneNumberSharingSupported: ipcPNP(), isPhoneNumberSharingSupported: ipcPNP(),
lastSyncTime: settingLastSyncTime.getValue(), lastSyncTime: settingLastSyncTime.getValue(),
@ -199,8 +206,9 @@ const renderPreferences = async () => {
// Callbacks // Callbacks
availableIODevices: ipcGetAvailableIODevices(), availableIODevices: ipcGetAvailableIODevices(),
customColors: ipcGetCustomColors(), customColors: ipcGetCustomColors(),
isSyncNotSupported: ipcIsSyncNotSupported(),
defaultConversationColor: ipcGetDefaultConversationColor(), defaultConversationColor: ipcGetDefaultConversationColor(),
isSyncNotSupported: ipcIsSyncNotSupported(),
shouldShowStoriesSettings: ipcShouldShowStoriesSettings(),
}); });
const { availableCameras, availableMicrophones, availableSpeakers } = const { availableCameras, availableMicrophones, availableSpeakers } =
@ -236,6 +244,7 @@ const renderPreferences = async () => {
hasReadReceipts, hasReadReceipts,
hasRelayCalls, hasRelayCalls,
hasSpellCheck, hasSpellCheck,
hasStoriesEnabled,
hasTypingIndicators, hasTypingIndicators,
lastSyncTime, lastSyncTime,
notificationContent, notificationContent,
@ -263,6 +272,7 @@ const renderPreferences = async () => {
resetAllChatColors: ipcResetAllChatColors, resetAllChatColors: ipcResetAllChatColors,
resetDefaultChatColor: ipcResetDefaultChatColor, resetDefaultChatColor: ipcResetDefaultChatColor,
setGlobalDefaultConversationColor: ipcSetGlobalDefaultConversationColor, setGlobalDefaultConversationColor: ipcSetGlobalDefaultConversationColor,
shouldShowStoriesSettings,
// Limited support features // Limited support features
isAudioNotificationsSupported: Settings.isAudioNotificationSupported(), isAudioNotificationsSupported: Settings.isAudioNotificationSupported(),
@ -287,6 +297,7 @@ const renderPreferences = async () => {
onCountMutedConversationsChange: reRender( onCountMutedConversationsChange: reRender(
settingCountMutedConversations.setValue settingCountMutedConversations.setValue
), ),
onHasStoriesEnabledChanged: reRender(settingHasStoriesEnabled.setValue),
onHideMenuBarChange: reRender(settingHideMenuBar.setValue), onHideMenuBarChange: reRender(settingHideMenuBar.setValue),
onIncomingCallNotificationsChange: reRender( onIncomingCallNotificationsChange: reRender(
settingIncomingCallNotification.setValue settingIncomingCallNotification.setValue