Phased rollout by country code; starting w/ desktop.stories remote flag
This commit is contained in:
parent
e14c3241c5
commit
1c89168301
10 changed files with 318 additions and 25 deletions
35
ts/util/stories.ts
Normal file
35
ts/util/stories.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
// Copyright 2022 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { isBucketValueEnabled, isEnabled } from '../RemoteConfig';
|
||||
import { UUIDKind } from '../types/UUID';
|
||||
import { isBeta } from './version';
|
||||
|
||||
// Note: selectors/items is the other place this check is done
|
||||
export const getStoriesAvailable = (): boolean => {
|
||||
if (
|
||||
isBucketValueEnabled(
|
||||
'desktop.stories',
|
||||
window.textsecure.storage.user.getNumber(),
|
||||
window.textsecure.storage.user.getUuid(UUIDKind.ACI)?.toString()
|
||||
)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isEnabled('desktop.internalUser')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isEnabled('desktop.stories.beta') && isBeta(window.getVersion())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
export const getStoriesDisabled = (): boolean =>
|
||||
window.Events.getHasStoriesDisabled();
|
||||
|
||||
export const getStoriesBlocked = (): boolean =>
|
||||
!getStoriesAvailable() || getStoriesDisabled();
|
Loading…
Add table
Add a link
Reference in a new issue