fix for tinode/chat/issues/838

This commit is contained in:
or-else
2023-03-14 18:14:33 -07:00
parent 8df3c34cf4
commit 52f879490e
5 changed files with 15 additions and 8 deletions
+8 -4
View File
@@ -317,9 +317,6 @@ class TinodeWeb extends React.Component {
}); });
} }
// Parse and save the hash navigation params.
const parsedNav = HashNavigation.parseUrlHash(window.location.hash);
// Read contacts from cache. // Read contacts from cache.
this.resetContactList(); this.resetContactList();
@@ -339,6 +336,8 @@ class TinodeWeb extends React.Component {
this.readTimer = null; this.readTimer = null;
this.readTimerCallback = null; this.readTimerCallback = null;
// Parse the hash navigation params.
const parsedNav = HashNavigation.parseUrlHash(window.location.hash);
// Maybe navigate to home screen. // Maybe navigate to home screen.
if (!['cred', 'reset', 'register'].includes(parsedNav.path[0])) { if (!['cred', 'reset', 'register'].includes(parsedNav.path[0])) {
// Save possible topic name. // Save possible topic name.
@@ -507,8 +506,12 @@ class TinodeWeb extends React.Component {
let topicName = hash.path[1] || null; let topicName = hash.path[1] || null;
if (topicName != this.state.topicSelected) { if (topicName != this.state.topicSelected) {
if (!Tinode.topicType(topicName)) { if (!Tinode.topicType(topicName)) {
// Clear invalid topic name. // Clear invalid topic name and hide messages view on mobile.
topicName = null; topicName = null;
newState.mobilePanel = 'sidepanel';
} else {
// Topic valid: show messages view on mobile.
newState.mobilePanel = 'topic-view';
} }
Object.assign(newState, { Object.assign(newState, {
topicSelected: topicName, topicSelected: topicName,
@@ -1985,6 +1988,7 @@ class TinodeWeb extends React.Component {
(_ => {this.setState({alertVisible: false}); this.state.alertParams.onConfirm();}) : null} (_ => {this.setState({alertVisible: false}); this.state.alertParams.onConfirm();}) : null}
confirm={this.state.alertParams.confirm} confirm={this.state.alertParams.confirm}
/> : null} /> : null}
{!this.state.displayMobile || this.state.mobilePanel == 'sidepanel' ? {!this.state.displayMobile || this.state.mobilePanel == 'sidepanel' ?
<SidepanelView <SidepanelView
tinode={this.tinode} tinode={this.tinode}
+4 -1
View File
@@ -7480,7 +7480,6 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
if (this.state.desktopAlertsEnabled) { if (this.state.desktopAlertsEnabled) {
this.initFCMessaging().catch(_ => {}); this.initFCMessaging().catch(_ => {});
} }
const parsedNav = _lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].parseUrlHash(window.location.hash);
this.resetContactList(); this.resetContactList();
const token = this.state.persist ? _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_17__["default"].getObject('auth-token') : undefined; const token = this.state.persist ? _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_17__["default"].getObject('auth-token') : undefined;
if (token) { if (token) {
@@ -7495,6 +7494,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
} }
this.readTimer = null; this.readTimer = null;
this.readTimerCallback = null; this.readTimerCallback = null;
const parsedNav = _lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].parseUrlHash(window.location.hash);
if (!['cred', 'reset', 'register'].includes(parsedNav.path[0])) { if (!['cred', 'reset', 'register'].includes(parsedNav.path[0])) {
this.setState({ this.setState({
requestedTopic: parsedNav.path[1] requestedTopic: parsedNav.path[1]
@@ -7666,6 +7666,9 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
if (topicName != this.state.topicSelected) { if (topicName != this.state.topicSelected) {
if (!tinode_sdk__WEBPACK_IMPORTED_MODULE_4__.Tinode.topicType(topicName)) { if (!tinode_sdk__WEBPACK_IMPORTED_MODULE_4__.Tinode.topicType(topicName)) {
topicName = null; topicName = null;
newState.mobilePanel = 'sidepanel';
} else {
newState.mobilePanel = 'topic-view';
} }
Object.assign(newState, { Object.assign(newState, {
topicSelected: topicName, topicSelected: topicName,
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long