Compare commits
17 Commits
develop
...
fix.jump-f
Author | SHA1 | Date |
---|---|---|
|
79768303ac | |
|
56859d0de1 | |
|
d5c4068ac8 | |
|
c6ff59e41c | |
|
360d104375 | |
|
c88a41bfeb | |
|
4599145d86 | |
|
8812d6ff2c | |
|
986abe9a61 | |
|
df09ef1c35 | |
|
20ebc34b20 | |
|
f9662036fd | |
|
f47a1a922c | |
|
daf7a3e02a | |
|
0d2f55bfd7 | |
|
1c0533a51e | |
|
3519282a03 |
|
@ -16,10 +16,15 @@ function replace(name, params) {
|
|||
navigationRef.current?.dispatch(StackActions.replace(name, params));
|
||||
}
|
||||
|
||||
function reset({ index, routes }) {
|
||||
navigationRef.current?.dispatch(CommonActions.reset({ index, routes }));
|
||||
}
|
||||
|
||||
export default {
|
||||
navigationRef,
|
||||
routeNameRef,
|
||||
navigate,
|
||||
back,
|
||||
replace
|
||||
replace,
|
||||
reset
|
||||
};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { CommonActions } from '@react-navigation/native';
|
||||
import { Text, View, InteractionManager } from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import parse from 'url-parse';
|
||||
|
@ -57,7 +58,6 @@ import RoomClass from '../../lib/methods/subscriptions/room';
|
|||
import { getUserSelector } from '../../selectors/login';
|
||||
import { CONTAINER_TYPES } from '../../lib/methods/actions';
|
||||
import Banner from './Banner';
|
||||
import Navigation from '../../lib/Navigation';
|
||||
import SafeAreaView from '../../containers/SafeAreaView';
|
||||
import { withDimensions } from '../../dimensions';
|
||||
import { getHeaderTitlePosition } from '../../containers/Header';
|
||||
|
@ -704,6 +704,12 @@ class RoomView extends React.Component {
|
|||
} else {
|
||||
this.navToThread(message);
|
||||
}
|
||||
} else if (!message.tmid && message.rid === this.rid && this.t === 'thread' && !message.replies) {
|
||||
/**
|
||||
* Test if the user is within a thread and the message that he is trying to jump to,
|
||||
* is a message in the main room
|
||||
*/
|
||||
return this.navToRoom(message);
|
||||
} else {
|
||||
/**
|
||||
* if it's from server, we don't have it saved locally and so we fetch surroundings
|
||||
|
@ -736,9 +742,10 @@ class RoomView extends React.Component {
|
|||
}
|
||||
|
||||
handleRoomRemoved = ({ rid }) => {
|
||||
const { navigation } = this.props;
|
||||
const { room } = this.state;
|
||||
if (rid === this.rid) {
|
||||
Navigation.navigate('RoomsListView');
|
||||
navigation.navigate('RoomsListView');
|
||||
showErrorAlert(I18n.t('You_were_removed_from_channel', { channel: RocketChat.getRoomTitle(room) }), I18n.t('Oops'));
|
||||
}
|
||||
}
|
||||
|
@ -833,7 +840,7 @@ class RoomView extends React.Component {
|
|||
|
||||
navToThread = async(item) => {
|
||||
const { roomUserId } = this.state;
|
||||
const { navigation } = this.props;
|
||||
const { navigation, isMasterDetail } = this.props;
|
||||
|
||||
if (item.tmid) {
|
||||
let name = item.tmsg;
|
||||
|
@ -843,9 +850,45 @@ class RoomView extends React.Component {
|
|||
if (item.t === E2E_MESSAGE_TYPE && item.e2e !== E2E_STATUS.DONE) {
|
||||
name = I18n.t('Encrypted_message');
|
||||
}
|
||||
return navigation.push('RoomView', {
|
||||
rid: this.rid, tmid: item.tmid, name, t: 'thread', roomUserId, jumpToMessageId: item.id
|
||||
});
|
||||
|
||||
if (isMasterDetail) {
|
||||
return navigation.push('RoomView', {
|
||||
rid: this.rid, tmid: item.tmid, name, t: 'thread', roomUserId, jumpToMessageId: item.id
|
||||
});
|
||||
}
|
||||
|
||||
return navigation.dispatch(
|
||||
CommonActions.reset({
|
||||
index: 2,
|
||||
routes: [
|
||||
{
|
||||
name: 'RoomsListView'
|
||||
},
|
||||
{
|
||||
name: 'RoomView',
|
||||
params: {
|
||||
rid: this.rid,
|
||||
name: item.name,
|
||||
t: item.t,
|
||||
prid: item.prid,
|
||||
room: item,
|
||||
visitor: item.visitor,
|
||||
roomUserId
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'RoomView',
|
||||
params: {
|
||||
rid: this.rid,
|
||||
tmid: item.tmid,
|
||||
name,
|
||||
t: 'thread',
|
||||
roomUserId,
|
||||
jumpToMessageId: item.id
|
||||
}
|
||||
}]
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (item.tlm) {
|
||||
|
@ -855,12 +898,38 @@ class RoomView extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
navToRoom = async(message) => {
|
||||
navToRoom = async(item) => {
|
||||
const { navigation, isMasterDetail } = this.props;
|
||||
const roomInfo = await getRoomInfo(message.rid);
|
||||
return goRoom({
|
||||
item: roomInfo, isMasterDetail, navigationMethod: navigation.push, jumpToMessageId: message.id
|
||||
});
|
||||
const roomInfo = await getRoomInfo(item.rid);
|
||||
|
||||
if (isMasterDetail) {
|
||||
return goRoom({
|
||||
item: roomInfo, isMasterDetail, navigationMethod: navigation.push, jumpToMessageId: item.id
|
||||
});
|
||||
}
|
||||
|
||||
return navigation.dispatch(
|
||||
CommonActions.reset({
|
||||
index: 1,
|
||||
routes: [
|
||||
{
|
||||
name: 'RoomsListView'
|
||||
},
|
||||
{
|
||||
name: 'RoomView',
|
||||
params: {
|
||||
rid: roomInfo.rid,
|
||||
name: RocketChat.getRoomTitle(roomInfo),
|
||||
t: roomInfo.t,
|
||||
prid: roomInfo.prid,
|
||||
room: roomInfo,
|
||||
visitor: roomInfo.visitor,
|
||||
roomUserId: RocketChat.getUidDirectMessage(roomInfo),
|
||||
jumpToMessageId: item.id
|
||||
}
|
||||
}]
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
callJitsi = () => {
|
||||
|
|
|
@ -10,7 +10,8 @@ const getMessageInfo = async(messageId) => {
|
|||
id: result.id,
|
||||
rid: result.subscription.id,
|
||||
tmid: result.tmid,
|
||||
msg: result.msg
|
||||
msg: result.msg,
|
||||
replies: result.replies
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -20,7 +21,8 @@ const getMessageInfo = async(messageId) => {
|
|||
id: result.id,
|
||||
rid: result.subscription.id,
|
||||
tmid: result.rid,
|
||||
msg: result.msg
|
||||
msg: result.msg,
|
||||
replies: result.replies
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue