@chat21/chat21-ionic 3.0.61-rc5 → 3.0.61

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 (115) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/README.md +6 -0
  3. package/angular.json +2 -0
  4. package/config.xml +4 -5
  5. package/deploy_pre.sh +10 -10
  6. package/deploy_prod.sh +4 -0
  7. package/env.sample +1 -1
  8. package/package.json +8 -8
  9. package/resources/{Android → android}/icon/drawable-hdpi-icon.png +0 -0
  10. package/resources/{Android → android}/icon/drawable-ldpi-icon.png +0 -0
  11. package/resources/{Android → android}/icon/drawable-mdpi-icon.png +0 -0
  12. package/resources/{Android → android}/icon/drawable-xhdpi-icon.png +0 -0
  13. package/resources/{Android → android}/icon/drawable-xxhdpi-icon.png +0 -0
  14. package/resources/{Android → android}/icon/drawable-xxxhdpi-icon.png +0 -0
  15. package/resources/{Android → android}/icon.png +0 -0
  16. package/resources/{Android → android}/splash/drawable-land-hdpi-screen.png +0 -0
  17. package/resources/{Android → android}/splash/drawable-land-ldpi-screen.png +0 -0
  18. package/resources/{Android → android}/splash/drawable-land-mdpi-screen.png +0 -0
  19. package/resources/{Android → android}/splash/drawable-land-xhdpi-screen.png +0 -0
  20. package/resources/{Android → android}/splash/drawable-land-xxhdpi-screen.png +0 -0
  21. package/resources/{Android → android}/splash/drawable-land-xxxhdpi-screen.png +0 -0
  22. package/resources/{Android → android}/splash/drawable-port-hdpi-screen.png +0 -0
  23. package/resources/{Android → android}/splash/drawable-port-ldpi-screen.png +0 -0
  24. package/resources/{Android → android}/splash/drawable-port-mdpi-screen.png +0 -0
  25. package/resources/{Android → android}/splash/drawable-port-xhdpi-screen.png +0 -0
  26. package/resources/{Android → android}/splash/drawable-port-xxhdpi-screen.png +0 -0
  27. package/resources/{Android → android}/splash/drawable-port-xxxhdpi-screen.png +0 -0
  28. package/resources/{Android → android}/splash.png +0 -0
  29. package/src/app/app-routing.module.ts +15 -0
  30. package/src/app/app.component.html +2 -2
  31. package/src/app/app.component.scss +2 -1
  32. package/src/app/app.component.ts +34 -20
  33. package/src/app/app.module.ts +11 -3
  34. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +36 -25
  35. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +160 -50
  36. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +108 -18
  37. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +21 -36
  38. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +19 -7
  39. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +35 -40
  40. package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.scss +1 -1
  41. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +78 -15
  42. package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.ts +13 -10
  43. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +11 -4
  44. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +3 -1
  45. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +142 -71
  46. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +59 -22
  47. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +32 -9
  48. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +107 -23
  49. package/src/app/components/ddp-header/ddp-header.component.html +9 -2
  50. package/src/app/components/ddp-header/ddp-header.component.ts +93 -18
  51. package/src/app/components/project-item/project-item.component.html +1 -1
  52. package/src/app/components/project-item/project-item.component.scss +1 -1
  53. package/src/app/components/project-item/project-item.component.ts +3 -3
  54. package/src/app/components/sidebar/sidebar.component.html +151 -86
  55. package/src/app/components/sidebar/sidebar.component.scss +60 -3
  56. package/src/app/components/sidebar/sidebar.component.ts +173 -47
  57. package/src/app/components/sidebar-user-details/sidebar-user-details.component.html +26 -7
  58. package/src/app/components/sidebar-user-details/sidebar-user-details.component.scss +44 -19
  59. package/src/app/components/sidebar-user-details/sidebar-user-details.component.ts +109 -35
  60. package/src/app/pages/conversation-detail/conversation-detail.module.ts +5 -1
  61. package/src/app/pages/conversation-detail/conversation-detail.page.html +19 -9
  62. package/src/app/pages/conversation-detail/conversation-detail.page.scss +28 -0
  63. package/src/app/pages/conversation-detail/conversation-detail.page.ts +1124 -778
  64. package/src/app/pages/conversations-list/conversations-list.page.html +3 -1
  65. package/src/app/pages/conversations-list/conversations-list.page.ts +647 -445
  66. package/src/app/pages/create-canned-response/create-canned-response-routing.module.ts +17 -0
  67. package/src/app/pages/create-canned-response/create-canned-response.module.ts +30 -0
  68. package/src/app/pages/create-canned-response/create-canned-response.page.html +150 -0
  69. package/src/app/pages/create-canned-response/create-canned-response.page.scss +55 -0
  70. package/src/app/pages/create-canned-response/create-canned-response.page.spec.ts +24 -0
  71. package/src/app/pages/create-canned-response/create-canned-response.page.ts +319 -0
  72. package/src/app/pages/create-requester/create-requester-routing.module.ts +17 -0
  73. package/src/app/pages/create-requester/create-requester.module.ts +28 -0
  74. package/src/app/pages/create-requester/create-requester.page.html +67 -0
  75. package/src/app/pages/create-requester/create-requester.page.scss +30 -0
  76. package/src/app/pages/create-requester/create-requester.page.spec.ts +24 -0
  77. package/src/app/pages/create-requester/create-requester.page.ts +138 -0
  78. package/src/app/pages/create-ticket/create-ticket-routing.module.ts +17 -0
  79. package/src/app/pages/create-ticket/create-ticket.module.ts +28 -0
  80. package/src/app/pages/create-ticket/create-ticket.page.html +171 -0
  81. package/src/app/pages/create-ticket/create-ticket.page.scss +52 -0
  82. package/src/app/pages/create-ticket/create-ticket.page.spec.ts +24 -0
  83. package/src/app/pages/create-ticket/create-ticket.page.ts +432 -0
  84. package/src/app/pages/loader-preview/loader-preview.page.ts +226 -166
  85. package/src/app/pages/profile-info/profile-info.page.html +2 -2
  86. package/src/app/pages/profile-info/profile-info.page.scss +13 -2
  87. package/src/app/services/tiledesk/tiledesk.service.ts +209 -0
  88. package/src/app/shared/shared.module.ts +1 -1
  89. package/src/assets/i18n/de.json +45 -7
  90. package/src/assets/i18n/en.json +41 -3
  91. package/src/assets/i18n/es.json +41 -3
  92. package/src/assets/i18n/fr.json +44 -6
  93. package/src/assets/i18n/it.json +41 -3
  94. package/src/assets/i18n/pt.json +41 -3
  95. package/src/assets/i18n/ru.json +42 -4
  96. package/src/assets/i18n/sr.json +265 -0
  97. package/src/assets/i18n/tr.json +41 -4
  98. package/src/assets/images/default-avatar-x-select.png +0 -0
  99. package/src/assets/images/priority_icons/high.svg +3 -0
  100. package/src/assets/images/priority_icons/high_v2.svg +14 -0
  101. package/src/assets/images/priority_icons/low.svg +10 -0
  102. package/src/assets/images/priority_icons/low_v2.svg +14 -0
  103. package/src/assets/images/priority_icons/medium.svg +16 -0
  104. package/src/assets/images/priority_icons/medium_v2.svg +11 -0
  105. package/src/assets/images/priority_icons/urgent.svg +4 -0
  106. package/src/assets/images/priority_icons/urgent_v2.svg +16 -0
  107. package/src/chat-config-mqtt.json +25 -16
  108. package/src/chat-config-template.json +5 -4
  109. package/src/chat-config.json +1 -0
  110. package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +8 -3
  111. package/src/chat21-core/utils/constants.ts +6 -1
  112. package/src/chat21-core/utils/utils-message.ts +19 -0
  113. package/src/global.scss +65 -76
  114. package/publish_pre.sh +0 -33
  115. package/publish_prod.sh +0 -33
@@ -1,41 +1,48 @@
1
- import { ArchivedConversationsHandlerService } from 'src/chat21-core/providers/abstract/archivedconversations-handler.service';
2
- import { Component, OnInit, ViewChild } from '@angular/core';
3
- import { IonContent, ModalController } from '@ionic/angular';
4
- import { ActivatedRoute, Router, NavigationExtras } from '@angular/router';
1
+ import { ArchivedConversationsHandlerService } from 'src/chat21-core/providers/abstract/archivedconversations-handler.service'
2
+ import { Component, OnInit, ViewChild } from '@angular/core'
3
+ import { IonContent, ModalController } from '@ionic/angular'
4
+ import { ActivatedRoute, Router, NavigationExtras } from '@angular/router'
5
5
  // config
6
- import { environment } from '../../../environments/environment';
6
+ import { environment } from '../../../environments/environment'
7
7
 
8
8
  // models
9
- import { ConversationModel } from 'src/chat21-core/models/conversation';
10
- import { UserModel } from 'src/chat21-core/models/user';
9
+ import { ConversationModel } from 'src/chat21-core/models/conversation'
10
+ import { UserModel } from 'src/chat21-core/models/user'
11
11
 
12
12
  // utils
13
- import { isInArray, checkPlatformIsMobile, presentModal, closeModal, convertMessage, isGroup, } from '../../../chat21-core/utils/utils';
14
-
15
- import { EventsService } from '../../services/events-service';
16
- import PerfectScrollbar from 'perfect-scrollbar'; // https://github.com/mdbootstrap/perfect-scrollbar
13
+ import {
14
+ isInArray,
15
+ checkPlatformIsMobile,
16
+ presentModal,
17
+ closeModal,
18
+ convertMessage,
19
+ isGroup,
20
+ } from '../../../chat21-core/utils/utils'
21
+
22
+ import { EventsService } from '../../services/events-service'
23
+ import PerfectScrollbar from 'perfect-scrollbar' // https://github.com/mdbootstrap/perfect-scrollbar
17
24
 
18
25
  // services
