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-11-07 21:36:16 +00:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { mapDispatchToProps } from '../actions';
|
|
|
|
import { ShortcutGuideModal } from '../../components/ShortcutGuideModal';
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { StateType } from '../reducer';
|
2019-11-07 21:36:16 +00:00
|
|
|
|
|
|
|
import { countStickers } from '../../components/stickers/lib';
|
|
|
|
import { getIntl, getPlatform } from '../selectors/user';
|
|
|
|
import {
|
|
|
|
getBlessedStickerPacks,
|
|
|
|
getInstalledStickerPacks,
|
|
|
|
getKnownStickerPacks,
|
|
|
|
getReceivedStickerPacks,
|
|
|
|
} from '../selectors/stickers';
|
2023-04-14 18:16:28 +00:00
|
|
|
import {
|
|
|
|
getIsFormattingEnabled,
|
|
|
|
getIsFormattingSpoilersEnabled,
|
|
|
|
} from '../selectors/composer';
|
2019-11-07 21:36:16 +00:00
|
|
|
|
2022-12-22 03:07:45 +00:00
|
|
|
const mapStateToProps = (state: StateType) => {
|
2019-11-07 21:36:16 +00:00
|
|
|
const blessedPacks = getBlessedStickerPacks(state);
|
|
|
|
const installedPacks = getInstalledStickerPacks(state);
|
|
|
|
const knownPacks = getKnownStickerPacks(state);
|
|
|
|
const receivedPacks = getReceivedStickerPacks(state);
|
|
|
|
|
2023-04-14 18:16:28 +00:00
|
|
|
const isFormattingFlagEnabled = getIsFormattingEnabled(state);
|
|
|
|
const isFormattingSpoilersFlagEnabled = getIsFormattingSpoilersEnabled(state);
|
|
|
|
|
2019-11-07 21:36:16 +00:00
|
|
|
const hasInstalledStickers =
|
|
|
|
countStickers({
|
|
|
|
knownPacks,
|
|
|
|
blessedPacks,
|
|
|
|
installedPacks,
|
|
|
|
receivedPacks,
|
2019-12-18 19:13:56 +00:00
|
|
|
}) > 0;
|
2019-11-07 21:36:16 +00:00
|
|
|
|
|
|
|
const platform = getPlatform(state);
|
|
|
|
|
|
|
|
return {
|
|
|
|
hasInstalledStickers,
|
2023-04-14 18:16:28 +00:00
|
|
|
isFormattingFlagEnabled,
|
|
|
|
isFormattingSpoilersFlagEnabled,
|
2019-11-07 21:36:16 +00:00
|
|
|
platform,
|
|
|
|
i18n: getIntl(state),
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const smart = connect(mapStateToProps, mapDispatchToProps);
|
|
|
|
|
|
|
|
export const SmartShortcutGuideModal = smart(ShortcutGuideModal);
|