edited for code style consistency
This commit is contained in:
@@ -138,10 +138,10 @@ export function imageCrop(mime, objURL, left, top, width, height, scale) {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const img = new Image();
|
const img = new Image();
|
||||||
img.crossOrigin = 'Anonymous';
|
img.crossOrigin = 'Anonymous';
|
||||||
img.onerror = (err) => {
|
img.onerror = _ => {
|
||||||
reject(new Error("Image format unrecognized"));
|
reject(new Error("Image format unrecognized"));
|
||||||
};
|
};
|
||||||
img.onload = () => {
|
img.onload = _ => {
|
||||||
// Once the image is loaded, the URL is no longer needed.
|
// Once the image is loaded, the URL is no longer needed.
|
||||||
URL.revokeObjectURL(img.src);
|
URL.revokeObjectURL(img.src);
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ export function fileToBase64(file) {
|
|||||||
reader.onerror = (evt) => {
|
reader.onerror = (evt) => {
|
||||||
reject(reader.error);
|
reject(reader.error);
|
||||||
};
|
};
|
||||||
reader.onload = () => {
|
reader.onload = _ => {
|
||||||
resolve({mime: file.type, bits: reader.result.split(',')[1], name: file.name});
|
resolve({mime: file.type, bits: reader.result.split(',')[1], name: file.name});
|
||||||
};
|
};
|
||||||
reader.readAsDataURL(file);
|
reader.readAsDataURL(file);
|
||||||
@@ -189,7 +189,7 @@ export function blobToBase64(blob) {
|
|||||||
reader.onerror = _ => {
|
reader.onerror = _ => {
|
||||||
reject(reader.error);
|
reject(reader.error);
|
||||||
};
|
};
|
||||||
reader.onload = () => {
|
reader.onload = _ => {
|
||||||
resolve({mime: blob.type, bits: reader.result.split(',')[1]});
|
resolve({mime: blob.type, bits: reader.result.split(',')[1]});
|
||||||
};
|
};
|
||||||
reader.readAsDataURL(blob);
|
reader.readAsDataURL(blob);
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class AccSecurityView extends React.Component {
|
|||||||
this.props.onShowAlert(
|
this.props.onShowAlert(
|
||||||
formatMessage(messages.delete_account), // title
|
formatMessage(messages.delete_account), // title
|
||||||
formatMessage(messages.delete_account_warning), // content
|
formatMessage(messages.delete_account_warning), // content
|
||||||
(() => { this.props.onDeleteAccount(); }), // onConfirm
|
(_ => this.props.onDeleteAccount()), // onConfirm
|
||||||
null, // use default text "OK"
|
null, // use default text "OK"
|
||||||
true, // Show Reject button
|
true, // Show Reject button
|
||||||
null // use default text "Cancel"
|
null // use default text "Cancel"
|
||||||
|
|||||||
@@ -410,11 +410,10 @@ class InfoView extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const isMe = this.props.tinode.isMe(params.topicName);
|
const isMe = this.props.tinode.isMe(params.topicName);
|
||||||
const menuItems = [
|
const menuItems = [{
|
||||||
{title: formatMessage(messages.edit_permissions), handler: () => {
|
title: formatMessage(messages.edit_permissions),
|
||||||
this.handleLaunchPermissionsEditor(isMe ? 'want' : 'user', params.topicName);
|
handler: _ => this.handleLaunchPermissionsEditor(isMe ? 'want' : 'user', params.topicName)
|
||||||
}}
|
}];
|
||||||
];
|
|
||||||
if (!isMe) {
|
if (!isMe) {
|
||||||
menuItems.push('member_delete');
|
menuItems.push('member_delete');
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-13
@@ -400,7 +400,7 @@ class MessagesView extends React.Component {
|
|||||||
|
|
||||||
const setQuery = newTopic ? this.props.newTopicParams : undefined;
|
const setQuery = newTopic ? this.props.newTopicParams : undefined;
|
||||||
topic.subscribe(getQuery.build(), setQuery)
|
topic.subscribe(getQuery.build(), setQuery)
|
||||||
.then((ctrl) => {
|
.then(ctrl => {
|
||||||
if (ctrl.code == 303) {
|
if (ctrl.code == 303) {
|
||||||
// Redirect to another topic requested.
|
// Redirect to another topic requested.
|
||||||
HashNavigation.navigateTo(HashNavigation.setUrlTopic('', ctrl.params.topic));
|
HashNavigation.navigateTo(HashNavigation.setUrlTopic('', ctrl.params.topic));
|
||||||
@@ -430,7 +430,7 @@ class MessagesView extends React.Component {
|
|||||||
topic.delMessagesList(calls, true);
|
topic.delMessagesList(calls, true);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch(err => {
|
||||||
console.error("Failed subscription to", this.state.topic, err);
|
console.error("Failed subscription to", this.state.topic, err);
|
||||||
this.props.onError(err.message, 'err');
|
this.props.onError(err.message, 'err');
|
||||||
const blankState = MessagesView.getDerivedStateFromProps({}, {});
|
const blankState = MessagesView.getDerivedStateFromProps({}, {});
|
||||||
@@ -447,8 +447,8 @@ class MessagesView extends React.Component {
|
|||||||
const oldTopic = this.props.tinode.getTopic(oldTopicName);
|
const oldTopic = this.props.tinode.getTopic(oldTopicName);
|
||||||
if (oldTopic && oldTopic.isSubscribed()) {
|
if (oldTopic && oldTopic.isSubscribed()) {
|
||||||
oldTopic.leave(false)
|
oldTopic.leave(false)
|
||||||
.catch(() => { /* do nothing here */ })
|
.catch(_ => { /* do nothing here */ })
|
||||||
.finally(() => {
|
.finally(_ => {
|
||||||
// We don't care if the request succeeded or failed.
|
// We don't care if the request succeeded or failed.
|
||||||
// The topic is dead regardless.
|
// The topic is dead regardless.
|
||||||
this.setState({fetchingMessages: false});
|
this.setState({fetchingMessages: false});
|
||||||
@@ -487,10 +487,10 @@ class MessagesView extends React.Component {
|
|||||||
if (event.target.scrollTop <= 0) {
|
if (event.target.scrollTop <= 0) {
|
||||||
const topic = this.props.tinode.getTopic(this.state.topic);
|
const topic = this.props.tinode.getTopic(this.state.topic);
|
||||||
if (topic && topic.isSubscribed() && topic.msgHasMoreMessages()) {
|
if (topic && topic.isSubscribed() && topic.msgHasMoreMessages()) {
|
||||||
this.setState({fetchingMessages: true}, () => {
|
this.setState({fetchingMessages: true}, _ => {
|
||||||
topic.getMessagesPage(MESSAGES_PAGE)
|
topic.getMessagesPage(MESSAGES_PAGE)
|
||||||
.catch((err) => this.props.onError(err.message, 'err'))
|
.catch(err => this.props.onError(err.message, 'err'))
|
||||||
.finally(() => this.setState({fetchingMessages: false}));
|
.finally(_ => this.setState({fetchingMessages: false}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -656,9 +656,7 @@ class MessagesView extends React.Component {
|
|||||||
switch (info.what) {
|
switch (info.what) {
|
||||||
case 'kp': {
|
case 'kp': {
|
||||||
clearTimeout(this.keyPressTimer);
|
clearTimeout(this.keyPressTimer);
|
||||||
this.keyPressTimer = setTimeout(() => {
|
this.keyPressTimer = setTimeout(_ => this.setState({typingIndicator: false}), KEYPRESS_DELAY + 1000);
|
||||||
this.setState({typingIndicator: false});
|
|
||||||
}, KEYPRESS_DELAY + 1000);
|
|
||||||
if (!this.state.typingIndicator) {
|
if (!this.state.typingIndicator) {
|
||||||
this.setState({typingIndicator: true});
|
this.setState({typingIndicator: true});
|
||||||
}
|
}
|
||||||
@@ -893,9 +891,8 @@ class MessagesView extends React.Component {
|
|||||||
}
|
}
|
||||||
// Pass data and the uploader to the TinodeWeb.
|
// Pass data and the uploader to the TinodeWeb.
|
||||||
this.sendMessage(msg, uploadCompletionPromise, uploader);
|
this.sendMessage(msg, uploadCompletionPromise, uploader);
|
||||||
}).catch((err) => {
|
})
|
||||||
this.props.onError(err, 'err');
|
.catch(err => this.props.onError(err, 'err'));
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,9 +35,7 @@ export default class PasswordResetView extends React.PureComponent {
|
|||||||
} else {
|
} else {
|
||||||
const email = this.state.email.trim();
|
const email = this.state.email.trim();
|
||||||
this.setState({email: email});
|
this.setState({email: email});
|
||||||
this.props.onRequest('email', email).then(() => {
|
this.props.onRequest('email', email).then(_ => this.setState({sent: true}));
|
||||||
this.setState({sent: true});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+74
-105
@@ -303,7 +303,7 @@ class TinodeWeb extends React.Component {
|
|||||||
if (this.state.desktopAlerts) {
|
if (this.state.desktopAlerts) {
|
||||||
this.tinode.setDeviceToken(this.state.firebaseToken);
|
this.tinode.setDeviceToken(this.state.firebaseToken);
|
||||||
}
|
}
|
||||||
}).catch(() => {
|
}).catch(_ => {
|
||||||
// do nothing: handled earlier.
|
// do nothing: handled earlier.
|
||||||
// catch needed to pervent unnecessary logging of error.
|
// catch needed to pervent unnecessary logging of error.
|
||||||
});
|
});
|
||||||
@@ -322,7 +322,7 @@ class TinodeWeb extends React.Component {
|
|||||||
// 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');
|
||||||
});
|
});
|
||||||
@@ -400,7 +400,7 @@ class TinodeWeb extends React.Component {
|
|||||||
// (a) for channels always,
|
// (a) for channels always,
|
||||||
// (b) pushes when the app is in foreground but has no focus.
|
// (b) pushes when the app is in foreground but has no focus.
|
||||||
firebaseOnMessage(this.fcm, (payload) => { this.handlePushMessage(payload); });
|
firebaseOnMessage(this.fcm, (payload) => { this.handlePushMessage(payload); });
|
||||||
}).catch((err) => {
|
}).catch(err => {
|
||||||
// SW registration or FCM has failed :(
|
// SW registration or FCM has failed :(
|
||||||
onError(err);
|
onError(err);
|
||||||
throw err;
|
throw err;
|
||||||
@@ -454,9 +454,9 @@ class TinodeWeb extends React.Component {
|
|||||||
|
|
||||||
// Check if a newer version of TinodeWeb app is available at the server.
|
// Check if a newer version of TinodeWeb app is available at the server.
|
||||||
checkForAppUpdate(reg) {
|
checkForAppUpdate(reg) {
|
||||||
reg.onupdatefound = () => {
|
reg.onupdatefound = _ => {
|
||||||
const installingWorker = reg.installing;
|
const installingWorker = reg.installing;
|
||||||
installingWorker.onstatechange = () => {
|
installingWorker.onstatechange = _ => {
|
||||||
if (installingWorker.state == 'installed' && navigator.serviceWorker.controller) {
|
if (installingWorker.state == 'installed' && navigator.serviceWorker.controller) {
|
||||||
const msg = <>
|
const msg = <>
|
||||||
<FormattedMessage id="update_available"
|
<FormattedMessage id="update_available"
|
||||||
@@ -570,7 +570,7 @@ class TinodeWeb extends React.Component {
|
|||||||
if (this.tinode.isConnected()) {
|
if (this.tinode.isConnected()) {
|
||||||
this.doLogin(login, password, null, {meth: this.state.credMethod, resp: this.state.credCode});
|
this.doLogin(login, password, null, {meth: this.state.credMethod, resp: this.state.credCode});
|
||||||
} else {
|
} else {
|
||||||
this.tinode.connect().catch((err) => {
|
this.tinode.connect().catch(err => {
|
||||||
// Socket error
|
// Socket error
|
||||||
this.setState({loginDisabled: false, autoLogin: false, loadSpinnerVisible: false});
|
this.setState({loginDisabled: false, autoLogin: false, loadSpinnerVisible: false});
|
||||||
this.handleError(err.message, 'err');
|
this.handleError(err.message, 'err');
|
||||||
@@ -581,12 +581,12 @@ class TinodeWeb extends React.Component {
|
|||||||
// Enable or disable saving the password and IndexedDB.
|
// Enable or disable saving the password and IndexedDB.
|
||||||
handlePersistenceChange(persist) {
|
handlePersistenceChange(persist) {
|
||||||
if (persist) {
|
if (persist) {
|
||||||
this.tinode.initStorage().then(() => {
|
this.tinode.initStorage().then(_ => {
|
||||||
LocalStorageUtil.setObject('keep-logged-in', true);
|
LocalStorageUtil.setObject('keep-logged-in', true);
|
||||||
this.setState({persist: true});
|
this.setState({persist: true});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.tinode.clearStorage().then(() => {
|
this.tinode.clearStorage().then(_ => {
|
||||||
LocalStorageUtil.setObject('keep-logged-in', false);
|
LocalStorageUtil.setObject('keep-logged-in', false);
|
||||||
this.setState({persist: false});
|
this.setState({persist: false});
|
||||||
});
|
});
|
||||||
@@ -625,7 +625,7 @@ class TinodeWeb extends React.Component {
|
|||||||
prom.then(_ => {
|
prom.then(_ => {
|
||||||
// Reconnected: clear error
|
// Reconnected: clear error
|
||||||
this.handleError();
|
this.handleError();
|
||||||
}).catch((err) => {
|
}).catch(err => {
|
||||||
this.handleError(err.message, 'err');
|
this.handleError(err.message, 'err');
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@@ -701,7 +701,7 @@ class TinodeWeb extends React.Component {
|
|||||||
loginPromise = connectionPromise.then(_ => this.tinode.loginToken(token, cred));
|
loginPromise = connectionPromise.then(_ => this.tinode.loginToken(token, cred));
|
||||||
}
|
}
|
||||||
|
|
||||||
loginPromise.then((ctrl) => {
|
loginPromise.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) {
|
||||||
@@ -711,7 +711,7 @@ class TinodeWeb extends React.Component {
|
|||||||
} else {
|
} else {
|
||||||
this.handleLoginSuccessful();
|
this.handleLoginSuccessful();
|
||||||
}
|
}
|
||||||
}).catch((err) => {
|
}).catch(err => {
|
||||||
// Connection or login failed, report error.
|
// Connection or login failed, report error.
|
||||||
this.setState({
|
this.setState({
|
||||||
loginDisabled: false,
|
loginDisabled: false,
|
||||||
@@ -768,12 +768,12 @@ class TinodeWeb extends React.Component {
|
|||||||
withTags().
|
withTags().
|
||||||
withCred().
|
withCred().
|
||||||
build()
|
build()
|
||||||
).catch((err) => {
|
).catch(err => {
|
||||||
this.tinode.disconnect();
|
this.tinode.disconnect();
|
||||||
localStorage.removeItem('auth-token');
|
localStorage.removeItem('auth-token');
|
||||||
this.handleError(err.message, 'err');
|
this.handleError(err.message, 'err');
|
||||||
HashNavigation.navigateTo('');
|
HashNavigation.navigateTo('');
|
||||||
}).finally(() => {
|
}).finally(_ => {
|
||||||
this.setState({loadSpinnerVisible: false});
|
this.setState({loadSpinnerVisible: false});
|
||||||
});
|
});
|
||||||
let urlHash = HashNavigation.setUrlSidePanel(window.location.hash, 'contacts');
|
let urlHash = HashNavigation.setUrlSidePanel(window.location.hash, 'contacts');
|
||||||
@@ -934,7 +934,7 @@ class TinodeWeb extends React.Component {
|
|||||||
if (fnd.isSubscribed()) {
|
if (fnd.isSubscribed()) {
|
||||||
this.tnFndSubsUpdated();
|
this.tnFndSubsUpdated();
|
||||||
} else {
|
} else {
|
||||||
fnd.subscribe(fnd.startMetaQuery().withSub().build()).catch((err) => {
|
fnd.subscribe(fnd.startMetaQuery().withSub().build()).catch(err => {
|
||||||
this.handleError(err.message, 'err');
|
this.handleError(err.message, 'err');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -957,11 +957,9 @@ class TinodeWeb extends React.Component {
|
|||||||
*/
|
*/
|
||||||
handleSearchContacts(query) {
|
handleSearchContacts(query) {
|
||||||
const fnd = this.tinode.getFndTopic();
|
const fnd = this.tinode.getFndTopic();
|
||||||
fnd.setMeta({desc: {public: query}}).then((ctrl) => {
|
fnd.setMeta({desc: {public: query}})
|
||||||
return fnd.getMeta(fnd.startMetaQuery().withSub().build());
|
.then(_ => fnd.getMeta(fnd.startMetaQuery().withSub().build()))
|
||||||
}).catch((err) => {
|
.catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// User clicked on a topic in the side panel or deleted a topic.
|
// User clicked on a topic in the side panel or deleted a topic.
|
||||||
@@ -1043,7 +1041,7 @@ class TinodeWeb extends React.Component {
|
|||||||
// Topic is not subscribed yet. Subscribe.
|
// Topic is not subscribed yet. Subscribe.
|
||||||
const subscribePromise =
|
const subscribePromise =
|
||||||
topic.subscribe()
|
topic.subscribe()
|
||||||
.then(() => {
|
.then(_ => {
|
||||||
// If there are unsent messages (except video call messages),
|
// If there are unsent messages (except video call messages),
|
||||||
// try sending them now. Unsent video call messages will be dropped.
|
// try sending them now. Unsent video call messages will be dropped.
|
||||||
let calls = [];
|
let calls = [];
|
||||||
@@ -1069,15 +1067,13 @@ class TinodeWeb extends React.Component {
|
|||||||
|
|
||||||
// TODO: check if return is required.
|
// TODO: check if return is required.
|
||||||
return topic.publishDraft(msg, Promise.all(completion))
|
return topic.publishDraft(msg, Promise.all(completion))
|
||||||
.then((ctrl) => {
|
.then(ctrl => {
|
||||||
if (topic.isArchived()) {
|
if (topic.isArchived()) {
|
||||||
topic.archive(false);
|
topic.archive(false);
|
||||||
}
|
}
|
||||||
return ctrl;
|
return ctrl;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleNewChatInvitation(topicName, action) {
|
handleNewChatInvitation(topicName, action) {
|
||||||
@@ -1091,9 +1087,7 @@ class TinodeWeb extends React.Component {
|
|||||||
if (topic.isP2PType()) {
|
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(_ => topic.setMeta({sub: {user: topicName, mode: mode}}));
|
||||||
topic.setMeta({sub: {user: topicName, mode: mode}});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
@@ -1104,18 +1098,14 @@ class TinodeWeb extends React.Component {
|
|||||||
// Ban the topic making futher invites impossible.
|
// Ban the topic making futher invites impossible.
|
||||||
// Just self-ban.
|
// Just self-ban.
|
||||||
const am = topic.getAccessMode().updateWant('-JP').getWant();
|
const am = topic.getAccessMode().updateWant('-JP').getWant();
|
||||||
response = topic.setMeta({sub: {mode: am}}).then((ctrl) => {
|
response = topic.setMeta({sub: {mode: am}}).then(_ => this.handleTopicSelected(null));
|
||||||
return this.handleTopicSelected(null);
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.warn("Unknown invitation action", '"' + action + '""');
|
console.warn("Unknown invitation action", '"' + action + '""');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response != null) {
|
if (response != null) {
|
||||||
response.catch((err) => {
|
response.catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1156,7 +1146,7 @@ class TinodeWeb extends React.Component {
|
|||||||
|
|
||||||
const me = this.tinode.getMeTopic();
|
const me = this.tinode.getMeTopic();
|
||||||
const am = me.getAccessMode().updateWant(on ? '-P' : '+P').getWant();
|
const am = me.getAccessMode().updateWant(on ? '-P' : '+P').getWant();
|
||||||
me.setMeta({sub: {mode: am}}).catch((err) => {
|
me.setMeta({sub: {mode: am}}).catch(err => {
|
||||||
// Request failed, keep existing state.
|
// Request failed, keep existing state.
|
||||||
this.setState({incognitoMode: !on});
|
this.setState({incognitoMode: !on});
|
||||||
this.handleError(err.message, 'err');
|
this.handleError(err.message, 'err');
|
||||||
@@ -1165,9 +1155,7 @@ class TinodeWeb extends React.Component {
|
|||||||
|
|
||||||
handleUpdateAccountTagsRequest(tags) {
|
handleUpdateAccountTagsRequest(tags) {
|
||||||
this.tinode.getMeTopic().setMeta({tags: tags})
|
this.tinode.getMeTopic().setMeta({tags: tags})
|
||||||
.catch((err) => {
|
.catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// User chose Settings menu item.
|
// User chose Settings menu item.
|
||||||
@@ -1235,9 +1223,9 @@ class TinodeWeb extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (this.state.firebaseToken && this.fcm) {
|
} else if (this.state.firebaseToken && this.fcm) {
|
||||||
firebaseDelToken(this.fcm).catch((err) => {
|
firebaseDelToken(this.fcm).catch(err => {
|
||||||
console.error("Unable to delete token.", err);
|
console.error("Unable to delete token.", err);
|
||||||
}).finally(() => {
|
}).finally(_ => {
|
||||||
LocalStorageUtil.updateObject('settings', {desktopAlerts: false});
|
LocalStorageUtil.updateObject('settings', {desktopAlerts: false});
|
||||||
localStorage.removeItem('firebase-token');
|
localStorage.removeItem('firebase-token');
|
||||||
this.setState({desktopAlerts: false, firebaseToken: null});
|
this.setState({desktopAlerts: false, firebaseToken: null});
|
||||||
@@ -1259,16 +1247,14 @@ class TinodeWeb extends React.Component {
|
|||||||
|
|
||||||
handleCredAdd(method, value) {
|
handleCredAdd(method, value) {
|
||||||
const me = this.tinode.getMeTopic();
|
const me = this.tinode.getMeTopic();
|
||||||
me.setMeta({cred: {meth: method, val: value}}).catch((err) => {
|
me.setMeta({cred: {meth: method, val: value}})
|
||||||
this.handleError(err.message, 'err');
|
.catch(err => this.handleError(err.message, 'err'));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCredDelete(method, value) {
|
handleCredDelete(method, value) {
|
||||||
const me = this.tinode.getMeTopic();
|
const me = this.tinode.getMeTopic();
|
||||||
me.delCredential(method, value).catch((err) => {
|
me.delCredential(method, value)
|
||||||
this.handleError(err.message, 'err');
|
.catch(err => this.handleError(err.message, 'err'));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCredConfirm(method, response) {
|
handleCredConfirm(method, response) {
|
||||||
@@ -1332,7 +1318,7 @@ class TinodeWeb extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
params._topicName = topicName;
|
params._topicName = topicName;
|
||||||
this.setState({newTopicParams: params}, () => {this.handleTopicSelected(topicName)});
|
this.setState({newTopicParams: params}, _ => {this.handleTopicSelected(topicName)});
|
||||||
}
|
}
|
||||||
|
|
||||||
// New topic was created, here is the new topic name.
|
// New topic was created, here is the new topic name.
|
||||||
@@ -1377,18 +1363,15 @@ class TinodeWeb extends React.Component {
|
|||||||
if (defacs) {
|
if (defacs) {
|
||||||
params.defacs = defacs;
|
params.defacs = defacs;
|
||||||
}
|
}
|
||||||
topic.setMeta({desc: params, attachments: attachments}).catch((err) => {
|
topic.setMeta({desc: params, attachments: attachments})
|
||||||
this.handleError(err.message, 'err');
|
.catch(err => this.handleError(err.message, 'err'));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleUnarchive(topicName) {
|
handleUnarchive(topicName) {
|
||||||
const topic = this.tinode.getTopic(topicName);
|
const topic = this.tinode.getTopic(topicName);
|
||||||
if (topic) {
|
if (topic) {
|
||||||
topic.archive(false).catch((err) => {
|
topic.archive(false).catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1396,9 +1379,8 @@ class TinodeWeb extends React.Component {
|
|||||||
this.handleError();
|
this.handleError();
|
||||||
|
|
||||||
if (password) {
|
if (password) {
|
||||||
this.tinode.updateAccountBasic(null, this.tinode.getCurrentLogin(), password).catch((err) => {
|
this.tinode.updateAccountBasic(null, this.tinode.getCurrentLogin(), password)
|
||||||
this.handleError(err.message, 'err');
|
.catch(err => this.handleError(err.message, 'err'));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1413,18 +1395,16 @@ class TinodeWeb extends React.Component {
|
|||||||
am.updateWant(mode);
|
am.updateWant(mode);
|
||||||
mode = am.getWant();
|
mode = am.getWant();
|
||||||
}
|
}
|
||||||
topic.setMeta({sub: {user: uid, mode: mode}}).catch((err) => {
|
topic.setMeta({sub: {user: uid, mode: mode}})
|
||||||
this.handleError(err.message, 'err');
|
.catch(err => this.handleError(err.message, 'err'));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleTagsUpdateRequest(topicName, tags) {
|
handleTagsUpdateRequest(topicName, tags) {
|
||||||
const topic = this.tinode.getTopic(topicName);
|
const topic = this.tinode.getTopic(topicName);
|
||||||
if (topic) {
|
if (topic) {
|
||||||
topic.setMeta({tags: tags}).catch((err) => {
|
topic.setMeta({tags: tags})
|
||||||
this.handleError(err.message, 'err');
|
.catch(err => this.handleError(err.message, 'err'));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1451,9 +1431,9 @@ class TinodeWeb extends React.Component {
|
|||||||
}
|
}
|
||||||
this.setState(this.getBlankState());
|
this.setState(this.getBlankState());
|
||||||
|
|
||||||
cleared.then(() => {
|
cleared.then(_ => {
|
||||||
this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, isSecureConnection(),
|
this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, isSecureConnection(),
|
||||||
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;
|
this.tinode.onAutoreconnectIteration = this.handleAutoreconnectIteration;
|
||||||
@@ -1477,10 +1457,10 @@ class TinodeWeb extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Request to hard-delete topic.
|
// Request to hard-delete topic.
|
||||||
topic.delTopic(true).then((ctrl) => {
|
topic.delTopic(true).then(_ => {
|
||||||
// Hide MessagesView and InfoView panels.
|
// Hide MessagesView and InfoView panels.
|
||||||
HashNavigation.navigateTo(HashNavigation.setUrlTopic(window.location.hash, ''));
|
HashNavigation.navigateTo(HashNavigation.setUrlTopic(window.location.hash, ''));
|
||||||
}).catch((err) => {
|
}).catch(err => {
|
||||||
this.handleError(err.message, 'err');
|
this.handleError(err.message, 'err');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1492,9 +1472,8 @@ class TinodeWeb extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Request hard-delete all messages.
|
// Request hard-delete all messages.
|
||||||
topic.delMessagesAll(true).catch((err) => {
|
topic.delMessagesAll(true)
|
||||||
this.handleError(err.message, 'err');
|
.catch(err => this.handleError(err.message, 'err'));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleLeaveUnsubRequest(topicName) {
|
handleLeaveUnsubRequest(topicName) {
|
||||||
@@ -1503,10 +1482,10 @@ class TinodeWeb extends React.Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
topic.leave(true).then((ctrl) => {
|
topic.leave(true).then(_ => {
|
||||||
// Hide MessagesView and InfoView panels.
|
// Hide MessagesView and InfoView panels.
|
||||||
HashNavigation.navigateTo(HashNavigation.setUrlTopic(window.location.hash, ''));
|
HashNavigation.navigateTo(HashNavigation.setUrlTopic(window.location.hash, ''));
|
||||||
}).catch((err) => {
|
}).catch(err => {
|
||||||
this.handleError(err.message, 'err');
|
this.handleError(err.message, 'err');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1517,12 +1496,12 @@ class TinodeWeb extends React.Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
topic.updateMode(null, '-JP').then(_ => {
|
topic.updateMode(null, '-JP')
|
||||||
// Hide MessagesView and InfoView panels.
|
.then(_ => {
|
||||||
HashNavigation.navigateTo(HashNavigation.setUrlTopic(window.location.hash, ''));
|
// Hide MessagesView and InfoView panels.
|
||||||
}).catch((err) => {
|
HashNavigation.navigateTo(HashNavigation.setUrlTopic(window.location.hash, ''));
|
||||||
this.handleError(err.message, 'err');
|
})
|
||||||
});
|
.catch(err => this.handleError(err.message, 'err'));
|
||||||
}
|
}
|
||||||
|
|
||||||
handleReportTopic(topicName) {
|
handleReportTopic(topicName) {
|
||||||
@@ -1535,12 +1514,12 @@ class TinodeWeb extends React.Component {
|
|||||||
this.tinode.report('report', topicName);
|
this.tinode.report('report', topicName);
|
||||||
|
|
||||||
// Remove J and P permissions.
|
// Remove J and P permissions.
|
||||||
topic.updateMode(null, '-JP').then((ctrl) => {
|
topic.updateMode(null, '-JP')
|
||||||
|
.then(_ => {
|
||||||
// Hide MessagesView and InfoView panels.
|
// Hide MessagesView and InfoView panels.
|
||||||
HashNavigation.navigateTo(HashNavigation.setUrlTopic(window.location.hash, ''));
|
HashNavigation.navigateTo(HashNavigation.setUrlTopic(window.location.hash, ''));
|
||||||
}).catch((err) => {
|
})
|
||||||
this.handleError(err.message, 'err');
|
.catch(err => this.handleError(err.message, 'err'));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleShowContextMenu(params, menuItems) {
|
handleShowContextMenu(params, menuItems) {
|
||||||
@@ -1637,7 +1616,7 @@ class TinodeWeb extends React.Component {
|
|||||||
handleContextMenuAction(action, promise, params) {
|
handleContextMenuAction(action, promise, params) {
|
||||||
if (action == 'topic_archive') {
|
if (action == 'topic_archive') {
|
||||||
if (promise && params.topicName && params.topicName == this.state.topicSelected) {
|
if (promise && params.topicName && params.topicName == this.state.topicSelected) {
|
||||||
promise.then(() => {
|
promise.then(_ => {
|
||||||
this.handleTopicSelected(null);
|
this.handleTopicSelected(null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1677,17 +1656,15 @@ class TinodeWeb extends React.Component {
|
|||||||
|
|
||||||
if (added && added.length > 0) {
|
if (added && added.length > 0) {
|
||||||
added.map((uid) => {
|
added.map((uid) => {
|
||||||
topic.invite(uid, null).catch((err) => {
|
topic.invite(uid, null)
|
||||||
this.handleError(err.message, 'err');
|
.catch(err => this.handleError(err.message, 'err'));
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (removed && removed.length > 0) {
|
if (removed && removed.length > 0) {
|
||||||
removed.map((uid) => {
|
removed.map((uid) => {
|
||||||
topic.delSubscription(uid).catch((err) => {
|
topic.delSubscription(uid)
|
||||||
this.handleError(err.message, 'err');
|
.catch(err => this.handleError(err.message, 'err'));
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1696,9 +1673,7 @@ class TinodeWeb extends React.Component {
|
|||||||
if (this.tinode.isAuthenticated()) {
|
if (this.tinode.isAuthenticated()) {
|
||||||
// Adding new email or phone number in account setting.
|
// Adding new email or phone number in account setting.
|
||||||
this.tinode.getMeTopic().setMeta({cred: {meth: cred, resp: code}})
|
this.tinode.getMeTopic().setMeta({cred: {meth: cred, resp: code}})
|
||||||
.catch((err) => {
|
.catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
// Credential validation on signup.
|
// Credential validation on signup.
|
||||||
this.setState({credMethod: cred, credCode: code, credToken: token});
|
this.setState({credMethod: cred, credCode: code, credToken: token});
|
||||||
@@ -1709,10 +1684,8 @@ class TinodeWeb extends React.Component {
|
|||||||
handlePasswordResetRequest(method, value) {
|
handlePasswordResetRequest(method, value) {
|
||||||
// If already connected, connnect() will return a resolved promise.
|
// If already connected, connnect() will return a resolved promise.
|
||||||
return this.tinode.connect()
|
return this.tinode.connect()
|
||||||
.then(() => {
|
.then(_ => this.tinode.requestResetAuthSecret('basic', method, value))
|
||||||
return this.tinode.requestResetAuthSecret('basic', method, value);
|
.catch(err => {
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
// Socket error
|
// Socket error
|
||||||
this.handleError(err.message, 'err');
|
this.handleError(err.message, 'err');
|
||||||
});
|
});
|
||||||
@@ -1724,13 +1697,9 @@ class TinodeWeb extends React.Component {
|
|||||||
this.handleError(this.props.intl.formatMessage(messages.invalid_security_token), 'err');
|
this.handleError(this.props.intl.formatMessage(messages.invalid_security_token), 'err');
|
||||||
} else {
|
} else {
|
||||||
this.tinode.connect()
|
this.tinode.connect()
|
||||||
.then(() => {
|
.then(_ => this.tinode.updateAccountBasic(null, null, newPassword, {token: token}))
|
||||||
return this.tinode.updateAccountBasic(null, null, newPassword, {token: token});
|
.then(_ => HashNavigation.navigateTo(''))
|
||||||
})
|
.catch(err => {
|
||||||
.then(() => {
|
|
||||||
HashNavigation.navigateTo('');
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
// Socket error
|
// Socket error
|
||||||
this.handleError(err.message, 'err');
|
this.handleError(err.message, 'err');
|
||||||
});
|
});
|
||||||
@@ -1749,7 +1718,7 @@ class TinodeWeb extends React.Component {
|
|||||||
case CALL_STATE_OUTGOING_INITATED:
|
case CALL_STATE_OUTGOING_INITATED:
|
||||||
let head = { webrtc: CALL_HEAD_STARTED };
|
let head = { webrtc: CALL_HEAD_STARTED };
|
||||||
this.handleSendMessage(Drafty.videoCall(), undefined, undefined, head)
|
this.handleSendMessage(Drafty.videoCall(), undefined, undefined, head)
|
||||||
.then((ctrl) => {
|
.then(ctrl => {
|
||||||
if (ctrl.code < 200 || ctrl.code >= 300 || !ctrl.params || !ctrl.params.seq) {
|
if (ctrl.code < 200 || ctrl.code >= 300 || !ctrl.params || !ctrl.params.seq) {
|
||||||
this.handleCallClose();
|
this.handleCallClose();
|
||||||
return;
|
return;
|
||||||
@@ -1836,7 +1805,7 @@ class TinodeWeb extends React.Component {
|
|||||||
// We need to switch and subscribe to callTopic first.
|
// We need to switch and subscribe to callTopic first.
|
||||||
this.setState({
|
this.setState({
|
||||||
callShouldStart: true,
|
callShouldStart: true,
|
||||||
}, () => this.handleTopicSelected(this.state.callTopic));
|
}, _ => this.handleTopicSelected(this.state.callTopic));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1955,9 +1924,9 @@ class TinodeWeb extends React.Component {
|
|||||||
visible={this.state.alertVisible}
|
visible={this.state.alertVisible}
|
||||||
title={this.state.alertParams.title}
|
title={this.state.alertParams.title}
|
||||||
content={this.state.alertParams.content}
|
content={this.state.alertParams.content}
|
||||||
onReject={this.state.alertParams.onReject ? (() => { this.setState({alertVisible: false}); }) : null}
|
onReject={this.state.alertParams.onReject ? (_ => this.setState({alertVisible: false})) : null}
|
||||||
reject={this.state.alertParams.reject}
|
reject={this.state.alertParams.reject}
|
||||||
onConfirm={() => { this.setState({alertVisible: false}); this.state.alertParams.onConfirm(); }}
|
onConfirm={_ => {this.setState({alertVisible: false}); this.state.alertParams.onConfirm();}}
|
||||||
confirm={this.state.alertParams.confirm}
|
confirm={this.state.alertParams.confirm}
|
||||||
/>
|
/>
|
||||||
<SidepanelView
|
<SidepanelView
|
||||||
|
|||||||
@@ -27,15 +27,11 @@ export default class Attachment extends React.Component {
|
|||||||
const downloader = this.props.tinode.getLargeFileHelper();
|
const downloader = this.props.tinode.getLargeFileHelper();
|
||||||
this.setState({downloader: downloader});
|
this.setState({downloader: downloader});
|
||||||
downloader.download(url, filename, mimetype,
|
downloader.download(url, filename, mimetype,
|
||||||
(loaded) => {
|
loaded => this.setState({progress: loaded / this.props.size}),
|
||||||
this.setState({progress: loaded / this.props.size});
|
err => this.props.onError(err, 'err')
|
||||||
},
|
)
|
||||||
(err) => {
|
.then(_ => this.setState({downloader: null, progress: 0}))
|
||||||
this.props.onError(err, 'err');
|
.catch(err => {
|
||||||
}
|
|
||||||
).then(() => {
|
|
||||||
this.setState({downloader: null, progress: 0});
|
|
||||||
}).catch((err) => {
|
|
||||||
if (err) {
|
if (err) {
|
||||||
this.props.onError("Error downloading file: " + err.message, 'err');
|
this.props.onError("Error downloading file: " + err.message, 'err');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ export default class AudioPlayer extends React.PureComponent {
|
|||||||
|
|
||||||
this.canvasContext.lineWidth = LINE_WIDTH;
|
this.canvasContext.lineWidth = LINE_WIDTH;
|
||||||
|
|
||||||
const drawFrame = () => {
|
const drawFrame = _ => {
|
||||||
if (!this.canvasRef.current || !this.audioPlayer) {
|
if (!this.canvasRef.current || !this.audioPlayer) {
|
||||||
// The component is unmounted.
|
// The component is unmounted.
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ export default class AudioRecorder extends React.PureComponent {
|
|||||||
let prevBarCount = 0;
|
let prevBarCount = 0;
|
||||||
let volume = 0.0;
|
let volume = 0.0;
|
||||||
let countPerBar = 0;
|
let countPerBar = 0;
|
||||||
const drawFrame = () => {
|
const drawFrame = _ => {
|
||||||
if (!this.startedOn) {
|
if (!this.startedOn) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ class CallPanel extends React.PureComponent {
|
|||||||
const desc = new RTCSessionDescription(info.payload);
|
const desc = new RTCSessionDescription(info.payload);
|
||||||
this.state.pc.setRemoteDescription(desc)
|
this.state.pc.setRemoteDescription(desc)
|
||||||
.then(_ => {
|
.then(_ => {
|
||||||
this.setState({ callInitialSetupComplete: true }, () => this.drainRemoteIceCandidatesCache());
|
this.setState({ callInitialSetupComplete: true }, _ => this.drainRemoteIceCandidatesCache());
|
||||||
})
|
})
|
||||||
.catch(this.reportError);
|
.catch(this.reportError);
|
||||||
}
|
}
|
||||||
@@ -357,7 +357,7 @@ class CallPanel extends React.PureComponent {
|
|||||||
})
|
})
|
||||||
.then(_ => {
|
.then(_ => {
|
||||||
this.props.onSendAnswer(this.props.topic, this.props.seq, pc.localDescription.toJSON());
|
this.props.onSendAnswer(this.props.topic, this.props.seq, pc.localDescription.toJSON());
|
||||||
this.setState({ callInitialSetupComplete: true }, () => this.drainRemoteIceCandidatesCache());
|
this.setState({ callInitialSetupComplete: true }, _ => this.drainRemoteIceCandidatesCache());
|
||||||
})
|
})
|
||||||
.catch(this.handleGetUserMediaError);
|
.catch(this.handleGetUserMediaError);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ class ContextMenu extends React.Component {
|
|||||||
'menu_item_forward': {
|
'menu_item_forward': {
|
||||||
id: 'menu_item_forward',
|
id: 'menu_item_forward',
|
||||||
title: formatMessage(messages.forward),
|
title: formatMessage(messages.forward),
|
||||||
handler: () => {} /* the action is taken directly in tinode-web */
|
handler: _ => {} /* the action is taken directly in tinode-web */
|
||||||
},
|
},
|
||||||
'menu_item_edit': {
|
'menu_item_edit': {
|
||||||
id: 'menu_item_edit',
|
id: 'menu_item_edit',
|
||||||
@@ -227,12 +227,10 @@ class ContextMenu extends React.Component {
|
|||||||
return props.onShowAlert(
|
return props.onShowAlert(
|
||||||
formatMessage(messages.block), // title
|
formatMessage(messages.block), // title
|
||||||
formatMessage(messages.topic_block_warning), // content
|
formatMessage(messages.topic_block_warning), // content
|
||||||
(() => {
|
(_ => this.topicPermissionSetter('-JP', params, errorHandler).then(ctrl => {
|
||||||
return this.topicPermissionSetter('-JP', params, errorHandler).then((ctrl) => {
|
this.props.onTopicRemoved(params.topicName);
|
||||||
this.props.onTopicRemoved(params.topicName);
|
return ctrl;
|
||||||
return ctrl;
|
})),
|
||||||
});
|
|
||||||
}),
|
|
||||||
null, // "OK"
|
null, // "OK"
|
||||||
true, // Show Reject button
|
true, // Show Reject button
|
||||||
null // "Cancel"
|
null // "Cancel"
|
||||||
@@ -246,13 +244,13 @@ class ContextMenu extends React.Component {
|
|||||||
return props.onShowAlert(
|
return props.onShowAlert(
|
||||||
formatMessage(messages.topic_delete), // title
|
formatMessage(messages.topic_delete), // title
|
||||||
formatMessage(messages.topic_delete_warning), // content
|
formatMessage(messages.topic_delete_warning), // content
|
||||||
(() => {
|
(_ => {
|
||||||
const topic = this.props.tinode.getTopic(params.topicName);
|
const topic = this.props.tinode.getTopic(params.topicName);
|
||||||
if (!topic) {
|
if (!topic) {
|
||||||
console.warn("Topic not found: ", params.topicName);
|
console.warn("Topic not found: ", params.topicName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return topic.delTopic(true).catch((err) => {
|
return topic.delTopic(true).catch(err => {
|
||||||
if (errorHandler) {
|
if (errorHandler) {
|
||||||
errorHandler(err.message, 'err');
|
errorHandler(err.message, 'err');
|
||||||
}
|
}
|
||||||
@@ -273,7 +271,7 @@ class ContextMenu extends React.Component {
|
|||||||
console.warn("Topic not found: ", params.topicName);
|
console.warn("Topic not found: ", params.topicName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return topic.archive(true).catch((err) => {
|
return topic.archive(true).catch(err => {
|
||||||
if (errorHandler) {
|
if (errorHandler) {
|
||||||
errorHandler(err.message, 'err');
|
errorHandler(err.message, 'err');
|
||||||
}
|
}
|
||||||
@@ -289,7 +287,7 @@ class ContextMenu extends React.Component {
|
|||||||
console.warn("Topic not found: ", params.topicName);
|
console.warn("Topic not found: ", params.topicName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return topic.archive(false).catch((err) => {
|
return topic.archive(false).catch(err => {
|
||||||
if (errorHandler) {
|
if (errorHandler) {
|
||||||
errorHandler(err.message, 'err');
|
errorHandler(err.message, 'err');
|
||||||
}
|
}
|
||||||
@@ -311,7 +309,7 @@ class ContextMenu extends React.Component {
|
|||||||
console.warn("Topic or user not found: '" + params.topicName + "', '" + params.user + "'");
|
console.warn("Topic or user not found: '" + params.topicName + "', '" + params.user + "'");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return topic.delSubscription(params.user).catch((err) => {
|
return topic.delSubscription(params.user).catch(err => {
|
||||||
if (errorHandler) {
|
if (errorHandler) {
|
||||||
errorHandler(err.message, 'err');
|
errorHandler(err.message, 'err');
|
||||||
}
|
}
|
||||||
@@ -406,7 +404,7 @@ class ContextMenu extends React.Component {
|
|||||||
topic.delMessagesAll(hard) :
|
topic.delMessagesAll(hard) :
|
||||||
topic.delMessagesList([params.seq], hard);
|
topic.delMessagesList([params.seq], hard);
|
||||||
|
|
||||||
return promise.catch((err) => {
|
return promise.catch(err => {
|
||||||
if (errorHandler) {
|
if (errorHandler) {
|
||||||
errorHandler(err.message, 'err');
|
errorHandler(err.message, 'err');
|
||||||
}
|
}
|
||||||
@@ -421,7 +419,7 @@ class ContextMenu extends React.Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const msg = topic.createMessage(params.content, false);
|
const msg = topic.createMessage(params.content, false);
|
||||||
return topic.publishDraft(msg).catch((err) => {
|
return topic.publishDraft(msg).catch(err => {
|
||||||
if (errorHandler) {
|
if (errorHandler) {
|
||||||
errorHandler(err.message, 'err');
|
errorHandler(err.message, 'err');
|
||||||
}
|
}
|
||||||
@@ -438,9 +436,7 @@ class ContextMenu extends React.Component {
|
|||||||
|
|
||||||
let result = topic.updateMode(params.user, mode);
|
let result = topic.updateMode(params.user, mode);
|
||||||
if (errorHandler) {
|
if (errorHandler) {
|
||||||
result = result.catch((err) => {
|
result = result.catch(err => errorHandler(err.message, 'err'));
|
||||||
errorHandler(err.message, 'err');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export default class InPlaceEdit extends React.Component {
|
|||||||
|
|
||||||
handleStartEditing() {
|
handleStartEditing() {
|
||||||
if (!this.props.readOnly) {
|
if (!this.props.readOnly) {
|
||||||
this.setState({active: true}, () => {
|
this.setState({active: true}, _ => {
|
||||||
if (this.selfRef.current) {
|
if (this.selfRef.current) {
|
||||||
this.selfRef.current.focus();
|
this.selfRef.current.focus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export default class LazyImage extends React.PureComponent {
|
|||||||
this.props.whenDone
|
this.props.whenDone
|
||||||
.promise
|
.promise
|
||||||
.then(data => this.setState({src: data.src, style: {...this.state.style, padding: 0}}))
|
.then(data => this.setState({src: data.src, style: {...this.state.style, padding: 0}}))
|
||||||
.catch(() => this.setState({src: 'img/broken_image.png'}));
|
.catch(_ => this.setState({src: 'img/broken_image.png'}));
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
@@ -33,7 +33,7 @@ export default class LazyImage extends React.PureComponent {
|
|||||||
this.props.whenDone
|
this.props.whenDone
|
||||||
.promise
|
.promise
|
||||||
.then(data => this.setState({src: data.src, style: {...this.state.style, padding: 0}}))
|
.then(data => this.setState({src: data.src, style: {...this.state.style, padding: 0}}))
|
||||||
.catch(() => this.setState({src: 'img/broken_image.png'}));
|
.catch(_ => this.setState({src: 'img/broken_image.png'}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class TopicSecurity extends React.PureComponent {
|
|||||||
this.props.onShowAlert(
|
this.props.onShowAlert(
|
||||||
formatMessage(messages.topic_delete), // title
|
formatMessage(messages.topic_delete), // title
|
||||||
formatMessage(messages.topic_delete_warning), // content
|
formatMessage(messages.topic_delete_warning), // content
|
||||||
(() => { this.props.onDeleteTopic(this.props.topic); }), // onConfirm
|
_ => this.props.onDeleteTopic(this.props.topic), // onConfirm
|
||||||
null, // "OK"
|
null, // "OK"
|
||||||
true, // Show Reject button
|
true, // Show Reject button
|
||||||
null // "Cancel"
|
null // "Cancel"
|
||||||
@@ -104,7 +104,7 @@ class TopicSecurity extends React.PureComponent {
|
|||||||
this.props.onShowAlert(
|
this.props.onShowAlert(
|
||||||
formatMessage(this.props.deleter ? messages.delete_messages : messages.clear_messages), // title
|
formatMessage(this.props.deleter ? messages.delete_messages : messages.clear_messages), // title
|
||||||
formatMessage(this.props.deleter ? messages.delete_messages_warning : messages.clear_messages_warning), // content
|
formatMessage(this.props.deleter ? messages.delete_messages_warning : messages.clear_messages_warning), // content
|
||||||
(() => { this.props.onDeleteMessages(this.props.topic); }), // onConfirm
|
_ => this.props.onDeleteMessages(this.props.topic), // onConfirm
|
||||||
null, // "OK"
|
null, // "OK"
|
||||||
true, // Show Reject button
|
true, // Show Reject button
|
||||||
null // "Cancel"
|
null // "Cancel"
|
||||||
@@ -117,7 +117,7 @@ class TopicSecurity extends React.PureComponent {
|
|||||||
this.props.onShowAlert(
|
this.props.onShowAlert(
|
||||||
formatMessage(messages.leave_chat), // title
|
formatMessage(messages.leave_chat), // title
|
||||||
formatMessage(messages.leave_chat_warning), // content
|
formatMessage(messages.leave_chat_warning), // content
|
||||||
(() => { this.props.onLeaveTopic(this.props.topic); }), // onConfirm
|
_ => this.props.onLeaveTopic(this.props.topic), // onConfirm
|
||||||
null, // "OK"
|
null, // "OK"
|
||||||
true, // Show Reject button
|
true, // Show Reject button
|
||||||
null // "Cancel"
|
null // "Cancel"
|
||||||
@@ -130,7 +130,7 @@ class TopicSecurity extends React.PureComponent {
|
|||||||
this.props.onShowAlert(
|
this.props.onShowAlert(
|
||||||
formatMessage(messages.block_contact), // title
|
formatMessage(messages.block_contact), // title
|
||||||
formatMessage(messages.block_contact_warning), // content
|
formatMessage(messages.block_contact_warning), // content
|
||||||
(() => { this.props.onBlockTopic(this.props.topic); }), // onConfirm
|
_ => this.props.onBlockTopic(this.props.topic), // onConfirm
|
||||||
null, // "OK"
|
null, // "OK"
|
||||||
true, // Show Reject button
|
true, // Show Reject button
|
||||||
null // "Cancel"
|
null // "Cancel"
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export default class VisiblePassword extends React.PureComponent {
|
|||||||
handleEditingFinished(e) {
|
handleEditingFinished(e) {
|
||||||
if (e) {
|
if (e) {
|
||||||
let currentTarget = e.currentTarget;
|
let currentTarget = e.currentTarget;
|
||||||
setTimeout(() => {
|
setTimeout(_ => {
|
||||||
if (!currentTarget.contains(document.activeElement)) {
|
if (!currentTarget.contains(document.activeElement)) {
|
||||||
if (this.props.onFinished) {
|
if (this.props.onFinished) {
|
||||||
this.props.onFinished(this.state.value);
|
this.props.onFinished(this.state.value);
|
||||||
|
|||||||
+89
-165
@@ -2434,10 +2434,10 @@ function imageCrop(mime, objURL, left, top, width, height, scale) {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const img = new Image();
|
const img = new Image();
|
||||||
img.crossOrigin = 'Anonymous';
|
img.crossOrigin = 'Anonymous';
|
||||||
img.onerror = err => {
|
img.onerror = _ => {
|
||||||
reject(new Error("Image format unrecognized"));
|
reject(new Error("Image format unrecognized"));
|
||||||
};
|
};
|
||||||
img.onload = () => {
|
img.onload = _ => {
|
||||||
URL.revokeObjectURL(img.src);
|
URL.revokeObjectURL(img.src);
|
||||||
let canvas = document.createElement('canvas');
|
let canvas = document.createElement('canvas');
|
||||||
canvas.width = width * scale;
|
canvas.width = width * scale;
|
||||||
@@ -2470,7 +2470,7 @@ function fileToBase64(file) {
|
|||||||
reader.onerror = evt => {
|
reader.onerror = evt => {
|
||||||
reject(reader.error);
|
reject(reader.error);
|
||||||
};
|
};
|
||||||
reader.onload = () => {
|
reader.onload = _ => {
|
||||||
resolve({
|
resolve({
|
||||||
mime: file.type,
|
mime: file.type,
|
||||||
bits: reader.result.split(',')[1],
|
bits: reader.result.split(',')[1],
|
||||||
@@ -2487,7 +2487,7 @@ function blobToBase64(blob) {
|
|||||||
reader.onerror = _ => {
|
reader.onerror = _ => {
|
||||||
reject(reader.error);
|
reject(reader.error);
|
||||||
};
|
};
|
||||||
reader.onload = () => {
|
reader.onload = _ => {
|
||||||
resolve({
|
resolve({
|
||||||
mime: blob.type,
|
mime: blob.type,
|
||||||
bits: reader.result.split(',')[1]
|
bits: reader.result.split(',')[1]
|
||||||
@@ -3706,9 +3706,7 @@ class AccSecurityView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Comp
|
|||||||
} = this.props.intl;
|
} = this.props.intl;
|
||||||
this.props.onShowAlert(formatMessage(messages.delete_account),
|
this.props.onShowAlert(formatMessage(messages.delete_account),
|
||||||
formatMessage(messages.delete_account_warning),
|
formatMessage(messages.delete_account_warning),
|
||||||
() => {
|
_ => this.props.onDeleteAccount(),
|
||||||
this.props.onDeleteAccount();
|
|
||||||
},
|
|
||||||
null,
|
null,
|
||||||
true,
|
true,
|
||||||
null);
|
null);
|
||||||
@@ -4952,9 +4950,7 @@ class InfoView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
const isMe = this.props.tinode.isMe(params.topicName);
|
const isMe = this.props.tinode.isMe(params.topicName);
|
||||||
const menuItems = [{
|
const menuItems = [{
|
||||||
title: formatMessage(messages.edit_permissions),
|
title: formatMessage(messages.edit_permissions),
|
||||||
handler: () => {
|
handler: _ => this.handleLaunchPermissionsEditor(isMe ? 'want' : 'user', params.topicName)
|
||||||
this.handleLaunchPermissionsEditor(isMe ? 'want' : 'user', params.topicName);
|
|
||||||
}
|
|
||||||
}];
|
}];
|
||||||
if (!isMe) {
|
if (!isMe) {
|
||||||
menuItems.push('member_delete');
|
menuItems.push('member_delete');
|
||||||
@@ -5850,7 +5846,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
}
|
}
|
||||||
const oldTopic = this.props.tinode.getTopic(oldTopicName);
|
const oldTopic = this.props.tinode.getTopic(oldTopicName);
|
||||||
if (oldTopic && oldTopic.isSubscribed()) {
|
if (oldTopic && oldTopic.isSubscribed()) {
|
||||||
oldTopic.leave(false).catch(() => {}).finally(() => {
|
oldTopic.leave(false).catch(_ => {}).finally(_ => {
|
||||||
this.setState({
|
this.setState({
|
||||||
fetchingMessages: false
|
fetchingMessages: false
|
||||||
});
|
});
|
||||||
@@ -5886,8 +5882,8 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
if (topic && topic.isSubscribed() && topic.msgHasMoreMessages()) {
|
if (topic && topic.isSubscribed() && topic.msgHasMoreMessages()) {
|
||||||
this.setState({
|
this.setState({
|
||||||
fetchingMessages: true
|
fetchingMessages: true
|
||||||
}, () => {
|
}, _ => {
|
||||||
topic.getMessagesPage(_config_js__WEBPACK_IMPORTED_MODULE_16__.MESSAGES_PAGE).catch(err => this.props.onError(err.message, 'err')).finally(() => this.setState({
|
topic.getMessagesPage(_config_js__WEBPACK_IMPORTED_MODULE_16__.MESSAGES_PAGE).catch(err => this.props.onError(err.message, 'err')).finally(_ => this.setState({
|
||||||
fetchingMessages: false
|
fetchingMessages: false
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
@@ -6042,11 +6038,9 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
case 'kp':
|
case 'kp':
|
||||||
{
|
{
|
||||||
clearTimeout(this.keyPressTimer);
|
clearTimeout(this.keyPressTimer);
|
||||||
this.keyPressTimer = setTimeout(() => {
|
this.keyPressTimer = setTimeout(_ => this.setState({
|
||||||
this.setState({
|
typingIndicator: false
|
||||||
typingIndicator: false
|
}), _config_js__WEBPACK_IMPORTED_MODULE_16__.KEYPRESS_DELAY + 1000);
|
||||||
});
|
|
||||||
}, _config_js__WEBPACK_IMPORTED_MODULE_16__.KEYPRESS_DELAY + 1000);
|
|
||||||
if (!this.state.typingIndicator) {
|
if (!this.state.typingIndicator) {
|
||||||
this.setState({
|
this.setState({
|
||||||
typingIndicator: true
|
typingIndicator: true
|
||||||
@@ -6261,9 +6255,7 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
|
|||||||
msg = tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.append(msg, tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.parse(caption));
|
msg = tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.append(msg, tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Drafty.parse(caption));
|
||||||
}
|
}
|
||||||
this.sendMessage(msg, uploadCompletionPromise, uploader);
|
this.sendMessage(msg, uploadCompletionPromise, uploader);
|
||||||
}).catch(err => {
|
}).catch(err => this.props.onError(err, 'err'));
|
||||||
this.props.onError(err, 'err');
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6947,11 +6939,9 @@ class PasswordResetView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Pu
|
|||||||
this.setState({
|
this.setState({
|
||||||
email: email
|
email: email
|
||||||
});
|
});
|
||||||
this.props.onRequest('email', email).then(() => {
|
this.props.onRequest('email', email).then(_ => this.setState({
|
||||||
this.setState({
|
sent: true
|
||||||
sent: true
|
}));
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleEmailChange(e) {
|
handleEmailChange(e) {
|
||||||
@@ -7800,7 +7790,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
if (this.state.desktopAlerts) {
|
if (this.state.desktopAlerts) {
|
||||||
this.tinode.setDeviceToken(this.state.firebaseToken);
|
this.tinode.setDeviceToken(this.state.firebaseToken);
|
||||||
}
|
}
|
||||||
}).catch(() => {
|
}).catch(_ => {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -7956,9 +7946,9 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
}
|
}
|
||||||
|
|
||||||
checkForAppUpdate(reg) {
|
checkForAppUpdate(reg) {
|
||||||
reg.onupdatefound = () => {
|
reg.onupdatefound = _ => {
|
||||||
const installingWorker = reg.installing;
|
const installingWorker = reg.installing;
|
||||||
installingWorker.onstatechange = () => {
|
installingWorker.onstatechange = _ => {
|
||||||
if (installingWorker.state == 'installed' && navigator.serviceWorker.controller) {
|
if (installingWorker.state == 'installed' && navigator.serviceWorker.controller) {
|
||||||
const msg = react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_intl__WEBPACK_IMPORTED_MODULE_1__.FormattedMessage, {
|
const msg = react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_intl__WEBPACK_IMPORTED_MODULE_1__.FormattedMessage, {
|
||||||
id: "update_available",
|
id: "update_available",
|
||||||
@@ -8084,14 +8074,14 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
|
|
||||||
handlePersistenceChange(persist) {
|
handlePersistenceChange(persist) {
|
||||||
if (persist) {
|
if (persist) {
|
||||||
this.tinode.initStorage().then(() => {
|
this.tinode.initStorage().then(_ => {
|
||||||
_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_17__["default"].setObject('keep-logged-in', true);
|
_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_17__["default"].setObject('keep-logged-in', true);
|
||||||
this.setState({
|
this.setState({
|
||||||
persist: true
|
persist: true
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.tinode.clearStorage().then(() => {
|
this.tinode.clearStorage().then(_ => {
|
||||||
_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_17__["default"].setObject('keep-logged-in', false);
|
_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_17__["default"].setObject('keep-logged-in', false);
|
||||||
this.setState({
|
this.setState({
|
||||||
persist: false
|
persist: false
|
||||||
@@ -8250,7 +8240,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
localStorage.removeItem('auth-token');
|
localStorage.removeItem('auth-token');
|
||||||
this.handleError(err.message, 'err');
|
this.handleError(err.message, 'err');
|
||||||
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].navigateTo('');
|
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].navigateTo('');
|
||||||
}).finally(() => {
|
}).finally(_ => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loadSpinnerVisible: false
|
loadSpinnerVisible: false
|
||||||
});
|
});
|
||||||
@@ -8407,11 +8397,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
desc: {
|
desc: {
|
||||||
public: query
|
public: query
|
||||||
}
|
}
|
||||||
}).then(ctrl => {
|
}).then(_ => fnd.getMeta(fnd.startMetaQuery().withSub().build())).catch(err => this.handleError(err.message, 'err'));
|
||||||
return fnd.getMeta(fnd.startMetaQuery().withSub().build());
|
|
||||||
}).catch(err => {
|
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleTopicSelected(topicName) {
|
handleTopicSelected(topicName) {
|
||||||
@@ -8471,7 +8457,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
completion.push(uploadCompletionPromise);
|
completion.push(uploadCompletionPromise);
|
||||||
}
|
}
|
||||||
if (!topic.isSubscribed()) {
|
if (!topic.isSubscribed()) {
|
||||||
const subscribePromise = topic.subscribe().then(() => {
|
const subscribePromise = topic.subscribe().then(_ => {
|
||||||
let calls = [];
|
let calls = [];
|
||||||
topic.queuedMessages(pub => {
|
topic.queuedMessages(pub => {
|
||||||
if (pub._sending || pub.seq == msg.seq) {
|
if (pub._sending || pub.seq == msg.seq) {
|
||||||
@@ -8497,9 +8483,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
topic.archive(false);
|
topic.archive(false);
|
||||||
}
|
}
|
||||||
return ctrl;
|
return ctrl;
|
||||||
}).catch(err => {
|
}).catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
handleNewChatInvitation(topicName, action) {
|
handleNewChatInvitation(topicName, action) {
|
||||||
const topic = this.tinode.getTopic(topicName);
|
const topic = this.tinode.getTopic(topicName);
|
||||||
@@ -8513,14 +8497,12 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (topic.isP2PType()) {
|
if (topic.isP2PType()) {
|
||||||
response = response.then(ctrl => {
|
response = response.then(_ => topic.setMeta({
|
||||||
topic.setMeta({
|
sub: {
|
||||||
sub: {
|
user: topicName,
|
||||||
user: topicName,
|
mode: mode
|
||||||
mode: mode
|
}
|
||||||
}
|
}));
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
@@ -8532,17 +8514,13 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
sub: {
|
sub: {
|
||||||
mode: am
|
mode: am
|
||||||
}
|
}
|
||||||
}).then(ctrl => {
|
}).then(_ => this.handleTopicSelected(null));
|
||||||
return this.handleTopicSelected(null);
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.warn("Unknown invitation action", '"' + action + '""');
|
console.warn("Unknown invitation action", '"' + action + '""');
|
||||||
}
|
}
|
||||||
if (response != null) {
|
if (response != null) {
|
||||||
response.catch(err => {
|
response.catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8594,9 +8572,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
handleUpdateAccountTagsRequest(tags) {
|
handleUpdateAccountTagsRequest(tags) {
|
||||||
this.tinode.getMeTopic().setMeta({
|
this.tinode.getMeTopic().setMeta({
|
||||||
tags: tags
|
tags: tags
|
||||||
}).catch(err => {
|
}).catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSettings() {
|
handleSettings() {
|
||||||
@@ -8659,7 +8635,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
} else if (this.state.firebaseToken && this.fcm) {
|
} else if (this.state.firebaseToken && this.fcm) {
|
||||||
(0,firebase_messaging__WEBPACK_IMPORTED_MODULE_3__.deleteToken)(this.fcm).catch(err => {
|
(0,firebase_messaging__WEBPACK_IMPORTED_MODULE_3__.deleteToken)(this.fcm).catch(err => {
|
||||||
console.error("Unable to delete token.", err);
|
console.error("Unable to delete token.", err);
|
||||||
}).finally(() => {
|
}).finally(_ => {
|
||||||
_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_17__["default"].updateObject('settings', {
|
_lib_local_storage_js__WEBPACK_IMPORTED_MODULE_17__["default"].updateObject('settings', {
|
||||||
desktopAlerts: false
|
desktopAlerts: false
|
||||||
});
|
});
|
||||||
@@ -8695,15 +8671,11 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
meth: method,
|
meth: method,
|
||||||
val: value
|
val: value
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
handleCredDelete(method, value) {
|
handleCredDelete(method, value) {
|
||||||
const me = this.tinode.getMeTopic();
|
const me = this.tinode.getMeTopic();
|
||||||
me.delCredential(method, value).catch(err => {
|
me.delCredential(method, value).catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
handleCredConfirm(method, response) {
|
handleCredConfirm(method, response) {
|
||||||
TinodeWeb.navigateToCredentialsView({
|
TinodeWeb.navigateToCredentialsView({
|
||||||
@@ -8776,7 +8748,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
params._topicName = topicName;
|
params._topicName = topicName;
|
||||||
this.setState({
|
this.setState({
|
||||||
newTopicParams: params
|
newTopicParams: params
|
||||||
}, () => {
|
}, _ => {
|
||||||
this.handleTopicSelected(topicName);
|
this.handleTopicSelected(topicName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -8823,25 +8795,19 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
topic.setMeta({
|
topic.setMeta({
|
||||||
desc: params,
|
desc: params,
|
||||||
attachments: attachments
|
attachments: attachments
|
||||||
}).catch(err => {
|
}).catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleUnarchive(topicName) {
|
handleUnarchive(topicName) {
|
||||||
const topic = this.tinode.getTopic(topicName);
|
const topic = this.tinode.getTopic(topicName);
|
||||||
if (topic) {
|
if (topic) {
|
||||||
topic.archive(false).catch(err => {
|
topic.archive(false).catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleUpdatePasswordRequest(password) {
|
handleUpdatePasswordRequest(password) {
|
||||||
this.handleError();
|
this.handleError();
|
||||||
if (password) {
|
if (password) {
|
||||||
this.tinode.updateAccountBasic(null, this.tinode.getCurrentLogin(), password).catch(err => {
|
this.tinode.updateAccountBasic(null, this.tinode.getCurrentLogin(), password).catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleChangePermissions(topicName, mode, uid) {
|
handleChangePermissions(topicName, mode, uid) {
|
||||||
@@ -8860,9 +8826,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
user: uid,
|
user: uid,
|
||||||
mode: mode
|
mode: mode
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleTagsUpdateRequest(topicName, tags) {
|
handleTagsUpdateRequest(topicName, tags) {
|
||||||
@@ -8870,9 +8834,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
if (topic) {
|
if (topic) {
|
||||||
topic.setMeta({
|
topic.setMeta({
|
||||||
tags: tags
|
tags: tags
|
||||||
}).catch(err => {
|
}).catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleLogout() {
|
handleLogout() {
|
||||||
@@ -8894,8 +8856,8 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
cleared = Promose.resolve();
|
cleared = Promose.resolve();
|
||||||
}
|
}
|
||||||
this.setState(this.getBlankState());
|
this.setState(this.getBlankState());
|
||||||
cleared.then(() => {
|
cleared.then(_ => {
|
||||||
this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, (0,_lib_host_name_js__WEBPACK_IMPORTED_MODULE_16__.isSecureConnection)(), this.state.transport, this.props.intl.locale, _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_17__["default"].getObject('keep-logged-in'), () => {
|
this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, (0,_lib_host_name_js__WEBPACK_IMPORTED_MODULE_16__.isSecureConnection)(), this.state.transport, this.props.intl.locale, _lib_local_storage_js__WEBPACK_IMPORTED_MODULE_17__["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.tinode.onAutoreconnectIteration = this.handleAutoreconnectIteration;
|
||||||
@@ -8916,7 +8878,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
topic.delTopic(true).then(ctrl => {
|
topic.delTopic(true).then(_ => {
|
||||||
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].setUrlTopic(window.location.hash, ''));
|
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].setUrlTopic(window.location.hash, ''));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
this.handleError(err.message, 'err');
|
this.handleError(err.message, 'err');
|
||||||
@@ -8928,16 +8890,14 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
topic.delMessagesAll(true).catch(err => {
|
topic.delMessagesAll(true).catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
handleLeaveUnsubRequest(topicName) {
|
handleLeaveUnsubRequest(topicName) {
|
||||||
const topic = this.tinode.getTopic(topicName);
|
const topic = this.tinode.getTopic(topicName);
|
||||||
if (!topic) {
|
if (!topic) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
topic.leave(true).then(ctrl => {
|
topic.leave(true).then(_ => {
|
||||||
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].setUrlTopic(window.location.hash, ''));
|
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].setUrlTopic(window.location.hash, ''));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
this.handleError(err.message, 'err');
|
this.handleError(err.message, 'err');
|
||||||
@@ -8950,9 +8910,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
}
|
}
|
||||||
topic.updateMode(null, '-JP').then(_ => {
|
topic.updateMode(null, '-JP').then(_ => {
|
||||||
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].setUrlTopic(window.location.hash, ''));
|
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].setUrlTopic(window.location.hash, ''));
|
||||||
}).catch(err => {
|
}).catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
handleReportTopic(topicName) {
|
handleReportTopic(topicName) {
|
||||||
const topic = this.tinode.getTopic(topicName);
|
const topic = this.tinode.getTopic(topicName);
|
||||||
@@ -8962,11 +8920,9 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
|
|
||||||
this.tinode.report('report', topicName);
|
this.tinode.report('report', topicName);
|
||||||
|
|
||||||
topic.updateMode(null, '-JP').then(ctrl => {
|
topic.updateMode(null, '-JP').then(_ => {
|
||||||
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].setUrlTopic(window.location.hash, ''));
|
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].navigateTo(_lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].setUrlTopic(window.location.hash, ''));
|
||||||
}).catch(err => {
|
}).catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
handleShowContextMenu(params, menuItems) {
|
handleShowContextMenu(params, menuItems) {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -9051,7 +9007,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
handleContextMenuAction(action, promise, params) {
|
handleContextMenuAction(action, promise, params) {
|
||||||
if (action == 'topic_archive') {
|
if (action == 'topic_archive') {
|
||||||
if (promise && params.topicName && params.topicName == this.state.topicSelected) {
|
if (promise && params.topicName && params.topicName == this.state.topicSelected) {
|
||||||
promise.then(() => {
|
promise.then(_ => {
|
||||||
this.handleTopicSelected(null);
|
this.handleTopicSelected(null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -9088,16 +9044,12 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
}
|
}
|
||||||
if (added && added.length > 0) {
|
if (added && added.length > 0) {
|
||||||
added.map(uid => {
|
added.map(uid => {
|
||||||
topic.invite(uid, null).catch(err => {
|
topic.invite(uid, null).catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (removed && removed.length > 0) {
|
if (removed && removed.length > 0) {
|
||||||
removed.map(uid => {
|
removed.map(uid => {
|
||||||
topic.delSubscription(uid).catch(err => {
|
topic.delSubscription(uid).catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9108,9 +9060,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
meth: cred,
|
meth: cred,
|
||||||
resp: code
|
resp: code
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => this.handleError(err.message, 'err'));
|
||||||
this.handleError(err.message, 'err');
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
this.setState({
|
this.setState({
|
||||||
credMethod: cred,
|
credMethod: cred,
|
||||||
@@ -9124,9 +9074,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
handlePasswordResetRequest(method, value) {
|
handlePasswordResetRequest(method, value) {
|
||||||
return this.tinode.connect().then(() => {
|
return this.tinode.connect().then(_ => this.tinode.requestResetAuthSecret('basic', method, value)).catch(err => {
|
||||||
return this.tinode.requestResetAuthSecret('basic', method, value);
|
|
||||||
}).catch(err => {
|
|
||||||
this.handleError(err.message, 'err');
|
this.handleError(err.message, 'err');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -9135,13 +9083,9 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
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');
|
||||||
} else {
|
} else {
|
||||||
this.tinode.connect().then(() => {
|
this.tinode.connect().then(_ => this.tinode.updateAccountBasic(null, null, newPassword, {
|
||||||
return this.tinode.updateAccountBasic(null, null, newPassword, {
|
token: token
|
||||||
token: token
|
})).then(_ => _lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].navigateTo('')).catch(err => {
|
||||||
});
|
|
||||||
}).then(() => {
|
|
||||||
_lib_navigation_js__WEBPACK_IMPORTED_MODULE_18__["default"].navigateTo('');
|
|
||||||
}).catch(err => {
|
|
||||||
this.handleError(err.message, 'err');
|
this.handleError(err.message, 'err');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -9234,7 +9178,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
} else {
|
} else {
|
||||||
this.setState({
|
this.setState({
|
||||||
callShouldStart: true
|
callShouldStart: true
|
||||||
}, () => this.handleTopicSelected(this.state.callTopic));
|
}, _ => this.handleTopicSelected(this.state.callTopic));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleInfoMessage(info) {
|
handleInfoMessage(info) {
|
||||||
@@ -9327,13 +9271,11 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
visible: this.state.alertVisible,
|
visible: this.state.alertVisible,
|
||||||
title: this.state.alertParams.title,
|
title: this.state.alertParams.title,
|
||||||
content: this.state.alertParams.content,
|
content: this.state.alertParams.content,
|
||||||
onReject: this.state.alertParams.onReject ? () => {
|
onReject: this.state.alertParams.onReject ? _ => this.setState({
|
||||||
this.setState({
|
alertVisible: false
|
||||||
alertVisible: false
|
}) : null,
|
||||||
});
|
|
||||||
} : null,
|
|
||||||
reject: this.state.alertParams.reject,
|
reject: this.state.alertParams.reject,
|
||||||
onConfirm: () => {
|
onConfirm: _ => {
|
||||||
this.setState({
|
this.setState({
|
||||||
alertVisible: false
|
alertVisible: false
|
||||||
});
|
});
|
||||||
@@ -9737,18 +9679,12 @@ class Attachment extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component
|
|||||||
this.setState({
|
this.setState({
|
||||||
downloader: downloader
|
downloader: downloader
|
||||||
});
|
});
|
||||||
downloader.download(url, filename, mimetype, loaded => {
|
downloader.download(url, filename, mimetype, loaded => this.setState({
|
||||||
this.setState({
|
progress: loaded / this.props.size
|
||||||
progress: loaded / this.props.size
|
}), err => this.props.onError(err, 'err')).then(_ => this.setState({
|
||||||
});
|
downloader: null,
|
||||||
}, err => {
|
progress: 0
|
||||||
this.props.onError(err, 'err');
|
})).catch(err => {
|
||||||
}).then(() => {
|
|
||||||
this.setState({
|
|
||||||
downloader: null,
|
|
||||||
progress: 0
|
|
||||||
});
|
|
||||||
}).catch(err => {
|
|
||||||
if (err) {
|
if (err) {
|
||||||
this.props.onError("Error downloading file: " + err.message, 'err');
|
this.props.onError("Error downloading file: " + err.message, 'err');
|
||||||
}
|
}
|
||||||
@@ -9931,7 +9867,7 @@ class AudioPlayer extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureComp
|
|||||||
const width = this.effectiveWidth;
|
const width = this.effectiveWidth;
|
||||||
const height = this.canvasRef.current.height;
|
const height = this.canvasRef.current.height;
|
||||||
this.canvasContext.lineWidth = LINE_WIDTH;
|
this.canvasContext.lineWidth = LINE_WIDTH;
|
||||||
const drawFrame = () => {
|
const drawFrame = _ => {
|
||||||
if (!this.canvasRef.current || !this.audioPlayer) {
|
if (!this.canvasRef.current || !this.audioPlayer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -10160,7 +10096,7 @@ class AudioRecorder extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCo
|
|||||||
let prevBarCount = 0;
|
let prevBarCount = 0;
|
||||||
let volume = 0.0;
|
let volume = 0.0;
|
||||||
let countPerBar = 0;
|
let countPerBar = 0;
|
||||||
const drawFrame = () => {
|
const drawFrame = _ => {
|
||||||
if (!this.startedOn) {
|
if (!this.startedOn) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -11145,7 +11081,7 @@ class CallPanel extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
|
|||||||
this.state.pc.setRemoteDescription(desc).then(_ => {
|
this.state.pc.setRemoteDescription(desc).then(_ => {
|
||||||
this.setState({
|
this.setState({
|
||||||
callInitialSetupComplete: true
|
callInitialSetupComplete: true
|
||||||
}, () => this.drainRemoteIceCandidatesCache());
|
}, _ => this.drainRemoteIceCandidatesCache());
|
||||||
}).catch(this.reportError);
|
}).catch(this.reportError);
|
||||||
}
|
}
|
||||||
reportError(err) {
|
reportError(err) {
|
||||||
@@ -11245,7 +11181,7 @@ class CallPanel extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
|
|||||||
this.props.onSendAnswer(this.props.topic, this.props.seq, pc.localDescription.toJSON());
|
this.props.onSendAnswer(this.props.topic, this.props.seq, pc.localDescription.toJSON());
|
||||||
this.setState({
|
this.setState({
|
||||||
callInitialSetupComplete: true
|
callInitialSetupComplete: true
|
||||||
}, () => this.drainRemoteIceCandidatesCache());
|
}, _ => this.drainRemoteIceCandidatesCache());
|
||||||
}).catch(this.handleGetUserMediaError);
|
}).catch(this.handleGetUserMediaError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12614,7 +12550,7 @@ class ContextMenu extends (react__WEBPACK_IMPORTED_MODULE_0___default().Componen
|
|||||||
'menu_item_forward': {
|
'menu_item_forward': {
|
||||||
id: 'menu_item_forward',
|
id: 'menu_item_forward',
|
||||||
title: formatMessage(messages.forward),
|
title: formatMessage(messages.forward),
|
||||||
handler: () => {}
|
handler: _ => {}
|
||||||
},
|
},
|
||||||
|
|
||||||
'menu_item_edit': {
|
'menu_item_edit': {
|
||||||
@@ -12645,12 +12581,10 @@ class ContextMenu extends (react__WEBPACK_IMPORTED_MODULE_0___default().Componen
|
|||||||
handler: (params, errorHandler) => {
|
handler: (params, errorHandler) => {
|
||||||
return props.onShowAlert(formatMessage(messages.block),
|
return props.onShowAlert(formatMessage(messages.block),
|
||||||
formatMessage(messages.topic_block_warning),
|
formatMessage(messages.topic_block_warning),
|
||||||
() => {
|
_ => this.topicPermissionSetter('-JP', params, errorHandler).then(ctrl => {
|
||||||
return this.topicPermissionSetter('-JP', params, errorHandler).then(ctrl => {
|
this.props.onTopicRemoved(params.topicName);
|
||||||
this.props.onTopicRemoved(params.topicName);
|
return ctrl;
|
||||||
return ctrl;
|
}), null,
|
||||||
});
|
|
||||||
}, null,
|
|
||||||
true,
|
true,
|
||||||
null);
|
null);
|
||||||
}
|
}
|
||||||
@@ -12662,7 +12596,7 @@ class ContextMenu extends (react__WEBPACK_IMPORTED_MODULE_0___default().Componen
|
|||||||
handler: (params, errorHandler) => {
|
handler: (params, errorHandler) => {
|
||||||
return props.onShowAlert(formatMessage(messages.topic_delete),
|
return props.onShowAlert(formatMessage(messages.topic_delete),
|
||||||
formatMessage(messages.topic_delete_warning),
|
formatMessage(messages.topic_delete_warning),
|
||||||
() => {
|
_ => {
|
||||||
const topic = this.props.tinode.getTopic(params.topicName);
|
const topic = this.props.tinode.getTopic(params.topicName);
|
||||||
if (!topic) {
|
if (!topic) {
|
||||||
console.warn("Topic not found: ", params.topicName);
|
console.warn("Topic not found: ", params.topicName);
|
||||||
@@ -12829,9 +12763,7 @@ class ContextMenu extends (react__WEBPACK_IMPORTED_MODULE_0___default().Componen
|
|||||||
}
|
}
|
||||||
let result = topic.updateMode(params.user, mode);
|
let result = topic.updateMode(params.user, mode);
|
||||||
if (errorHandler) {
|
if (errorHandler) {
|
||||||
result = result.catch(err => {
|
result = result.catch(err => errorHandler(err.message, 'err'));
|
||||||
errorHandler(err.message, 'err');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -14052,7 +13984,7 @@ class InPlaceEdit extends (react__WEBPACK_IMPORTED_MODULE_0___default().Componen
|
|||||||
if (!this.props.readOnly) {
|
if (!this.props.readOnly) {
|
||||||
this.setState({
|
this.setState({
|
||||||
active: true
|
active: true
|
||||||
}, () => {
|
}, _ => {
|
||||||
if (this.selfRef.current) {
|
if (this.selfRef.current) {
|
||||||
this.selfRef.current.focus();
|
this.selfRef.current.focus();
|
||||||
}
|
}
|
||||||
@@ -14248,7 +14180,7 @@ class LazyImage extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
|
|||||||
...this.state.style,
|
...this.state.style,
|
||||||
padding: 0
|
padding: 0
|
||||||
}
|
}
|
||||||
})).catch(() => this.setState({
|
})).catch(_ => this.setState({
|
||||||
src: 'img/broken_image.png'
|
src: 'img/broken_image.png'
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -14270,7 +14202,7 @@ class LazyImage extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
|
|||||||
...this.state.style,
|
...this.state.style,
|
||||||
padding: 0
|
padding: 0
|
||||||
}
|
}
|
||||||
})).catch(() => this.setState({
|
})).catch(_ => this.setState({
|
||||||
src: 'img/broken_image.png'
|
src: 'img/broken_image.png'
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -16549,9 +16481,7 @@ class TopicSecurity extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCo
|
|||||||
} = this.props.intl;
|
} = this.props.intl;
|
||||||
this.props.onShowAlert(formatMessage(messages.topic_delete),
|
this.props.onShowAlert(formatMessage(messages.topic_delete),
|
||||||
formatMessage(messages.topic_delete_warning),
|
formatMessage(messages.topic_delete_warning),
|
||||||
() => {
|
_ => this.props.onDeleteTopic(this.props.topic),
|
||||||
this.props.onDeleteTopic(this.props.topic);
|
|
||||||
},
|
|
||||||
null,
|
null,
|
||||||
true,
|
true,
|
||||||
null);
|
null);
|
||||||
@@ -16564,9 +16494,7 @@ class TopicSecurity extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCo
|
|||||||
} = this.props.intl;
|
} = this.props.intl;
|
||||||
this.props.onShowAlert(formatMessage(this.props.deleter ? messages.delete_messages : messages.clear_messages),
|
this.props.onShowAlert(formatMessage(this.props.deleter ? messages.delete_messages : messages.clear_messages),
|
||||||
formatMessage(this.props.deleter ? messages.delete_messages_warning : messages.clear_messages_warning),
|
formatMessage(this.props.deleter ? messages.delete_messages_warning : messages.clear_messages_warning),
|
||||||
() => {
|
_ => this.props.onDeleteMessages(this.props.topic),
|
||||||
this.props.onDeleteMessages(this.props.topic);
|
|
||||||
},
|
|
||||||
null,
|
null,
|
||||||
true,
|
true,
|
||||||
null);
|
null);
|
||||||
@@ -16579,9 +16507,7 @@ class TopicSecurity extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCo
|
|||||||
} = this.props.intl;
|
} = this.props.intl;
|
||||||
this.props.onShowAlert(formatMessage(messages.leave_chat),
|
this.props.onShowAlert(formatMessage(messages.leave_chat),
|
||||||
formatMessage(messages.leave_chat_warning),
|
formatMessage(messages.leave_chat_warning),
|
||||||
() => {
|
_ => this.props.onLeaveTopic(this.props.topic),
|
||||||
this.props.onLeaveTopic(this.props.topic);
|
|
||||||
},
|
|
||||||
null,
|
null,
|
||||||
true,
|
true,
|
||||||
null);
|
null);
|
||||||
@@ -16594,9 +16520,7 @@ class TopicSecurity extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCo
|
|||||||
} = this.props.intl;
|
} = this.props.intl;
|
||||||
this.props.onShowAlert(formatMessage(messages.block_contact),
|
this.props.onShowAlert(formatMessage(messages.block_contact),
|
||||||
formatMessage(messages.block_contact_warning),
|
formatMessage(messages.block_contact_warning),
|
||||||
() => {
|
_ => this.props.onBlockTopic(this.props.topic),
|
||||||
this.props.onBlockTopic(this.props.topic);
|
|
||||||
},
|
|
||||||
null,
|
null,
|
||||||
true,
|
true,
|
||||||
null);
|
null);
|
||||||
@@ -16867,7 +16791,7 @@ class VisiblePassword extends (react__WEBPACK_IMPORTED_MODULE_0___default().Pure
|
|||||||
handleEditingFinished(e) {
|
handleEditingFinished(e) {
|
||||||
if (e) {
|
if (e) {
|
||||||
let currentTarget = e.currentTarget;
|
let currentTarget = e.currentTarget;
|
||||||
setTimeout(() => {
|
setTimeout(_ => {
|
||||||
if (!currentTarget.contains(document.activeElement)) {
|
if (!currentTarget.contains(document.activeElement)) {
|
||||||
if (this.props.onFinished) {
|
if (this.props.onFinished) {
|
||||||
this.props.onFinished(this.state.value);
|
this.props.onFinished(this.state.value);
|
||||||
|
|||||||
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
Reference in New Issue
Block a user