19
- import { ConversationsHandlerService } from 'src/chat21-core/providers/abstract/conversations-handler.service';
20
- import { ChatManager } from 'src/chat21-core/providers/chat-manager';
21
- import { NavProxyService } from '../../services/nav-proxy.service';
22
- import { TiledeskService } from '../../services/tiledesk/tiledesk.service';
23
- import { ConversationDetailPage } from '../conversation-detail/conversation-detail.page';
24
- import { ContactsDirectoryPage } from '../contacts-directory/contacts-directory.page';
25
- import { UnassignedConversationsPage } from '../unassigned-conversations/unassigned-conversations.page';
26
- import { ProfileInfoPage } from '../profile-info/profile-info.page';
27
- import { MessagingAuthService } from 'src/chat21-core/providers/abstract/messagingAuth.service';
28
- import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service';
29
- import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service';
30
- import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service';
31
- import { AppConfigProvider } from '../../services/app-config';
32
- import { Subscription } from 'rxjs';
33
- import { Platform } from '@ionic/angular';
26
+ import { ConversationsHandlerService } from 'src/chat21-core/providers/abstract/conversations-handler.service'
27
+ import { ChatManager } from 'src/chat21-core/providers/chat-manager'
28
+ import { NavProxyService } from '../../services/nav-proxy.service'
29
+ import { TiledeskService } from '../../services/tiledesk/tiledesk.service'
30
+ import { ConversationDetailPage } from '../conversation-detail/conversation-detail.page'
31
+ import { ContactsDirectoryPage } from '../contacts-directory/contacts-directory.page'
32
+ import { UnassignedConversationsPage } from '../unassigned-conversations/unassigned-conversations.page'
33
+ import { ProfileInfoPage } from '../profile-info/profile-info.page'
34
+ import { MessagingAuthService } from 'src/chat21-core/providers/abstract/messagingAuth.service'
35
+ import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service'
36
+ import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service'
37
+ import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service'
38
+ import { AppConfigProvider } from '../../services/app-config'
39
+ import { Subscription } from 'rxjs'
40
+ import { Platform } from '@ionic/angular'
34
41
  // Logger
35
- import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
36
- import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
37
- import { NetworkService } from 'src/app/services/network-service/network.service';
38
- import { Subject } from 'rxjs';
42
+ import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service'
43
+ import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance'
44
+ import { NetworkService } from 'src/app/services/network-service/network.service'
45
+ import { Subject } from 'rxjs'
39
46
  import { takeUntil } from 'rxjs/operators'
40
47
 
41
48
  @Component({
@@ -44,53 +51,54 @@ import { takeUntil } from 'rxjs/operators'
44
51
  styleUrls: ['./conversations-list.page.scss'],
45
52
  })
46
53
  export class ConversationListPage implements OnInit {
47
-
48
- @ViewChild('ioncontentconvlist', { static: false }) ionContentConvList: IonContent;
49
-
50
- private unsubscribe$: Subject<any> = new Subject<any>();
51
- private subscriptions: Array<string>;
52
- public tenant: string;
53
- public loggedUserUid: string;
54
- public conversations: Array<ConversationModel> = [];
55
- public archivedConversations: Array<ConversationModel> = [];
56
- public uidConvSelected: string;
57
- public conversationSelected: ConversationModel;
58
- public uidReciverFromUrl: string;
59
- public showPlaceholder = true;
60
- public numberOpenConv = 0;
61
- public loadingIsActive = true;
62
- public supportMode: boolean;
63
- public writeto_btn: boolean;
64
- public archived_btn: boolean;
65
- public convertMessage = convertMessage;
66
- private isShowMenuPage = false;
67
- private logger: LoggerService = LoggerInstance.getInstance();
68
- translationMapConversation: Map<string, string>;
69
- stylesMap: Map<string, string>;
54
+ @ViewChild('ioncontentconvlist', { static: false })
55
+ ionContentConvList: IonContent
56
+
57
+ private unsubscribe$: Subject<any> = new Subject<any>()
58
+ private subscriptions: Array<string>
59
+ public tenant: string
60
+ public loggedUserUid: string
61
+ public conversations: Array<ConversationModel> = []
62
+ public archivedConversations: Array<ConversationModel> = []
63
+ public uidConvSelected: string
64
+ public conversationSelected: ConversationModel
65
+ public uidReciverFromUrl: string
66
+ public showPlaceholder = true
67
+ public numberOpenConv = 0
68
+ public loadingIsActive = true
69
+ public supportMode: boolean
70
+ public writeto_btn: boolean
71
+ public archived_btn: boolean
72
+ public convertMessage = convertMessage
73
+ private isShowMenuPage = false
74
+ private logger: LoggerService = LoggerInstance.getInstance()
75
+ translationMapConversation: Map<string, string>
76
+ stylesMap: Map<string, string>
70
77
 
71
78
  public conversationType = 'active'
72
- headerTitle: string;
73
- subscription: Subscription;
79
+ headerTitle: string
80
+ subscription: Subscription
74
81
 
75
- public UNASSIGNED_CONVS_URL: any;
76
- public PROJECTS_FOR_PANEL_URL: any;
77
- public IFRAME_URL: any;
78
- public hasClickedOpenUnservedConvIframe: boolean = false;
79
- public lastProjectId: string;
80
- public isOnline: boolean = true;
81
- public checkInternet: boolean;
82
+ public UNASSIGNED_CONVS_URL: any
83
+ public PROJECTS_FOR_PANEL_URL: any
84
+ public IFRAME_URL: any
85
+ public hasClickedOpenUnservedConvIframe: boolean = false
86
+ public lastProjectId: string
87
+ public isOnline: boolean = true
88
+ public checkInternet: boolean
82
89
 
83
90
  public displayNewConvsItem: boolean = true
91
+ public archiveActionNotAllowed: boolean = false
84
92
 
85
93
  tooltipOptions = {
86
94
  'show-delay': 1500,
87
95
  'tooltip-class': 'chat-tooltip',
88
- 'theme': 'light',
89
- 'shadow': false,
96
+ theme: 'light',
97
+ shadow: false,
90
98
  'hide-delay-mobile': 0,
91
- 'hideDelayAfterClick': 3000,
92
- 'hide-delay': 200
93
- };
99
+ hideDelayAfterClick: 3000,
100
+ 'hide-delay': 200,
101
+ }
94
102
 
95
103
  constructor(
96
104
  private router: Router,
@@ -110,43 +118,50 @@ export class ConversationListPage implements OnInit {
110
118
  public appConfigProvider: AppConfigProvider,
111
119
  public platform: Platform,
112
120
  private networkService: NetworkService,
113
-
114
121
  ) {
115
- this.listenToAppCompConvsLengthOnInitConvs();
116
- this.listenToLogoutEvent();
117
- this.listenGoOnline();
118
- this.listenGoOffline();
119
- this.listenToSwPostMessage();
120
- this.listenSupportConvIdHasChanged();
122
+ this.listenToAppCompConvsLengthOnInitConvs()
123
+ this.listenToLogoutEvent()
124
+ this.listenGoOnline()
125
+ this.listenGoOffline()
126
+ this.listenToSwPostMessage()
127
+ this.listenSupportConvIdHasChanged()
121
128
  // this.listenDirectConvIdHasChanged();
122
- this.listenToCloseConvFromHeaderConversation();
123
-
129
+ this.listenToCloseConvFromHeaderConversation()
124
130
  }
125
131
 
126
-
127
-
128
132
  listenSupportConvIdHasChanged() {
129
133
  this.events.subscribe('supportconvid:haschanged', (IDConv) => {
130
134
  // console.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - convId', IDConv);
131
135
  if (IDConv) {
132
136
  // const conversationSelected = this.conversations.find(item => item.uid === convId);
133
137
  // this.onConversationSelected(conversationSelected)
134
- this.setUidConvSelected(IDConv, 'active');
138
+ this.setUidConvSelected(IDConv, 'active')
135
139
  }
136
140
  if (!IDConv) {
137
- this.logger.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - is the page without conv select');
141
+ this.logger.log(
142
+ '[CONVS-LIST-PAGE] - listen To convid:haschanged - is the page without conv select',
143
+ )
138
144
 
139
145
  const chatTabCount = +localStorage.getItem('tabCount')
140
- this.logger.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - chatTabCount ', chatTabCount);
146
+ this.logger.log(
147
+ '[CONVS-LIST-PAGE] - listen To convid:haschanged - chatTabCount ',
148
+ chatTabCount,
149
+ )
141
150
  if (chatTabCount && chatTabCount > 0) {
142
- this.logger.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - the chat is already open ', chatTabCount);
151
+ this.logger.log(
152
+ '[CONVS-LIST-PAGE] - listen To convid:haschanged - the chat is already open ',
153
+ chatTabCount,
154
+ )
143
155
  if (checkPlatformIsMobile()) {
144
- this.logger.log('[CONVS-LIST-PAGE] - the chat is in mobile mode ', checkPlatformIsMobile());
145
- this.events.publish('noparams:mobile', true);
156
+ this.logger.log(
157
+ '[CONVS-LIST-PAGE] - the chat is in mobile mode ',
158
+ checkPlatformIsMobile(),
159
+ )
160
+ this.events.publish('noparams:mobile', true)
146
161
  }
147
162
  }
148
163
  }
149
- });
164
+ })
150
165
  }
151
166
 
152
167
  // listenDirectConvIdHasChanged() {
