@chat21/chat21-ionic 3.0.6-2.4 → 3.0.6-2.4-rc1
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/CHANGELOG.md +8 -3
- package/deploy_prod.sh +3 -3
- package/package.json +2 -1
- package/src/app/app.component.ts +85 -88
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +2 -2
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +1 -0
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +1 -2
- package/src/app/chatlib/conversation-detail/message/image/image.component.ts +5 -3
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +3 -3
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +10 -55
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +8 -2
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +2 -0
- package/src/app/components/image-viewer/image-viewer.component.ts +28 -10
- package/src/app/pages/conversation-detail/conversation-detail.page.html +36 -17
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +127 -227
- package/src/app/pages/conversations-list/conversations-list.page.html +18 -10
- package/src/app/pages/conversations-list/conversations-list.page.ts +58 -181
- package/src/chat-config-pre-test.json +2 -1
- package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +18 -3
- package/src/chat21-core/utils/utils-message.ts +96 -96
|
@@ -32,10 +32,15 @@
|
|
|
32
32
|
|
|
33
33
|
<ng-template #showConversation>
|
|
34
34
|
|
|
35
|
-
<app-header-conversation-detail
|
|
36
|
-
[
|
|
37
|
-
|
|
38
|
-
[
|
|
35
|
+
<app-header-conversation-detail
|
|
36
|
+
[isMobile]="isMobile"
|
|
37
|
+
[idLoggedUser]="loggedUser.uid"
|
|
38
|
+
[conversationUid]="conversationWith"
|
|
39
|
+
[conversationAvatar]="conversationAvatar"
|
|
40
|
+
[translationMap]="translationMap"
|
|
41
|
+
[isOpenInfoConversation]="isOpenInfoConversation"
|
|
42
|
+
[conv_type]="conv_type"
|
|
43
|
+
(eventOpenCloseInfoConversation)="returnOpenCloseInfoConversation($event)">
|
|
39
44
|
</app-header-conversation-detail>
|
|
40
45
|
|
|
41
46
|
<ion-content id="conv-details">
|
|
@@ -113,12 +118,16 @@
|
|
|
113
118
|
|
|
114
119
|
|
|
115
120
|
<ion-conversation-detail *ngIf="isHovering === false" #conversationContentDetail
|
|
116
|
-
[channelType]="channelType"
|
|
117
|
-
[
|
|
121
|
+
[channelType]="channelType"
|
|
122
|
+
[messages]="messages"
|
|
123
|
+
[senderId]="loggedUser.uid"
|
|
124
|
+
[baseLocation]="window?.location?.origin"
|
|
125
|
+
[stylesMap]="styleMap"
|
|
118
126
|
(onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
|
|
119
127
|
(onAfterMessageRender)="returnOnAfterMessageRender($event)"
|
|
120
128
|
(onAttachmentButtonClicked)="returnOnAttachmentButtonClicked($event)"
|
|
121
|
-
(onScrollContent)="returnOnScrollContent($event)"
|
|
129
|
+
(onScrollContent)="returnOnScrollContent($event)"
|
|
130
|
+
(onMenuOptionShow)="returnOnMenuOption($event)"
|
|
122
131
|
(onImageRendered)="onImageRenderedFN($event)"
|
|
123
132
|
(onAddUploadingBubble)="addUploadingBubbleEvent($event)">
|
|
124
133
|
</ion-conversation-detail>
|
|
@@ -163,16 +172,22 @@
|
|
|
163
172
|
<!-- (eventReplaceMessageWithCanned)="replaceTagInMessage($event)" -->
|
|
164
173
|
<!-- [tagsCannedFilter]="tagsCannedFilter" -->
|
|
165
174
|
<!-- openInfoConversation {{openInfoConversation}} - isMobile {{isMobile}} -->
|
|
166
|
-
<app-message-text-area
|
|
167
|
-
|
|
168
|
-
[
|
|
169
|
-
[
|
|
175
|
+
<app-message-text-area *ngIf="(openInfoConversation === false && isMobile === true) || (openInfoConversation === true && isMobile === false) || (openInfoConversation === false && isMobile === false)"
|
|
176
|
+
[tagsCannedCount]="tagsCannedCount"
|
|
177
|
+
[areVisibleCAR]="areVisibleCAR"
|
|
178
|
+
[support_mode]="support_mode"
|
|
179
|
+
[loggedUser]="loggedUser"
|
|
180
|
+
[conversationWith]="conversationWith"
|
|
181
|
+
[tagsCannedFilter]="tagsCannedFilter"
|
|
182
|
+
[translationMap]="translationMap"
|
|
183
|
+
[fileUploadAccept]="appConfigProvider.getConfig().fileUploadAccept"
|
|
184
|
+
[isOpenInfoConversation]="isOpenInfoConversation"
|
|
185
|
+
[dropEvent]="dropEvent"
|
|
186
|
+
[disableTextarea]="disableTextarea"
|
|
170
187
|
(eventChangeTextArea)="returnChangeTextArea($event)"
|
|
171
188
|
(hasClickedOpenCannedResponses)="hasClickedOpenCannedResponses($event)"
|
|
172
|
-
(eventSendMessage)="returnSendMessage($event)"
|
|
173
|
-
|
|
174
|
-
[isOpenInfoConversation]="isOpenInfoConversation" [dropEvent]="dropEvent"
|
|
175
|
-
(onPresentModalScrollToBottom)="onPresentModalScrollToBottom($event)" [disableTextarea]="disableTextarea">
|
|
189
|
+
(eventSendMessage)="returnSendMessage($event)"
|
|
190
|
+
(onPresentModalScrollToBottom)="onPresentModalScrollToBottom($event)">
|
|
176
191
|
</app-message-text-area>
|
|
177
192
|
<!-- [events]="eventsReplaceTexareaText.asObservable()" -->
|
|
178
193
|
</ion-row>
|
|
@@ -180,8 +195,12 @@
|
|
|
180
195
|
</ion-col>
|
|
181
196
|
|
|
182
197
|
<ion-col id="chat21-info-conversation" [class.mobile]="isMobile" [class.open]="openInfoConversation">
|
|
183
|
-
<app-info-content
|
|
184
|
-
[
|
|
198
|
+
<app-info-content
|
|
199
|
+
[openInfoConversation]="openInfoConversation"
|
|
200
|
+
[translationMap]="translationMap"
|
|
201
|
+
[loggedUser]="loggedUser"
|
|
202
|
+
[tenant]="tenant"
|
|
203
|
+
[groupDetail]="groupDetail">
|
|
185
204
|
</app-info-content>
|
|
186
205
|
</ion-col>
|
|
187
206
|
|
|
@@ -284,10 +284,23 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
284
284
|
const conversations = this.conversationsHandlerService.conversations
|
|
285
285
|
// console.log('[CONVS-DETAIL] conversations', conversations);
|
|
286
286
|
this.conversation_count = conversations.length
|
|
287
|
-
this.logger.log(
|
|
288
|
-
|
|
289
|
-
this.
|
|
290
|
-
|
|
287
|
+
this.logger.log('[CONVS-DETAIL] conversation_count',this.conversation_count)
|
|
288
|
+
if (conv && conv.sender !== this.loggedUser.uid) {
|
|
289
|
+
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange data sender ', conv.sender)
|
|
290
|
+
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange this.loggedUser.uid ', this.loggedUser.uid)
|
|
291
|
+
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange is_new ', conv.is_new)
|
|
292
|
+
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange showButtonToBottom ', this.showButtonToBottom)
|
|
293
|
+
// UPDATE THE CONVERSATION TO 'READ' IF IT IS ME WHO WRITES THE LAST MESSAGE OF THE CONVERSATION
|
|
294
|
+
// AND IF THE POSITION OF THE SCROLL IS AT THE END
|
|
295
|
+
if (!this.showButtonToBottom && conv.is_new) {
|
|
296
|
+
// ARE AT THE END
|
|
297
|
+
this.updateConversationBadge()
|
|
298
|
+
}
|
|
299
|
+
if(conv.uid === this.conversationWith){
|
|
300
|
+
this.conversationAvatar = setConversationAvatar(conv.conversation_with,conv.conversation_with_fullname,conv.channel_type)
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
}
|
|
291
304
|
})
|
|
292
305
|
|
|
293
306
|
this.conversationsHandlerService.conversationRemoved.subscribe((conv) => {
|
|
@@ -295,10 +308,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
295
308
|
const conversations = this.conversationsHandlerService.conversations
|
|
296
309
|
// console.log('[CONVS-DETAIL] conversations', conversations);
|
|
297
310
|
this.conversation_count = conversations.length
|
|
298
|
-
this.logger.log(
|
|
299
|
-
'[CONVS-DETAIL] conversation_count',
|
|
300
|
-
this.conversation_count,
|
|
301
|
-
)
|
|
311
|
+
this.logger.log('[CONVS-DETAIL] conversation_count',this.conversation_count)
|
|
302
312
|
})
|
|
303
313
|
|
|
304
314
|
setTimeout(() => {
|
|
@@ -430,21 +440,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
430
440
|
// @ Inizialize
|
|
431
441
|
// --------------------------------------------------
|
|
432
442
|
initialize() {
|
|
433
|
-
// this.logger.log('[CONVS-DETAIL] x conversationWith getConversationDetail', this.conversationWith)
|
|
434
|
-
// this.logger.log('[CONVS-DETAIL] x conversationsHandlerService getConversationDetail', this.conversationsHandlerService)
|
|
435
|
-
// this.logger.log('[CONVS-DETAIL] x this.conv_type getConversationDetail', this.conv_type)
|
|
436
|
-
|
|
437
|
-
// if (this.conversationWith && this.conversationsHandlerService && this.conv_type === 'active') {
|
|
438
|
-
// this.conversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
439
|
-
// this.logger.log('[CONVS-DETAIL] x conversationsHandlerService getConversationDetail', this.conversationWith, conv)
|
|
440
|
-
// })
|
|
441
|
-
// }
|
|
442
|
-
// else { //get conversation from 'conversations' firebase node
|
|
443
|
-
// this.archivedConversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
444
|
-
// this.logger.log('[CONVS-DETAIL] x archivedConversationsHandlerService getConversationDetail', this.conversationWith, conv)
|
|
445
|
-
|
|
446
|
-
// })
|
|
447
|
-
// }
|
|
448
443
|
|
|
449
444
|
this.loggedUser = this.tiledeskAuthService.getCurrentUser()
|
|
450
445
|
this.logger.log('[CONVS-DETAIL] - initialize -> loggedUser: ', this.loggedUser)
|
|
@@ -454,7 +449,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
454
449
|
this.showMessageWelcome = false
|
|
455
450
|
|
|
456
451
|
const appconfig = this.appConfigProvider.getConfig()
|
|
457
|
-
// this.tenant = appconfig.tenant;
|
|
458
452
|
this.tenant = appconfig.firebaseConfig.tenant
|
|
459
453
|
this.logger.log('[CONVS-DETAIL] - initialize -> firebaseConfig tenant ', this.tenant)
|
|
460
454
|
|
|
@@ -473,40 +467,21 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
473
467
|
this.logger.log('[CONVS-DETAIL] - initialize -> checkPlatformIsMobile isMobile? ', this.isMobile)
|
|
474
468
|
} else {
|
|
475
469
|
this.isMobile = false
|
|
476
|
-
this.logger.log(
|
|
477
|
-
'[CONVS-DETAIL] - initialize -> checkPlatformIsMobile isMobile? ',
|
|
478
|
-
this.isMobile,
|
|
479
|
-
)
|
|
470
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> checkPlatformIsMobile isMobile? ',this.isMobile)
|
|
480
471
|
// this.openInfoConversation = true;
|
|
481
472
|
}
|
|
482
473
|
|
|
483
474
|
if (this.isMobile === false) {
|
|
484
475
|
if (checkWindowWidthIsLessThan991px()) {
|
|
485
|
-
this.logger.log(
|
|
486
|
-
'[CONVS-DETAIL] - initialize -> checkWindowWidthIsLessThan991px ',
|
|
487
|
-
checkWindowWidthIsLessThan991px(),
|
|
488
|
-
)
|
|
476
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> checkWindowWidthIsLessThan991px ',checkWindowWidthIsLessThan991px())
|
|
489
477
|
this.openInfoConversation = false // indica se è aperto il box info conversazione
|
|
490
478
|
this.isOpenInfoConversation = false
|
|
491
|
-
this.logger.log(
|
|
492
|
-
'[CONVS-DETAIL] - initialize -> openInfoConversation ',
|
|
493
|
-
this.openInfoConversation,
|
|
494
|
-
' -> isOpenInfoConversation ',
|
|
495
|
-
this.isOpenInfoConversation,
|
|
496
|
-
)
|
|
479
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> openInfoConversation ',this.openInfoConversation,' -> isOpenInfoConversation ',this.isOpenInfoConversation)
|
|
497
480
|
} else {
|
|
498
|
-
this.logger.log(
|
|
499
|
-
'[CONVS-DETAIL] - initialize -> checkWindowWidthIsLessThan991px ',
|
|
500
|
-
checkWindowWidthIsLessThan991px(),
|
|
501
|
-
)
|
|
481
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> checkWindowWidthIsLessThan991px ',checkWindowWidthIsLessThan991px())
|
|
502
482
|
this.openInfoConversation = true
|
|
503
483
|
this.isOpenInfoConversation = true
|
|
504
|
-
this.logger.log(
|
|
505
|
-
'[CONVS-DETAIL] - initialize -> openInfoConversation ',
|
|
506
|
-
this.openInfoConversation,
|
|
507
|
-
' -> isOpenInfoConversation ',
|
|
508
|
-
this.isOpenInfoConversation,
|
|
509
|
-
)
|
|
484
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> openInfoConversation ',this.openInfoConversation,' -> isOpenInfoConversation ',this.isOpenInfoConversation)
|
|
510
485
|
}
|
|
511
486
|
}
|
|
512
487
|
|
|
@@ -582,10 +557,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
582
557
|
}
|
|
583
558
|
|
|
584
559
|
returnOpenCloseInfoConversation(openInfoConversation: boolean) {
|
|
585
|
-
this.logger.log(
|
|
586
|
-
'[CONVS-DETAIL] returnOpenCloseInfoConversation - openInfoConversation ',
|
|
587
|
-
openInfoConversation,
|
|
588
|
-
)
|
|
560
|
+
this.logger.log('[CONVS-DETAIL] returnOpenCloseInfoConversation - openInfoConversation ',openInfoConversation)
|
|
589
561
|
this.resizeTextArea()
|
|
590
562
|
this.openInfoMessage = false
|
|
591
563
|
this.openInfoConversation = openInfoConversation
|
|
@@ -677,15 +649,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
677
649
|
initConversationHandler() {
|
|
678
650
|
const translationMap = this.setTranslationMapForConversationHandler()
|
|
679
651
|
this.showMessageWelcome = false
|
|
680
|
-
const handler: ConversationHandlerService = this.chatManager.getConversationHandlerByConversationId(
|
|
681
|
-
|
|
682
|
-
)
|
|
683
|
-
this.logger.log(
|
|
684
|
-
'[CONVS-DETAIL] - initConversationHandler - handler ',
|
|
685
|
-
handler,
|
|
686
|
-
' conversationWith ',
|
|
687
|
-
this.conversationWith,
|
|
688
|
-
)
|
|
652
|
+
const handler: ConversationHandlerService = this.chatManager.getConversationHandlerByConversationId(this.conversationWith)
|
|
653
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler - handler ',handler,' conversationWith ',this.conversationWith)
|
|
689
654
|
if (!handler) {
|
|
690
655
|
this.conversationHandlerService = this.conversationHandlerBuilderService.build()
|
|
691
656
|
this.conversationHandlerService.initialize(
|
|
@@ -696,15 +661,9 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
696
661
|
translationMap,
|
|
697
662
|
)
|
|
698
663
|
this.conversationHandlerService.connect()
|
|
699
|
-
this.logger.log(
|
|
700
|
-
'[CONVS-DETAIL] - initConversationHandler - NEW handler - conversationHandlerService',
|
|
701
|
-
this.conversationHandlerService,
|
|
702
|
-
)
|
|
664
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler - NEW handler - conversationHandlerService',this.conversationHandlerService)
|
|
703
665
|
this.messages = this.conversationHandlerService.messages
|
|
704
|
-
this.logger.log(
|
|
705
|
-
'[CONVS-DETAIL] - initConversationHandler - messages: ',
|
|
706
|
-
this.messages,
|
|
707
|
-
)
|
|
666
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler - messages: ',this.messages)
|
|
708
667
|
this.chatManager.addConversationHandler(this.conversationHandlerService)
|
|
709
668
|
|
|
710
669
|
// // wait 8 second and then display the message if there are no messages
|
|
@@ -773,15 +732,10 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
773
732
|
// this.logger.log('[CONVS-DETAIL] - setHeaderContent conversationWith', this.conversationWith)
|
|
774
733
|
// this.logger.log('[CONVS-DETAIL] - setHeaderContent conversationsHandlerService', this.conversationsHandlerService)
|
|
775
734
|
// this.logger.log('[CONVS-DETAIL] - setHeaderContent conv_type', this.conv_type)
|
|
776
|
-
if (
|
|
777
|
-
this.conversationWith &&
|
|
778
|
-
this.conversationsHandlerService &&
|
|
779
|
-
this.conv_type === 'active'
|
|
780
|
-
) {
|
|
735
|
+
if ( this.conversationWith && this.conversationsHandlerService && this.conv_type === 'active' ) {
|
|
781
736
|
this.logger.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail CALLING')
|
|
782
737
|
this.conversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
783
738
|
if (conv) {
|
|
784
|
-
// console.log( '[CONVS-DETAIL] - setHeaderContent getConversationDetail (active)', this.conversationWith, conv )
|
|
785
739
|
this.conversationAvatar = setConversationAvatar(
|
|
786
740
|
conv.conversation_with,
|
|
787
741
|
conv.conversation_with_fullname,
|
|
@@ -789,23 +743,19 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
789
743
|
)
|
|
790
744
|
}
|
|
791
745
|
this.logger.log('[CONVS-DETAIL] - setHeaderContent > conversationAvatar: ', this.conversationAvatar)
|
|
792
|
-
}
|
|
793
|
-
)
|
|
746
|
+
})
|
|
794
747
|
} else {
|
|
795
748
|
//get conversation from 'conversations' firebase node
|
|
796
|
-
this.archivedConversationsHandlerService.getConversationDetail(
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
}
|
|
807
|
-
},
|
|
808
|
-
)
|
|
749
|
+
this.archivedConversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
750
|
+
if (conv) {
|
|
751
|
+
// console.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail (archived)', this.conversationWith, 'CONVS', conv)
|
|
752
|
+
this.conversationAvatar = setConversationAvatar(
|
|
753
|
+
conv.conversation_with,
|
|
754
|
+
conv.conversation_with_fullname,
|
|
755
|
+
conv.channel_type,
|
|
756
|
+
)
|
|
757
|
+
}
|
|
758
|
+
})
|
|
809
759
|
}
|
|
810
760
|
|
|
811
761
|
// this.conversationAvatar = setConversationAvatar(
|
|
@@ -924,81 +874,71 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
924
874
|
let subscription: any
|
|
925
875
|
let subscriptionKey: string
|
|
926
876
|
|
|
927
|
-
subscriptionKey = 'BSConversationsChanged'
|
|
928
|
-
subscription = this.subscriptions.find(
|
|
929
|
-
|
|
930
|
-
)
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
}
|
|
877
|
+
// subscriptionKey = 'BSConversationsChanged'
|
|
878
|
+
// subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
|
|
879
|
+
// if (!subscription) {
|
|
880
|
+
// subscription = this.conversationsHandlerService.conversationChanged.subscribe((data: ConversationModel) => {
|
|
881
|
+
// this.logger.log('[CONVS-DETAIL] subscribe BSConversationsChanged data ', data, ' this.loggedUser.uid:', this.loggedUser.uid)
|
|
882
|
+
|
|
883
|
+
// if (data && data.sender !== this.loggedUser.uid) {
|
|
884
|
+
// this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange data sender ', data.sender)
|
|
885
|
+
// this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange this.loggedUser.uid ', this.loggedUser.uid)
|
|
886
|
+
// this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange is_new ', data.is_new)
|
|
887
|
+
// this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange showButtonToBottom ', this.showButtonToBottom)
|
|
888
|
+
// // UPDATE THE CONVERSATION TO 'READ' IF IT IS ME WHO WRITES THE LAST MESSAGE OF THE CONVERSATION
|
|
889
|
+
// // AND IF THE POSITION OF THE SCROLL IS AT THE END
|
|
890
|
+
// if (!this.showButtonToBottom && data.is_new) {
|
|
891
|
+
// // ARE AT THE END
|
|
892
|
+
// this.updateConversationBadge()
|
|
893
|
+
// }
|
|
894
|
+
// if(data.uid === this.conversationWith){
|
|
895
|
+
// this.conversationAvatar = setConversationAvatar(
|
|
896
|
+
// data.conversation_with,
|
|
897
|
+
// data.conversation_with_fullname,
|
|
898
|
+
// data.channel_type,
|
|
899
|
+
// )
|
|
900
|
+
// }
|
|
901
|
+
|
|
902
|
+
// }
|
|
903
|
+
// })
|
|
904
|
+
// const subscribe = { key: subscriptionKey, value: subscription }
|
|
905
|
+
// this.subscriptions.push(subscribe)
|
|
906
|
+
// }
|
|
953
907
|
|
|
954
908
|
subscriptionKey = 'messageAdded'
|
|
955
|
-
subscription = this.subscriptions.find(
|
|
956
|
-
(item) => item.key === subscriptionKey,
|
|
957
|
-
)
|
|
909
|
+
subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
|
|
958
910
|
if (!subscription) {
|
|
959
911
|
this.logger.log('[CONVS-DETAIL] subscribe to messageAdded - conversationHandlerService', this.conversationHandlerService)
|
|
960
|
-
subscription = this.conversationHandlerService.messageAdded.subscribe(
|
|
961
|
-
(msg: any) => {
|
|
912
|
+
subscription = this.conversationHandlerService.messageAdded.subscribe((msg: any) => {
|
|
962
913
|
this.logger.log('[CONVS-DETAIL] subscribe to messageAdded - msg ', msg)
|
|
963
914
|
if (msg) {
|
|
964
915
|
that.newMessageAdded(msg)
|
|
916
|
+
// this.setHeaderContent()
|
|
965
917
|
}
|
|
966
|
-
|
|
967
|
-
)
|
|
918
|
+
})
|
|
968
919
|
const subscribe = { key: subscriptionKey, value: subscription }
|
|
969
920
|
this.subscriptions.push(subscribe)
|
|
970
921
|
}
|
|
971
922
|
|
|
972
923
|
// IS USED ?
|
|
973
924
|
subscriptionKey = 'messageChanged'
|
|
974
|
-
subscription = this.subscriptions.find(
|
|
975
|
-
(item) => item.key === subscriptionKey,
|
|
976
|
-
)
|
|
925
|
+
subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
|
|
977
926
|
if (!subscription) {
|
|
978
927
|
this.logger.log('[CONVS-DETAIL] subscribe to messageChanged')
|
|
979
|
-
subscription = this.conversationHandlerService.messageChanged.subscribe(
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
'[CONVS-DETAIL] subscribe to messageChanged - msg ',
|
|
983
|
-
msg,
|
|
984
|
-
)
|
|
985
|
-
},
|
|
986
|
-
)
|
|
928
|
+
subscription = this.conversationHandlerService.messageChanged.subscribe((msg: any) => {
|
|
929
|
+
this.logger.log('[CONVS-DETAIL] subscribe to messageChanged - msg ',msg)
|
|
930
|
+
})
|
|
987
931
|
const subscribe = { key: subscriptionKey, value: subscription }
|
|
988
932
|
this.subscriptions.push(subscribe)
|
|
989
933
|
}
|
|
990
934
|
|
|
991
935
|
subscriptionKey = 'messageRemoved'
|
|
992
|
-
subscription = this.subscriptions.find(
|
|
993
|
-
(item) => item.key === subscriptionKey,
|
|
994
|
-
)
|
|
936
|
+
subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
|
|
995
937
|
if (!subscription) {
|
|
996
938
|
this.logger.log('[CONVS-DETAIL] subscribe to messageRemoved')
|
|
997
|
-
subscription = this.conversationHandlerService.messageRemoved.subscribe(
|
|
998
|
-
(messageId: any) => {
|
|
939
|
+
subscription = this.conversationHandlerService.messageRemoved.subscribe((messageId: any) => {
|
|
999
940
|
this.logger.log('[CONVS-DETAIL] subscribe to messageRemoved - messageId ', messageId)
|
|
1000
|
-
|
|
1001
|
-
)
|
|
941
|
+
})
|
|
1002
942
|
const subscribe = { key: subscriptionKey, value: subscription }
|
|
1003
943
|
this.subscriptions.push(subscribe)
|
|
1004
944
|
}
|
|
@@ -1008,22 +948,15 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1008
948
|
// if (!subscription) {
|
|
1009
949
|
// subscription =
|
|
1010
950
|
if (this.conversationWith.startsWith('group-')) {
|
|
1011
|
-
this.groupService
|
|
1012
|
-
|
|
1013
|
-
.
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
this.logger.error('[CONVS-DETAIL] subscribe to onGroupChange - ERROR ', error)
|
|
1021
|
-
},
|
|
1022
|
-
() => {
|
|
1023
|
-
this.logger.log('[CONVS-DETAIL] subscribe to onGroupChange /* COMPLETE */')
|
|
1024
|
-
this.groupDetail = null
|
|
1025
|
-
},
|
|
1026
|
-
)
|
|
951
|
+
this.groupService.onGroupChange(this.conversationWith).pipe(takeUntil(this.unsubscribe$)).subscribe((groupDetail: any) => {
|
|
952
|
+
this.groupDetail = groupDetail
|
|
953
|
+
this.logger.log('[CONVS-DETAIL] subscribe to onGroupChange - groupDetail ', this.groupDetail)
|
|
954
|
+
},(error) => {
|
|
955
|
+
this.logger.error('[CONVS-DETAIL] subscribe to onGroupChange - ERROR ', error)
|
|
956
|
+
},() => {
|
|
957
|
+
this.logger.log('[CONVS-DETAIL] subscribe to onGroupChange /* COMPLETE */')
|
|
958
|
+
this.groupDetail = null
|
|
959
|
+
})
|
|
1027
960
|
}
|
|
1028
961
|
// const subscribe = { key: subscriptionKey, value: subscription };
|
|
1029
962
|
// this.subscriptions.push(subscribe);
|
|
@@ -1095,22 +1028,10 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1095
1028
|
}
|
|
1096
1029
|
|
|
1097
1030
|
updateConversationBadge() {
|
|
1098
|
-
if (
|
|
1099
|
-
this.conversationWith
|
|
1100
|
-
|
|
1101
|
-
this.
|
|
1102
|
-
) {
|
|
1103
|
-
this.conversationsHandlerService.setConversationRead(
|
|
1104
|
-
this.conversationWith,
|
|
1105
|
-
)
|
|
1106
|
-
} else if (
|
|
1107
|
-
this.conversationWith &&
|
|
1108
|
-
this.archivedConversationsHandlerService &&
|
|
1109
|
-
this.conv_type === 'archived'
|
|
1110
|
-
) {
|
|
1111
|
-
this.archivedConversationsHandlerService.setConversationRead(
|
|
1112
|
-
this.conversationWith,
|
|
1113
|
-
)
|
|
1031
|
+
if (this.conversationWith &&this.conversationsHandlerService && this.conv_type === 'active') {
|
|
1032
|
+
this.conversationsHandlerService.setConversationRead(this.conversationWith)
|
|
1033
|
+
} else if (this.conversationWith && this.archivedConversationsHandlerService && this.conv_type === 'archived') {
|
|
1034
|
+
this.archivedConversationsHandlerService.setConversationRead(this.conversationWith)
|
|
1114
1035
|
}
|
|
1115
1036
|
}
|
|
1116
1037
|
|
|
@@ -1157,13 +1078,11 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1157
1078
|
// }
|
|
1158
1079
|
idCurrentUser = this.loggedUser.uid
|
|
1159
1080
|
|
|
1160
|
-
if (
|
|
1161
|
-
this.loggedUser.firstname &&
|
|
1162
|
-
this.loggedUser.firstname !== undefined
|
|
1163
|
-
) {
|
|
1081
|
+
if (this.loggedUser.firstname &&this.loggedUser.firstname !== undefined) {
|
|
1164
1082
|
userFullname = this.loggedUser.firstname
|
|
1165
1083
|
}
|
|
1166
1084
|
|
|
1085
|
+
/** DO NOT SET TYPING if message is empty */
|
|
1167
1086
|
if (message !== '') {
|
|
1168
1087
|
this.typingService.setTyping(this.conversationWith, message, idCurrentUser, userFullname)
|
|
1169
1088
|
}
|
|
@@ -1289,15 +1208,12 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1289
1208
|
|
|
1290
1209
|
const conversationWith_segments = conversationWith.split('-')
|
|
1291
1210
|
// Removes the last element of the array if is = to the separator
|
|
1292
|
-
if (
|
|
1293
|
-
conversationWith_segments[conversationWith_segments.length - 1] === ''
|
|
1294
|
-
) {
|
|
1211
|
+
if (conversationWith_segments[conversationWith_segments.length - 1] === '') {
|
|
1295
1212
|
conversationWith_segments.pop()
|
|
1296
1213
|
}
|
|
1297
1214
|
|
|
1298
1215
|
if (conversationWith_segments.length === 4) {
|
|
1299
|
-
const lastArrayElement =
|
|
1300
|
-
conversationWith_segments[conversationWith_segments.length - 1]
|
|
1216
|
+
const lastArrayElement = conversationWith_segments[conversationWith_segments.length - 1]
|
|
1301
1217
|
this.logger.log('[CONVS-DETAIL] - lastArrayElement ', lastArrayElement)
|
|
1302
1218
|
this.logger.log('[CONVS-DETAIL] - lastArrayElement length', lastArrayElement.length)
|
|
1303
1219
|
if (lastArrayElement.length !== 32) {
|
|
@@ -1311,7 +1227,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1311
1227
|
if (conversationWith_segments.length === 4) {
|
|
1312
1228
|
projectId = conversationWith_segments[2]
|
|
1313
1229
|
this.logger.log('[CONVS-DETAIL] - loadTagsCanned projectId ', projectId)
|
|
1314
|
-
|
|
1315
1230
|
this.getAndShowCannedResponses(strSearch, projectId)
|
|
1316
1231
|
} else {
|
|
1317
1232
|
this.getProjectIdByConversationWith(strSearch, this.conversationWith)
|
|
@@ -1321,56 +1236,41 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1321
1236
|
getProjectIdByConversationWith(strSearch, conversationWith: string) {
|
|
1322
1237
|
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
|
|
1323
1238
|
|
|
1324
|
-
this.tiledeskService
|
|
1325
|
-
.
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
this.logger.error('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT - ERROR ', error)
|
|
1339
|
-
},
|
|
1340
|
-
() => {
|
|
1341
|
-
this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT * COMPLETE *')
|
|
1342
|
-
},
|
|
1343
|
-
)
|
|
1239
|
+
this.tiledeskService.getProjectIdByConvRecipient(tiledeskToken, conversationWith).subscribe( (res) => {
|
|
1240
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT RES', res)
|
|
1241
|
+
if (res) {
|
|
1242
|
+
const projectId = res.id_project
|
|
1243
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT projectId ', projectId)
|
|
1244
|
+
if (projectId) {
|
|
1245
|
+
this.getAndShowCannedResponses(strSearch, projectId)
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
},(error) => {
|
|
1249
|
+
this.logger.error('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT - ERROR ', error)
|
|
1250
|
+
},() => {
|
|
1251
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT * COMPLETE *')
|
|
1252
|
+
})
|
|
1344
1253
|
}
|
|
1345
1254
|
|
|
1346
1255
|
getAndShowCannedResponses(strSearch, projectId) {
|
|
1347
1256
|
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
|
|
1348
|
-
this.logger.log(
|
|
1349
|
-
'[CONVS-DETAIL] - loadTagsCanned tagsCanned.length',
|
|
1350
|
-
this.tagsCanned.length,
|
|
1351
|
-
)
|
|
1257
|
+
this.logger.log( '[CONVS-DETAIL] - loadTagsCanned tagsCanned.length',this.tagsCanned.length)
|
|
1352
1258
|
//if(this.tagsCanned.length <= 0 ){
|
|
1353
1259
|
this.tagsCanned = []
|
|
1354
|
-
this.cannedResponsesService
|
|
1355
|
-
.getCannedResponses
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
this.logger.error('[CONVS-DETAIL] - loadTagsCanned getCannedResponses - ERROR ', error)
|
|
1369
|
-
},
|
|
1370
|
-
() => {
|
|
1371
|
-
this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses * COMPLETE *')
|
|
1372
|
-
},
|
|
1373
|
-
)
|
|
1260
|
+
this.cannedResponsesService.getCannedResponses(tiledeskToken, projectId).subscribe((res) => {
|
|
1261
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses RES', res)
|
|
1262
|
+
|
|
1263
|
+
this.tagsCanned = res
|
|
1264
|
+
this.tagsCannedCount = res.length
|
|
1265
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses tagsCannedCount', this.tagsCannedCount)
|
|
1266
|
+
if (this.HIDE_CANNED_RESPONSES === false) {
|
|
1267
|
+
this.showTagsCanned(strSearch)
|
|
1268
|
+
}
|
|
1269
|
+
},(error) => {
|
|
1270
|
+
this.logger.error('[CONVS-DETAIL] - loadTagsCanned getCannedResponses - ERROR ', error)
|
|
1271
|
+
},() => {
|
|
1272
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses * COMPLETE *')
|
|
1273
|
+
})
|
|
1374
1274
|
}
|
|
1375
1275
|
|
|
1376
1276
|
showTagsCanned(strSearch) {
|