Fix navigation logic and update interfaces

This commit is contained in:
Gerzon Z 2022-01-24 14:35:06 -04:00
parent ce8a208e42
commit bce775d88d
6 changed files with 18 additions and 10 deletions

View File

@ -1,5 +1,7 @@
import { MarkdownAST } from '@rocket.chat/message-parser';
export type TMessageType = 'discussion-created' | 'jitsi_call_started';
export interface IMessageAttachments {
attachments: any;
timeFormat: string;
@ -140,7 +142,7 @@ export interface IMessageInner
IMessageThread,
IMessageAttachments,
IMessageBroadcast {
type: 'discussion-created' | 'jitsi_call_started' | 'c' | 'd' | 'p' | 'l';
type: TMessageType;
blocks: [];
}

View File

@ -43,7 +43,7 @@ export interface IThread {
id: string;
msg?: string;
t?: SubscriptionType;
rid?: string;
rid: string;
_updatedAt?: Date;
ts?: Date;
u?: IUserMessage;

View File

@ -58,6 +58,7 @@ export type ModalStackParamList = {
};
DiscussionsView: {
rid: string;
t: SubscriptionType;
};
SearchMessagesView: {
rid: string;

View File

@ -56,6 +56,7 @@ export type ChatsStackParamList = {
};
DiscussionsView: {
rid: string;
t: SubscriptionType;
};
SearchMessagesView: {
rid: string;

View File

@ -5,7 +5,7 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { HeaderBackButton, StackNavigationOptions, StackNavigationProp } from '@react-navigation/stack';
import { RouteProp } from '@react-navigation/core';
import { IApplicationState, SubscriptionType } from '../../definitions';
import { IApplicationState } from '../../definitions';
import { ChatsStackParamList } from '../../stacks/types';
import ActivityIndicator from '../../containers/ActivityIndicator';
import I18n from '../../i18n';
@ -36,6 +36,7 @@ interface IDiscussionsViewProps {
const DiscussionsView = ({ navigation, route }: IDiscussionsViewProps): JSX.Element => {
const rid = route.params?.rid;
const t = route.params?.t;
const baseUrl = useSelector((state: IApplicationState) => state.server?.server);
const isMasterDetail = useSelector((state: IApplicationState) => state.app?.isMasterDetail);
@ -152,12 +153,14 @@ const DiscussionsView = ({ navigation, route }: IDiscussionsViewProps): JSX.Elem
const onDiscussionPress = debounce(
(item: TThreadModel) => {
navigation.push('RoomView', {
rid: item.drid!,
prid: item.rid,
name: item.msg,
t: item.rid! === 'GENERAL' ? SubscriptionType.CHANNEL : SubscriptionType.GROUP
});
if (item.drid && item.t) {
navigation.push('RoomView', {
rid: item.drid,
prid: item.rid,
name: item.msg,
t
});
}
},
1000,
true

View File

@ -1017,7 +1017,8 @@ class RoomActionsView extends React.Component {
this.onPressTouchable({
route: 'DiscussionsView',
params: {
rid
rid,
t
}
})
}