2022-01-27 17:12:26 -05:00
|
|
|
// Copyright 2019-2022 Signal Messenger, LLC
|
2020-10-30 15:34:04 -05:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2019-01-14 13:49:58 -08:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { mapDispatchToProps } from '../actions';
|
|
|
|
|
|
|
|
import { MainHeader } from '../../components/MainHeader';
|
2021-10-26 14:15:33 -05:00
|
|
|
import type { StateType } from '../reducer';
|
2019-01-14 13:49:58 -08:00
|
|
|
|
2021-11-08 10:29:54 -06:00
|
|
|
import { getPreferredBadgeSelector } from '../selectors/badges';
|
2020-03-05 13:14:58 -08:00
|
|
|
import {
|
|
|
|
getIntl,
|
|
|
|
getRegionCode,
|
2021-11-08 10:29:54 -06:00
|
|
|
getTheme,
|
2020-03-05 13:14:58 -08:00
|
|
|
getUserConversationId,
|
|
|
|
getUserNumber,
|
|
|
|
} from '../selectors/user';
|
2022-01-27 17:12:26 -05:00
|
|
|
import { getMe } from '../selectors/conversations';
|
2022-03-04 16:14:52 -05:00
|
|
|
import { getStoriesEnabled } from '../selectors/items';
|
2022-08-23 13:37:48 -04:00
|
|
|
import { getStoriesNotificationCount } from '../selectors/stories';
|
2019-01-14 13:49:58 -08:00
|
|
|
|
|
|
|
const mapStateToProps = (state: StateType) => {
|
2021-11-08 10:29:54 -06:00
|
|
|
const me = getMe(state);
|
|
|
|
|
2019-01-14 13:49:58 -08:00
|
|
|
return {
|
2022-03-04 16:14:52 -05:00
|
|
|
areStoriesEnabled: getStoriesEnabled(state),
|
2021-08-19 18:56:29 -04:00
|
|
|
hasPendingUpdate: Boolean(state.updates.didSnooze),
|
2019-01-14 13:49:58 -08:00
|
|
|
regionCode: getRegionCode(state),
|
2020-03-05 13:14:58 -08:00
|
|
|
ourConversationId: getUserConversationId(state),
|
2019-01-14 13:49:58 -08:00
|
|
|
ourNumber: getUserNumber(state),
|
2021-11-08 10:29:54 -06:00
|
|
|
...me,
|
|
|
|
badge: getPreferredBadgeSelector(state)(me.badges),
|
|
|
|
theme: getTheme(state),
|
2019-01-14 13:49:58 -08:00
|
|
|
i18n: getIntl(state),
|
2022-08-23 13:37:48 -04:00
|
|
|
unreadStoriesCount: getStoriesNotificationCount(state),
|
2019-01-14 13:49:58 -08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const smart = connect(mapStateToProps, mapDispatchToProps);
|
|
|
|
|
|
|
|
export const SmartMainHeader = smart(MainHeader);
|