Compare commits

...

13 Commits

Author SHA1 Message Date
Diego Mello 2c9fb39365
Merge branch 'develop' into fix.multiple-calls-jump-to-message 2021-08-17 09:54:49 -03:00
Reinaldo Neto 6dca095d44
Merge branch 'develop' into fix.multiple-calls-jump-to-message 2021-07-20 12:09:54 -03:00
Reinaldo Neto 16bb5e468f
Merge branch 'develop' into fix.multiple-calls-jump-to-message 2021-07-20 09:57:58 -03:00
Reinaldo Neto 8812d6ff2c Merge branch 'fix.multiple-calls-jump-to-message' of https://github.com/RocketChat/Rocket.Chat.ReactNative into fix.multiple-calls-jump-to-message 2021-07-06 11:35:41 -03:00
Reinaldo Neto 986abe9a61 Changed Navigation to props.navigation 2021-07-06 11:33:33 -03:00
Reinaldo Neto df09ef1c35
Merge branch 'develop' into fix.multiple-calls-jump-to-message 2021-07-06 10:42:05 -03:00
Gerzon Z 20ebc34b20 Minor tweak 2021-06-24 11:36:56 -04:00
Gerzon Z f9662036fd Minor tweak 2021-06-24 11:34:14 -04:00
Gerzon Z f47a1a922c Small refactor 2021-06-23 17:02:22 -04:00
Gerzon Z daf7a3e02a Update navToRoom and navToThread 2021-06-23 16:33:56 -04:00
Gerzon Z 0d2f55bfd7 Merge branch 'develop' into fix.multiple-calls-jump-to-message 2021-06-23 09:58:43 -04:00
Gerzon Z 1c0533a51e Update navigation method 2021-06-21 14:04:24 -04:00
Gerzon Z 3519282a03 Update navToRoom 2021-06-21 10:34:58 -04:00
2 changed files with 80 additions and 12 deletions

View File

@ -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
};

View File

@ -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';
@ -736,9 +736,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 +834,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 +844,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 +892,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 = () => {