2020-10-30 20:34:04 +00:00
|
|
|
// Copyright 2020 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-06-26 00:08:58 +00:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { mapDispatchToProps } from '../actions';
|
|
|
|
import { SafetyNumberViewer } from '../../components/SafetyNumberViewer';
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { StateType } from '../reducer';
|
2022-03-02 18:24:28 +00:00
|
|
|
import type { SafetyNumberProps } from '../../components/SafetyNumberChangeDialog';
|
2020-06-26 00:08:58 +00:00
|
|
|
import { getContactSafetyNumber } from '../selectors/safetyNumber';
|
|
|
|
import { getConversationSelector } from '../selectors/conversations';
|
2023-07-13 19:06:42 +00:00
|
|
|
import { getSafetyNumberMode } from '../selectors/items';
|
2020-06-26 00:08:58 +00:00
|
|
|
import { getIntl } from '../selectors/user';
|
|
|
|
|
2022-03-02 18:24:28 +00:00
|
|
|
const mapStateToProps = (state: StateType, props: SafetyNumberProps) => {
|
2020-06-26 00:08:58 +00:00
|
|
|
return {
|
|
|
|
...props,
|
|
|
|
...getContactSafetyNumber(state, props),
|
|
|
|
contact: getConversationSelector(state)(props.contactID),
|
2023-07-13 19:06:42 +00:00
|
|
|
safetyNumberMode: getSafetyNumberMode(state, { now: Date.now() }),
|
2020-06-26 00:08:58 +00:00
|
|
|
i18n: getIntl(state),
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const smart = connect(mapStateToProps, mapDispatchToProps);
|
|
|
|
|
|
|
|
export const SmartSafetyNumberViewer = smart(SafetyNumberViewer);
|