Moves various panels out to ConversationView react

This commit is contained in:
Josh Perez 2022-12-14 20:10:09 -05:00 committed by GitHub
parent 15efbde23d
commit e142cb47f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 287 additions and 473 deletions

View file

@ -92,7 +92,7 @@ const useProps = (overrideProps: Partial<Props> = {}): Props => ({
blessedPacks: [], blessedPacks: [],
recentStickers: [], recentStickers: [],
clearInstalledStickerPack: action('clearInstalledStickerPack'), clearInstalledStickerPack: action('clearInstalledStickerPack'),
onClickAddPack: action('onClickAddPack'), pushPanelForConversation: action('pushPanelForConversation'),
sendStickerMessage: action('sendStickerMessage'), sendStickerMessage: action('sendStickerMessage'),
clearShowIntroduction: action('clearShowIntroduction'), clearShowIntroduction: action('clearShowIntroduction'),
showPickerHint: false, showPickerHint: false,

View file

@ -42,6 +42,7 @@ import { AudioCapture } from './conversation/AudioCapture';
import { CompositionUpload } from './CompositionUpload'; import { CompositionUpload } from './CompositionUpload';
import type { import type {
ConversationType, ConversationType,
PushPanelForConversationActionType,
ShowConversationType, ShowConversationType,
} from '../state/ducks/conversations'; } from '../state/ducks/conversations';
import type { EmojiPickDataType } from './emoji/EmojiPicker'; import type { EmojiPickDataType } from './emoji/EmojiPicker';
@ -61,6 +62,7 @@ import { MediaEditor } from './MediaEditor';
import { isImageTypeSupported } from '../util/GoogleChrome'; import { isImageTypeSupported } from '../util/GoogleChrome';
import * as KeyboardLayout from '../services/keyboardLayout'; import * as KeyboardLayout from '../services/keyboardLayout';
import { usePrevious } from '../hooks/usePrevious'; import { usePrevious } from '../hooks/usePrevious';
import { PanelType } from '../types/Panels';
export type OwnProps = Readonly<{ export type OwnProps = Readonly<{
acceptedMessageRequest?: boolean; acceptedMessageRequest?: boolean;
@ -162,15 +164,15 @@ export type Props = Pick<
| 'blessedPacks' | 'blessedPacks'
| 'recentStickers' | 'recentStickers'
| 'clearInstalledStickerPack' | 'clearInstalledStickerPack'
| 'onClickAddPack'
| 'clearShowIntroduction' | 'clearShowIntroduction'
| 'showPickerHint' | 'showPickerHint'
| 'clearShowPickerHint' | 'clearShowPickerHint'
> & > &
MessageRequestActionsProps & MessageRequestActionsProps &
Pick<GroupV1DisabledActionsPropsType, 'showGV2MigrationDialog'> & Pick<GroupV1DisabledActionsPropsType, 'showGV2MigrationDialog'> &
Pick<GroupV2PendingApprovalActionsPropsType, 'onCancelJoinRequest'> & Pick<GroupV2PendingApprovalActionsPropsType, 'onCancelJoinRequest'> & {
OwnProps; pushPanelForConversation: PushPanelForConversationActionType;
} & OwnProps;
export function CompositionArea({ export function CompositionArea({
// Base props // Base props
@ -182,6 +184,7 @@ export function CompositionArea({
isDisabled, isDisabled,
isSignalConversation, isSignalConversation,
messageCompositionId, messageCompositionId,
pushPanelForConversation,
processAttachments, processAttachments,
removeAttachment, removeAttachment,
sendMultiMediaMessage, sendMultiMediaMessage,
@ -232,7 +235,6 @@ export function CompositionArea({
blessedPacks, blessedPacks,
recentStickers, recentStickers,
clearInstalledStickerPack, clearInstalledStickerPack,
onClickAddPack,
sendStickerMessage, sendStickerMessage,
clearShowIntroduction, clearShowIntroduction,
showPickerHint, showPickerHint,
@ -459,7 +461,11 @@ export function CompositionArea({
blessedPacks={blessedPacks} blessedPacks={blessedPacks}
recentStickers={recentStickers} recentStickers={recentStickers}
clearInstalledStickerPack={clearInstalledStickerPack} clearInstalledStickerPack={clearInstalledStickerPack}
onClickAddPack={onClickAddPack} onClickAddPack={() =>
pushPanelForConversation(conversationId, {
type: PanelType.StickerManager,
})
}
onPickSticker={(packId, stickerId) => onPickSticker={(packId, stickerId) =>
sendStickerMessage(conversationId, { packId, stickerId }) sendStickerMessage(conversationId, { packId, stickerId })
} }

View file

@ -56,16 +56,15 @@ const MESSAGE_DEFAULT_PROPS = {
markAttachmentAsCorrupted: shouldNeverBeCalled, markAttachmentAsCorrupted: shouldNeverBeCalled,
markViewed: shouldNeverBeCalled, markViewed: shouldNeverBeCalled,
messageExpanded: shouldNeverBeCalled, messageExpanded: shouldNeverBeCalled,
// Called when clicking mention, but shouldn't do anything.
showConversation: noop,
openGiftBadge: shouldNeverBeCalled, openGiftBadge: shouldNeverBeCalled,
openLink: shouldNeverBeCalled, openLink: shouldNeverBeCalled,
previews: [], previews: [],
pushPanelForConversation: shouldNeverBeCalled,
renderAudioAttachment: () => <div />, renderAudioAttachment: () => <div />,
saveAttachment: shouldNeverBeCalled, saveAttachment: shouldNeverBeCalled,
scrollToQuotedMessage: shouldNeverBeCalled, scrollToQuotedMessage: shouldNeverBeCalled,
showContactDetail: shouldNeverBeCalled,
showContactModal: shouldNeverBeCalled, showContactModal: shouldNeverBeCalled,
showConversation: noop,
showExpiredIncomingTapToViewToast: shouldNeverBeCalled, showExpiredIncomingTapToViewToast: shouldNeverBeCalled,
showExpiredOutgoingTapToViewToast: shouldNeverBeCalled, showExpiredOutgoingTapToViewToast: shouldNeverBeCalled,
showLightbox: shouldNeverBeCalled, showLightbox: shouldNeverBeCalled,

View file

@ -49,12 +49,12 @@ const commonProps = {
), ),
onShowAllMedia: action('onShowAllMedia'), onShowAllMedia: action('onShowAllMedia'),
onShowGroupMembers: action('onShowGroupMembers'),
onGoBack: action('onGoBack'), onGoBack: action('onGoBack'),
onArchive: action('onArchive'), onArchive: action('onArchive'),
onMarkUnread: action('onMarkUnread'), onMarkUnread: action('onMarkUnread'),
onMoveToInbox: action('onMoveToInbox'), onMoveToInbox: action('onMoveToInbox'),
pushPanelForConversation: action('pushPanelForConversation'),
setMuteExpiration: action('onSetMuteNotifications'), setMuteExpiration: action('onSetMuteNotifications'),
setPinned: action('setPinned'), setPinned: action('setPinned'),
viewUserStories: action('viewUserStories'), viewUserStories: action('viewUserStories'),

View file

@ -18,7 +18,10 @@ import { Avatar, AvatarSize } from '../Avatar';
import { InContactsIcon } from '../InContactsIcon'; import { InContactsIcon } from '../InContactsIcon';
import type { LocalizerType, ThemeType } from '../../types/Util'; import type { LocalizerType, ThemeType } from '../../types/Util';
import type { ConversationType } from '../../state/ducks/conversations'; import type {
ConversationType,
PushPanelForConversationActionType,
} from '../../state/ducks/conversations';
import type { BadgeType } from '../../badges/types'; import type { BadgeType } from '../../badges/types';
import type { HasStories } from '../../types/Stories'; import type { HasStories } from '../../types/Stories';
import type { ViewUserStoriesActionCreatorType } from '../../state/ducks/stories'; import type { ViewUserStoriesActionCreatorType } from '../../state/ducks/stories';
@ -34,6 +37,7 @@ import {
useStartCallShortcuts, useStartCallShortcuts,
useKeyboardShortcuts, useKeyboardShortcuts,
} from '../../hooks/useKeyboardShortcuts'; } from '../../hooks/useKeyboardShortcuts';
import { PanelType } from '../../types/Panels';
export enum OutgoingCallButtonStyle { export enum OutgoingCallButtonStyle {
None, None,
@ -90,7 +94,7 @@ export type PropsActionsType = {
onSearchInConversation: () => void; onSearchInConversation: () => void;
onShowAllMedia: () => void; onShowAllMedia: () => void;
onShowConversationDetails: () => void; onShowConversationDetails: () => void;
onShowGroupMembers: () => void; pushPanelForConversation: PushPanelForConversationActionType;
setDisappearingMessages: ( setDisappearingMessages: (
conversationId: string, conversationId: string,
seconds: DurationInSeconds seconds: DurationInSeconds
@ -349,7 +353,7 @@ export class ConversationHeader extends React.Component<PropsType, StateType> {
onMoveToInbox, onMoveToInbox,
onShowAllMedia, onShowAllMedia,
onShowConversationDetails, onShowConversationDetails,
onShowGroupMembers, pushPanelForConversation,
setDisappearingMessages, setDisappearingMessages,
setMuteExpiration, setMuteExpiration,
setPinned, setPinned,
@ -478,7 +482,11 @@ export class ConversationHeader extends React.Component<PropsType, StateType> {
</MenuItem> </MenuItem>
) : null} ) : null}
{isGroup && !hasGV2AdminEnabled ? ( {isGroup && !hasGV2AdminEnabled ? (
<MenuItem onClick={onShowGroupMembers}> <MenuItem
onClick={() =>
pushPanelForConversation(id, { type: PanelType.GroupV1Members })
}
>
{i18n('showMembers')} {i18n('showMembers')}
</MenuItem> </MenuItem>
) : null} ) : null}

View file

@ -14,6 +14,7 @@ import type {
ConversationType, ConversationType,
ConversationTypeType, ConversationTypeType,
InteractionModeType, InteractionModeType,
PushPanelForConversationActionType,
SaveAttachmentActionCreatorType, SaveAttachmentActionCreatorType,
ShowConversationType, ShowConversationType,
} from '../../state/ducks/conversations'; } from '../../state/ducks/conversations';
@ -89,6 +90,7 @@ import { PaymentEventKind } from '../../types/Payment';
import type { AnyPaymentEvent } from '../../types/Payment'; import type { AnyPaymentEvent } from '../../types/Payment';
import { Emojify } from './Emojify'; import { Emojify } from './Emojify';
import { getPaymentEventDescription } from '../../messages/helpers'; import { getPaymentEventDescription } from '../../messages/helpers';
import { PanelType } from '../../types/Panels';
const GUESS_METADATA_WIDTH_TIMESTAMP_SIZE = 10; const GUESS_METADATA_WIDTH_TIMESTAMP_SIZE = 10;
const GUESS_METADATA_WIDTH_EXPIRE_TIMER_SIZE = 18; const GUESS_METADATA_WIDTH_EXPIRE_TIMER_SIZE = 18;
@ -302,13 +304,7 @@ export type PropsActions = {
startConversation: (e164: string, uuid: UUIDStringType) => void; startConversation: (e164: string, uuid: UUIDStringType) => void;
showConversation: ShowConversationType; showConversation: ShowConversationType;
openGiftBadge: (messageId: string) => void; openGiftBadge: (messageId: string) => void;
showContactDetail: (options: { pushPanelForConversation: PushPanelForConversationActionType;
contact: EmbeddedContactType;
signalAccount?: {
phoneNumber: string;
uuid: UUIDStringType;
};
}) => void;
showContactModal: (contactId: string, conversationId?: string) => void; showContactModal: (contactId: string, conversationId?: string) => void;
kickOffAttachmentDownload: (options: { kickOffAttachmentDownload: (options: {
@ -1566,10 +1562,11 @@ export class Message extends React.PureComponent<Props, State> {
public renderEmbeddedContact(): JSX.Element | null { public renderEmbeddedContact(): JSX.Element | null {
const { const {
contact, contact,
conversationId,
conversationType, conversationType,
direction, direction,
i18n, i18n,
showContactDetail, pushPanelForConversation,
text, text,
} = this.props; } = this.props;
if (!contact) { if (!contact) {
@ -1601,9 +1598,12 @@ export class Message extends React.PureComponent<Props, State> {
} }
: undefined; : undefined;
showContactDetail({ pushPanelForConversation(conversationId, {
type: PanelType.ContactDetails,
args: {
contact, contact,
signalAccount, signalAccount,
},
}); });
}} }}
withContentAbove={withContentAbove} withContentAbove={withContentAbove}
@ -2238,6 +2238,7 @@ export class Message extends React.PureComponent<Props, State> {
const { const {
attachments, attachments,
contact, contact,
conversationId,
showLightboxForViewOnceMedia, showLightboxForViewOnceMedia,
direction, direction,
giftBadge, giftBadge,
@ -2247,7 +2248,7 @@ export class Message extends React.PureComponent<Props, State> {
kickOffAttachmentDownload, kickOffAttachmentDownload,
startConversation, startConversation,
openGiftBadge, openGiftBadge,
showContactDetail, pushPanelForConversation,
showLightbox, showLightbox,
showExpiredIncomingTapToViewToast, showExpiredIncomingTapToViewToast,
showExpiredOutgoingTapToViewToast, showExpiredOutgoingTapToViewToast,
@ -2374,7 +2375,13 @@ export class Message extends React.PureComponent<Props, State> {
uuid: contact.uuid, uuid: contact.uuid,
} }
: undefined; : undefined;
showContactDetail({ contact, signalAccount }); pushPanelForConversation(conversationId, {
type: PanelType.ContactDetails,
args: {
contact,
signalAccount,
},
});
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();

View file

@ -83,7 +83,7 @@ const createProps = (overrideProps: Partial<Props> = {}): Props => ({
openLink: action('openLink'), openLink: action('openLink'),
renderAudioAttachment: () => <div>*AudioAttachment*</div>, renderAudioAttachment: () => <div>*AudioAttachment*</div>,
saveAttachment: action('saveAttachment'), saveAttachment: action('saveAttachment'),
showContactDetail: action('showContactDetail'), pushPanelForConversation: action('pushPanelForConversation'),
showContactModal: action('showContactModal'), showContactModal: action('showContactModal'),
showExpiredIncomingTapToViewToast: action( showExpiredIncomingTapToViewToast: action(
'showExpiredIncomingTapToViewToast' 'showExpiredIncomingTapToViewToast'

View file

@ -84,7 +84,6 @@ export type PropsBackboneActions = Pick<
| 'openGiftBadge' | 'openGiftBadge'
| 'openLink' | 'openLink'
| 'renderAudioAttachment' | 'renderAudioAttachment'
| 'showContactDetail'
| 'showExpiredIncomingTapToViewToast' | 'showExpiredIncomingTapToViewToast'
| 'showExpiredOutgoingTapToViewToast' | 'showExpiredOutgoingTapToViewToast'
| 'startConversation' | 'startConversation'
@ -95,6 +94,7 @@ export type PropsReduxActions = Pick<
| 'checkForAccount' | 'checkForAccount'
| 'clearSelectedMessage' | 'clearSelectedMessage'
| 'doubleCheckMissingQuoteReference' | 'doubleCheckMissingQuoteReference'
| 'pushPanelForConversation'
| 'saveAttachment' | 'saveAttachment'
| 'showContactModal' | 'showContactModal'
| 'showConversation' | 'showConversation'
@ -292,9 +292,9 @@ export class MessageDetail extends React.Component<Props> {
markViewed, markViewed,
openGiftBadge, openGiftBadge,
openLink, openLink,
pushPanelForConversation,
renderAudioAttachment, renderAudioAttachment,
saveAttachment, saveAttachment,
showContactDetail,
showContactModal, showContactModal,
showConversation, showConversation,
showExpiredIncomingTapToViewToast, showExpiredIncomingTapToViewToast,
@ -339,6 +339,7 @@ export class MessageDetail extends React.Component<Props> {
showConversation={showConversation} showConversation={showConversation}
openGiftBadge={openGiftBadge} openGiftBadge={openGiftBadge}
openLink={openLink} openLink={openLink}
pushPanelForConversation={pushPanelForConversation}
renderAudioAttachment={renderAudioAttachment} renderAudioAttachment={renderAudioAttachment}
saveAttachment={saveAttachment} saveAttachment={saveAttachment}
shouldCollapseAbove={false} shouldCollapseAbove={false}
@ -347,7 +348,6 @@ export class MessageDetail extends React.Component<Props> {
scrollToQuotedMessage={() => { scrollToQuotedMessage={() => {
log.warn('MessageDetail: scrollToQuotedMessage called!'); log.warn('MessageDetail: scrollToQuotedMessage called!');
}} }}
showContactDetail={showContactDetail}
showContactModal={showContactModal} showContactModal={showContactModal}
showExpiredIncomingTapToViewToast={ showExpiredIncomingTapToViewToast={
showExpiredIncomingTapToViewToast showExpiredIncomingTapToViewToast

View file

@ -130,7 +130,7 @@ const defaultMessageProps: TimelineMessagesProps = {
shouldCollapseAbove: false, shouldCollapseAbove: false,
shouldCollapseBelow: false, shouldCollapseBelow: false,
shouldHideMetadata: false, shouldHideMetadata: false,
showContactDetail: action('default--showContactDetail'), pushPanelForConversation: action('default--pushPanelForConversation'),
showContactModal: action('default--showContactModal'), showContactModal: action('default--showContactModal'),
showExpiredIncomingTapToViewToast: action( showExpiredIncomingTapToViewToast: action(
'showExpiredIncomingTapToViewToast' 'showExpiredIncomingTapToViewToast'

View file

@ -283,7 +283,7 @@ const actions = () => ({
deleteMessageForEveryone: action('deleteMessageForEveryone'), deleteMessageForEveryone: action('deleteMessageForEveryone'),
showMessageDetail: action('showMessageDetail'), showMessageDetail: action('showMessageDetail'),
saveAttachment: action('saveAttachment'), saveAttachment: action('saveAttachment'),
showContactDetail: action('showContactDetail'), pushPanelForConversation: action('pushPanelForConversation'),
showContactModal: action('showContactModal'), showContactModal: action('showContactModal'),
showConversation: action('showConversation'), showConversation: action('showConversation'),
kickOffAttachmentDownload: action('kickOffAttachmentDownload'), kickOffAttachmentDownload: action('kickOffAttachmentDownload'),

View file

@ -248,7 +248,6 @@ const getActions = createSelector(
'showMessageDetail', 'showMessageDetail',
'openGiftBadge', 'openGiftBadge',
'setQuoteByMessageId', 'setQuoteByMessageId',
'showContactDetail',
'showContactModal', 'showContactModal',
'kickOffAttachmentDownload', 'kickOffAttachmentDownload',
'markAttachmentAsCorrupted', 'markAttachmentAsCorrupted',
@ -257,6 +256,7 @@ const getActions = createSelector(
'showLightbox', 'showLightbox',
'showLightboxForViewOnceMedia', 'showLightboxForViewOnceMedia',
'openLink', 'openLink',
'pushPanelForConversation',
'scrollToQuotedMessage', 'scrollToQuotedMessage',
'showExpiredIncomingTapToViewToast', 'showExpiredIncomingTapToViewToast',
'showExpiredOutgoingTapToViewToast', 'showExpiredOutgoingTapToViewToast',

View file

@ -81,7 +81,7 @@ const getDefaultProps = () => ({
showConversation: action('showConversation'), showConversation: action('showConversation'),
openGiftBadge: action('openGiftBadge'), openGiftBadge: action('openGiftBadge'),
saveAttachment: action('saveAttachment'), saveAttachment: action('saveAttachment'),
showContactDetail: action('showContactDetail'), pushPanelForConversation: action('pushPanelForConversation'),
showContactModal: action('showContactModal'), showContactModal: action('showContactModal'),
showLightbox: action('showLightbox'), showLightbox: action('showLightbox'),
toggleForwardMessageModal: action('toggleForwardMessageModal'), toggleForwardMessageModal: action('toggleForwardMessageModal'),

View file

@ -308,7 +308,7 @@ const createProps = (overrideProps: Partial<Props> = {}): Props => ({
shouldHideMetadata: isBoolean(overrideProps.shouldHideMetadata) shouldHideMetadata: isBoolean(overrideProps.shouldHideMetadata)
? overrideProps.shouldHideMetadata ? overrideProps.shouldHideMetadata
: false, : false,
showContactDetail: action('showContactDetail'), pushPanelForConversation: action('pushPanelForConversation'),
showContactModal: action('showContactModal'), showContactModal: action('showContactModal'),
showExpiredIncomingTapToViewToast: action( showExpiredIncomingTapToViewToast: action(
'showExpiredIncomingTapToViewToast' 'showExpiredIncomingTapToViewToast'

View file

@ -81,13 +81,7 @@ const createProps = (
showAllMedia: action('showAllMedia'), showAllMedia: action('showAllMedia'),
showContactModal: action('showContactModal'), showContactModal: action('showContactModal'),
pushPanelForConversation: action('pushPanelForConversation'), pushPanelForConversation: action('pushPanelForConversation'),
showGroupLinkManagement: action('showGroupLinkManagement'),
showGroupV2Permissions: action('showGroupV2Permissions'),
showConversationNotificationsSettings: action(
'showConversationNotificationsSettings'
),
showConversation: action('showConversation'), showConversation: action('showConversation'),
showPendingInvites: action('showPendingInvites'),
showLightboxWithMedia: action('showLightboxWithMedia'), showLightboxWithMedia: action('showLightboxWithMedia'),
updateGroupAttributes: async () => { updateGroupAttributes: async () => {
action('updateGroupAttributes')(); action('updateGroupAttributes')();

View file

@ -82,10 +82,6 @@ export type StateProps = {
pendingApprovalMemberships: ReadonlyArray<GroupV2RequestingMembership>; pendingApprovalMemberships: ReadonlyArray<GroupV2RequestingMembership>;
pendingMemberships: ReadonlyArray<GroupV2PendingMembership>; pendingMemberships: ReadonlyArray<GroupV2PendingMembership>;
showAllMedia: () => void; showAllMedia: () => void;
showGroupLinkManagement: () => void;
showGroupV2Permissions: () => void;
showPendingInvites: () => void;
showConversationNotificationsSettings: () => void;
updateGroupAttributes: ( updateGroupAttributes: (
_: Readonly<{ _: Readonly<{
avatar?: undefined | Uint8Array; avatar?: undefined | Uint8Array;
@ -161,12 +157,8 @@ export function ConversationDetails({
setMuteExpiration, setMuteExpiration,
showAllMedia, showAllMedia,
showContactModal, showContactModal,
showConversationNotificationsSettings,
showConversation, showConversation,
showGroupLinkManagement,
showGroupV2Permissions,
showLightboxWithMedia, showLightboxWithMedia,
showPendingInvites,
theme, theme,
toggleSafetyNumberModal, toggleSafetyNumberModal,
toggleAddUserToAnotherGroupModal, toggleAddUserToAnotherGroupModal,
@ -451,7 +443,11 @@ export function ConversationDetails({
/> />
} }
label={i18n('ConversationDetails--notifications')} label={i18n('ConversationDetails--notifications')}
onClick={showConversationNotificationsSettings} onClick={() =>
pushPanelForConversation(conversation.id, {
type: PanelType.NotificationSettings,
})
}
right={ right={
conversation.muteExpiresAt conversation.muteExpiresAt
? getMutedUntilText(conversation.muteExpiresAt, i18n) ? getMutedUntilText(conversation.muteExpiresAt, i18n)
@ -503,7 +499,11 @@ export function ConversationDetails({
/> />
} }
label={i18n('ConversationDetails--group-link')} label={i18n('ConversationDetails--group-link')}
onClick={showGroupLinkManagement} onClick={() =>
pushPanelForConversation(conversation.id, {
type: PanelType.GroupLinkManagement,
})
}
right={hasGroupLink ? i18n('on') : i18n('off')} right={hasGroupLink ? i18n('on') : i18n('off')}
/> />
) : null} ) : null}
@ -515,7 +515,11 @@ export function ConversationDetails({
/> />
} }
label={i18n('ConversationDetails--requests-and-invites')} label={i18n('ConversationDetails--requests-and-invites')}
onClick={showPendingInvites} onClick={() =>
pushPanelForConversation(conversation.id, {
type: PanelType.GroupInvites,
})
}
right={invitesCount} right={invitesCount}
/> />
{isAdmin ? ( {isAdmin ? (
@ -527,7 +531,11 @@ export function ConversationDetails({
/> />
} }
label={i18n('permissions')} label={i18n('permissions')}
onClick={showGroupV2Permissions} onClick={() =>
pushPanelForConversation(conversation.id, {
type: PanelType.GroupPermissions,
})
}
/> />
) : null} ) : null}
</PanelSection> </PanelSection>

View file

@ -26,14 +26,9 @@ import { DisappearingTimeDialog } from './components/DisappearingTimeDialog';
// State // State
import { createConversationDetails } from './state/roots/createConversationDetails'; import { createConversationDetails } from './state/roots/createConversationDetails';
import { createApp } from './state/roots/createApp'; import { createApp } from './state/roots/createApp';
import { createGroupLinkManagement } from './state/roots/createGroupLinkManagement';
import { createGroupV2JoinModal } from './state/roots/createGroupV2JoinModal'; import { createGroupV2JoinModal } from './state/roots/createGroupV2JoinModal';
import { createMessageDetail } from './state/roots/createMessageDetail'; import { createMessageDetail } from './state/roots/createMessageDetail';
import { createConversationNotificationsSettings } from './state/roots/createConversationNotificationsSettings';
import { createGroupV2Permissions } from './state/roots/createGroupV2Permissions';
import { createPendingInvites } from './state/roots/createPendingInvites';
import { createSafetyNumberViewer } from './state/roots/createSafetyNumberViewer'; import { createSafetyNumberViewer } from './state/roots/createSafetyNumberViewer';
import { createStickerManager } from './state/roots/createStickerManager';
import { createShortcutGuideModal } from './state/roots/createShortcutGuideModal'; import { createShortcutGuideModal } from './state/roots/createShortcutGuideModal';
import { createStore } from './state/createStore'; import { createStore } from './state/createStore';
@ -401,15 +396,10 @@ export const setup = (options: {
const Roots = { const Roots = {
createApp, createApp,
createConversationDetails, createConversationDetails,
createGroupLinkManagement,
createGroupV2JoinModal, createGroupV2JoinModal,
createGroupV2Permissions,
createMessageDetail, createMessageDetail,
createConversationNotificationsSettings,
createPendingInvites,
createSafetyNumberViewer, createSafetyNumberViewer,
createShortcutGuideModal, createShortcutGuideModal,
createStickerManager,
}; };
const Ducks = { const Ducks = {

View file

@ -15,6 +15,7 @@ import type {
AttachmentDraftType, AttachmentDraftType,
InMemoryAttachmentDraftType, InMemoryAttachmentDraftType,
} from '../../types/Attachment'; } from '../../types/Attachment';
import type { BoundActionCreatorsMapObject } from '../../hooks/useBoundActions';
import type { import type {
DraftBodyRangesType, DraftBodyRangesType,
ReplacementValuesType, ReplacementValuesType,
@ -66,6 +67,7 @@ import { writeDraftAttachment } from '../../util/writeDraftAttachment';
import { getMessageById } from '../../messages/getMessageById'; import { getMessageById } from '../../messages/getMessageById';
import { canReply } from '../selectors/message'; import { canReply } from '../selectors/message';
import { getConversationSelector } from '../selectors/conversations'; import { getConversationSelector } from '../selectors/conversations';
import { useBoundActions } from '../../hooks/useBoundActions';
// State // State
@ -153,6 +155,10 @@ export const actions = {
setQuotedMessage, setQuotedMessage,
}; };
export const useComposerActions = (): BoundActionCreatorsMapObject<
typeof actions
> => useBoundActions(actions);
function sendMultiMediaMessage( function sendMultiMediaMessage(
conversationId: string, conversationId: string,
options: { options: {

View file

@ -1,19 +0,0 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import * as React from 'react';
import { Provider } from 'react-redux';
import type { Store } from 'redux';
import type { OwnProps } from '../smart/ConversationNotificationsSettings';
import { SmartConversationNotificationsSettings } from '../smart/ConversationNotificationsSettings';
export const createConversationNotificationsSettings = (
store: Store,
props: OwnProps
): React.ReactElement => (
<Provider store={store}>
<SmartConversationNotificationsSettings {...props} />
</Provider>
);

View file

@ -1,19 +0,0 @@
// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React from 'react';
import { Provider } from 'react-redux';
import type { Store } from 'redux';
import type { SmartGroupLinkManagementProps } from '../smart/GroupLinkManagement';
import { SmartGroupLinkManagement } from '../smart/GroupLinkManagement';
export const createGroupLinkManagement = (
store: Store,
props: SmartGroupLinkManagementProps
): React.ReactElement => (
<Provider store={store}>
<SmartGroupLinkManagement {...props} />
</Provider>
);

View file

@ -1,19 +0,0 @@
// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React from 'react';
import { Provider } from 'react-redux';
import type { Store } from 'redux';
import type { SmartGroupV2PermissionsProps } from '../smart/GroupV2Permissions';
import { SmartGroupV2Permissions } from '../smart/GroupV2Permissions';
export const createGroupV2Permissions = (
store: Store,
props: SmartGroupV2PermissionsProps
): React.ReactElement => (
<Provider store={store}>
<SmartGroupV2Permissions {...props} />
</Provider>
);

View file

@ -1,19 +0,0 @@
// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React from 'react';
import { Provider } from 'react-redux';
import type { Store } from 'redux';
import type { SmartPendingInvitesProps } from '../smart/PendingInvites';
import { SmartPendingInvites } from '../smart/PendingInvites';
export const createPendingInvites = (
store: Store,
props: SmartPendingInvitesProps
): React.ReactElement => (
<Provider store={store}>
<SmartPendingInvites {...props} />
</Provider>
);

View file

@ -1,15 +0,0 @@
// Copyright 2019-2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React from 'react';
import { Provider } from 'react-redux';
import type { Store } from 'redux';
import { SmartStickerManager } from '../smart/StickerManager';
export const createStickerManager = (store: Store): React.ReactElement => (
<Provider store={store}>
<SmartStickerManager />
</Provider>
);

View file

@ -38,10 +38,6 @@ export type SmartConversationDetailsProps = {
addMembers: (conversationIds: ReadonlyArray<string>) => Promise<void>; addMembers: (conversationIds: ReadonlyArray<string>) => Promise<void>;
conversationId: string; conversationId: string;
showAllMedia: () => void; showAllMedia: () => void;
showGroupLinkManagement: () => void;
showGroupV2Permissions: () => void;
showConversationNotificationsSettings: () => void;
showPendingInvites: () => void;
updateGroupAttributes: ( updateGroupAttributes: (
_: Readonly<{ _: Readonly<{
avatar?: undefined | Uint8Array; avatar?: undefined | Uint8Array;

View file

@ -37,7 +37,6 @@ export type OwnProps = {
onSearchInConversation: () => void; onSearchInConversation: () => void;
onShowAllMedia: () => void; onShowAllMedia: () => void;
onShowConversationDetails: () => void; onShowConversationDetails: () => void;
onShowGroupMembers: () => void;
}; };
const getOutgoingCallButtonStyle = ( const getOutgoingCallButtonStyle = (

View file

@ -1,21 +1,31 @@
// Copyright 2021 Signal Messenger, LLC // Copyright 2021-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
import React from 'react'; import React from 'react';
import { connect } from 'react-redux'; import { useSelector } from 'react-redux';
import type { CompositionAreaPropsType } from './CompositionArea'; import type { CompositionAreaPropsType } from './CompositionArea';
import type { OwnProps as ConversationHeaderPropsType } from './ConversationHeader'; import type { OwnProps as ConversationHeaderPropsType } from './ConversationHeader';
import type { StateType } from '../reducer'; import type { StateType } from '../reducer';
import type { ReactPanelRenderType } from '../../types/Panels';
import type { TimelinePropsType } from './Timeline'; import type { TimelinePropsType } from './Timeline';
import * as log from '../../logging/log'; import * as log from '../../logging/log';
import { ContactDetail } from '../../components/conversation/ContactDetail';
import { ConversationView } from '../../components/conversation/ConversationView'; import { ConversationView } from '../../components/conversation/ConversationView';
import { PanelType } from '../../types/Panels'; import { PanelType } from '../../types/Panels';
import { SmartChatColorPicker } from './ChatColorPicker'; import { SmartChatColorPicker } from './ChatColorPicker';
import { SmartCompositionArea } from './CompositionArea'; import { SmartCompositionArea } from './CompositionArea';
import { SmartConversationNotificationsSettings } from './ConversationNotificationsSettings';
import { SmartConversationHeader } from './ConversationHeader'; import { SmartConversationHeader } from './ConversationHeader';
import { SmartGroupLinkManagement } from './GroupLinkManagement';
import { SmartGroupV2Permissions } from './GroupV2Permissions';
import { SmartGV1Members } from './GV1Members';
import { SmartPendingInvites } from './PendingInvites';
import { SmartStickerManager } from './StickerManager';
import { SmartTimeline } from './Timeline'; import { SmartTimeline } from './Timeline';
import { getIntl } from '../selectors/user';
import { getTopPanelRenderableByReact } from '../selectors/conversations'; import { getTopPanelRenderableByReact } from '../selectors/conversations';
import { mapDispatchToProps } from '../actions'; import { startConversation } from '../../util/startConversation';
import { useComposerActions } from '../ducks/composer';
export type PropsType = { export type PropsType = {
conversationId: string; conversationId: string;
@ -24,7 +34,6 @@ export type PropsType = {
| 'id' | 'id'
| 'onCancelJoinRequest' | 'onCancelJoinRequest'
| 'onClearAttachments' | 'onClearAttachments'
| 'onClickAddPack'
| 'onCloseLinkPreview' | 'onCloseLinkPreview'
| 'onEditorStateChange' | 'onEditorStateChange'
| 'onSelectMediaQuality' | 'onSelectMediaQuality'
@ -34,26 +43,31 @@ export type PropsType = {
timelineProps: TimelinePropsType; timelineProps: TimelinePropsType;
}; };
const mapStateToProps = (state: StateType, props: PropsType) => { export function SmartConversationView({
const {
compositionAreaProps, compositionAreaProps,
conversationHeaderProps, conversationHeaderProps,
conversationId, conversationId,
timelineProps, timelineProps,
} = props; }: PropsType): JSX.Element {
const topPanel = useSelector<StateType, ReactPanelRenderType | undefined>(
getTopPanelRenderableByReact
);
const topPanel = getTopPanelRenderableByReact(state); const { processAttachments } = useComposerActions();
const i18n = useSelector(getIntl);
return { return (
conversationId, <ConversationView
renderCompositionArea: () => ( conversationId={conversationId}
processAttachments={processAttachments}
renderCompositionArea={() => (
<SmartCompositionArea {...compositionAreaProps} /> <SmartCompositionArea {...compositionAreaProps} />
), )}
renderConversationHeader: () => ( renderConversationHeader={() => (
<SmartConversationHeader {...conversationHeaderProps} /> <SmartConversationHeader {...conversationHeaderProps} />
), )}
renderTimeline: () => <SmartTimeline {...timelineProps} />, renderTimeline={() => <SmartTimeline {...timelineProps} />}
renderPanel: () => { renderPanel={() => {
if (!topPanel) { if (!topPanel) {
return; return;
} }
@ -66,14 +80,85 @@ const mapStateToProps = (state: StateType, props: PropsType) => {
); );
} }
const unknownPanelType: never = topPanel.type; if (topPanel.type === PanelType.ContactDetails) {
log.warn(`renderPanel: Got unexpected panel type ${unknownPanelType}`); const { contact, signalAccount } = topPanel.args;
return (
<div className="panel">
<ContactDetail
contact={contact}
hasSignalAccount={Boolean(signalAccount)}
i18n={i18n}
onSendMessage={() => {
if (signalAccount) {
startConversation(
signalAccount.phoneNumber,
signalAccount.uuid
);
}
}}
/>
</div>
);
}
if (topPanel.type === PanelType.GroupInvites) {
return (
<div className="panel">
<SmartPendingInvites
conversationId={conversationId}
ourUuid={window.storage.user.getCheckedUuid().toString()}
/>
</div>
);
}
if (topPanel.type === PanelType.GroupLinkManagement) {
return (
<div className="panel">
<SmartGroupLinkManagement conversationId={conversationId} />
</div>
);
}
if (topPanel.type === PanelType.GroupPermissions) {
return (
<div className="panel">
<SmartGroupV2Permissions conversationId={conversationId} />
</div>
);
}
if (topPanel.type === PanelType.GroupV1Members) {
return (
<div className="group-member-list panel">
<SmartGV1Members conversationId={conversationId} />
</div>
);
}
if (topPanel.type === PanelType.NotificationSettings) {
return (
<div className="panel">
<SmartConversationNotificationsSettings
conversationId={conversationId}
/>
</div>
);
}
if (topPanel.type === PanelType.StickerManager) {
return (
<div className="panel sticker-manager-wrapper">
<SmartStickerManager />
</div>
);
}
log.warn('renderPanel: Got unexpected panel', topPanel);
return undefined; return undefined;
}, }}
}; />
}; );
}
const smart = connect(mapStateToProps, mapDispatchToProps);
export const SmartConversationView = smart(ConversationView);

View file

@ -0,0 +1,54 @@
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React from 'react';
import { useSelector } from 'react-redux';
import { ConversationDetailsMembershipList } from '../../components/conversation/conversation-details/ConversationDetailsMembershipList';
import { assertDev } from '../../util/assert';
import { getGroupMemberships } from '../../util/getGroupMemberships';
import {
getConversationByIdSelector,
getConversationByUuidSelector,
} from '../selectors/conversations';
import { getIntl, getTheme } from '../selectors/user';
import { getPreferredBadgeSelector } from '../selectors/badges';
import { useGlobalModalActions } from '../ducks/globalModals';
export type PropsType = {
conversationId: string;
};
export function SmartGV1Members({ conversationId }: PropsType): JSX.Element {
const getPreferredBadge = useSelector(getPreferredBadgeSelector);
const i18n = useSelector(getIntl);
const theme = useSelector(getTheme);
const { showContactModal } = useGlobalModalActions();
const conversationSelector = useSelector(getConversationByIdSelector);
const conversationByUuidSelector = useSelector(getConversationByUuidSelector);
const conversation = conversationSelector(conversationId);
assertDev(
conversation,
'<SmartPendingInvites> expected a conversation to be found'
);
const { memberships } = getGroupMemberships(
conversation,
conversationByUuidSelector
);
return (
<ConversationDetailsMembershipList
canAddNewMembers={false}
conversationId={conversationId}
i18n={i18n}
getPreferredBadge={getPreferredBadge}
maxShownMemberCount={32}
memberships={memberships}
showContactModal={showContactModal}
theme={theme}
/>
);
}

View file

@ -44,7 +44,6 @@ const mapStateToProps = (
markAttachmentAsCorrupted, markAttachmentAsCorrupted,
openGiftBadge, openGiftBadge,
openLink, openLink,
showContactDetail,
showExpiredIncomingTapToViewToast, showExpiredIncomingTapToViewToast,
showExpiredOutgoingTapToViewToast, showExpiredOutgoingTapToViewToast,
startConversation, startConversation,
@ -79,7 +78,6 @@ const mapStateToProps = (
openGiftBadge, openGiftBadge,
openLink, openLink,
renderAudioAttachment, renderAudioAttachment,
showContactDetail,
showExpiredIncomingTapToViewToast, showExpiredIncomingTapToViewToast,
showExpiredOutgoingTapToViewToast, showExpiredOutgoingTapToViewToast,
startConversation, startConversation,

View file

@ -80,7 +80,6 @@ export type TimelinePropsType = ExternalProps &
| 'retryDeleteForEveryone' | 'retryDeleteForEveryone'
| 'retrySend' | 'retrySend'
| 'scrollToQuotedMessage' | 'scrollToQuotedMessage'
| 'showContactDetail'
| 'showExpiredIncomingTapToViewToast' | 'showExpiredIncomingTapToViewToast'
| 'showExpiredOutgoingTapToViewToast' | 'showExpiredOutgoingTapToViewToast'
| 'showMessageDetail' | 'showMessageDetail'

View file

@ -18,10 +18,8 @@ export enum PanelType {
StickerManager = 'StickerManager', StickerManager = 'StickerManager',
} }
export type ReactPanelRenderType = { type: PanelType.ChatColorEditor }; export type ReactPanelRenderType =
| { type: PanelType.ChatColorEditor }
export type BackbonePanelRenderType =
| { type: PanelType.AllMedia }
| { | {
type: PanelType.ContactDetails; type: PanelType.ContactDetails;
args: { args: {
@ -32,15 +30,18 @@ export type BackbonePanelRenderType =
}; };
}; };
} }
| { type: PanelType.ConversationDetails }
| { type: PanelType.GroupInvites } | { type: PanelType.GroupInvites }
| { type: PanelType.GroupLinkManagement } | { type: PanelType.GroupLinkManagement }
| { type: PanelType.GroupPermissions } | { type: PanelType.GroupPermissions }
| { type: PanelType.GroupV1Members } | { type: PanelType.GroupV1Members }
| { type: PanelType.MessageDetails; args: { messageId: string } }
| { type: PanelType.NotificationSettings } | { type: PanelType.NotificationSettings }
| { type: PanelType.StickerManager }; | { type: PanelType.StickerManager };
export type BackbonePanelRenderType =
| { type: PanelType.AllMedia }
| { type: PanelType.ConversationDetails }
| { type: PanelType.MessageDetails; args: { messageId: string } };
export type PanelRenderType = ReactPanelRenderType | BackbonePanelRenderType; export type PanelRenderType = ReactPanelRenderType | BackbonePanelRenderType;
export function isPanelHandledByReact( export function isPanelHandledByReact(
@ -50,5 +51,14 @@ export function isPanelHandledByReact(
return false; return false;
} }
return panel.type === PanelType.ChatColorEditor; return (
panel.type === PanelType.ChatColorEditor ||
panel.type === PanelType.ContactDetails ||
panel.type === PanelType.GroupInvites ||
panel.type === PanelType.GroupLinkManagement ||
panel.type === PanelType.GroupPermissions ||
panel.type === PanelType.GroupV1Members ||
panel.type === PanelType.NotificationSettings ||
panel.type === PanelType.StickerManager
);
} }

View file

@ -21,6 +21,10 @@ export function getConversationTitleForPanelType(
return i18n('ChatColorPicker__menu-title'); return i18n('ChatColorPicker__menu-title');
} }
if (panelType === PanelType.ContactDetails) {
return '';
}
if (panelType === PanelType.ConversationDetails) { if (panelType === PanelType.ConversationDetails) {
return ''; return '';
} }
@ -41,11 +45,13 @@ export function getConversationTitleForPanelType(
return i18n('ConversationDetails--notifications'); return i18n('ConversationDetails--notifications');
} }
if (panelType === PanelType.StickerManager) {
return '';
}
if ( if (
panelType === PanelType.ContactDetails ||
panelType === PanelType.GroupV1Members || panelType === PanelType.GroupV1Members ||
panelType === PanelType.MessageDetails || panelType === PanelType.MessageDetails
panelType === PanelType.StickerManager
) { ) {
return undefined; return undefined;
} }

View file

@ -19,14 +19,10 @@ import { strictAssert } from '../util/assert';
import { enqueueReactionForSend } from '../reactions/enqueueReactionForSend'; import { enqueueReactionForSend } from '../reactions/enqueueReactionForSend';
import type { GroupNameCollisionsWithIdsByTitle } from '../util/groupMemberNameCollisions'; import type { GroupNameCollisionsWithIdsByTitle } from '../util/groupMemberNameCollisions';
import { isGroup } from '../util/whatTypeOfConversation'; import { isGroup } from '../util/whatTypeOfConversation';
import { getPreferredBadgeSelector } from '../state/selectors/badges';
import { isIncoming } from '../state/selectors/message'; import { isIncoming } from '../state/selectors/message';
import { getActiveCallState } from '../state/selectors/calling'; import { getActiveCallState } from '../state/selectors/calling';
import { getTheme } from '../state/selectors/user';
import { ReactWrapperView } from './ReactWrapperView'; import { ReactWrapperView } from './ReactWrapperView';
import { ConversationDetailsMembershipList } from '../components/conversation/conversation-details/ConversationDetailsMembershipList';
import * as log from '../logging/log'; import * as log from '../logging/log';
import type { EmbeddedContactType } from '../types/EmbeddedContact';
import { createConversationView } from '../state/roots/createConversationView'; import { createConversationView } from '../state/roots/createConversationView';
import { ToastConversationArchived } from '../components/ToastConversationArchived'; import { ToastConversationArchived } from '../components/ToastConversationArchived';
import { ToastConversationMarkedUnread } from '../components/ToastConversationMarkedUnread'; import { ToastConversationMarkedUnread } from '../components/ToastConversationMarkedUnread';
@ -44,7 +40,6 @@ import { showToast } from '../util/showToast';
import { UUIDKind } from '../types/UUID'; import { UUIDKind } from '../types/UUID';
import type { UUIDStringType } from '../types/UUID'; import type { UUIDStringType } from '../types/UUID';
import { retryDeleteForEveryone } from '../util/retryDeleteForEveryone'; import { retryDeleteForEveryone } from '../util/retryDeleteForEveryone';
import { ContactDetail } from '../components/conversation/ContactDetail';
import { MediaGallery } from '../components/conversation/media-gallery/MediaGallery'; import { MediaGallery } from '../components/conversation/media-gallery/MediaGallery';
import type { ItemClickEvent } from '../components/conversation/media-gallery/types/ItemClickEvent'; import type { ItemClickEvent } from '../components/conversation/media-gallery/types/ItemClickEvent';
import { import {
@ -86,13 +81,6 @@ type MessageActionsType = {
) => unknown; ) => unknown;
retrySend: (messageId: string) => unknown; retrySend: (messageId: string) => unknown;
retryDeleteForEveryone: (messageId: string) => unknown; retryDeleteForEveryone: (messageId: string) => unknown;
showContactDetail: (options: {
contact: EmbeddedContactType;
signalAccount?: {
phoneNumber: string;
uuid: UUIDStringType;
};
}) => unknown;
showExpiredIncomingTapToViewToast: () => unknown; showExpiredIncomingTapToViewToast: () => unknown;
showExpiredOutgoingTapToViewToast: () => unknown; showExpiredOutgoingTapToViewToast: () => unknown;
showMessageDetail: (messageId: string) => unknown; showMessageDetail: (messageId: string) => unknown;
@ -202,9 +190,6 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
onShowAllMedia: () => { onShowAllMedia: () => {
this.showAllMedia(); this.showAllMedia();
}, },
onShowGroupMembers: () => {
this.showGV1Members();
},
onGoBack: () => { onGoBack: () => {
window.reduxActions.conversations.popPanelForConversation( window.reduxActions.conversations.popPanelForConversation(
this.model.id this.model.id
@ -342,7 +327,6 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
const compositionAreaProps = { const compositionAreaProps = {
id: this.model.id, id: this.model.id,
onClickAddPack: () => this.showStickerManager(),
onTextTooLong: () => showToast(ToastMessageBodyTooLong), onTextTooLong: () => showToast(ToastMessageBodyTooLong),
onCancelJoinRequest: async () => { onCancelJoinRequest: async () => {
await window.showConfirmationDialog({ await window.showConfirmationDialog({
@ -411,15 +395,6 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
const showMessageDetail = (messageId: string) => { const showMessageDetail = (messageId: string) => {
this.showMessageDetail(messageId); this.showMessageDetail(messageId);
}; };
const showContactDetail = (options: {
contact: EmbeddedContactType;
signalAccount?: {
phoneNumber: string;
uuid: UUIDStringType;
};
}) => {
this.showContactDetail(options);
};
const kickOffAttachmentDownload = async ( const kickOffAttachmentDownload = async (
options: Readonly<{ messageId: string }> options: Readonly<{ messageId: string }>
) => { ) => {
@ -474,7 +449,6 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
reactToMessage, reactToMessage,
retrySend, retrySend,
retryDeleteForEveryone, retryDeleteForEveryone,
showContactDetail,
showExpiredIncomingTapToViewToast, showExpiredIncomingTapToViewToast,
showExpiredOutgoingTapToViewToast, showExpiredOutgoingTapToViewToast,
showMessageDetail, showMessageDetail,
@ -809,139 +783,6 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
return view; return view;
} }
showGV1Members(): void {
window.reduxActions.conversations.pushPanelForConversation(this.model.id, {
type: PanelType.GroupV1Members,
});
}
getGV1Members(): Backbone.View {
const { contactCollection, id } = this.model;
const memberships =
contactCollection?.map((conversation: ConversationModel) => {
return {
isAdmin: false,
member: conversation.format(),
};
}) || [];
const reduxState = window.reduxStore.getState();
const getPreferredBadge = getPreferredBadgeSelector(reduxState);
const theme = getTheme(reduxState);
const view = new ReactWrapperView({
className: 'group-member-list panel',
JSX: (
<ConversationDetailsMembershipList
canAddNewMembers={false}
conversationId={id}
i18n={window.i18n}
getPreferredBadge={getPreferredBadge}
maxShownMemberCount={32}
memberships={memberships}
showContactModal={contactId => {
window.reduxActions.globalModals.showContactModal(
contactId,
this.model.id
);
}}
theme={theme}
/>
),
});
view.render();
return view;
}
showGroupLinkManagement(): void {
window.reduxActions.conversations.pushPanelForConversation(this.model.id, {
type: PanelType.GroupLinkManagement,
});
}
getGroupLinkManagement(): Backbone.View {
const view = new ReactWrapperView({
className: 'panel',
JSX: window.Signal.State.Roots.createGroupLinkManagement(
window.reduxStore,
{
conversationId: this.model.id,
}
),
});
view.render();
return view;
}
showGroupV2Permissions(): void {
window.reduxActions.conversations.pushPanelForConversation(this.model.id, {
type: PanelType.GroupPermissions,
});
}
getGroupV2Permissions(): Backbone.View {
const view = new ReactWrapperView({
className: 'panel',
JSX: window.Signal.State.Roots.createGroupV2Permissions(
window.reduxStore,
{
conversationId: this.model.id,
}
),
});
view.render();
return view;
}
showPendingInvites(): void {
window.reduxActions.conversations.pushPanelForConversation(this.model.id, {
type: PanelType.GroupInvites,
});
}
getPendingInvites(): Backbone.View {
const view = new ReactWrapperView({
className: 'panel',
JSX: window.Signal.State.Roots.createPendingInvites(window.reduxStore, {
conversationId: this.model.id,
ourUuid: window.textsecure.storage.user.getCheckedUuid().toString(),
}),
});
view.render();
return view;
}
showConversationNotificationsSettings(): void {
window.reduxActions.conversations.pushPanelForConversation(this.model.id, {
type: PanelType.NotificationSettings,
});
}
getConversationNotificationsSettings(): Backbone.View {
const view = new ReactWrapperView({
className: 'panel',
JSX: window.Signal.State.Roots.createConversationNotificationsSettings(
window.reduxStore,
{
conversationId: this.model.id,
}
),
});
view.render();
return view;
}
showConversationDetails(): void { showConversationDetails(): void {
window.reduxActions.conversations.pushPanelForConversation(this.model.id, { window.reduxActions.conversations.pushPanelForConversation(this.model.id, {
type: PanelType.ConversationDetails, type: PanelType.ConversationDetails,
@ -970,11 +811,6 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
addMembers: this.model.addMembersV2.bind(this.model), addMembers: this.model.addMembersV2.bind(this.model),
conversationId: this.model.get('id'), conversationId: this.model.get('id'),
showAllMedia: this.showAllMedia.bind(this), showAllMedia: this.showAllMedia.bind(this),
showGroupLinkManagement: this.showGroupLinkManagement.bind(this),
showGroupV2Permissions: this.showGroupV2Permissions.bind(this),
showConversationNotificationsSettings:
this.showConversationNotificationsSettings.bind(this),
showPendingInvites: this.showPendingInvites.bind(this),
updateGroupAttributes: this.model.updateGroupAttributesV2.bind( updateGroupAttributes: this.model.updateGroupAttributesV2.bind(
this.model this.model
), ),
@ -1052,78 +888,6 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
return view; return view;
} }
showStickerManager(): void {
window.reduxActions.conversations.pushPanelForConversation(this.model.id, {
type: PanelType.StickerManager,
});
}
getStickerManager(): Backbone.View {
const view = new ReactWrapperView({
className: ['sticker-manager-wrapper', 'panel'].join(' '),
JSX: window.Signal.State.Roots.createStickerManager(window.reduxStore),
onClose: () => {
window.reduxActions.conversations.popPanelForConversation(
this.model.id
);
},
});
view.render();
return view;
}
showContactDetail({
contact,
signalAccount,
}: {
contact: EmbeddedContactType;
signalAccount?: {
phoneNumber: string;
uuid: UUIDStringType;
};
}): void {
window.reduxActions.conversations.pushPanelForConversation(this.model.id, {
type: PanelType.ContactDetails,
args: { contact, signalAccount },
});
}
getContactDetail({
contact,
signalAccount,
}: {
contact: EmbeddedContactType;
signalAccount?: {
phoneNumber: string;
uuid: UUIDStringType;
};
}): Backbone.View {
const view = new ReactWrapperView({
className: 'contact-detail-pane panel',
JSX: (
<ContactDetail
i18n={window.i18n}
contact={contact}
hasSignalAccount={Boolean(signalAccount)}
onSendMessage={() => {
if (signalAccount) {
startConversation(signalAccount.phoneNumber, signalAccount.uuid);
}
}}
/>
),
onClose: () => {
window.reduxActions.conversations.popPanelForConversation(
this.model.id
);
},
});
return view;
}
pushPanel(panel: PanelRenderType): void { pushPanel(panel: PanelRenderType): void {
if (isPanelHandledByReact(panel)) { if (isPanelHandledByReact(panel)) {
return; return;
@ -1140,24 +904,10 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
let view: Backbone.View | undefined; let view: Backbone.View | undefined;
if (type === PanelType.AllMedia) { if (type === PanelType.AllMedia) {
view = this.getAllMedia(); view = this.getAllMedia();
} else if (panel.type === PanelType.ContactDetails) {
view = this.getContactDetail(panel.args);
} else if (type === PanelType.ConversationDetails) { } else if (type === PanelType.ConversationDetails) {
view = this.getConversationDetails(); view = this.getConversationDetails();
} else if (type === PanelType.GroupInvites) {
view = this.getPendingInvites();
} else if (type === PanelType.GroupLinkManagement) {
view = this.getGroupLinkManagement();
} else if (type === PanelType.GroupPermissions) {
view = this.getGroupV2Permissions();
} else if (type === PanelType.GroupV1Members) {
view = this.getGV1Members();
} else if (type === PanelType.NotificationSettings) {
view = this.getConversationNotificationsSettings();
} else if (panel.type === PanelType.MessageDetails) { } else if (panel.type === PanelType.MessageDetails) {
view = this.getMessageDetail(panel.args); view = this.getMessageDetail(panel.args);
} else if (type === PanelType.StickerManager) {
view = this.getStickerManager();
} }
if (!view) { if (!view) {

10
ts/window.d.ts vendored
View file

@ -38,15 +38,10 @@ import type { ReduxActions } from './state/types';
import type { createStore } from './state/createStore'; import type { createStore } from './state/createStore';
import type { createApp } from './state/roots/createApp'; import type { createApp } from './state/roots/createApp';
import type { createConversationDetails } from './state/roots/createConversationDetails'; import type { createConversationDetails } from './state/roots/createConversationDetails';
import type { createGroupLinkManagement } from './state/roots/createGroupLinkManagement';
import type { createGroupV2JoinModal } from './state/roots/createGroupV2JoinModal'; import type { createGroupV2JoinModal } from './state/roots/createGroupV2JoinModal';
import type { createGroupV2Permissions } from './state/roots/createGroupV2Permissions';
import type { createMessageDetail } from './state/roots/createMessageDetail'; import type { createMessageDetail } from './state/roots/createMessageDetail';
import type { createConversationNotificationsSettings } from './state/roots/createConversationNotificationsSettings';
import type { createPendingInvites } from './state/roots/createPendingInvites';
import type { createSafetyNumberViewer } from './state/roots/createSafetyNumberViewer'; import type { createSafetyNumberViewer } from './state/roots/createSafetyNumberViewer';
import type { createShortcutGuideModal } from './state/roots/createShortcutGuideModal'; import type { createShortcutGuideModal } from './state/roots/createShortcutGuideModal';
import type { createStickerManager } from './state/roots/createStickerManager';
import type * as appDuck from './state/ducks/app'; import type * as appDuck from './state/ducks/app';
import type * as callingDuck from './state/ducks/calling'; import type * as callingDuck from './state/ducks/calling';
import type * as conversationsDuck from './state/ducks/conversations'; import type * as conversationsDuck from './state/ducks/conversations';
@ -167,15 +162,10 @@ export type SignalCoreType = {
Roots: { Roots: {
createApp: typeof createApp; createApp: typeof createApp;
createConversationDetails: typeof createConversationDetails; createConversationDetails: typeof createConversationDetails;
createGroupLinkManagement: typeof createGroupLinkManagement;
createGroupV2JoinModal: typeof createGroupV2JoinModal; createGroupV2JoinModal: typeof createGroupV2JoinModal;
createGroupV2Permissions: typeof createGroupV2Permissions;
createMessageDetail: typeof createMessageDetail; createMessageDetail: typeof createMessageDetail;
createConversationNotificationsSettings: typeof createConversationNotificationsSettings;
createPendingInvites: typeof createPendingInvites;
createSafetyNumberViewer: typeof createSafetyNumberViewer; createSafetyNumberViewer: typeof createSafetyNumberViewer;
createShortcutGuideModal: typeof createShortcutGuideModal; createShortcutGuideModal: typeof createShortcutGuideModal;
createStickerManager: typeof createStickerManager;
}; };
Ducks: { Ducks: {
app: typeof appDuck; app: typeof appDuck;