@@ -158,13 +173,12 @@ export class ConversationListPage implements OnInit {
158
173
  // });
159
174
  // }
160
175
 
161
-
162
176
  // -----------------------------------------------
163
177
  // @ Lifehooks
164
178
  // -----------------------------------------------
165
179
  ngOnInit() {
166
- this.watchToConnectionStatus();
167
- this.getAppConfigToHideDiplayBtns();
180
+ this.watchToConnectionStatus()
181
+ this.getAppConfigToHideDiplayBtns()
168
182
 
169
183
  // const currentUrl = this.router.url;
170
184
  // this.logger.log('[CONVS-LIST-PAGE] current_url ngOnInit ', currentUrl);
@@ -212,80 +226,105 @@ export class ConversationListPage implements OnInit {
212
226
  }
213
227
 
214
228
  getConversationListHeight() {
215
- var scrollbar2element = document.getElementById('scrollbar2');
216
- console.log('[CONVS-LIST-PAGE] getConversationListHeight scrollbar2element', scrollbar2element)
229
+ var scrollbar2element = document.getElementById('scrollbar2')
230
+ this.logger.log('[CONVS-LIST-PAGE] getConversationListHeight scrollbar2element', scrollbar2element)
217
231
  }
218
232
 
233
+ // this.support_mode = null
234
+ // if( this.appConfigProvider.getConfig().supportMode === true || this.appConfigProvider.getConfig().supportMode === 'true') {
235
+ // this.support_mode = true
236
+ // } else if ( this.appConfigProvider.getConfig().supportMode === false || this.appConfigProvider.getConfig().supportMode === 'false') {
237
+ // this.support_mode = false
238
+ // } else if ( !this.appConfigProvider.getConfig().supportMode ) {
239
+ // this.support_mode = false
240
+ // }
219
241
 
220
242
  getAppConfigToHideDiplayBtns() {
221
- const appConfig = this.appConfigProvider.getConfig();
222
- // console.log('[ION-LIST-CONVS-COMP] - appConfig ', appConfig)
223
- if (appConfig && appConfig.supportMode) {
224
- this.supportMode = appConfig.supportMode;
225
- } else {
226
- this.supportMode = false;
243
+ const appConfig = this.appConfigProvider.getConfig()
244
+ // console.log('[CONVS-LIST-PAGE] - appConfig ', appConfig)
245
+ this.supportMode = null
246
+ if (appConfig && appConfig.supportMode === true || appConfig.supportMode === 'true') {
247
+ this.supportMode = true;
248
+ this.logger.log('[CONVS-LIST-PAGE] getAppConfigToHideDiplayBtns supportMode ', this.supportMode)
249
+ } else if (appConfig && appConfig.supportMode === false || appConfig.supportMode === 'false') {
250
+ this.supportMode = false
251
+ this.logger.log('[CONVS-LIST-PAGE] getAppConfigToHideDiplayBtns supportMode ', this.supportMode)
227
252
  }
228
- if (appConfig && appConfig.archivedButton) {
229
- this.archived_btn = appConfig.archivedButton;
230
- } else {
253
+ this.archived_btn = null
254
+ if (appConfig && appConfig.archivedButton === true || appConfig.archivedButton === 'true') {
255
+ this.archived_btn = true;
256
+ this.logger.log('[CONVS-LIST-PAGE] getAppConfigToHideDiplayBtns archived_btn ', this.archived_btn)
257
+ } else if (appConfig && appConfig.archivedButton === false || appConfig.archivedButton === 'false') {
231
258
  this.archived_btn = false;
259
+ this.logger.log('[CONVS-LIST-PAGE] getAppConfigToHideDiplayBtns archived_btn ', this.archived_btn)
232
260
  }
233
- if (appConfig && appConfig.writeToButton) {
234
- this.writeto_btn = appConfig.writeToButton;
235
- } else {
261
+ this.writeto_btn = null
262
+ if (appConfig && appConfig.writeToButton === true || appConfig.writeToButton === 'true') {
263
+ this.writeto_btn = true;
264
+ this.logger.log('[CONVS-LIST-PAGE] getAppConfigToHideDiplayBtns writeto_btn ', this.writeto_btn)
265
+ } else if (appConfig && appConfig.writeToButton === false || appConfig.writeToButton === 'false') {
236
266
  this.writeto_btn = false;
267
+ this.logger.log('[CONVS-LIST-PAGE] getAppConfigToHideDiplayBtns writeto_btn ', this.writeto_btn)
237
268
  }
238
269
  // console.log('[ION-LIST-CONVS-COMP] - supportMode ', this.supportMode)
239
270
  }
240
271
 
241
272
  watchToConnectionStatus() {
242
- this.networkService.checkInternetFunc().subscribe(isOnline => {
273
+ this.networkService.checkInternetFunc().subscribe((isOnline) => {
243
274
  this.checkInternet = isOnline
244
275
  this.logger.log('[ION-LIST-CONVS-COMP] - watchToConnectionStatus - isOnline', this.checkInternet)
245
276
 
246
277
  // checking internet connection
247
278
  if (this.checkInternet == true) {
248
-
249
- this.isOnline = true;
279
+ this.isOnline = true
250
280
  } else {
251
- this.isOnline = false;
281
+ this.isOnline = false
252
282
  }
253
- });
283
+ })
254
284
  }
255
285
 
256
-
257
286
  ionViewWillEnter() {
258
287
  this.logger.log('Called ionViewDidEnter')
259
- this.logger.log('[CONVS-LIST-PAGE] ionViewWillEnter uidConvSelected', this.uidConvSelected);
260
- this.listnerStart();
288
+ this.logger.log(
289
+ '[CONVS-LIST-PAGE] ionViewWillEnter uidConvSelected',
290
+ this.uidConvSelected,
291
+ )
292
+ this.listnerStart()
261
293
 
262
294
  // exit from app with hardware back button
263
295
  this.subscription = this.platform.backButton.subscribe(() => {
264
- navigator['app'].exitApp();
265
- });
296
+ navigator['app'].exitApp()
297
+ })
266
298
  }
267
299
 
268
300
  // unsubscribe backButton.subscribe method to not use from other page
269
301
  ionViewWillLeave() {
270
302
  this.logger.log('Called ionViewWillLeave')
271
- this.subscription.unsubscribe();
303
+ this.subscription.unsubscribe()
272
304
  }
273
305
 
274
306
  ionViewDidEnter() { }
275
307
 
276
308
  getLastProjectId(projectid: string) {
277
- this.logger.log('[CONVS-LIST-PAGE] - GET LAST PROJECT ID', projectid);
278
- this.lastProjectId = projectid;
309
+ this.logger.log('[CONVS-LIST-PAGE] - GET LAST PROJECT ID', projectid)
310
+ this.lastProjectId = projectid
279
311
  }
280
312
 
281
313
  openUnsevedConversationIframe(event) {
282
314
  this.logger.log('[CONVS-LIST-PAGE] openUnsevedConversationIframe ', event)
283
315
  this.hasClickedOpenUnservedConvIframe = true
284
- this.logger.log('[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME', this.hasClickedOpenUnservedConvIframe);
285
- const DASHBOARD_BASE_URL = this.appConfigProvider.getConfig().dashboardUrl;
316
+ this.logger.log(
317
+ '[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME',
318
+ this.hasClickedOpenUnservedConvIframe,
319
+ )
320
+ const DASHBOARD_BASE_URL = this.appConfigProvider.getConfig().dashboardUrl
286
321
  // http://localhost:4204/#/projects-for-panel
287
- this.PROJECTS_FOR_PANEL_URL = DASHBOARD_BASE_URL + '#/projects-for-panel';
288
- this.UNASSIGNED_CONVS_URL = DASHBOARD_BASE_URL + '#/project/' + this.lastProjectId + '/unserved-request-for-panel';
322
+ this.PROJECTS_FOR_PANEL_URL = DASHBOARD_BASE_URL + '#/projects-for-panel'
323
+ this.UNASSIGNED_CONVS_URL =
324
+ DASHBOARD_BASE_URL +
325
+ '#/project/' +
326
+ this.lastProjectId +
327
+ '/unserved-request-for-panel'
289
328
 
290
329
  if (event === 'pinbtn') {
291
330
  this.IFRAME_URL = this.PROJECTS_FOR_PANEL_URL
@@ -293,7 +332,10 @@ export class ConversationListPage implements OnInit {
293
332
  this.IFRAME_URL = this.UNASSIGNED_CONVS_URL
294
333
  }
295
334
 
296
- this.logger.log('[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME > UNASSIGNED CONVS URL', this.UNASSIGNED_CONVS_URL);
335
+ this.logger.log(
336
+ '[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME > UNASSIGNED CONVS URL',
337
+ this.UNASSIGNED_CONVS_URL,
338
+ )
297
339
  this.openUnassignedConversations(this.IFRAME_URL, event)
298
340
  }
299
341
 
@@ -304,180 +346,233 @@ export class ConversationListPage implements OnInit {
304
346
  if (checkPlatformIsMobile()) {
305
347
  presentModal(this.modalController, UnassignedConversationsPage, {
306
348
  iframe_URL: IFRAME_URL,
307
- callerBtn: event
308
- });
349
+ callerBtn: event,
350
+ })
309
351
  } else {
310
352
  this.navService.push(UnassignedConversationsPage, {
311
353
  iframe_URL: IFRAME_URL,
312
- callerBtn: event
313
-
314
- });
354
+ callerBtn: event,
355
+ })
315
356
  }
316
357
  }
317
358
 
318
359
  _closeContactsDirectory() {
319
360
  try {
320
- closeModal(this.modalController);
361
+ closeModal(this.modalController)
321
362
  } catch (err) {
322
- this.logger.error('[CONVS-LIST-PAGE] closeContactsDirectory -> error:', err);
363
+ this.logger.error(
364
+ '[CONVS-LIST-PAGE] closeContactsDirectory -> error:',
365
+ err,
366
+ )
323
367
  }
324
368
  }
325
369
 
326
-
327
370
  listenToSwPostMessage() {
328
- this.logger.log('[CONVS-LIST-PAGE] listenToNotificationCLick - CALLED: ');
329
- const that = this;
371
+ this.logger.log('[CONVS-LIST-PAGE] listenToNotificationCLick - CALLED: ')
372
+ const that = this
330
373
  if (navigator && navigator.serviceWorker) {
331
-
332
374
  navigator.serviceWorker.addEventListener('message', function (event) {
333
-
334
- that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event data: ', event.data);
335
- that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event data data: ', event.data['data']);
336
- that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event data data typeof: ', typeof event.data['data']);
375
+ that.logger.log(
376
+ '[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event data: ',
377
+ event.data,
378
+ )
379
+ that.logger.log(
380
+ '[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event data data: ',
381
+ event.data['data'],
382
+ )
383
+ that.logger.log(
384
+ '[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event data data typeof: ',
385
+ typeof event.data['data'],
386
+ )
337
387
  let uidConvSelected = ''
338
388
  if (event.data && event.data['conversWith']) {
339
- uidConvSelected = event.data['conversWith'];
340
- }
341
- else {
342
- that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - DIFFERENT MSG');
343
- return;
389
+ uidConvSelected = event.data['conversWith']
390
+ } else {
391
+ that.logger.log(
392
+ '[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - DIFFERENT MSG',
393
+ )
394
+ return
344
395
  }
345
396
 
346
- that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event dataObjct uidConvSelected: ', uidConvSelected);
347
- that.logger.log('[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker that.conversations: ', that.conversations);
348
- const conversationSelected = that.conversations.find(item => item.uid === uidConvSelected);
397
+ that.logger.log(
398
+ '[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker event dataObjct uidConvSelected: ',
399
+ uidConvSelected,
400
+ )
401
+ that.logger.log(
402
+ '[CONVS-LIST-PAGE] FIREBASE-NOTIFICATION listenToNotificationCLick - Received a message from service worker that.conversations: ',
403
+ that.conversations,
404
+ )
405
+ const conversationSelected = that.conversations.find(
406
+ (item) => item.uid === uidConvSelected,
407
+ )
349
408
  if (conversationSelected) {
350
-
351
- that.conversationSelected = conversationSelected;
352
- that.logger.log('[CONVS-LIST-PAGE] listenToNotificationCLick- Received a message from service worker event conversationSelected: ', that.conversationSelected);
409
+ that.conversationSelected = conversationSelected
410
+ that.logger.log(
411
+ '[CONVS-LIST-PAGE] listenToNotificationCLick- Received a message from service worker event conversationSelected: ',
412
+ that.conversationSelected,
413
+ )
353
414
 
354
415
  that.navigateByUrl('active', uidConvSelected)
355
416
  }
356
- });
417
+ })
357
418
  }
358
419
  }
359
420
 
360
-
361
421
  private listnerStart() {
362
- const that = this;
363
- this.chatManager.BSStart
364
- .pipe(
365
- takeUntil(that.unsubscribe$)
366
- )
367
- .subscribe((data: any) => {
368
- this.logger.log('[CONVS-LIST-PAGE] - BSStart SUBSCR DATA - Current user *****', data);
422
+ const that = this
423
+ this.chatManager.BSStart.pipe(takeUntil(that.unsubscribe$)).subscribe(
424
+ (data: any) => {
425
+ this.logger.log(
426
+ '[CONVS-LIST-PAGE] - BSStart SUBSCR DATA - Current user *****',
427
+ data,
428
+ )
369
429
  if (data) {
370
- that.initialize();
430
+ that.initialize()
371
431
  }
372
- }, error => {
373
- this.logger.error('[CONVS-LIST-PAGE] - BSStart SUBSCR - ERROR: ', error);
374
- }, () => {
432
+ },
433
+ (error) => {
434
+ this.logger.error('[CONVS-LIST-PAGE] - BSStart SUBSCR - ERROR: ', error)
435
+ },
436
+ () => {
375
437
  this.logger.log('[CONVS-LIST-PAGE] - BSStart SUBSCR * COMPLETE *')
376
- });
438
+ },
439
+ )
377
440
  }
