refresh channels on push, correctly set push enabled status

This commit is contained in:
or-else
2021-04-12 16:59:01 -07:00
parent 8504e4a155
commit a33891a5a9
10 changed files with 189 additions and 113 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"name": "tinode-webapp", "name": "tinode-webapp",
"description": "Tinode messenger for the web", "description": "Tinode messenger for the web",
"version": "0.17.0-beta1", "version": "0.17.0-beta2",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/tinode/example-react-js.git" "url": "https://github.com/tinode/example-react-js.git"
@@ -72,7 +72,7 @@
"react": "^17.0.1", "react": "^17.0.1",
"react-dom": "^17.0.1", "react-dom": "^17.0.1",
"react-intl": "^5.13.1", "react-intl": "^5.13.1",
"tinode-sdk": "^0.17.0-beta1" "tinode-sdk": "^0.17.0-beta2"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.13.8", "@babel/core": "^7.13.8",
+25 -14
View File
@@ -3,6 +3,9 @@ importScripts('https://cdn.jsdelivr.net/npm/firebase@8.2.9/firebase-app.js');
importScripts('https://cdn.jsdelivr.net/npm/firebase@8.2.9/firebase-messaging.js'); importScripts('https://cdn.jsdelivr.net/npm/firebase@8.2.9/firebase-messaging.js');
importScripts('firebase-init.js'); importScripts('firebase-init.js');
// Channel to notify the webapp.
const webAppChannel = new BroadcastChannel('tinode-sw');
// Basic internationalization. // Basic internationalization.
const i18n = { const i18n = {
'de': { 'de': {
@@ -47,12 +50,13 @@ const fbMessaging = firebase.messaging();
// This method shows the push notifications while the window is in background. // This method shows the push notifications while the window is in background.
fbMessaging.onBackgroundMessage((payload) => { fbMessaging.onBackgroundMessage((payload) => {
console.log("sw got background message", payload.data);
if (payload.data.silent == 'true') { if (payload.data.silent == 'true') {
return; return;
} }
// Notify webapp that a message was received.
webAppChannel.postMessage(payload);
const pushType = payload.data.what || 'msg'; const pushType = payload.data.what || 'msg';
const title = payload.data.title || self.i18nMessage(pushType == 'msg' ? 'new_message' : 'new_chat'); const title = payload.data.title || self.i18nMessage(pushType == 'msg' ? 'new_message' : 'new_chat');
const options = { const options = {
@@ -116,23 +120,30 @@ self.addEventListener('notificationclick', event => {
// This is needed for 'Add to Home Screen'. // This is needed for 'Add to Home Screen'.
self.addEventListener('fetch', event => { self.addEventListener('fetch', event => {
event.respondWith( event.respondWith((async () => {
// Try to find response in cache. // Try to find response in cache.
caches.match(event.request) const cachedResponse = await caches.match(event.request);
.then((resp) => { if (cachedResponse) {
// If response is found in cache, return it. Otherwise fetch. return cachedResponse;
return resp || fetch(event.request); }
}) // Not found in cache.
.catch((err) => { const response = await fetch(event.request);
// Something went wrong. if (!response || response.status != 200 || response.type != 'basic') {
console.log("Service worker Fetch:", err); return response;
}) }
); if (event.request.url && (event.request.url.startsWith('http://') || event.request.url.startsWith('https://'))) {
const cache = await caches.open(self.version);
await cache.put(event.request, response.clone());
}
return response;
})());
}); });
// This code get the human language from the webapp for localization of strings. // This code get the human language & app version from the webapp.
// Locale is used for localization of strings, version for naming the cache.
self.addEventListener('message', event => { self.addEventListener('message', event => {
const data = JSON.parse(event.data); const data = JSON.parse(event.data);
self.locale = data.locale || ''; self.locale = data.locale || '';
self.baseLocale = self.locale.toLowerCase().split(/[-_]/)[0]; self.baseLocale = self.locale.toLowerCase().split(/[-_]/)[0];
self.version = data.version || 'default';
}); });
+1 -1
View File
@@ -1,3 +1,3 @@
// This is a generated file. Don't edit. // This is a generated file. Don't edit.
export const PACKAGE_VERSION = "0.17.0-beta1"; export const PACKAGE_VERSION = "0.17.0-beta2";
+31 -11
View File
@@ -17,6 +17,7 @@ import SidepanelView from './sidepanel-view.jsx';
import { API_KEY, APP_NAME, DEFAULT_P2P_ACCESS_MODE, LOGGING_ENABLED, import { API_KEY, APP_NAME, DEFAULT_P2P_ACCESS_MODE, LOGGING_ENABLED,
MEDIA_BREAKPOINT, RECEIVED_DELAY } from '../config.js'; MEDIA_BREAKPOINT, RECEIVED_DELAY } from '../config.js';
import { PACKAGE_VERSION } from '../version.js';
import { base64ReEncode, makeImageUrl } from '../lib/blob-helpers.js'; import { base64ReEncode, makeImageUrl } from '../lib/blob-helpers.js';
import { detectServerAddress, isLocalHost, isSecureConnection } from '../lib/host-name.js'; import { detectServerAddress, isLocalHost, isSecureConnection } from '../lib/host-name.js';
import LocalStorageUtil from '../lib/local-storage.js'; import LocalStorageUtil from '../lib/local-storage.js';
@@ -112,6 +113,7 @@ class TinodeWeb extends React.Component {
this.initFCMessaging = this.initFCMessaging.bind(this); this.initFCMessaging = this.initFCMessaging.bind(this);
this.togglePushToken = this.togglePushToken.bind(this); this.togglePushToken = this.togglePushToken.bind(this);
this.requestPushToken = this.requestPushToken.bind(this); this.requestPushToken = this.requestPushToken.bind(this);
this.handlePushMessage = this.handlePushMessage.bind(this);
this.handleSidepanelCancel = this.handleSidepanelCancel.bind(this); this.handleSidepanelCancel = this.handleSidepanelCancel.bind(this);
this.handleStartTopicRequest = this.handleStartTopicRequest.bind(this); this.handleStartTopicRequest = this.handleStartTopicRequest.bind(this);
this.handleNewTopicCreated = this.handleNewTopicCreated.bind(this); this.handleNewTopicCreated = this.handleNewTopicCreated.bind(this);
@@ -139,6 +141,7 @@ class TinodeWeb extends React.Component {
getBlankState() { getBlankState() {
const settings = LocalStorageUtil.getObject('settings') || {}; const settings = LocalStorageUtil.getObject('settings') || {};
const persist = !!LocalStorageUtil.getObject('keep-logged-in');
return { return {
connected: false, connected: false,
@@ -152,11 +155,11 @@ class TinodeWeb extends React.Component {
// "On" is the default, so saving the "off" state. // "On" is the default, so saving the "off" state.
messageSounds: !settings.messageSoundsOff, messageSounds: !settings.messageSoundsOff,
incognitoMode: false, incognitoMode: false,
desktopAlerts: settings.desktopAlerts, desktopAlerts: persist && settings.desktopAlerts,
desktopAlertsEnabled: (isSecureConnection() || isLocalHost()) && desktopAlertsEnabled: (isSecureConnection() || isLocalHost()) &&
(typeof firebase != 'undefined') && (typeof navigator != 'undefined') && (typeof firebase != 'undefined') && (typeof navigator != 'undefined') &&
(typeof FIREBASE_INIT != 'undefined'), (typeof FIREBASE_INIT != 'undefined'),
firebaseToken: LocalStorageUtil.getObject('firebase-token'), firebaseToken: persist ? LocalStorageUtil.getObject('firebase-token') : null,
applicationVisible: !document.hidden, applicationVisible: !document.hidden,
@@ -209,6 +212,10 @@ class TinodeWeb extends React.Component {
window.addEventListener('online', (e) => { this.handleOnline(true); }); window.addEventListener('online', (e) => { this.handleOnline(true); });
window.addEventListener('offline', (e) => { this.handleOnline(false); }); window.addEventListener('offline', (e) => { this.handleOnline(false); });
window.addEventListener('hashchange', this.handleHashRoute); window.addEventListener('hashchange', this.handleHashRoute);
// Process background notifications from the service worker.
const serviceWorkerChannel = new BroadcastChannel('tinode-sw');
serviceWorkerChannel.addEventListener('message', this.handlePushMessage);
// Window/tab visible or invisible for pausing timers. // Window/tab visible or invisible for pausing timers.
document.addEventListener('visibilitychange', this.handleVisibilityEvent); document.addEventListener('visibilitychange', this.handleVisibilityEvent);
@@ -285,6 +292,14 @@ class TinodeWeb extends React.Component {
return tinode; return tinode;
} }
// Notifiy Tinode that a push message was received from the server.
handlePushMessage(payload) {
if (payload.data.what == 'msg' && Tinode.isChannelTopicName(payload.data.topic)) {
// The last argument is a fake user Id: otherwise the update is seen as one from the current user.
this.tinode.oobNotification(payload.data.topic, payload.data.seq, 'fake-uid');
}
}
initFCMessaging() { initFCMessaging() {
const {formatMessage, locale} = this.props.intl; const {formatMessage, locale} = this.props.intl;
const onError = (msg, err) => { const onError = (msg, err) => {
@@ -300,18 +315,16 @@ class TinodeWeb extends React.Component {
return navigator.serviceWorker.register('/service-worker.js').then((reg) => { return navigator.serviceWorker.register('/service-worker.js').then((reg) => {
this.checkForAppUpdate(reg); this.checkForAppUpdate(reg);
this.fbPush.useServiceWorker(reg); this.fbPush.useServiceWorker(reg);
reg.active.postMessage(JSON.stringify({locale: locale})); reg.active.postMessage(JSON.stringify({locale: locale, version: PACKAGE_VERSION}));
// Google could not be bothered to mention that // Google could not be bothered to mention that
// onTokenRefresh is never called. // onTokenRefresh is never called.
this.fbPush.onTokenRefresh(() => { this.fbPush.onTokenRefresh(() => {
this.requestPushToken(); this.requestPushToken();
}); });
// TODO: add handler for FCM topic pushes (pushes for channels). // FCM pushes for channels have to be handled even when the app is in the foreground.
// They have to be handled even when the app is in the foreground. this.fbPush.onMessage(this.handlePushMessage);
this.fbPush.onMessage((payload) => {
console.log("got fg push message", payload.data);
});
return reg; return reg;
}).catch((err) => { }).catch((err) => {
// registration failed :( // registration failed :(
@@ -1017,7 +1030,9 @@ class TinodeWeb extends React.Component {
}); });
} else { } else {
this.setState({desktopAlerts: true}); this.setState({desktopAlerts: true});
LocalStorageUtil.updateObject('settings', {desktopAlerts: true}); if (LocalStorageUtil.getObject('keep-logged-in')) {
LocalStorageUtil.updateObject('settings', {desktopAlerts: true});
}
} }
} else if (this.state.firebaseToken && this.fbPush) { } else if (this.state.firebaseToken && this.fbPush) {
this.fbPush.deleteToken(this.state.firebaseToken).catch((err) => { this.fbPush.deleteToken(this.state.firebaseToken).catch((err) => {
@@ -1037,12 +1052,17 @@ class TinodeWeb extends React.Component {
requestPushToken() { requestPushToken() {
this.fbPush.getToken().then((refreshedToken) => { this.fbPush.getToken().then((refreshedToken) => {
const persist = LocalStorageUtil.getObject('keep-logged-in');
if (refreshedToken != this.state.firebaseToken) { if (refreshedToken != this.state.firebaseToken) {
this.tinode.setDeviceToken(refreshedToken); this.tinode.setDeviceToken(refreshedToken);
LocalStorageUtil.setObject('firebase-token', refreshedToken); if (persist) {
LocalStorageUtil.setObject('firebase-token', refreshedToken);
}
} }
this.setState({firebaseToken: refreshedToken, desktopAlerts: true}); this.setState({firebaseToken: refreshedToken, desktopAlerts: true});
LocalStorageUtil.updateObject('settings', {desktopAlerts: true}); if (persist) {
LocalStorageUtil.updateObject('settings', {desktopAlerts: true});
}
}).catch((err) => { }).catch((err) => {
this.handleError(err.message, 'err'); this.handleError(err.message, 'err');
console.log("Failed to retrieve firebase token", err); console.log("Failed to retrieve firebase token", err);
+91 -69
View File
@@ -702,7 +702,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "PACKAGE_VERSION": function() { return /* binding */ PACKAGE_VERSION; } /* harmony export */ "PACKAGE_VERSION": function() { return /* binding */ PACKAGE_VERSION; }
/* harmony export */ }); /* harmony export */ });
const PACKAGE_VERSION = "0.17.0-beta1"; const PACKAGE_VERSION = "0.17.0-beta2";
/***/ }), /***/ }),
@@ -4764,12 +4764,14 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _messages_view_jsx__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./messages-view.jsx */ "./src/views/messages-view.jsx"); /* harmony import */ var _messages_view_jsx__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./messages-view.jsx */ "./src/views/messages-view.jsx");
/* harmony import */ var _sidepanel_view_jsx__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./sidepanel-view.jsx */ "./src/views/sidepanel-view.jsx"); /* harmony import */ var _sidepanel_view_jsx__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./sidepanel-view.jsx */ "./src/views/sidepanel-view.jsx");
/* harmony import */ var _config_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../config.js */ "./src/config.js"); /* harmony import */ var _config_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../config.js */ "./src/config.js");
/* harmony import */ var _lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../lib/blob-helpers.js */ "./src/lib/blob-helpers.js"); /* harmony import */ var _version_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../version.js */ "./src/version.js");
/* harmony import */ var _lib_host_name_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../lib/host-name.js */ "./src/lib/host-name.js"); /* harmony import */ var _lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../lib/blob-helpers.js */ "./src/lib/blob-helpers.js");
/* harmony import */ var _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../lib/local-storage.js */ "./src/lib/local-storage.js"); /* harmony import */ var _lib_host_name_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../lib/host-name.js */ "./src/lib/host-name.js");
/* harmony import */ var _lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../lib/navigation.js */ "./src/lib/navigation.js"); /* harmony import */ var _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../lib/local-storage.js */ "./src/lib/local-storage.js");
/* harmony import */ var _lib_strformat_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../lib/strformat.js */ "./src/lib/strformat.js"); /* harmony import */ var _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../lib/navigation.js */ "./src/lib/navigation.js");
/* harmony import */ var _lib_utils_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../lib/utils.js */ "./src/lib/utils.js"); /* harmony import */ var _lib_strformat_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../lib/strformat.js */ "./src/lib/strformat.js");
/* harmony import */ var _lib_utils_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../lib/utils.js */ "./src/lib/utils.js");
@@ -4892,6 +4894,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
this.initFCMessaging = this.initFCMessaging.bind(this); this.initFCMessaging = this.initFCMessaging.bind(this);
this.togglePushToken = this.togglePushToken.bind(this); this.togglePushToken = this.togglePushToken.bind(this);
this.requestPushToken = this.requestPushToken.bind(this); this.requestPushToken = this.requestPushToken.bind(this);
this.handlePushMessage = this.handlePushMessage.bind(this);
this.handleSidepanelCancel = this.handleSidepanelCancel.bind(this); this.handleSidepanelCancel = this.handleSidepanelCancel.bind(this);
this.handleStartTopicRequest = this.handleStartTopicRequest.bind(this); this.handleStartTopicRequest = this.handleStartTopicRequest.bind(this);
this.handleNewTopicCreated = this.handleNewTopicCreated.bind(this); this.handleNewTopicCreated = this.handleNewTopicCreated.bind(this);
@@ -4918,19 +4921,20 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
} }
getBlankState() { getBlankState() {
const settings = _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_14__.default.getObject('settings') || {}; const settings = _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.default.getObject('settings') || {};
const persist = !!_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.default.getObject('keep-logged-in');
return { return {
connected: false, connected: false,
ready: false, ready: false,
autoLogin: false, autoLogin: false,
transport: settings.transport || null, transport: settings.transport || null,
serverAddress: settings.serverAddress || (0,_lib_host_name_js__WEBPACK_IMPORTED_MODULE_13__.detectServerAddress)(), serverAddress: settings.serverAddress || (0,_lib_host_name_js__WEBPACK_IMPORTED_MODULE_14__.detectServerAddress)(),
serverVersion: "no connection", serverVersion: "no connection",
messageSounds: !settings.messageSoundsOff, messageSounds: !settings.messageSoundsOff,
incognitoMode: false, incognitoMode: false,
desktopAlerts: settings.desktopAlerts, desktopAlerts: persist && settings.desktopAlerts,
desktopAlertsEnabled: ((0,_lib_host_name_js__WEBPACK_IMPORTED_MODULE_13__.isSecureConnection)() || (0,_lib_host_name_js__WEBPACK_IMPORTED_MODULE_13__.isLocalHost)()) && typeof firebase_app__WEBPACK_IMPORTED_MODULE_3__ != 'undefined' && typeof navigator != 'undefined' && typeof FIREBASE_INIT != 'undefined', desktopAlertsEnabled: ((0,_lib_host_name_js__WEBPACK_IMPORTED_MODULE_14__.isSecureConnection)() || (0,_lib_host_name_js__WEBPACK_IMPORTED_MODULE_14__.isLocalHost)()) && typeof firebase_app__WEBPACK_IMPORTED_MODULE_3__ != 'undefined' && typeof navigator != 'undefined' && typeof FIREBASE_INIT != 'undefined',
firebaseToken: _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_14__.default.getObject('firebase-token'), firebaseToken: persist ? _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.default.getObject('firebase-token') : null,
applicationVisible: !document.hidden, applicationVisible: !document.hidden,
errorText: '', errorText: '',
errorLevel: null, errorLevel: null,
@@ -4976,12 +4980,14 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
this.handleOnline(false); this.handleOnline(false);
}); });
window.addEventListener('hashchange', this.handleHashRoute); window.addEventListener('hashchange', this.handleHashRoute);
const serviceWorkerChannel = new BroadcastChannel('tinode-sw');
serviceWorkerChannel.addEventListener('message', this.handlePushMessage);
document.addEventListener('visibilitychange', this.handleVisibilityEvent); document.addEventListener('visibilitychange', this.handleVisibilityEvent);
this.setState({ this.setState({
viewportWidth: document.documentElement.clientWidth, viewportWidth: document.documentElement.clientWidth,
viewportHeight: document.documentElement.clientHeight viewportHeight: document.documentElement.clientHeight
}); });
const keepLoggedIn = _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_14__.default.getObject('keep-logged-in'); const keepLoggedIn = _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.default.getObject('keep-logged-in');
new Promise((resolve, reject) => { new Promise((resolve, reject) => {
this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, this.state.transport, this.props.intl.locale, keepLoggedIn, resolve); this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, this.state.transport, this.props.intl.locale, keepLoggedIn, resolve);
this.tinode.onConnect = this.handleConnected; this.tinode.onConnect = this.handleConnected;
@@ -5000,8 +5006,8 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
}).catch(() => {}); }).catch(() => {});
} }
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_15__.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_16__.default.parseUrlHash(window.location.hash);
if (token) { if (token) {
this.setState({ this.setState({
@@ -5015,9 +5021,9 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
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_16__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.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_16__.default.navigateTo('');
} }
this.readTimer = null; this.readTimer = null;
@@ -5038,7 +5044,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
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_14__.isSecureConnection)(),
persist: persistentCache persist: persistentCache
}, onSetupCompleted); }, onSetupCompleted);
tinode.setHumanLanguage(locale); tinode.setHumanLanguage(locale);
@@ -5046,6 +5052,12 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
return tinode; return tinode;
} }
handlePushMessage(payload) {
if (payload.data.what == 'msg' && tinode_sdk__WEBPACK_IMPORTED_MODULE_5___default().isChannelTopicName(payload.data.topic)) {
this.tinode.oobNotification(payload.data.topic, payload.data.seq, 'fake-uid');
}
}
initFCMessaging() { initFCMessaging() {
const { const {
formatMessage, formatMessage,
@@ -5067,14 +5079,13 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
this.checkForAppUpdate(reg); this.checkForAppUpdate(reg);
this.fbPush.useServiceWorker(reg); this.fbPush.useServiceWorker(reg);
reg.active.postMessage(JSON.stringify({ reg.active.postMessage(JSON.stringify({
locale: locale locale: locale,
version: _version_js__WEBPACK_IMPORTED_MODULE_12__.PACKAGE_VERSION
})); }));
this.fbPush.onTokenRefresh(() => { this.fbPush.onTokenRefresh(() => {
this.requestPushToken(); this.requestPushToken();
}); });
this.fbPush.onMessage(payload => { this.fbPush.onMessage(this.handlePushMessage);
console.log("got fg push message", payload.data);
});
return reg; return reg;
}).catch(err => { }).catch(err => {
onError("Failed to register service worker:", err); onError("Failed to register service worker:", err);
@@ -5128,7 +5139,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
} }
handleHashRoute() { handleHashRoute() {
const hash = _lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.parseUrlHash(window.location.hash); const hash = _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.parseUrlHash(window.location.hash);
if (hash.path && hash.path.length > 0) { if (hash.path && hash.path.length > 0) {
if (['register', 'settings', 'edit', 'notif', 'security', 'support', 'general', 'cred', 'reset', 'newtpk', 'archive', 'blocked', 'contacts', ''].includes(hash.path[0])) { if (['register', 'settings', 'edit', 'notif', 'security', 'support', 'general', 'cred', 'reset', 'newtpk', 'archive', 'blocked', 'contacts', ''].includes(hash.path[0])) {
@@ -5261,7 +5272,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
let count = sec / 1000; let count = sec / 1000;
count = count | count; count = count | count;
this.reconnectCountdown = setInterval(() => { this.reconnectCountdown = setInterval(() => {
const timeLeft = count > 99 ? (0,_lib_strformat_js__WEBPACK_IMPORTED_MODULE_16__.secondsToTime)(count) : count; const timeLeft = count > 99 ? (0,_lib_strformat_js__WEBPACK_IMPORTED_MODULE_17__.secondsToTime)(count) : count;
this.handleError(formatMessage(messages.reconnect_countdown, { this.handleError(formatMessage(messages.reconnect_countdown, {
seconds: timeLeft seconds: timeLeft
}), 'warn', () => { }), 'warn', () => {
@@ -5287,7 +5298,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
doLogin(login, password, cred) { doLogin(login, password, cred) {
if (this.tinode.isAuthenticated()) { if (this.tinode.isAuthenticated()) {
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(''); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo('');
return; return;
} }
@@ -5329,10 +5340,10 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
}); });
this.handleError(err.message, 'err'); this.handleError(err.message, 'err');
localStorage.removeItem('auth-token'); localStorage.removeItem('auth-token');
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(''); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo('');
}); });
} else { } else {
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(''); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo('');
this.setState({ this.setState({
loginDisabled: false loginDisabled: false
}); });
@@ -5340,17 +5351,17 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
} }
handleCredentialsRequest(params) { handleCredentialsRequest(params) {
const parsed = _lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.parseUrlHash(window.location.hash); const parsed = _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.parseUrlHash(window.location.hash);
parsed.path[0] = 'cred'; parsed.path[0] = 'cred';
parsed.params['method'] = params.cred[0]; parsed.params['method'] = params.cred[0];
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.composeUrlHash(parsed.path, parsed.params)); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.composeUrlHash(parsed.path, parsed.params));
} }
handleLoginSuccessful() { handleLoginSuccessful() {
this.handleError(); this.handleError();
if (_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_14__.default.getObject('keep-logged-in')) { if (_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.default.getObject('keep-logged-in')) {
_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_14__.default.setObject('auth-token', this.tinode.getAuthToken()); _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.default.setObject('auth-token', this.tinode.getAuthToken());
} }
const me = this.tinode.getMeTopic(); const me = this.tinode.getMeTopic();
@@ -5368,13 +5379,13 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
this.tinode.disconnect(); this.tinode.disconnect();
localStorage.removeItem('auth-token'); localStorage.removeItem('auth-token');
this.handleError(err.message, 'err'); this.handleError(err.message, 'err');
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(''); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo('');
}).finally(() => { }).finally(() => {
this.setState({ this.setState({
loadSpinnerVisible: false loadSpinnerVisible: false
}); });
}); });
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.setUrlSidePanel(window.location.hash, 'contacts')); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.setUrlSidePanel(window.location.hash, 'contacts'));
} }
tnMeMetaDesc(desc) { tnMeMetaDesc(desc) {
@@ -5382,7 +5393,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
if (desc.public) { if (desc.public) {
this.setState({ this.setState({
sidePanelTitle: desc.public.fn, sidePanelTitle: desc.public.fn,
sidePanelAvatar: (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_12__.makeImageUrl)(desc.public.photo) sidePanelAvatar: (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_13__.makeImageUrl)(desc.public.photo)
}); });
} }
@@ -5555,7 +5566,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
topicSelectedOnline: this.tinode.isTopicOnline(topicName), topicSelectedOnline: this.tinode.isTopicOnline(topicName),
topicSelectedAcs: this.tinode.getTopicAccessMode(topicName) topicSelectedAcs: this.tinode.getTopicAccessMode(topicName)
}); });
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.setUrlTopic('', topicName)); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.setUrlTopic('', topicName));
} }
} else { } else {
this.setState({ this.setState({
@@ -5566,7 +5577,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
topicSelectedAcs: null, topicSelectedAcs: null,
showInfoPanel: false showInfoPanel: false
}); });
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.setUrlTopic('', null)); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.setUrlTopic('', null));
} }
} }
@@ -5574,7 +5585,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
this.setState({ this.setState({
mobilePanel: 'sidepanel' mobilePanel: 'sidepanel'
}); });
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.setUrlTopic(window.location.hash, null)); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.setUrlTopic(window.location.hash, null));
} }
handleSendMessage(msg, promise, uploader) { handleSendMessage(msg, promise, uploader) {
@@ -5661,7 +5672,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
handleNewAccount() { handleNewAccount() {
this.handleError(); this.handleError();
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.setUrlSidePanel(window.location.hash, 'register')); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.setUrlSidePanel(window.location.hash, 'register'));
} }
handleNewAccountRequest(login_, password_, public_, cred_, tags_) { handleNewAccountRequest(login_, password_, public_, cred_, tags_) {
@@ -5733,7 +5744,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
handleSettings() { handleSettings() {
this.handleError(); this.handleError();
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.setUrlSidePanel(window.location.hash, this.state.myUserId ? 'edit' : 'settings')); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.setUrlSidePanel(window.location.hash, this.state.myUserId ? 'edit' : 'settings'));
} }
handleGlobalSettings(settings) { handleGlobalSettings(settings) {
@@ -5746,26 +5757,26 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
this.tinode.disconnect(); this.tinode.disconnect();
} }
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 = TinodeWeb.tnSetup(serverAddress, transport, this.props.intl.locale, _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.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({
serverAddress: serverAddress, serverAddress: serverAddress,
transport: transport transport: transport
}); });
_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_14__.default.setObject('settings', { _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.default.setObject('settings', {
serverAddress: serverAddress, serverAddress: serverAddress,
transport: transport transport: transport
}); });
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.setUrlSidePanel(window.location.hash, '')); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.setUrlSidePanel(window.location.hash, ''));
} }
handleShowArchive() { handleShowArchive() {
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.setUrlSidePanel(window.location.hash, this.state.myUserId ? 'archive' : '')); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.setUrlSidePanel(window.location.hash, this.state.myUserId ? 'archive' : ''));
} }
handleShowBlocked() { handleShowBlocked() {
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.setUrlSidePanel(window.location.hash, this.state.myUserId ? 'blocked' : '')); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.setUrlSidePanel(window.location.hash, this.state.myUserId ? 'blocked' : ''));
} }
togglePushToken(enabled) { togglePushToken(enabled) {
@@ -5783,7 +5794,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
desktopAlerts: false, desktopAlerts: false,
firebaseToken: null firebaseToken: null
}); });
_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_14__.default.updateObject('settings', { _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.default.updateObject('settings', {
desktopAlerts: false desktopAlerts: false
}); });
}); });
@@ -5791,15 +5802,18 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
this.setState({ this.setState({
desktopAlerts: true desktopAlerts: true
}); });
_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_14__.default.updateObject('settings', {
desktopAlerts: true if (_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.default.getObject('keep-logged-in')) {
}); _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.default.updateObject('settings', {
desktopAlerts: true
});
}
} }
} else if (this.state.firebaseToken && this.fbPush) { } else if (this.state.firebaseToken && this.fbPush) {
this.fbPush.deleteToken(this.state.firebaseToken).catch(err => { this.fbPush.deleteToken(this.state.firebaseToken).catch(err => {
console.log("Unable to delete token.", err); console.log("Unable to delete token.", err);
}).finally(() => { }).finally(() => {
_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_14__.default.updateObject('settings', { _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.default.updateObject('settings', {
desktopAlerts: false desktopAlerts: false
}); });
localStorage.removeItem('firebase-token'); localStorage.removeItem('firebase-token');
@@ -5814,7 +5828,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
desktopAlerts: false, desktopAlerts: false,
firebaseToken: null firebaseToken: null
}); });
_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_14__.default.updateObject('settings', { _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.default.updateObject('settings', {
desktopAlerts: false desktopAlerts: false
}); });
} }
@@ -5822,18 +5836,26 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
requestPushToken() { requestPushToken() {
this.fbPush.getToken().then(refreshedToken => { this.fbPush.getToken().then(refreshedToken => {
const persist = _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.default.getObject('keep-logged-in');
if (refreshedToken != this.state.firebaseToken) { if (refreshedToken != this.state.firebaseToken) {
this.tinode.setDeviceToken(refreshedToken); this.tinode.setDeviceToken(refreshedToken);
_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_14__.default.setObject('firebase-token', refreshedToken);
if (persist) {
_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.default.setObject('firebase-token', refreshedToken);
}
} }
this.setState({ this.setState({
firebaseToken: refreshedToken, firebaseToken: refreshedToken,
desktopAlerts: true desktopAlerts: true
}); });
_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_14__.default.updateObject('settings', {
desktopAlerts: true if (persist) {
}); _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.default.updateObject('settings', {
desktopAlerts: true
});
}
}).catch(err => { }).catch(err => {
this.handleError(err.message, 'err'); this.handleError(err.message, 'err');
console.log("Failed to retrieve firebase token", err); console.log("Failed to retrieve firebase token", err);
@@ -5844,7 +5866,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
this.setState({ this.setState({
messageSounds: enabled messageSounds: enabled
}); });
_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_14__.default.updateObject('settings', { _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.default.updateObject('settings', {
messageSoundsOff: !enabled messageSoundsOff: !enabled
}); });
} }
@@ -5875,7 +5897,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
} }
handleSidepanelCancel() { handleSidepanelCancel() {
const parsed = _lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.parseUrlHash(window.location.hash); const parsed = _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.parseUrlHash(window.location.hash);
let path = ''; let path = '';
if (['security', 'support', 'general', 'notif'].includes(parsed.path[0])) { if (['security', 'support', 'general', 'notif'].includes(parsed.path[0])) {
@@ -5894,7 +5916,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
delete parsed.params.tab; delete parsed.params.tab;
} }
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.composeUrlHash(parsed.path, parsed.params)); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.composeUrlHash(parsed.path, parsed.params));
this.setState({ this.setState({
errorText: '', errorText: '',
errorLevel: null errorLevel: null
@@ -5902,7 +5924,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
} }
basicNavigator(hash) { basicNavigator(hash) {
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.setUrlSidePanel(window.location.hash, hash)); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.setUrlSidePanel(window.location.hash, hash));
} }
handleStartTopicRequest(topicName, pub, priv, tags, isChannel) { handleStartTopicRequest(topicName, pub, priv, tags, isChannel) {
@@ -5946,7 +5968,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
this.setState({ this.setState({
topicSelected: newName topicSelected: newName
}, () => { }, () => {
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.setUrlTopic('', newName)); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.setUrlTopic('', newName));
}); });
} }
} }
@@ -6017,7 +6039,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
} }
handleLogout() { handleLogout() {
(0,_lib_utils_js__WEBPACK_IMPORTED_MODULE_17__.updateFavicon)(0); (0,_lib_utils_js__WEBPACK_IMPORTED_MODULE_18__.updateFavicon)(0);
localStorage.removeItem('auth-token'); localStorage.removeItem('auth-token');
localStorage.removeItem('firebase-token'); localStorage.removeItem('firebase-token');
localStorage.removeItem('settings'); localStorage.removeItem('settings');
@@ -6033,10 +6055,10 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
} }
this.setState(this.getBlankState()); this.setState(this.getBlankState());
this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, this.state.transport, this.props.intl.locale, _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_14__.default.getObject('keep-logged-in')); this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, this.state.transport, this.props.intl.locale, _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.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;
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(''); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo('');
} }
handleDeleteAccount() { handleDeleteAccount() {
@@ -6065,7 +6087,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
} }
topic.leave(true).then(ctrl => { topic.leave(true).then(ctrl => {
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.setUrlTopic(window.location.hash, '')); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.setUrlTopic(window.location.hash, ''));
}).catch(err => { }).catch(err => {
this.handleError(err.message, 'err'); this.handleError(err.message, 'err');
}); });
@@ -6079,7 +6101,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
} }
topic.updateMode(null, '-JP').then(ctrl => { topic.updateMode(null, '-JP').then(ctrl => {
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.setUrlTopic(window.location.hash, '')); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.setUrlTopic(window.location.hash, ''));
}).catch(err => { }).catch(err => {
this.handleError(err.message, 'err'); this.handleError(err.message, 'err');
}); });
@@ -6097,7 +6119,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
'target': topicName 'target': topicName
})); }));
topic.updateMode(null, '-JP').then(ctrl => { topic.updateMode(null, '-JP').then(ctrl => {
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.setUrlTopic(window.location.hash, '')); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.setUrlTopic(window.location.hash, ''));
}).catch(err => { }).catch(err => {
this.handleError(err.message, 'err'); this.handleError(err.message, 'err');
}); });
@@ -6178,14 +6200,14 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
} }
handleShowInfoView() { handleShowInfoView() {
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.addUrlParam(window.location.hash, 'info', true)); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.addUrlParam(window.location.hash, 'info', true));
this.setState({ this.setState({
showInfoPanel: true showInfoPanel: true
}); });
} }
handleHideInfoView() { handleHideInfoView() {
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.removeUrlParam(window.location.hash, 'info')); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.removeUrlParam(window.location.hash, 'info'));
this.setState({ this.setState({
showInfoPanel: false showInfoPanel: false
}); });
@@ -6228,7 +6250,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
resp: code resp: code
} }
}).then(() => { }).then(() => {
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_15__.default.navigateTo(''); _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo('');
}).catch(err => { }).catch(err => {
this.handleError(err.message, 'err'); this.handleError(err.message, 'err');
}); });
@@ -6253,7 +6275,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
} }
handleResetPassword(scheme, newPassword, token) { handleResetPassword(scheme, newPassword, token) {
token = (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_12__.base64ReEncode)(token); token = (0,_lib_blob_helpers_js__WEBPACK_IMPORTED_MODULE_13__.base64ReEncode)(token);
if (!token) { if (!token) {
this.handleError(this.props.intl.formatMessage(messages.invalid_security_token), 'err'); this.handleError(this.props.intl.formatMessage(messages.invalid_security_token), 'err');
+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
+35 -12
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