2022-10-20 21:02:22 +00:00
|
|
|
// Copyright 2022 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import { isBucketValueEnabled, isEnabled } from '../RemoteConfig';
|
|
|
|
import { isBeta } from './version';
|
|
|
|
|
|
|
|
// Note: selectors/items is the other place this check is done
|
|
|
|
export const getStoriesAvailable = (): boolean => {
|
|
|
|
if (
|
|
|
|
isBucketValueEnabled(
|
2022-11-08 20:55:51 +00:00
|
|
|
'desktop.stories2',
|
2022-10-20 21:02:22 +00:00
|
|
|
window.textsecure.storage.user.getNumber(),
|
2023-08-10 16:43:33 +00:00
|
|
|
window.textsecure.storage.user.getAci()
|
2022-10-20 21:02:22 +00:00
|
|
|
)
|
|
|
|
) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isEnabled('desktop.internalUser')) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2022-11-08 20:55:51 +00:00
|
|
|
if (isEnabled('desktop.stories2.beta') && isBeta(window.getVersion())) {
|
2022-10-20 21:02:22 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const getStoriesDisabled = (): boolean =>
|
|
|
|
window.Events.getHasStoriesDisabled();
|
|
|
|
|
|
|
|
export const getStoriesBlocked = (): boolean =>
|
|
|
|
!getStoriesAvailable() || getStoriesDisabled();
|