sceyt-chat-react-uikit 1.8.4-beta.3 → 1.8.4-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +341 -436
- package/index.modern.js +341 -436
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2658,14 +2658,6 @@ var channelDetailsTabs = {
|
|
|
2658
2658
|
link: 'Links',
|
|
2659
2659
|
voice: 'Voice'
|
|
2660
2660
|
};
|
|
2661
|
-
var DB_NAMES = {
|
|
2662
|
-
FILES_STORAGE: 'files-storage'
|
|
2663
|
-
};
|
|
2664
|
-
var DB_STORE_NAMES = {
|
|
2665
|
-
CHANNELS: 'channels',
|
|
2666
|
-
MESSAGES: 'messages',
|
|
2667
|
-
ATTACHMENTS: 'attachments'
|
|
2668
|
-
};
|
|
2669
2661
|
var THEME = {
|
|
2670
2662
|
DARK: 'dark',
|
|
2671
2663
|
LIGHT: 'light'
|
|
@@ -10351,32 +10343,6 @@ var getEmojisCategoryTitle = function getEmojisCategoryTitle(categoryKey) {
|
|
|
10351
10343
|
}
|
|
10352
10344
|
return category;
|
|
10353
10345
|
};
|
|
10354
|
-
var hashString = function hashString(str) {
|
|
10355
|
-
try {
|
|
10356
|
-
var _temp3 = function _temp3(_result) {
|
|
10357
|
-
if (_exit) return _result;
|
|
10358
|
-
var hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
10359
|
-
return hashArray.map(function (_byte) {
|
|
10360
|
-
return _byte.toString(16).padStart(2, '0');
|
|
10361
|
-
}).join('');
|
|
10362
|
-
};
|
|
10363
|
-
var _exit = false;
|
|
10364
|
-
var encoder = new TextEncoder();
|
|
10365
|
-
var encodedData = encoder.encode(str);
|
|
10366
|
-
var hashBuffer;
|
|
10367
|
-
var _temp2 = _catch(function () {
|
|
10368
|
-
return Promise.resolve(crypto.subtle.digest('SHA-256', encodedData)).then(function (_crypto$subtle$digest) {
|
|
10369
|
-
hashBuffer = _crypto$subtle$digest;
|
|
10370
|
-
});
|
|
10371
|
-
}, function () {
|
|
10372
|
-
_exit = true;
|
|
10373
|
-
return '';
|
|
10374
|
-
});
|
|
10375
|
-
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2));
|
|
10376
|
-
} catch (e) {
|
|
10377
|
-
return Promise.reject(e);
|
|
10378
|
-
}
|
|
10379
|
-
};
|
|
10380
10346
|
var formatDisappearingMessageTime = function formatDisappearingMessageTime(periodInMilliseconds) {
|
|
10381
10347
|
if (!periodInMilliseconds) return 'Off';
|
|
10382
10348
|
var periodInSeconds = periodInMilliseconds / 1000;
|
|
@@ -20613,7 +20579,7 @@ var compressAndCacheImage = function compressAndCacheImage(url, cacheKey, maxWid
|
|
|
20613
20579
|
try {
|
|
20614
20580
|
return Promise.resolve(_catch(function () {
|
|
20615
20581
|
return Promise.resolve(fetch(url)).then(function (response) {
|
|
20616
|
-
return Promise.resolve(response.blob()).then(function (blob) {
|
|
20582
|
+
return response.ok ? Promise.resolve(response.blob()).then(function (blob) {
|
|
20617
20583
|
var _exit = false;
|
|
20618
20584
|
function _temp2(_result2) {
|
|
20619
20585
|
if (_exit) return _result2;
|
|
@@ -20642,19 +20608,11 @@ var compressAndCacheImage = function compressAndCacheImage(url, cacheKey, maxWid
|
|
|
20642
20608
|
}
|
|
20643
20609
|
}();
|
|
20644
20610
|
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
|
20645
|
-
});
|
|
20611
|
+
}) : '';
|
|
20646
20612
|
});
|
|
20647
20613
|
}, function (error) {
|
|
20648
20614
|
log.error('Error compressing and caching image:', error);
|
|
20649
|
-
return
|
|
20650
|
-
return Promise.resolve(fetch(url)).then(function (response) {
|
|
20651
|
-
setAttachmentToCache(cacheKey, response);
|
|
20652
|
-
return '';
|
|
20653
|
-
});
|
|
20654
|
-
}, function (fetchError) {
|
|
20655
|
-
log.error('Error caching image:', fetchError);
|
|
20656
|
-
return '';
|
|
20657
|
-
});
|
|
20615
|
+
return '';
|
|
20658
20616
|
}));
|
|
20659
20617
|
} catch (e) {
|
|
20660
20618
|
return Promise.reject(e);
|
|
@@ -20705,7 +20663,16 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
|
|
|
20705
20663
|
var _temp10 = function _temp10() {
|
|
20706
20664
|
function _temp0() {
|
|
20707
20665
|
store.dispatch(updateAttachmentUploadingStateAC(UPLOAD_STATE.SUCCESS, attachment.tid));
|
|
20708
|
-
var
|
|
20666
|
+
var parsedAttachmentMeta = function () {
|
|
20667
|
+
if (!attachment.metadata) return {};
|
|
20668
|
+
try {
|
|
20669
|
+
var parsed = typeof attachment.metadata === 'string' ? JSON.parse(attachment.metadata) : attachment.metadata;
|
|
20670
|
+
return typeof parsed === 'string' ? JSON.parse(parsed) : parsed || {};
|
|
20671
|
+
} catch (_unused) {
|
|
20672
|
+
return {};
|
|
20673
|
+
}
|
|
20674
|
+
}();
|
|
20675
|
+
var attachmentMeta = attachment.cachedUrl ? attachment.metadata : JSON.stringify(_extends({}, parsedAttachmentMeta, thumbnailMetas && thumbnailMetas.thumbnail && _extends({
|
|
20709
20676
|
tmb: thumbnailMetas.thumbnail,
|
|
20710
20677
|
szw: thumbnailMetas.imageWidth,
|
|
20711
20678
|
szh: thumbnailMetas.imageHeight
|
|
@@ -20714,6 +20681,9 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
|
|
|
20714
20681
|
} : {})));
|
|
20715
20682
|
var attachmentBuilder = channel.createAttachmentBuilder(uriLocal, attachment.type);
|
|
20716
20683
|
var attachmentToSend = attachmentBuilder.setName(attachment.name).setMetadata(attachmentMeta).setFileSize(fileSize || attachment.size).setUpload(false).create();
|
|
20684
|
+
if (attachment.tid) {
|
|
20685
|
+
attachmentToSend.tid = attachment.tid;
|
|
20686
|
+
}
|
|
20717
20687
|
return attachmentToSend;
|
|
20718
20688
|
}
|
|
20719
20689
|
var thumbnailMetas;
|
|
@@ -20724,8 +20694,8 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
|
|
|
20724
20694
|
return _catch(function () {
|
|
20725
20695
|
var _temp2 = function () {
|
|
20726
20696
|
if (blobLocal && blobLocal.type.startsWith('image/')) {
|
|
20727
|
-
var file = new File([
|
|
20728
|
-
type: blobLocal.type
|
|
20697
|
+
var file = attachment.url instanceof File ? attachment.url : new File([attachment.url], attachment.name || 'image', {
|
|
20698
|
+
type: attachment.url.type || blobLocal.type
|
|
20729
20699
|
});
|
|
20730
20700
|
var _calculateRenderedIma = calculateRenderedImageWidth(thumbnailMetas.imageWidth || 1280, thumbnailMetas.imageHeight || 1080),
|
|
20731
20701
|
newWidth = _calculateRenderedIma[0],
|
|
@@ -20847,16 +20817,22 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
|
|
|
20847
20817
|
var blobLocal = null;
|
|
20848
20818
|
var _temp1 = function () {
|
|
20849
20819
|
if (attachment.cachedUrl) {
|
|
20820
|
+
var _attachment$data;
|
|
20850
20821
|
uriLocal = attachment.cachedUrl;
|
|
20851
|
-
|
|
20822
|
+
var dataSize = ((_attachment$data = attachment.data) === null || _attachment$data === void 0 ? void 0 : _attachment$data.size) || 0;
|
|
20823
|
+
store.dispatch(updateAttachmentUploadingProgressAC(dataSize, dataSize, attachment.tid));
|
|
20852
20824
|
} else {
|
|
20853
20825
|
return Promise.resolve(customUpload(attachment, handleUploadProgress, message.type, handleUpdateLocalPath)).then(function (_ref3) {
|
|
20854
20826
|
var uri = _ref3.uri,
|
|
20855
20827
|
blob = _ref3.blob;
|
|
20856
20828
|
uriLocal = uri;
|
|
20857
20829
|
blobLocal = blob;
|
|
20858
|
-
|
|
20859
|
-
|
|
20830
|
+
if (blobLocal) {
|
|
20831
|
+
fileSize = blobLocal.size;
|
|
20832
|
+
filePath = URL.createObjectURL(blobLocal);
|
|
20833
|
+
} else {
|
|
20834
|
+
log.warn('Upload returned null blob for attachment:', attachment.name);
|
|
20835
|
+
}
|
|
20860
20836
|
});
|
|
20861
20837
|
}
|
|
20862
20838
|
}();
|
|
@@ -21059,15 +21035,9 @@ function sendMessage(action) {
|
|
|
21059
21035
|
log.info('fail to upload attachment ... ', error);
|
|
21060
21036
|
store.dispatch(updateAttachmentUploadingStateAC(UPLOAD_STATE.FAIL, attachment.tid));
|
|
21061
21037
|
} else {
|
|
21062
|
-
var _attachment$
|
|
21063
|
-
var pendingAttachment = getPendingAttachment(attachment.tid);
|
|
21064
|
-
if (!attachment.cachedUrl) {
|
|
21065
|
-
setDataToDB(DB_NAMES.FILES_STORAGE, DB_STORE_NAMES.ATTACHMENTS, [_extends({}, updatedAttachment, {
|
|
21066
|
-
checksum: pendingAttachment.checksum
|
|
21067
|
-
})], 'checksum');
|
|
21068
|
-
}
|
|
21038
|
+
var _attachment$data2, _attachment$data2$typ;
|
|
21069
21039
|
var uriLocal = updatedAttachment.url;
|
|
21070
|
-
var fileType = (_attachment$
|
|
21040
|
+
var fileType = (_attachment$data2 = attachment.data) === null || _attachment$data2 === void 0 ? void 0 : (_attachment$data2$typ = _attachment$data2.type) === null || _attachment$data2$typ === void 0 ? void 0 : _attachment$data2$typ.split('/')[0];
|
|
21071
21041
|
var updateImage = function updateImage() {
|
|
21072
21042
|
try {
|
|
21073
21043
|
var _temp18 = function () {
|
|
@@ -21282,28 +21252,45 @@ function sendMessage(action) {
|
|
|
21282
21252
|
messagesToSend.push(messageToSend);
|
|
21283
21253
|
case 13:
|
|
21284
21254
|
_loop2 = /*#__PURE__*/_regenerator().m(function _callee3() {
|
|
21285
|
-
var messageAttachment, messageToSend, messageCopy, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k,
|
|
21255
|
+
var messageAttachment, messageToSend, pendingState, messageCopy, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k, attachmentsToUpdate, currentAttachmentsMap, messageUpdateData, activeChannelId, messageToUpdate, channelUpdateParam, _channel, _messageToSend2, _channel2, isErrorResendable, _messageToSend$attach, _iterator, _step, att, _t;
|
|
21286
21256
|
return _regenerator().w(function (_context3) {
|
|
21287
21257
|
while (1) switch (_context3.p = _context3.n) {
|
|
21288
21258
|
case 0:
|
|
21289
21259
|
messageAttachment = messagesToSend[_i].attachments;
|
|
21290
21260
|
messageToSend = messagesToSend[_i];
|
|
21291
|
-
|
|
21261
|
+
if (!(action.type === RESEND_MESSAGE)) {
|
|
21262
|
+
_context3.n = 2;
|
|
21263
|
+
break;
|
|
21264
|
+
}
|
|
21265
|
+
pendingState = {
|
|
21266
|
+
state: MESSAGE_STATUS.UNMODIFIED
|
|
21267
|
+
};
|
|
21268
|
+
updateMessageOnMap(channel.id, {
|
|
21269
|
+
messageId: messageToSend.tid,
|
|
21270
|
+
params: pendingState
|
|
21271
|
+
});
|
|
21272
|
+
updateMessageOnAllMessages(messageToSend.tid, pendingState);
|
|
21273
|
+
_context3.n = 1;
|
|
21274
|
+
return effects.put(updateMessageAC(messageToSend.tid, pendingState));
|
|
21275
|
+
case 1:
|
|
21276
|
+
messageToSend = _extends({}, messageToSend, pendingState);
|
|
21277
|
+
case 2:
|
|
21278
|
+
_context3.p = 2;
|
|
21292
21279
|
messageCopy = JSON.parse(JSON.stringify(messagesToSend[_i]));
|
|
21293
21280
|
if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
|
|
21294
|
-
_context3.n =
|
|
21281
|
+
_context3.n = 14;
|
|
21295
21282
|
break;
|
|
21296
21283
|
}
|
|
21297
21284
|
_attachmentsToSend = messageAttachment;
|
|
21298
21285
|
if (!customUploader) {
|
|
21299
|
-
_context3.n =
|
|
21286
|
+
_context3.n = 4;
|
|
21300
21287
|
break;
|
|
21301
21288
|
}
|
|
21302
|
-
_context3.n =
|
|
21289
|
+
_context3.n = 3;
|
|
21303
21290
|
return effects.call(handleUploadAttachments, messageAttachment || [], messageCopy, channel);
|
|
21304
|
-
case 2:
|
|
21305
|
-
_attachmentsToSend = _context3.v;
|
|
21306
21291
|
case 3:
|
|
21292
|
+
_attachmentsToSend = _context3.v;
|
|
21293
|
+
case 4:
|
|
21307
21294
|
linkAttachmentToSend = null;
|
|
21308
21295
|
if (_i === 0 && linkAttachment) {
|
|
21309
21296
|
linkAttachmentBuilder = channel.createAttachmentBuilder(linkAttachment.data, linkAttachment.type);
|
|
@@ -21318,39 +21305,33 @@ function sendMessage(action) {
|
|
|
21318
21305
|
attachments: [].concat(_attachmentsToSend)
|
|
21319
21306
|
});
|
|
21320
21307
|
}
|
|
21321
|
-
_context3.n =
|
|
21308
|
+
_context3.n = 5;
|
|
21322
21309
|
return effects.call(channel.sendMessage, messageToSend);
|
|
21323
|
-
case
|
|
21310
|
+
case 5:
|
|
21324
21311
|
messageResponse = _context3.v;
|
|
21325
21312
|
if (!customUploader) {
|
|
21326
|
-
_context3.n =
|
|
21313
|
+
_context3.n = 9;
|
|
21327
21314
|
break;
|
|
21328
21315
|
}
|
|
21329
21316
|
k = 0;
|
|
21330
|
-
case
|
|
21317
|
+
case 6:
|
|
21331
21318
|
if (!(k < messageAttachment.length)) {
|
|
21332
|
-
_context3.n =
|
|
21319
|
+
_context3.n = 9;
|
|
21333
21320
|
break;
|
|
21334
21321
|
}
|
|
21335
21322
|
messageResponse.attachments[k] = _extends({}, messageResponse.attachments[k], {
|
|
21336
21323
|
user: JSON.parse(JSON.stringify(messageResponse.user)),
|
|
21337
21324
|
tid: messageAttachment[k].tid
|
|
21338
21325
|
});
|
|
21339
|
-
|
|
21340
|
-
if (!messageAttachment[k].cachedUrl) {
|
|
21341
|
-
setDataToDB(DB_NAMES.FILES_STORAGE, DB_STORE_NAMES.ATTACHMENTS, [_extends({}, messageResponse.attachments[k], {
|
|
21342
|
-
checksum: pendingAttachment.checksum || (pendingAttachment === null || pendingAttachment === void 0 ? void 0 : pendingAttachment.file)
|
|
21343
|
-
})], 'checksum');
|
|
21344
|
-
}
|
|
21345
|
-
_context3.n = 6;
|
|
21326
|
+
_context3.n = 7;
|
|
21346
21327
|
return effects.put(removeAttachmentProgressAC(messageAttachment[k].tid));
|
|
21347
|
-
case 6:
|
|
21348
|
-
deletePendingAttachment(messageAttachment[k].tid);
|
|
21349
21328
|
case 7:
|
|
21329
|
+
deletePendingAttachment(messageAttachment[k].tid);
|
|
21330
|
+
case 8:
|
|
21350
21331
|
k++;
|
|
21351
|
-
_context3.n =
|
|
21332
|
+
_context3.n = 6;
|
|
21352
21333
|
break;
|
|
21353
|
-
case
|
|
21334
|
+
case 9:
|
|
21354
21335
|
attachmentsToUpdate = [];
|
|
21355
21336
|
if (messageResponse.attachments && messageResponse.attachments.length > 0) {
|
|
21356
21337
|
currentAttachmentsMap = {};
|
|
@@ -21358,9 +21339,13 @@ function sendMessage(action) {
|
|
|
21358
21339
|
currentAttachmentsMap[attachment.tid] = attachment;
|
|
21359
21340
|
});
|
|
21360
21341
|
attachmentsToUpdate = messageResponse.attachments.map(function (attachment) {
|
|
21361
|
-
|
|
21362
|
-
|
|
21363
|
-
|
|
21342
|
+
var localAttachment = currentAttachmentsMap[attachment.tid];
|
|
21343
|
+
if (localAttachment && attachment.type !== attachmentTypes.voice) {
|
|
21344
|
+
var merged = _extends({}, attachment);
|
|
21345
|
+
if (!+merged.size && localAttachment.size) {
|
|
21346
|
+
merged.size = localAttachment.size;
|
|
21347
|
+
}
|
|
21348
|
+
return merged;
|
|
21364
21349
|
} else if (attachment.type === attachmentTypes.voice) {
|
|
21365
21350
|
return _extends({}, attachment);
|
|
21366
21351
|
}
|
|
@@ -21373,15 +21358,15 @@ function sendMessage(action) {
|
|
|
21373
21358
|
});
|
|
21374
21359
|
activeChannelId = getActiveChannelId();
|
|
21375
21360
|
if (!(activeChannelId === channel.id)) {
|
|
21376
|
-
_context3.n =
|
|
21361
|
+
_context3.n = 10;
|
|
21377
21362
|
break;
|
|
21378
21363
|
}
|
|
21379
|
-
_context3.n = 9;
|
|
21380
|
-
return effects.put(updateMessageAC(messageToSend.tid, messageUpdateData, true));
|
|
21381
|
-
case 9:
|
|
21382
21364
|
_context3.n = 10;
|
|
21383
|
-
return effects.put(
|
|
21365
|
+
return effects.put(updateMessageAC(messageToSend.tid, messageUpdateData, true));
|
|
21384
21366
|
case 10:
|
|
21367
|
+
_context3.n = 11;
|
|
21368
|
+
return effects.put(removePendingMessageAC(channel.id, messageToSend.tid));
|
|
21369
|
+
case 11:
|
|
21385
21370
|
updateMessageOnAllMessages(messageToSend.tid, messageUpdateData);
|
|
21386
21371
|
messageToUpdate = JSON.parse(JSON.stringify(messageResponse));
|
|
21387
21372
|
addMessageToMap(channel.id, messageToUpdate);
|
|
@@ -21391,49 +21376,63 @@ function sendMessage(action) {
|
|
|
21391
21376
|
lastReactedMessage: null
|
|
21392
21377
|
};
|
|
21393
21378
|
if (!channel.unread) {
|
|
21394
|
-
_context3.n =
|
|
21379
|
+
_context3.n = 12;
|
|
21395
21380
|
break;
|
|
21396
21381
|
}
|
|
21397
|
-
_context3.n = 11;
|
|
21398
|
-
return effects.put(markChannelAsReadAC(channel.id));
|
|
21399
|
-
case 11:
|
|
21400
21382
|
_context3.n = 12;
|
|
21401
|
-
return effects.put(
|
|
21383
|
+
return effects.put(markChannelAsReadAC(channel.id));
|
|
21402
21384
|
case 12:
|
|
21385
|
+
_context3.n = 13;
|
|
21386
|
+
return effects.put(updateChannelDataAC(channel.id, channelUpdateParam, true));
|
|
21387
|
+
case 13:
|
|
21403
21388
|
updateChannelOnAllChannels(channel.id, channelUpdateParam);
|
|
21404
|
-
_context3.n =
|
|
21389
|
+
_context3.n = 15;
|
|
21405
21390
|
break;
|
|
21406
|
-
case 13:
|
|
21407
|
-
throw new Error('Connection required to send message');
|
|
21408
21391
|
case 14:
|
|
21409
|
-
|
|
21410
|
-
break;
|
|
21392
|
+
throw new Error('Connection required to send message');
|
|
21411
21393
|
case 15:
|
|
21412
|
-
_context3.
|
|
21394
|
+
_context3.n = 22;
|
|
21395
|
+
break;
|
|
21396
|
+
case 16:
|
|
21397
|
+
_context3.p = 16;
|
|
21413
21398
|
_t = _context3.v;
|
|
21414
21399
|
isErrorResendable = isResendableError(_t === null || _t === void 0 ? void 0 : _t.type);
|
|
21415
21400
|
if (!(!isErrorResendable && (_channel = channel) !== null && _channel !== void 0 && _channel.id && (_messageToSend2 = messageToSend) !== null && _messageToSend2 !== void 0 && _messageToSend2.tid)) {
|
|
21416
|
-
_context3.n =
|
|
21401
|
+
_context3.n = 18;
|
|
21417
21402
|
break;
|
|
21418
21403
|
}
|
|
21419
|
-
_context3.n =
|
|
21404
|
+
_context3.n = 17;
|
|
21420
21405
|
return effects.put(removePendingMessageAC(channel.id, messageToSend.tid));
|
|
21421
|
-
case 16:
|
|
21422
|
-
_context3.n = 19;
|
|
21423
|
-
break;
|
|
21424
21406
|
case 17:
|
|
21407
|
+
_context3.n = 22;
|
|
21408
|
+
break;
|
|
21409
|
+
case 18:
|
|
21425
21410
|
if (!((_channel2 = channel) !== null && _channel2 !== void 0 && _channel2.id)) {
|
|
21426
|
-
_context3.n =
|
|
21411
|
+
_context3.n = 22;
|
|
21427
21412
|
break;
|
|
21428
21413
|
}
|
|
21429
21414
|
log.error('Error on uploading attachment', messageToSend.tid, _t);
|
|
21430
|
-
if (!(messageToSend.attachments &&
|
|
21431
|
-
_context3.n =
|
|
21415
|
+
if (!((_messageToSend$attach = messageToSend.attachments) !== null && _messageToSend$attach !== void 0 && _messageToSend$attach.length)) {
|
|
21416
|
+
_context3.n = 21;
|
|
21432
21417
|
break;
|
|
21433
21418
|
}
|
|
21434
|
-
|
|
21435
|
-
|
|
21436
|
-
|
|
21419
|
+
_iterator = _createForOfIteratorHelperLoose(messageToSend.attachments);
|
|
21420
|
+
case 19:
|
|
21421
|
+
if ((_step = _iterator()).done) {
|
|
21422
|
+
_context3.n = 21;
|
|
21423
|
+
break;
|
|
21424
|
+
}
|
|
21425
|
+
att = _step.value;
|
|
21426
|
+
if (!att.tid) {
|
|
21427
|
+
_context3.n = 20;
|
|
21428
|
+
break;
|
|
21429
|
+
}
|
|
21430
|
+
_context3.n = 20;
|
|
21431
|
+
return effects.put(updateAttachmentUploadingStateAC(UPLOAD_STATE.FAIL, att.tid));
|
|
21432
|
+
case 20:
|
|
21433
|
+
_context3.n = 19;
|
|
21434
|
+
break;
|
|
21435
|
+
case 21:
|
|
21437
21436
|
updateMessageOnMap(channel.id, {
|
|
21438
21437
|
messageId: messageToSend.tid,
|
|
21439
21438
|
params: {
|
|
@@ -21443,14 +21442,14 @@ function sendMessage(action) {
|
|
|
21443
21442
|
updateMessageOnAllMessages(messageToSend.tid, {
|
|
21444
21443
|
state: MESSAGE_STATUS.FAILED
|
|
21445
21444
|
});
|
|
21446
|
-
_context3.n =
|
|
21445
|
+
_context3.n = 22;
|
|
21447
21446
|
return effects.put(updateMessageAC(messageToSend.tid, {
|
|
21448
21447
|
state: MESSAGE_STATUS.FAILED
|
|
21449
21448
|
}));
|
|
21450
|
-
case
|
|
21449
|
+
case 22:
|
|
21451
21450
|
return _context3.a(2);
|
|
21452
21451
|
}
|
|
21453
|
-
}, _callee3, null, [[
|
|
21452
|
+
}, _callee3, null, [[2, 16]]);
|
|
21454
21453
|
});
|
|
21455
21454
|
_i = 0;
|
|
21456
21455
|
case 14:
|
|
@@ -21551,7 +21550,8 @@ function sendTextMessage(action) {
|
|
|
21551
21550
|
}
|
|
21552
21551
|
createdMessage = action.type === RESEND_MESSAGE ? action.payload.message : messageBuilder.create();
|
|
21553
21552
|
messageToSend = _extends({}, createdMessage, action.type === RESEND_MESSAGE ? {
|
|
21554
|
-
attachments: message === null || message === void 0 ? void 0 : message.attachments
|
|
21553
|
+
attachments: message === null || message === void 0 ? void 0 : message.attachments,
|
|
21554
|
+
state: MESSAGE_STATUS.UNMODIFIED
|
|
21555
21555
|
} : {});
|
|
21556
21556
|
pendingMessage = _extends({}, messageToSend, {
|
|
21557
21557
|
createdAt: new Date(Date.now()),
|
|
@@ -22113,7 +22113,7 @@ function editMessage(action) {
|
|
|
22113
22113
|
}, _marked6$1, null, [[0, 5]]);
|
|
22114
22114
|
}
|
|
22115
22115
|
var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee4(connectionState) {
|
|
22116
|
-
var pendingMessagesMap, channelId,
|
|
22116
|
+
var pendingMessagesMap, channelId, _iterator2, _step2, _msg$attachments, msg, attachments, pendingPollActionsMap, _t7, _t8, _t9;
|
|
22117
22117
|
return _regenerator().w(function (_context0) {
|
|
22118
22118
|
while (1) switch (_context0.p = _context0.n) {
|
|
22119
22119
|
case 0:
|
|
@@ -22125,13 +22125,13 @@ var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee4(connec
|
|
|
22125
22125
|
break;
|
|
22126
22126
|
}
|
|
22127
22127
|
channelId = _t8.value;
|
|
22128
|
-
|
|
22128
|
+
_iterator2 = _createForOfIteratorHelperLoose(pendingMessagesMap[channelId]);
|
|
22129
22129
|
case 2:
|
|
22130
|
-
if ((
|
|
22130
|
+
if ((_step2 = _iterator2()).done) {
|
|
22131
22131
|
_context0.n = 11;
|
|
22132
22132
|
break;
|
|
22133
22133
|
}
|
|
22134
|
-
msg =
|
|
22134
|
+
msg = _step2.value;
|
|
22135
22135
|
attachments = msg === null || msg === void 0 ? void 0 : (_msg$attachments = msg.attachments) === null || _msg$attachments === void 0 ? void 0 : _msg$attachments.filter(function (att) {
|
|
22136
22136
|
return (att === null || att === void 0 ? void 0 : att.type) !== attachmentTypes.link;
|
|
22137
22137
|
});
|
|
@@ -23762,7 +23762,7 @@ function resumeAttachmentUploading(action) {
|
|
|
23762
23762
|
}, _marked18$1, null, [[0, 2]]);
|
|
23763
23763
|
}
|
|
23764
23764
|
function getMessageMarkers(action) {
|
|
23765
|
-
var _action$payload6, messageId, channelId, deliveryStatuses, sceytChatClient, deliveryStatusesArray, messageMarkers,
|
|
23765
|
+
var _action$payload6, messageId, channelId, deliveryStatuses, sceytChatClient, deliveryStatusesArray, messageMarkers, _iterator3, _step3, deliveryStatus, messageMarkerListQueryBuilder, messageMarkerListQuery, messageMarkersResult, _t34;
|
|
23766
23766
|
return _regenerator().w(function (_context25) {
|
|
23767
23767
|
while (1) switch (_context25.p = _context25.n) {
|
|
23768
23768
|
case 0:
|
|
@@ -23778,13 +23778,13 @@ function getMessageMarkers(action) {
|
|
|
23778
23778
|
}
|
|
23779
23779
|
deliveryStatusesArray = deliveryStatuses.split(',');
|
|
23780
23780
|
messageMarkers = {};
|
|
23781
|
-
|
|
23781
|
+
_iterator3 = _createForOfIteratorHelperLoose(deliveryStatusesArray);
|
|
23782
23782
|
case 2:
|
|
23783
|
-
if ((
|
|
23783
|
+
if ((_step3 = _iterator3()).done) {
|
|
23784
23784
|
_context25.n = 6;
|
|
23785
23785
|
break;
|
|
23786
23786
|
}
|
|
23787
|
-
deliveryStatus =
|
|
23787
|
+
deliveryStatus = _step3.value;
|
|
23788
23788
|
messageMarkerListQueryBuilder = new sceytChatClient.MessageMarkerListQueryBuilder(channelId, String(messageId), deliveryStatus);
|
|
23789
23789
|
_context25.n = 3;
|
|
23790
23790
|
return effects.call(messageMarkerListQueryBuilder.build);
|
|
@@ -24286,7 +24286,7 @@ function closePoll(action) {
|
|
|
24286
24286
|
}, _marked28$1, null, [[0, 4]]);
|
|
24287
24287
|
}
|
|
24288
24288
|
function executeRetractPollVote(channelId, pollId, message, objs, isResend) {
|
|
24289
|
-
var channel,
|
|
24289
|
+
var channel, _iterator4, _step4, obj;
|
|
24290
24290
|
return _regenerator().w(function (_context35) {
|
|
24291
24291
|
while (1) switch (_context35.n) {
|
|
24292
24292
|
case 0:
|
|
@@ -24298,13 +24298,13 @@ function executeRetractPollVote(channelId, pollId, message, objs, isResend) {
|
|
|
24298
24298
|
_context35.n = 4;
|
|
24299
24299
|
break;
|
|
24300
24300
|
}
|
|
24301
|
-
|
|
24301
|
+
_iterator4 = _createForOfIteratorHelperLoose(objs);
|
|
24302
24302
|
case 2:
|
|
24303
|
-
if ((
|
|
24303
|
+
if ((_step4 = _iterator4()).done) {
|
|
24304
24304
|
_context35.n = 4;
|
|
24305
24305
|
break;
|
|
24306
24306
|
}
|
|
24307
|
-
obj =
|
|
24307
|
+
obj = _step4.value;
|
|
24308
24308
|
updateMessageOnMap(channelId, {
|
|
24309
24309
|
messageId: message.id,
|
|
24310
24310
|
params: {}
|
|
@@ -24331,7 +24331,7 @@ function executeRetractPollVote(channelId, pollId, message, objs, isResend) {
|
|
|
24331
24331
|
}, _marked29$1);
|
|
24332
24332
|
}
|
|
24333
24333
|
function updateMessageOptimisticallyForRetractPollVote(channelId, message, objs) {
|
|
24334
|
-
var channel,
|
|
24334
|
+
var channel, _iterator5, _step5, obj;
|
|
24335
24335
|
return _regenerator().w(function (_context36) {
|
|
24336
24336
|
while (1) switch (_context36.n) {
|
|
24337
24337
|
case 0:
|
|
@@ -24345,13 +24345,13 @@ function updateMessageOptimisticallyForRetractPollVote(channelId, message, objs)
|
|
|
24345
24345
|
}
|
|
24346
24346
|
return _context36.a(2);
|
|
24347
24347
|
case 2:
|
|
24348
|
-
|
|
24348
|
+
_iterator5 = _createForOfIteratorHelperLoose(objs);
|
|
24349
24349
|
case 3:
|
|
24350
|
-
if ((
|
|
24350
|
+
if ((_step5 = _iterator5()).done) {
|
|
24351
24351
|
_context36.n = 5;
|
|
24352
24352
|
break;
|
|
24353
24353
|
}
|
|
24354
|
-
obj =
|
|
24354
|
+
obj = _step5.value;
|
|
24355
24355
|
updateMessageOnMap(channelId, {
|
|
24356
24356
|
messageId: message.id,
|
|
24357
24357
|
params: {}
|
|
@@ -24368,7 +24368,7 @@ function updateMessageOptimisticallyForRetractPollVote(channelId, message, objs)
|
|
|
24368
24368
|
}, _marked30$1);
|
|
24369
24369
|
}
|
|
24370
24370
|
function retractPollVote(action) {
|
|
24371
|
-
var payload, channelId, pollId, message, isResend, sceytChatClient, connectionState, objs,
|
|
24371
|
+
var payload, channelId, pollId, message, isResend, sceytChatClient, connectionState, objs, _iterator6, _step6, _message$pollDetails12, _message$pollDetails13, vote, _t38;
|
|
24372
24372
|
return _regenerator().w(function (_context37) {
|
|
24373
24373
|
while (1) switch (_context37.p = _context37.n) {
|
|
24374
24374
|
case 0:
|
|
@@ -24382,8 +24382,8 @@ function retractPollVote(action) {
|
|
|
24382
24382
|
}
|
|
24383
24383
|
connectionState = sceytChatClient.connectionState;
|
|
24384
24384
|
objs = [];
|
|
24385
|
-
for (
|
|
24386
|
-
vote =
|
|
24385
|
+
for (_iterator6 = _createForOfIteratorHelperLoose(((_message$pollDetails12 = message.pollDetails) === null || _message$pollDetails12 === void 0 ? void 0 : (_message$pollDetails13 = _message$pollDetails12.voteDetails) === null || _message$pollDetails13 === void 0 ? void 0 : _message$pollDetails13.ownVotes) || []); !(_step6 = _iterator6()).done;) {
|
|
24386
|
+
vote = _step6.value;
|
|
24387
24387
|
objs.push({
|
|
24388
24388
|
type: 'deleteOwn',
|
|
24389
24389
|
vote: vote
|
|
@@ -31743,6 +31743,7 @@ var VideoPlayer = function VideoPlayer(_ref) {
|
|
|
31743
31743
|
if (!isLoaded) return;
|
|
31744
31744
|
if (!videoRef.current) return;
|
|
31745
31745
|
if (!readyToPlay) return;
|
|
31746
|
+
if (activeFileId !== videoFileId) return;
|
|
31746
31747
|
videoRef.current.play().then(function () {
|
|
31747
31748
|
return setPlaying(true);
|
|
31748
31749
|
})["catch"](function () {
|
|
@@ -46275,289 +46276,205 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
46275
46276
|
var customUploader = getCustomUploader();
|
|
46276
46277
|
var fileType = file.type.split('/')[0];
|
|
46277
46278
|
var tid = uuid.v4();
|
|
46278
|
-
var cachedUrl;
|
|
46279
46279
|
var reader = new FileReader();
|
|
46280
46280
|
reader.onload = function () {
|
|
46281
46281
|
try {
|
|
46282
|
-
|
|
46283
|
-
|
|
46284
|
-
|
|
46285
|
-
|
|
46286
|
-
|
|
46287
|
-
|
|
46288
|
-
|
|
46289
|
-
|
|
46290
|
-
|
|
46291
|
-
|
|
46292
|
-
|
|
46293
|
-
|
|
46294
|
-
|
|
46295
|
-
|
|
46296
|
-
|
|
46297
|
-
|
|
46298
|
-
|
|
46299
|
-
|
|
46300
|
-
|
|
46301
|
-
|
|
46302
|
-
|
|
46303
|
-
|
|
46304
|
-
|
|
46305
|
-
|
|
46306
|
-
|
|
46307
|
-
|
|
46308
|
-
|
|
46309
|
-
|
|
46310
|
-
|
|
46311
|
-
|
|
46312
|
-
|
|
46313
|
-
|
|
46314
|
-
|
|
46315
|
-
|
|
46316
|
-
|
|
46317
|
-
|
|
46318
|
-
|
|
46319
|
-
|
|
46320
|
-
|
|
46321
|
-
|
|
46322
|
-
|
|
46323
|
-
|
|
46324
|
-
|
|
46325
|
-
|
|
46326
|
-
|
|
46327
|
-
|
|
46328
|
-
|
|
46329
|
-
|
|
46330
|
-
|
|
46331
|
-
|
|
46332
|
-
|
|
46333
|
-
|
|
46334
|
-
|
|
46335
|
-
|
|
46282
|
+
setPendingAttachment(tid, {
|
|
46283
|
+
file: file
|
|
46284
|
+
});
|
|
46285
|
+
var _temp8 = function () {
|
|
46286
|
+
if (customUploader) {
|
|
46287
|
+
var _temp4 = function () {
|
|
46288
|
+
if (fileType === 'image') {
|
|
46289
|
+
resizeImage(file).then(function (resizedFile) {
|
|
46290
|
+
try {
|
|
46291
|
+
return Promise.resolve(createImageThumbnail(file)).then(function (_ref4) {
|
|
46292
|
+
var thumbnail = _ref4.thumbnail,
|
|
46293
|
+
imageWidth = _ref4.imageWidth,
|
|
46294
|
+
imageHeight = _ref4.imageHeight;
|
|
46295
|
+
setAttachments(function (prevState) {
|
|
46296
|
+
var _resizedFile$blob;
|
|
46297
|
+
return [].concat(prevState, [{
|
|
46298
|
+
data: file,
|
|
46299
|
+
upload: false,
|
|
46300
|
+
type: isMediaAttachment ? fileType : 'file',
|
|
46301
|
+
attachmentUrl: URL.createObjectURL(resizedFile.blob),
|
|
46302
|
+
tid: tid,
|
|
46303
|
+
size: isMediaAttachment ? resizedFile !== null && resizedFile !== void 0 && resizedFile.blob ? resizedFile === null || resizedFile === void 0 ? void 0 : (_resizedFile$blob = resizedFile.blob) === null || _resizedFile$blob === void 0 ? void 0 : _resizedFile$blob.size : file.size : file.size,
|
|
46304
|
+
metadata: {
|
|
46305
|
+
szw: imageWidth,
|
|
46306
|
+
szh: imageHeight,
|
|
46307
|
+
tmb: thumbnail
|
|
46308
|
+
}
|
|
46309
|
+
}]);
|
|
46310
|
+
});
|
|
46311
|
+
});
|
|
46312
|
+
} catch (e) {
|
|
46313
|
+
return Promise.reject(e);
|
|
46314
|
+
}
|
|
46315
|
+
});
|
|
46316
|
+
} else {
|
|
46317
|
+
var _temp9 = function () {
|
|
46318
|
+
if (fileType === 'video') {
|
|
46319
|
+
return Promise.resolve(getFrame(URL.createObjectURL(file), 0)).then(function (_ref5) {
|
|
46320
|
+
var thumb = _ref5.thumb,
|
|
46321
|
+
width = _ref5.width,
|
|
46322
|
+
height = _ref5.height,
|
|
46323
|
+
duration = _ref5.duration;
|
|
46324
|
+
setAttachments(function (prevState) {
|
|
46325
|
+
return [].concat(prevState, [{
|
|
46326
|
+
data: file,
|
|
46327
|
+
upload: false,
|
|
46328
|
+
type: isMediaAttachment ? fileType : 'file',
|
|
46329
|
+
attachmentUrl: URL.createObjectURL(file),
|
|
46330
|
+
tid: tid,
|
|
46331
|
+
size: file.size,
|
|
46332
|
+
metadata: {
|
|
46333
|
+
szw: width,
|
|
46334
|
+
szh: height,
|
|
46335
|
+
tmb: thumb,
|
|
46336
|
+
dur: duration
|
|
46337
|
+
}
|
|
46338
|
+
}]);
|
|
46339
|
+
});
|
|
46336
46340
|
});
|
|
46337
46341
|
} else {
|
|
46338
|
-
|
|
46339
|
-
|
|
46340
|
-
|
|
46341
|
-
|
|
46342
|
-
|
|
46343
|
-
|
|
46344
|
-
|
|
46345
|
-
|
|
46346
|
-
|
|
46347
|
-
|
|
46348
|
-
|
|
46349
|
-
|
|
46350
|
-
|
|
46351
|
-
|
|
46352
|
-
|
|
46353
|
-
|
|
46354
|
-
|
|
46355
|
-
|
|
46356
|
-
|
|
46357
|
-
|
|
46358
|
-
|
|
46359
|
-
|
|
46360
|
-
|
|
46361
|
-
|
|
46362
|
-
|
|
46363
|
-
|
|
46342
|
+
setAttachments(function (prevState) {
|
|
46343
|
+
return [].concat(prevState, [{
|
|
46344
|
+
data: file,
|
|
46345
|
+
upload: false,
|
|
46346
|
+
type: 'file',
|
|
46347
|
+
tid: tid,
|
|
46348
|
+
size: file.size
|
|
46349
|
+
}]);
|
|
46350
|
+
});
|
|
46351
|
+
}
|
|
46352
|
+
}();
|
|
46353
|
+
if (_temp9 && _temp9.then) return _temp9.then(function () {});
|
|
46354
|
+
}
|
|
46355
|
+
}();
|
|
46356
|
+
if (_temp4 && _temp4.then) return _temp4.then(function () {});
|
|
46357
|
+
} else {
|
|
46358
|
+
var _temp7 = function () {
|
|
46359
|
+
if (fileType === 'image') {
|
|
46360
|
+
var _temp5 = function () {
|
|
46361
|
+
if (isMediaAttachment) {
|
|
46362
|
+
return Promise.resolve(createImageThumbnail(file)).then(function (_ref6) {
|
|
46363
|
+
var thumbnail = _ref6.thumbnail,
|
|
46364
|
+
imageWidth = _ref6.imageWidth,
|
|
46365
|
+
imageHeight = _ref6.imageHeight;
|
|
46366
|
+
var metas = {
|
|
46367
|
+
thumbnail: thumbnail,
|
|
46368
|
+
imageWidth: imageWidth,
|
|
46369
|
+
imageHeight: imageHeight
|
|
46370
|
+
};
|
|
46371
|
+
if (file.type === 'image/gif') {
|
|
46364
46372
|
setAttachments(function (prevState) {
|
|
46365
46373
|
return [].concat(prevState, [{
|
|
46366
46374
|
data: file,
|
|
46367
|
-
|
|
46368
|
-
|
|
46369
|
-
type: 'file',
|
|
46375
|
+
upload: true,
|
|
46376
|
+
attachmentUrl: URL.createObjectURL(file),
|
|
46370
46377
|
tid: tid,
|
|
46371
|
-
|
|
46372
|
-
|
|
46378
|
+
type: fileType,
|
|
46379
|
+
size: file.size,
|
|
46380
|
+
metadata: JSON.stringify({
|
|
46381
|
+
tmb: metas.thumbnail,
|
|
46382
|
+
szw: metas.imageWidth,
|
|
46383
|
+
szh: metas.imageHeight
|
|
46384
|
+
})
|
|
46373
46385
|
}]);
|
|
46374
46386
|
});
|
|
46375
|
-
}
|
|
46376
|
-
|
|
46377
|
-
|
|
46378
|
-
|
|
46379
|
-
}();
|
|
46380
|
-
if (_temp4 && _temp4.then) return _temp4.then(function () {});
|
|
46381
|
-
} else {
|
|
46382
|
-
var _temp11 = function () {
|
|
46383
|
-
if (fileType === 'image') {
|
|
46384
|
-
var _temp9 = function () {
|
|
46385
|
-
if (isMediaAttachment) {
|
|
46386
|
-
var _temp6 = function _temp6() {
|
|
46387
|
-
if (file.type === 'image/gif') {
|
|
46387
|
+
} else {
|
|
46388
|
+
resizeImage(file).then(function (resizedFileData) {
|
|
46389
|
+
try {
|
|
46390
|
+
var resizedFile = new File([resizedFileData.blob], resizedFileData.file.name);
|
|
46388
46391
|
setAttachments(function (prevState) {
|
|
46389
46392
|
return [].concat(prevState, [{
|
|
46390
|
-
data:
|
|
46391
|
-
|
|
46392
|
-
|
|
46393
|
-
attachmentUrl: URL.createObjectURL(file),
|
|
46393
|
+
data: resizedFile,
|
|
46394
|
+
upload: true,
|
|
46395
|
+
attachmentUrl: URL.createObjectURL(resizedFile),
|
|
46394
46396
|
tid: tid,
|
|
46395
46397
|
type: fileType,
|
|
46396
|
-
size:
|
|
46397
|
-
metadata:
|
|
46398
|
+
size: resizedFile.size,
|
|
46399
|
+
metadata: JSON.stringify({
|
|
46398
46400
|
tmb: metas.thumbnail,
|
|
46399
|
-
szw:
|
|
46400
|
-
szh:
|
|
46401
|
+
szw: resizedFileData.newWidth,
|
|
46402
|
+
szh: resizedFileData.newHeight
|
|
46401
46403
|
})
|
|
46402
46404
|
}]);
|
|
46403
46405
|
});
|
|
46404
|
-
|
|
46405
|
-
|
|
46406
|
-
|
|
46407
|
-
return [].concat(prevState, [{
|
|
46408
|
-
data: file,
|
|
46409
|
-
cachedUrl: cachedUrl,
|
|
46410
|
-
upload: false,
|
|
46411
|
-
attachmentUrl: URL.createObjectURL(file),
|
|
46412
|
-
tid: tid,
|
|
46413
|
-
type: fileType,
|
|
46414
|
-
size: dataFromDb.size,
|
|
46415
|
-
metadata: metas
|
|
46416
|
-
}]);
|
|
46417
|
-
});
|
|
46418
|
-
} else {
|
|
46419
|
-
resizeImage(file).then(function (resizedFileData) {
|
|
46420
|
-
try {
|
|
46421
|
-
var resizedFile = new File([resizedFileData.blob], resizedFileData.file.name);
|
|
46422
|
-
setAttachments(function (prevState) {
|
|
46423
|
-
return [].concat(prevState, [{
|
|
46424
|
-
data: resizedFile,
|
|
46425
|
-
upload: true,
|
|
46426
|
-
attachmentUrl: URL.createObjectURL(resizedFile),
|
|
46427
|
-
tid: tid,
|
|
46428
|
-
type: fileType,
|
|
46429
|
-
size: resizedFile.size,
|
|
46430
|
-
metadata: JSON.stringify({
|
|
46431
|
-
tmb: metas.thumbnail,
|
|
46432
|
-
szw: resizedFileData.newWidth,
|
|
46433
|
-
szh: resizedFileData.newHeight
|
|
46434
|
-
})
|
|
46435
|
-
}]);
|
|
46436
|
-
});
|
|
46437
|
-
return Promise.resolve();
|
|
46438
|
-
} catch (e) {
|
|
46439
|
-
return Promise.reject(e);
|
|
46440
|
-
}
|
|
46441
|
-
});
|
|
46442
|
-
}
|
|
46406
|
+
return Promise.resolve();
|
|
46407
|
+
} catch (e) {
|
|
46408
|
+
return Promise.reject(e);
|
|
46443
46409
|
}
|
|
46444
|
-
};
|
|
46445
|
-
var metas = {};
|
|
46446
|
-
var _temp5 = function () {
|
|
46447
|
-
if (dataFromDb) {
|
|
46448
|
-
metas = dataFromDb.metadata;
|
|
46449
|
-
} else {
|
|
46450
|
-
return Promise.resolve(createImageThumbnail(file)).then(function (_ref6) {
|
|
46451
|
-
var thumbnail = _ref6.thumbnail,
|
|
46452
|
-
imageWidth = _ref6.imageWidth,
|
|
46453
|
-
imageHeight = _ref6.imageHeight;
|
|
46454
|
-
metas.imageHeight = imageHeight;
|
|
46455
|
-
metas.imageWidth = imageWidth;
|
|
46456
|
-
metas.thumbnail = thumbnail;
|
|
46457
|
-
});
|
|
46458
|
-
}
|
|
46459
|
-
}();
|
|
46460
|
-
return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
|
|
46461
|
-
} else {
|
|
46462
|
-
var _temp8 = function _temp8() {
|
|
46463
|
-
setAttachments(function (prevState) {
|
|
46464
|
-
return [].concat(prevState, [{
|
|
46465
|
-
data: file,
|
|
46466
|
-
type: 'file',
|
|
46467
|
-
cachedUrl: cachedUrl,
|
|
46468
|
-
upload: !cachedUrl,
|
|
46469
|
-
attachmentUrl: URL.createObjectURL(file),
|
|
46470
|
-
tid: tid,
|
|
46471
|
-
size: dataFromDb ? dataFromDb.size : file.size,
|
|
46472
|
-
metadata: dataFromDb ? _metas : JSON.stringify({
|
|
46473
|
-
tmb: _metas.thumbnail
|
|
46474
|
-
})
|
|
46475
|
-
}]);
|
|
46476
|
-
});
|
|
46477
|
-
};
|
|
46478
|
-
var _metas = {};
|
|
46479
|
-
var _temp7 = function () {
|
|
46480
|
-
if (dataFromDb) {
|
|
46481
|
-
_metas = dataFromDb.metadata;
|
|
46482
|
-
} else {
|
|
46483
|
-
return Promise.resolve(createImageThumbnail(file, undefined, 50, 50)).then(function (_ref7) {
|
|
46484
|
-
var thumbnail = _ref7.thumbnail;
|
|
46485
|
-
_metas.thumbnail = thumbnail;
|
|
46486
|
-
});
|
|
46487
|
-
}
|
|
46488
|
-
}();
|
|
46489
|
-
return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7);
|
|
46490
|
-
}
|
|
46491
|
-
}();
|
|
46492
|
-
if (_temp9 && _temp9.then) return _temp9.then(function () {});
|
|
46493
|
-
} else {
|
|
46494
|
-
var _temp16 = function () {
|
|
46495
|
-
if (fileType === 'video') {
|
|
46496
|
-
var _temp1 = function _temp1() {
|
|
46497
|
-
setAttachments(function (prevState) {
|
|
46498
|
-
return [].concat(prevState, [{
|
|
46499
|
-
data: file,
|
|
46500
|
-
type: 'video',
|
|
46501
|
-
cachedUrl: cachedUrl,
|
|
46502
|
-
upload: !cachedUrl,
|
|
46503
|
-
size: dataFromDb ? dataFromDb.size : file.size,
|
|
46504
|
-
attachmentUrl: URL.createObjectURL(file),
|
|
46505
|
-
tid: tid,
|
|
46506
|
-
metadata: metas
|
|
46507
|
-
}]);
|
|
46508
|
-
});
|
|
46509
|
-
};
|
|
46510
|
-
var metas = {};
|
|
46511
|
-
var _temp0 = function () {
|
|
46512
|
-
if (dataFromDb) {
|
|
46513
|
-
metas = dataFromDb.metadata;
|
|
46514
|
-
} else {
|
|
46515
|
-
return Promise.resolve(getFrame(URL.createObjectURL(file), 0)).then(function (_ref8) {
|
|
46516
|
-
var thumb = _ref8.thumb,
|
|
46517
|
-
width = _ref8.width,
|
|
46518
|
-
height = _ref8.height,
|
|
46519
|
-
duration = _ref8.duration;
|
|
46520
|
-
metas.tmb = thumb;
|
|
46521
|
-
metas.width = width;
|
|
46522
|
-
metas.height = height;
|
|
46523
|
-
metas.dur = duration;
|
|
46524
|
-
metas = JSON.stringify(metas);
|
|
46525
|
-
});
|
|
46526
|
-
}
|
|
46527
|
-
}();
|
|
46528
|
-
return _temp0 && _temp0.then ? _temp0.then(_temp1) : _temp1(_temp0);
|
|
46529
|
-
} else {
|
|
46530
|
-
setAttachments(function (prevState) {
|
|
46531
|
-
return [].concat(prevState, [{
|
|
46532
|
-
data: file,
|
|
46533
|
-
cachedUrl: cachedUrl,
|
|
46534
|
-
upload: !cachedUrl,
|
|
46535
|
-
type: 'file',
|
|
46536
|
-
size: dataFromDb ? dataFromDb.size : file.size,
|
|
46537
|
-
metadata: dataFromDb && dataFromDb.metadata,
|
|
46538
|
-
tid: tid
|
|
46539
|
-
}]);
|
|
46540
46410
|
});
|
|
46541
46411
|
}
|
|
46542
|
-
}
|
|
46543
|
-
|
|
46412
|
+
});
|
|
46413
|
+
} else {
|
|
46414
|
+
return Promise.resolve(createImageThumbnail(file, undefined, 50, 50)).then(function (_ref7) {
|
|
46415
|
+
var thumbnail = _ref7.thumbnail;
|
|
46416
|
+
setAttachments(function (prevState) {
|
|
46417
|
+
return [].concat(prevState, [{
|
|
46418
|
+
data: file,
|
|
46419
|
+
type: 'file',
|
|
46420
|
+
upload: true,
|
|
46421
|
+
attachmentUrl: URL.createObjectURL(file),
|
|
46422
|
+
tid: tid,
|
|
46423
|
+
size: file.size,
|
|
46424
|
+
metadata: JSON.stringify({
|
|
46425
|
+
tmb: thumbnail
|
|
46426
|
+
})
|
|
46427
|
+
}]);
|
|
46428
|
+
});
|
|
46429
|
+
});
|
|
46430
|
+
}
|
|
46431
|
+
}();
|
|
46432
|
+
if (_temp5 && _temp5.then) return _temp5.then(function () {});
|
|
46433
|
+
} else {
|
|
46434
|
+
var _temp0 = function () {
|
|
46435
|
+
if (fileType === 'video') {
|
|
46436
|
+
return Promise.resolve(getFrame(URL.createObjectURL(file), 0)).then(function (_ref8) {
|
|
46437
|
+
var thumb = _ref8.thumb,
|
|
46438
|
+
width = _ref8.width,
|
|
46439
|
+
height = _ref8.height,
|
|
46440
|
+
duration = _ref8.duration;
|
|
46441
|
+
var metas = JSON.stringify({
|
|
46442
|
+
tmb: thumb,
|
|
46443
|
+
width: width,
|
|
46444
|
+
height: height,
|
|
46445
|
+
dur: duration
|
|
46446
|
+
});
|
|
46447
|
+
setAttachments(function (prevState) {
|
|
46448
|
+
return [].concat(prevState, [{
|
|
46449
|
+
data: file,
|
|
46450
|
+
type: 'video',
|
|
46451
|
+
upload: true,
|
|
46452
|
+
size: file.size,
|
|
46453
|
+
attachmentUrl: URL.createObjectURL(file),
|
|
46454
|
+
tid: tid,
|
|
46455
|
+
metadata: metas
|
|
46456
|
+
}]);
|
|
46457
|
+
});
|
|
46458
|
+
});
|
|
46459
|
+
} else {
|
|
46460
|
+
setAttachments(function (prevState) {
|
|
46461
|
+
return [].concat(prevState, [{
|
|
46462
|
+
data: file,
|
|
46463
|
+
upload: true,
|
|
46464
|
+
type: 'file',
|
|
46465
|
+
size: file.size,
|
|
46466
|
+
tid: tid
|
|
46467
|
+
}]);
|
|
46468
|
+
});
|
|
46544
46469
|
}
|
|
46545
46470
|
}();
|
|
46546
|
-
if (
|
|
46471
|
+
if (_temp0 && _temp0.then) return _temp0.then(function () {});
|
|
46547
46472
|
}
|
|
46548
46473
|
}();
|
|
46549
|
-
if (
|
|
46474
|
+
if (_temp7 && _temp7.then) return _temp7.then(function () {});
|
|
46550
46475
|
}
|
|
46551
|
-
|
|
46552
|
-
|
|
46553
|
-
return Promise.resolve(getDataFromDB(DB_NAMES.FILES_STORAGE, DB_STORE_NAMES.ATTACHMENTS, checksumHash, 'checksum')).then(function (_getDataFromDB) {
|
|
46554
|
-
dataFromDb = _getDataFromDB;
|
|
46555
|
-
});
|
|
46556
|
-
}, function (e) {
|
|
46557
|
-
log.error('error in get data from db . . . . ', e);
|
|
46558
|
-
});
|
|
46559
|
-
return _temp13 && _temp13.then ? _temp13.then(_temp14) : _temp14(_temp13);
|
|
46560
|
-
});
|
|
46476
|
+
}();
|
|
46477
|
+
return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
|
|
46561
46478
|
} catch (e) {
|
|
46562
46479
|
return Promise.reject(e);
|
|
46563
46480
|
}
|
|
@@ -46625,14 +46542,14 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
46625
46542
|
}
|
|
46626
46543
|
}
|
|
46627
46544
|
}
|
|
46628
|
-
var
|
|
46545
|
+
var _temp1 = function () {
|
|
46629
46546
|
if (allowUpload) {
|
|
46630
46547
|
return Promise.resolve(handleAddAttachmentWithViewOnceCheck(file, isMediaAttachment)).then(function () {});
|
|
46631
46548
|
} else {
|
|
46632
46549
|
showFileUploadError(errorMessage);
|
|
46633
46550
|
}
|
|
46634
46551
|
}();
|
|
46635
|
-
return Promise.resolve(
|
|
46552
|
+
return Promise.resolve(_temp1 && _temp1.then ? _temp1.then(function () {}) : void 0);
|
|
46636
46553
|
} catch (e) {
|
|
46637
46554
|
return Promise.reject(e);
|
|
46638
46555
|
}
|
|
@@ -46646,48 +46563,36 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
46646
46563
|
var reader = new FileReader();
|
|
46647
46564
|
reader.onload = function () {
|
|
46648
46565
|
try {
|
|
46649
|
-
|
|
46650
|
-
|
|
46651
|
-
if (length > 3000) {
|
|
46652
|
-
var firstPart = reader.result && reader.result.slice(0, 1000);
|
|
46653
|
-
var middlePart = reader.result && reader.result.slice(length / 2 - 500, length / 2 + 500);
|
|
46654
|
-
var lastPart = reader.result && reader.result.slice(length - 1000, length);
|
|
46655
|
-
fileChecksum = "" + firstPart + middlePart + lastPart;
|
|
46656
|
-
} else {
|
|
46657
|
-
fileChecksum = "" + reader.result;
|
|
46658
|
-
}
|
|
46659
|
-
return Promise.resolve(hashString(fileChecksum || '')).then(function (checksumHash) {
|
|
46660
|
-
setPendingAttachment(tid, {
|
|
46661
|
-
file: recordedFile,
|
|
46662
|
-
checksum: checksumHash
|
|
46663
|
-
});
|
|
46664
|
-
var messageToSend = {
|
|
46665
|
-
metadata: '',
|
|
46666
|
-
body: '',
|
|
46667
|
-
mentionedUsers: [],
|
|
46668
|
-
attachments: [{
|
|
46669
|
-
name: uuid.v4() + ".mp3",
|
|
46670
|
-
data: recordedFile.file,
|
|
46671
|
-
tid: tid,
|
|
46672
|
-
upload: true,
|
|
46673
|
-
size: recordedFile.file.size,
|
|
46674
|
-
attachmentUrl: recordedFile.objectUrl,
|
|
46675
|
-
metadata: JSON.stringify({
|
|
46676
|
-
tmb: recordedFile.thumb,
|
|
46677
|
-
dur: recordedFile.dur
|
|
46678
|
-
}),
|
|
46679
|
-
type: attachmentTypes.voice
|
|
46680
|
-
}],
|
|
46681
|
-
type: 'text',
|
|
46682
|
-
viewOnce: viewOnce || false,
|
|
46683
|
-
parentMessage: messageForReply || null
|
|
46684
|
-
};
|
|
46685
|
-
var sendAttachmentsAsSeparateMessage = getSendAttachmentsAsSeparateMessages();
|
|
46686
|
-
dispatch(sendMessageAC(messageToSend, id, connectionStatus, connectionStatus, sendAttachmentsAsSeparateMessage));
|
|
46687
|
-
setViewOnce(false);
|
|
46688
|
-
setAttachments([]);
|
|
46689
|
-
handleCloseReply();
|
|
46566
|
+
setPendingAttachment(tid, {
|
|
46567
|
+
file: recordedFile
|
|
46690
46568
|
});
|
|
46569
|
+
var messageToSend = {
|
|
46570
|
+
metadata: '',
|
|
46571
|
+
body: '',
|
|
46572
|
+
mentionedUsers: [],
|
|
46573
|
+
attachments: [{
|
|
46574
|
+
name: uuid.v4() + ".mp3",
|
|
46575
|
+
data: recordedFile.file,
|
|
46576
|
+
tid: tid,
|
|
46577
|
+
upload: true,
|
|
46578
|
+
size: recordedFile.file.size,
|
|
46579
|
+
attachmentUrl: recordedFile.objectUrl,
|
|
46580
|
+
metadata: JSON.stringify({
|
|
46581
|
+
tmb: recordedFile.thumb,
|
|
46582
|
+
dur: recordedFile.dur
|
|
46583
|
+
}),
|
|
46584
|
+
type: attachmentTypes.voice
|
|
46585
|
+
}],
|
|
46586
|
+
type: 'text',
|
|
46587
|
+
viewOnce: viewOnce || false,
|
|
46588
|
+
parentMessage: messageForReply || null
|
|
46589
|
+
};
|
|
46590
|
+
var sendAttachmentsAsSeparateMessage = getSendAttachmentsAsSeparateMessages();
|
|
46591
|
+
dispatch(sendMessageAC(messageToSend, id, connectionStatus, connectionStatus, sendAttachmentsAsSeparateMessage));
|
|
46592
|
+
setViewOnce(false);
|
|
46593
|
+
setAttachments([]);
|
|
46594
|
+
handleCloseReply();
|
|
46595
|
+
return Promise.resolve();
|
|
46691
46596
|
} catch (e) {
|
|
46692
46597
|
return Promise.reject(e);
|
|
46693
46598
|
}
|
|
@@ -46840,10 +46745,10 @@ var SendMessageInput = function SendMessageInput(_ref3) {
|
|
|
46840
46745
|
var windowHeight = window.innerHeight;
|
|
46841
46746
|
var _emojiBtnRef$current$ = emojiBtnRef.current.getBoundingClientRect(),
|
|
46842
46747
|
left = _emojiBtnRef$current$.left,
|
|
46843
|
-
|
|
46748
|
+
width = _emojiBtnRef$current$.width,
|
|
46844
46749
|
top = _emojiBtnRef$current$.top;
|
|
46845
46750
|
setEmojisPopupBottomPosition(windowHeight - top);
|
|
46846
|
-
setEmojisPopupLeftPosition(left -
|
|
46751
|
+
setEmojisPopupLeftPosition(left - width / 2);
|
|
46847
46752
|
if (emojiBtnRef.current.getBoundingClientRect().left > messageInputRef.current.getBoundingClientRect().left) {
|
|
46848
46753
|
setEmojisInRightSide(true);
|
|
46849
46754
|
}
|