2022-07-21 00:07:09 +00:00
|
|
|
// Copyright 2022 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import { useSelector } from 'react-redux';
|
|
|
|
|
|
|
|
import type { LocalizerType } from '../../types/Util';
|
|
|
|
import type { StateType } from '../reducer';
|
|
|
|
import { StoriesSettingsModal } from '../../components/StoriesSettingsModal';
|
|
|
|
import {
|
2022-10-26 23:17:39 +00:00
|
|
|
getAllSignalConnections,
|
2022-07-21 00:07:09 +00:00
|
|
|
getCandidateContactsForNewGroup,
|
2022-11-01 17:34:23 +00:00
|
|
|
getConversationByUuidSelector,
|
|
|
|
getGroupStories,
|
2022-07-21 00:07:09 +00:00
|
|
|
getMe,
|
|
|
|
} from '../selectors/conversations';
|
|
|
|
import { getDistributionListsWithMembers } from '../selectors/storyDistributionLists';
|
|
|
|
import { getIntl } from '../selectors/user';
|
|
|
|
import { getPreferredBadgeSelector } from '../selectors/badges';
|
2022-10-25 22:18:42 +00:00
|
|
|
import { getHasStoryViewReceiptSetting } from '../selectors/items';
|
2022-07-21 00:07:09 +00:00
|
|
|
import { useGlobalModalActions } from '../ducks/globalModals';
|
|
|
|
import { useStoryDistributionListsActions } from '../ducks/storyDistributionLists';
|
2022-10-26 23:17:39 +00:00
|
|
|
import { useStoriesActions } from '../ducks/stories';
|
2022-11-01 17:34:23 +00:00
|
|
|
import { useConversationsActions } from '../ducks/conversations';
|
2022-07-21 00:07:09 +00:00
|
|
|
|
|
|
|
export function SmartStoriesSettingsModal(): JSX.Element | null {
|
2022-10-26 23:17:39 +00:00
|
|
|
const { toggleStoriesView, setStoriesDisabled } = useStoriesActions();
|
2022-07-21 00:07:09 +00:00
|
|
|
const { hideStoriesSettings, toggleSignalConnectionsModal } =
|
|
|
|
useGlobalModalActions();
|
|
|
|
const {
|
|
|
|
allowsRepliesChanged,
|
|
|
|
createDistributionList,
|
|
|
|
deleteDistributionList,
|
|
|
|
hideMyStoriesFrom,
|
2022-11-11 04:10:30 +00:00
|
|
|
removeMembersFromDistributionList,
|
2022-07-21 00:07:09 +00:00
|
|
|
setMyStoriesToAllSignalConnections,
|
|
|
|
updateStoryViewers,
|
|
|
|
} = useStoryDistributionListsActions();
|
2022-11-01 17:34:23 +00:00
|
|
|
const { toggleGroupsForStorySend } = useConversationsActions();
|
2022-10-26 23:17:39 +00:00
|
|
|
const signalConnections = useSelector(getAllSignalConnections);
|
2022-07-21 00:07:09 +00:00
|
|
|
|
|
|
|
const getPreferredBadge = useSelector(getPreferredBadgeSelector);
|
2022-10-25 22:18:42 +00:00
|
|
|
const storyViewReceiptsEnabled = useSelector(getHasStoryViewReceiptSetting);
|
2022-07-21 00:07:09 +00:00
|
|
|
const i18n = useSelector<StateType, LocalizerType>(getIntl);
|
|
|
|
const me = useSelector(getMe);
|
|
|
|
|
|
|
|
const candidateConversations = useSelector(getCandidateContactsForNewGroup);
|
|
|
|
const distributionLists = useSelector(getDistributionListsWithMembers);
|
2022-11-01 17:34:23 +00:00
|
|
|
const groupStories = useSelector(getGroupStories);
|
|
|
|
|
|
|
|
const getConversationByUuid = useSelector(getConversationByUuidSelector);
|
2022-07-21 00:07:09 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<StoriesSettingsModal
|
|
|
|
candidateConversations={candidateConversations}
|
|
|
|
distributionLists={distributionLists}
|
2022-11-01 17:34:23 +00:00
|
|
|
groupStories={groupStories}
|
2022-10-26 23:17:39 +00:00
|
|
|
signalConnections={signalConnections}
|
2022-07-21 00:07:09 +00:00
|
|
|
hideStoriesSettings={hideStoriesSettings}
|
|
|
|
getPreferredBadge={getPreferredBadge}
|
|
|
|
i18n={i18n}
|
|
|
|
me={me}
|
2022-11-01 17:34:23 +00:00
|
|
|
getConversationByUuid={getConversationByUuid}
|
2022-07-21 00:07:09 +00:00
|
|
|
onDeleteList={deleteDistributionList}
|
2022-11-01 17:34:23 +00:00
|
|
|
toggleGroupsForStorySend={toggleGroupsForStorySend}
|
2022-07-21 00:07:09 +00:00
|
|
|
onDistributionListCreated={createDistributionList}
|
|
|
|
onHideMyStoriesFrom={hideMyStoriesFrom}
|
2022-11-11 04:10:30 +00:00
|
|
|
onRemoveMembers={removeMembersFromDistributionList}
|
2022-07-21 00:07:09 +00:00
|
|
|
onRepliesNReactionsChanged={allowsRepliesChanged}
|
|
|
|
onViewersUpdated={updateStoryViewers}
|
|
|
|
setMyStoriesToAllSignalConnections={setMyStoriesToAllSignalConnections}
|
2022-10-25 22:18:42 +00:00
|
|
|
storyViewReceiptsEnabled={storyViewReceiptsEnabled}
|
2022-07-21 00:07:09 +00:00
|
|
|
toggleSignalConnectionsModal={toggleSignalConnectionsModal}
|
2022-10-26 23:17:39 +00:00
|
|
|
toggleStoriesView={toggleStoriesView}
|
|
|
|
setStoriesDisabled={setStoriesDisabled}
|
2022-07-21 00:07:09 +00:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|