@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.
Files changed (20) hide show
  1. package/CHANGELOG.md +8 -3
  2. package/deploy_prod.sh +3 -3
  3. package/package.json +2 -1
  4. package/src/app/app.component.ts +85 -88
  5. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +2 -2
  6. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +1 -0
  7. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +1 -2
  8. package/src/app/chatlib/conversation-detail/message/image/image.component.ts +5 -3
  9. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +3 -3
  10. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +10 -55
  11. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +8 -2
  12. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +2 -0
  13. package/src/app/components/image-viewer/image-viewer.component.ts +28 -10
  14. package/src/app/pages/conversation-detail/conversation-detail.page.html +36 -17
  15. package/src/app/pages/conversation-detail/conversation-detail.page.ts +127 -227
  16. package/src/app/pages/conversations-list/conversations-list.page.html +18 -10
  17. package/src/app/pages/conversations-list/conversations-list.page.ts +58 -181
  18. package/src/chat-config-pre-test.json +2 -1
  19. package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +18 -3
  20. package/src/chat21-core/utils/utils-message.ts +96 -96
package/CHANGELOG.md CHANGED
@@ -1,8 +1,13 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
- ### 3.0.62.4
4
- - Fixed bug: when the user profile is updated in the dashboard it is not updated in the chat
5
- - Fixed bug: when is sent a message with only emojis, some emojis have the chat balloon background
3
+ ### 3.0.62.4-rc1
4
+ - Fixes the bug: when the user profile is updated in the dashboard it is not updated in the chat
5
+ - Fixes the bug: when is sent a message with only emojis, some emojis have the chat balloon background
6
+ - Fixes the bug: in the conversation detail header the requester's avatar does not update after the same has filled in the pre-chat form requested by the bot
7
+ - Fixes the bug: images that are not in the database cannot be downloaded
8
+ - Adds default chat color to emojis picker tabs
9
+ - Fixes the bug: the selected conversation is undefined
10
+ - Fixes the bug: in the conversation list, the name of the requester changes according to the order of arrival of the conversations
6
11
 
7
12
  ### 3.0.62.3
8
13
  - Fixes the bug: the method setTyping fired twice after that a message is sent
package/deploy_prod.sh CHANGED
@@ -25,16 +25,16 @@ cp -p config.xml platforms/browser/www/
25
25
 
26
26
  ###### CHAT in prod
27
27
  cd platforms/browser/www
28
- aws s3 sync . s3://tiledesk-console/v2/chat/
28
+ # aws s3 sync . s3://tiledesk-console/v2/chat/
29
29
  aws s3 sync . s3://tiledesk-console/v2/chat/$version/
30
30
  cd ../../../
31
31
  # aws cloudfront create-invalidation --distribution-id E2DTAKWHWQ7C3J --paths "/*"
32
32
 
33
33
  # echo new version deployed on s3://tiledesk-dashboard/chat/$NEW_BUILD/
34
34
  echo new version deployed on s3://tiledesk-console/v2/chat/$version/
35
- echo new version deployed on s3://tiledesk-console/v2/chat/
35
+ # echo new version deployed on s3://tiledesk-console/v2/chat/
36
36
  echo available on https://console.tiledesk.com/v2/chat/$version/index.html
37
- echo available on https://console.tiledesk.com/v2/chat/index.html
37
+ # echo available on https://console.tiledesk.com/v2/chat/index.html
38
38
 
39
39
 
40
40
  ###### CHAT-IONIC5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
- "version": "3.0.62.4",
3
+ "version": "3.0.62.4-rc1",
4
4
  "author": "Tiledesk SRL",
5
5
  "homepage": "https://tiledesk.com/",
