@chat21/chat21-ionic 3.0.65-rc2 → 3.0.65

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 (24) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/deploy_amazon_prod.sh +2 -2
  3. package/package.json +3 -3
  4. package/src/app/app.component.ts +14 -33
  5. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +0 -10
  6. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +1 -1
  7. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +18 -30
  8. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +1 -1
  9. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +2 -0
  10. package/src/app/components/project-item/project-item.component.ts +5 -0
  11. package/src/app/components/sidebar/sidebar.component.ts +8 -15
  12. package/src/app/components/sidebar-user-details/sidebar-user-details.component.html +12 -23
  13. package/src/app/components/sidebar-user-details/sidebar-user-details.component.scss +3 -0
  14. package/src/app/components/sidebar-user-details/sidebar-user-details.component.ts +88 -136
  15. package/src/app/directives/truncate.pipe.ts +0 -1
  16. package/src/app/pages/authentication/login/login.page.ts +0 -1
  17. package/src/app/pages/conversation-detail/conversation-detail.page.ts +40 -44
  18. package/src/app/pages/conversations-list/conversations-list.page.ts +25 -5
  19. package/src/assets/i18n/ar.json +266 -0
  20. package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +26 -21
  21. package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +62 -55
  22. package/src/chat21-core/utils/constants.ts +1 -1
  23. package/src/global.scss +2 -2
  24. package/deploy_prod.sh +0 -14
@@ -46,19 +46,14 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
46
46
  profile_name_translated: string;
47
47
  SubscriptionPaymentProblem: string;
48
48
  user: any
49
- projectID: any
50
49
  tiledeskToken: string;
51
- prjct_name: string;
52
- plan_type: string;
50
+ project: { _id: string, name: string, type: string, isActiveSubscription: boolean, plan_name: string}
53
51
  _prjct_profile_name: string;
54
52
 
55
53
  isVisiblePAY: boolean;
56
54
  public_Key: any
57
- plan_name: string;
58
- plan_subscription_is_active: boolean;
59
55
  USER_PHOTO_PROFILE_EXIST: boolean;
60
56
  version: string
61
- test: Date = new Date();
62
57
  company_name: string = 'Tiledesk'
63
58
  DASHBOARD_URL: string;
