@chat21/chat21-ionic 3.0.52-beta → 3.0.55-RC6
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 +55 -0
- package/LICENSE +21 -0
- package/config.xml +1 -0
- package/env.sample +1 -0
- package/package.json +6 -2
- package/resources/Android/icon/drawable-hdpi-icon.png +0 -0
- package/resources/Android/icon/drawable-ldpi-icon.png +0 -0
- package/resources/Android/icon/drawable-mdpi-icon.png +0 -0
- package/resources/Android/icon/drawable-xhdpi-icon.png +0 -0
- package/resources/Android/icon/drawable-xxhdpi-icon.png +0 -0
- package/resources/Android/icon/drawable-xxxhdpi-icon.png +0 -0
- package/resources/Android/icon.png +0 -0
- package/resources/Android/splash/drawable-land-hdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-land-ldpi-screen.png +0 -0
- package/resources/Android/splash/drawable-land-mdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-land-xhdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-land-xxhdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-land-xxxhdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-hdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-ldpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-mdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-xhdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-xxhdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-xxxhdpi-screen.png +0 -0
- package/resources/Android/splash.png +0 -0
- package/src/app/app.component.ts +509 -434
- package/src/app/app.module.ts +10 -5
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +4 -0
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +27 -30
- package/src/app/chatlib/conversation-detail/message/text/text.component.html +1 -1
- package/src/app/chatlib/conversation-detail/message/text/text.component.ts +27 -3
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +18 -5
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.scss +15 -3
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +24 -6
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +4 -0
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +17 -4
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +20 -16
- package/src/app/components/conversation-info/info-content/info-content.component.ts +8 -1
- package/src/app/pages/conversation-detail/conversation-detail.page.html +37 -16
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +143 -53
- package/src/app/pages/conversations-list/conversations-list.page.html +5 -2
- package/src/app/pages/conversations-list/conversations-list.page.ts +19 -14
- package/src/chat-config-pre-test.json +4 -2
- package/src/chat-config-template.json +2 -1
- package/src/chat-config.json +2 -1
- package/src/chat21-core/providers/abstract/messagingAuth.service.ts +1 -1
- package/src/chat21-core/providers/abstract/notifications.service.ts +2 -2
- package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +6 -4
- package/src/chat21-core/providers/firebase/firebase-auth-service.ts +84 -17
- package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +15 -10
- package/src/chat21-core/providers/firebase/firebase-notifications.ts +119 -18
- package/src/chat21-core/providers/localSessionStorage.ts +2 -1
- package/src/chat21-core/utils/utils-user.ts +2 -1
- package/src/index.html +87 -6
|
@@ -37,6 +37,7 @@ import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service
|
|
|
37
37
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
38
38
|
import { Subject } from 'rxjs';
|
|
39
39
|
import { takeUntil } from 'rxjs/operators';
|
|
40
|
+
import { TiledeskService } from '../../services/tiledesk/tiledesk.service';
|
|
40
41
|
|
|
41
42
|
@Component({
|
|
42
43
|
selector: 'app-conversation-detail',
|
|
@@ -155,9 +156,18 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
155
156
|
public cannedResponsesService: CannedResponsesService,
|
|
156
157
|
public imageRepoService: ImageRepoService,
|
|
157
158
|
public presenceService: PresenceService,
|
|
158
|
-
public toastController: ToastController
|
|
159
|
+
public toastController: ToastController,
|
|
160
|
+
public tiledeskService: TiledeskService
|
|
159
161
|
) {
|
|
160
162
|
|
|
163
|
+
// Change list on date change
|
|
164
|
+
this.route.paramMap.subscribe(params => {
|
|
165
|
+
this.logger.log('[CONVS-DETAIL] - constructor -> params: ', params);
|
|
166
|
+
this.conversationWith = params.get('IDConv');
|
|
167
|
+
this.conversationWithFullname = params.get('FullNameConv');
|
|
168
|
+
this.conv_type = params.get('Convtype');
|
|
169
|
+
});
|
|
170
|
+
|
|
161
171
|
}
|
|
162
172
|
|
|
163
173
|
// -----------------------------------------------------------
|
|
@@ -233,6 +243,25 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
233
243
|
// @ Inizialize
|
|
234
244
|
// --------------------------------------------------
|
|
235
245
|
initialize() {
|
|
246
|
+
|
|
247
|
+
// this.logger.log('[CONVS-DETAIL] x conversationWith getConversationDetail', this.conversationWith)
|
|
248
|
+
// this.logger.log('[CONVS-DETAIL] x conversationsHandlerService getConversationDetail', this.conversationsHandlerService)
|
|
249
|
+
// this.logger.log('[CONVS-DETAIL] x this.conv_type getConversationDetail', this.conv_type)
|
|
250
|
+
|
|
251
|
+
// if (this.conversationWith && this.conversationsHandlerService && this.conv_type === 'active') {
|
|
252
|
+
// this.conversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
253
|
+
// this.logger.log('[CONVS-DETAIL] x conversationsHandlerService getConversationDetail', this.conversationWith, conv)
|
|
254
|
+
// })
|
|
255
|
+
// }
|
|
256
|
+
// else { //get conversation from 'conversations' firebase node
|
|
257
|
+
// this.archivedConversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
258
|
+
// this.logger.log('[CONVS-DETAIL] x archivedConversationsHandlerService getConversationDetail', this.conversationWith, conv)
|
|
259
|
+
|
|
260
|
+
// })
|
|
261
|
+
// }
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
236
265
|
this.loggedUser = this.tiledeskAuthService.getCurrentUser();
|
|
237
266
|
this.logger.log('[CONVS-DETAIL] - initialize -> loggedUser: ', this.loggedUser);
|
|
238
267
|
this.translations();
|
|
@@ -246,13 +275,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
246
275
|
this.logger.log('[CONVS-DETAIL] - initialize -> firebaseConfig tenant ', this.tenant);
|
|
247
276
|
|
|
248
277
|
|
|
249
|
-
|
|
250
|
-
this.route.paramMap.subscribe(params => {
|
|
251
|
-
this.logger.log('[CONVS-DETAIL] - initialize -> params: ', params);
|
|
252
|
-
this.conversationWith = params.get('IDConv');
|
|
253
|
-
this.conversationWithFullname = params.get('FullNameConv');
|
|
254
|
-
this.conv_type = params.get('Convtype');
|
|
255
|
-
});
|
|
278
|
+
|
|
256
279
|
|
|
257
280
|
this.logger.log('[CONVS-DETAIL] - initialize -> conversationWith: ', this.conversationWith, ' -> conversationWithFullname: ', this.conversationWithFullname);
|
|
258
281
|
this.subscriptions = [];
|
|
@@ -349,6 +372,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
349
372
|
];
|
|
350
373
|
|
|
351
374
|
this.translationMap = this.customTranslateService.translateLanguage(keys);
|
|
375
|
+
this.logger.log('[CONVS-DETAIL] x this.translationMap ', this.translationMap)
|
|
352
376
|
}
|
|
353
377
|
|
|
354
378
|
// --------------------------------------------------------
|
|
@@ -400,8 +424,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
400
424
|
|
|
401
425
|
// // wait 8 second and then display the message if there are no messages
|
|
402
426
|
const that = this;
|
|
403
|
-
this.logger.log('[CONVS-DETAIL] - initConversationHandler that.messages ', that.messages
|
|
404
|
-
this.logger.log('[CONVS-DETAIL] - initConversationHandler that.messages.length ', that.messages.length
|
|
427
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler that.messages ', that.messages);
|
|
428
|
+
this.logger.log('[CONVS-DETAIL] - initConversationHandler that.messages.length ', that.messages.length);
|
|
405
429
|
setTimeout(() => {
|
|
406
430
|
if (!that.messages || that.messages.length === 0) {
|
|
407
431
|
this.showIonContent = true;
|
|
@@ -463,12 +487,38 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
463
487
|
}
|
|
464
488
|
|
|
465
489
|
setHeaderContent() {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
)
|
|
471
|
-
|
|
490
|
+
// this.logger.log('[CONVS-DETAIL] - setHeaderContent conversationWith', this.conversationWith)
|
|
491
|
+
// this.logger.log('[CONVS-DETAIL] - setHeaderContent conversationsHandlerService', this.conversationsHandlerService)
|
|
492
|
+
// this.logger.log('[CONVS-DETAIL] - setHeaderContent conv_type', this.conv_type)
|
|
493
|
+
if (this.conversationWith && this.conversationsHandlerService && this.conv_type === 'active') {
|
|
494
|
+
this.logger.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail CALLING')
|
|
495
|
+
this.conversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
496
|
+
this.logger.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail (active)', this.conversationWith, conv)
|
|
497
|
+
this.conversationAvatar = setConversationAvatar(
|
|
498
|
+
conv.conversation_with,
|
|
499
|
+
conv.conversation_with_fullname,
|
|
500
|
+
conv.channel_type
|
|
501
|
+
);
|
|
502
|
+
this.logger.log('[CONVS-DETAIL] - setHeaderContent > conversationAvatar: ', this.conversationAvatar);
|
|
503
|
+
})
|
|
504
|
+
}
|
|
505
|
+
else { //get conversation from 'conversations' firebase node
|
|
506
|
+
this.archivedConversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
507
|
+
this.logger.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail (archived)', this.conversationWith, conv)
|
|
508
|
+
this.conversationAvatar = setConversationAvatar(
|
|
509
|
+
conv.conversation_with,
|
|
510
|
+
conv.conversation_with_fullname,
|
|
511
|
+
conv.channel_type
|
|
512
|
+
);
|
|
513
|
+
})
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// this.conversationAvatar = setConversationAvatar(
|
|
517
|
+
// this.conversationWith,
|
|
518
|
+
// this.conversationWithFullname,
|
|
519
|
+
// this.channelType
|
|
520
|
+
// );
|
|
521
|
+
// this.logger.log('[CONVS-DETAIL] - setHeaderContent > conversationAvatar: ', this.conversationAvatar);
|
|
472
522
|
}
|
|
473
523
|
|
|
474
524
|
returnSendMessage(e: any) {
|
|
@@ -510,7 +560,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
510
560
|
|
|
511
561
|
if (msg) {
|
|
512
562
|
// msg = msg + '<br>' + 'File: ' + metadata.src;
|
|
513
|
-
msg =
|
|
563
|
+
msg = `[${metadata.name}](${metadata.src})` + '\n' + msg
|
|
514
564
|
|
|
515
565
|
} else {
|
|
516
566
|
// msg = 'File: ' + metadata.src;
|
|
@@ -765,18 +815,21 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
765
815
|
// DISPLAY CANNED RESPONSES if message.lastIndexOf("/")
|
|
766
816
|
// ----------------------------------------------------------
|
|
767
817
|
setTimeout(() => {
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
818
|
+
if (this.conversationWith.startsWith("support-group")) {
|
|
819
|
+
var pos = message.lastIndexOf("/");
|
|
820
|
+
this.logger.log("[CONVS-DETAIL] - returnChangeTextArea - canned responses pos of / ", pos);
|
|
821
|
+
this.logger.log("[CONVS-DETAIL] - returnChangeTextArea - pos:: ", pos);
|
|
822
|
+
|
|
823
|
+
if (pos >= 0) {
|
|
824
|
+
// if (pos === 0) {
|
|
825
|
+
// && that.tagsCanned.length > 0
|
|
826
|
+
var strSearch = message.substr(pos + 1);
|
|
827
|
+
this.logger.log("[CONVS-DETAIL] - returnChangeTextArea - canned responses strSearch ", strSearch);
|
|
828
|
+
this.loadTagsCanned(strSearch, this.conversationWith);
|
|
829
|
+
|
|
830
|
+
} else {
|
|
831
|
+
this.tagsCannedFilter = [];
|
|
832
|
+
}
|
|
780
833
|
}
|
|
781
834
|
}, 300);
|
|
782
835
|
// ./ CANNED RESPONSES //
|
|
@@ -789,37 +842,74 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
789
842
|
// ----------------------------------------------------------
|
|
790
843
|
// @ CANNED RESPONSES methods
|
|
791
844
|
// ----------------------------------------------------------
|
|
792
|
-
loadTagsCanned(strSearch) {
|
|
845
|
+
loadTagsCanned(strSearch, conversationWith) {
|
|
793
846
|
this.logger.log("[CONVS-DETAIL] - loadTagsCanned strSearch ", strSearch);
|
|
794
|
-
|
|
847
|
+
this.logger.log("[CONVS-DETAIL] - loadTagsCanned groupDetail ", this.groupDetail);
|
|
848
|
+
this.logger.log("[CONVS-DETAIL] - loadTagsCanned conversationWith ", conversationWith);
|
|
849
|
+
|
|
850
|
+
const conversationWith_segments = conversationWith.split('-');
|
|
851
|
+
// Removes the last element of the array if is = to the separator
|
|
852
|
+
if (conversationWith_segments[conversationWith_segments.length - 1] === '') {
|
|
853
|
+
conversationWith_segments.pop();
|
|
854
|
+
}
|
|
855
|
+
this.logger.log("[CONVS-DETAIL] - loadTagsCanned conversationWith_segments ", conversationWith_segments);
|
|
795
856
|
let projectId = ""
|
|
796
|
-
if (this.groupDetail && this.groupDetail['attributes'] && this.groupDetail['attributes']['projectId']) {
|
|
797
|
-
this.logger.log("[CONVS-DETAIL] - loadTagsCanned groupDetail ", this.groupDetail);
|
|
798
|
-
projectId = this.groupDetail['attributes']['projectId']
|
|
799
857
|
|
|
800
|
-
|
|
858
|
+
if (conversationWith_segments.length === 4) {
|
|
859
|
+
projectId = conversationWith_segments[2];
|
|
860
|
+
this.logger.log("[CONVS-DETAIL] - loadTagsCanned projectId ", projectId);
|
|
801
861
|
|
|
862
|
+
this.getAndShowCannedResponses(strSearch, projectId)
|
|
863
|
+
|
|
864
|
+
} else {
|
|
865
|
+
this.getProjectIdByConversationWith(strSearch, this.conversationWith)
|
|
866
|
+
}
|
|
867
|
+
}
|
|
802
868
|
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
//if(this.tagsCanned.length <= 0 ){
|
|
806
|
-
this.tagsCanned = [];
|
|
807
|
-
this.cannedResponsesService.getCannedResponses(tiledeskToken, projectId).subscribe(res => {
|
|
808
|
-
this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses RES', res);
|
|
869
|
+
getProjectIdByConversationWith(strSearch, conversationWith: string) {
|
|
870
|
+
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
|
|
809
871
|
|
|
810
|
-
|
|
811
|
-
|
|
872
|
+
this.tiledeskService.getProjectIdByConvRecipient(tiledeskToken, conversationWith).subscribe(res => {
|
|
873
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT RES', res);
|
|
874
|
+
if (res) {
|
|
875
|
+
const projectId = res.id_project
|
|
876
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT projectId ', projectId);
|
|
877
|
+
if (projectId) {
|
|
878
|
+
this.getAndShowCannedResponses(strSearch, projectId)
|
|
879
|
+
}
|
|
880
|
+
}
|
|
812
881
|
|
|
813
|
-
|
|
814
|
-
|
|
882
|
+
}, (error) => {
|
|
883
|
+
this.logger.error('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT - ERROR ', error);
|
|
815
884
|
|
|
816
|
-
|
|
817
|
-
|
|
885
|
+
}, () => {
|
|
886
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned - GET PROJECTID BY CONV RECIPIENT * COMPLETE *');
|
|
818
887
|
|
|
819
|
-
|
|
820
|
-
}
|
|
888
|
+
});
|
|
821
889
|
}
|
|
822
890
|
|
|
891
|
+
getAndShowCannedResponses(strSearch, projectId) {
|
|
892
|
+
|
|
893
|
+
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
|
|
894
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned tagsCanned.length', this.tagsCanned.length);
|
|
895
|
+
//if(this.tagsCanned.length <= 0 ){
|
|
896
|
+
this.tagsCanned = [];
|
|
897
|
+
this.cannedResponsesService.getCannedResponses(tiledeskToken, projectId).subscribe(res => {
|
|
898
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses RES', res);
|
|
899
|
+
|
|
900
|
+
this.tagsCanned = res
|
|
901
|
+
this.showTagsCanned(strSearch);
|
|
902
|
+
|
|
903
|
+
}, (error) => {
|
|
904
|
+
this.logger.error('[CONVS-DETAIL] - loadTagsCanned getCannedResponses - ERROR ', error);
|
|
905
|
+
|
|
906
|
+
}, () => {
|
|
907
|
+
this.logger.log('[CONVS-DETAIL] - loadTagsCanned getCannedResponses * COMPLETE *');
|
|
908
|
+
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
|
|
823
913
|
showTagsCanned(strSearch) {
|
|
824
914
|
this.logger.log('[CONVS-DETAIL] - showTagsCanned strSearch ', strSearch);
|
|
825
915
|
this.tagsCannedFilter = [];
|
|
@@ -855,9 +945,9 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
855
945
|
replacePlaceholderInCanned(str) {
|
|
856
946
|
this.logger.log('[CONVS-DETAIL] - replacePlaceholderInCanned str ', str);
|
|
857
947
|
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
948
|
+
|
|
949
|
+
str = str.replace('$recipient_name', this.conversationWithFullname);
|
|
950
|
+
|
|
861
951
|
if (this.loggedUser && this.loggedUser.fullname) {
|
|
862
952
|
str = str.replace('$agent_name', this.loggedUser.fullname);
|
|
863
953
|
}
|
|
@@ -996,7 +1086,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
996
1086
|
}
|
|
997
1087
|
}
|
|
998
1088
|
|
|
999
|
-
onPresentModalScrollToBottom
|
|
1089
|
+
onPresentModalScrollToBottom(event: boolean) {
|
|
1000
1090
|
this.logger.log('[CONVS-DETAIL] onPresentModalScrollToBottom event', event);
|
|
1001
1091
|
if (event === true) {
|
|
1002
1092
|
this.scrollBottom(0);
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
<ion-header no-border class="ion-no-border">
|
|
3
|
-
<app-ddp-header *ngIf="conversationType ==='active'"
|
|
4
|
-
|
|
3
|
+
<app-ddp-header *ngIf="conversationType ==='active'"
|
|
4
|
+
[numberOpenConv]="numberOpenConv"
|
|
5
|
+
[supportMode]="supportMode"
|
|
6
|
+
(openContactsDirectory)=openContactsDirectory($event)
|
|
7
|
+
(openProfileInfo)=openProfileInfo($event)>
|
|
5
8
|
</app-ddp-header>
|
|
6
9
|
|
|
7
10
|
<app-option-header *ngIf="conversationType !=='active'" [headerTitle]=headerTitle
|
|
@@ -81,8 +81,7 @@ export class ConversationListPage implements OnInit {
|
|
|
81
81
|
) {
|
|
82
82
|
this.listenToAppCompConvsLengthOnInitConvs();
|
|
83
83
|
this.listenToLogoutEvent();
|
|
84
|
-
this.
|
|
85
|
-
|
|
84
|
+
this.listenToSwPostMessage();
|
|
86
85
|
}
|
|
87
86
|
|
|
88
87
|
// -----------------------------------------------
|
|
@@ -97,23 +96,27 @@ export class ConversationListPage implements OnInit {
|
|
|
97
96
|
|
|
98
97
|
ionViewDidEnter() { }
|
|
99
98
|
|
|
100
|
-
|
|
99
|
+
listenToSwPostMessage() {
|
|
101
100
|
this.logger.log('[CONVS-LIST-PAGE] listenToNotificationCLick - CALLED: ');
|
|
102
101
|
const that = this;
|
|
103
102
|
if (navigator && navigator.serviceWorker) {
|
|
103
|
+
|
|
104
104
|
navigator.serviceWorker.addEventListener('message', function (event) {
|
|
105
|
-
|
|
106
|
-
that.logger.log('[CONVS-LIST-PAGE] listenToNotificationCLick - Received a message from service worker event data
|
|
107
|
-
that.logger.log('[CONVS-LIST-PAGE] listenToNotificationCLick - Received a message from service worker event data data
|
|
105
|
+
|
|
106
|
+
that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event data: ', event.data);
|
|
107
|
+
that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event data data: ', event.data['data']);
|
|
108
|
+
that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event data data typeof: ', typeof event.data['data']);
|
|
108
109
|
let uidConvSelected = ''
|
|
109
|
-
if (
|
|
110
|
-
uidConvSelected = event.data['
|
|
111
|
-
}
|
|
112
|
-
|
|
110
|
+
if (event.data && event.data['conversWith']) {
|
|
111
|
+
uidConvSelected = event.data['conversWith'];
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - DIFFERENT MSG');
|
|
115
|
+
return;
|
|
113
116
|
}
|
|
114
117
|
|
|
115
|
-
that.logger.log('[CONVS-LIST-PAGE] listenToNotificationCLick - Received a message from service worker event dataObjct uidConvSelected: ', uidConvSelected);
|
|
116
|
-
that.logger.log('[CONVS-LIST-PAGE] listenToNotificationCLick - Received a message from service worker that.conversations: ', that.conversations);
|
|
118
|
+
that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event dataObjct uidConvSelected: ', uidConvSelected);
|
|
119
|
+
that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker that.conversations: ', that.conversations);
|
|
117
120
|
const conversationSelected = that.conversations.find(item => item.uid === uidConvSelected);
|
|
118
121
|
if (conversationSelected) {
|
|
119
122
|
|
|
@@ -466,7 +469,9 @@ export class ConversationListPage implements OnInit {
|
|
|
466
469
|
conversation_with = conversation.recipient;
|
|
467
470
|
conversation_with_fullname = conversation.recipient_fullname;
|
|
468
471
|
}
|
|
469
|
-
|
|
472
|
+
if (!conversation_with.startsWith("support-group")) {
|
|
473
|
+
conversation.image = this.imageRepoService.getImagePhotoUrl(conversation_with)
|
|
474
|
+
}
|
|
470
475
|
}
|
|
471
476
|
|
|
472
477
|
onConversationLoaded(conversation: ConversationModel) {
|
|
@@ -491,7 +496,7 @@ export class ConversationListPage implements OnInit {
|
|
|
491
496
|
this.logger.log('[CONVS-LIST-PAGE] HAS SENT AN IMAGE');
|
|
492
497
|
this.logger.log("[CONVS-LIST-PAGE] translationMap.get('YOU')")
|
|
493
498
|
// const keys = ['SENT_AN_IMAGE'];
|
|
494
|
-
|
|
499
|
+
|
|
495
500
|
const SENT_AN_IMAGE = conversation['last_message_text'] = translationMap.get('SENT_AN_IMAGE')
|
|
496
501
|
|
|
497
502
|
conversation.last_message_text = translationMap.get('YOU') + ' ' + SENT_AN_IMAGE;
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
"chatEngine": "firebase",
|
|
3
3
|
"uploadEngine": "firebase",
|
|
4
4
|
"pushEngine": "firebase",
|
|
5
|
-
"logLevel": "
|
|
5
|
+
"logLevel": "debug",
|
|
6
6
|
"fileUploadAccept":"*/*",
|
|
7
|
+
"authPersistence": "LOCAL",
|
|
7
8
|
"firebaseConfig": {
|
|
8
9
|
"tenant": "tilechat",
|
|
9
10
|
"apiKey": "AIzaSyCoWXHNvP1-qOllCpTshhC6VjPXeRTK0T4",
|
|
@@ -13,7 +14,8 @@
|
|
|
13
14
|
"storageBucket": "chat21-pre-01.appspot.com",
|
|
14
15
|
"messagingSenderId": "269505353043",
|
|
15
16
|
"appId": "1:269505353043:web:b82af070572669e3707da6",
|
|
16
|
-
"chat21ApiUrl": "https://us-central1-chat21-pre-01.cloudfunctions.net"
|
|
17
|
+
"chat21ApiUrl": "https://us-central1-chat21-pre-01.cloudfunctions.net",
|
|
18
|
+
"vapidKey": "BOsgS2ADwspKdWAmiFDZXEYqY1HSYADVfJT3j67wsySh3NxaViJqoabPJH8WM02wb5r8cQIm5TgM0UK047Z1D1c"
|
|
17
19
|
},
|
|
18
20
|
"chat21Config": {
|
|
19
21
|
"appId": "tilechat",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"storageBucket": "${FIREBASE_STORAGEBUCKET}",
|
|
14
14
|
"messagingSenderId": "${FIREBASE_MESSAGINGSENDERID}",
|
|
15
15
|
"appId": "${FIREBASE_APP_ID}",
|
|
16
|
-
"chat21ApiUrl": "${CHAT21_URL}"
|
|
16
|
+
"chat21ApiUrl": "${CHAT21_URL}",
|
|
17
|
+
"vapidKey": "${FIREBASE_VAPID}"
|
|
17
18
|
},
|
|
18
19
|
"chat21Config": {
|
|
19
20
|
"appId": "${MQTT_APPID}",
|
package/src/chat-config.json
CHANGED
|
@@ -16,7 +16,7 @@ export abstract class MessagingAuthService {
|
|
|
16
16
|
abstract BSSignOut: BehaviorSubject<any> = new BehaviorSubject<any>(null);
|
|
17
17
|
|
|
18
18
|
// params
|
|
19
|
-
public DEFAULT_PERSISTENCE: string = '
|
|
19
|
+
public DEFAULT_PERSISTENCE: string = 'NONE';
|
|
20
20
|
public DEFAULT_URL: string = 'https://api.tiledesk.com/v2/auth/';
|
|
21
21
|
|
|
22
22
|
private persistence;
|
|
@@ -8,7 +8,7 @@ import * as PACKAGE from '../../../../package.json';
|
|
|
8
8
|
export abstract class NotificationsService {
|
|
9
9
|
|
|
10
10
|
private _tenant: string;
|
|
11
|
-
|
|
11
|
+
public BUILD_VERSION = PACKAGE.version
|
|
12
12
|
|
|
13
13
|
public setTenant(tenant): void {
|
|
14
14
|
this._tenant = tenant;
|
|
@@ -19,7 +19,7 @@ export abstract class NotificationsService {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
abstract initialize(tenant: string): void;
|
|
22
|
+
abstract initialize(tenant: string, vapidKey: string): void;
|
|
23
23
|
abstract getNotificationPermissionAndSaveToken(currentUserUid: string): void;
|
|
24
24
|
abstract removeNotificationsInstance(callback: (string) => void): void;
|
|
25
25
|
|
|
@@ -177,18 +177,20 @@ export class FirebaseArchivedConversationsHandler extends ArchivedConversationsH
|
|
|
177
177
|
|
|
178
178
|
getConversationDetail(conversationId: string, callback: (conv: ConversationModel) => void) {
|
|
179
179
|
const conversation = this.archivedConversations.find(item => item.uid === conversationId);
|
|
180
|
-
this.logger.
|
|
180
|
+
this.logger.log('[FIREBASEArchivedConversationsHandlerSERVICE] SubscribeToConversations getConversationDetail::ARCHIVED *****: ', conversation)
|
|
181
181
|
if (conversation) {
|
|
182
182
|
callback(conversation)
|
|
183
183
|
// this.BSConversationDetail.next(conversationSelected);
|
|
184
184
|
} else {
|
|
185
185
|
// const urlNodeFirebase = '/apps/' + this.tenant + '/users/' + this.loggedUserId + '/archived_conversations/' + conversationId;
|
|
186
186
|
const urlNodeFirebase = archivedConversationsPathForUserId(this.tenant, this.loggedUserId) + '/' + conversationId;
|
|
187
|
-
this.logger.
|
|
187
|
+
this.logger.log('[FIREBASEArchivedConversationsHandlerSERVICE] urlNodeFirebase conversationDetail *****', urlNodeFirebase)
|
|
188
188
|
const firebaseMessages = firebase.database().ref(urlNodeFirebase);
|
|
189
189
|
firebaseMessages.on('value', (childSnapshot) => {
|
|
190
190
|
const childData: ConversationModel = childSnapshot.val();
|
|
191
|
-
|
|
191
|
+
this.logger.log('[FIREBASEArchivedConversationsHandlerSERVICE] childData *****', childData)
|
|
192
|
+
// if (childSnapshot && childSnapshot.key && childData.uid) {
|
|
193
|
+
if (childSnapshot && childSnapshot.key) {
|
|
192
194
|
childData.uid = childSnapshot.key;
|
|
193
195
|
const conversation = this.completeConversation(childData);
|
|
194
196
|
if (conversation) {
|
|
@@ -391,7 +393,7 @@ export class FirebaseArchivedConversationsHandler extends ArchivedConversationsH
|
|
|
391
393
|
// conv.last_message_text = htmlEntities(conv.last_message_text)
|
|
392
394
|
conv.conversation_with_fullname = conversation_with_fullname;
|
|
393
395
|
conv.status = this.setStatusConversation(conv.sender, conv.uid);
|
|
394
|
-
conv.time_last_message = this.getTimeLastMessage(conv.timestamp);
|
|
396
|
+
// conv.time_last_message = this.getTimeLastMessage(conv.timestamp); // evaluate if is used
|
|
395
397
|
conv.avatar = avatarPlaceholder(conversation_with_fullname);
|
|
396
398
|
conv.color = getColorBck(conversation_with_fullname);
|
|
397
399
|
conv.archived = true;
|