378
441
 
379
-
380
442
  // ------------------------------------------------------------------ //
381
443
  // Init convrsation handler
382
444
  // ------------------------------------------------------------------ //
383
445
  initConversationsHandler() {
384
- this.conversations = this.conversationsHandlerService.conversations;
446
+ this.conversations = this.conversationsHandlerService.conversations
385
447
  this.logger.log('[CONVS-LIST-PAGE] - CONVERSATIONS ', this.conversations)
386
448
  // save conversationHandler in chatManager
387
- this.chatManager.setConversationsHandler(this.conversationsHandlerService);
388
- this.showPlaceholder = false;
449
+ this.chatManager.setConversationsHandler(this.conversationsHandlerService)
450
+ this.showPlaceholder = false
389
451
  }
390
452
 
391
-
392
-
393
453
  initArchivedConversationsHandler() {
394
- const keysConversation = ['CLOSED', 'Resolve'];
395
- this.translationMapConversation = this.translateService.translateLanguage(keysConversation);
454
+ const keysConversation = ['CLOSED', 'Resolve']
455
+ this.translationMapConversation = this.translateService.translateLanguage(
456
+ keysConversation,
457
+ )
396
458
 
397
459
  this.archivedConversationsHandlerService.subscribeToConversations(() => {
398
- this.logger.log('[CONVS-LIST-PAGE]-CONVS - conversations archived length ', this.archivedConversations.length)
399
-
400
- });
460
+ this.logger.log(
461
+ '[CONVS-LIST-PAGE]-CONVS - conversations archived length ',
462
+ this.archivedConversations.length,
463
+ )
464
+ })
401
465
 
402
- this.archivedConversations = this.archivedConversationsHandlerService.archivedConversations;
403
- this.logger.log('[CONVS-LIST-PAGE] archived conversation', this.archivedConversations)
466
+ this.archivedConversations = this.archivedConversationsHandlerService.archivedConversations
467
+ this.logger.log(
468
+ '[CONVS-LIST-PAGE] archived conversation',
469
+ this.archivedConversations,
470
+ )
404
471
 
405
472
  // save archivedConversationsHandlerService in chatManager
406
- this.chatManager.setArchivedConversationsHandler(this.archivedConversationsHandlerService);
407
-
408
- this.logger.log('[CONVS-LIST-PAGE]-CONVS SubscribeToConversations - conversations archived length ', this.archivedConversations.length)
409
- if (!this.archivedConversations || this.archivedConversations.length === 0) {
410
- this.loadingIsActive = false;
473
+ this.chatManager.setArchivedConversationsHandler(
474
+ this.archivedConversationsHandlerService,
475
+ )
476
+
477
+ this.logger.log(
478
+ '[CONVS-LIST-PAGE]-CONVS SubscribeToConversations - conversations archived length ',
479
+ this.archivedConversations.length,
480
+ )
481
+ if (
482
+ !this.archivedConversations ||
483
+ this.archivedConversations.length === 0
484
+ ) {
485
+ this.loadingIsActive = false
411
486
  }
412
487
  }
413
488
 
414
-
415
489
  // ----------------------------------------------------------------------------------------------------
416
- // To display "No conversation yet" MESSAGE in conversazion list
490
+ // To display "No conversation yet" MESSAGE in conversazion list
417
491
  // this.loadingIsActive is set to false only if on init there are not conversation
418
492
  // otherwise loadingIsActive remains set to true and the message "No conversation yet" is not displayed
419
493
  // to fix this
420
- // - for the direct conversation
421
- // ----------------------------------------------------------------------------------------------------
494
+ // - for the direct conversation
495
+ // ----------------------------------------------------------------------------------------------------
422
496
  listenToAppCompConvsLengthOnInitConvs() {
423
- this.events.subscribe('appcompSubscribeToConvs:loadingIsActive', (loadingIsActive) => {
424
- this.logger.log('[CONVS-LIST-PAGE]-CONVS loadingIsActive', loadingIsActive);
425
- if (loadingIsActive === false) {
426
- this.loadingIsActive = false
427
- }
428
- });
497
+ this.events.subscribe(
498
+ 'appcompSubscribeToConvs:loadingIsActive',
499
+ (loadingIsActive) => {
500
+ this.logger.log(
501
+ '[CONVS-LIST-PAGE]-CONVS loadingIsActive',
502
+ loadingIsActive,
503
+ )
504
+ if (loadingIsActive === false) {
505
+ this.loadingIsActive = false
506
+ }
507
+ },
508
+ )
429
509
  }
430
510
 
431
511
  listenGoOnline() {
432
512
  this.events.subscribe('go:online', (goonline) => {
433
- this.logger.info('[CONVS-LIST-PAGE] - listen To go:online - goonline', goonline);
513
+ this.logger.info(
514
+ '[CONVS-LIST-PAGE] - listen To go:online - goonline',
515
+ goonline,
516
+ )
434
517
  // this.events.unsubscribe('profileInfoButtonClick:logout')
435
518
  if (goonline === true) {
436
519
  this.displayNewConvsItem = true
437
520
  }
438
- });
521
+ })
439
522
  }
440
523
 
441
524
  listenGoOffline() {
442
525
  this.events.subscribe('go:offline', (offline) => {
443
- this.logger.info('[CONVS-LIST-PAGE] - listen To go:offline - offline', offline);
526
+ this.logger.info(
527
+ '[CONVS-LIST-PAGE] - listen To go:offline - offline',
528
+ offline,
529
+ )
444
530
  // this.events.unsubscribe('profileInfoButtonClick:logout')
445
531
  if (offline === true) {
446
532
  this.displayNewConvsItem = false
447
533
  }
448
- });
534
+ })
449
535
  }
450
536
 
451
537
  listenToLogoutEvent() {
452
- this.events.subscribe('profileInfoButtonClick:logout', (hasclickedlogout) => {
453
- this.logger.info('[CONVS-LIST-PAGE] - listenToLogoutEvent - hasclickedlogout', hasclickedlogout);
454
-
455
-
456
- this.conversations = []
457
- this.conversationsHandlerService.conversations = [];
458
- this.uidConvSelected = null;
459
-
460
- this.logger.log('[CONVS-LIST-PAGE] - listenToLogoutEvent - CONVERSATIONS ', this.conversations)
461
- this.logger.log('[CONVS-LIST-PAGE] - listenToLogoutEvent - uidConvSelected ', this.uidConvSelected)
462
- if (hasclickedlogout === true) {
463
- this.loadingIsActive = false
464
- }
465
- });
538
+ this.events.subscribe(
539
+ 'profileInfoButtonClick:logout',
540
+ (hasclickedlogout) => {
541
+ this.logger.info(
542
+ '[CONVS-LIST-PAGE] - listenToLogoutEvent - hasclickedlogout',
543
+ hasclickedlogout,
544
+ )
545
+
546
+ this.conversations = []
547
+ this.conversationsHandlerService.conversations = []
548
+ this.uidConvSelected = null
549
+
550
+ this.logger.log(
551
+ '[CONVS-LIST-PAGE] - listenToLogoutEvent - CONVERSATIONS ',
552
+ this.conversations,
553
+ )
554
+ this.logger.log(
555
+ '[CONVS-LIST-PAGE] - listenToLogoutEvent - uidConvSelected ',
556
+ this.uidConvSelected,
557
+ )
558
+ if (hasclickedlogout === true) {
559
+ this.loadingIsActive = false
560
+ }
561
+ },
562
+ )
466
563
  }
467
564
 
468
-
469
- // ------------------------------------------------------------------
565
+ // ------------------------------------------------------------------
470
566
  // SUBSCRIPTIONS
471
567
  // ------------------------------------------------------------------
