Fix navigation logic and update interfaces
This commit is contained in:
parent
ce8a208e42
commit
bce775d88d
|
@ -1,5 +1,7 @@
|
||||||
import { MarkdownAST } from '@rocket.chat/message-parser';
|
import { MarkdownAST } from '@rocket.chat/message-parser';
|
||||||
|
|
||||||
|
export type TMessageType = 'discussion-created' | 'jitsi_call_started';
|
||||||
|
|
||||||
export interface IMessageAttachments {
|
export interface IMessageAttachments {
|
||||||
attachments: any;
|
attachments: any;
|
||||||
timeFormat: string;
|
timeFormat: string;
|
||||||
|
@ -140,7 +142,7 @@ export interface IMessageInner
|
||||||
IMessageThread,
|
IMessageThread,
|
||||||
IMessageAttachments,
|
IMessageAttachments,
|
||||||
IMessageBroadcast {
|
IMessageBroadcast {
|
||||||
type: 'discussion-created' | 'jitsi_call_started' | 'c' | 'd' | 'p' | 'l';
|
type: TMessageType;
|
||||||
blocks: [];
|
blocks: [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ export interface IThread {
|
||||||
id: string;
|
id: string;
|
||||||
msg?: string;
|
msg?: string;
|
||||||
t?: SubscriptionType;
|
t?: SubscriptionType;
|
||||||
rid?: string;
|
rid: string;
|
||||||
_updatedAt?: Date;
|
_updatedAt?: Date;
|
||||||
ts?: Date;
|
ts?: Date;
|
||||||
u?: IUserMessage;
|
u?: IUserMessage;
|
||||||
|
|
|
@ -58,6 +58,7 @@ export type ModalStackParamList = {
|
||||||
};
|
};
|
||||||
DiscussionsView: {
|
DiscussionsView: {
|
||||||
rid: string;
|
rid: string;
|
||||||
|
t: SubscriptionType;
|
||||||
};
|
};
|
||||||
SearchMessagesView: {
|
SearchMessagesView: {
|
||||||
rid: string;
|
rid: string;
|
||||||
|
|
|
@ -56,6 +56,7 @@ export type ChatsStackParamList = {
|
||||||
};
|
};
|
||||||
DiscussionsView: {
|
DiscussionsView: {
|
||||||
rid: string;
|
rid: string;
|
||||||
|
t: SubscriptionType;
|
||||||
};
|
};
|
||||||
SearchMessagesView: {
|
SearchMessagesView: {
|
||||||
rid: string;
|
rid: string;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||||
import { HeaderBackButton, StackNavigationOptions, StackNavigationProp } from '@react-navigation/stack';
|
import { HeaderBackButton, StackNavigationOptions, StackNavigationProp } from '@react-navigation/stack';
|
||||||
import { RouteProp } from '@react-navigation/core';
|
import { RouteProp } from '@react-navigation/core';
|
||||||
|
|
||||||
import { IApplicationState, SubscriptionType } from '../../definitions';
|
import { IApplicationState } from '../../definitions';
|
||||||
import { ChatsStackParamList } from '../../stacks/types';
|
import { ChatsStackParamList } from '../../stacks/types';
|
||||||
import ActivityIndicator from '../../containers/ActivityIndicator';
|
import ActivityIndicator from '../../containers/ActivityIndicator';
|
||||||
import I18n from '../../i18n';
|
import I18n from '../../i18n';
|
||||||
|
@ -36,6 +36,7 @@ interface IDiscussionsViewProps {
|
||||||
|
|
||||||
const DiscussionsView = ({ navigation, route }: IDiscussionsViewProps): JSX.Element => {
|
const DiscussionsView = ({ navigation, route }: IDiscussionsViewProps): JSX.Element => {
|
||||||
const rid = route.params?.rid;
|
const rid = route.params?.rid;
|
||||||
|
const t = route.params?.t;
|
||||||
|
|
||||||
const baseUrl = useSelector((state: IApplicationState) => state.server?.server);
|
const baseUrl = useSelector((state: IApplicationState) => state.server?.server);
|
||||||
const isMasterDetail = useSelector((state: IApplicationState) => state.app?.isMasterDetail);
|
const isMasterDetail = useSelector((state: IApplicationState) => state.app?.isMasterDetail);
|
||||||
|
@ -152,12 +153,14 @@ const DiscussionsView = ({ navigation, route }: IDiscussionsViewProps): JSX.Elem
|
||||||
|
|
||||||
const onDiscussionPress = debounce(
|
const onDiscussionPress = debounce(
|
||||||
(item: TThreadModel) => {
|
(item: TThreadModel) => {
|
||||||
|
if (item.drid && item.t) {
|
||||||
navigation.push('RoomView', {
|
navigation.push('RoomView', {
|
||||||
rid: item.drid!,
|
rid: item.drid,
|
||||||
prid: item.rid,
|
prid: item.rid,
|
||||||
name: item.msg,
|
name: item.msg,
|
||||||
t: item.rid! === 'GENERAL' ? SubscriptionType.CHANNEL : SubscriptionType.GROUP
|
t
|
||||||
});
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
1000,
|
1000,
|
||||||
true
|
true
|
||||||
|
|
|
@ -1017,7 +1017,8 @@ class RoomActionsView extends React.Component {
|
||||||
this.onPressTouchable({
|
this.onPressTouchable({
|
||||||
route: 'DiscussionsView',
|
route: 'DiscussionsView',
|
||||||
params: {
|
params: {
|
||||||
rid
|
rid,
|
||||||
|
t
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue