Simplify redux ducks and avoid reexport
This commit is contained in:
parent
bd41d7b216
commit
d34d187f1e
5 changed files with 144 additions and 94 deletions
|
@ -5,6 +5,7 @@ import { createSelector } from 'reselect';
|
|||
import { isInteger } from 'lodash';
|
||||
|
||||
import { ITEM_NAME as UNIVERSAL_EXPIRE_TIMER_ITEM } from '../../util/universalExpireTimer';
|
||||
import { SecurityNumberIdentifierType } from '../../util/safetyNumber';
|
||||
import { innerIsBucketValueEnabled } from '../../RemoteConfig';
|
||||
import type { ConfigKeyType, ConfigMapType } from '../../RemoteConfig';
|
||||
import type { StateType } from '../reducer';
|
||||
|
@ -145,6 +146,25 @@ export const getContactManagementEnabled = createSelector(
|
|||
}
|
||||
);
|
||||
|
||||
export const getSecurityNumberIdentifierType = createSelector(
|
||||
getRemoteConfig,
|
||||
(_state: StateType, { now }: { now: number }) => now,
|
||||
(remoteConfig: ConfigMapType, now: number): SecurityNumberIdentifierType => {
|
||||
if (isRemoteConfigFlagEnabled(remoteConfig, 'desktop.safetyNumberUUID')) {
|
||||
return SecurityNumberIdentifierType.UUIDIdentifier;
|
||||
}
|
||||
|
||||
const timestamp = remoteConfig['desktop.safetyNumberUUID.timestamp']?.value;
|
||||
if (typeof timestamp !== 'number') {
|
||||
return SecurityNumberIdentifierType.E164Identifier;
|
||||
}
|
||||
|
||||
return now >= timestamp
|
||||
? SecurityNumberIdentifierType.UUIDIdentifier
|
||||
: SecurityNumberIdentifierType.E164Identifier;
|
||||
}
|
||||
);
|
||||
|
||||
export const getDefaultConversationColor = createSelector(
|
||||
getItems,
|
||||
(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue