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

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