Expand beta check for stories availability

This commit is contained in:
Scott Nonnenberg 2022-10-12 10:39:05 -07:00 committed by GitHub
parent 820eaa50ad
commit c08608e5d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 7 deletions

View file

@ -15,6 +15,7 @@ import type {
} from '../../types/Colors';
import { DEFAULT_CONVERSATION_COLOR } from '../../types/Colors';
import { getPreferredReactionEmoji as getPreferredReactionEmojiFromStoredValue } from '../../reactions/preferredReactionEmoji';
import { isBeta } from '../../util/version';
const DEFAULT_PREFERRED_LEFT_PANE_WIDTH = 320;
@ -63,13 +64,16 @@ export const getUsernamesEnabled = createSelector(
isRemoteConfigFlagEnabled(remoteConfig, 'desktop.usernames')
);
// Note: types/Stories is the other place this check is done
export const getStoriesEnabled = createSelector(
getItems,
getRemoteConfig,
(state: ItemsStateType, remoteConfig: ConfigMapType): boolean =>
!state.hasStoriesDisabled &&
(isRemoteConfigFlagEnabled(remoteConfig, 'desktop.internalUser') ||
isRemoteConfigFlagEnabled(remoteConfig, 'desktop.stories'))
isRemoteConfigFlagEnabled(remoteConfig, 'desktop.stories') ||
(isRemoteConfigFlagEnabled(remoteConfig, 'desktop.stories.beta') &&
isBeta(window.getVersion())))
);
export const getDefaultConversationColor = createSelector(

View file

@ -157,12 +157,14 @@ export enum StorySendMode {
Never = 'Never',
}
const getStoriesAvailable = () =>
// Note: selectors/items is the other place this check is done
export const getStoriesAvailable = (): boolean =>
isEnabled('desktop.stories') ||
isEnabled('desktop.internalUser') ||
(isEnabled('desktop.stories.beta') && isBeta(window.getVersion()));
const getStoriesDisabled = () => window.Events.getHasStoriesDisabled();
export const getStoriesDisabled = (): boolean =>
window.Events.getHasStoriesDisabled();
export const getStoriesBlocked = (): boolean =>
!getStoriesAvailable() || getStoriesDisabled();

View file

@ -4,7 +4,7 @@
import { webFrame } from 'electron';
import type { AudioDevice } from 'ringrtc';
import * as React from 'react';
import * as RemoteConfig from '../RemoteConfig';
import { getStoriesAvailable } from '../types/Stories';
import type { ZoomFactorType } from '../types/Storage.d';
import type {
@ -343,9 +343,7 @@ export function createIPCEvents(
isPhoneNumberSharingEnabled: () => isPhoneNumberSharingEnabled(),
isPrimary: () => window.textsecure.storage.user.getDeviceId() === 1,
shouldShowStoriesSettings: () =>
RemoteConfig.isEnabled('desktop.internalUser') ||
RemoteConfig.isEnabled('desktop.stories'),
shouldShowStoriesSettings: () => getStoriesAvailable(),
syncRequest: () =>
new Promise<void>((resolve, reject) => {
const FIVE_MINUTES = 5 * durations.MINUTE;