@chat21/chat21-ionic 3.0.55-RC6 → 3.0.57

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.
Files changed (73) hide show
  1. package/CHANGELOG.md +95 -1
  2. package/package.json +1 -1
  3. package/src/app/app.component.scss +1 -0
  4. package/src/app/app.component.ts +615 -515
  5. package/src/app/app.module.ts +1 -1
  6. package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts +2 -1
  7. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +44 -24
  8. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +7 -8
  9. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +9 -7
  10. package/src/app/chatlib/conversation-detail/message/avatar/avatar.component.ts +1 -1
  11. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +22 -14
  12. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +85 -45
  13. package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.scss +1 -1
  14. package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.ts +1 -1
  15. package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.scss +4 -4
  16. package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.ts +1 -1
  17. package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.scss +1 -1
  18. package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.ts +1 -1
  19. package/src/app/chatlib/conversation-detail/message/frame/frame.component.ts +4 -2
  20. package/src/app/chatlib/conversation-detail/message/image/image.component.html +9 -8
  21. package/src/app/chatlib/conversation-detail/message/image/image.component.scss +3 -2
  22. package/src/app/chatlib/conversation-detail/message/image/image.component.ts +35 -3
  23. package/src/app/chatlib/conversation-detail/message/info-message/info-message.component.ts +1 -1
  24. package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.html +56 -0
  25. package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.scss +169 -0
  26. package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.spec.ts +33 -0
  27. package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.ts +80 -0
  28. package/src/app/chatlib/conversation-detail/message/return-receipt/return-receipt.component.ts +1 -1
  29. package/src/app/chatlib/conversation-detail/message/text/text.component.html +2 -1
  30. package/src/app/chatlib/conversation-detail/message/text/text.component.ts +4 -4
  31. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +40 -13
  32. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.scss +147 -1
  33. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +47 -2
  34. package/src/app/components/authentication/login/login.component.scss +1 -1
  35. package/src/app/components/contacts-directory/contacts-directory.component.html +3 -2
  36. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +2 -2
  37. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +28 -13
  38. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +1 -2
  39. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +10 -6
  40. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +46 -43
  41. package/src/app/components/conversation-info/advanced-info-accordion/advanced-info-accordion.component.html +2 -2
  42. package/src/app/components/conversation-info/info-content/info-content.component.ts +15 -5
  43. package/src/app/components/conversation-info/info-group/info-group.component.ts +4 -4
  44. package/src/app/components/utils/avatar-profile/avatar-profile.component.html +2 -1
  45. package/src/app/components/utils/user-presence/user-presence.component.ts +8 -6
  46. package/src/app/pages/contacts-directory/contacts-directory.page.ts +1 -1
  47. package/src/app/pages/conversation-detail/conversation-detail.page.html +4 -1
  48. package/src/app/pages/conversation-detail/conversation-detail.page.ts +218 -42
  49. package/src/app/pages/conversations-list/conversations-list.page.html +1 -1
  50. package/src/app/pages/conversations-list/conversations-list.page.ts +135 -45
  51. package/src/app/pages/loader-preview/loader-preview.page.html +1 -1
  52. package/src/app/pages/loader-preview/loader-preview.page.ts +18 -5
  53. package/src/app/pages/profile-info/profile-info.page.html +2 -0
  54. package/src/app/services/nav-proxy.service.ts +2 -2
  55. package/src/app/services/network-service/network.service.spec.ts +12 -0
  56. package/src/app/services/network-service/network.service.ts +46 -0
  57. package/src/app/shared/shared.module.ts +2 -0
  58. package/src/assets/i18n/en.json +4 -2
  59. package/src/assets/i18n/it.json +5 -3
  60. package/src/chat21-core/providers/abstract/app-storage.service.ts +2 -2
  61. package/src/chat21-core/providers/chat-manager.ts +2 -1
  62. package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +3 -2
  63. package/src/chat21-core/providers/firebase/firebase-auth-service.ts +112 -69
  64. package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +4 -4
  65. package/src/chat21-core/providers/firebase/firebase-image-repo.ts +1 -1
  66. package/src/chat21-core/providers/firebase/firebase-notifications.ts +29 -29
  67. package/src/chat21-core/providers/firebase/firebase-presence.service.ts +1 -0
  68. package/src/chat21-core/providers/localSessionStorage.ts +155 -154
  69. package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +42 -12
  70. package/src/chat21-core/utils/user-typing/user-typing.component.html +6 -11
  71. package/src/chat21-core/utils/utils.ts +3 -3
  72. package/src/global.scss +17 -0
  73. package/src/index.html +27 -59
@@ -1,6 +1,6 @@
1
1
  import { ArchivedConversationsHandlerService } from 'src/chat21-core/providers/abstract/archivedconversations-handler.service';
