Timeline date headers
This commit is contained in:
parent
0fa069f260
commit
f9440bf594
41 changed files with 1183 additions and 771 deletions
|
@ -1,11 +1,11 @@
|
|||
// Copyright 2019-2021 Signal Messenger, LLC
|
||||
// Copyright 2019-2022 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { createSelector } from 'reselect';
|
||||
import { isInteger } from 'lodash';
|
||||
|
||||
import { ITEM_NAME as UNIVERSAL_EXPIRE_TIMER_ITEM } from '../../util/universalExpireTimer';
|
||||
import type { ConfigMapType } from '../../RemoteConfig';
|
||||
import type { ConfigKeyType, ConfigMapType } from '../../RemoteConfig';
|
||||
|
||||
import type { StateType } from '../reducer';
|
||||
import type { ItemsStateType } from '../ducks/items';
|
||||
|
@ -15,6 +15,7 @@ import type {
|
|||
} from '../../types/Colors';
|
||||
import { DEFAULT_CONVERSATION_COLOR } from '../../types/Colors';
|
||||
import { getPreferredReactionEmoji as getPreferredReactionEmojiFromStoredValue } from '../../reactions/preferredReactionEmoji';
|
||||
import { getIsAlpha, getIsBeta } from './user';
|
||||
|
||||
const DEFAULT_PREFERRED_LEFT_PANE_WIDTH = 320;
|
||||
|
||||
|
@ -42,15 +43,39 @@ export const getUniversalExpireTimer = createSelector(
|
|||
(state: ItemsStateType): number => state[UNIVERSAL_EXPIRE_TIMER_ITEM] || 0
|
||||
);
|
||||
|
||||
const isRemoteConfigFlagEnabled = (
|
||||
config: Readonly<ConfigMapType>,
|
||||
key: ConfigKeyType
|
||||
): boolean => Boolean(config[key]?.enabled);
|
||||
|
||||
const getRemoteConfig = createSelector(
|
||||
getItems,
|
||||
(state: ItemsStateType): ConfigMapType | undefined => state.remoteConfig
|
||||
(state: ItemsStateType): ConfigMapType => state.remoteConfig || {}
|
||||
);
|
||||
|
||||
export const getUsernamesEnabled = createSelector(
|
||||
getRemoteConfig,
|
||||
(remoteConfig?: ConfigMapType): boolean =>
|
||||
Boolean(remoteConfig?.['desktop.usernames']?.enabled)
|
||||
(remoteConfig: ConfigMapType): boolean =>
|
||||
isRemoteConfigFlagEnabled(remoteConfig, 'desktop.usernames')
|
||||
);
|
||||
|
||||
export const getAreFloatingDateHeadersEnabled = createSelector(
|
||||
getRemoteConfig,
|
||||
getIsAlpha,
|
||||
getIsBeta,
|
||||
(remoteConfig: ConfigMapType, isAlpha, isBeta): boolean => {
|
||||
if (
|
||||
isAlpha ||
|
||||
isRemoteConfigFlagEnabled(remoteConfig, 'desktop.internalUser')
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const remoteConfigKey: ConfigKeyType = isBeta
|
||||
? 'desktop.floatingDateHeaders.beta'
|
||||
: 'desktop.floatingDateHeaders.production';
|
||||
return isRemoteConfigFlagEnabled(remoteConfig, remoteConfigKey);
|
||||
}
|
||||
);
|
||||
|
||||
export const getDefaultConversationColor = createSelector(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue