fix DB initialization and teardown, wrong upload parameters order
This commit is contained in:
@@ -822,6 +822,7 @@ i.search {
|
|||||||
margin-top: 0.25rem;
|
margin-top: 0.25rem;
|
||||||
margin-bottom: auto;
|
margin-bottom: auto;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
scroll-behavior: smooth;
|
||||||
}
|
}
|
||||||
|
|
||||||
.contact-box {
|
.contact-box {
|
||||||
@@ -1387,6 +1388,7 @@ i.search {
|
|||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0 0 3.5rem 0;
|
padding: 0 0 3.5rem 0;
|
||||||
margin: 0 0.5rem;
|
margin: 0 0.5rem;
|
||||||
|
scroll-behavior: smooth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Group chats have avatars on the left. Make left margin smaller */
|
/* Group chats have avatars on the left. Make left margin smaller */
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+2
-2
@@ -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.1",
|
"version": "0.17.2-alpha1",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/tinode/example-react-js.git"
|
"url": "https://github.com/tinode/example-react-js.git"
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
"react": "^17.0.1",
|
"react": "^17.0.1",
|
||||||
"react-dom": "^17.0.1",
|
"react-dom": "^17.0.1",
|
||||||
"react-intl": "^5.18.3",
|
"react-intl": "^5.18.3",
|
||||||
"tinode-sdk": "^0.17.1"
|
"tinode-sdk": "^0.17.2-alpha1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.14.3",
|
"@babel/core": "^7.14.3",
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ export function imageScaled(fileOrBlob, maxWidth, maxHeight, maxSize, forceSquar
|
|||||||
}
|
}
|
||||||
|
|
||||||
canvas = null;
|
canvas = null;
|
||||||
onSuccess(blob, mime, dim.dstWidth, dim.dstHeight, fileNameForMime(fileOrBlob.name, mime));
|
onSuccess(mime, blob, dim.dstWidth, dim.dstHeight, fileNameForMime(fileOrBlob.name, mime));
|
||||||
};
|
};
|
||||||
img.src = URL.createObjectURL(fileOrBlob);
|
img.src = URL.createObjectURL(fileOrBlob);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -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.1";
|
export const PACKAGE_VERSION = "0.17.2-alpha1";
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export default class LoginView extends React.Component {
|
|||||||
login: props.login,
|
login: props.login,
|
||||||
password: '',
|
password: '',
|
||||||
hostName: props.serverAddress,
|
hostName: props.serverAddress,
|
||||||
saveToken: LocalStorageUtil.getObject('keep-logged-in')
|
saveToken: props.persist
|
||||||
};
|
};
|
||||||
this.handleLoginChange = this.handleLoginChange.bind(this);
|
this.handleLoginChange = this.handleLoginChange.bind(this);
|
||||||
this.handlePasswordChange = this.handlePasswordChange.bind(this);
|
this.handlePasswordChange = this.handlePasswordChange.bind(this);
|
||||||
@@ -32,7 +32,7 @@ export default class LoginView extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleToggleSaveToken() {
|
handleToggleSaveToken() {
|
||||||
LocalStorageUtil.setObject('keep-logged-in', !this.state.saveToken);
|
this.props.onPersistenceChange(!this.state.saveToken);
|
||||||
this.setState({saveToken: !this.state.saveToken});
|
this.setState({saveToken: !this.state.saveToken});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,14 +91,9 @@ class SidepanelView extends React.Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.handleLoginRequested = this.handleLoginRequested.bind(this);
|
|
||||||
this.handleNewTopic = this.handleNewTopic.bind(this);
|
this.handleNewTopic = this.handleNewTopic.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleLoginRequested(login, password) {
|
|
||||||
this.props.onLoginRequest(login, password);
|
|
||||||
}
|
|
||||||
|
|
||||||
handleNewTopic() {
|
handleNewTopic() {
|
||||||
this.props.onBasicNavigate('newtpk');
|
this.props.onBasicNavigate('newtpk');
|
||||||
}
|
}
|
||||||
@@ -146,7 +141,9 @@ class SidepanelView extends React.Component {
|
|||||||
<LoginView
|
<LoginView
|
||||||
login={this.props.login}
|
login={this.props.login}
|
||||||
disabled={this.props.loginDisabled}
|
disabled={this.props.loginDisabled}
|
||||||
onLogin={this.handleLoginRequested} /> :
|
persist={this.props.persist}
|
||||||
|
onLogin={this.props.onLoginRequest}
|
||||||
|
onPersistenceChange={this.props.onPersistenceChange} /> :
|
||||||
|
|
||||||
view === 'register' ?
|
view === 'register' ?
|
||||||
<CreateAccountView
|
<CreateAccountView
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ class TinodeWeb extends React.Component {
|
|||||||
this.handleVisibilityEvent = this.handleVisibilityEvent.bind(this);
|
this.handleVisibilityEvent = this.handleVisibilityEvent.bind(this);
|
||||||
this.handleError = this.handleError.bind(this);
|
this.handleError = this.handleError.bind(this);
|
||||||
this.handleLoginRequest = this.handleLoginRequest.bind(this);
|
this.handleLoginRequest = this.handleLoginRequest.bind(this);
|
||||||
|
this.handlePersistenceChange = this.handlePersistenceChange.bind(this);
|
||||||
this.handleConnected = this.handleConnected.bind(this);
|
this.handleConnected = this.handleConnected.bind(this);
|
||||||
this.handleAutoreconnectIteration = this.handleAutoreconnectIteration.bind(this);
|
this.handleAutoreconnectIteration = this.handleAutoreconnectIteration.bind(this);
|
||||||
this.doLogin = this.doLogin.bind(this);
|
this.doLogin = this.doLogin.bind(this);
|
||||||
@@ -175,6 +176,7 @@ class TinodeWeb extends React.Component {
|
|||||||
|
|
||||||
login: '',
|
login: '',
|
||||||
password: '',
|
password: '',
|
||||||
|
persist: persist,
|
||||||
myUserId: null,
|
myUserId: null,
|
||||||
liveConnection: navigator.onLine,
|
liveConnection: navigator.onLine,
|
||||||
topicSelected: '',
|
topicSelected: '',
|
||||||
@@ -226,11 +228,9 @@ class TinodeWeb extends React.Component {
|
|||||||
viewportHeight: document.documentElement.clientHeight
|
viewportHeight: document.documentElement.clientHeight
|
||||||
});
|
});
|
||||||
|
|
||||||
const keepLoggedIn = LocalStorageUtil.getObject('keep-logged-in');
|
|
||||||
|
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, this.state.transport,
|
this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, this.state.transport,
|
||||||
this.props.intl.locale, keepLoggedIn, resolve);
|
this.props.intl.locale, this.state.persist, resolve);
|
||||||
this.tinode.onConnect = this.handleConnected;
|
this.tinode.onConnect = this.handleConnected;
|
||||||
this.tinode.onDisconnect = this.handleDisconnect;
|
this.tinode.onDisconnect = this.handleDisconnect;
|
||||||
this.tinode.onAutoreconnectIteration = this.handleAutoreconnectIteration;
|
this.tinode.onAutoreconnectIteration = this.handleAutoreconnectIteration;
|
||||||
@@ -257,7 +257,7 @@ class TinodeWeb extends React.Component {
|
|||||||
// Read contacts from cache.
|
// Read contacts from cache.
|
||||||
this.resetContactList();
|
this.resetContactList();
|
||||||
|
|
||||||
const token = keepLoggedIn ? LocalStorageUtil.getObject('auth-token') : undefined;
|
const token = this.state.persist ? LocalStorageUtil.getObject('auth-token') : undefined;
|
||||||
if (token) {
|
if (token) {
|
||||||
this.setState({autoLogin: true});
|
this.setState({autoLogin: true});
|
||||||
|
|
||||||
@@ -465,6 +465,23 @@ class TinodeWeb extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable or disable saving the password and IndexedDB.
|
||||||
|
handlePersistenceChange(persist) {
|
||||||
|
if (persist) {
|
||||||
|
this.tinode.initStorage().then(() => {
|
||||||
|
console.log("storage initialized");
|
||||||
|
LocalStorageUtil.setObject('keep-logged-in', true);
|
||||||
|
this.setState({persist: true});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.tinode.clearStorage().then(() => {
|
||||||
|
console.log("storage cleared");
|
||||||
|
LocalStorageUtil.setObject('keep-logged-in', false);
|
||||||
|
this.setState({persist: false});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Connection succeeded.
|
// Connection succeeded.
|
||||||
handleConnected() {
|
handleConnected() {
|
||||||
// Just to be sure.
|
// Just to be sure.
|
||||||
@@ -1016,6 +1033,7 @@ class TinodeWeb extends React.Component {
|
|||||||
LocalStorageUtil.getObject('keep-logged-in'));
|
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;
|
||||||
|
this.tinode.onAutoreconnectIteration = this.handleAutoreconnectIteration;
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
serverAddress: serverAddress,
|
serverAddress: serverAddress,
|
||||||
@@ -1252,6 +1270,7 @@ class TinodeWeb extends React.Component {
|
|||||||
this.state.transport, this.props.intl.locale, LocalStorageUtil.getObject('keep-logged-in'));
|
this.state.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;
|
||||||
|
this.tinode.onAutoreconnectIteration = this.handleAutoreconnectIteration;
|
||||||
HashNavigation.navigateTo('');
|
HashNavigation.navigateTo('');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1517,6 +1536,7 @@ class TinodeWeb extends React.Component {
|
|||||||
title={this.state.sidePanelTitle}
|
title={this.state.sidePanelTitle}
|
||||||
avatar={this.state.sidePanelAvatar}
|
avatar={this.state.sidePanelAvatar}
|
||||||
login={this.state.login}
|
login={this.state.login}
|
||||||
|
persist={this.state.persist}
|
||||||
myUserId={this.state.myUserId}
|
myUserId={this.state.myUserId}
|
||||||
loginDisabled={this.state.loginDisabled}
|
loginDisabled={this.state.loginDisabled}
|
||||||
loadSpinnerVisible={this.state.loadSpinnerVisible}
|
loadSpinnerVisible={this.state.loadSpinnerVisible}
|
||||||
@@ -1544,6 +1564,7 @@ class TinodeWeb extends React.Component {
|
|||||||
onSettings={this.handleSettings}
|
onSettings={this.handleSettings}
|
||||||
onBasicNavigate={this.basicNavigator}
|
onBasicNavigate={this.basicNavigator}
|
||||||
onLoginRequest={this.handleLoginRequest}
|
onLoginRequest={this.handleLoginRequest}
|
||||||
|
onPersistenceChange={this.handlePersistenceChange}
|
||||||
onCreateAccount={this.handleNewAccountRequest}
|
onCreateAccount={this.handleNewAccountRequest}
|
||||||
onUpdateAccount={this.handleUpdateAccountRequest}
|
onUpdateAccount={this.handleUpdateAccountRequest}
|
||||||
onUpdateAccountTags={this.handleUpdateAccountTagsRequest}
|
onUpdateAccountTags={this.handleUpdateAccountTagsRequest}
|
||||||
|
|||||||
@@ -204,6 +204,7 @@ function draftyFormatter(style, data, values, key) {
|
|||||||
if (attr.src) {
|
if (attr.src) {
|
||||||
attr.onClick = this.handleImagePreview;
|
attr.onClick = this.handleImagePreview;
|
||||||
attr.className += ' image-clickable';
|
attr.className += ' image-clickable';
|
||||||
|
attr.loading = 'lazy';
|
||||||
} else {
|
} else {
|
||||||
attr.src = 'img/broken_image.png';
|
attr.src = 'img/broken_image.png';
|
||||||
}
|
}
|
||||||
|
|||||||
+38
-13
@@ -210,7 +210,8 @@ function imageScaled(fileOrBlob, maxWidth, maxHeight, maxSize, forceSquare, onSu
|
|||||||
}
|
}
|
||||||
|
|
||||||
canvas = null;
|
canvas = null;
|
||||||
onSuccess(blob, mime, dim.dstWidth, dim.dstHeight, fileNameForMime(fileOrBlob.name, mime));
|
console.log("imageScaled", blob);
|
||||||
|
onSuccess(mime, blob, dim.dstWidth, dim.dstHeight, fileNameForMime(fileOrBlob.name, mime));
|
||||||
};
|
};
|
||||||
|
|
||||||
img.src = URL.createObjectURL(fileOrBlob);
|
img.src = URL.createObjectURL(fileOrBlob);
|
||||||
@@ -220,6 +221,7 @@ function fileToBase64(file, onSuccess) {
|
|||||||
reader.addEventListener('load', function () {
|
reader.addEventListener('load', function () {
|
||||||
onSuccess(file.type, reader.result.split(',')[1], file.name);
|
onSuccess(file.type, reader.result.split(',')[1], file.name);
|
||||||
});
|
});
|
||||||
|
console.log("fileToBase64", file);
|
||||||
reader.readAsDataURL(file);
|
reader.readAsDataURL(file);
|
||||||
}
|
}
|
||||||
function blobToBase64(blob, onSuccess) {
|
function blobToBase64(blob, onSuccess) {
|
||||||
@@ -720,7 +722,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
/* harmony export */ "PACKAGE_VERSION": () => (/* binding */ PACKAGE_VERSION)
|
/* harmony export */ "PACKAGE_VERSION": () => (/* binding */ PACKAGE_VERSION)
|
||||||
/* harmony export */ });
|
/* harmony export */ });
|
||||||
const PACKAGE_VERSION = "0.17.1";
|
const PACKAGE_VERSION = "0.17.2-alpha1";
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
@@ -2825,7 +2827,7 @@ class LoginView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
login: props.login,
|
login: props.login,
|
||||||
password: '',
|
password: '',
|
||||||
hostName: props.serverAddress,
|
hostName: props.serverAddress,
|
||||||
saveToken: _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_4__.default.getObject('keep-logged-in')
|
saveToken: props.persist
|
||||||
};
|
};
|
||||||
this.handleLoginChange = this.handleLoginChange.bind(this);
|
this.handleLoginChange = this.handleLoginChange.bind(this);
|
||||||
this.handlePasswordChange = this.handlePasswordChange.bind(this);
|
this.handlePasswordChange = this.handlePasswordChange.bind(this);
|
||||||
@@ -2846,7 +2848,7 @@ class LoginView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleToggleSaveToken() {
|
handleToggleSaveToken() {
|
||||||
_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_4__.default.setObject('keep-logged-in', !this.state.saveToken);
|
this.props.onPersistenceChange(!this.state.saveToken);
|
||||||
this.setState({
|
this.setState({
|
||||||
saveToken: !this.state.saveToken
|
saveToken: !this.state.saveToken
|
||||||
});
|
});
|
||||||
@@ -4637,14 +4639,9 @@ const messages = (0,react_intl__WEBPACK_IMPORTED_MODULE_1__.defineMessages)({
|
|||||||
class SidepanelView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
|
class SidepanelView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.handleLoginRequested = this.handleLoginRequested.bind(this);
|
|
||||||
this.handleNewTopic = this.handleNewTopic.bind(this);
|
this.handleNewTopic = this.handleNewTopic.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleLoginRequested(login, password) {
|
|
||||||
this.props.onLoginRequest(login, password);
|
|
||||||
}
|
|
||||||
|
|
||||||
handleNewTopic() {
|
handleNewTopic() {
|
||||||
this.props.onBasicNavigate('newtpk');
|
this.props.onBasicNavigate('newtpk');
|
||||||
}
|
}
|
||||||
@@ -4693,7 +4690,9 @@ class SidepanelView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compon
|
|||||||
}), view === 'login' ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_login_view_jsx__WEBPACK_IMPORTED_MODULE_12__.default, {
|
}), view === 'login' ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_login_view_jsx__WEBPACK_IMPORTED_MODULE_12__.default, {
|
||||||
login: this.props.login,
|
login: this.props.login,
|
||||||
disabled: this.props.loginDisabled,
|
disabled: this.props.loginDisabled,
|
||||||
onLogin: this.handleLoginRequested
|
persist: this.props.persist,
|
||||||
|
onLogin: this.props.onLoginRequest,
|
||||||
|
onPersistenceChange: this.props.onPersistenceChange
|
||||||
}) : view === 'register' ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_create_account_view_jsx__WEBPACK_IMPORTED_MODULE_6__.default, {
|
}) : view === 'register' ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_create_account_view_jsx__WEBPACK_IMPORTED_MODULE_6__.default, {
|
||||||
onCreateAccount: this.props.onCreateAccount,
|
onCreateAccount: this.props.onCreateAccount,
|
||||||
onCancel: this.props.onCancel,
|
onCancel: this.props.onCancel,
|
||||||
@@ -4896,6 +4895,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
this.handleVisibilityEvent = this.handleVisibilityEvent.bind(this);
|
this.handleVisibilityEvent = this.handleVisibilityEvent.bind(this);
|
||||||
this.handleError = this.handleError.bind(this);
|
this.handleError = this.handleError.bind(this);
|
||||||
this.handleLoginRequest = this.handleLoginRequest.bind(this);
|
this.handleLoginRequest = this.handleLoginRequest.bind(this);
|
||||||
|
this.handlePersistenceChange = this.handlePersistenceChange.bind(this);
|
||||||
this.handleConnected = this.handleConnected.bind(this);
|
this.handleConnected = this.handleConnected.bind(this);
|
||||||
this.handleAutoreconnectIteration = this.handleAutoreconnectIteration.bind(this);
|
this.handleAutoreconnectIteration = this.handleAutoreconnectIteration.bind(this);
|
||||||
this.doLogin = this.doLogin.bind(this);
|
this.doLogin = this.doLogin.bind(this);
|
||||||
@@ -4982,6 +4982,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
loadSpinnerVisible: false,
|
loadSpinnerVisible: false,
|
||||||
login: '',
|
login: '',
|
||||||
password: '',
|
password: '',
|
||||||
|
persist: persist,
|
||||||
myUserId: null,
|
myUserId: null,
|
||||||
liveConnection: navigator.onLine,
|
liveConnection: navigator.onLine,
|
||||||
topicSelected: '',
|
topicSelected: '',
|
||||||
@@ -5024,9 +5025,8 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
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_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, this.state.persist, resolve);
|
||||||
this.tinode.onConnect = this.handleConnected;
|
this.tinode.onConnect = this.handleConnected;
|
||||||
this.tinode.onDisconnect = this.handleDisconnect;
|
this.tinode.onDisconnect = this.handleDisconnect;
|
||||||
this.tinode.onAutoreconnectIteration = this.handleAutoreconnectIteration;
|
this.tinode.onAutoreconnectIteration = this.handleAutoreconnectIteration;
|
||||||
@@ -5045,7 +5045,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
|
|
||||||
const parsedNav = _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.parseUrlHash(window.location.hash);
|
const parsedNav = _lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.parseUrlHash(window.location.hash);
|
||||||
this.resetContactList();
|
this.resetContactList();
|
||||||
const token = keepLoggedIn ? _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.default.getObject('auth-token') : undefined;
|
const token = this.state.persist ? _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.default.getObject('auth-token') : undefined;
|
||||||
|
|
||||||
if (token) {
|
if (token) {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -5289,6 +5289,26 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handlePersistenceChange(persist) {
|
||||||
|
if (persist) {
|
||||||
|
this.tinode.initStorage().then(() => {
|
||||||
|
console.log("storage initialized");
|
||||||
|
_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.default.setObject('keep-logged-in', true);
|
||||||
|
this.setState({
|
||||||
|
persist: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.tinode.clearStorage().then(() => {
|
||||||
|
console.log("storage cleared");
|
||||||
|
_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_15__.default.setObject('keep-logged-in', false);
|
||||||
|
this.setState({
|
||||||
|
persist: false
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handleConnected() {
|
handleConnected() {
|
||||||
clearInterval(this.reconnectCountdown);
|
clearInterval(this.reconnectCountdown);
|
||||||
this.handleError();
|
this.handleError();
|
||||||
@@ -5824,6 +5844,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
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 = 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.tinode.onAutoreconnectIteration = this.handleAutoreconnectIteration;
|
||||||
this.setState({
|
this.setState({
|
||||||
serverAddress: serverAddress,
|
serverAddress: serverAddress,
|
||||||
transport: transport
|
transport: transport
|
||||||
@@ -6122,6 +6143,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
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 = 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;
|
||||||
|
this.tinode.onAutoreconnectIteration = this.handleAutoreconnectIteration;
|
||||||
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo('');
|
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_16__.default.navigateTo('');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6398,6 +6420,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
title: this.state.sidePanelTitle,
|
title: this.state.sidePanelTitle,
|
||||||
avatar: this.state.sidePanelAvatar,
|
avatar: this.state.sidePanelAvatar,
|
||||||
login: this.state.login,
|
login: this.state.login,
|
||||||
|
persist: this.state.persist,
|
||||||
myUserId: this.state.myUserId,
|
myUserId: this.state.myUserId,
|
||||||
loginDisabled: this.state.loginDisabled,
|
loginDisabled: this.state.loginDisabled,
|
||||||
loadSpinnerVisible: this.state.loadSpinnerVisible,
|
loadSpinnerVisible: this.state.loadSpinnerVisible,
|
||||||
@@ -6421,6 +6444,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
onSettings: this.handleSettings,
|
onSettings: this.handleSettings,
|
||||||
onBasicNavigate: this.basicNavigator,
|
onBasicNavigate: this.basicNavigator,
|
||||||
onLoginRequest: this.handleLoginRequest,
|
onLoginRequest: this.handleLoginRequest,
|
||||||
|
onPersistenceChange: this.handlePersistenceChange,
|
||||||
onCreateAccount: this.handleNewAccountRequest,
|
onCreateAccount: this.handleNewAccountRequest,
|
||||||
onUpdateAccount: this.handleUpdateAccountRequest,
|
onUpdateAccount: this.handleUpdateAccountRequest,
|
||||||
onUpdateAccountTags: this.handleUpdateAccountTagsRequest,
|
onUpdateAccountTags: this.handleUpdateAccountTagsRequest,
|
||||||
@@ -7204,6 +7228,7 @@ function draftyFormatter(style, data, values, key) {
|
|||||||
if (attr.src) {
|
if (attr.src) {
|
||||||
attr.onClick = this.handleImagePreview;
|
attr.onClick = this.handleImagePreview;
|
||||||
attr.className += ' image-clickable';
|
attr.className += ' image-clickable';
|
||||||
|
attr.loading = 'lazy';
|
||||||
} else {
|
} else {
|
||||||
attr.src = 'img/broken_image.png';
|
attr.src = 'img/broken_image.png';
|
||||||
}
|
}
|
||||||
|
|||||||
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
+533
-483
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
// This is a generated file. Don't edit.
|
// This is a generated file. Don't edit.
|
||||||
|
|
||||||
const PACKAGE_VERSION = "0.17.1";
|
const PACKAGE_VERSION = "0.17.2-alpha1";
|
||||||
|
|||||||
Reference in New Issue
Block a user