2
- import { Component, OnInit } from '@angular/core';
3
- import { ModalController } from '@ionic/angular';
2
+ import { Component, OnInit, ViewChild } from '@angular/core';
3
+ import { IonContent, ModalController } from '@ionic/angular';
4
4
  import { ActivatedRoute, Router, NavigationExtras } from '@angular/router';
5
5
  // config
6
6
  import { environment } from '../../../environments/environment';
@@ -39,6 +39,7 @@ import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance'
39
39
  styleUrls: ['./conversations-list.page.scss'],
40
40
  })
41
41
  export class ConversationListPage implements OnInit {
42
+ @ViewChild('ioncontentconvlist', { static: false }) ionContentConvList: IonContent;
42
43
  private subscriptions: Array<string>;
43
44
  public tenant: string;
44
45
  public loggedUserUid: string;
@@ -59,7 +60,7 @@ export class ConversationListPage implements OnInit {
59
60
  stylesMap: Map<string, string>;
60
61
 
61
62
  public conversationType = 'active'
62
- headerTitle: string
63
+ headerTitle: string;
63
64
 
64
65
 
65
66
  constructor(
@@ -82,12 +83,16 @@ export class ConversationListPage implements OnInit {
82
83
  this.listenToAppCompConvsLengthOnInitConvs();
83
84
  this.listenToLogoutEvent();
84
85
  this.listenToSwPostMessage();
86
+
85
87
  }
86
88
 
89
+
87
90
  // -----------------------------------------------
88
91
  // @ Lifehooks
89
92
  // -----------------------------------------------
90
- ngOnInit() { }
93
+ ngOnInit() {
94
+
95
+ }
91
96
 
92
97
  ionViewWillEnter() {
93
98
  this.logger.log('[CONVS-LIST-PAGE] ionViewWillEnter uidConvSelected', this.uidConvSelected);
@@ -195,8 +200,8 @@ export class ConversationListPage implements OnInit {
195
200
 
196
201
  listenToLogoutEvent() {
197
202
  this.events.subscribe('profileInfoButtonClick:logout', (hasclickedlogout) => {
198
- this.logger.log('[CONVS-LIST-PAGE] - listenToLogoutEvent - hasclickedlogout', hasclickedlogout);
199
-
203
+ this.logger.info('[CONVS-LIST-PAGE] - listenToLogoutEvent - hasclickedlogout', hasclickedlogout);
204
+ this.conversations = []
200
205
  this.conversationsHandlerService.conversations = [];
201
206
  this.uidConvSelected = null;
202
207
 
@@ -209,13 +214,11 @@ export class ConversationListPage implements OnInit {
209
214
  }
210
215
 
211
216
 
212
-
213
-
214
-
215
217
  // ------------------------------------------------------------------
216
218
  // SUBSCRIPTIONS
217
219
  // ------------------------------------------------------------------
218
220
  initSubscriptions() {
221
+ this.logger.log('[CONVS-LIST-PAGE] - CALLING - initSubscriptions ')
219
222
  let key = '';
220
223
 
221
224
 
@@ -243,7 +246,7 @@ export class ConversationListPage implements OnInit {
243
246
  // });
244
247
 
245
248
  this.conversationsHandlerService.conversationAdded.subscribe((conversation: ConversationModel) => {
246
- this.logger.log('[CONVS-LIST-PAGE] ***** conversationsAdded *****', conversation);
249
+ // this.logger.log('[CONVS-LIST-PAGE] ***** conversationsAdded *****', conversation);
247
250
  // that.conversationsChanged(conversations);
248
251
  if (conversation) {
249
252
  this.onImageLoaded(conversation)
@@ -252,7 +255,7 @@ export class ConversationListPage implements OnInit {
252
255
  });
253
256
 
254
257
  this.conversationsHandlerService.conversationChanged.subscribe((conversation: ConversationModel) => {
255
- this.logger.log('[CONVS-LIST-PAGE] ***** subscribeConversationChanged *****', conversation);
258
+ // this.logger.log('[CONVS-LIST-PAGE] ***** subscribeConversationChanged *****', conversation);
256
259
  // that.conversationsChanged(conversations)
257
260
  if (conversation) {
258
261
  this.onImageLoaded(conversation)
@@ -263,6 +266,15 @@ export class ConversationListPage implements OnInit {
263
266
  this.conversationsHandlerService.conversationRemoved.subscribe((conversation: ConversationModel) => {
264
267
  this.logger.log('[CONVS-LIST-PAGE] ***** conversationsRemoved *****', conversation);
265
268
  });
269
+
270
+ this.archivedConversationsHandlerService.archivedConversationAdded.subscribe((conversation: ConversationModel) => {
271
+ this.logger.log('[CONVS-LIST-PAGE] ***** archivedConversationAdded *****', conversation);
272
+ // that.conversationsChanged(conversations);
273
+ if (conversation) {
274
+ this.onImageLoaded(conversation)
275
+ this.onConversationLoaded(conversation)
276
+ }
277
+ });
266
278
  }
267
279
 
268
280
  // ------------------------------------------------------------------------------------
@@ -403,18 +415,24 @@ export class ConversationListPage implements OnInit {
403
415
  * imposto recipient se esiste nei parametri passati nell'url
404
416
  * imposto uidConvSelected recuperando id ultima conversazione aperta dallo storage
405
417
  */
418
+ // --------------------------------------------------------
419
+ // It only works on BSStart.subscribe! it is useful or can be eliminated
420
+ // --------------------------------------------------------
406
421
  initVariables() {
407
422
  this.logger.log('[CONVS-LIST-PAGE] uidReciverFromUrl:: ' + this.uidReciverFromUrl);
408
423
  this.logger.log('[CONVS-LIST-PAGE] loggedUserUid:: ' + this.loggedUserUid);
409
424
  this.logger.log('[CONVS-LIST-PAGE] tenant:: ' + this.tenant);
410
425
  if (this.route.component['name'] !== "ConversationListPage") {
411
- const IDConv = this.route.snapshot.firstChild.paramMap.get('IDConv');
412
- this.logger.log('[CONVS-LIST-PAGE] conversationWith: ', IDConv);
413
- if (IDConv) {
414
- this.setUidConvSelected(IDConv);
415
- } else {
416
426
 
417
- this.logger.log('[CONVS-LIST-PAGE] conversationWith: ', IDConv);
427
+ if (this.route && this.route.snapshot && this.route.snapshot.firstChild) {
428
+ const IDConv = this.route.snapshot.firstChild.paramMap.get('IDConv');
429
+ this.logger.log('[CONVS-LIST-PAGE] conversationWith 2: ', IDConv);
430
+ if (IDConv) {
431
+ this.setUidConvSelected(IDConv);
432
+ } else {
433
+
434
+ this.logger.log('[CONVS-LIST-PAGE] conversationWith 2 (else): ', IDConv);
435
+ }
418
436
  }
419
437
  }
420
438
  }
@@ -437,7 +455,7 @@ export class ConversationListPage implements OnInit {
437
455
  }
438
456
  if (conversationSelected) {
439
457
  this.logger.log('[CONVS-LIST-PAGE] conversationSelected', conversationSelected);
440
- this.logger.log('[CONVS-LIST-PAGE] la conv ', this.conversationSelected, ' è già stata caricata');
458
+ this.logger.log('[CONVS-LIST-PAGE] la conv ', this.conversationSelected, ' has already been loaded');
441
459
  this.conversationSelected = conversationSelected;
442
460
  this.logger.log('[CONVS-LIST-PAGE] setUidConvSelected: ', this.conversationSelected);
443
461
  }
@@ -457,7 +475,7 @@ export class ConversationListPage implements OnInit {
457
475
  }
458
476
 
459
477
  onImageLoaded(conversation: any) {
460
- this.logger.log('[CONVS-LIST-PAGE] onImageLoaded', conversation)
478
+ // this.logger.log('[CONVS-LIST-PAGE] onImageLoaded', conversation)
461
479
  let conversation_with_fullname = conversation.sender_fullname;
462
480
  let conversation_with = conversation.sender;
463
481
  if (conversation.sender === this.loggedUserUid) {
@@ -476,6 +494,11 @@ export class ConversationListPage implements OnInit {
476
494
 
477
495
  onConversationLoaded(conversation: ConversationModel) {
478
496
  this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded ', conversation)
497
+ this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded is new? ', conversation.is_new)
498
+ // if (conversation.is_new === false) {
499
+ // this.ionContentConvList.scrollToTop(0);
500
+ // }
501
+
479
502
  const keys = ['YOU', 'SENT_AN_IMAGE', 'SENT_AN_ATTACHMENT'];
480
503
  const translationMap = this.translateService.translateLanguage(keys);
481
504
  // Fixes the bug: if a snippet of code is pasted and sent it is not displayed correctly in the convesations list
@@ -486,30 +509,55 @@ export class ConversationListPage implements OnInit {
486
509
 
487
510
  //FIX-BUG: 'YOU: YOU: YOU: text' on last-message-text in conversation-list
488
511
  if (conversation.sender === this.loggedUserUid && !conversation.last_message_text.includes(': ')) {
489
- this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded', conversation)
512
+ // this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded', conversation)
490
513
 
491
514
  if (conversation.type !== "image" && conversation.type !== "file") {
492
515
  conversation.last_message_text = translationMap.get('YOU') + ': ' + conversation.last_message_text;
493
516
 
494
517
  } else if (conversation.type === "image") {
495
518
 
496
- this.logger.log('[CONVS-LIST-PAGE] HAS SENT AN IMAGE');
497
- this.logger.log("[CONVS-LIST-PAGE] translationMap.get('YOU')")
498
- // const keys = ['SENT_AN_IMAGE'];
499
-
519
+ // this.logger.log('[CONVS-LIST-PAGE] HAS SENT AN IMAGE');
520
+ // this.logger.log("[CONVS-LIST-PAGE] translationMap.get('YOU')")
500
521
  const SENT_AN_IMAGE = conversation['last_message_text'] = translationMap.get('SENT_AN_IMAGE')
501
522
 
502
- conversation.last_message_text = translationMap.get('YOU') + ' ' + SENT_AN_IMAGE;
523
+ conversation.last_message_text = translationMap.get('YOU') + ': ' + SENT_AN_IMAGE;
503
524
 
504
525
  } else if (conversation.type === "file") {
505
- this.logger.log('[CONVS-LIST-PAGE] HAS SENT FILE')
526
+ // this.logger.log('[CONVS-LIST-PAGE] HAS SENT FILE')
527
+ const SENT_AN_ATTACHMENT = conversation['last_message_text'] = translationMap.get('SENT_AN_ATTACHMENT')
528
+ conversation.last_message_text = translationMap.get('YOU') + ': ' + SENT_AN_ATTACHMENT;
529
+ }
530
+ } else {
531
+ if (conversation.type === "image") {
532
+
533
+ // this.logger.log('[CONVS-LIST-PAGE] HAS SENT AN IMAGE');
534
+ // this.logger.log("[CONVS-LIST-PAGE] translationMap.get('YOU')")
535
+ const SENT_AN_IMAGE = conversation['last_message_text'] = translationMap.get('SENT_AN_IMAGE')
536
+
537
+ conversation.last_message_text = SENT_AN_IMAGE;
538
+
539
+ }
540
+ else if (conversation.type === "file") {
541
+ // this.logger.log('[CONVS-LIST-PAGE] HAS SENT FILE')
506
542
  const SENT_AN_ATTACHMENT = conversation['last_message_text'] = translationMap.get('SENT_AN_ATTACHMENT')
507
- conversation.last_message_text = translationMap.get('YOU') + ' ' + SENT_AN_ATTACHMENT;
543
+ conversation.last_message_text = SENT_AN_ATTACHMENT;
544
+
508
545
  }
509
546
  }
510
547
  }
511
548
  }
512
549
 
550
+ // isMarkdownLink(last_message_text) {
551
+ // this.logger.log('[CONVS-LIST-PAGE] isMarkdownLink 1')
552
+ // var regex = /^(^|[\n\r])\s*1\.\s.*\s+1\.\s$/
553
+ // let matchRegex = false
554
+ // if (regex.test(last_message_text)) {
555
+ // this.logger.log('[CONVS-LIST-PAGE] isMarkdownLink 2')
556
+ // matchRegex = true
557
+ // return matchRegex
558
+ // }
559
+ // }
560
+
513
561
 
514
562
  navigateByUrl(converationType: string, uidConvSelected: string) {
515
563
  this.logger.log('[CONVS-LIST-PAGE] navigateByUrl uidConvSelected: ', uidConvSelected);
@@ -588,33 +636,75 @@ export class ConversationListPage implements OnInit {
588
636
  const conversationId = conversation.uid;
589
637
 
590
638
  this.logger.log('[CONVS-LIST-PAGE] onCloseConversation conversationId: ', conversationId)
591
- const conversationId_segments = conversationId.split('-');
592
- this.logger.log('[CONVS-LIST-PAGE] - conversationId_segments: ', conversationId_segments);
593
- const project_id = conversationId_segments[2]
594
- this.logger.log('[CONVS-LIST-PAGE] - conversationWith_segments project_id: ', project_id);
595
639
 
596
- if (conversationId.startsWith("support-group")) {
640
+ const conversationWith_segments = conversationId.split('-');
641
+ this.logger.log('[CONVS-LIST-PAGE] - conversationId_segments: ', conversationWith_segments);
642
+
643
+ // Removes the last element of the array if is = to the separator
644
+ if (conversationWith_segments[conversationWith_segments.length - 1] === '') {
645
+ conversationWith_segments.pop();
646
+ }
597
647
 
598
- // const projectId = conversation.attributes.projectId
599
- const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
600
- this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation projectId: ', project_id)
648
+ if (conversationWith_segments.length === 4) {
649
+ const lastArrayElement = conversationWith_segments[conversationWith_segments.length - 1]
650
+ this.logger.log('[CONVS-LIST-PAGE] - lastArrayElement ', lastArrayElement);
651
+ this.logger.log('[CONVS-LIST-PAGE] - lastArrayElement length', lastArrayElement.length);
652
+ if (lastArrayElement.length !== 32) {
653
+ conversationWith_segments.pop();
654
+ }
655
+ }
601
656
 
602
- this.tiledeskService.closeSupportGroup(tiledeskToken, project_id, conversationId).subscribe(res => {
657
+ if (conversationId.startsWith("support-group")) {
658
+ let project_id = ''
659
+ if (conversationWith_segments.length === 4) {
660
+ project_id = conversationWith_segments[2];
603
661
 
604
- this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup RES', res);
605
- }, (error) => {
606
- this.logger.error('[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup - ERROR ', error);
607
- }, () => {
608
- this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup * COMPLETE *');
609
- this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation (closeSupportGroup) CONVS ', this.conversations)
610
- this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation (closeSupportGroup) CONVS LENGHT ', this.conversations.length)
611
- });
612
- } else {
662
+ const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
663
+ this.archiveSupportGroupConv(tiledeskToken, project_id, conversationId);
613
664
 
665
+ } else {
666
+ this.getProjectIdByConversationWith(conversationId)
667
+ }
668
+ } else {
614
669
  this.conversationsHandlerService.archiveConversation(conversationId)
615
670
  }
616
671
  }
617
672
 
673
+ getProjectIdByConversationWith(conversationId: string) {
674
+ const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
675
+
676
+ this.tiledeskService.getProjectIdByConvRecipient(tiledeskToken, conversationId).subscribe(res => {
677
+ this.logger.log('[INFO-CONTENT-COMP] - GET PROJECTID BY CONV RECIPIENT RES', res);
678
+
679
+ if (res) {
680
+ const project_id = res.id_project
681
+ this.logger.log('[INFO-CONTENT-COMP] - GET PROJECTID BY CONV RECIPIENT project_id', project_id);
682
+ this.archiveSupportGroupConv(tiledeskToken, project_id, conversationId);
683
+ }
684
+
685
+ }, (error) => {
686
+ this.logger.error('[INFO-CONTENT-COMP] - GET PROJECTID BY CONV RECIPIENT - ERROR ', error);
687
+
688
+ }, () => {
689
+ this.logger.log('[INFO-CONTENT-COMP] - GET PROJECTID BY CONV RECIPIENT * COMPLETE *');
690
+
691
+ });
692
+ }
693
+
694
+ archiveSupportGroupConv(tiledeskToken, project_id, conversationId) {
695
+ this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation projectId: ', project_id)
696
+ this.tiledeskService.closeSupportGroup(tiledeskToken, project_id, conversationId).subscribe(res => {
697
+
698
+ this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup RES', res);
699
+ }, (error) => {
700
+ this.logger.error('[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup - ERROR ', error);
701
+ }, () => {
702
+ this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup * COMPLETE *');
703
+ this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation (closeSupportGroup) CONVS ', this.conversations)
704
+ this.logger.log('[CONVS-LIST-PAGE] - onCloseConversation (closeSupportGroup) CONVS LENGHT ', this.conversations.length)
705
+ });
706
+
707
+ }
618
708
 
619
709
 
620
710
  public generateFake(count: number): Array<number> {
@@ -27,7 +27,7 @@
27
27
  <ion-item>
28
28
  <ion-label color="primary" position="floating" floating> {{'AddACaption' | translate}}...</ion-label>
29
29
  <!-- <ion-input clearInput></ion-input> -->
30
- <ion-textarea #messageTextArea rows="1" autosize="false" auto-grow="true" [(ngModel)]="messageString"
30
+ <ion-textarea #messageTextArea #imageCaptionTexarea rows="1" autosize="false" auto-grow="true" [(ngModel)]="messageString"
31
31
  (ionInput)="onChangeTextArea($event);" (keyup.enter)="pressedOnKeyboard($event, messageString);">
32
32
  </ion-textarea>
33
33
  </ion-item>
@@ -1,4 +1,4 @@
1
- import { Component, OnInit, Input, Output, ViewChild, ElementRef, EventEmitter, HostListener } from '@angular/core';
1
+ import { Component, OnInit, Input, Output, ViewChild, ElementRef, EventEmitter, HostListener, AfterViewInit } from '@angular/core';
2
2
  import { TYPE_MSG_IMAGE } from 'src/chat21-core/utils/constants';
3
3
  import { NavParams, ModalController } from '@ionic/angular';
4
4
  import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
@@ -12,9 +12,10 @@ import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance'
12
12
  templateUrl: './loader-preview.page.html',
13
13
  styleUrls: ['./loader-preview.page.scss'],
14
14
  })
15
- export class LoaderPreviewPage implements OnInit {
15
+ export class LoaderPreviewPage implements OnInit, AfterViewInit {
16
16
  @ViewChild('thumbnailsPreview', { static: false }) thumbnailsPreview: ElementRef;
17
17
  @ViewChild('messageTextArea', { static: false }) messageTextArea: ElementRef;
18
+ @ViewChild('imageCaptionTexarea', { static: false }) imageCaptionTexarea: any
18
19
  // @Output() eventSendMessage = new EventEmitter<object>();
19
20
  @Input() files: [any];
20
21
 
@@ -43,6 +44,17 @@ export class LoaderPreviewPage implements OnInit {
43
44
  //this.fileChange(this.files[i]);
44
45
  }
45
46
  }
47
+ ngAfterViewInit() {
48
+ if (this.imageCaptionTexarea) {
49
+ setTimeout(() => {
50
+ // this.logger.log("[CONVS-DETAIL][MSG-TEXT-AREA] set focus on ", this.messageTextArea);
51
+ // Keyboard.show() // for android
52
+ this.logger.log("[CONVS-DETAIL][MSG-TEXT-AREA] ngAfterViewInit this.imageCaptionTexarea ", this.imageCaptionTexarea);
53
+ this.imageCaptionTexarea.setFocus();
54
+
55
+ }, 1000); //a least 150ms.
56
+ }
57
+ }
46
58
 
47
59
  ionViewDidEnter() {
48
60
  this.logger.log('[LOADER-PREVIEW-PAGE] ionViewDidEnter thumbnailsPreview.nativeElement.offsetHeight', this.thumbnailsPreview.nativeElement.offsetHeight);
@@ -126,7 +138,7 @@ export class LoaderPreviewPage implements OnInit {
126
138
 
127
139
  start_and_end(str) {
128
140
  if (str.length > 70) {
129
- return str.substr(0, 20) + '...' + str.substr(str.length-10, str.length);
141
+ return str.substr(0, 20) + '...' + str.substr(str.length - 10, str.length);
130
142
  }
131
143
  return str;
132
144
  }
@@ -270,7 +282,7 @@ export class LoaderPreviewPage implements OnInit {
270
282
 
271
283
  /** */
272
284
  onChangeTextArea(e: any) {
273
- // this.logger.log('onChangeTextArea', e.target.clientHeight);
285
+ this.logger.log('onChangeTextArea', e.target.clientHeight);
274
286
  this.calculateHeightPreviewArea();
275
287
  // try {
276
288
  // let height: number = e.target.offsetHeight;
@@ -315,7 +327,7 @@ export class LoaderPreviewPage implements OnInit {
315
327
  /** */
316
328
  onSendMessage() {
317
329
  this.logger.log('[LOADER-PREVIEW-PAGE] onSendMessage messageString:', this.messageString);
318
- const file = this.selectedFiles.item(0);
330
+ let file = this.selectedFiles.item(0);
319
331
  const file4Load = new Image;
320
332
  const nameImg = file.name;
321
333
  const typeFile = file.type;
@@ -332,6 +344,7 @@ export class LoaderPreviewPage implements OnInit {
332
344
  'uid': uid
333
345
  };
334
346
  this.viewCtrl.dismiss({ fileSelected: file, messageString: this.messageString, metadata: metadata, type: TYPE_MSG_IMAGE });
347
+
335
348
  }
336
349
 
337
350
  async onClose() {
@@ -56,6 +56,7 @@
56
56
 
57
57
  <ion-list *ngIf="loggedUser">
58
58
  <ion-item lines="none" class="sidebar-items" (click)="onClickArchivedConversation()">
59
+ <div tabindex="0"></div>
59
60
  <ion-icon name="archive-outline" class="sidebar-icons"></ion-icon>
60
61
  <ion-label class="sidebar-labels">
61
62
  <h3>{{ 'LABEL_ARCHIVED' | translate }}</h3>
@@ -63,6 +64,7 @@
63
64
  </ion-item>
64
65
 
65
66
  <ion-item lines="none" class="sidebar-items" (click)="onLogout()">
67
+ <div tabindex="0"></div>
66
68
  <ion-icon name="log-out-outline" class="sidebar-icons"></ion-icon>
67
69
  <ion-label class="sidebar-labels">
68
70
  <h3>{{ 'LABEL_LOGOUT' | translate }}</h3>
@@ -52,7 +52,7 @@ export class NavProxyService {
52
52
 
53
53
  // !!!! SEEMS NOT USED
54
54
  pushSidebar(page: any, pageName: string, navExtra?) {
55
- console.log('push2:', pageName, 'navExtra():', navExtra, 'this.sidebarNav', this.sidebarNav);
55
+ this.logger.log('push2:', pageName, 'navExtra():', navExtra, 'this.sidebarNav', this.sidebarNav);
56
56
  if (checkPlatformIsMobile()) {
57
57
  this.router.navigate([pageName], navExtra);
58
58
  } else {
@@ -64,7 +64,7 @@ export class NavProxyService {
64
64
 
65
65
  // !!!! SEEMS NOT USED
66
66
  closePage(pageName: string) {
67
- console.log('closePage:', pageName, 'checkPlatformIsMobile():', checkPlatformIsMobile());
67
+ this.logger.log('closePage:', pageName, 'checkPlatformIsMobile():', checkPlatformIsMobile());
68
68
  if (checkPlatformIsMobile()) {
69
69
  const navigationExtras: NavigationExtras = {
70
70
  state: {
@@ -0,0 +1,12 @@
1
+ import { TestBed } from '@angular/core/testing';
2
+
3
+ import { NetworkService } from './network.service';
4
+
5
+ describe('NetworkService', () => {
6
+ beforeEach(() => TestBed.configureTestingModule({}));
7
+
8
+ it('should be created', () => {
9
+ const service: NetworkService = TestBed.get(NetworkService);
10
+ expect(service).toBeTruthy();
11
+ });
12
+ });
@@ -0,0 +1,46 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { Observable, Observer, fromEvent, merge, of } from 'rxjs';
3
+ import { mapTo } from 'rxjs/operators';
4
+ import { Platform } from '@ionic/angular';
5
+ import { Network } from '@ionic-native/network/ngx';
6
+
7
+ @Injectable({
8
+ providedIn: 'root'
9
+ })
10
+ export class NetworkService {
11
+
12
+ public appIsOnline$: Observable<boolean> = undefined;
13
+ checkInternet: boolean;
14
+
15
+ constructor(
16
+ private platform: Platform,
17
+ private network: Network
18
+ ) { }
19
+
20
+
21
+
22
+ checkInternetFunc() {
23
+ if (!window || !navigator || !('onLine' in navigator)) return;
24
+
25
+ this.appIsOnline$ = Observable.create(observer => {
26
+ observer.next(true);
27
+ }).pipe(mapTo(true));
28
+
29
+ if (this.platform.is('cordova')) {
30
+ // on Device - when platform is cordova
31
+ this.appIsOnline$ = merge(
32
+ this.network.onConnect().pipe(mapTo(true)),
33
+ this.network.onDisconnect().pipe(mapTo(false))
34
+ );
35
+ } else {
36
+ // on Browser - when platform is Browser
37
+ this.appIsOnline$ = merge(
38
+ of(navigator.onLine),
39
+ fromEvent(window, 'online').pipe(mapTo(true)),
40
+ fromEvent(window, 'offline').pipe(mapTo(false))
41
+ );
42
+ }
43
+ return this.appIsOnline$
44
+ }
45
+
46
+ }
@@ -36,6 +36,7 @@ import { AdvancedInfoAccordionComponent } from '../components/conversation-info/
36
36
  import { InfoGroupComponent } from '../components/conversation-info/info-group/info-group.component';
37
37
  import { TooltipModule } from 'ng2-tooltip-directive';
38
38
  import { OptionHeaderComponent } from '../components/conversation-detail/option-header/option-header.component';
39
+ import { MessageAttachmentComponent } from '../chatlib/conversation-detail/message/message-attachment/message-attachment.component';
39
40
 
40
41
  @NgModule({
41
42
  declarations: [
@@ -50,6 +51,7 @@ import { OptionHeaderComponent } from '../components/conversation-detail/option-
50
51
  ConversationContentComponent,
51
52
  AvatarComponent,
52
53
  BubbleMessageComponent,
54
+ MessageAttachmentComponent,
53
55
  TextButtonComponent,
54
56
  LinkButtonComponent,
55
57
  ActionButtonComponent,
@@ -172,10 +172,12 @@
172
172
  "UPLOAD_FILE_ERROR":"An unexpected error occurred while uploading the file",
173
173
  "DROP_IMAGE_HERE_TO_SEND_IT":"Drop image here to send it",
174
174
  "ONLY_IMAGE_FILES_ARE_ALLOWED_TO_PASTE": "Only image files and text are allowed to be pasted",
175
- "ONLY_IMAGE_FILES_ARE_ALLOWED_TO_DRAG": "Only image files are allowed to be dragged",
175
+ "FAILED_TO_UPLOAD_THE_FORMAT_IS_NOT_SUPPORTED": "Failed to upload: the format is not supported",
176
176
  "SENT_AN_IMAGE": "sent an image",
177
177
  "SENT_AN_ATTACHMENT":"sent an attachment",
178
178
  "NO_INFORMATION_AVAILABLE": "No information available",
179
179
  "CONTACT_ID": "Contact ID",
180
- "USER_ID": "User ID"
180
+ "USER_ID": "User ID",
181
+ "CLOSE_TOAST": "Close",
182
+ "WAITING_FOR_NETWORK": "Waiting for network"
181
183
  }
@@ -180,10 +180,12 @@
180
180
  "UPLOAD_FILE_ERROR":"Si è verificato un errore imprevisto durante il caricamento del file",
181
181
  "DROP_IMAGE_HERE_TO_SEND_IT":"Trascina qui l'immagine per inviarla",
182
182
  "ONLY_IMAGE_FILES_ARE_ALLOWED_TO_PASTE": "Possono essere incollati solo file di tipo immagine e testo",
183
- "ONLY_IMAGE_FILES_ARE_ALLOWED_TO_DRAG": "È consentito trascinare solo file di tipo immagine",
184
- "SENT_AN_IMAGE": "hai inviato un'immagine",
183
+ "FAILED_TO_UPLOAD_THE_FORMAT_IS_NOT_SUPPORTED": "Impossibile caricare: il formato non è supportato",
184
+ "SENT_AN_IMAGE": "ha inviato un'immagine",
185
185
  "SENT_AN_ATTACHMENT":"hai inviato un allegato",
186
186
  "NO_INFORMATION_AVAILABLE": "Nessuna informazione disponibile",
187
187
  "CONTACT_ID": "ID contatto",
188
- "USER_ID": "ID utente"
188
+ "USER_ID": "ID utente",
189
+ "CLOSE_TOAST": "Chiudi",
190
+ "WAITING_FOR_NETWORK": "In attesa di rete"
189
191
  }
@@ -9,8 +9,8 @@ export abstract class AppStorageService {
9
9
  abstract initialize(storagePrefix: string, persistence: string, projectID?: string): void;
10
10
  abstract getItem(key: string): any;
11
11
  abstract setItem(key: string, value: any): void;
12
- abstract getItemWithoutProjectID(key: string): any;
13
- abstract setItemWithoutProjectID(key: string, value: any): void;
12
+ // abstract getItemWithoutProjectID(key: string): any; // deprecated !Not tUsed
13
+ // abstract setItemWithoutProjectID(key: string, value: any): void; // deprecated !Not tUsed
14
14
  abstract removeItem(key: string): void;
15
15
  abstract clear(): void;
16
16
 
@@ -17,7 +17,6 @@ import { LoggerService } from './abstract/logger.service';
17
17
  import { LoggerInstance } from './logger/loggerInstance';
18
18
 
19
19
 
20
-
21
20
  @Injectable({ providedIn: 'root' })
22
21
 
23
22
  export class ChatManager {
@@ -58,6 +57,7 @@ export class ChatManager {
58
57
  * setTiledeskToken
59
58
  */
60
59
  public setTiledeskToken(tiledeskToken: string) {
60
+ this.logger.info('initialize FROM [APP-COMP] - [CHAT MANAGER] - initialize -> firebaseConfig tenant ', this.tenant);
61
61
  this.tiledeskToken = tiledeskToken;
62
62
  }
63
63
 
@@ -72,6 +72,7 @@ export class ChatManager {
72
72
  * setCurrentUser
73
73
  */
74
74
  public setCurrentUser(currentUser: UserModel) {
75
+ this.logger.info('initialize FROM [APP-COMP] - [CHAT MANAGER] setCurrentUser currentUser ', currentUser)
75
76
  this.currentUser = currentUser;
76
77
  }
77
78
 
@@ -64,7 +64,7 @@ export class FirebaseArchivedConversationsHandler extends ArchivedConversationsH
64
64
  * inizializzo conversations handler
65
65
  */
66
66
  initialize(tenant: string, userId: string, translationMap: Map<string, string>) {
67
- this.logger.info('[FIREBASEArchivedConversationsHandlerSERVICE] tenant ', tenant, ' - userId: ', userId, ' - translationMap: ', translationMap)
67
+ this.logger.info('initialize FROM [APP-COMP] - FIREBASEArchivedConversationsHandlerSERVICE] tenant ', tenant, ' - userId: ', userId, ' - translationMap: ', translationMap)
68
68
  this.tenant = tenant;
69
69
  this.loggedUserId = userId;
70
70
  this.translationMap = translationMap;
@@ -190,7 +190,7 @@ export class FirebaseArchivedConversationsHandler extends ArchivedConversationsH
190
190
  const childData: ConversationModel = childSnapshot.val();
191
191
  this.logger.log('[FIREBASEArchivedConversationsHandlerSERVICE] childData *****', childData)
192
192
  // if (childSnapshot && childSnapshot.key && childData.uid) {
193
- if (childSnapshot && childSnapshot.key) {
193
+ if (childSnapshot && childSnapshot.key && childData) {
194
194
  childData.uid = childSnapshot.key;
195
195
  const conversation = this.completeConversation(childData);
196
196
  if (conversation) {
@@ -391,6 +391,7 @@ export class FirebaseArchivedConversationsHandler extends ArchivedConversationsH
391
391
  }
392
392
  // Fixes the bug: if a snippet of code is pasted and sent it is not displayed correctly in the archived convesations list
393
393
  // conv.last_message_text = htmlEntities(conv.last_message_text)
394
+ conv.conversation_with = conversation_with;
394
395
  conv.conversation_with_fullname = conversation_with_fullname;
395
396
  conv.status = this.setStatusConversation(conv.sender, conv.uid);
396
397
  // conv.time_last_message = this.getTimeLastMessage(conv.timestamp); // evaluate if is used