64
59
  constructor(
@@ -77,10 +72,9 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
77
72
  ngOnInit() {
78
73
  this.DASHBOARD_URL = this.appConfigProvider.getConfig().dashboardUrl + '#/project/';
79
74
  this.version = PACKAGE.version;
80
- this.getCurrentChatLangAndTranslateLabels();
81
75
  this.subcribeToAuthStateChanged();
82
76
  this.listenTocurrentProjectUserUserAvailability$();
83
- this.getCurrentStoredProject();
77
+ this.listenToCurrentStoredProject();
84
78
  this.getOSCODE();
85
79
  // this.listenOpenUserSidebarEvent();
86
80
  }
@@ -90,15 +84,14 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
90
84
  this.logger.log('[SIDEBAR-USER-DETAILS] BSAuthStateChanged ', state)
91
85
 
92
86
  if (state === 'online') {
93
-
94
87
  const storedCurrentUser = this.appStorageService.getItem('currentUser')
95
88
  if (storedCurrentUser && storedCurrentUser !== 'undefined') {
96
89
  const currentUser = JSON.parse(storedCurrentUser);
97
90
  this.logger.log('[SIDEBAR-USER-DETAILS] - subcribeToAuthStateChanged - currentUser ', currentUser)
98
91
  if (currentUser) {
99
92
  this.user = currentUser;
100
- this.createUserAvatar(this.user)
101
- this.photo_profile_URL = this.imageRepoService.getImagePhotoUrl(currentUser.uid)
93
+ this.getCurrentChatLangAndTranslateLabels(this.user);
94
+ this.photo_profile_URL = this.imageRepoService.getImagePhotoUrl(this.user.uid)
102
95
  this.logger.log('[SIDEBAR-USER-DETAILS] photo_profile_URL ', this.photo_profile_URL);
103
96
  this.checkIfExistPhotoProfile(this.photo_profile_URL)
104
97
  }
@@ -124,23 +117,6 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
124
117
  }
125
118
 
126
119
 
127
- createUserAvatar(currentUser) {
128
- this.logger.log('[SIDEBAR-USER-DETAILS] - createProjectUserAvatar ', currentUser)
129
- let fullname = ''
130
- if (currentUser && currentUser.firstname && currentUser.lastname) {
131
- fullname = currentUser.firstname + ' ' + currentUser.lastname
132
- currentUser['fullname_initial'] = avatarPlaceholder(fullname)
133
- currentUser['fillColour'] = getColorBck(fullname)
134
- } else if (currentUser && currentUser.firstname) {
135
- fullname = currentUser.firstname
136
- currentUser['fullname_initial'] = avatarPlaceholder(fullname)
137
- currentUser['fillColour'] = getColorBck(fullname)
138
- } else {
139
- currentUser['fullname_initial'] = 'N/A'
140
- currentUser['fillColour'] = 'rgb(98, 100, 167)'
141
- }
142
- }
143
-
144
120
  verifyImageURL(image_url, callBack) {
145
121
  const img = new Image();
146
122
  img.src = image_url;
@@ -184,64 +160,64 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
184
160
  }
185
161
 
186
162
 
187
- getCurrentChatLangAndTranslateLabels() {
163
+ getCurrentChatLangAndTranslateLabels(currentUser) {
188
164
  this.browserLang = this.translate.getBrowserLang();
189
- const storedCurrentUser = this.appStorageService.getItem('currentUser')
190
-
191
- if (storedCurrentUser && storedCurrentUser !== 'undefined') {
192
- const currentUser = JSON.parse(storedCurrentUser);
193
- this.logger.log('[SIDEBAR-USER-DETAILS] - ngOnInit - currentUser ', currentUser)
194
- this.logger.log('[SIDEBAR-USER-DETAILS] - ngOnInit - browserLang ', this.browserLang)
195
- let currentUserId = ''
196
- if (currentUser) {
197
- currentUserId = currentUser.uid
198
- this.logger.log('[SIDEBAR-USER-DETAILS] - ngOnInit - currentUserId ', currentUserId)
199
- }
165
+ this.logger.log('[SIDEBAR-USER-DETAILS] - ngOnInit - currentUser ', currentUser)
166
+ this.logger.log('[SIDEBAR-USER-DETAILS] - ngOnInit - browserLang ', this.browserLang)
200
167
 
201
- const stored_preferred_lang = localStorage.getItem(currentUserId + '_lang');
202
- this.logger.log('[SIDEBAR-USER-DETAILS] stored_preferred_lang: ', stored_preferred_lang);
168
+ const stored_preferred_lang = localStorage.getItem(currentUser.uid + '_lang');
169
+ this.logger.log('[SIDEBAR-USER-DETAILS] stored_preferred_lang: ', stored_preferred_lang);
203
170
 
204
171
 
205
- this.chat_lang = ''
206
- if (this.browserLang && !stored_preferred_lang) {
207
- this.chat_lang = this.browserLang
208
- // this.flag_url = "assets/images/language_flag/" + this.chat_lang + ".png"
209
-
210
- this.logger.log('[SIDEBAR-USER-DETAILS] flag_url: ', this.flag_url);
211
- this.logger.log('[SIDEBAR-USER-DETAILS] chat_lang: ', this.chat_lang);
212
- } else if (this.browserLang && stored_preferred_lang) {
213
- this.chat_lang = stored_preferred_lang
214
- // this.flag_url = "assets/images/language_flag/" + this.chat_lang + ".png"
215
- this.logger.log('[SIDEBAR-USER-DETAILS] flag_url: ', this.flag_url);
216
- this.logger.log('[SIDEBAR-USER-DETAILS] chat_lang: ', this.chat_lang);
217
- }
172
+ this.chat_lang = ''
173
+ if (this.browserLang && !stored_preferred_lang) {
174
+ this.chat_lang = this.browserLang
175
+ // this.flag_url = "assets/images/language_flag/" + this.chat_lang + ".png"
218
176
 
177
+ this.logger.log('[SIDEBAR-USER-DETAILS] flag_url: ', this.flag_url);
178
+ this.logger.log('[SIDEBAR-USER-DETAILS] chat_lang: ', this.chat_lang);
179
+ } else if (this.browserLang && stored_preferred_lang) {
180
+ this.chat_lang = stored_preferred_lang
181
+ // this.flag_url = "assets/images/language_flag/" + this.chat_lang + ".png"
182
+ this.logger.log('[SIDEBAR-USER-DETAILS] flag_url: ', this.flag_url);
183
+ this.logger.log('[SIDEBAR-USER-DETAILS] chat_lang: ', this.chat_lang);
184
+ }
219
185
 
220
- if (tranlatedLanguage.includes(this.chat_lang)) {
221
- this.logger.log('[SIDEBAR-USER-DETAILS] tranlatedLanguage includes', this.chat_lang, ': ', tranlatedLanguage.includes(this.chat_lang))
222
- this.translate.use(this.chat_lang);
223
- this.flag_url = "assets/images/language_flag/" + this.chat_lang + ".png"
224
- } else {
225
- this.logger.log('[SIDEBAR-USER-DETAILS] tranlatedLanguage includes', this.chat_lang, ': ', tranlatedLanguage.includes(this.chat_lang))
226
- this.translate.use('en');
227
- this.flag_url = "assets/images/language_flag/en.png"
228
- this.chat_lang = 'en'
229
- }
230
-
186
+ if (tranlatedLanguage.includes(this.chat_lang)) {
187
+ this.logger.log('[SIDEBAR-USER-DETAILS] tranlatedLanguage includes', this.chat_lang, ': ', tranlatedLanguage.includes(this.chat_lang))
188
+ this.translate.use(this.chat_lang);
189
+ this.flag_url = "assets/images/language_flag/" + this.chat_lang + ".png"
231
190
  } else {
232
- this.logger.error('[SIDEBAR-USER-DETAILS] - ngOnInit - currentUser not found in storage')
191
+ this.logger.log('[SIDEBAR-USER-DETAILS] tranlatedLanguage includes', this.chat_lang, ': ', tranlatedLanguage.includes(this.chat_lang))
192
+ this.translate.use('en');
193
+ this.flag_url = "assets/images/language_flag/en.png"
194
+ this.chat_lang = 'en'
233
195
  }
196
+
234
197
  this.translateLabels()
235
198
  }
236
199
 
237
200
  translateLabels() {
238
- this.getEditProfileTranslation();
239
- this.getAvailableTranslation();
240
- this.getUnavailableTranslation();
241
- this.getIsBusyTranslation();
242
- this.getSubscriptionPaymentProblemTranslation();
243
- this.getThePlanHasExpiredTranslation();
244
- this.getLogoutTranslation();
201
+ let keys= [
202
+ 'EditProfile',
203
+ 'Available',
204
+ 'Unavailable',
205
+ 'Busy',
206
+ 'LABEL_LOGOUT',
207
+ 'SubscriptionPaymentProblem',
208
+ 'ThePlanHasExpired'
209
+ ]
210
+
211
+ this.translate.get(keys).subscribe((text: string) => {
212
+ this.EditProfileLabel = text['EditProfile'];
213
+ this.IS_AVAILABLE_msg = text['Available']
214
+ this.IS_UNAVAILABLE_msg = text['Unavailable']
215
+ this.IS_BUSY_msg = text['Busy']
216
+ this.LOGOUT_msg = text['LABEL_LOGOUT']
217
+ this.SUBSCRIPTION_PAYMENT_PROBLEM_msg = text['SubscriptionPaymentProblem']
218
+ this.THE_PLAN_HAS_EXPIRED_msg = text['ThePlanHasExpired']
219
+
220
+ });
245
221
  }
246
222
 
247
223
 
@@ -275,92 +251,77 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
275
251
  }
276
252
 
277
253
  getEditProfileTranslation() {
278
- this.translate.get('EditProfile')
279
- .subscribe((text: string) => {
254
+ this.translate.get('EditProfile').subscribe((text: string) => {
280
255
  this.EditProfileLabel = text
281
256
  });
282
257
  }
283
258
 
284
-
285
-
286
259
  getAvailableTranslation() {
287
- this.translate.get('Available')
288
- .subscribe((text: string) => {
260
+ this.translate.get('Available').subscribe((text: string) => {
289
261
  this.IS_AVAILABLE_msg = text
290
- });
262
+ });
291
263
  }
292
264
  getUnavailableTranslation() {
293
- this.translate.get('Unavailable')
294
- .subscribe((text: string) => {
265
+ this.translate.get('Unavailable').subscribe((text: string) => {
295
266
  this.IS_UNAVAILABLE_msg = text
296
- });
267
+ });
297
268
  }
298
269
 
299
270
  getIsBusyTranslation() {
300
- this.translate.get('Busy')
301
- .subscribe((text: string) => {
271
+ this.translate.get('Busy').subscribe((text: string) => {
302
272
  this.IS_BUSY_msg = text
303
- });
273
+ });
304
274
  }
305
275
 
306
276
  getLogoutTranslation() {
307
- this.translate.get('LABEL_LOGOUT')
308
- .subscribe((text: string) => {
277
+ this.translate.get('LABEL_LOGOUT').subscribe((text: string) => {
309
278
  this.LOGOUT_msg = text
310
- });
279
+ });
311
280
  }
312
281
 
313
282
  getSubscriptionPaymentProblemTranslation() {
314
- this.translate.get('SubscriptionPaymentProblem')
315
- .subscribe((text: string) => {
283
+ this.translate.get('SubscriptionPaymentProblem').subscribe((text: string) => {
316
284
  this.SUBSCRIPTION_PAYMENT_PROBLEM_msg = text
317
- });
285
+ });
318
286
  }
319
287
 
320
288
  getThePlanHasExpiredTranslation() {
321
- this.translate.get('ThePlanHasExpired')
322
- .subscribe((text: string) => {
289
+ this.translate.get('ThePlanHasExpired').subscribe((text: string) => {
323
290
  this.THE_PLAN_HAS_EXPIRED_msg = text
324
- });
291
+ });
325
292
  }
326
293
 
327
294
 
328
- getCurrentStoredProject() {
329
- try {
330
- const project = localStorage.getItem('last_project')
331
- if (project && project !== 'undefined') {
332
- const projectObjct = JSON.parse(localStorage.getItem('last_project'))
295
+ listenToCurrentStoredProject() {
296
+ this.events.subscribe('storage:last_project', projectObjct => {
297
+ if (projectObjct && projectObjct !== 'undefined') {
333
298
  // console.log('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT ', projectObjct)
334
299
 
335
- this.projectID = projectObjct['id_project']['_id']
336
-
337
- this.prjct_name = projectObjct['id_project']['name']
300
+ this.project = {
301
+ _id: projectObjct['id_project']['_id'],
302
+ name: projectObjct['id_project']['name'],
303
+ type: projectObjct['id_project']['profile']['type'],
304
+ isActiveSubscription: projectObjct['id_project']['isActiveSubscription'],
305
+ plan_name: projectObjct['id_project']['profile']['name']
306
+ }
338
307
 
339
- this.plan_type = projectObjct['id_project']['profile']['type'];
340
-
341
- const trial_expired = projectObjct['id_project']['trialExpired']
342
-
308
+ const trial_expired = projectObjct['id_project']['trialExpired']
343
309
  const profile_name = projectObjct['id_project']['profile']['name'];
344
-
345
- this.plan_name = projectObjct['id_project']['profile']['name'];
346
- this.plan_subscription_is_active = projectObjct['id_project']['isActiveSubscription'];
347
-
348
- if (this.plan_type === 'free') {
310
+
311
+ if (this.project.type === 'free') {
349
312
 
350
313
  if (trial_expired === false) {
351
314
  this.getProPlanTrialTranslation();
352
315
  } else if (trial_expired === true) {
353
316
  this.getFreePlanTranslation();
354
317
  }
355
- } else if (this.plan_type === 'payment' && profile_name === 'pro') {
318
+ } else if (this.project.type === 'payment' && profile_name === 'pro') {
356
319
  this.getProPlanTranslation();
357
- } else if (this.plan_type === 'payment' && profile_name === 'enterprise') {
320
+ } else if (this.project.type === 'payment' && profile_name === 'enterprise') {
358
321
  this.getEnterprisePlanTranslation();
359
322
  }
360
323
  }
361
- } catch (err) {
362
- this.logger.error('[SIDEBAR-USER-DETAILS] - GET STORED PROJECT ERR ', err)
363
- }
324
+ })
364
325
 
365
326
  try {
366
327
  this.tiledeskToken = this.appStorageService.getItem('tiledeskToken');
@@ -372,37 +333,31 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
372
333
 
373
334
 
374
335
  getProPlanTrialTranslation() {
375
- this.translate.get('ProPlanTrial')
376
- .subscribe((text: string) => {
336
+ this.translate.get('ProPlanTrial').subscribe((text: string) => {
377
337
  this.profile_name_translated = text
378
338
  });
379
339
  }
380
340
 
381
341
  getFreePlanTranslation() {
382
- this.translate.get('FreePlan')
383
- .subscribe((text: string) => {
342
+ this.translate.get('FreePlan').subscribe((text: string) => {
384
343
  this.profile_name_translated = text
385
344
  });
386
345
  }
387
346
 
388
347
  getProPlanTranslation() {
389
- this.translate.get('PaydPlanNamePro')
390
- .subscribe((text: string) => {
348
+ this.translate.get('PaydPlanNamePro').subscribe((text: string) => {
391
349
  this.profile_name_translated = text
392
350
  });
393
351
  }
394
352
 
395
353
  getEnterprisePlanTranslation() {
396
- this.translate.get('PaydPlanNameEnterprise')
397
- .subscribe((text: string) => {
354
+ this.translate.get('PaydPlanNameEnterprise').subscribe((text: string) => {
398
355
  this.profile_name_translated = text
399
356
  });
400
357
  }
401
358
 
402
359
  listenTocurrentProjectUserUserAvailability$() {
403
- this.wsService.currentProjectUserAvailability$
404
- .pipe(skip(1))
405
- .subscribe((projectUser) => {
360
+ this.wsService.currentProjectUserAvailability$.pipe(skip(1)).subscribe((projectUser) => {
406
361
  this.logger.log('[SIDEBAR-USER-DETAILS] - $UBSC TO WS USER AVAILABILITY & BUSY STATUS RES ', projectUser);
407
362
 
408
363
  if (projectUser) {
@@ -412,8 +367,6 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
412
367
  this.translateUserRole(this.USER_ROLE)
413
368
  }
414
369
 
415
-
416
-
417
370
  }, (error) => {
418
371
  this.logger.error('[SIDEBAR-USER-DETAILS] - $UBSC TO WS USER AVAILABILITY & BUSY STATUS error ', error);
419
372
  }, () => {
@@ -422,8 +375,7 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
422
375
  }
423
376
 
424
377
  translateUserRole(role) {
425
- this.translate.get(role)
426
- .subscribe((text: string) => {
378
+ this.translate.get(role).subscribe((text: string) => {
427
379
  this.USER_ROLE_LABEL = text
428
380
  });
429
381
  }
@@ -436,9 +388,9 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
436
388
 
437
389
 
438
390
  changeAvailabilityStateInUserDetailsSidebar(available) {
439
- this.logger.log('[SIDEBAR-USER-DETAILS] - changeAvailabilityState projectid', this.projectID, ' available 1: ', available);
391
+ this.logger.log('[SIDEBAR-USER-DETAILS] - changeAvailabilityState projectid', this.project._id, ' available 1: ', available);
440
392
 
441
- this.wsService.updateCurrentUserAvailability(this.tiledeskToken, this.projectID, available)
393
+ this.wsService.updateCurrentUserAvailability(this.tiledeskToken, this.project._id, available)
442
394
  .subscribe((projectUser: any) => {
443
395
 
444
396
  this.logger.log('[SIDEBAR-USER-DETAILS] - PROJECT-USER UPDATED ', projectUser)
@@ -453,7 +405,7 @@ export class SidebarUserDetailsComponent implements OnInit, OnChanges {
453
405
  }
454
406
 
455
407
  goToUserProfile() {
456
- let url = this.DASHBOARD_URL + this.projectID + '/user-profile'
408
+ let url = this.DASHBOARD_URL + this.project._id + '/user-profile'
457
409
  const myWindow = window.open(url, '_self');
458
410
  myWindow.focus();
459
411
  }
@@ -6,7 +6,6 @@ import { Pipe, PipeTransform } from '@angular/core';
6
6
  export class TruncatePipe implements PipeTransform {
7
7
 
8
8
  transform(value: string, character: number): any {
9
- console.log('stringggg', value, character)
10
9
  if(value && value.length > character)
11
10
  return value.substring(0, character) + ' ...'
12
11
  else
@@ -110,7 +110,6 @@ export class LoginPage implements OnInit {
110
110
  'Email must be a valid email',
111
111
  'Password is required',
112
112
  'Password must be at least 6 characters long'
113
-
114
113
  ];
115
114
  this.translationMap = this.translateService.translateLanguage(keys);
116
115
  }
@@ -320,7 +320,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
320
320
  const conversations = this.conversationsHandlerService.conversations
321
321
  // console.log('[CONVS-DETAIL] conversations', conversations);
322
322
  this.conversation_count = conversations.length
323
- if (conv && conv.sender !== this.loggedUser.uid) {
323
+ if (conv && this.loggedUser && conv.sender !== this.loggedUser.uid) {
324
324
  this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange data sender ', conv.sender)
325
325
  this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange this.loggedUser.uid ', this.loggedUser.uid)
326
326
  this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange is_new ', conv.is_new)
@@ -761,6 +761,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
761
761
  if (this.conversationWith && this.conversationsHandlerService && this.conv_type === 'active') {
762
762
  this.logger.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail CALLING')
763
763
  this.conversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
764
+ this.logger.debug('[CONV-COMP] setHeaderContent getConversationDetail: conversationsHandlerService ', this.conversationWith, conv, this.conv_type)
764
765
  if (conv) {
765
766
  this.conversationAvatar = setConversationAvatar(
766
767
  conv.conversation_with,
@@ -768,19 +769,45 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
768
769
  conv.channel_type,
769
770
  )
770
771
  }
772
+ if(!conv){
773
+ this.logger.debug('[CONV-COMP] setHeaderContent getConversationDetail: conv not exist --> search in archived list', this.conversationWith, this.conv_type)
774
+ this.archivedConversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
775
+ this.logger.debug('[CONV-COMP] setHeaderContent getConversationDetail: archivedConversationsHandlerService', this.conversationWith, conv)
776
+ if (conv) {
777
+ console.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail (archived)', this.conversationWith, 'CONVS', conv)
778
+ this.conversationAvatar = setConversationAvatar(
779
+ conv.conversation_with,
780
+ conv.conversation_with_fullname,
781
+ conv.channel_type,
782
+ )
783
+ }
784
+ })
785
+ }
771
786
  this.logger.log('[CONVS-DETAIL] - setHeaderContent > conversationAvatar: ', this.conversationAvatar)
772
787
  })
773
788
  } else {
774
- //get conversation from 'conversations' firebase node
789
+ //get conversation from 'archived-conversations' firebase node
790
+ this.logger.debug('[CONV-COMP] setHeaderContent getConversationDetail: archivedConversationsHandlerService', this.conversationWith, this.conv_type)
775
791
  this.archivedConversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
776
792
  if (conv) {
777
- // console.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail (archived)', this.conversationWith, 'CONVS', conv)
778
793
  this.conversationAvatar = setConversationAvatar(
779
794
  conv.conversation_with,
780
795
  conv.conversation_with_fullname,
781
796
  conv.channel_type,
782
797
  )
783
798
  }
799
+ if(!conv){
800
+ this.conversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
801
+ if (conv) {
802
+ this.conversationAvatar = setConversationAvatar(
803
+ conv.conversation_with,
804
+ conv.conversation_with_fullname,
805
+ conv.channel_type,
806
+ )
807
+ }
808
+ this.logger.log('[CONVS-DETAIL] - setHeaderContent > conversationAvatar: ', this.conversationAvatar)
809
+ })
810
+ }
784
811
  })
785
812
  }
786
813
 
@@ -934,7 +961,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
934
961
  subscriptionKey = 'messageAdded'
935
962
  subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
936
963
  if (!subscription) {
937
- this.logger.log('[CONVS-DETAIL] subscribe to messageAdded - conversationHandlerService', this.conversationHandlerService)
938
964
  subscription = this.conversationHandlerService.messageAdded.subscribe((msg: any) => {
939
965
  this.logger.log('[CONVS-DETAIL] subscribe to messageAdded - msg ', msg)
940
966
  if (msg) {
@@ -950,7 +976,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
950
976
  subscriptionKey = 'messageChanged'
951
977
  subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
952
978
  if (!subscription) {
953
- this.logger.log('[CONVS-DETAIL] subscribe to messageChanged')
954
979
  subscription = this.conversationHandlerService.messageChanged.subscribe((msg: any) => {
955
980
  this.logger.log('[CONVS-DETAIL] subscribe to messageChanged - msg ', msg)
956
981
  })
@@ -961,7 +986,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
961
986
  subscriptionKey = 'messageRemoved'
962
987
  subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
963
988
  if (!subscription) {
964
- this.logger.log('[CONVS-DETAIL] subscribe to messageRemoved')
965
989
  subscription = this.conversationHandlerService.messageRemoved.subscribe((messageId: any) => {
966
990
  this.logger.log('[CONVS-DETAIL] subscribe to messageRemoved - messageId ', messageId)
967
991
  })
@@ -1186,26 +1210,15 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1186
1210
  this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash parts', beforeSlashParts)
1187
1211
 
1188
1212
  if (beforeSlashParts.length === 2) {
1189
- if (
1190
- beforeSlashParts[0].indexOf(' ') >= 0 &&
1191
- afterSlashParts[0] === ''
1192
- ) {
1213
+ if (beforeSlashParts[0].indexOf(' ') >= 0 && afterSlashParts[0] === '') {
1193
1214
  this.HIDE_CANNED_RESPONSES = false
1194
- this.logger.log(
1195
- '[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash there is a white space After Not',
1196
- )
1215
+ this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash there is a white space After Not')
1197
1216
  // if (beforeSlashParts[0].indexOf(' ') >= 0 && afterSlashParts[0].indexOf(' ') >= 0)
1198
- } else if (
1199
- beforeSlashParts[0].indexOf(' ') < 0 &&
1200
- afterSlashParts[0] === ''
1201
- ) {
1217
+ } else if (beforeSlashParts[0].indexOf(' ') < 0 && afterSlashParts[0] === '') {
1202
1218
  this.HIDE_CANNED_RESPONSES = true
1203
1219
  this.tagsCannedFilter = []
1204
1220
  this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash not thete is a white space After Not')
1205
- } else if (
1206
- beforeSlashParts[0].indexOf(' ') >= 0 &&
1207
- afterSlashParts[0] === ' '
1208
- ) {
1221
+ } else if (beforeSlashParts[0].indexOf(' ') >= 0 && afterSlashParts[0] === ' ') {
1209
1222
  this.logger.log('[CONVS-DETAIL] - returnChangeTextArea --> beforeSlash not thete is a white space After YES')
1210
1223
  this.HIDE_CANNED_RESPONSES = true
1211
1224
  this.tagsCannedFilter = []
@@ -1475,11 +1488,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1475
1488
  this.logger.log('[CONVS-DETAIL] - insertAtCursor - myValue ', myValue)
1476
1489
  this.logger.log('[CONVS-DETAIL] - insertAtCursor - myField ', myField)
1477
1490
 
1478
- // myValue = ' ' + myValue;
1479
-
1480
- // console.log('[CONVS-DETAIL] - GET TEXT AREA - Here yes myValue ', myValue);
1481
- // console.log('[CONVS-DETAIL] - GET TEXT AREA - Here yes textArea value length', myField.value.length);
1482
-
1483
1491
  if (myField.value.length > 0) {
1484
1492
  myValue = ' ' + myValue
1485
1493
  }
@@ -1571,24 +1579,15 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1571
1579
  // this.audio.src = '/assets/sounds/pling.mp3';
1572
1580
  this.audio.src = URL_SOUND_LIST_CONVERSATION
1573
1581
  this.audio.load()
1574
- this.logger.log(
1575
- '[CONVS-DETAIL] soundMessage conversation this.audio',
1576
- this.audio,
1577
- )
1582
+ this.logger.log('[CONVS-DETAIL] soundMessage conversation this.audio',this.audio)
1578
1583
  clearTimeout(this.setTimeoutSound)
1579
1584
  this.setTimeoutSound = setTimeout(function () {
1580
- that.audio
1581
- .play()
1582
- .then(() => {
1585
+ that.audio.play().then(() => {
1583
1586
  // Audio is playing.
1584
- this.logger.log(
1585
- '[CONVS-DETAIL] soundMessag that.audio.src ',
1586
- that.audio.src,
1587
- )
1588
- })
1589
- .catch((error) => {
1587
+ this.logger.log('[CONVS-DETAIL] soundMessag that.audio.src ',that.audio.src)
1588
+ }).catch((error) => {
1590
1589
  that.logger.error(error)
1591
- })
1590
+ })
1592
1591
  }, 1000)
1593
1592
  }
1594
1593
 
@@ -1750,10 +1749,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1750
1749
  * FIREBY BY: click event ScrollToBottom bottom-right icon button
1751
1750
  */
1752
1751
  public actionScrollBottom() {
1753
- this.logger.log(
1754
- '[CONVS-DETAIL] actionScrollBottom - ionContentChatArea: ',
1755
- this.ionContentChatArea,
1756
- )
1752
+ this.logger.log('[CONVS-DETAIL] actionScrollBottom - ionContentChatArea: ',this.ionContentChatArea)
1757
1753
  // const that = this;
1758
1754
  this.showButtonToBottom = false
1759
1755
  this.updateConversationBadge()