6
6
  "scripts": {
@@ -52,6 +52,7 @@
52
52
  "cordova-plugin-whitelist": "^1.3.5",
53
53
  "cordova-res": "^0.15.1",
54
54
  "core-js": "^2.5.4",
55
+ "file-saver": "^2.0.5",
55
56
  "firebase": "^8.6.7",
56
57
  "marked": "^2.0.1",
57
58
  "material-design-icons": "^3.0.1",
@@ -269,7 +269,6 @@ export class AppComponent implements OnInit {
269
269
 
270
270
  saveInStorageNumberOfOpenedChatTab() {
271
271
  // this.logger.log('Calling saveInStorageChatOpenedTab!');
272
-
273
272
  // https://jsfiddle.net/jjjs5wd3/3/å
274
273
  if (+localStorage.tabCount > 0) {
275
274
  this.logger.log('Chat IONIC Already open!');
@@ -660,75 +659,84 @@ export class AppComponent implements OnInit {
660
659
 
661
660
 
662
661
  updateStoredCurrentUser() {
663
- const currentUser = JSON.parse(this.appStorageService.getItem('currentUser'));
664
- this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser', currentUser)
665
- const dshbrdUser = JSON.parse(localStorage.getItem('user'));
666
- this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser', dshbrdUser)
667
-
668
- if (currentUser.color !== dshbrdUser.fillColour) {
669
- this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color !== dshbrdUser.fillColour')
670
- this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color ', currentUser.color)
671
- this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fillColour ', dshbrdUser.fillColour)
672
- currentUser.color = dshbrdUser.fillColour;
673
- } else {
674
- this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color === dshbrdUser.fillColour')
675
- this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color ', currentUser.color)
676
- this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fillColour ', dshbrdUser.fillColour)
677
- }
662
+ const storedCurrentUser = this.appStorageService.getItem('currentUser')
663
+ const storedDshbrdUser = localStorage.getItem('user')
664
+
665
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - stored currentUser', storedCurrentUser)
666
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - stored dshbrdUser', storedDshbrdUser)
667
+ if ((storedCurrentUser && storedCurrentUser !== 'undefined') && (storedDshbrdUser && storedDshbrdUser !== 'undefined')) {
668
+ const currentUser = JSON.parse(storedCurrentUser);
669
+ const dshbrdUser = JSON.parse(storedDshbrdUser);
670
+ if (currentUser && dshbrdUser) {
671
+ if (currentUser.color !== dshbrdUser.fillColour) {
672
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color !== dshbrdUser.fillColour')
673
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color ', currentUser.color)
674
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fillColour ', dshbrdUser.fillColour)
675
+ currentUser.color = dshbrdUser.fillColour;
676
+ } else {
677
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color === dshbrdUser.fillColour')
678
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color ', currentUser.color)
679
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fillColour ', dshbrdUser.fillColour)
680
+ }
678
681
 
679
- if (currentUser.firstname !== dshbrdUser.firstname) {
680
- this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname !== dshbrdUser.firstname')
681
- this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname ', currentUser.firstname)
682
- this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.firstname ', dshbrdUser.firstname)
683
- currentUser.firstname = dshbrdUser.firstname
684
- } else {
685
- this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname === dshbrdUser.firstname')
686
- this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname ', currentUser.firstname)
687
- this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.firstname ', dshbrdUser.firstname)
688
-
689
- }
682
+ if (currentUser.firstname !== dshbrdUser.firstname) {
683
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname !== dshbrdUser.firstname')
684
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname ', currentUser.firstname)
685
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.firstname ', dshbrdUser.firstname)
686
+ currentUser.firstname = dshbrdUser.firstname;
687
+ } else {
688
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname === dshbrdUser.firstname')
689
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname ', currentUser.firstname)
690
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.firstname ', dshbrdUser.firstname)
691
+ }
690
692
 
691
- if (currentUser.lastname !== dshbrdUser.lastname) {
692
- this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname !== dshbrdUser.lastname')
693
- this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname ', currentUser.lastname)
694
- this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.lastname ', dshbrdUser.lastname)
695
- currentUser.lastname = dshbrdUser.lastname
696
- } else {
697
- this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname === dshbrdUser.lastname')
698
- this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname ', currentUser.lastname)
699
- this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.lastname ', dshbrdUser.lastname)
700
- }
693
+ if (currentUser.lastname !== dshbrdUser.lastname) {
694
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname !== dshbrdUser.lastname')
695
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname ', currentUser.lastname)
696
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.lastname ', dshbrdUser.lastname)
697
+ currentUser.lastname = dshbrdUser.lastname;
698
+ } else {
699
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname === dshbrdUser.lastname')
700
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname ', currentUser.lastname)
701
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.lastname ', dshbrdUser.lastname)
702
+ }
701
703
 
702
- if (currentUser.avatar !== dshbrdUser.fullname_initial) {
703
- this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar !== dshbrdUser.fullname_initial')
704
- this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar ', currentUser.avatar)
705
- this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname_initial ', dshbrdUser.fullname_initial )
706
- } else {
707
- this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar === dshbrdUser.fullname_initial')
708
- this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar ', currentUser.avatar)
709
- this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname_initial ', dshbrdUser.fullname_initial )
710
- }
704
+ if (currentUser.avatar !== dshbrdUser.fullname_initial) {
705
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar !== dshbrdUser.fullname_initial')
706
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar ', currentUser.avatar)
707
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname_initial ', dshbrdUser.fullname_initial)
708
+ currentUser.avatar = dshbrdUser.fullname_initial
709
+ } else {
710
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar === dshbrdUser.fullname_initial')
711
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar ', currentUser.avatar)
712
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname_initial ', dshbrdUser.fullname_initial)
713
+ }
711
714
 
712
- let fullname = ""
713
- if (dshbrdUser.firstname && !dshbrdUser.lastname ) {
714
- fullname = dshbrdUser.firstname
715
- } else if (dshbrdUser.firstname && dshbrdUser.lastname) {
716
- fullname = dshbrdUser.firstname + ' ' + dshbrdUser.lastname
717
- this.logger.log('[APP-COMP] updateStoredCurrentUser - fullname ', fullname)
718
- }
715
+ let fullname = ""
716
+ if (dshbrdUser.firstname && !dshbrdUser.lastname) {
717
+ fullname = dshbrdUser.firstname
718
+ } else if (dshbrdUser.firstname && dshbrdUser.lastname) {
719
+ fullname = dshbrdUser.firstname + ' ' + dshbrdUser.lastname
720
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - fullname ', fullname)
721
+ }
722
+
723
+ if (fullname !== currentUser.fullname) {
724
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname !== dshbrdUser.fullname ')
725
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname ', fullname)
726
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname ', currentUser.fullname)
727
+ currentUser.fullname = fullname
728
+ } else {
729
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname === dshbrdUser.fullname ')
730
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname ', fullname)
731
+ this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname ', currentUser.fullname)
732
+ }
719
733
 
720
- if (fullname !== currentUser.fullname) {
721
- this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname !== dshbrdUser.fullname ')
722
- this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname ' , fullname)
723
- this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname ', currentUser.fullname )
724
- currentUser.fullname = fullname
734
+ this.appStorageService.setItem('currentUser', JSON.stringify(currentUser));
735
+ this.tiledeskAuthService.setCurrentUser(currentUser);
736
+ }
725
737
  } else {
726
- this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname === dshbrdUser.fullname ')
727
- this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname ' , fullname)
728
- this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname ', currentUser.fullname )
738
+ this.logger.error('[APP-COMP] updateStoredCurrentUser - currentuser or dashboarduser not found in storage')
729
739
  }
730
-
731
- this.appStorageService.setItem('currentUser', JSON.stringify(currentUser));
732
740
  }
733
741
 
734
742
  /***************************************************+*/
@@ -744,7 +752,7 @@ export class AppComponent implements OnInit {
744
752
  this.logger.log('[APP-COMP] >>> initAuthentication I LOG IN WITH A TOKEN EXISTING IN THE LOCAL STORAGE OR WITH A TOKEN PASSED IN THE URL PARAMETERS <<<')
745
753
  this.tiledeskAuthService.signInWithCustomToken(tiledeskToken).then(user => {
746
754
  this.logger.log('[APP-COMP] >>> initAuthentication user ', user)
747
-
755
+
748
756
  this.updateStoredCurrentUser()
749
757
 
750
758
  this.messagingAuthService.createCustomToken(tiledeskToken)
@@ -776,24 +784,7 @@ export class AppComponent implements OnInit {
776
784
  /**------- AUTHENTICATION FUNCTIONS --> END <--- +*/
777
785
  /***************************************************+*/
778
786
 
779
-
780
-
781
787
  checkPlatform() {
782
- // console.log('[APP-COMP] checkPlatform');
783
- // let pageUrl = '';
784
- // try {
785
- // const pathPage = this.route.snapshot.firstChild.routeConfig.path;
786
- // this.route.snapshot.firstChild.url.forEach(element => {
787
- // pageUrl += '/' + element.path;
788
- // });
789
- // } catch (error) {
790
- // this.logger.debug('error', error);
791
- // }
792
- // this.logger.debug('checkPlatform pathPage: ', pageUrl);
793
- // if (!pageUrl || pageUrl === '') {
794
- // pageUrl = '/conversations-list';
795
- // }
796
-
797
788
  if (checkPlatformIsMobile()) {
798
789
  this.chatManager.startApp();
799
790
 
@@ -969,14 +960,20 @@ export class AppComponent implements OnInit {
969
960
  this.conversationsHandlerService.conversationChanged.subscribe((conversation: ConversationModel) => {
970
961
 
971
962
  // console.log('[APP-COMP] ***** subscribeConversationChanged conversation: ', conversation);
972
- const currentUser = JSON.parse(this.appStorageService.getItem('currentUser'));
973
- this.logger.log('[APP-COMP] ***** subscribeConversationChanged current_user: ', currentUser);
974
-
975
- if (currentUser) {
976
- this.logger.log('[APP-COMP] ***** subscribeConversationChanged current_user uid: ', currentUser.uid);
977
- if (conversation && conversation.sender !== currentUser.uid) {
978
- this.manageTabNotification();
963
+ let currentUser = null
964
+ const storedCurrentUser = this.appStorageService.getItem('currentUser')
965
+ if (storedCurrentUser && storedCurrentUser !== 'undefined') {
966
+ currentUser = JSON.parse(storedCurrentUser);
967
+ this.logger.log('[APP-COMP] ***** subscribeConversationChanged currentUser: ', currentUser);
968
+
969
+ if (currentUser) {
970
+ this.logger.log('[APP-COMP] ***** subscribeConversationChanged current_user uid: ', currentUser.uid);
971
+ if (conversation && conversation.sender !== currentUser.uid) {
972
+ this.manageTabNotification();
973
+ }
979
974
  }
975
+ } else {
976
+ this.logger.error('[APP-COMP] ***** subscribeConversationChanged currentUser nor found in storage ');
980
977
  }
981
978
  });
982
979
  }
@@ -80,7 +80,7 @@
80
80
  <!--backgroundColor non viene ancora usato -->
81
81
  <chat-bubble-message class="messages msg_sent" id="message_msg_sent" style="position: relative;"
82
82
  [ngClass]="{'has-metadata': (isImage(message) || isFrame(message))}"
83
- [class.emoticon]="isEmojii_2(message?.text)"
83
+ [class.emoticon]="isEmojii(message?.text)"
84
84
  [ngClass]="{'button-in-msg' : message.metadata && message.metadata.button}"
85
85
  [message]="message"
86
86
  [textColor]="'col-msg-sent'"
@@ -120,7 +120,7 @@
120
120
 
121
121
  <chat-bubble-message class="messages msg_receive" id="message_msg_receive" style="position: relative;"
122
122
  [ngClass]="{'has-metadata': (isImage(message) || isFrame(message))}"
123
- [class.emoticon]="isEmojii_2(message?.text)"
123
+ [class.emoticon]="isEmojii(message?.text)"
124
124
  [message]="message"
125
125
  [textColor]="'black'"
126
126
  [addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText"
@@ -98,6 +98,7 @@ ion-item {
98
98
  font-size: 4em;
99
99
  // padding-bottom: 21px;
100
100
  padding-top: 30px;
101
+ text-align: right;
101
102
  }
102
103
  .has-metadata {
103
104
  max-width: 100% !important;
@@ -3,7 +3,7 @@ import { ChangeDetectorRef, Component, Input, OnInit, Output, EventEmitter } fro
3
3
 
4
4
 
5
5
  import { MESSAGE_TYPE_INFO, MESSAGE_TYPE_MINE, MESSAGE_TYPE_OTHERS } from 'src/chat21-core/utils/constants';
6
- import { isChannelTypeGroup, isEmojii,isEmojii_2, isFirstMessage, isInfo, isMine, messageType } from 'src/chat21-core/utils/utils-message';
6
+ import { isChannelTypeGroup, isEmojii, isFirstMessage, isInfo, isMine, messageType } from 'src/chat21-core/utils/utils-message';
7
7
  import { UploadService } from 'src/chat21-core/providers/abstract/upload.service';
8
8
  import { isFile, isFrame, isImage } from 'src/chat21-core/utils/utils-message';
9
9
 
@@ -42,7 +42,6 @@ export class IonConversationDetailComponent extends ConversationContentComponent
42
42
  messageType = messageType;
43
43
  isChannelTypeGroup = isChannelTypeGroup;
44
44
  isEmojii = isEmojii;
45
- isEmojii_2 =isEmojii_2
46
45
 
47
46
  MESSAGE_TYPE_INFO = MESSAGE_TYPE_INFO;
48
47
  MESSAGE_TYPE_MINE = MESSAGE_TYPE_MINE;
@@ -66,11 +66,13 @@ export class ImageComponent implements OnInit {
66
66
  var modalImg = <HTMLImageElement>document.getElementById("image-viewer-img");
67
67
  var captionText = document.getElementById("caption");
68
68
  modalImg.src = url
69
- captionText.innerHTML = fileName;
69
+ if (captionText) {
70
70
 
71
- }
71
+ captionText.innerHTML = fileName ? null : fileName = decodeURIComponent(decodeURIComponent(url).split('/').pop());
72
+ // console.log('XXXX ', decodeURIComponent(decodeURIComponent(url).split('/').pop()))
73
+ }
72
74
 
73
-
75
+ }
74
76
 
75
77
 
76
78
  }
@@ -32,8 +32,8 @@
32
32
  <!-- (click)="onOpenCloseInfoConversation()" -->
33
33
  <div *ngIf="conversationAvatar" class="tile-info-with"
34
34
  [ngClass]="{ 'tile-info-with-ios': platformName === 'ios' }">
35
- <!-- <span class="tile-username">{{ conversationAvatar.conversation_with_fullname }} </span> -->
36
- <span class="tile-username">{{ conversation_with_fullname }} </span>
35
+ <span class="tile-username">{{ conversationAvatar.conversation_with_fullname }} </span>
36
+ <!-- <span class="tile-username">{{ conversation_with_fullname }} </span> -->
37
37
 
38
38
  </div>
39
39
 
@@ -50,7 +50,7 @@
50
50
  <span style="text-transform: capitalize; margin-left: 5px;"> {{ 'Crea ticket' | translate}} </span>
51
51
  </ion-button> -->
52
52
 
53
- <ion-button *ngIf="idConv.startsWith('support-group') && conv_type !== 'archived'" ion-button fill="clear" color="primary" size="small"
53
+ <ion-button *ngIf="conversationUid?.startsWith('support-group') && conv_type !== 'archived'" ion-button fill="clear" color="primary" size="small"
54
54
  (click)="closeConversation()" [ngClass]="{'resolve-conv-margin-right': !isMobile}" [disabled]="conv_closed === true">
55
55
  <!-- <ion-icon slot="icon-only" name="alert-circle-outline"></ion-icon> -->
56
56
  <ion-icon name="archive-outline"></ion-icon>
@@ -22,6 +22,7 @@ import { ModalController } from '@ionic/angular'
22
22
  import { EventsService } from 'src/app/services/events-service'
23
23
  import { CreateTicketPage } from 'src/app/pages/create-ticket/create-ticket.page'
24
24
  import { TiledeskService } from 'src/app/services/tiledesk/tiledesk.service'
25
+ import { TYPE_DIRECT } from 'src/chat21-core/utils/constants'
25
26
 
26
27
  @Component({
27
28
  selector: 'app-header-conversation-detail',
@@ -31,57 +32,36 @@ import { TiledeskService } from 'src/app/services/tiledesk/tiledesk.service'
31
32
  export class HeaderConversationDetailComponent implements OnInit, OnChanges {
32
33
  @Input() conversationAvatar: any
33
34
  @Input() idLoggedUser: string
35
+ @Input() conversationUid: string
34
36
  @Input() conv_type: string
35
- @Input() isOpenInfoConversation: boolean
37
+ @Input() isOpenInfoConversation: boolean = true
36
38
  @Input() isMobile: boolean
37
39
  @Input() translationMap: Map<string, string>
38
40
  @Output() eventOpenCloseInfoConversation = new EventEmitter<boolean>()
39
41
  conversationWithFullname: string
40
42
  openInfoConversation = true
41
43
  openInfoMessage = true
42
- DIRECT = 'direct'
43
44
 
44
45
  isDirect = false
45
46
  isTyping = false
46
47
  borderColor = '#ffffff'
47
48
  fontColor = '#949494'
48
49
  membersConversation = ['SYSTEM']
49
- fullNameConv: string
50
- idConv: string
51
- conversation_with_fullname: string
52
50
  platformName: string
53
51
  conv_closed: boolean = false;
54
52
  IS_ON_IOS_MOBILE_DEVICE: boolean
55
53
  private logger: LoggerService = LoggerInstance.getInstance()
56
54
 
57
- /**
58
- * Constructor
59
- * @param imageRepoService
60
- */
61
55
  constructor(
62
56
  public imageRepoService: ImageRepoService,
63
57
  private route: ActivatedRoute,
64
58
  public platform: Platform,
65
59
  private router: Router,
66
- // public tiledeskAuthService: TiledeskAuthService,
67
60
  public tiledeskService: TiledeskService,
68
61
  public events: EventsService,
69
62
  public modalController: ModalController,
70
63
  ) {
71
- this.route.paramMap.subscribe((params) => {
72
- // this.conversationWithFullname = params.get('FullNameConv');
73
- this.logger.log('[CONVS-DETAIL][HEADER] -> params: ', params)
74
- this.fullNameConv = params.get('FullNameConv')
75
- this.logger.log(
76
- '[CONVS-DETAIL][HEADER] -> params > conversation_with_fullname: ',
77
- this.fullNameConv,
78
- )
79
- this.idConv = params.get('IDConv')
80
- this.logger.log(
81
- '[CONVS-DETAIL][HEADER] -> params > conversation_with: ',
82
- this.idConv,
83
- )
84
- })
64
+
85
65
  }
86
66
 
87
67
  // ----------------------------------------------------
@@ -91,8 +71,7 @@ export class HeaderConversationDetailComponent implements OnInit, OnChanges {
91
71
 
92
72
  this.logger.log('[CONVS-DETAIL][HEADER] - (ngOnInit) - idLoggedUser', this.idLoggedUser,)
93
73
  this.logger.log('[CONVS-DETAIL][HEADER] - (ngOnInit) - conversationAvatar', this.conversationAvatar,)
94
- this.logger.log('[CONVS-DETAIL][HEADER] - (ngOnInit) - conv_type', this.conv_type,)
95
- this.conversation_with_fullname = this.conversationAvatar.conversation_with_fullname
74
+ this.logger.log('[CONVS-DETAIL][HEADER] - (ngOnInit) - conv_type', this.conv_type)
96
75
  this.listenToConversationHasBeenClosed()
97
76
  this.initialize();
98
77
  // this.isOniOSMobileDevice()
@@ -111,29 +90,8 @@ export class HeaderConversationDetailComponent implements OnInit, OnChanges {
111
90
  ngOnChanges() {
112
91
  this.logger.log('[CONVS-DETAIL][HEADER] - (ngOnChanges) - conversationAvatar', this.conversationAvatar)
113
92
  if (this.conversationAvatar) {
114
- this.conversationAvatar.imageurl = this.imageRepoService.getImagePhotoUrl(
115
- this.conversationAvatar.uid,
116
- )
117
- } else {
118
- const channelType = setChannelType(this.idConv)
119
- this.logger.log('[CONVS-DETAIL][HEADER] - (ngOnChanges) - conversationAvatar usecase UNDEFINED channelType ', channelType)
120
- this.conversationAvatar = setConversationAvatar(
121
- this.idConv,
122
- this.fullNameConv,
123
- channelType,
124
- )
125
- if (this.conversationAvatar) {
126
- this.conversationAvatar.imageurl = this.imageRepoService.getImagePhotoUrl(
127
- this.conversationAvatar.uid,
128
- )
129
- }
130
- this.logger.log('[CONVS-DETAIL][HEADER] - (ngOnChanges) - conversationAvatar usecase UNDEFINED conversationAvatar', this.conversationAvatar)
131
- }
132
-
133
- this.logger.log(
134
- '[CONVS-DETAIL][HEADER] - (ngOnChanges) - isOpenInfoConversation',
135
- this.isOpenInfoConversation,
136
- )
93
+ this.conversationAvatar.imageurl = this.imageRepoService.getImagePhotoUrl(this.conversationAvatar.uid)
94
+ }
137
95
  this.openInfoConversation = this.isOpenInfoConversation
138
96
  }
139
97
 
@@ -142,10 +100,7 @@ export class HeaderConversationDetailComponent implements OnInit, OnChanges {
142
100
  // ----------------------------------------------------
143
101
  initialize() {
144
102
  this.getPlatformName()
145
- if (
146
- this.conversationAvatar &&
147
- this.conversationAvatar.channelType === this.DIRECT
148
- ) {
103
+ if ( this.conversationAvatar && this.conversationAvatar.channelType === TYPE_DIRECT ) {
149
104
  this.isDirect = true
150
105
  } else if (this.idLoggedUser) {
151
106
  this.membersConversation.push(this.idLoggedUser)
@@ -165,13 +120,13 @@ export class HeaderConversationDetailComponent implements OnInit, OnChanges {
165
120
 
166
121
  closeConversation() {
167
122
  this.logger.log('[CONVS-DETAIL][HEADER] click on RESOLVE this.events', this.events)
168
- this.events.publish('conversation:closed', this.idConv)
123
+ this.events.publish('conversation:closed', this.conversationUid)
169
124
  }
170
125
 
171
126
  listenToConversationHasBeenClosed() {
172
127
  this.events.subscribe('conversationhasbeenclosed', (convId) => {
173
128
  // console.log('[CONVS-DETAIL][HEADER] conversationhasbeenclosed convId', convId)
174
- if (convId === this.idConv) {
129
+ if (convId === this.conversationUid) {
175
130
  this.logger.log('[CONVS-DETAIL][HEADER] the conversation was closed',)
176
131
  this.conv_closed = true;
177
132
  }
@@ -92,8 +92,14 @@
92
92
  <!-- https://www.npmjs.com/package/@ctrl/ngx-emoji-mart/v/1.0.6 -->
93
93
  <!-- --------------------------------------------------------------------- -->
94
94
  <!-- [style]="{ position: 'absolute', bottom: '53px', right: '-246px' }" -->
95
- <emoji-mart [showPreview]="false" [perLine]="emojiPerLine" [style.visibility]="showEmojiPicker?'visible':'hidden'"
96
- (emojiSelect)="addEmoji($event)" [ngClass]="{'emoji-mart-desktop': !IS_ON_MOBILE_DEVICE, 'emoji-mart-mobile': IS_ON_MOBILE_DEVICE }">
95
+ <emoji-mart
96
+ [showPreview]="false"
97
+ [perLine]="emojiPerLine"
98
+ [style.visibility]="showEmojiPicker?'visible':'hidden'"
99
+ [include]="emojiiCategories"
100
+ [color]="emojiColor"
101
+ [ngClass]="{'emoji-mart-desktop': !IS_ON_MOBILE_DEVICE, 'emoji-mart-mobile': IS_ON_MOBILE_DEVICE }"
102
+ (emojiSelect)="addEmoji($event)">
97
103
  </emoji-mart>
98
104
  <!-- </div> -->
99
105
 
@@ -87,6 +87,8 @@ export class MessageTextAreaComponent implements OnInit, AfterViewInit, OnChange
87
87
  showEmojiPicker: boolean = false; //To show/hide emoji picker
88
88
  addWhiteSpaceBefore: boolean;
89
89
  emojiPerLine: number = 9
90
+ emojiColor: string ="#3880ff"
91
+ emojiiCategories = [ 'recent', 'people', 'nature', 'activity']
90
92
  /**
91
93
  * Constructor
92
94
  * @param chooser
@@ -1,5 +1,5 @@
1
1
  import { Component, OnInit } from '@angular/core';
2
-
2
+ import { saveAs } from 'file-saver';
3
3
  @Component({
4
4
  selector: 'app-image-viewer',
5
5
  templateUrl: './image-viewer.component.html',
@@ -7,9 +7,14 @@ import { Component, OnInit } from '@angular/core';
7
7
  })
8
8
  export class ImageViewerComponent implements OnInit {
9
9
 
10
- constructor() { }
10
+ constructor(
11
+
12
+ ) { }
13
+
14
+
15
+ ngOnInit() { }
16
+
11
17
 
12
- ngOnInit() {}
13
18
 
14
19
  closeImageViewerModal() {
15
20
  // console.log('HAS CLICKED CLOSE MODAL')
@@ -18,6 +23,24 @@ export class ImageViewerComponent implements OnInit {
18
23
  modal.style.display = "none";
19
24
  }
20
25
 
26
+ // __downloadImage() {
27
+ // var modalImg = <HTMLImageElement>document.getElementById("image-viewer-img")
28
+ // console.log('HAS CLICKED CLOSE DWNLD IMG modalImg ', modalImg)
29
+ // var modalImgURL = modalImg.src;
30
+ // console.log('HAS CLICKED CLOSE DWNLD IMG modalImgURL ', modalImgURL)
31
+ // var captionText = document.getElementById("caption").innerHTML;
32
+ // console.log('HAS CLICKED CLOSE DWNLD IMG captionText ', captionText)
33
+
34
+ // const a: any = document.createElement('a');
35
+ // a.href = modalImgURL;
36
+ // a.download = captionText;
37
+ // document.body.appendChild(a);
38
+ // a.style = 'display: none';
39
+ // a.click();
40
+ // a.remove();
41
+ // }
42
+
43
+
21
44
  downloadImage() {
22
45
  var modalImg = <HTMLImageElement>document.getElementById("image-viewer-img")
23
46
  // console.log('HAS CLICKED CLOSE DWNLD IMG modalImg ', modalImg)
@@ -26,13 +49,8 @@ export class ImageViewerComponent implements OnInit {
26
49
  var captionText = document.getElementById("caption").innerHTML;
27
50
  // console.log('HAS CLICKED CLOSE DWNLD IMG captionText ', captionText)
28
51
 
29
- const a: any = document.createElement('a');
30
- a.href = modalImgURL;
31
- a.download = captionText;
32
- document.body.appendChild(a);
33
- a.style = 'display: none';
34
- a.click();
35
- a.remove();
52
+ saveAs(modalImgURL, captionText);
53
+ this.closeImageViewerModal()
36
54
  }
37
55
 
38
56
  }