podchat-browser 12.8.2-snapshot.0 → 12.8.2-snapshot.2
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/dist/node/chat.js +131 -8
- package/dist/podchat-browser-bundle.js +131 -8
- package/package.json +1 -1
- package/src/chat.js +196 -120
package/dist/node/chat.js
CHANGED
|
@@ -279,10 +279,10 @@ sendMessageCallbacksHandler(_constants.chatMessageVOTypes.DELIVERY,threadId,uniq
|
|
|
279
279
|
*/case _constants.chatMessageVOTypes.GET_CONTACTS:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent,contentCount));}break;/**
|
|
280
280
|
* Type 14 Get Threads List
|
|
281
281
|
*/case _constants.chatMessageVOTypes.GET_THREADS:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent,contentCount,uniqueId));}break;/**
|
|
282
|
-
* Type 15 Get Message History of
|
|
282
|
+
* Type 15 Get Message History of a Thread
|
|
283
283
|
*/case _constants.chatMessageVOTypes.GET_HISTORY:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent,contentCount));}break;/**
|
|
284
284
|
* Type 17 Remove sb from thread
|
|
285
|
-
*/case _constants.chatMessageVOTypes.REMOVED_FROM_THREAD:_events.chatEvents.fireEvent('threadEvents',{type:'THREAD_REMOVED_FROM',result:{thread:threadId}});/**
|
|
285
|
+
*/case _constants.chatMessageVOTypes.REMOVED_FROM_THREAD:var threadThatImRemovedFrom=_store.store.threads.get(threadId);if(threadThatImRemovedFrom)_store.store.threads.remove(threadId);_events.chatEvents.fireEvent('threadEvents',{type:'THREAD_REMOVED_FROM',result:{thread:threadId}});/**
|
|
286
286
|
* This user has been removed from a thread
|
|
287
287
|
* So we should delete thread, its participants
|
|
288
288
|
* and it's messages from this users cache
|
|
@@ -296,13 +296,94 @@ sendMessageCallbacksHandler(_constants.chatMessageVOTypes.DELIVERY,threadId,uniq
|
|
|
296
296
|
* this user left
|
|
297
297
|
*/db.participants.where('threadId').equals(parseInt(threadId)).and(function(participant){return participant.owner===chatMessaging.userInfo.id;})["delete"]()["catch"](function(error){_events.chatEvents.fireEvent('error',{code:error.code,message:error.message,error:error});});}else{_events.chatEvents.fireEvent('error',{code:6601,message:CHAT_ERRORS[6601],error:null});}}break;/**
|
|
298
298
|
* Type 18 Remove a participant from Thread
|
|
299
|
-
*/case _constants.chatMessageVOTypes.REMOVE_PARTICIPANT:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent,contentCount));}
|
|
299
|
+
*/case _constants.chatMessageVOTypes.REMOVE_PARTICIPANT:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent,contentCount));}var removeParticipantThread=_store.store.threads.get(threadId);if(removeParticipantThread)removeParticipantThread=removeParticipantThread.get();else removeParticipantThread=threadId;_events.chatEvents.fireEvent('threadEvents',{type:'THREAD_REMOVE_PARTICIPANTS',result:{thread:removeParticipantThread}});_events.chatEvents.fireEvent('threadEvents',{type:'THREAD_LAST_ACTIVITY_TIME',result:{thread:removeParticipantThread}});/**
|
|
300
300
|
* Remove the participant from cache
|
|
301
|
-
*/if(canUseCache){if(db){for(var i=0;i<messageContent.length;i++){db.participants.where('id').equals(parseInt(messageContent[i].id)).and(function(participants){return participants.threadId===threadId;})["delete"]()["catch"](function(error){_events.chatEvents.fireEvent('error',{code:error.code,message:error.message,error:error});});}}else{_events.chatEvents.fireEvent('error',{code:6601,message:CHAT_ERRORS[6601],error:null});}}if(fullResponseObject)
|
|
301
|
+
*/if(canUseCache){if(db){for(var i=0;i<messageContent.length;i++){db.participants.where('id').equals(parseInt(messageContent[i].id)).and(function(participants){return participants.threadId===threadId;})["delete"]()["catch"](function(error){_events.chatEvents.fireEvent('error',{code:error.code,message:error.message,error:error});});}}else{_events.chatEvents.fireEvent('error',{code:6601,message:CHAT_ERRORS[6601],error:null});}}// if (fullResponseObject) {
|
|
302
|
+
// getThreads({
|
|
303
|
+
// threadIds: [threadId]
|
|
304
|
+
// }, function (threadsResult) {
|
|
305
|
+
// var threads = threadsResult.result.threads;
|
|
306
|
+
//
|
|
307
|
+
// if (!threadsResult.cache) {
|
|
308
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
309
|
+
// type: 'THREAD_REMOVE_PARTICIPANTS',
|
|
310
|
+
// result: {
|
|
311
|
+
// thread: threads[0]
|
|
312
|
+
// }
|
|
313
|
+
// });
|
|
314
|
+
//
|
|
315
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
316
|
+
// type: 'THREAD_LAST_ACTIVITY_TIME',
|
|
317
|
+
// result: {
|
|
318
|
+
// thread: threads[0]
|
|
319
|
+
// }
|
|
320
|
+
// });
|
|
321
|
+
// }
|
|
322
|
+
// });
|
|
323
|
+
// } else {
|
|
324
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
325
|
+
// type: 'THREAD_REMOVE_PARTICIPANTS',
|
|
326
|
+
// result: {
|
|
327
|
+
// thread: threadId
|
|
328
|
+
// }
|
|
329
|
+
// });
|
|
330
|
+
//
|
|
331
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
332
|
+
// type: 'THREAD_LAST_ACTIVITY_TIME',
|
|
333
|
+
// result: {
|
|
334
|
+
// thread: threadId
|
|
335
|
+
// }
|
|
336
|
+
// });
|
|
337
|
+
// }
|
|
338
|
+
break;/**
|
|
302
339
|
* Type 19 Mute Thread
|
|
303
|
-
*/case _constants.chatMessageVOTypes.MUTE_THREAD:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}
|
|
340
|
+
*/case _constants.chatMessageVOTypes.MUTE_THREAD:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}var mutedThread=_store.store.threads.get(threadId);if(mutedThread)mutedThread=mutedThread.get();else mutedThread=threadId;_events.chatEvents.fireEvent('threadEvents',{type:'THREAD_UNMUTE',result:{thread:mutedThread}});// if (fullResponseObject) {
|
|
341
|
+
// getThreads({
|
|
342
|
+
// threadIds: [threadId]
|
|
343
|
+
// }, function (threadsResult) {
|
|
344
|
+
// var thread = threadsResult.result.threads[0];
|
|
345
|
+
// thread.mute = true;
|
|
346
|
+
//
|
|
347
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
348
|
+
// type: 'THREAD_MUTE',
|
|
349
|
+
// result: {
|
|
350
|
+
// thread: thread
|
|
351
|
+
// }
|
|
352
|
+
// });
|
|
353
|
+
// });
|
|
354
|
+
// } else {
|
|
355
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
356
|
+
// type: 'THREAD_MUTE',
|
|
357
|
+
// result: {
|
|
358
|
+
// thread: threadId
|
|
359
|
+
// }
|
|
360
|
+
// });
|
|
361
|
+
// }
|
|
362
|
+
break;/**
|
|
304
363
|
* Type 20 Unmute muted Thread
|
|
305
|
-
*/case _constants.chatMessageVOTypes.UNMUTE_THREAD:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}
|
|
364
|
+
*/case _constants.chatMessageVOTypes.UNMUTE_THREAD:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}var unmutedThread=_store.store.threads.get(threadId);if(unmutedThread)unmutedThread=unmutedThread.get();else unmutedThread=threadId;_events.chatEvents.fireEvent('threadEvents',{type:'THREAD_UNMUTE',result:{thread:unmutedThread}});// if (fullResponseObject) {
|
|
365
|
+
// getThreads({
|
|
366
|
+
// threadIds: [threadId]
|
|
367
|
+
// }, function (threadsResult) {
|
|
368
|
+
// var thread = threadsResult.result.threads[0];
|
|
369
|
+
// thread.mute = false;
|
|
370
|
+
//
|
|
371
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
372
|
+
// type: 'THREAD_UNMUTE',
|
|
373
|
+
// result: {
|
|
374
|
+
// thread: thread
|
|
375
|
+
// }
|
|
376
|
+
// });
|
|
377
|
+
// });
|
|
378
|
+
// } else {
|
|
379
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
380
|
+
// type: 'THREAD_UNMUTE',
|
|
381
|
+
// result: {
|
|
382
|
+
// thread: threadId
|
|
383
|
+
// }
|
|
384
|
+
// });
|
|
385
|
+
// }
|
|
386
|
+
break;/**
|
|
306
387
|
* Type 21 Update Thread Info
|
|
307
388
|
*/case _constants.chatMessageVOTypes.UPDATE_THREAD_INFO:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}var formattedThread=formatDataToMakeConversation(messageContent);_store.store.threads.save(formattedThread);_events.chatEvents.fireEvent('threadEvents',{type:'THREAD_INFO_UPDATED',result:{thread:_store.store.threads.get(messageContent.id).get()}});// if (fullResponseObject) {
|
|
308
389
|
// getThreads({
|
|
@@ -496,9 +577,51 @@ break;/**
|
|
|
496
577
|
* Type 47 Get Not Seen Duration
|
|
497
578
|
*/case _constants.chatMessageVOTypes.GET_NOT_SEEN_DURATION:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}break;/**
|
|
498
579
|
* Type 48 Pin Thread
|
|
499
|
-
*/case _constants.chatMessageVOTypes.PIN_THREAD:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}
|
|
580
|
+
*/case _constants.chatMessageVOTypes.PIN_THREAD:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}var pinnedThread=_store.store.threads.get(threadId);if(pinnedThread)pinnedThread=pinnedThread.get();else pinnedThread=threadId;_events.chatEvents.fireEvent('threadEvents',{type:'THREAD_PIN',result:{thread:pinnedThread}});// if (fullResponseObject) {
|
|
581
|
+
// getThreads({
|
|
582
|
+
// threadIds: [threadId]
|
|
583
|
+
// }, function (threadsResult) {
|
|
584
|
+
// var thread = threadsResult.result.threads[0];
|
|
585
|
+
//
|
|
586
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
587
|
+
// type: 'THREAD_PIN',
|
|
588
|
+
// result: {
|
|
589
|
+
// thread: thread
|
|
590
|
+
// }
|
|
591
|
+
// });
|
|
592
|
+
// });
|
|
593
|
+
// } else {
|
|
594
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
595
|
+
// type: 'THREAD_PIN',
|
|
596
|
+
// result: {
|
|
597
|
+
// thread: threadId
|
|
598
|
+
// }
|
|
599
|
+
// });
|
|
600
|
+
// }
|
|
601
|
+
break;/**
|
|
500
602
|
* Type 49 UnPin Thread
|
|
501
|
-
*/case _constants.chatMessageVOTypes.UNPIN_THREAD:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}
|
|
603
|
+
*/case _constants.chatMessageVOTypes.UNPIN_THREAD:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}var unPinnedThread=_store.store.threads.get(threadId);if(unPinnedThread)unPinnedThread=unPinnedThread.get();else unPinnedThread=threadId;_events.chatEvents.fireEvent('threadEvents',{type:'THREAD_UNPIN',result:{thread:unPinnedThread}});// if (fullResponseObject) {
|
|
604
|
+
// getThreads({
|
|
605
|
+
// threadIds: [threadId]
|
|
606
|
+
// }, function (threadsResult) {
|
|
607
|
+
// var thread = threadsResult.result.threads[0];
|
|
608
|
+
//
|
|
609
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
610
|
+
// type: 'THREAD_UNPIN',
|
|
611
|
+
// result: {
|
|
612
|
+
// thread: thread
|
|
613
|
+
// }
|
|
614
|
+
// });
|
|
615
|
+
// });
|
|
616
|
+
// } else {
|
|
617
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
618
|
+
// type: 'THREAD_UNPIN',
|
|
619
|
+
// result: {
|
|
620
|
+
// thread: threadId
|
|
621
|
+
// }
|
|
622
|
+
// });
|
|
623
|
+
// }
|
|
624
|
+
break;/**
|
|
502
625
|
* Type 50 Pin Message
|
|
503
626
|
*/case _constants.chatMessageVOTypes.PIN_MESSAGE:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}_events.chatEvents.fireEvent('threadEvents',{type:'MESSAGE_PIN',result:{thread:threadId,pinMessage:formatDataToMakePinMessage(threadId,messageContent)}});break;/**
|
|
504
627
|
* Type 51 UnPin Message
|
|
@@ -46367,10 +46367,10 @@ sendMessageCallbacksHandler(_constants.chatMessageVOTypes.DELIVERY,threadId,uniq
|
|
|
46367
46367
|
*/case _constants.chatMessageVOTypes.GET_CONTACTS:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent,contentCount));}break;/**
|
|
46368
46368
|
* Type 14 Get Threads List
|
|
46369
46369
|
*/case _constants.chatMessageVOTypes.GET_THREADS:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent,contentCount,uniqueId));}break;/**
|
|
46370
|
-
* Type 15 Get Message History of
|
|
46370
|
+
* Type 15 Get Message History of a Thread
|
|
46371
46371
|
*/case _constants.chatMessageVOTypes.GET_HISTORY:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent,contentCount));}break;/**
|
|
46372
46372
|
* Type 17 Remove sb from thread
|
|
46373
|
-
*/case _constants.chatMessageVOTypes.REMOVED_FROM_THREAD:_events.chatEvents.fireEvent('threadEvents',{type:'THREAD_REMOVED_FROM',result:{thread:threadId}});/**
|
|
46373
|
+
*/case _constants.chatMessageVOTypes.REMOVED_FROM_THREAD:var threadThatImRemovedFrom=_store.store.threads.get(threadId);if(threadThatImRemovedFrom)_store.store.threads.remove(threadId);_events.chatEvents.fireEvent('threadEvents',{type:'THREAD_REMOVED_FROM',result:{thread:threadId}});/**
|
|
46374
46374
|
* This user has been removed from a thread
|
|
46375
46375
|
* So we should delete thread, its participants
|
|
46376
46376
|
* and it's messages from this users cache
|
|
@@ -46384,13 +46384,94 @@ sendMessageCallbacksHandler(_constants.chatMessageVOTypes.DELIVERY,threadId,uniq
|
|
|
46384
46384
|
* this user left
|
|
46385
46385
|
*/db.participants.where('threadId').equals(parseInt(threadId)).and(function(participant){return participant.owner===chatMessaging.userInfo.id;})["delete"]()["catch"](function(error){_events.chatEvents.fireEvent('error',{code:error.code,message:error.message,error:error});});}else{_events.chatEvents.fireEvent('error',{code:6601,message:CHAT_ERRORS[6601],error:null});}}break;/**
|
|
46386
46386
|
* Type 18 Remove a participant from Thread
|
|
46387
|
-
*/case _constants.chatMessageVOTypes.REMOVE_PARTICIPANT:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent,contentCount));}
|
|
46387
|
+
*/case _constants.chatMessageVOTypes.REMOVE_PARTICIPANT:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent,contentCount));}var removeParticipantThread=_store.store.threads.get(threadId);if(removeParticipantThread)removeParticipantThread=removeParticipantThread.get();else removeParticipantThread=threadId;_events.chatEvents.fireEvent('threadEvents',{type:'THREAD_REMOVE_PARTICIPANTS',result:{thread:removeParticipantThread}});_events.chatEvents.fireEvent('threadEvents',{type:'THREAD_LAST_ACTIVITY_TIME',result:{thread:removeParticipantThread}});/**
|
|
46388
46388
|
* Remove the participant from cache
|
|
46389
|
-
*/if(canUseCache){if(db){for(var i=0;i<messageContent.length;i++){db.participants.where('id').equals(parseInt(messageContent[i].id)).and(function(participants){return participants.threadId===threadId;})["delete"]()["catch"](function(error){_events.chatEvents.fireEvent('error',{code:error.code,message:error.message,error:error});});}}else{_events.chatEvents.fireEvent('error',{code:6601,message:CHAT_ERRORS[6601],error:null});}}if(fullResponseObject)
|
|
46389
|
+
*/if(canUseCache){if(db){for(var i=0;i<messageContent.length;i++){db.participants.where('id').equals(parseInt(messageContent[i].id)).and(function(participants){return participants.threadId===threadId;})["delete"]()["catch"](function(error){_events.chatEvents.fireEvent('error',{code:error.code,message:error.message,error:error});});}}else{_events.chatEvents.fireEvent('error',{code:6601,message:CHAT_ERRORS[6601],error:null});}}// if (fullResponseObject) {
|
|
46390
|
+
// getThreads({
|
|
46391
|
+
// threadIds: [threadId]
|
|
46392
|
+
// }, function (threadsResult) {
|
|
46393
|
+
// var threads = threadsResult.result.threads;
|
|
46394
|
+
//
|
|
46395
|
+
// if (!threadsResult.cache) {
|
|
46396
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
46397
|
+
// type: 'THREAD_REMOVE_PARTICIPANTS',
|
|
46398
|
+
// result: {
|
|
46399
|
+
// thread: threads[0]
|
|
46400
|
+
// }
|
|
46401
|
+
// });
|
|
46402
|
+
//
|
|
46403
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
46404
|
+
// type: 'THREAD_LAST_ACTIVITY_TIME',
|
|
46405
|
+
// result: {
|
|
46406
|
+
// thread: threads[0]
|
|
46407
|
+
// }
|
|
46408
|
+
// });
|
|
46409
|
+
// }
|
|
46410
|
+
// });
|
|
46411
|
+
// } else {
|
|
46412
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
46413
|
+
// type: 'THREAD_REMOVE_PARTICIPANTS',
|
|
46414
|
+
// result: {
|
|
46415
|
+
// thread: threadId
|
|
46416
|
+
// }
|
|
46417
|
+
// });
|
|
46418
|
+
//
|
|
46419
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
46420
|
+
// type: 'THREAD_LAST_ACTIVITY_TIME',
|
|
46421
|
+
// result: {
|
|
46422
|
+
// thread: threadId
|
|
46423
|
+
// }
|
|
46424
|
+
// });
|
|
46425
|
+
// }
|
|
46426
|
+
break;/**
|
|
46390
46427
|
* Type 19 Mute Thread
|
|
46391
|
-
*/case _constants.chatMessageVOTypes.MUTE_THREAD:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}
|
|
46428
|
+
*/case _constants.chatMessageVOTypes.MUTE_THREAD:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}var mutedThread=_store.store.threads.get(threadId);if(mutedThread)mutedThread=mutedThread.get();else mutedThread=threadId;_events.chatEvents.fireEvent('threadEvents',{type:'THREAD_UNMUTE',result:{thread:mutedThread}});// if (fullResponseObject) {
|
|
46429
|
+
// getThreads({
|
|
46430
|
+
// threadIds: [threadId]
|
|
46431
|
+
// }, function (threadsResult) {
|
|
46432
|
+
// var thread = threadsResult.result.threads[0];
|
|
46433
|
+
// thread.mute = true;
|
|
46434
|
+
//
|
|
46435
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
46436
|
+
// type: 'THREAD_MUTE',
|
|
46437
|
+
// result: {
|
|
46438
|
+
// thread: thread
|
|
46439
|
+
// }
|
|
46440
|
+
// });
|
|
46441
|
+
// });
|
|
46442
|
+
// } else {
|
|
46443
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
46444
|
+
// type: 'THREAD_MUTE',
|
|
46445
|
+
// result: {
|
|
46446
|
+
// thread: threadId
|
|
46447
|
+
// }
|
|
46448
|
+
// });
|
|
46449
|
+
// }
|
|
46450
|
+
break;/**
|
|
46392
46451
|
* Type 20 Unmute muted Thread
|
|
46393
|
-
*/case _constants.chatMessageVOTypes.UNMUTE_THREAD:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}
|
|
46452
|
+
*/case _constants.chatMessageVOTypes.UNMUTE_THREAD:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}var unmutedThread=_store.store.threads.get(threadId);if(unmutedThread)unmutedThread=unmutedThread.get();else unmutedThread=threadId;_events.chatEvents.fireEvent('threadEvents',{type:'THREAD_UNMUTE',result:{thread:unmutedThread}});// if (fullResponseObject) {
|
|
46453
|
+
// getThreads({
|
|
46454
|
+
// threadIds: [threadId]
|
|
46455
|
+
// }, function (threadsResult) {
|
|
46456
|
+
// var thread = threadsResult.result.threads[0];
|
|
46457
|
+
// thread.mute = false;
|
|
46458
|
+
//
|
|
46459
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
46460
|
+
// type: 'THREAD_UNMUTE',
|
|
46461
|
+
// result: {
|
|
46462
|
+
// thread: thread
|
|
46463
|
+
// }
|
|
46464
|
+
// });
|
|
46465
|
+
// });
|
|
46466
|
+
// } else {
|
|
46467
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
46468
|
+
// type: 'THREAD_UNMUTE',
|
|
46469
|
+
// result: {
|
|
46470
|
+
// thread: threadId
|
|
46471
|
+
// }
|
|
46472
|
+
// });
|
|
46473
|
+
// }
|
|
46474
|
+
break;/**
|
|
46394
46475
|
* Type 21 Update Thread Info
|
|
46395
46476
|
*/case _constants.chatMessageVOTypes.UPDATE_THREAD_INFO:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}var formattedThread=formatDataToMakeConversation(messageContent);_store.store.threads.save(formattedThread);_events.chatEvents.fireEvent('threadEvents',{type:'THREAD_INFO_UPDATED',result:{thread:_store.store.threads.get(messageContent.id).get()}});// if (fullResponseObject) {
|
|
46396
46477
|
// getThreads({
|
|
@@ -46584,9 +46665,51 @@ break;/**
|
|
|
46584
46665
|
* Type 47 Get Not Seen Duration
|
|
46585
46666
|
*/case _constants.chatMessageVOTypes.GET_NOT_SEEN_DURATION:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}break;/**
|
|
46586
46667
|
* Type 48 Pin Thread
|
|
46587
|
-
*/case _constants.chatMessageVOTypes.PIN_THREAD:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}
|
|
46668
|
+
*/case _constants.chatMessageVOTypes.PIN_THREAD:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}var pinnedThread=_store.store.threads.get(threadId);if(pinnedThread)pinnedThread=pinnedThread.get();else pinnedThread=threadId;_events.chatEvents.fireEvent('threadEvents',{type:'THREAD_PIN',result:{thread:pinnedThread}});// if (fullResponseObject) {
|
|
46669
|
+
// getThreads({
|
|
46670
|
+
// threadIds: [threadId]
|
|
46671
|
+
// }, function (threadsResult) {
|
|
46672
|
+
// var thread = threadsResult.result.threads[0];
|
|
46673
|
+
//
|
|
46674
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
46675
|
+
// type: 'THREAD_PIN',
|
|
46676
|
+
// result: {
|
|
46677
|
+
// thread: thread
|
|
46678
|
+
// }
|
|
46679
|
+
// });
|
|
46680
|
+
// });
|
|
46681
|
+
// } else {
|
|
46682
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
46683
|
+
// type: 'THREAD_PIN',
|
|
46684
|
+
// result: {
|
|
46685
|
+
// thread: threadId
|
|
46686
|
+
// }
|
|
46687
|
+
// });
|
|
46688
|
+
// }
|
|
46689
|
+
break;/**
|
|
46588
46690
|
* Type 49 UnPin Thread
|
|
46589
|
-
*/case _constants.chatMessageVOTypes.UNPIN_THREAD:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}
|
|
46691
|
+
*/case _constants.chatMessageVOTypes.UNPIN_THREAD:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}var unPinnedThread=_store.store.threads.get(threadId);if(unPinnedThread)unPinnedThread=unPinnedThread.get();else unPinnedThread=threadId;_events.chatEvents.fireEvent('threadEvents',{type:'THREAD_UNPIN',result:{thread:unPinnedThread}});// if (fullResponseObject) {
|
|
46692
|
+
// getThreads({
|
|
46693
|
+
// threadIds: [threadId]
|
|
46694
|
+
// }, function (threadsResult) {
|
|
46695
|
+
// var thread = threadsResult.result.threads[0];
|
|
46696
|
+
//
|
|
46697
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
46698
|
+
// type: 'THREAD_UNPIN',
|
|
46699
|
+
// result: {
|
|
46700
|
+
// thread: thread
|
|
46701
|
+
// }
|
|
46702
|
+
// });
|
|
46703
|
+
// });
|
|
46704
|
+
// } else {
|
|
46705
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
46706
|
+
// type: 'THREAD_UNPIN',
|
|
46707
|
+
// result: {
|
|
46708
|
+
// thread: threadId
|
|
46709
|
+
// }
|
|
46710
|
+
// });
|
|
46711
|
+
// }
|
|
46712
|
+
break;/**
|
|
46590
46713
|
* Type 50 Pin Message
|
|
46591
46714
|
*/case _constants.chatMessageVOTypes.PIN_MESSAGE:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent));}_events.chatEvents.fireEvent('threadEvents',{type:'MESSAGE_PIN',result:{thread:threadId,pinMessage:formatDataToMakePinMessage(threadId,messageContent)}});break;/**
|
|
46592
46715
|
* Type 51 UnPin Message
|
package/package.json
CHANGED
package/src/chat.js
CHANGED
|
@@ -1717,7 +1717,7 @@ function Chat(params) {
|
|
|
1717
1717
|
break;
|
|
1718
1718
|
|
|
1719
1719
|
/**
|
|
1720
|
-
* Type 15 Get Message History of
|
|
1720
|
+
* Type 15 Get Message History of a Thread
|
|
1721
1721
|
*/
|
|
1722
1722
|
case chatMessageVOTypes.GET_HISTORY:
|
|
1723
1723
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
@@ -1729,6 +1729,9 @@ function Chat(params) {
|
|
|
1729
1729
|
* Type 17 Remove sb from thread
|
|
1730
1730
|
*/
|
|
1731
1731
|
case chatMessageVOTypes.REMOVED_FROM_THREAD:
|
|
1732
|
+
let threadThatImRemovedFrom = store.threads.get(threadId);
|
|
1733
|
+
if(threadThatImRemovedFrom)
|
|
1734
|
+
store.threads.remove(threadId);
|
|
1732
1735
|
|
|
1733
1736
|
chatEvents.fireEvent('threadEvents', {
|
|
1734
1737
|
type: 'THREAD_REMOVED_FROM',
|
|
@@ -1813,6 +1816,26 @@ function Chat(params) {
|
|
|
1813
1816
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
1814
1817
|
}
|
|
1815
1818
|
|
|
1819
|
+
let removeParticipantThread = store.threads.get(threadId);
|
|
1820
|
+
if(removeParticipantThread)
|
|
1821
|
+
removeParticipantThread = removeParticipantThread.get()
|
|
1822
|
+
else
|
|
1823
|
+
removeParticipantThread = threadId;
|
|
1824
|
+
|
|
1825
|
+
chatEvents.fireEvent('threadEvents', {
|
|
1826
|
+
type: 'THREAD_REMOVE_PARTICIPANTS',
|
|
1827
|
+
result: {
|
|
1828
|
+
thread: removeParticipantThread
|
|
1829
|
+
}
|
|
1830
|
+
});
|
|
1831
|
+
|
|
1832
|
+
chatEvents.fireEvent('threadEvents', {
|
|
1833
|
+
type: 'THREAD_LAST_ACTIVITY_TIME',
|
|
1834
|
+
result: {
|
|
1835
|
+
thread: removeParticipantThread
|
|
1836
|
+
}
|
|
1837
|
+
});
|
|
1838
|
+
|
|
1816
1839
|
/**
|
|
1817
1840
|
* Remove the participant from cache
|
|
1818
1841
|
*/
|
|
@@ -1842,43 +1865,43 @@ function Chat(params) {
|
|
|
1842
1865
|
}
|
|
1843
1866
|
}
|
|
1844
1867
|
|
|
1845
|
-
if (fullResponseObject) {
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
} else {
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
}
|
|
1868
|
+
// if (fullResponseObject) {
|
|
1869
|
+
// getThreads({
|
|
1870
|
+
// threadIds: [threadId]
|
|
1871
|
+
// }, function (threadsResult) {
|
|
1872
|
+
// var threads = threadsResult.result.threads;
|
|
1873
|
+
//
|
|
1874
|
+
// if (!threadsResult.cache) {
|
|
1875
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
1876
|
+
// type: 'THREAD_REMOVE_PARTICIPANTS',
|
|
1877
|
+
// result: {
|
|
1878
|
+
// thread: threads[0]
|
|
1879
|
+
// }
|
|
1880
|
+
// });
|
|
1881
|
+
//
|
|
1882
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
1883
|
+
// type: 'THREAD_LAST_ACTIVITY_TIME',
|
|
1884
|
+
// result: {
|
|
1885
|
+
// thread: threads[0]
|
|
1886
|
+
// }
|
|
1887
|
+
// });
|
|
1888
|
+
// }
|
|
1889
|
+
// });
|
|
1890
|
+
// } else {
|
|
1891
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
1892
|
+
// type: 'THREAD_REMOVE_PARTICIPANTS',
|
|
1893
|
+
// result: {
|
|
1894
|
+
// thread: threadId
|
|
1895
|
+
// }
|
|
1896
|
+
// });
|
|
1897
|
+
//
|
|
1898
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
1899
|
+
// type: 'THREAD_LAST_ACTIVITY_TIME',
|
|
1900
|
+
// result: {
|
|
1901
|
+
// thread: threadId
|
|
1902
|
+
// }
|
|
1903
|
+
// });
|
|
1904
|
+
// }
|
|
1882
1905
|
break;
|
|
1883
1906
|
|
|
1884
1907
|
/**
|
|
@@ -1889,28 +1912,42 @@ function Chat(params) {
|
|
|
1889
1912
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent));
|
|
1890
1913
|
}
|
|
1891
1914
|
|
|
1892
|
-
if (fullResponseObject) {
|
|
1893
|
-
getThreads({
|
|
1894
|
-
threadIds: [threadId]
|
|
1895
|
-
}, function (threadsResult) {
|
|
1896
|
-
var thread = threadsResult.result.threads[0];
|
|
1897
|
-
thread.mute = true;
|
|
1898
1915
|
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1916
|
+
let mutedThread = store.threads.get(threadId);
|
|
1917
|
+
if(mutedThread)
|
|
1918
|
+
mutedThread = mutedThread.get()
|
|
1919
|
+
else
|
|
1920
|
+
mutedThread = threadId;
|
|
1921
|
+
|
|
1922
|
+
chatEvents.fireEvent('threadEvents', {
|
|
1923
|
+
type: 'THREAD_UNMUTE',
|
|
1924
|
+
result: {
|
|
1925
|
+
thread: mutedThread
|
|
1926
|
+
}
|
|
1927
|
+
});
|
|
1928
|
+
|
|
1929
|
+
// if (fullResponseObject) {
|
|
1930
|
+
// getThreads({
|
|
1931
|
+
// threadIds: [threadId]
|
|
1932
|
+
// }, function (threadsResult) {
|
|
1933
|
+
// var thread = threadsResult.result.threads[0];
|
|
1934
|
+
// thread.mute = true;
|
|
1935
|
+
//
|
|
1936
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
1937
|
+
// type: 'THREAD_MUTE',
|
|
1938
|
+
// result: {
|
|
1939
|
+
// thread: thread
|
|
1940
|
+
// }
|
|
1941
|
+
// });
|
|
1942
|
+
// });
|
|
1943
|
+
// } else {
|
|
1944
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
1945
|
+
// type: 'THREAD_MUTE',
|
|
1946
|
+
// result: {
|
|
1947
|
+
// thread: threadId
|
|
1948
|
+
// }
|
|
1949
|
+
// });
|
|
1950
|
+
// }
|
|
1914
1951
|
|
|
1915
1952
|
break;
|
|
1916
1953
|
|
|
@@ -1922,28 +1959,41 @@ function Chat(params) {
|
|
|
1922
1959
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent));
|
|
1923
1960
|
}
|
|
1924
1961
|
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
thread.mute = false;
|
|
1962
|
+
let unmutedThread = store.threads.get(threadId);
|
|
1963
|
+
if(unmutedThread)
|
|
1964
|
+
unmutedThread = unmutedThread.get()
|
|
1965
|
+
else
|
|
1966
|
+
unmutedThread = threadId;
|
|
1931
1967
|
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1968
|
+
chatEvents.fireEvent('threadEvents', {
|
|
1969
|
+
type: 'THREAD_UNMUTE',
|
|
1970
|
+
result: {
|
|
1971
|
+
thread: unmutedThread
|
|
1972
|
+
}
|
|
1973
|
+
});
|
|
1974
|
+
|
|
1975
|
+
// if (fullResponseObject) {
|
|
1976
|
+
// getThreads({
|
|
1977
|
+
// threadIds: [threadId]
|
|
1978
|
+
// }, function (threadsResult) {
|
|
1979
|
+
// var thread = threadsResult.result.threads[0];
|
|
1980
|
+
// thread.mute = false;
|
|
1981
|
+
//
|
|
1982
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
1983
|
+
// type: 'THREAD_UNMUTE',
|
|
1984
|
+
// result: {
|
|
1985
|
+
// thread: thread
|
|
1986
|
+
// }
|
|
1987
|
+
// });
|
|
1988
|
+
// });
|
|
1989
|
+
// } else {
|
|
1990
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
1991
|
+
// type: 'THREAD_UNMUTE',
|
|
1992
|
+
// result: {
|
|
1993
|
+
// thread: threadId
|
|
1994
|
+
// }
|
|
1995
|
+
// });
|
|
1996
|
+
// }
|
|
1947
1997
|
break;
|
|
1948
1998
|
|
|
1949
1999
|
/**
|
|
@@ -2471,27 +2521,40 @@ function Chat(params) {
|
|
|
2471
2521
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent));
|
|
2472
2522
|
}
|
|
2473
2523
|
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2524
|
+
let pinnedThread = store.threads.get(threadId);
|
|
2525
|
+
if(pinnedThread)
|
|
2526
|
+
pinnedThread = pinnedThread.get()
|
|
2527
|
+
else
|
|
2528
|
+
pinnedThread = threadId;
|
|
2479
2529
|
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2530
|
+
chatEvents.fireEvent('threadEvents', {
|
|
2531
|
+
type: 'THREAD_PIN',
|
|
2532
|
+
result: {
|
|
2533
|
+
thread: pinnedThread
|
|
2534
|
+
}
|
|
2535
|
+
});
|
|
2536
|
+
|
|
2537
|
+
// if (fullResponseObject) {
|
|
2538
|
+
// getThreads({
|
|
2539
|
+
// threadIds: [threadId]
|
|
2540
|
+
// }, function (threadsResult) {
|
|
2541
|
+
// var thread = threadsResult.result.threads[0];
|
|
2542
|
+
//
|
|
2543
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
2544
|
+
// type: 'THREAD_PIN',
|
|
2545
|
+
// result: {
|
|
2546
|
+
// thread: thread
|
|
2547
|
+
// }
|
|
2548
|
+
// });
|
|
2549
|
+
// });
|
|
2550
|
+
// } else {
|
|
2551
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
2552
|
+
// type: 'THREAD_PIN',
|
|
2553
|
+
// result: {
|
|
2554
|
+
// thread: threadId
|
|
2555
|
+
// }
|
|
2556
|
+
// });
|
|
2557
|
+
// }
|
|
2495
2558
|
|
|
2496
2559
|
break;
|
|
2497
2560
|
|
|
@@ -2503,27 +2566,40 @@ function Chat(params) {
|
|
|
2503
2566
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent));
|
|
2504
2567
|
}
|
|
2505
2568
|
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2569
|
+
let unPinnedThread = store.threads.get(threadId);
|
|
2570
|
+
if(unPinnedThread)
|
|
2571
|
+
unPinnedThread = unPinnedThread.get()
|
|
2572
|
+
else
|
|
2573
|
+
unPinnedThread = threadId;
|
|
2511
2574
|
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2575
|
+
chatEvents.fireEvent('threadEvents', {
|
|
2576
|
+
type: 'THREAD_UNPIN',
|
|
2577
|
+
result: {
|
|
2578
|
+
thread: unPinnedThread
|
|
2579
|
+
}
|
|
2580
|
+
});
|
|
2581
|
+
|
|
2582
|
+
// if (fullResponseObject) {
|
|
2583
|
+
// getThreads({
|
|
2584
|
+
// threadIds: [threadId]
|
|
2585
|
+
// }, function (threadsResult) {
|
|
2586
|
+
// var thread = threadsResult.result.threads[0];
|
|
2587
|
+
//
|
|
2588
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
2589
|
+
// type: 'THREAD_UNPIN',
|
|
2590
|
+
// result: {
|
|
2591
|
+
// thread: thread
|
|
2592
|
+
// }
|
|
2593
|
+
// });
|
|
2594
|
+
// });
|
|
2595
|
+
// } else {
|
|
2596
|
+
// chatEvents.fireEvent('threadEvents', {
|
|
2597
|
+
// type: 'THREAD_UNPIN',
|
|
2598
|
+
// result: {
|
|
2599
|
+
// thread: threadId
|
|
2600
|
+
// }
|
|
2601
|
+
// });
|
|
2602
|
+
// }
|
|
2527
2603
|
|
|
2528
2604
|
break;
|
|
2529
2605
|
|