472
568
  initSubscriptions() {
473
569
  this.logger.log('[CONVS-LIST-PAGE] - CALLING - initSubscriptions ')
474
- let key = '';
570
+ let key = ''
475
571
 
476
-
477
- key = 'loggedUser:logout';
572
+ key = 'loggedUser:logout'
478
573
  if (!isInArray(key, this.subscriptions)) {
479
- this.subscriptions.push(key);
480
- this.events.subscribe(key, this.subscribeLoggedUserLogout);
574
+ this.subscriptions.push(key)
575
+ this.events.subscribe(key, this.subscribeLoggedUserLogout)
481
576
  }
482
577
 
483
578
  // key = 'readAllMessages';
@@ -486,10 +581,10 @@ export class ConversationListPage implements OnInit {
486
581
  // this.events.subscribe(key, this.readAllMessages);
487
582
  // }
488
583
 
489
- key = 'profileInfoButtonClick:changed';
584
+ key = 'profileInfoButtonClick:changed'
490
585
  if (!isInArray(key, this.subscriptions)) {
491
- this.subscriptions.push(key);
492
- this.events.subscribe(key, this.subscribeProfileInfoButtonClicked);
586
+ this.subscriptions.push(key)
587
+ this.events.subscribe(key, this.subscribeProfileInfoButtonClicked)
493
588
  }
494
589
 
495
590
  // this.conversationsHandlerService.readAllMessages.subscribe((conversationId: string) => {
@@ -497,67 +592,89 @@ export class ConversationListPage implements OnInit {
497
592
  // this.readAllMessages(conversationId);
498
593
  // });
499
594
 
500
- this.conversationsHandlerService.conversationAdded.subscribe((conversation: ConversationModel) => {
501
- // this.logger.log('[CONVS-LIST-PAGE] ***** conversationsAdded *****', conversation);
502
- // that.conversationsChanged(conversations);
503
- if (conversation) {
504
- this.onImageLoaded(conversation)
505
- this.onConversationLoaded(conversation)
506
- }
507
- });
508
-
509
- this.conversationsHandlerService.conversationChanged.subscribe((conversation: ConversationModel) => {
510
- // this.logger.log('[CONVS-LIST-PAGE] ***** subscribeConversationChanged *****', conversation);
511
- // that.conversationsChanged(conversations)
512
- if (conversation) {
513
- this.onImageLoaded(conversation)
514
- this.onConversationLoaded(conversation)
515
- }
516
- });
517
-
518
- this.conversationsHandlerService.conversationRemoved.subscribe((conversation: ConversationModel) => {
519
- this.logger.log('[CONVS-LIST-PAGE] ***** conversationsRemoved *****', conversation);
520
- });
521
-
522
- this.archivedConversationsHandlerService.archivedConversationAdded.subscribe((conversation: ConversationModel) => {
523
- this.logger.log('[CONVS-LIST-PAGE] ***** archivedConversationAdded *****', conversation);
524
- // that.conversationsChanged(conversations);
525
- if (conversation) {
526
- this.onImageLoaded(conversation)
527
- this.onConversationLoaded(conversation)
528
- }
529
- });
595
+ this.conversationsHandlerService.conversationAdded.subscribe(
596
+ (conversation: ConversationModel) => {
597
+ // this.logger.log('[CONVS-LIST-PAGE] ***** conversationsAdded *****', conversation);
598
+ // that.conversationsChanged(conversations);
599
+ if (conversation) {
600
+ this.onImageLoaded(conversation)
601
+ this.onConversationLoaded(conversation)
602
+ }
603
+ },
604
+ )
605
+
606
+ this.conversationsHandlerService.conversationChanged.subscribe(
607
+ (conversation: ConversationModel) => {
608
+ // this.logger.log('[CONVS-LIST-PAGE] ***** subscribeConversationChanged *****', conversation);
609
+ // that.conversationsChanged(conversations)
610
+ if (conversation) {
611
+ this.onImageLoaded(conversation)
612
+ this.onConversationLoaded(conversation)
613
+ }
614
+ },
615
+ )
616
+
617
+ this.conversationsHandlerService.conversationRemoved.subscribe(
618
+ (conversation: ConversationModel) => {
619
+ this.logger.log(
620
+ '[CONVS-LIST-PAGE] ***** conversationsRemoved *****',
621
+ conversation,
622
+ )
623
+ },
624
+ )
625
+
626
+ this.archivedConversationsHandlerService.archivedConversationAdded.subscribe(
627
+ (conversation: ConversationModel) => {
628
+ this.logger.log(
629
+ '[CONVS-LIST-PAGE] ***** archivedConversationAdded *****',
630
+ conversation,
631
+ )
632
+ // that.conversationsChanged(conversations);
633
+ if (conversation) {
634
+ this.onImageLoaded(conversation)
635
+ this.onConversationLoaded(conversation)
636
+ }
637
+ },
638
+ )
530
639
  }
531
640
 
532
641
  // ------------------------------------------------------------------------------------
533
642
  // @ SUBSCRIBE TO LOGGED USER LOGOUT ??????????? SEEMS NOT USED ?????????????????
534
643
  // ------------------------------------------------------------------------------------
535
644
  subscribeLoggedUserLogout = () => {
536
- this.conversations = [];
537
- this.uidConvSelected = null;
538
- this.logger.log('[CONVS-LIST-PAGE] - subscribeLoggedUserLogout conversations ', this.conversations);
539
- this.logger.log('[CONVS-LIST-PAGE] - subscribeLoggedUserLogout uidConvSelected ', this.uidConvSelected);
645
+ this.conversations = []
646
+ this.uidConvSelected = null
647
+ this.logger.log(
648
+ '[CONVS-LIST-PAGE] - subscribeLoggedUserLogout conversations ',
649
+ this.conversations,
650
+ )
651
+ this.logger.log(
652
+ '[CONVS-LIST-PAGE] - subscribeLoggedUserLogout uidConvSelected ',
653
+ this.uidConvSelected,
654
+ )
540
655
  }
541
656
 
542
-
543
-
544
657
  // ------------------------------------------------------------------------------------
545
658
  // @ SUBSCRIBE TO CONVERSATION CHANGED ??????????? SEEMS NOT USED ?????????????????
546
659
  // ------------------------------------------------------------------------------------
547
660
  conversationsChanged = (conversations: ConversationModel[]) => {
548
- this.numberOpenConv = this.conversationsHandlerService.countIsNew();
549
- this.logger.log('[CONVS-LIST-PAGE] - conversationsChanged - NUMB OF CONVERSATIONS: ', this.numberOpenConv);
661
+ this.numberOpenConv = this.conversationsHandlerService.countIsNew()
662
+ this.logger.log(
663
+ '[CONVS-LIST-PAGE] - conversationsChanged - NUMB OF CONVERSATIONS: ',
664
+ this.numberOpenConv,
665
+ )
550
666
  // console.log('conversationsChanged »»»»»»»»» uidConvSelected', that.conversations[0], that.uidConvSelected);
551
667
  if (this.uidConvSelected && !this.conversationSelected) {
552
- const conversationSelected = this.conversations.find(item => item.uid === this.uidConvSelected);
668
+ const conversationSelected = this.conversations.find(
669
+ (item) => item.uid === this.uidConvSelected,
670
+ )
553
671
  if (conversationSelected) {
554
- this.conversationSelected = conversationSelected;
555
- this.setUidConvSelected(this.uidConvSelected);
672
+ this.conversationSelected = conversationSelected
673
+ this.setUidConvSelected(this.uidConvSelected)
556
674
  }
557
675
  }
558
676
  }
559
677
 
560
-
561
678
  /**
562
679
  * ::: subscribeChangedConversationSelected :::
563
680
  * evento richiamato quando si seleziona un utente nell'elenco degli user
@@ -567,14 +684,27 @@ export class ConversationListPage implements OnInit {
567
684
  // !!!!!! IS USED? ?????
568
685
  // ------------------------------
569
686
  subscribeChangedConversationSelected = (user: UserModel, type: string) => {
570
- this.logger.log('[CONVS-LIST-PAGE] ************** subscribeUidConvSelectedChanged navigateByUrl', user, type);
571
- this.uidConvSelected = user.uid;
572
- this.logger.log('[CONVS-LIST-PAGE] ************** uidConvSelected ', this.uidConvSelected);
687
+ this.logger.log(
688
+ '[CONVS-LIST-PAGE] ************** subscribeUidConvSelectedChanged navigateByUrl',
689
+ user,
690
+ type,
691
+ )
692
+ this.uidConvSelected = user.uid
693
+ this.logger.log(
694
+ '[CONVS-LIST-PAGE] ************** uidConvSelected ',
695
+ this.uidConvSelected,
696
+ )
573
697
  // this.conversationsHandlerService.uidConvSelected = user.uid;
574
- const conversationSelected = this.conversations.find(item => item.uid === this.uidConvSelected);
698
+ const conversationSelected = this.conversations.find(
699
+ (item) => item.uid === this.uidConvSelected,
700
+ )
575
701
  if (conversationSelected) {
576
- this.logger.log('[CONVS-LIST-PAGE] --> uidConvSelected: ', this.conversationSelected, this.uidConvSelected);
577
- this.conversationSelected = conversationSelected;
702
+ this.logger.log(
703
+ '[CONVS-LIST-PAGE] --> uidConvSelected: ',
704
+ this.conversationSelected,
705
+ this.uidConvSelected,
706
+ )
707
+ this.conversationSelected = conversationSelected
578
708
  }
579
709
  // this.router.navigateByUrl('conversation-detail/' + user.uid + '?conversationWithFullname=' + user.fullname);
580
710
  }
@@ -584,22 +714,28 @@ export class ConversationListPage implements OnInit {
584
714
  * evento richiamato quando si seleziona bottone profile-info-modal
585
715
  */
586
716
  subscribeProfileInfoButtonClicked = (event: string) => {
587
- this.logger.log('[CONVS-LIST-PAGE] ************** subscribeProfileInfoButtonClicked: ', event);
717
+ this.logger.log(
718
+ '[CONVS-LIST-PAGE] ************** subscribeProfileInfoButtonClicked: ',
719
+ event,
720
+ )
588
721
  if (event === 'displayArchived') {
589
- this.initArchivedConversationsHandler();
722
+ this.initArchivedConversationsHandler()
590
723
  // this.openArchivedConversationsModal()
591
724
  this.conversationType = 'archived'
592
725
 
593
726
  // let storedArchivedConv = localStorage.getItem('activeConversationSelected');
594
- const keys = ['LABEL_ARCHIVED'];
727
+ const keys = ['LABEL_ARCHIVED']
595
728
  // const keys = ['History'];
596
729
 
597
- this.headerTitle = this.translateService.translateLanguage(keys).get(keys[0]);
598
-
730
+ this.headerTitle = this.translateService
731
+ .translateLanguage(keys)
732
+ .get(keys[0])
599
733
  } else if (event === 'displayContact') {
600
734
  this.conversationType = 'archived'
601
- const keys = ['LABEL_CONTACTS'];
602
- this.headerTitle = this.translateService.translateLanguage(keys).get(keys[0]);
735
+ const keys = ['LABEL_CONTACTS']
736
+ this.headerTitle = this.translateService
737
+ .translateLanguage(keys)
738
+ .get(keys[0])
603
739
  }
604
740
  }
605
741
 
@@ -613,12 +749,10 @@ export class ConversationListPage implements OnInit {
613
749
  // console.log('ConversationListPage - storedActiveConv Objct: ', storedActiveConvObjct);
614
750
  // this.navigateByUrl('active', storedActiveConvObjct.uid)
615
751
  // } else {
616
- // // da implementare se nn c'è stata nessuna conv attive selezionata
752
+ // // da implementare se nn c'è stata nessuna conv attive selezionata
617
753
  // }
618
-
619
754
  }
620
755
 
621
-
622
756
  // ------------------------------------------------------------------//
623
757
  // END SUBSCRIPTIONS
624
758
  // ------------------------------------------------------------------//
@@ -640,8 +774,6 @@ export class ConversationListPage implements OnInit {
640
774
  // })
641
775
  // }
642
776
 
643
-
644
-
645
777
  // ------------------------------------------------------------------//
646
778
  // BEGIN FUNCTIONS
647
779
  // ------------------------------------------------------------------//
@@ -649,22 +781,24 @@ export class ConversationListPage implements OnInit {
649
781
  * ::: initialize :::
650
782
  */
651
783
  initialize() {
652
- const appconfig = this.appConfigProvider.getConfig();
653
- this.tenant = appconfig.firebaseConfig.tenant;
654
- this.logger.log('[CONVS-LIST-PAGE] - initialize -> firebaseConfig tenant ', this.tenant);
784
+ const appconfig = this.appConfigProvider.getConfig()
785
+ this.tenant = appconfig.firebaseConfig.tenant
786
+ this.logger.log(
787
+ '[CONVS-LIST-PAGE] - initialize -> firebaseConfig tenant ',
788
+ this.tenant,
789
+ )
655
790
 
656
791
  if (this.tiledeskAuthService.getCurrentUser()) {
657
- this.loggedUserUid = this.tiledeskAuthService.getCurrentUser().uid;
792
+ this.loggedUserUid = this.tiledeskAuthService.getCurrentUser().uid
658
793
  }
659
- this.subscriptions = [];
660
- this.initConversationsHandler();
661
- this.initVariables();
662
- this.initSubscriptions();
794
+ this.subscriptions = []
795
+ this.initConversationsHandler()
796
+ this.initVariables()
797
+ this.initSubscriptions()
663
798
 
664
799
  // this.initHandlerEventEmitter();
665
800
  }
666
801
 
667
-
668
802
  /**
669
803
  * ::: initVariables :::
670
804
  * al caricamento della pagina:
@@ -679,46 +813,45 @@ export class ConversationListPage implements OnInit {
679
813
  // It only works on BSStart.subscribe! it is useful or can be eliminated
680
814
  // --------------------------------------------------------
681
815
  initVariables() {
682
- this.logger.log('[CONVS-LIST-PAGE] uidReciverFromUrl:: ' + this.uidReciverFromUrl);
683
- this.logger.log('[CONVS-LIST-PAGE] loggedUserUid:: ' + this.loggedUserUid);
684
- this.logger.log('[CONVS-LIST-PAGE] tenant:: ' + this.tenant);
685
- if (this.route.component['name'] !== "ConversationListPage") {
686
-
816
+ this.logger.log(
817
+ '[CONVS-LIST-PAGE] uidReciverFromUrl:: ' + this.uidReciverFromUrl,
818
+ )
819
+ this.logger.log('[CONVS-LIST-PAGE] loggedUserUid:: ' + this.loggedUserUid)
820
+ this.logger.log('[CONVS-LIST-PAGE] tenant:: ' + this.tenant)
821
+ if (this.route.component['name'] !== 'ConversationListPage') {
687
822
  if (this.route && this.route.snapshot && this.route.snapshot.firstChild) {
688
- const IDConv = this.route.snapshot.firstChild.paramMap.get('IDConv');
689
- this.logger.log('[CONVS-LIST-PAGE] conversationWith 2: ', IDConv);
823
+ const IDConv = this.route.snapshot.firstChild.paramMap.get('IDConv')
824
+ this.logger.log('[CONVS-LIST-PAGE] conversationWith 2: ', IDConv)
690
825
  if (IDConv) {
691
- this.setUidConvSelected(IDConv);
826
+ this.setUidConvSelected(IDConv)
692
827
  } else {
693
-
694
- this.logger.log('[CONVS-LIST-PAGE] conversationWith 2 (else): ', IDConv);
828
+ this.logger.log(
829
+ '[CONVS-LIST-PAGE] conversationWith 2 (else): ',
830
+ IDConv,
831
+ )
695
832
  }
696
833
  }
697
834
  }
698
835
  }
699
836
 
700
-
701
-
702
837
  /**
703
838
  * ::: setUidConvSelected :::
704
839
  */
705
- setUidConvSelected(uidConvSelected: string, conversationType?: string,) {
840
+ setUidConvSelected(uidConvSelected: string, conversationType?: string) {
706
841
  this.logger.log('[CONVS-LIST-PAGE] setuidCOnvSelected', uidConvSelected)
707
- this.uidConvSelected = uidConvSelected;
842
+ this.uidConvSelected = uidConvSelected
708
843
  this.logger.log('uidConvSelected', uidConvSelected)
709
844
  // this.conversationsHandlerService.uidConvSelected = uidConvSelected;
710
845
  if (uidConvSelected) {
711
- let conversationSelected;
846
+ let conversationSelected
712
847
  if (conversationType === 'active') {
713
- conversationSelected = this.conversations.find(item => item.uid === this.uidConvSelected);
714
- } else if (conversationType === 'archived') {
715
- conversationSelected = this.archivedConversations.find(item => item.uid === this.uidConvSelected);
716
- }
848
+ conversationSelected = this.conversations.find((item) => item.uid === this.uidConvSelected)
849
+ } else if (conversationType === 'archived') { conversationSelected = this.archivedConversations.find((item) => item.uid === this.uidConvSelected) }
717
850
  if (conversationSelected) {
718
- this.logger.log('[CONVS-LIST-PAGE] conversationSelected', conversationSelected);
719
- this.logger.log('[CONVS-LIST-PAGE] the conversation ', this.conversationSelected, ' has already been loaded');
720
- this.conversationSelected = conversationSelected;
721
- this.logger.log('[CONVS-LIST-PAGE] setUidConvSelected: ', this.conversationSelected);
851
+ this.logger.log('[CONVS-LIST-PAGE] conversationSelected', conversationSelected,)
852
+ this.logger.log('[CONVS-LIST-PAGE] the conversation ', this.conversationSelected, ' has already been loaded')
853
+ this.conversationSelected = conversationSelected
854
+ this.logger.log('[CONVS-LIST-PAGE] setUidConvSelected: ', this.conversationSelected)
722
855
  }
723
856
  }
724
857
  }
@@ -727,29 +860,31 @@ export class ConversationListPage implements OnInit {
727
860
  this.logger.log('onConversationSelected conversation', conversation)
728
861
  if (conversation.archived) {
729
862
  this.navigateByUrl('archived', conversation.uid)
730
- this.logger.log('[CONVS-LIST-PAGE] onConversationSelected archived conversation.uid ', conversation.uid)
863
+ this.logger.log('[CONVS-LIST-PAGE] onConversationSelected archived conversation.uid ', conversation.uid,
864
+ )
731
865
  } else {
732
866
  this.navigateByUrl('active', conversation.uid)
733
867
  this.logger.log('[CONVS-LIST-PAGE] onConversationSelected active conversation.uid ', conversation.uid)
734
868
  }
735
-
736
869
  }
737
870
 
738
871
  onImageLoaded(conversation: any) {
739
872
  // this.logger.log('[CONVS-LIST-PAGE] onImageLoaded', conversation)
740
- let conversation_with_fullname = conversation.sender_fullname;
741
- let conversation_with = conversation.sender;
873
+ let conversation_with_fullname = conversation.sender_fullname
874
+ let conversation_with = conversation.sender
742
875
  if (conversation.sender === this.loggedUserUid) {
743
- conversation_with = conversation.recipient;
744
- conversation_with_fullname = conversation.recipient_fullname;
876
+ conversation_with = conversation.recipient
877
+ conversation_with_fullname = conversation.recipient_fullname
745
878
  } else if (isGroup(conversation)) {
746
879
  // conversation_with_fullname = conv.sender_fullname;
747
880
  // conv.last_message_text = conv.last_message_text;
748
- conversation_with = conversation.recipient;
749
- conversation_with_fullname = conversation.recipient_fullname;
881
+ conversation_with = conversation.recipient
882
+ conversation_with_fullname = conversation.recipient_fullname
750
883
  }
751
- if (!conversation_with.startsWith("support-group")) {
752
- conversation.image = this.imageRepoService.getImagePhotoUrl(conversation_with)
884
+ if (!conversation_with.startsWith('support-group')) {
885
+ conversation.image = this.imageRepoService.getImagePhotoUrl(
886
+ conversation_with,
887
+ )
753
888
  }
754
889
  }
755
890
 
@@ -760,49 +895,42 @@ export class ConversationListPage implements OnInit {
760
895
  // this.ionContentConvList.scrollToTop(0);
761
896
  // }
762
897
 
763
- const keys = ['YOU', 'SENT_AN_IMAGE', 'SENT_AN_ATTACHMENT'];
764
- const translationMap = this.translateService.translateLanguage(keys);
898
+ const keys = ['YOU', 'SENT_AN_IMAGE', 'SENT_AN_ATTACHMENT']
899
+ const translationMap = this.translateService.translateLanguage(keys)
765
900
  // Fixes the bug: if a snippet of code is pasted and sent it is not displayed correctly in the convesations list
766
901
 
767
- var regex = /<br\s*[\/]?>/gi;
902
+ var regex = /<br\s*[\/]?>/gi
768
903
  if (conversation && conversation.last_message_text) {
769
- conversation.last_message_text = conversation.last_message_text.replace(regex, "")
904
+ conversation.last_message_text = conversation.last_message_text.replace(regex, '',)
770
905
 
771
906
  //FIX-BUG: 'YOU: YOU: YOU: text' on last-message-text in conversation-list
772
907
  if (conversation.sender === this.loggedUserUid && !conversation.last_message_text.includes(': ')) {
773
908
  // this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded', conversation)
774
909
 
775
- if (conversation.type !== "image" && conversation.type !== "file") {
776
- conversation.last_message_text = translationMap.get('YOU') + ': ' + conversation.last_message_text;
777
-
778
- } else if (conversation.type === "image") {
779
-
910
+ if (conversation.type !== 'image' && conversation.type !== 'file') {
911
+ conversation.last_message_text = translationMap.get('YOU') + ': ' + conversation.last_message_text
912
+ } else if (conversation.type === 'image') {
780
913
  // this.logger.log('[CONVS-LIST-PAGE] HAS SENT AN IMAGE');
781
914
  // this.logger.log("[CONVS-LIST-PAGE] translationMap.get('YOU')")
782
- const SENT_AN_IMAGE = conversation['last_message_text'] = translationMap.get('SENT_AN_IMAGE')
915
+ const SENT_AN_IMAGE = (conversation['last_message_text'] = translationMap.get('SENT_AN_IMAGE'))
783
916
 
784
- conversation.last_message_text = translationMap.get('YOU') + ': ' + SENT_AN_IMAGE;
785
-
786
- } else if (conversation.type === "file") {
917
+ conversation.last_message_text = translationMap.get('YOU') + ': ' + SENT_AN_IMAGE
918
+ } else if (conversation.type === 'file') {
787
919
  // this.logger.log('[CONVS-LIST-PAGE] HAS SENT FILE')
788
- const SENT_AN_ATTACHMENT = conversation['last_message_text'] = translationMap.get('SENT_AN_ATTACHMENT')
789
- conversation.last_message_text = translationMap.get('YOU') + ': ' + SENT_AN_ATTACHMENT;
920
+ const SENT_AN_ATTACHMENT = (conversation['last_message_text'] = translationMap.get('SENT_AN_ATTACHMENT'))
921
+ conversation.last_message_text = translationMap.get('YOU') + ': ' + SENT_AN_ATTACHMENT
790
922
  }
791
923
  } else {
792
- if (conversation.type === "image") {
793
-
924
+ if (conversation.type === 'image') {
794
925
  // this.logger.log('[CONVS-LIST-PAGE] HAS SENT AN IMAGE');
795
926
  // this.logger.log("[CONVS-LIST-PAGE] translationMap.get('YOU')")
796
- const SENT_AN_IMAGE = conversation['last_message_text'] = translationMap.get('SENT_AN_IMAGE')
927
+ const SENT_AN_IMAGE = (conversation['last_message_text'] = translationMap.get('SENT_AN_IMAGE'))
797
928
 
798
- conversation.last_message_text = SENT_AN_IMAGE;
799
-
800
- }
801
- else if (conversation.type === "file") {
929
+ conversation.last_message_text = SENT_AN_IMAGE
930
+ } else if (conversation.type === 'file') {
802
931
  // this.logger.log('[CONVS-LIST-PAGE] HAS SENT FILE')
803
- const SENT_AN_ATTACHMENT = conversation['last_message_text'] = translationMap.get('SENT_AN_ATTACHMENT')
804
- conversation.last_message_text = SENT_AN_ATTACHMENT;
805
-
932
+ const SENT_AN_ATTACHMENT = (conversation['last_message_text'] = translationMap.get('SENT_AN_ATTACHMENT'))
933
+ conversation.last_message_text = SENT_AN_ATTACHMENT
806
934
  }
807
935
  }
808
936
  }
@@ -812,59 +940,65 @@ export class ConversationListPage implements OnInit {
812
940
  // this.logger.log('[CONVS-LIST-PAGE] isMarkdownLink 1')
813
941
  // var regex = /^(^|[\n\r])\s*1\.\s.*\s+1\.\s$/
814
942
  // let matchRegex = false
815
- // if (regex.test(last_message_text)) {
943
+ // if (regex.test(last_message_text)) {
816
944
  // this.logger.log('[CONVS-LIST-PAGE] isMarkdownLink 2')
817
945
  // matchRegex = true
818
946
  // return matchRegex
819
947
  // }
820
948
  // }
821
949
 
822
-
823
950
  navigateByUrl(converationType: string, uidConvSelected: string) {
824
- this.logger.log('[CONVS-LIST-PAGE] calling navigateByUrl: ');
825
- this.logger.log('[CONVS-LIST-PAGE] navigateByUrl uidConvSelected: ', uidConvSelected);
826
- this.logger.log('[CONVS-LIST-PAGE] navigateByUrl run this.setUidConvSelected');
827
- this.logger.log('[CONVS-LIST-PAGE] navigateByUrl this.uidConvSelected ', this.uidConvSelected);
828
- this.logger.log('[CONVS-LIST-PAGE] navigateByUrl this.conversationSelected ', this.conversationSelected)
829
951
 
830
- this.setUidConvSelected(uidConvSelected, converationType);
952
+ this.logger.log('[CONVS-LIST-PAGE] navigateByUrl uidConvSelected: ', uidConvSelected)
953
+
954
+ this.logger.log('[CONVS-LIST-PAGE] navigateByUrl this.uidConvSelected ', this.uidConvSelected)
955
+
956
+ this.setUidConvSelected(uidConvSelected, converationType)
831
957
  if (checkPlatformIsMobile()) {
832
- this.logger.log('[CONVS-LIST-PAGE] checkPlatformIsMobile(): ', checkPlatformIsMobile());
833
- this.logger.log('[CONVS-LIST-PAGE] DESKTOP (window >= 768)', this.navService);
834
- let pageUrl = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname + '/' + converationType;
958
+ this.logger.log('[CONVS-LIST-PAGE] checkPlatformIsMobile(): ', checkPlatformIsMobile())
959
+ this.logger.log('[CONVS-LIST-PAGE] DESKTOP (window < 768)', this.navService)
960
+ this.logger.log('[CONVS-LIST-PAGE] navigateByUrl this.conversationSelected conversation_with_fullname ', this.conversationSelected.conversation_with_fullname)
961
+ let pageUrl = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname + '/' + converationType
835
962
  this.logger.log('[CONVS-LIST-PAGE] pageURL', pageUrl)
836
- this.router.navigateByUrl(pageUrl);
963
+ // replace(/\(/g, '%28').replace(/\)/g, '%29') -> used for the encoder of any round brackets
964
+ this.router.navigateByUrl(pageUrl.replace(/\(/g, '%28').replace(/\)/g, '%29'))
837
965
  } else {
838
- this.logger.log('[CONVS-LIST-PAGE] checkPlatformIsMobile(): ', checkPlatformIsMobile());
839
- this.logger.log('[CONVS-LIST-PAGE] MOBILE (window < 768) ', this.navService);
840
- let pageUrl = 'conversation-detail/' + this.uidConvSelected;
966
+ this.logger.log('[CONVS-LIST-PAGE] navigateByUrl this.conversationSelected conversation_with_fullname ', this.conversationSelected.conversation_with_fullname)
967
+ this.logger.log('[CONVS-LIST-PAGE] checkPlatformIsMobile(): ', checkPlatformIsMobile())
968
+ this.logger.log('[CONVS-LIST-PAGE] MOBILE (window >= 768) ', this.navService)
969
+ let pageUrl = 'conversation-detail/' + this.uidConvSelected
841
970
  if (this.conversationSelected && this.conversationSelected.conversation_with_fullname) {
842
- pageUrl = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname + '/' + converationType;
971
+ pageUrl = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname + '/' + converationType
843
972
  }
844
- this.logger.log('[CONVS-LIST-PAGE] setUidConvSelected navigateByUrl--->: ', pageUrl);
845
- this.router.navigateByUrl(pageUrl);
973
+ this.logger.log('[CONVS-LIST-PAGE] setUidConvSelected navigateByUrl--->: ', pageUrl)
974
+ // replace(/\(/g, '%28').replace(/\)/g, '%29') -> used for the encoder of any round brackets
975
+ this.router.navigateByUrl(pageUrl.replace(/\(/g, '%28').replace(/\)/g, '%29'))
846
976
  }
847
977
  }
848
978
 
849
-
850
979
  // ---------------------------------------------------------
851
980
  // Opens the list of contacts for direct convs
852
981
  // ---------------------------------------------------------
853
982
  openContactsDirectory(event: any) {
854
- const TOKEN = this.tiledeskAuthService.getTiledeskToken();
855
- this.logger.log('[CONVS-LIST-PAGE] openContactsDirectory', TOKEN);
983
+ const TOKEN = this.tiledeskAuthService.getTiledeskToken()
984
+ this.logger.log('[CONVS-LIST-PAGE] openContactsDirectory', TOKEN)
856
985
  if (checkPlatformIsMobile()) {
857
- presentModal(this.modalController, ContactsDirectoryPage, { token: TOKEN });
986
+ presentModal(this.modalController, ContactsDirectoryPage, {
987
+ token: TOKEN,
988
+ })
858
989
  } else {
859
- this.navService.push(ContactsDirectoryPage, { token: TOKEN });
990
+ this.navService.push(ContactsDirectoryPage, { token: TOKEN })
860
991
  }
861
992
  }
862
993
 
863
994
  closeContactsDirectory() {
864
995
  try {
865
- closeModal(this.modalController);
996
+ closeModal(this.modalController)
866
997
  } catch (err) {
867
- this.logger.error('[CONVS-LIST-PAGE] closeContactsDirectory -> error:', err);
998
+ this.logger.error(
999
+ '[CONVS-LIST-PAGE] closeContactsDirectory -> error:',
1000
+ err,
1001
+ )
868
1002
  }
869
1003
  }
870
1004
 
@@ -872,8 +1006,8 @@ export class ConversationListPage implements OnInit {
872
1006
  // Opens logged user profile modal
873
1007
  // ---------------------------------------------------------
874
1008
  openProfileInfo(event: any) {
875
- const TOKEN = this.messagingAuthService.getToken();
876
- this.logger.log('[CONVS-LIST-PAGE] open ProfileInfoPage TOKEN ', TOKEN);
1009
+ const TOKEN = this.messagingAuthService.getToken()
1010
+ this.logger.log('[CONVS-LIST-PAGE] open ProfileInfoPage TOKEN ', TOKEN)
877
1011
  if (checkPlatformIsMobile()) {
878
1012
  presentModal(this.modalController, ProfileInfoPage, { token: TOKEN })
879
1013
  } else {
@@ -882,13 +1016,15 @@ export class ConversationListPage implements OnInit {
882
1016
  }
883
1017
 
884
1018
  listenToCloseConvFromHeaderConversation() {
885
- this.events.subscribe('hasclosedconversation', (convId) => {
1019
+ this.events.subscribe('conversation:closed', (convId) => {
886
1020
  this.logger.log('[CONVS-LIST-PAGE] hasclosedconversation convId', convId)
887
1021
 
888
- const conversation = this.conversations.find(conv => conv.uid === convId)
1022
+ const conversation = this.conversations.find(
1023
+ (conv) => conv.uid === convId,
1024
+ )
889
1025
  this.logger.log('[CONVS-LIST-PAGE] hasclosedconversation conversation', conversation)
890
1026
  this.onCloseConversation(conversation)
891
- });
1027
+ })
892
1028
  }
893
1029
 
894
1030
  // ----------------------------------------------------------------------------------------------
@@ -896,96 +1032,169 @@ export class ConversationListPage implements OnInit {
896
1032
  // https://github.com/chat21/chat21-cloud-functions/blob/master/docs/api.md#delete-a-conversation
897
1033
  // ----------------------------------------------------------------------------------------------
898
1034
  onCloseConversation(conversation: ConversationModel) {
899
- console.log('[CONVS-LIST-PAGE] onCloseConversation conversation', conversation)
1035
+ this.logger.log('[CONVS-LIST-PAGE] onCloseConversation conversation', conversation)
1036
+
900
1037
  // -------------------------------------------------------------------------------------
901
- // Fix the display of the message "No conversation yet" when a conversation is archived
902
- // but there are others in the list (happens when loadingIsActive is set to false because
1038
+ // Fix the display of the message "No conversation yet" when a conversation is archived
1039
+ // but there are others in the list (happens when loadingIsActive is set to false because
903
1040
  // when is called the initConversationsHandler method there is not conversations)
904
1041
  // -------------------------------------------------------------------------------------
905
- this.loadingIsActive = false;
1042
+ this.loadingIsActive = false
906
1043
  // console.log('CONVS - CONV-LIST-PAGE onCloseConversation CONVS: ', conversation)
907
1044
  this.logger.log('[CONVS-LIST-PAGE] onCloseConversation loadingIsActive: ', this.loadingIsActive)
1045
+ if (conversation) {
1046
+ const conversationId = conversation.uid
908
1047
 
909
- const conversationId = conversation.uid;
910
-
911
- this.logger.log('[CONVS-LIST-PAGE] onCloseConversation conversationId: ', conversationId)
912
-
913
- const conversationWith_segments = conversationId.split('-');
914
- this.logger.log('[CONVS-LIST-PAGE] - conversationId_segments: ', conversationWith_segments);
1048
+ this.logger.log('[CONVS-LIST-PAGE] onCloseConversation conversationId: ', conversationId)
915
1049
 
916
- // Removes the last element of the array if is = to the separator
917
- if (conversationWith_segments[conversationWith_segments.length - 1] === '') {
918
- conversationWith_segments.pop();
919
- }
1050
+ const conversationWith_segments = conversationId.split('-')
1051
+ this.logger.log(
1052
+ '[CONVS-LIST-PAGE] - conversationId_segments: ',
1053
+ conversationWith_segments,
1054
+ )
920
1055
 
921
- if (conversationWith_segments.length === 4) {
922
- const lastArrayElement = conversationWith_segments[conversationWith_segments.length - 1]
923
- this.logger.log('[CONVS-LIST-PAGE] - lastArrayElement ', lastArrayElement);
924
- this.logger.log('[CONVS-LIST-PAGE] - lastArrayElement length', lastArrayElement.length);
925
- if (lastArrayElement.length !== 32) {
926
- conversationWith_segments.pop();
1056
+ // Removes the last element of the array if is = to the separator
1057
+ if (
1058
+ conversationWith_segments[conversationWith_segments.length - 1] === ''
1059
+ ) {
1060
+ conversationWith_segments.pop()
927
1061
  }
928
- }
929
1062
 
930
- if (conversationId.startsWith("support-group")) {
931
- let project_id = ''
932
1063
  if (conversationWith_segments.length === 4) {
933
- project_id = conversationWith_segments[2];
934
-
935
- const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
936
- this.archiveSupportGroupConv(tiledeskToken, project_id, conversationId);
1064
+ const lastArrayElement =
1065
+ conversationWith_segments[conversationWith_segments.length - 1]
1066
+ this.logger.log(
1067
+ '[CONVS-LIST-PAGE] - lastArrayElement ',
1068
+ lastArrayElement,
1069
+ )
1070
+ this.logger.log(
1071
+ '[CONVS-LIST-PAGE] - lastArrayElement length',
1072
+ lastArrayElement.length,
1073
+ )
1074
+ if (lastArrayElement.length !== 32) {
1075
+ conversationWith_segments.pop()
1076
+ }
1077
+ }
937
1078
 
1079
+ if (conversationId.startsWith('support-group')) {
1080
+ let project_id = ''
1081
+ if (conversationWith_segments.length === 4) {
1082
+ project_id = conversationWith_segments[2]
1083
+
1084
+ const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
1085
+ this.archiveSupportGroupConv(
1086
+ tiledeskToken,
1087
+ project_id,
1088
+ conversationId,
1089
+ )
1090
+ } else {
1091
+ this.getProjectIdByConversationWith(conversationId)
1092
+ }
938
1093
  } else {
939
- this.getProjectIdByConversationWith(conversationId)
1094
+ this.conversationsHandlerService.archiveConversation(conversationId)
940
1095
  }
941
- } else {
942
- this.conversationsHandlerService.archiveConversation(conversationId)
943
1096
  }
944
1097
  }
945
1098
 
946
1099
  getProjectIdByConversationWith(conversationId: string) {
947
- const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
948
-
949
- this.tiledeskService.getProjectIdByConvRecipient(tiledeskToken, conversationId).subscribe(res => {
950
- this.logger.log('[INFO-CONTENT-COMP] - GET PROJECTID BY CONV RECIPIENT RES', res);
951
-
952
- if (res) {
953
- const project_id = res.id_project
954
- this.logger.log('[INFO-CONTENT-COMP] - GET PROJECTID BY CONV RECIPIENT project_id', project_id);
955
- this.archiveSupportGroupConv(tiledeskToken, project_id, conversationId);
956
- }
957
-
958
- }, (error) => {
959
- this.logger.error('[INFO-CONTENT-COMP] - GET PROJECTID BY CONV RECIPIENT - ERROR ', error);
960
-
961
- }, () => {
962
- this.logger.log('[INFO-CONTENT-COMP] - GET PROJECTID BY CONV RECIPIENT * COMPLETE *');
963
-
964
- });
1100
+ const tiledeskToken = this.tiledeskAuthService.getTiledeskToken()
1101
+
1102
+ this.tiledeskService
1103
+ .getProjectIdByConvRecipient(tiledeskToken, conversationId)
1104
+ .subscribe(
1105
+ (res) => {
1106
+ this.logger.log(
1107
+ '[CONVS-LIST-PAGE] - GET PROJECTID BY CONV RECIPIENT RES',
1108
+ res,
1109
+ )
1110
+
1111
+ if (res) {
1112
+ const project_id = res.id_project
1113
+ this.logger.log(
1114
+ '[INFO-CONTENT-COMP] - GET PROJECTID BY CONV RECIPIENT project_id',
1115
+ project_id,
1116
+ )
1117
+ this.archiveSupportGroupConv(
1118
+ tiledeskToken,
1119
+ project_id,
1120
+ conversationId,
1121
+ )
1122
+ }
1123
+ },
1124
+ (error) => {
1125
+ this.logger.error(
1126
+ '[CONVS-LIST-PAGE] - GET PROJECTID BY CONV RECIPIENT - ERROR ',
1127
+ error,
1128
+ )
1129
+ },
1130
+ () => {
1131
+ this.logger.log(
1132
+ '[CONVS-LIST-PAGE] - GET PROJECTID BY CONV RECIPIENT * COMPLETE *',
1133
+ )
1134
+ },
1135
+ )
965
1136
  }
966
1137
 
967
1138
  archiveSupportGroupConv(tiledeskToken, project_id, conversationId) {
968
- console.log('[CONVS-LIST-PAGE] - onCloseConversation projectId: ', project_id)
969
- this.tiledeskService.closeSupportGroup(tiledeskToken, project_id, conversationId).subscribe(res => {
970
-
971
- console.log('[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup RES', res);
972
- }, (error) => {
973
- console.error('[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup - ERROR ', error);
974
- }, () => {
975
- console.log('[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup * COMPLETE *');
976
- console.log('[CONVS-LIST-PAGE] - onCloseConversation (closeSupportGroup) CONVS ', this.conversations)
977
- console.log('[CONVS-LIST-PAGE] - onCloseConversation (closeSupportGroup) CONVS LENGHT ', this.conversations.length)
978
- });
979
-
1139
+ this.logger.log(
1140
+ '[CONVS-LIST-PAGE] - onCloseConversation projectId: ',
1141
+ project_id,
1142
+ )
1143
+ this.tiledeskService
1144
+ .closeSupportGroup(tiledeskToken, project_id, conversationId)
1145
+ .subscribe(
1146
+ (res) => {
1147
+ this.archiveActionNotAllowed = false
1148
+ this.logger.log(
1149
+ '[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup RES',
1150
+ res,
1151
+ )
1152
+ },
1153
+ (error) => {
1154
+ this.logger.error(
1155
+ '[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup - ERROR ',
1156
+ error,
1157
+ )
1158
+ this.logger.error(
1159
+ '[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup - ERROR error.error.msg ',
1160
+ error.error.msg,
1161
+ )
1162
+ this.logger.error(
1163
+ '[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup - ERROR error.status ',
1164
+ error.status,
1165
+ )
1166
+ if (error.error.msg === 'you dont belong to the project.') {
1167
+ this.archiveActionNotAllowed = true
1168
+ }
1169
+ },
1170
+ () => {
1171
+ this.logger.log(
1172
+ '[CONVS-LIST-PAGE] - onCloseConversation closeSupportGroup * COMPLETE *',
1173
+ )
1174
+ this.logger.log(
1175
+ '[CONVS-LIST-PAGE] - onCloseConversation (closeSupportGroup) CONVS ',
1176
+ this.conversations,
1177
+ )
1178
+ this.logger.log(
1179
+ '[CONVS-LIST-PAGE] - onCloseConversation (closeSupportGroup) CONVS LENGHT ',
1180
+ this.conversations.length,
1181
+ )
1182
+ this.events.publish('conversationhasbeenclosed', conversationId)
1183
+ },
1184
+ )
980
1185
  }
981
1186
 
1187
+ onCloseAlert($event) {
1188
+ this.logger.log('[CONVS-LIST-PAGE] - onCloseAlert ', $event)
1189
+ this.archiveActionNotAllowed = false
1190
+ }
982
1191
 
983
1192
  public generateFake(count: number): Array<number> {
984
- const indexes = [];
1193
+ const indexes = []
985
1194
  for (let i = 0; i < count; i++) {
986
- indexes.push(i);
1195
+ indexes.push(i)
987
1196
  }
988
- return indexes;
1197
+ return indexes
989
1198
  }
990
1199
 
991
1200
  // ------------------------------------------------------------------
@@ -1001,7 +1210,6 @@ export class ConversationListPage implements OnInit {
1001
1210
  // this.logger.log('[CONVS-LIST-PAGE] openArchivedConversationsPage');
1002
1211
  // }
1003
1212
 
1004
-
1005
1213
  // // info page
1006
1214
  // returnCloseInfoPage() {
1007
1215
  // this.logger.log('[CONVS-LIST-PAGE] returnCloseInfoPage');
@@ -1010,7 +1218,6 @@ export class ConversationListPage implements OnInit {
1010
1218
 
1011
1219
  // }
1012
1220
 
1013
-
1014
1221
  // private navigatePage() {
1015
1222
  // this.logger.log('[CONVS-LIST-PAGE] navigatePage:: >>>> conversationSelected ', this.conversationSelected);
1016
1223
  // let urlPage = 'detail/';
@@ -1031,7 +1238,6 @@ export class ConversationListPage implements OnInit {
1031
1238
  // this.navService.openPage(urlPage, ConversationDetailPage, navigationExtras);
1032
1239
  // }
1033
1240
 
1034
-
1035
1241
  // openDetailsWithState(conversationSelected) {
1036
1242
  // console.log('openDetailsWithState:: >>>> conversationSelected ', conversationSelected);
1037
1243
  // let navigationExtras: NavigationExtras = {
@@ -1060,8 +1266,6 @@ export class ConversationListPage implements OnInit {
1060
1266
  // this.initialize();
1061
1267
  // }
1062
1268
 
1063
-
1064
-
1065
1269
  /**
1066
1270
  * ::: conversationsChanged :::
1067
1271
  * evento richiamato su add, change, remove dell'elenco delle conversazioni
@@ -1069,15 +1273,13 @@ export class ConversationListPage implements OnInit {
1069
1273
  * 2 - aggiorno il conto delle nuove conversazioni
1070
1274
  * 4 - se esiste un uidReciverFromUrl (passato nell'url)
1071
1275
  * e se esiste una conversazione con lo stesso id di uidReciverFromUrl
1072
- * imposto questa come conversazione attiva (operazione da fare una sola volta al caricamento delle conversazioni)
1276
+ * imposto questa come conversazione attiva (operazione da fare una sola volta al caricamento delle conversazioni)
1073
1277
  * e la carico nella pagina di dettaglio e azzero la variabile uidReciverFromUrl!!!
1074
1278
  * 5 - altrimenti se esiste una conversazione con lo stesso id della conversazione attiva
1075
- * e la pagina di dettaglio è vuota (placeholder), carico la conversazione attiva (uidConvSelected) nella pagina di dettaglio
1279
+ * e la pagina di dettaglio è vuota (placeholder), carico la conversazione attiva (uidConvSelected) nella pagina di dettaglio
1076
1280
  * (operazione da fare una sola volta al caricamento delle conversazioni)
1077
1281
  */
1078
1282
 
1079
-
1080
-
1081
1283
  // ------------------------------------------------------------------------------------
1082
1284
  // ::: readAllMessages ::: ??????????? SEEMS NOT USED ?????????????????
1083
1285
  // when all chat messages are displayed,