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