diff --git a/app/containers/MessageActions/index.tsx b/app/containers/MessageActions/index.tsx index eb9be9675..9147d061b 100644 --- a/app/containers/MessageActions/index.tsx +++ b/app/containers/MessageActions/index.tsx @@ -23,7 +23,7 @@ interface IMessageActions { autoTranslate: any; reactWhenReadOnly: any; }; - tmid: string; + tmid?: string; user: { id: string | number; }; diff --git a/app/definitions/IRoom.ts b/app/definitions/IRoom.ts index 786c1d7c8..4c71d8645 100644 --- a/app/definitions/IRoom.ts +++ b/app/definitions/IRoom.ts @@ -5,7 +5,8 @@ export enum RoomType { DIRECT = 'd', CHANNEL = 'c', OMNICHANNEL = 'l', - THREAD = 'thread' + THREAD = 'thread', + E2E_MESSAGE_TYPE = 'e2e' } export interface IRoom extends IRocketChatRecord { diff --git a/app/stacks/types.ts b/app/stacks/types.ts index 03a9b5abb..310522c1d 100644 --- a/app/stacks/types.ts +++ b/app/stacks/types.ts @@ -25,6 +25,7 @@ export type ChatsStackParamList = { jumpToMessageId?: string; jumpToThreadId?: string; roomUserId?: string; + usedCannedResponse?: boolean; }; RoomActionsView: { room: IRoom; @@ -48,6 +49,7 @@ export type ChatsStackParamList = { member: any; rid: string; t: RoomType; + showCloseModal?: boolean; }; RoomInfoEditView: { rid: string; diff --git a/app/views/RoomView/Banner.tsx b/app/views/RoomView/Banner.tsx index 606c71ad7..55eafc625 100644 --- a/app/views/RoomView/Banner.tsx +++ b/app/views/RoomView/Banner.tsx @@ -14,6 +14,7 @@ interface IRoomBannerProps { theme: string; bannerClosed: boolean; closeBanner(): void; + rid?: string; // TODO - verify if this props exist } const Banner = React.memo( diff --git a/app/views/RoomView/LeftButtons.tsx b/app/views/RoomView/LeftButtons.tsx index e35bb36c9..1fbc3833a 100644 --- a/app/views/RoomView/LeftButtons.tsx +++ b/app/views/RoomView/LeftButtons.tsx @@ -13,7 +13,7 @@ const styles = StyleSheet.create({ }); interface IRoomLeftButtonsProps { - tmid: string; + tmid?: string; unreadsCount: number; navigation: any; // TODO - change this after merge react navigation baseUrl: string; diff --git a/app/views/RoomView/List/index.tsx b/app/views/RoomView/List/index.tsx index 8e72ef208..2a2c455dd 100644 --- a/app/views/RoomView/List/index.tsx +++ b/app/views/RoomView/List/index.tsx @@ -36,11 +36,11 @@ const onScroll = ({ y }: any) => interface IRoomListContainerProps { renderRow: Function; rid: string; - tmid: string; + tmid?: string; theme: string; loading: boolean; listRef: any; - hideSystemMessages: []; + hideSystemMessages: any[]; tunread: []; ignored: []; navigation: any; // TODO - change this after merge with navigation ts; diff --git a/app/views/RoomView/RightButtons.tsx b/app/views/RoomView/RightButtons.tsx index 8bd66b20c..125566fde 100644 --- a/app/views/RoomView/RightButtons.tsx +++ b/app/views/RoomView/RightButtons.tsx @@ -15,13 +15,14 @@ interface IRoomRightButtonsContainerProps { threadsEnabled: boolean; rid: string; t: string; - tmid: string; + tmid?: string; teamId: string; navigation: any; // TODO - change this after merge react navigation isMasterDetail: boolean; toggleFollowThread: Function; joined: boolean; encrypted: boolean; + teamMain?: string; // TODO - verify if this props exist } class RightButtonsContainer extends Component { diff --git a/app/views/RoomView/Separator.tsx b/app/views/RoomView/Separator.tsx index 4b05c6914..21289e762 100644 --- a/app/views/RoomView/Separator.tsx +++ b/app/views/RoomView/Separator.tsx @@ -34,7 +34,7 @@ const styles = StyleSheet.create({ }); interface IRoomDateSeparatorProps { - ts: Date; + ts: Date | null; unread: boolean; theme: string; } diff --git a/app/views/RoomView/index.tsx b/app/views/RoomView/index.tsx index 7d25d7466..9600ebdb6 100644 --- a/app/views/RoomView/index.tsx +++ b/app/views/RoomView/index.tsx @@ -137,6 +137,19 @@ interface IRoomViewProps { }; } +interface IRoomItem { + id: string; + tmid: string; + tmsg: string; + t: RoomType; + e2e: string; + tlm: string; + rid: string; + ts: Date; + status: any; + u: { _id: string }; +} + class RoomView extends React.Component { private rid: string; private t: RoomType; @@ -479,7 +492,7 @@ class RoomView extends React.Component { }; // goRoomActionsView = (screen?: keyof ChatsStackParamList) => { - goRoomActionsView = (screen: any) => { + goRoomActionsView = (screen?: any) => { logEvent(events.ROOM_GO_RA); const { room, member, joined } = this.state; const { navigation, isMasterDetail } = this.props; @@ -653,7 +666,7 @@ class RoomView extends React.Component { } }; - onReplyInit = (message: string, mention: string) => { + onReplyInit = (message: string, mention: boolean) => { this.setState({ selectedMessage: message, replying: true, @@ -815,7 +828,7 @@ class RoomView extends React.Component { EventEmitter.removeListener('connected', this.handleConnected); }; - handleRoomRemoved = ({ rid }: {rid: string}) => { + handleRoomRemoved = ({ rid }: { rid: string }) => { const { room } = this.state; if (rid === this.rid) { Navigation.navigate('RoomsListView'); @@ -852,7 +865,7 @@ class RoomView extends React.Component { return null; }; - setLastOpen = lastOpen => this.setState({ lastOpen }); + setLastOpen = (lastOpen: Date | null) => this.setState({ lastOpen }); onJoin = () => { this.internalSetState({ @@ -882,9 +895,9 @@ class RoomView extends React.Component { } }; - getThreadName = (tmid, messageId) => getThreadName(this.rid, tmid, messageId); + getThreadName = (tmid: string, messageId: string) => getThreadName(this.rid, tmid, messageId); - toggleFollowThread = async (isFollowingThread, tmid) => { + toggleFollowThread = async (isFollowingThread: boolean, tmid: string) => { try { await RocketChat.toggleFollowMessage(tmid ?? this.tmid, !isFollowingThread); EventEmitter.emit(LISTENER, { message: isFollowingThread ? I18n.t('Unfollowed_thread') : I18n.t('Following_thread') }); @@ -893,13 +906,13 @@ class RoomView extends React.Component { } }; - getBadgeColor = messageId => { + getBadgeColor = (messageId: string) => { const { room } = this.state; const { theme } = this.props; return getBadgeColor({ subscription: room, theme, messageId }); }; - navToRoomInfo = navParam => { + navToRoomInfo = (navParam: ChatsStackParamList['RoomInfoView']) => { const { navigation, user, isMasterDetail } = this.props; logEvent(events[`ROOM_GO_${navParam.t === 'd' ? 'USER' : 'ROOM'}_INFO`]); if (navParam.rid === user.id) { @@ -913,7 +926,7 @@ class RoomView extends React.Component { } }; - navToThread = async item => { + navToThread = async (item: IRoomItem) => { const { roomUserId } = this.state; const { navigation } = this.props; @@ -951,9 +964,9 @@ class RoomView extends React.Component { } }; - navToRoom = async message => { + navToRoom = async (message: IRoomItem) => { const { navigation, isMasterDetail } = this.props; - const roomInfo = await getRoomInfo(message.rid); + const roomInfo: any = await getRoomInfo(message.rid); return goRoom({ item: roomInfo, isMasterDetail, @@ -972,11 +985,11 @@ class RoomView extends React.Component { } }; - handleCommands = ({ event }) => { + handleCommands = ({ event }: any) => { if (this.rid) { const { input } = event; if (handleCommandScroll(event)) { - const offset = input === 'UIKeyInputUpArrow' ? 100 : -100; + const offset: any = input === 'UIKeyInputUpArrow' ? 100 : -100; this.offset += offset; this.flatList?.scrollToOffset({ offset: this.offset }); } else if (handleCommandRoomActions(event)) { @@ -992,7 +1005,7 @@ class RoomView extends React.Component { } }; - blockAction = ({ actionId, appId, value, blockId, rid, mid }) => + blockAction = ({ actionId, appId, value, blockId, rid, mid }: any) => RocketChat.triggerBlockAction({ blockId, actionId, @@ -1020,12 +1033,12 @@ class RoomView extends React.Component { } }; - isIgnored = message => { + isIgnored = (message: IRoomItem) => { const { room } = this.state; return room?.ignored?.includes?.(message?.u?._id) ?? false; }; - onLoadMoreMessages = loaderItem => + onLoadMoreMessages = (loaderItem: any): any => RoomServices.getMoreMessages({ rid: this.rid, tmid: this.tmid, @@ -1033,7 +1046,7 @@ class RoomView extends React.Component { loaderItem }); - renderItem = (item, previousItem, highlightedMessage) => { + renderItem = (item: IRoomItem, previousItem: IRoomItem, highlightedMessage: any) => { const { room, lastOpen, canAutoTranslate } = this.state; const { user, Message_GroupingPeriod, Message_TimeFormat, useRealName, baseUrl, Message_Read_Receipt_Enabled, theme } = this.props;