tinode setup is async now
This commit is contained in:
@@ -230,8 +230,8 @@ class InfoView extends React.Component {
|
|||||||
avatar: makeImageUrl(topic.public ? topic.public.photo : null),
|
avatar: makeImageUrl(topic.public ? topic.public.photo : null),
|
||||||
private: topic.private ? topic.private.comment : null,
|
private: topic.private ? topic.private.comment : null,
|
||||||
address: topic.name,
|
address: topic.name,
|
||||||
groupTopic: (topic.getType() == 'grp'),
|
groupTopic: topic.isGroupType(),
|
||||||
channel: topic.isChannel(),
|
channel: topic.isChannelType(),
|
||||||
showMemberPanel: false,
|
showMemberPanel: false,
|
||||||
access: acs ? acs.getMode() : undefined,
|
access: acs ? acs.getMode() : undefined,
|
||||||
modeGiven: acs ? acs.getGiven() : undefined,
|
modeGiven: acs ? acs.getGiven() : undefined,
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ class MessagesView extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
Object.assign(nextState, {
|
Object.assign(nextState, {
|
||||||
channel: topic.isChannel()
|
channel: topic.isChannelType()
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Invalid topic.
|
// Invalid topic.
|
||||||
@@ -597,7 +597,7 @@ class MessagesView extends React.Component {
|
|||||||
const menuItems = messageSpecificMenuItems || [];
|
const menuItems = messageSpecificMenuItems || [];
|
||||||
const topic = this.props.tinode.getTopic(params.topicName);
|
const topic = this.props.tinode.getTopic(params.topicName);
|
||||||
if (topic) {
|
if (topic) {
|
||||||
if (!topic.isChannel()) {
|
if (!topic.isChannelType()) {
|
||||||
menuItems.push('message_delete');
|
menuItems.push('message_delete');
|
||||||
}
|
}
|
||||||
const acs = topic.getAccessMode();
|
const acs = topic.getAccessMode();
|
||||||
@@ -817,8 +817,8 @@ class MessagesView extends React.Component {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
const topic = this.props.tinode.getTopic(this.state.topic);
|
const topic = this.props.tinode.getTopic(this.state.topic);
|
||||||
const isChannel = topic.isChannel();
|
const isChannel = topic.isChannelType();
|
||||||
const groupTopic = topic.getType() == 'grp' && !isChannel;
|
const groupTopic = topic.isGroupType() && !isChannel;
|
||||||
let messageNodes = [];
|
let messageNodes = [];
|
||||||
let previousFrom = null;
|
let previousFrom = null;
|
||||||
let chatBoxClass = null;
|
let chatBoxClass = null;
|
||||||
|
|||||||
+59
-56
@@ -215,64 +215,66 @@ class TinodeWeb extends React.Component {
|
|||||||
const keepLoggedIn = LocalStorageUtil.getObject('keep-logged-in');
|
const keepLoggedIn = LocalStorageUtil.getObject('keep-logged-in');
|
||||||
|
|
||||||
const {formatMessage, locale} = this.props.intl;
|
const {formatMessage, locale} = this.props.intl;
|
||||||
this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, this.state.transport, locale, keepLoggedIn);
|
new Promise((resolve, reject) => {
|
||||||
this.tinode.onConnect = this.handleConnected;
|
this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, this.state.transport, locale, keepLoggedIn, resolve);
|
||||||
this.tinode.onDisconnect = this.handleDisconnect;
|
this.tinode.onConnect = this.handleConnected;
|
||||||
this.tinode.onAutoreconnectIteration = this.handleAutoreconnectIteration;
|
this.tinode.onDisconnect = this.handleDisconnect;
|
||||||
|
this.tinode.onAutoreconnectIteration = this.handleAutoreconnectIteration;
|
||||||
// Initialize desktop alerts.
|
}).then(() => {
|
||||||
if (this.state.desktopAlertsEnabled) {
|
// Initialize desktop alerts.
|
||||||
try {
|
if (this.state.desktopAlertsEnabled) {
|
||||||
this.fbPush = firebase.initializeApp(FIREBASE_INIT, APP_NAME).messaging();
|
try {
|
||||||
this.fbPush.usePublicVapidKey(FIREBASE_INIT.messagingVapidKey);
|
this.fbPush = firebase.initializeApp(FIREBASE_INIT, APP_NAME).messaging();
|
||||||
navigator.serviceWorker.register('/service-worker.js').then((reg) => {
|
this.fbPush.usePublicVapidKey(FIREBASE_INIT.messagingVapidKey);
|
||||||
this.checkForAppUpdate(reg);
|
navigator.serviceWorker.register('/service-worker.js').then((reg) => {
|
||||||
this.fbPush.useServiceWorker(reg);
|
this.checkForAppUpdate(reg);
|
||||||
reg.active.postMessage(JSON.stringify({locale: locale}));
|
this.fbPush.useServiceWorker(reg);
|
||||||
this.initDesktopAlerts();
|
reg.active.postMessage(JSON.stringify({locale: locale}));
|
||||||
if (this.state.desktopAlerts) {
|
this.initDesktopAlerts();
|
||||||
if (!this.state.firebaseToken) {
|
if (this.state.desktopAlerts) {
|
||||||
this.togglePushToken(true);
|
if (!this.state.firebaseToken) {
|
||||||
} else {
|
this.togglePushToken(true);
|
||||||
this.tinode.setDeviceToken(this.state.firebaseToken, true);
|
} else {
|
||||||
|
this.tinode.setDeviceToken(this.state.firebaseToken, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}).catch((err) => {
|
||||||
}).catch((err) => {
|
// registration failed :(
|
||||||
// registration failed :(
|
console.log("Failed to register service worker:", err);
|
||||||
console.log("Failed to register service worker:", err);
|
});
|
||||||
});
|
} catch (err) {
|
||||||
} catch (err) {
|
this.handleError(formatMessage({id: 'push_init_failed'}), 'err');
|
||||||
this.handleError(formatMessage({id: 'push_init_failed'}), 'err');
|
console.log("Failed to initialize push notifications", err);
|
||||||
console.log("Failed to initialize push notifications", err);
|
this.setState({desktopAlertsEnabled: false});
|
||||||
this.setState({desktopAlertsEnabled: false});
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const token = keepLoggedIn ? LocalStorageUtil.getObject('auth-token') : undefined;
|
const token = keepLoggedIn ? LocalStorageUtil.getObject('auth-token') : undefined;
|
||||||
|
|
||||||
const parsedNav = HashNavigation.parseUrlHash(window.location.hash);
|
const parsedNav = HashNavigation.parseUrlHash(window.location.hash);
|
||||||
if (token) {
|
if (token) {
|
||||||
this.setState({autoLogin: true});
|
this.setState({autoLogin: true});
|
||||||
|
|
||||||
// When reading from storage, date is returned as string.
|
// When reading from storage, date is returned as string.
|
||||||
token.expires = new Date(token.expires);
|
token.expires = new Date(token.expires);
|
||||||
this.tinode.setAuthToken(token);
|
this.tinode.setAuthToken(token);
|
||||||
this.tinode.connect().catch((err) => {
|
this.tinode.connect().catch((err) => {
|
||||||
// Socket error
|
// Socket error
|
||||||
this.handleError(err.message, 'err');
|
this.handleError(err.message, 'err');
|
||||||
});
|
});
|
||||||
delete parsedNav.params.info;
|
delete parsedNav.params.info;
|
||||||
delete parsedNav.params.tab;
|
delete parsedNav.params.tab;
|
||||||
parsedNav.path[0] = '';
|
parsedNav.path[0] = '';
|
||||||
HashNavigation.navigateTo(HashNavigation.composeUrlHash(parsedNav.path, parsedNav.params));
|
HashNavigation.navigateTo(HashNavigation.composeUrlHash(parsedNav.path, parsedNav.params));
|
||||||
} else if (!parsedNav.params.token) {
|
} else if (!parsedNav.params.token) {
|
||||||
HashNavigation.navigateTo('');
|
HashNavigation.navigateTo('');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.readTimer = null;
|
this.readTimer = null;
|
||||||
this.readTimerCallback = null;
|
this.readTimerCallback = null;
|
||||||
|
|
||||||
this.handleHashRoute();
|
this.handleHashRoute();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
@@ -282,9 +284,9 @@ class TinodeWeb extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Setup transport (usually websocket) and server address. This will terminate connection with the server.
|
// Setup transport (usually websocket) and server address. This will terminate connection with the server.
|
||||||
static tnSetup(serverAddress, transport, locale, persist) {
|
static tnSetup(serverAddress, transport, locale, persistentCache, onSetupCompleted) {
|
||||||
const tinode = new Tinode({appName: APP_NAME, host: serverAddress, apiKey: API_KEY, transport: transport,
|
const tinode = new Tinode({appName: APP_NAME, host: serverAddress, apiKey: API_KEY, transport: transport,
|
||||||
secure: isSecureConnection(), persist: persist});
|
secure: isSecureConnection(), persist: persistentCache}, onSetupCompleted);
|
||||||
tinode.setHumanLanguage(locale);
|
tinode.setHumanLanguage(locale);
|
||||||
tinode.enableLogging(LOGGING_ENABLED, true);
|
tinode.enableLogging(LOGGING_ENABLED, true);
|
||||||
return tinode;
|
return tinode;
|
||||||
@@ -483,7 +485,6 @@ class TinodeWeb extends React.Component {
|
|||||||
|
|
||||||
if (promise) {
|
if (promise) {
|
||||||
promise.then((ctrl) => {
|
promise.then((ctrl) => {
|
||||||
console.log("doLogin->then", ctrl);
|
|
||||||
if (ctrl.code >= 300 && ctrl.text === 'validate credentials') {
|
if (ctrl.code >= 300 && ctrl.text === 'validate credentials') {
|
||||||
this.setState({loadSpinnerVisible: false});
|
this.setState({loadSpinnerVisible: false});
|
||||||
if (cred) {
|
if (cred) {
|
||||||
@@ -819,7 +820,7 @@ class TinodeWeb extends React.Component {
|
|||||||
// Accept given permissions.
|
// Accept given permissions.
|
||||||
const mode = topic.getAccessMode().getGiven();
|
const mode = topic.getAccessMode().getGiven();
|
||||||
response = topic.setMeta({sub: {mode: mode}});
|
response = topic.setMeta({sub: {mode: mode}});
|
||||||
if (topic.isP2P()) {
|
if (topic.isP2PType()) {
|
||||||
// For P2P topics change 'given' permission of the peer too.
|
// For P2P topics change 'given' permission of the peer too.
|
||||||
// In p2p topics the other user has the same name as the topic.
|
// In p2p topics the other user has the same name as the topic.
|
||||||
response = response.then((ctrl) => {
|
response = response.then((ctrl) => {
|
||||||
@@ -927,10 +928,12 @@ class TinodeWeb extends React.Component {
|
|||||||
const serverAddress = settings.serverAddress || this.state.serverAddress;
|
const serverAddress = settings.serverAddress || this.state.serverAddress;
|
||||||
const transport = settings.transport || this.state.transport;
|
const transport = settings.transport || this.state.transport;
|
||||||
if (this.tinode) {
|
if (this.tinode) {
|
||||||
|
this.tinode.clearStorage();
|
||||||
this.tinode.onDisconnect = undefined;
|
this.tinode.onDisconnect = undefined;
|
||||||
this.tinode.disconnect();
|
this.tinode.disconnect();
|
||||||
}
|
}
|
||||||
this.tinode = TinodeWeb.tnSetup(serverAddress, transport, this.props.intl.locale);
|
this.tinode = TinodeWeb.tnSetup(serverAddress, transport, this.props.intl.locale,
|
||||||
|
LocalStorageUtil.getObject('keep-logged-in'));
|
||||||
this.tinode.onConnect = this.handleConnected;
|
this.tinode.onConnect = this.handleConnected;
|
||||||
this.tinode.onDisconnect = this.handleDisconnect;
|
this.tinode.onDisconnect = this.handleDisconnect;
|
||||||
|
|
||||||
|
|||||||
+69
-68
@@ -2060,8 +2060,8 @@ class InfoView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
avatar: (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_14__.makeImageUrl)(topic.public ? topic.public.photo : null),
|
avatar: (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_14__.makeImageUrl)(topic.public ? topic.public.photo : null),
|
||||||
private: topic.private ? topic.private.comment : null,
|
private: topic.private ? topic.private.comment : null,
|
||||||
address: topic.name,
|
address: topic.name,
|
||||||
groupTopic: topic.getType() == 'grp',
|
groupTopic: topic.isGroupType(),
|
||||||
channel: topic.isChannel(),
|
channel: topic.isChannelType(),
|
||||||
showMemberPanel: false,
|
showMemberPanel: false,
|
||||||
access: acs ? acs.getMode() : undefined,
|
access: acs ? acs.getMode() : undefined,
|
||||||
modeGiven: acs ? acs.getGiven() : undefined,
|
modeGiven: acs ? acs.getGiven() : undefined,
|
||||||
@@ -3095,7 +3095,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
}
|
}
|
||||||
|
|
||||||
Object.assign(nextState, {
|
Object.assign(nextState, {
|
||||||
channel: topic.isChannel()
|
channel: topic.isChannelType()
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Object.assign(nextState, {
|
Object.assign(nextState, {
|
||||||
@@ -3452,7 +3452,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
const topic = this.props.tinode.getTopic(params.topicName);
|
const topic = this.props.tinode.getTopic(params.topicName);
|
||||||
|
|
||||||
if (topic) {
|
if (topic) {
|
||||||
if (!topic.isChannel()) {
|
if (!topic.isChannelType()) {
|
||||||
menuItems.push('message_delete');
|
menuItems.push('message_delete');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3659,8 +3659,8 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const topic = this.props.tinode.getTopic(this.state.topic);
|
const topic = this.props.tinode.getTopic(this.state.topic);
|
||||||
const isChannel = topic.isChannel();
|
const isChannel = topic.isChannelType();
|
||||||
const groupTopic = topic.getType() == 'grp' && !isChannel;
|
const groupTopic = topic.isGroupType() && !isChannel;
|
||||||
let messageNodes = [];
|
let messageNodes = [];
|
||||||
let previousFrom = null;
|
let previousFrom = null;
|
||||||
let chatBoxClass = null;
|
let chatBoxClass = null;
|
||||||
@@ -4716,67 +4716,69 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
formatMessage,
|
formatMessage,
|
||||||
locale
|
locale
|
||||||
} = this.props.intl;
|
} = this.props.intl;
|
||||||
this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, this.state.transport, locale, keepLoggedIn);
|
new Promise((resolve, reject) => {
|
||||||
this.tinode.onConnect = this.handleConnected;
|
this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, this.state.transport, locale, keepLoggedIn, resolve);
|
||||||
this.tinode.onDisconnect = this.handleDisconnect;
|
this.tinode.onConnect = this.handleConnected;
|
||||||
this.tinode.onAutoreconnectIteration = this.handleAutoreconnectIteration;
|
this.tinode.onDisconnect = this.handleDisconnect;
|
||||||
|
this.tinode.onAutoreconnectIteration = this.handleAutoreconnectIteration;
|
||||||
|
}).then(() => {
|
||||||
|
if (this.state.desktopAlertsEnabled) {
|
||||||
|
try {
|
||||||
|
this.fbPush = firebase_app__WEBPACK_IMPORTED_MODULE_3__.initializeApp(FIREBASE_INIT, _config_js__WEBPACK_IMPORTED_MODULE_11__.APP_NAME).messaging();
|
||||||
|
this.fbPush.usePublicVapidKey(FIREBASE_INIT.messagingVapidKey);
|
||||||
|
navigator.serviceWorker.register('/service-worker.js').then(reg => {
|
||||||
|
this.checkForAppUpdate(reg);
|
||||||
|
this.fbPush.useServiceWorker(reg);
|
||||||
|
reg.active.postMessage(JSON.stringify({
|
||||||
|
locale: locale
|
||||||
|
}));
|
||||||
|
this.initDesktopAlerts();
|
||||||
|
|
||||||
if (this.state.desktopAlertsEnabled) {
|
if (this.state.desktopAlerts) {
|
||||||
try {
|
if (!this.state.firebaseToken) {
|
||||||
this.fbPush = firebase_app__WEBPACK_IMPORTED_MODULE_3__.initializeApp(FIREBASE_INIT, _config_js__WEBPACK_IMPORTED_MODULE_11__.APP_NAME).messaging();
|
this.togglePushToken(true);
|
||||||
this.fbPush.usePublicVapidKey(FIREBASE_INIT.messagingVapidKey);
|
} else {
|
||||||
navigator.serviceWorker.register('/service-worker.js').then(reg => {
|
this.tinode.setDeviceToken(this.state.firebaseToken, true);
|
||||||
this.checkForAppUpdate(reg);
|
}
|
||||||
this.fbPush.useServiceWorker(reg);
|
|
||||||
reg.active.postMessage(JSON.stringify({
|
|
||||||
locale: locale
|
|
||||||
}));
|
|
||||||
this.initDesktopAlerts();
|
|
||||||
|
|
||||||
if (this.state.desktopAlerts) {
|
|
||||||
if (!this.state.firebaseToken) {
|
|
||||||
this.togglePushToken(true);
|
|
||||||
} else {
|
|
||||||
this.tinode.setDeviceToken(this.state.firebaseToken, true);
|
|
||||||
}
|
}
|
||||||
}
|
}).catch(err => {
|
||||||
}).catch(err => {
|
console.log("Failed to register service worker:", err);
|
||||||
console.log("Failed to register service worker:", err);
|
});
|
||||||
});
|
} catch (err) {
|
||||||
} catch (err) {
|
this.handleError(formatMessage({
|
||||||
this.handleError(formatMessage({
|
id: 'push_init_failed'
|
||||||
id: 'push_init_failed'
|
}), 'err');
|
||||||
}), 'err');
|
console.log("Failed to initialize push notifications", err);
|
||||||
console.log("Failed to initialize push notifications", err);
|
this.setState({
|
||||||
this.setState({
|
desktopAlertsEnabled: false
|
||||||
desktopAlertsEnabled: false
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const token = keepLoggedIn ? _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_14__.default.getObject('auth-token') : undefined;
|
const token = keepLoggedIn ? _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_14__.default.getObject('auth-token') : undefined;
|
||||||
const parsedNav = _lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.parseUrlHash(window.location.hash);
|
const parsedNav = _lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.parseUrlHash(window.location.hash);
|
||||||
|
|
||||||
if (token) {
|
if (token) {
|
||||||
this.setState({
|
this.setState({
|
||||||
autoLogin: true
|
autoLogin: true
|
||||||
});
|
});
|
||||||
token.expires = new Date(token.expires);
|
token.expires = new Date(token.expires);
|
||||||
this.tinode.setAuthToken(token);
|
this.tinode.setAuthToken(token);
|
||||||
this.tinode.connect().catch(err => {
|
this.tinode.connect().catch(err => {
|
||||||
this.handleError(err.message, 'err');
|
this.handleError(err.message, 'err');
|
||||||
});
|
});
|
||||||
delete parsedNav.params.info;
|
delete parsedNav.params.info;
|
||||||
delete parsedNav.params.tab;
|
delete parsedNav.params.tab;
|
||||||
parsedNav.path[0] = '';
|
parsedNav.path[0] = '';
|
||||||
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.composeUrlHash(parsedNav.path, parsedNav.params));
|
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.composeUrlHash(parsedNav.path, parsedNav.params));
|
||||||
} else if (!parsedNav.params.token) {
|
} else if (!parsedNav.params.token) {
|
||||||
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo('');
|
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo('');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.readTimer = null;
|
this.readTimer = null;
|
||||||
this.readTimerCallback = null;
|
this.readTimerCallback = null;
|
||||||
this.handleHashRoute();
|
this.handleHashRoute();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
@@ -4785,15 +4787,15 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
document.removeEventListener('visibilitychange', this.handleVisibilityEvent);
|
document.removeEventListener('visibilitychange', this.handleVisibilityEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static tnSetup(serverAddress, transport, locale, persist) {
|
static tnSetup(serverAddress, transport, locale, persistentCache, onSetupCompleted) {
|
||||||
const tinode = new (tinode_sdk__WEBPACK_IMPORTED_MODULE_5___default())({
|
const tinode = new (tinode_sdk__WEBPACK_IMPORTED_MODULE_5___default())({
|
||||||
appName: _config_js__WEBPACK_IMPORTED_MODULE_11__.APP_NAME,
|
appName: _config_js__WEBPACK_IMPORTED_MODULE_11__.APP_NAME,
|
||||||
host: serverAddress,
|
host: serverAddress,
|
||||||
apiKey: _config_js__WEBPACK_IMPORTED_MODULE_11__.API_KEY,
|
apiKey: _config_js__WEBPACK_IMPORTED_MODULE_11__.API_KEY,
|
||||||
transport: transport,
|
transport: transport,
|
||||||
secure: (0,_lib_host_name_js__WEBPACK_IMPORTED_MODULE_13__.isSecureConnection)(),
|
secure: (0,_lib_host_name_js__WEBPACK_IMPORTED_MODULE_13__.isSecureConnection)(),
|
||||||
persist: persist
|
persist: persistentCache
|
||||||
});
|
}, onSetupCompleted);
|
||||||
tinode.setHumanLanguage(locale);
|
tinode.setHumanLanguage(locale);
|
||||||
tinode.enableLogging(_config_js__WEBPACK_IMPORTED_MODULE_11__.LOGGING_ENABLED, true);
|
tinode.enableLogging(_config_js__WEBPACK_IMPORTED_MODULE_11__.LOGGING_ENABLED, true);
|
||||||
return tinode;
|
return tinode;
|
||||||
@@ -5015,8 +5017,6 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
|
|
||||||
if (promise) {
|
if (promise) {
|
||||||
promise.then(ctrl => {
|
promise.then(ctrl => {
|
||||||
console.log("doLogin->then", ctrl);
|
|
||||||
|
|
||||||
if (ctrl.code >= 300 && ctrl.text === 'validate credentials') {
|
if (ctrl.code >= 300 && ctrl.text === 'validate credentials') {
|
||||||
this.setState({
|
this.setState({
|
||||||
loadSpinnerVisible: false
|
loadSpinnerVisible: false
|
||||||
@@ -5329,7 +5329,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (topic.isP2P()) {
|
if (topic.isP2PType()) {
|
||||||
response = response.then(ctrl => {
|
response = response.then(ctrl => {
|
||||||
topic.setMeta({
|
topic.setMeta({
|
||||||
sub: {
|
sub: {
|
||||||
@@ -5450,11 +5450,12 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
const transport = settings.transport || this.state.transport;
|
const transport = settings.transport || this.state.transport;
|
||||||
|
|
||||||
if (this.tinode) {
|
if (this.tinode) {
|
||||||
|
this.tinode.clearStorage();
|
||||||
this.tinode.onDisconnect = undefined;
|
this.tinode.onDisconnect = undefined;
|
||||||
this.tinode.disconnect();
|
this.tinode.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tinode = TinodeWeb.tnSetup(serverAddress, transport, this.props.intl.locale);
|
this.tinode = TinodeWeb.tnSetup(serverAddress, transport, this.props.intl.locale, _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_14__.default.getObject('keep-logged-in'));
|
||||||
this.tinode.onConnect = this.handleConnected;
|
this.tinode.onConnect = this.handleConnected;
|
||||||
this.tinode.onDisconnect = this.handleDisconnect;
|
this.tinode.onDisconnect = this.handleDisconnect;
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+77
-34
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user