fix issues with video uploading and display

This commit is contained in:
or-else
2023-02-05 17:08:41 -08:00
parent fc2ff79329
commit eeea27ca82
13 changed files with 190 additions and 166 deletions
+1
View File
@@ -172,6 +172,7 @@ export function deliveryMarker(received) {
case Tinode.MESSAGE_STATUS_SENDING: case Tinode.MESSAGE_STATUS_SENDING:
return { name: 'access_time' }; // watch face return { name: 'access_time' }; // watch face
case Tinode.MESSAGE_STATUS_FAILED: case Tinode.MESSAGE_STATUS_FAILED:
case Tinode.MESSAGE_STATUS_FATAL:
return { name: 'warning', color: 'danger-color' }; // yellow icon /!\ return { name: 'warning', color: 'danger-color' }; // yellow icon /!\
case Tinode.MESSAGE_STATUS_SENT: case Tinode.MESSAGE_STATUS_SENT:
return { name: 'done' }; // checkmark return { name: 'done' }; // checkmark
+11 -10
View File
@@ -457,24 +457,24 @@ class MessagesView extends React.Component {
this.setState({topic: ctrl.topic}); this.setState({topic: ctrl.topic});
} }
this.props.onNewTopicCreated(this.props.topic, ctrl.topic); this.props.onNewTopicCreated(this.props.topic, ctrl.topic);
// If there are unsent messages (except video call messages), // If there are unsent messages (except hard-failed and video call messages),
// try sending them now. Unsent video call messages will be dropped. // try sending them now. Hard-failed and unsent video call messages will be dropped.
let calls = []; let discard = [];
topic.queuedMessages((pub) => { topic.queuedMessages(pub => {
if (pub._sending) { if (pub._sending) {
return; return;
} }
if (pub.head && pub.head.webrtc) { if (pub._fatal || (pub.head && pub.head.webrtc)) {
// Filter out unsent video call messages. // Filter out unsent failed & video call messages.
calls.push(pub.seq); discard.push(pub.seq);
return; return;
} }
if (topic.isSubscribed()) { if (topic.isSubscribed()) {
this.retrySend(pub); this.retrySend(pub);
} }
}); });
if (calls.length > 0) { if (discard.length > 0) {
topic.delMessagesList(calls, true); topic.delMessagesList(discard, true);
} }
}) })
.catch(err => { .catch(err => {
@@ -1057,8 +1057,8 @@ class MessagesView extends React.Component {
// Small preview to show while uploading. // Small preview to show while uploading.
b64conv[2] = imageScaled(previewBlob, VIDEO_PREVIEW_DIM, VIDEO_PREVIEW_DIM, -1, false) b64conv[2] = imageScaled(previewBlob, VIDEO_PREVIEW_DIM, VIDEO_PREVIEW_DIM, -1, false)
.then(scaled => blobToBase64(scaled.blob)); .then(scaled => blobToBase64(scaled.blob));
// Convert tiny image into base64 for serialization and previewing.
Promise.all(b64conv) Promise.all(b64conv)
// Convert tiny image into base64 for serialization and previewing.
.then(b64s => { .then(b64s => {
const [video, img, preview] = b64s; const [video, img, preview] = b64s;
let msg = Drafty.insertVideo(null, 0, { let msg = Drafty.insertVideo(null, 0, {
@@ -1074,6 +1074,7 @@ class MessagesView extends React.Component {
size: videoBlob.size, size: videoBlob.size,
urlPromise: uploadCompletionPromise urlPromise: uploadCompletionPromise
}); });
if (caption) { if (caption) {
msg = Drafty.appendLineBreak(msg); msg = Drafty.appendLineBreak(msg);
msg = Drafty.append(msg, Drafty.parse(caption)); msg = Drafty.append(msg, Drafty.parse(caption));
+1 -1
View File
@@ -93,7 +93,7 @@ class BaseChatMessage extends React.PureComponent {
if (this.props.received == Tinode.MESSAGE_STATUS_FAILED) { if (this.props.received == Tinode.MESSAGE_STATUS_FAILED) {
menuItems.push('menu_item_send_retry'); menuItems.push('menu_item_send_retry');
} }
if (this.props.userIsWriter && this.props.received > Tinode.MESSAGE_STATUS_FAILED) { if (this.props.userIsWriter && this.props.received > Tinode.MESSAGE_STATUS_FATAL) {
menuItems.push('menu_item_reply'); menuItems.push('menu_item_reply');
if (!this.props.response) { if (!this.props.response) {
let immutable = false; let immutable = false;
+1 -1
View File
@@ -31,7 +31,7 @@ export default class InlineVideo extends React.PureComponent {
{this.props.onClick ? {this.props.onClick ?
<i className="material-icons white bigger">play_arrow</i> <i className="material-icons white bigger">play_arrow</i>
: :
<img src="img/broken_video.png" width="36" height="36" />} <img src="img/broken_video.png" style={{filter: 'invert(100%)'}} width="36" height="36" />}
</div> </div>
{duration ? <div className="duration">{duration}</div> : null} {duration ? <div className="duration">{duration}</div> : null}
</div> </div>
+2 -1
View File
@@ -30,7 +30,8 @@ class ReceivedMarker extends React.PureComponent {
let timestamp; let timestamp;
if (this.props.received <= Tinode.MESSAGE_STATUS_SENDING) { if (this.props.received <= Tinode.MESSAGE_STATUS_SENDING) {
timestamp = formatMessage(messages.message_sending); timestamp = formatMessage(messages.message_sending);
} else if (this.props.received == Tinode.MESSAGE_STATUS_FAILED) { } else if (this.props.received == Tinode.MESSAGE_STATUS_FAILED ||
this.props.received == Tinode.MESSAGE_STATUS_FATAL) {
timestamp = formatMessage(messages.message_sending_failed); timestamp = formatMessage(messages.message_sending_failed);
} else { } else {
timestamp = this.props.timestamp.toLocaleTimeString(this.props.intl.locale, { timeStyle: 'short' }); timestamp = this.props.timestamp.toLocaleTimeString(this.props.intl.locale, { timeStyle: 'short' });
+11 -7
View File
@@ -3525,6 +3525,7 @@ function deliveryMarker(received) {
name: 'access_time' name: 'access_time'
}; };
case tinode_sdk__WEBPACK_IMPORTED_MODULE_0__.Tinode.MESSAGE_STATUS_FAILED: case tinode_sdk__WEBPACK_IMPORTED_MODULE_0__.Tinode.MESSAGE_STATUS_FAILED:
case tinode_sdk__WEBPACK_IMPORTED_MODULE_0__.Tinode.MESSAGE_STATUS_FATAL:
return { return {
name: 'warning', name: 'warning',
color: 'danger-color' color: 'danger-color'
@@ -5458,21 +5459,21 @@ class MessagesView extends (react__WEBPACK_IMPORTED_MODULE_0___default().Compone
}); });
} }
this.props.onNewTopicCreated(this.props.topic, ctrl.topic); this.props.onNewTopicCreated(this.props.topic, ctrl.topic);
let calls = []; let discard = [];
topic.queuedMessages(pub => { topic.queuedMessages(pub => {
if (pub._sending) { if (pub._sending) {
return; return;
} }
if (pub.head && pub.head.webrtc) { if (pub._fatal || pub.head && pub.head.webrtc) {
calls.push(pub.seq); discard.push(pub.seq);
return; return;
} }
if (topic.isSubscribed()) { if (topic.isSubscribed()) {
this.retrySend(pub); this.retrySend(pub);
} }
}); });
if (calls.length > 0) { if (discard.length > 0) {
topic.delMessagesList(calls, true); topic.delMessagesList(discard, true);
} }
}).catch(err => { }).catch(err => {
console.error("Failed subscription to", this.state.topic, err); console.error("Failed subscription to", this.state.topic, err);
@@ -11030,7 +11031,7 @@ class BaseChatMessage extends (react__WEBPACK_IMPORTED_MODULE_0___default().Pure
if (this.props.received == tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Tinode.MESSAGE_STATUS_FAILED) { if (this.props.received == tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Tinode.MESSAGE_STATUS_FAILED) {
menuItems.push('menu_item_send_retry'); menuItems.push('menu_item_send_retry');
} }
if (this.props.userIsWriter && this.props.received > tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Tinode.MESSAGE_STATUS_FAILED) { if (this.props.userIsWriter && this.props.received > tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Tinode.MESSAGE_STATUS_FATAL) {
menuItems.push('menu_item_reply'); menuItems.push('menu_item_reply');
if (!this.props.response) { if (!this.props.response) {
let immutable = false; let immutable = false;
@@ -13590,6 +13591,9 @@ class InlineVideo extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureComp
className: "material-icons white bigger" className: "material-icons white bigger"
}, "play_arrow") : react__WEBPACK_IMPORTED_MODULE_0___default().createElement("img", { }, "play_arrow") : react__WEBPACK_IMPORTED_MODULE_0___default().createElement("img", {
src: "img/broken_video.png", src: "img/broken_video.png",
style: {
filter: 'invert(100%)'
},
width: "36", width: "36",
height: "36" height: "36"
})), duration ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { })), duration ? react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
@@ -14667,7 +14671,7 @@ class ReceivedMarker extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureC
let timestamp; let timestamp;
if (this.props.received <= tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Tinode.MESSAGE_STATUS_SENDING) { if (this.props.received <= tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Tinode.MESSAGE_STATUS_SENDING) {
timestamp = formatMessage(messages.message_sending); timestamp = formatMessage(messages.message_sending);
} else if (this.props.received == tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Tinode.MESSAGE_STATUS_FAILED) { } else if (this.props.received == tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Tinode.MESSAGE_STATUS_FAILED || this.props.received == tinode_sdk__WEBPACK_IMPORTED_MODULE_2__.Tinode.MESSAGE_STATUS_FATAL) {
timestamp = formatMessage(messages.message_sending_failed); timestamp = formatMessage(messages.message_sending_failed);
} else { } else {
timestamp = this.props.timestamp.toLocaleTimeString(this.props.intl.locale, { timestamp = this.props.timestamp.toLocaleTimeString(this.props.intl.locale, {
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+157 -140
View File
@@ -411,6 +411,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ "LIBRARY": () => (/* binding */ LIBRARY), /* harmony export */ "LIBRARY": () => (/* binding */ LIBRARY),
/* harmony export */ "LOCAL_SEQID": () => (/* binding */ LOCAL_SEQID), /* harmony export */ "LOCAL_SEQID": () => (/* binding */ LOCAL_SEQID),
/* harmony export */ "MESSAGE_STATUS_FAILED": () => (/* binding */ MESSAGE_STATUS_FAILED), /* harmony export */ "MESSAGE_STATUS_FAILED": () => (/* binding */ MESSAGE_STATUS_FAILED),
/* harmony export */ "MESSAGE_STATUS_FATAL": () => (/* binding */ MESSAGE_STATUS_FATAL),
/* harmony export */ "MESSAGE_STATUS_NONE": () => (/* binding */ MESSAGE_STATUS_NONE), /* harmony export */ "MESSAGE_STATUS_NONE": () => (/* binding */ MESSAGE_STATUS_NONE),
/* harmony export */ "MESSAGE_STATUS_QUEUED": () => (/* binding */ MESSAGE_STATUS_QUEUED), /* harmony export */ "MESSAGE_STATUS_QUEUED": () => (/* binding */ MESSAGE_STATUS_QUEUED),
/* harmony export */ "MESSAGE_STATUS_READ": () => (/* binding */ MESSAGE_STATUS_READ), /* harmony export */ "MESSAGE_STATUS_READ": () => (/* binding */ MESSAGE_STATUS_READ),
@@ -449,13 +450,14 @@ const TOPIC_P2P = 'p2p';
const USER_NEW = 'new'; const USER_NEW = 'new';
const LOCAL_SEQID = 0xFFFFFFF; const LOCAL_SEQID = 0xFFFFFFF;
const MESSAGE_STATUS_NONE = 0; const MESSAGE_STATUS_NONE = 0;
const MESSAGE_STATUS_QUEUED = 1; const MESSAGE_STATUS_QUEUED = 10;
const MESSAGE_STATUS_SENDING = 2; const MESSAGE_STATUS_SENDING = 20;
const MESSAGE_STATUS_FAILED = 3; const MESSAGE_STATUS_FAILED = 30;
const MESSAGE_STATUS_SENT = 4; const MESSAGE_STATUS_FATAL = 40;
const MESSAGE_STATUS_RECEIVED = 5; const MESSAGE_STATUS_SENT = 50;
const MESSAGE_STATUS_READ = 6; const MESSAGE_STATUS_RECEIVED = 60;
const MESSAGE_STATUS_TO_ME = 7; const MESSAGE_STATUS_READ = 70;
const MESSAGE_STATUS_TO_ME = 80;
const EXPIRE_PROMISES_TIMEOUT = 5000; const EXPIRE_PROMISES_TIMEOUT = 5000;
const EXPIRE_PROMISES_PERIOD = 1000; const EXPIRE_PROMISES_PERIOD = 1000;
const RECV_TIMEOUT = 100; const RECV_TIMEOUT = 100;
@@ -3032,16 +3034,9 @@ class LargeFileHelper {
this._version = version; this._version = version;
this._apiKey = tinode._apiKey; this._apiKey = tinode._apiKey;
this._authToken = tinode.getAuthToken(); this._authToken = tinode.getAuthToken();
this._reqId = tinode.getNextUniqueId(); this.xhr = [];
this.xhr = new XHRProvider();
this.toResolve = null;
this.toReject = null;
this.onProgress = null;
this.onSuccess = null;
this.onFailure = null;
} }
uploadWithBaseUrl(baseUrl, data, avatarFor, onProgress, onSuccess, onFailure) { uploadWithBaseUrl(baseUrl, data, avatarFor, onProgress, onSuccess, onFailure) {
const instance = this;
let url = `/v${this._version}/file/u/`; let url = `/v${this._version}/file/u/`;
if (baseUrl) { if (baseUrl) {
let base = baseUrl; let base = baseUrl;
@@ -3054,24 +3049,31 @@ class LargeFileHelper {
throw new Error(`Invalid base URL '${baseUrl}'`); throw new Error(`Invalid base URL '${baseUrl}'`);
} }
} }
this.xhr.open('POST', url, true); const instance = this;
this.xhr.setRequestHeader('X-Tinode-APIKey', this._apiKey); const xhr = new XHRProvider();
this.xhr.push(xhr);
xhr.open('POST', url, true);
xhr.setRequestHeader('X-Tinode-APIKey', this._apiKey);
if (this._authToken) { if (this._authToken) {
this.xhr.setRequestHeader('X-Tinode-Auth', `Token ${this._authToken.token}`); xhr.setRequestHeader('X-Tinode-Auth', `Token ${this._authToken.token}`);
} }
let toResolve = null;
let toReject = null;
const result = new Promise((resolve, reject) => { const result = new Promise((resolve, reject) => {
this.toResolve = resolve; toResolve = resolve;
this.toReject = reject; toReject = reject;
}); });
this.onProgress = onProgress; xhr.upload.onprogress = e => {
this.onSuccess = onSuccess; if (e.lengthComputable) {
this.onFailure = onFailure; if (onProgress) {
this.xhr.upload.onprogress = e => { onProgress(e.loaded / e.total);
if (e.lengthComputable && instance.onProgress) { }
instance.onProgress(e.loaded / e.total); if (this.onProgress) {
this.onProgress(e.loaded / e.total);
}
} }
}; };
this.xhr.onload = function () { xhr.onload = function () {
let pkt; let pkt;
try { try {
pkt = JSON.parse(this.response, _utils_js__WEBPACK_IMPORTED_MODULE_1__.jsonParseHelper); pkt = JSON.parse(this.response, _utils_js__WEBPACK_IMPORTED_MODULE_1__.jsonParseHelper);
@@ -3085,53 +3087,53 @@ class LargeFileHelper {
}; };
} }
if (this.status >= 200 && this.status < 300) { if (this.status >= 200 && this.status < 300) {
if (instance.toResolve) { if (toResolve) {
instance.toResolve(pkt.ctrl.params.url); toResolve(pkt.ctrl.params.url);
} }
if (instance.onSuccess) { if (onSuccess) {
instance.onSuccess(pkt.ctrl); onSuccess(pkt.ctrl);
} }
} else if (this.status >= 400) { } else if (this.status >= 400) {
if (instance.toReject) { if (toReject) {
instance.toReject(new _comm_error_js__WEBPACK_IMPORTED_MODULE_0__["default"](pkt.ctrl.text, pkt.ctrl.code)); toReject(new _comm_error_js__WEBPACK_IMPORTED_MODULE_0__["default"](pkt.ctrl.text, pkt.ctrl.code));
} }
if (instance.onFailure) { if (onFailure) {
instance.onFailure(pkt.ctrl); onFailure(pkt.ctrl);
} }
} else { } else {
instance._tinode.logger("ERROR: Unexpected server response status", this.status, this.response); instance._tinode.logger("ERROR: Unexpected server response status", this.status, this.response);
} }
}; };
this.xhr.onerror = function (e) { xhr.onerror = function (e) {
if (instance.toReject) { if (toReject) {
instance.toReject(e || new Error("failed")); toReject(e || new Error("failed"));
} }
if (instance.onFailure) { if (onFailure) {
instance.onFailure(null); onFailure(null);
} }
}; };
this.xhr.onabort = function (e) { xhr.onabort = function (e) {
if (instance.toReject) { if (toReject) {
instance.toReject(new Error("upload cancelled by user")); toReject(new Error("upload cancelled by user"));
} }
if (instance.onFailure) { if (onFailure) {
instance.onFailure(null); onFailure(null);
} }
}; };
try { try {
const form = new FormData(); const form = new FormData();
form.append('file', data); form.append('file', data);
form.set('id', this._reqId); form.set('id', this._tinode.getNextUniqueId());
if (avatarFor) { if (avatarFor) {
form.set('topic', avatarFor); form.set('topic', avatarFor);
} }
this.xhr.send(form); xhr.send(form);
} catch (err) { } catch (err) {
if (this.toReject) { if (toReject) {
this.toReject(err); toReject(err);
} }
if (this.onFailure) { if (onFailure) {
this.onFailure(null); onFailure(null);
} }
} }
return result; return result;
@@ -3154,21 +3156,24 @@ class LargeFileHelper {
return; return;
} }
const instance = this; const instance = this;
this.xhr.open('GET', relativeUrl, true); const xhr = new XHRProvider();
this.xhr.setRequestHeader('X-Tinode-APIKey', this._apiKey); this.xhr.push(xhr);
this.xhr.setRequestHeader('X-Tinode-Auth', 'Token ' + this._authToken.token); xhr.open('GET', relativeUrl, true);
this.xhr.responseType = 'blob'; xhr.setRequestHeader('X-Tinode-APIKey', this._apiKey);
this.onProgress = onProgress; xhr.setRequestHeader('X-Tinode-Auth', 'Token ' + this._authToken.token);
this.xhr.onprogress = function (e) { xhr.responseType = 'blob';
if (instance.onProgress) { xhr.onprogress = function (e) {
instance.onProgress(e.loaded); if (onProgress) {
onProgress(e.loaded);
} }
}; };
let toResolve = null;
let toReject = null;
const result = new Promise((resolve, reject) => { const result = new Promise((resolve, reject) => {
this.toResolve = resolve; toResolve = resolve;
this.toReject = reject; toReject = reject;
}); });
this.xhr.onload = function () { xhr.onload = function () {
if (this.status == 200) { if (this.status == 200) {
const link = document.createElement('a'); const link = document.createElement('a');
link.href = window.URL.createObjectURL(new Blob([this.response], { link.href = window.URL.createObjectURL(new Blob([this.response], {
@@ -3180,49 +3185,54 @@ class LargeFileHelper {
link.click(); link.click();
document.body.removeChild(link); document.body.removeChild(link);
window.URL.revokeObjectURL(link.href); window.URL.revokeObjectURL(link.href);
if (instance.toResolve) { if (toResolve) {
instance.toResolve(); toResolve();
} }
} else if (this.status >= 400 && instance.toReject) { } else if (this.status >= 400 && toReject) {
const reader = new FileReader(); const reader = new FileReader();
reader.onload = function () { reader.onload = function () {
try { try {
const pkt = JSON.parse(this.result, _utils_js__WEBPACK_IMPORTED_MODULE_1__.jsonParseHelper); const pkt = JSON.parse(this.result, _utils_js__WEBPACK_IMPORTED_MODULE_1__.jsonParseHelper);
instance.toReject(new _comm_error_js__WEBPACK_IMPORTED_MODULE_0__["default"](pkt.ctrl.text, pkt.ctrl.code)); toReject(new _comm_error_js__WEBPACK_IMPORTED_MODULE_0__["default"](pkt.ctrl.text, pkt.ctrl.code));
} catch (err) { } catch (err) {
instance._tinode.logger("ERROR: Invalid server response in LargeFileHelper", this.result); instance._tinode.logger("ERROR: Invalid server response in LargeFileHelper", this.result);
instance.toReject(err); toReject(err);
} }
}; };
reader.readAsText(this.response); reader.readAsText(this.response);
} }
}; };
this.xhr.onerror = function (e) { xhr.onerror = function (e) {
if (instance.toReject) { if (toReject) {
instance.toReject(new Error("failed")); toReject(new Error("failed"));
}
if (onError) {
onError(e);
} }
}; };
this.xhr.onabort = function () { xhr.onabort = function () {
if (instance.toReject) { if (toReject) {
instance.toReject(null); toReject(null);
} }
}; };
try { try {
this.xhr.send(); xhr.send();
} catch (err) { } catch (err) {
if (this.toReject) { if (toReject) {
this.toReject(err); toReject(err);
}
if (onError) {
onError(err);
} }
} }
return result; return result;
} }
cancel() { cancel() {
if (this.xhr && this.xhr.readyState < 4) { this.xhr.forEach(req => {
this.xhr.abort(); if (req.readyState < 4) {
} req.abort();
} }
getId() { });
return this._reqId;
} }
static setNetworkProvider(xhrProvider) { static setNetworkProvider(xhrProvider) {
XHRProvider = xhrProvider; XHRProvider = xhrProvider;
@@ -3371,11 +3381,12 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ }); /* harmony export */ });
/* harmony import */ var _access_mode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./access-mode.js */ "./src/access-mode.js"); /* harmony import */ var _access_mode_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./access-mode.js */ "./src/access-mode.js");
/* harmony import */ var _cbuffer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cbuffer.js */ "./src/cbuffer.js"); /* harmony import */ var _cbuffer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cbuffer.js */ "./src/cbuffer.js");
/* harmony import */ var _config_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./config.js */ "./src/config.js"); /* harmony import */ var _comm_error_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./comm-error.js */ "./src/comm-error.js");
/* harmony import */ var _drafty_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./drafty.js */ "./src/drafty.js"); /* harmony import */ var _config_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./config.js */ "./src/config.js");
/* harmony import */ var _drafty_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_drafty_js__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var _drafty_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./drafty.js */ "./src/drafty.js");
/* harmony import */ var _meta_builder_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./meta-builder.js */ "./src/meta-builder.js"); /* harmony import */ var _drafty_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_drafty_js__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils.js */ "./src/utils.js"); /* harmony import */ var _meta_builder_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./meta-builder.js */ "./src/meta-builder.js");
/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils.js */ "./src/utils.js");
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -3387,6 +3398,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
class Topic { class Topic {
constructor(name, callbacks) { constructor(name, callbacks) {
this._tinode = null; this._tinode = null;
@@ -3399,7 +3411,7 @@ class Topic {
this.public = null; this.public = null;
this.trusted = null; this.trusted = null;
this._users = {}; this._users = {};
this._queuedSeqId = _config_js__WEBPACK_IMPORTED_MODULE_2__.LOCAL_SEQID; this._queuedSeqId = _config_js__WEBPACK_IMPORTED_MODULE_3__.LOCAL_SEQID;
this._maxSeq = 0; this._maxSeq = 0;
this._minSeq = 0; this._minSeq = 0;
this._noEarlierMsgs = false; this._noEarlierMsgs = false;
@@ -3432,34 +3444,34 @@ class Topic {
} }
static topicType(name) { static topicType(name) {
const types = { const types = {
'me': _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_ME, 'me': _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_ME,
'fnd': _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_FND, 'fnd': _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_FND,
'grp': _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_GRP, 'grp': _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_GRP,
'new': _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_GRP, 'new': _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_GRP,
'nch': _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_GRP, 'nch': _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_GRP,
'chn': _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_GRP, 'chn': _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_GRP,
'usr': _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_P2P, 'usr': _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_P2P,
'sys': _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_SYS 'sys': _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_SYS
}; };
return types[typeof name == 'string' ? name.substring(0, 3) : 'xxx']; return types[typeof name == 'string' ? name.substring(0, 3) : 'xxx'];
} }
static isMeTopicName(name) { static isMeTopicName(name) {
return Topic.topicType(name) == _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_ME; return Topic.topicType(name) == _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_ME;
} }
static isGroupTopicName(name) { static isGroupTopicName(name) {
return Topic.topicType(name) == _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_GRP; return Topic.topicType(name) == _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_GRP;
} }
static isP2PTopicName(name) { static isP2PTopicName(name) {
return Topic.topicType(name) == _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_P2P; return Topic.topicType(name) == _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_P2P;
} }
static isCommTopicName(name) { static isCommTopicName(name) {
return Topic.isP2PTopicName(name) || Topic.isGroupTopicName(name); return Topic.isP2PTopicName(name) || Topic.isGroupTopicName(name);
} }
static isNewGroupTopicName(name) { static isNewGroupTopicName(name) {
return typeof name == 'string' && (name.substring(0, 3) == _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_NEW || name.substring(0, 3) == _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_NEW_CHAN); return typeof name == 'string' && (name.substring(0, 3) == _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_NEW || name.substring(0, 3) == _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_NEW_CHAN);
} }
static isChannelTopicName(name) { static isChannelTopicName(name) {
return typeof name == 'string' && (name.substring(0, 3) == _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_CHAN || name.substring(0, 3) == _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_NEW_CHAN); return typeof name == 'string' && (name.substring(0, 3) == _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_CHAN || name.substring(0, 3) == _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_NEW_CHAN);
} }
isSubscribed() { isSubscribed() {
return this._attached; return this._attached;
@@ -3473,7 +3485,7 @@ class Topic {
if (this._deleted) { if (this._deleted) {
return Promise.reject(new Error("Conversation deleted")); return Promise.reject(new Error("Conversation deleted"));
} }
return this._tinode.subscribe(this.name || _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_NEW, getParams, setParams).then(ctrl => { return this._tinode.subscribe(this.name || _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_NEW, getParams, setParams).then(ctrl => {
if (ctrl.code >= 300) { if (ctrl.code >= 300) {
return ctrl; return ctrl;
} }
@@ -3489,7 +3501,7 @@ class Topic {
this._cachePutSelf(); this._cachePutSelf();
this.created = ctrl.ts; this.created = ctrl.ts;
this.updated = ctrl.ts; this.updated = ctrl.ts;
if (this.name != _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_ME && this.name != _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_FND) { if (this.name != _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_ME && this.name != _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_FND) {
const me = this._tinode.getMeTopic(); const me = this._tinode.getMeTopic();
if (me.onMetaSub) { if (me.onMetaSub) {
me.onMetaSub(this); me.onMetaSub(this);
@@ -3522,9 +3534,9 @@ class Topic {
pub._sending = true; pub._sending = true;
pub._failed = false; pub._failed = false;
let attachments = null; let attachments = null;
if (_drafty_js__WEBPACK_IMPORTED_MODULE_3___default().hasEntities(pub.content)) { if (_drafty_js__WEBPACK_IMPORTED_MODULE_4___default().hasEntities(pub.content)) {
attachments = []; attachments = [];
_drafty_js__WEBPACK_IMPORTED_MODULE_3___default().entities(pub.content, data => { _drafty_js__WEBPACK_IMPORTED_MODULE_4___default().entities(pub.content, data => {
if (data && data.ref) { if (data && data.ref) {
attachments.push(data.ref); attachments.push(data.ref);
} }
@@ -3575,6 +3587,7 @@ class Topic {
this._tinode.logger("WARNING: Message draft rejected", err); this._tinode.logger("WARNING: Message draft rejected", err);
pub._sending = false; pub._sending = false;
pub._failed = true; pub._failed = true;
pub._fatal = err instanceof _comm_error_js__WEBPACK_IMPORTED_MODULE_2__["default"] ? err.code >= 400 && err.code < 500 : false;
if (this.onData) { if (this.onData) {
this.onData(); this.onData();
} }
@@ -3630,7 +3643,7 @@ class Topic {
} }
setMeta(params) { setMeta(params) {
if (params.tags) { if (params.tags) {
params.tags = (0,_utils_js__WEBPACK_IMPORTED_MODULE_5__.normalizeArray)(params.tags); params.tags = (0,_utils_js__WEBPACK_IMPORTED_MODULE_6__.normalizeArray)(params.tags);
} }
return this._tinode.setMeta(this.name, params).then(ctrl => { return this._tinode.setMeta(this.name, params).then(ctrl => {
if (ctrl && ctrl.code >= 300) { if (ctrl && ctrl.code >= 300) {
@@ -3692,7 +3705,7 @@ class Topic {
return this.setMeta({ return this.setMeta({
desc: { desc: {
private: { private: {
arch: arch ? true : _config_js__WEBPACK_IMPORTED_MODULE_2__.DEL_CHAR arch: arch ? true : _config_js__WEBPACK_IMPORTED_MODULE_3__.DEL_CHAR
} }
} }
}); });
@@ -3711,8 +3724,8 @@ class Topic {
return false; return false;
}); });
let tosend = ranges.reduce((out, r) => { let tosend = ranges.reduce((out, r) => {
if (r.low < _config_js__WEBPACK_IMPORTED_MODULE_2__.LOCAL_SEQID) { if (r.low < _config_js__WEBPACK_IMPORTED_MODULE_3__.LOCAL_SEQID) {
if (!r.hi || r.hi < _config_js__WEBPACK_IMPORTED_MODULE_2__.LOCAL_SEQID) { if (!r.hi || r.hi < _config_js__WEBPACK_IMPORTED_MODULE_3__.LOCAL_SEQID) {
out.push(r); out.push(r);
} else { } else {
out.push({ out.push({
@@ -4001,7 +4014,7 @@ class Topic {
if (!callback) { if (!callback) {
throw new Error("Callback must be provided"); throw new Error("Callback must be provided");
} }
this.messages(callback, _config_js__WEBPACK_IMPORTED_MODULE_2__.LOCAL_SEQID, undefined, context); this.messages(callback, _config_js__WEBPACK_IMPORTED_MODULE_3__.LOCAL_SEQID, undefined, context);
} }
msgReceiptCount(what, seq) { msgReceiptCount(what, seq) {
let count = 0; let count = 0;
@@ -4069,7 +4082,7 @@ class Topic {
if (idx >= 0) { if (idx >= 0) {
const msg = this._messages.getAt(idx); const msg = this._messages.getAt(idx);
const status = this.msgStatus(msg); const status = this.msgStatus(msg);
if (status == _config_js__WEBPACK_IMPORTED_MODULE_2__.MESSAGE_STATUS_QUEUED || status == _config_js__WEBPACK_IMPORTED_MODULE_2__.MESSAGE_STATUS_FAILED) { if (status == _config_js__WEBPACK_IMPORTED_MODULE_3__.MESSAGE_STATUS_QUEUED || status == _config_js__WEBPACK_IMPORTED_MODULE_3__.MESSAGE_STATUS_FAILED || status == _config_js__WEBPACK_IMPORTED_MODULE_3__.MESSAGE_STATUS_FATAL) {
this._tinode._db.remMessages(this.name, seqId); this._tinode._db.remMessages(this.name, seqId);
msg._cancelled = true; msg._cancelled = true;
this._messages.delAt(idx); this._messages.delAt(idx);
@@ -4094,7 +4107,7 @@ class Topic {
return this.defacs; return this.defacs;
} }
startMetaQuery() { startMetaQuery() {
return new _meta_builder_js__WEBPACK_IMPORTED_MODULE_4__["default"](this); return new _meta_builder_js__WEBPACK_IMPORTED_MODULE_5__["default"](this);
} }
isArchived() { isArchived() {
return this.private && !!this.private.arch; return this.private && !!this.private.arch;
@@ -4115,23 +4128,25 @@ class Topic {
return Topic.isCommTopicName(this.name); return Topic.isCommTopicName(this.name);
} }
msgStatus(msg, upd) { msgStatus(msg, upd) {
let status = _config_js__WEBPACK_IMPORTED_MODULE_2__.MESSAGE_STATUS_NONE; let status = _config_js__WEBPACK_IMPORTED_MODULE_3__.MESSAGE_STATUS_NONE;
if (this._tinode.isMe(msg.from)) { if (this._tinode.isMe(msg.from)) {
if (msg._sending) { if (msg._sending) {
status = _config_js__WEBPACK_IMPORTED_MODULE_2__.MESSAGE_STATUS_SENDING; status = _config_js__WEBPACK_IMPORTED_MODULE_3__.MESSAGE_STATUS_SENDING;
} else if (msg._failed || msg._cancelled) { } else if (msg._fatal || msg._cancelled) {
status = _config_js__WEBPACK_IMPORTED_MODULE_2__.MESSAGE_STATUS_FAILED; status = _config_js__WEBPACK_IMPORTED_MODULE_3__.MESSAGE_STATUS_FATAL;
} else if (msg.seq >= _config_js__WEBPACK_IMPORTED_MODULE_2__.LOCAL_SEQID) { } else if (msg._failed) {
status = _config_js__WEBPACK_IMPORTED_MODULE_2__.MESSAGE_STATUS_QUEUED; status = _config_js__WEBPACK_IMPORTED_MODULE_3__.MESSAGE_STATUS_FAILED;
} else if (msg.seq >= _config_js__WEBPACK_IMPORTED_MODULE_3__.LOCAL_SEQID) {
status = _config_js__WEBPACK_IMPORTED_MODULE_3__.MESSAGE_STATUS_QUEUED;
} else if (this.msgReadCount(msg.seq) > 0) { } else if (this.msgReadCount(msg.seq) > 0) {
status = _config_js__WEBPACK_IMPORTED_MODULE_2__.MESSAGE_STATUS_READ; status = _config_js__WEBPACK_IMPORTED_MODULE_3__.MESSAGE_STATUS_READ;
} else if (this.msgRecvCount(msg.seq) > 0) { } else if (this.msgRecvCount(msg.seq) > 0) {
status = _config_js__WEBPACK_IMPORTED_MODULE_2__.MESSAGE_STATUS_RECEIVED; status = _config_js__WEBPACK_IMPORTED_MODULE_3__.MESSAGE_STATUS_RECEIVED;
} else if (msg.seq > 0) { } else if (msg.seq > 0) {
status = _config_js__WEBPACK_IMPORTED_MODULE_2__.MESSAGE_STATUS_SENT; status = _config_js__WEBPACK_IMPORTED_MODULE_3__.MESSAGE_STATUS_SENT;
} }
} else { } else {
status = _config_js__WEBPACK_IMPORTED_MODULE_2__.MESSAGE_STATUS_TO_ME; status = _config_js__WEBPACK_IMPORTED_MODULE_3__.MESSAGE_STATUS_TO_ME;
} }
if (upd && msg._status != status) { if (upd && msg._status != status) {
msg._status = status; msg._status = status;
@@ -4180,14 +4195,14 @@ class Topic {
this._recvNotificationTimer = setTimeout(_ => { this._recvNotificationTimer = setTimeout(_ => {
this._recvNotificationTimer = null; this._recvNotificationTimer = null;
this.noteRecv(this._maxSeq); this.noteRecv(this._maxSeq);
}, _config_js__WEBPACK_IMPORTED_MODULE_2__.RECV_TIMEOUT); }, _config_js__WEBPACK_IMPORTED_MODULE_3__.RECV_TIMEOUT);
} }
if (data.seq < this._minSeq || this._minSeq == 0) { if (data.seq < this._minSeq || this._minSeq == 0) {
this._minSeq = data.seq; this._minSeq = data.seq;
} }
const outgoing = !this.isChannelType() && !data.from || this._tinode.isMe(data.from); const outgoing = !this.isChannelType() && !data.from || this._tinode.isMe(data.from);
if (data.head && data.head.webrtc && data.head.mime == _drafty_js__WEBPACK_IMPORTED_MODULE_3___default().getContentType() && data.content) { if (data.head && data.head.webrtc && data.head.mime == _drafty_js__WEBPACK_IMPORTED_MODULE_4___default().getContentType() && data.content) {
data.content = _drafty_js__WEBPACK_IMPORTED_MODULE_3___default().updateVideoCall(data.content, { data.content = _drafty_js__WEBPACK_IMPORTED_MODULE_4___default().updateVideoCall(data.content, {
state: data.head.webrtc, state: data.head.webrtc,
duration: data.head['webrtc-duration'], duration: data.head['webrtc-duration'],
incoming: !outgoing incoming: !outgoing
@@ -4319,9 +4334,9 @@ class Topic {
delete desc.defacs; delete desc.defacs;
this._tinode._db.updUser(this.name, desc.public); this._tinode._db.updUser(this.name, desc.public);
} }
(0,_utils_js__WEBPACK_IMPORTED_MODULE_5__.mergeObj)(this, desc); (0,_utils_js__WEBPACK_IMPORTED_MODULE_6__.mergeObj)(this, desc);
this._tinode._db.updTopic(this); this._tinode._db.updTopic(this);
if (this.name !== _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_ME && !desc._noForwarding) { if (this.name !== _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_ME && !desc._noForwarding) {
const me = this._tinode.getMeTopic(); const me = this._tinode.getMeTopic();
if (me.onMetaSub) { if (me.onMetaSub) {
me.onMetaSub(this); me.onMetaSub(this);
@@ -4362,7 +4377,7 @@ class Topic {
} }
} }
_processMetaTags(tags) { _processMetaTags(tags) {
if (tags.length == 1 && tags[0] == _config_js__WEBPACK_IMPORTED_MODULE_2__.DEL_CHAR) { if (tags.length == 1 && tags[0] == _config_js__WEBPACK_IMPORTED_MODULE_3__.DEL_CHAR) {
tags = []; tags = [];
} }
this._tags = tags; this._tags = tags;
@@ -4419,7 +4434,7 @@ class Topic {
me._routePres({ me._routePres({
_noForwarding: true, _noForwarding: true,
what: 'gone', what: 'gone',
topic: _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_ME, topic: _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_ME,
src: this.name src: this.name
}); });
} }
@@ -4429,9 +4444,9 @@ class Topic {
} }
_updateCachedUser(uid, obj) { _updateCachedUser(uid, obj) {
let cached = this._cacheGetUser(uid); let cached = this._cacheGetUser(uid);
cached = (0,_utils_js__WEBPACK_IMPORTED_MODULE_5__.mergeObj)(cached || {}, obj); cached = (0,_utils_js__WEBPACK_IMPORTED_MODULE_6__.mergeObj)(cached || {}, obj);
this._cachePutUser(uid, cached); this._cachePutUser(uid, cached);
return (0,_utils_js__WEBPACK_IMPORTED_MODULE_5__.mergeToCache)(this._users, uid, cached); return (0,_utils_js__WEBPACK_IMPORTED_MODULE_6__.mergeToCache)(this._users, uid, cached);
} }
_getQueuedSeqId() { _getQueuedSeqId() {
return this._queuedSeqId++; return this._queuedSeqId++;
@@ -4445,7 +4460,7 @@ class Topic {
return db.readMessages(this.name, { return db.readMessages(this.name, {
since: since, since: since,
before: before, before: before,
limit: limit || _config_js__WEBPACK_IMPORTED_MODULE_2__.DEFAULT_MESSAGES_PAGE limit: limit || _config_js__WEBPACK_IMPORTED_MODULE_3__.DEFAULT_MESSAGES_PAGE
}).then(msgs => { }).then(msgs => {
msgs.forEach(data => { msgs.forEach(data => {
if (data.seq > this._maxSeq) { if (data.seq > this._maxSeq) {
@@ -4473,7 +4488,7 @@ class Topic {
} }
class TopicMe extends Topic { class TopicMe extends Topic {
constructor(callbacks) { constructor(callbacks) {
super(_config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_ME, callbacks); super(_config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_ME, callbacks);
_defineProperty(this, "onContactUpdate", void 0); _defineProperty(this, "onContactUpdate", void 0);
if (callbacks) { if (callbacks) {
this.onContactUpdate = callbacks.onContactUpdate; this.onContactUpdate = callbacks.onContactUpdate;
@@ -4481,7 +4496,7 @@ class TopicMe extends Topic {
} }
_processMetaDesc(desc) { _processMetaDesc(desc) {
const turnOff = desc.acs && !desc.acs.isPresencer() && this.acs && this.acs.isPresencer(); const turnOff = desc.acs && !desc.acs.isPresencer() && this.acs && this.acs.isPresencer();
(0,_utils_js__WEBPACK_IMPORTED_MODULE_5__.mergeObj)(this, desc); (0,_utils_js__WEBPACK_IMPORTED_MODULE_6__.mergeObj)(this, desc);
this._tinode._db.updTopic(this); this._tinode._db.updTopic(this);
this._updateCachedUser(this._tinode._myUID, desc); this._updateCachedUser(this._tinode._myUID, desc);
if (turnOff) { if (turnOff) {
@@ -4503,7 +4518,7 @@ class TopicMe extends Topic {
let updateCount = 0; let updateCount = 0;
subs.forEach(sub => { subs.forEach(sub => {
const topicName = sub.topic; const topicName = sub.topic;
if (topicName == _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_FND || topicName == _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_ME) { if (topicName == _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_FND || topicName == _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_ME) {
return; return;
} }
sub.online = !!sub.online; sub.online = !!sub.online;
@@ -4523,7 +4538,7 @@ class TopicMe extends Topic {
if (topic._new) { if (topic._new) {
delete topic._new; delete topic._new;
} }
cont = (0,_utils_js__WEBPACK_IMPORTED_MODULE_5__.mergeObj)(topic, sub); cont = (0,_utils_js__WEBPACK_IMPORTED_MODULE_6__.mergeObj)(topic, sub);
this._tinode._db.updTopic(cont); this._tinode._db.updTopic(cont);
if (Topic.isP2PTopicName(topicName)) { if (Topic.isP2PTopicName(topicName)) {
this._cachePutUser(topicName, cont); this._cachePutUser(topicName, cont);
@@ -4548,7 +4563,7 @@ class TopicMe extends Topic {
} }
} }
_processMetaCreds(creds, upd) { _processMetaCreds(creds, upd) {
if (creds.length == 1 && creds[0] == _config_js__WEBPACK_IMPORTED_MODULE_2__.DEL_CHAR) { if (creds.length == 1 && creds[0] == _config_js__WEBPACK_IMPORTED_MODULE_3__.DEL_CHAR) {
creds = []; creds = [];
} }
if (upd) { if (upd) {
@@ -4591,7 +4606,7 @@ class TopicMe extends Topic {
this._resetSub(); this._resetSub();
return; return;
} }
if (pres.what == 'upd' && pres.src == _config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_ME) { if (pres.what == 'upd' && pres.src == _config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_ME) {
this.getMeta(this.startMetaQuery().withDesc().build()); this.getMeta(this.startMetaQuery().withDesc().build());
return; return;
} }
@@ -4731,7 +4746,7 @@ class TopicMe extends Topic {
} }
class TopicFnd extends Topic { class TopicFnd extends Topic {
constructor(callbacks) { constructor(callbacks) {
super(_config_js__WEBPACK_IMPORTED_MODULE_2__.TOPIC_FND, callbacks); super(_config_js__WEBPACK_IMPORTED_MODULE_3__.TOPIC_FND, callbacks);
_defineProperty(this, "_contacts", {}); _defineProperty(this, "_contacts", {});
} }
_processMetaSub(subs) { _processMetaSub(subs) {
@@ -4740,7 +4755,7 @@ class TopicFnd extends Topic {
for (let idx in subs) { for (let idx in subs) {
let sub = subs[idx]; let sub = subs[idx];
const indexBy = sub.topic ? sub.topic : sub.user; const indexBy = sub.topic ? sub.topic : sub.user;
sub = (0,_utils_js__WEBPACK_IMPORTED_MODULE_5__.mergeToCache)(this._contacts, indexBy, sub); sub = (0,_utils_js__WEBPACK_IMPORTED_MODULE_6__.mergeToCache)(this._contacts, indexBy, sub);
updateCount++; updateCount++;
if (this.onMetaSub) { if (this.onMetaSub) {
this.onMetaSub(sub); this.onMetaSub(sub);
@@ -6275,6 +6290,7 @@ Tinode.MESSAGE_STATUS_NONE = _config_js__WEBPACK_IMPORTED_MODULE_1__.MESSAGE_STA
Tinode.MESSAGE_STATUS_QUEUED = _config_js__WEBPACK_IMPORTED_MODULE_1__.MESSAGE_STATUS_QUEUED; Tinode.MESSAGE_STATUS_QUEUED = _config_js__WEBPACK_IMPORTED_MODULE_1__.MESSAGE_STATUS_QUEUED;
Tinode.MESSAGE_STATUS_SENDING = _config_js__WEBPACK_IMPORTED_MODULE_1__.MESSAGE_STATUS_SENDING; Tinode.MESSAGE_STATUS_SENDING = _config_js__WEBPACK_IMPORTED_MODULE_1__.MESSAGE_STATUS_SENDING;
Tinode.MESSAGE_STATUS_FAILED = _config_js__WEBPACK_IMPORTED_MODULE_1__.MESSAGE_STATUS_FAILED; Tinode.MESSAGE_STATUS_FAILED = _config_js__WEBPACK_IMPORTED_MODULE_1__.MESSAGE_STATUS_FAILED;
Tinode.MESSAGE_STATUS_FATAL = _config_js__WEBPACK_IMPORTED_MODULE_1__.MESSAGE_STATUS_FATAL;
Tinode.MESSAGE_STATUS_SENT = _config_js__WEBPACK_IMPORTED_MODULE_1__.MESSAGE_STATUS_SENT; Tinode.MESSAGE_STATUS_SENT = _config_js__WEBPACK_IMPORTED_MODULE_1__.MESSAGE_STATUS_SENT;
Tinode.MESSAGE_STATUS_RECEIVED = _config_js__WEBPACK_IMPORTED_MODULE_1__.MESSAGE_STATUS_RECEIVED; Tinode.MESSAGE_STATUS_RECEIVED = _config_js__WEBPACK_IMPORTED_MODULE_1__.MESSAGE_STATUS_RECEIVED;
Tinode.MESSAGE_STATUS_READ = _config_js__WEBPACK_IMPORTED_MODULE_1__.MESSAGE_STATUS_READ; Tinode.MESSAGE_STATUS_READ = _config_js__WEBPACK_IMPORTED_MODULE_1__.MESSAGE_STATUS_READ;
@@ -6284,6 +6300,7 @@ Tinode.MAX_MESSAGE_SIZE = 'maxMessageSize';
Tinode.MAX_SUBSCRIBER_COUNT = 'maxSubscriberCount'; Tinode.MAX_SUBSCRIBER_COUNT = 'maxSubscriberCount';
Tinode.MAX_TAG_COUNT = 'maxTagCount'; Tinode.MAX_TAG_COUNT = 'maxTagCount';
Tinode.MAX_FILE_UPLOAD_SIZE = 'maxFileUploadSize'; Tinode.MAX_FILE_UPLOAD_SIZE = 'maxFileUploadSize';
Tinode.REQ_CRED_VALIDATORS = 'reqCred';
})(); })();
/******/ return __webpack_exports__; /******/ return __webpack_exports__;
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long