@chat21/chat21-ionic 3.0.5-8.1 → 3.0.5-9.1

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 (102) hide show
  1. package/CHANGELOG.md +104 -2
  2. package/README.md +9 -0
  3. package/config.xml +2 -2
  4. package/env.sample +3 -1
  5. package/package.json +1 -1
  6. package/resources/Android/splash/drawable-land-hdpi-screen.png +0 -0
  7. package/resources/Android/splash/drawable-land-ldpi-screen.png +0 -0
  8. package/resources/Android/splash/drawable-land-mdpi-screen.png +0 -0
  9. package/resources/Android/splash/drawable-land-xhdpi-screen.png +0 -0
  10. package/resources/Android/splash/drawable-land-xxhdpi-screen.png +0 -0
  11. package/resources/Android/splash/drawable-land-xxxhdpi-screen.png +0 -0
  12. package/resources/Android/splash/drawable-port-hdpi-screen.png +0 -0
  13. package/resources/Android/splash/drawable-port-ldpi-screen.png +0 -0
  14. package/resources/Android/splash/drawable-port-mdpi-screen.png +0 -0
  15. package/resources/Android/splash/drawable-port-xhdpi-screen.png +0 -0
  16. package/resources/Android/splash/drawable-port-xxhdpi-screen.png +0 -0
  17. package/resources/Android/splash/drawable-port-xxxhdpi-screen.png +0 -0
  18. package/resources/Android/splash.png +0 -0
  19. package/src/app/app-routing.module.ts +21 -17
  20. package/src/app/app.component.html +6 -3
  21. package/src/app/app.component.scss +10 -5
  22. package/src/app/app.component.ts +496 -174
  23. package/src/app/app.module.ts +16 -8
  24. package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html +1 -1
  25. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +4 -4
  26. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +8 -2
  27. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +6 -1
  28. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +7 -2
  29. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +47 -2
  30. package/src/app/chatlib/conversation-detail/message/image/image.component.html +7 -6
  31. package/src/app/chatlib/conversation-detail/message/image/image.component.ts +20 -1
  32. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +40 -10
  33. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.scss +8 -144
  34. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +14 -17
  35. package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.html +1 -1
  36. package/src/app/components/authentication/login/login.component.html +10 -10
  37. package/src/app/components/authentication/login/login.component.ts +2 -1
  38. package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.ts +1 -1
  39. package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.ts +1 -1
  40. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +15 -12
  41. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +12 -0
  42. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +27 -6
  43. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +3 -2
  44. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +22 -17
  45. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +46 -5
  46. package/src/app/components/ddp-header/ddp-header.component.html +1 -1
  47. package/src/app/components/ddp-header/ddp-header.component.ts +4 -2
  48. package/src/app/components/image-viewer/image-viewer.component.html +23 -0
  49. package/src/app/components/image-viewer/image-viewer.component.scss +107 -0
  50. package/src/app/components/image-viewer/image-viewer.component.spec.ts +24 -0
  51. package/src/app/components/image-viewer/image-viewer.component.ts +38 -0
  52. package/src/app/components/project-item/project-item.component.html +147 -0
  53. package/src/app/components/project-item/project-item.component.scss +669 -0
  54. package/src/app/components/project-item/project-item.component.spec.ts +24 -0
  55. package/src/app/components/project-item/project-item.component.ts +330 -0
  56. package/src/app/components/utils/avatar-profile/avatar-profile.component.html +7 -0
  57. package/src/app/components/utils/avatar-profile/avatar-profile.component.ts +22 -5
  58. package/src/app/pages/authentication/login/login.page.html +1 -2
  59. package/src/app/pages/authentication/login/login.page.ts +1 -1
  60. package/src/app/pages/conversation-detail/conversation-detail.page.html +5 -3
  61. package/src/app/pages/conversation-detail/conversation-detail.page.ts +124 -30
  62. package/src/app/pages/conversations-list/conversations-list.page.html +44 -23
  63. package/src/app/pages/conversations-list/conversations-list.page.scss +290 -127
  64. package/src/app/pages/conversations-list/conversations-list.page.ts +225 -17
  65. package/src/app/pages/unassigned-conversations/unassigned-conversations-routing.module.ts +17 -0
  66. package/src/app/pages/unassigned-conversations/unassigned-conversations.module.ts +22 -0
  67. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.html +22 -0
  68. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.scss +79 -0
  69. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.spec.ts +24 -0
  70. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.ts +116 -0
  71. package/src/app/services/app-config.ts +77 -5
  72. package/src/app/services/nav-proxy.service.ts +1 -1
  73. package/src/app/services/tiledesk/tiledesk.service.ts +22 -1
  74. package/src/app/services/websocket/websocket-js.ts +560 -0
  75. package/src/app/services/websocket/websocket.service.spec.ts +12 -0
  76. package/src/app/services/websocket/websocket.service.ts +292 -0
  77. package/src/app/shared/shared.module.ts +7 -1
  78. package/src/assets/i18n/en.json +9 -1
  79. package/src/assets/i18n/it.json +9 -1
  80. package/src/assets/js/chat21client.js +144 -82
  81. package/src/assets/logo.png +0 -0
  82. package/src/assets/transparent.png +0 -0
  83. package/src/chat-config-pre-test.json +2 -2
  84. package/src/chat-config-template.json +4 -1
  85. package/src/chat-config.json +4 -1
  86. package/src/chat21-core/providers/chat-manager.ts +3 -3
  87. package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +2 -2
  88. package/src/chat21-core/providers/firebase/firebase-auth-service.ts +6 -6
  89. package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +1 -1
  90. package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +1 -1
  91. package/src/chat21-core/providers/firebase/firebase-notifications.ts +32 -24
  92. package/src/chat21-core/providers/firebase/firebase-presence.service.ts +2 -2
  93. package/src/chat21-core/providers/firebase/firebase-typing.service.ts +1 -1
  94. package/src/chat21-core/providers/firebase/firebase-upload.service.ts +1 -1
  95. package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +3 -5
  96. package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +13 -5
  97. package/src/chat21-core/providers/mqtt/mqtt-notifications.ts +101 -11
  98. package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +13 -4
  99. package/src/chat21-core/utils/utils-message.ts +2 -2
  100. package/src/chat21-core/utils/utils.ts +1 -1
  101. package/src/firebase-messaging-sw-template.js +1 -1
  102. package/src/assets/images/tiledesk_logo_50x50.png +0 -0
@@ -2,7 +2,7 @@ import { URL_SOUND_LIST_CONVERSATION } from './../chat21-core/utils/constants';
2
2
  import { ArchivedConversationsHandlerService } from 'src/chat21-core/providers/abstract/archivedconversations-handler.service';
3
3
  import { AppStorageService } from 'src/chat21-core/providers/abstract/app-storage.service';
4
4
 
5
- import { Component, ViewChild, NgZone, OnInit, HostListener, ElementRef, Renderer2, } from '@angular/core';
5
+ import { Component, ViewChild, NgZone, OnInit, HostListener, ElementRef, Renderer2, AfterViewInit, } from '@angular/core';
6
6
  import { Config, Platform, IonRouterOutlet, IonSplitPane, NavController, MenuController, AlertController, IonNav, ToastController } from '@ionic/angular';
7
7
  import { ActivatedRoute, NavigationStart, Router } from '@angular/router';
8
8
  import { Subscription, VirtualTimeScheduler } from 'rxjs';
@@ -55,10 +55,9 @@ import { getImageUrlThumbFromFirebasestorage } from 'src/chat21-core/utils/utils
55
55
  import { TiledeskService } from './services/tiledesk/tiledesk.service';
56
56
  import { NetworkService } from './services/network-service/network.service';
57
57
  import * as PACKAGE from 'package.json';
58
-
59
- import { Subject } from 'rxjs';
60
- import { filter, takeUntil } from 'rxjs/operators'
61
-
58
+ import { filter } from 'rxjs/operators'
59
+ import { WebSocketJs } from './services/websocket/websocket-js';
60
+ import { Location } from '@angular/common'
62
61
  // import { filter } from 'rxjs/operators';
63
62
 
64
63
  @Component({
@@ -99,15 +98,17 @@ export class AppComponent implements OnInit {
99
98
  public missingConnectionToast: any
100
99
  public executedInitializeAppByWatchConnection: boolean = false;
101
100
  private version: string;
102
- private unsubscribe$: Subject<any> = new Subject<any>();
101
+ public browserRefresh: boolean = false;
103
102
  // private isOnline: boolean = false;
104
103
 
104
+ wsService: WebSocketJs;
105
+
105
106
  constructor(
106
107
  private platform: Platform,
107
108
  private splashScreen: SplashScreen,
108
109
  private statusBar: StatusBar,
109
110
  private appConfigProvider: AppConfigProvider,
110
- private events: EventsService,
111
+ public events: EventsService,
111
112
  public config: Config,
112
113
  public chatManager: ChatManager,
113
114
  public translate: TranslateService,
@@ -136,34 +137,182 @@ export class AppComponent implements OnInit {
136
137
  public toastController: ToastController,
137
138
  // private network: Network,
138
139
  // private tiledeskService: TiledeskService,
139
- private networkService: NetworkService
140
+ private networkService: NetworkService,
141
+ public webSocketJs: WebSocketJs,
142
+ public location: Location
140
143
  ) {
141
- this.logger.log('[APP-COMP] HELLO Constuctor !!!!!!!')
142
- // HACK: fix toast not presented when offline, due to lazy loading the toast controller.
143
- // this.toastController.create({ animated: false }).then(t => {
144
- // console.log('[APP-COMP] toastController create')
145
- // t.present();
146
- // t.dismiss();
144
+
145
+
146
+ this.saveInStorageNumberOfOpenedChatTab();
147
+ this.listenChatAlreadyOpenWithoutParamsInMobileMode()
148
+
149
+ // this.listenToUrlChanges();
150
+ // this.getPageState();
151
+
152
+ // location.subscribe((val) => {
153
+
154
+ // console.log('location subscribe val', val)
155
+ // if (val.type == "hashchange") {
156
+ // const convId = getParameterByName('convId')
157
+ // console.log('[APP-COMP] ngOnInit convId get with getParameterByName ', convId)
158
+ // const requesterFullaname = getParameterByName('requester_fullaname')
159
+ // console.log('[APP-COMP] ngOnInit convId get with getParameterByName ', requesterFullaname);
160
+
161
+ // this.navigateToDetail(convId, requesterFullaname)
162
+
163
+ // this.events.publish('convid:haschanged', convId);
164
+ // }
147
165
  // });
166
+
167
+ router.events.subscribe((event) => {
168
+ if (event instanceof NavigationStart) {
169
+ this.browserRefresh = !router.navigated;
170
+ // console.log('browserRefresh ', this.browserRefresh)
171
+ }
172
+ });
173
+ }
174
+
175
+ listenChatAlreadyOpenWithoutParamsInMobileMode() {
176
+ this.events.subscribe('noparams:mobile', (isAlreadyOpenInMobileMode) => {
177
+ // console.log('[APP-COMP] Chat is Already Open In Mobile Mode ', isAlreadyOpenInMobileMode)
178
+ if (isAlreadyOpenInMobileMode === true) {
179
+ this.checkPlatform()
180
+ }
181
+ });
148
182
  }
149
183
 
150
- param() {
151
- // PARAM
152
- const url: URL = new URL(window.top.location.href);
153
- const params: URLSearchParams = url.searchParams;
154
- return params;
184
+ // listenToUrlChanges() {
185
+ // const self = this;
186
+ // // window.addEventListener('hashchange', function () {
187
+ // window.addEventListener('locationchange', function () {
188
+
189
+ // console.log('location changed!');
190
+
191
+ // const convId = getParameterByName('convId')
192
+ // console.log('[APP-COMP] getParameterByName convId ', convId)
193
+ // if (convId) {
194
+ // setTimeout(() => {
195
+ // self.events.publish('supportconvid:haschanged', convId);
196
+ // }, 0);
197
+ // }
198
+
199
+ // const contact_id = getParameterByName('contact_id')
200
+ // console.log('[APP-COMP] getParameterByName contact_id ', contact_id)
201
+ // const contact_fullname = getParameterByName('contact_fullname')
202
+ // console.log('[APP-COMP] getParameterByName contact_fullname ', contact_fullname)
203
+ // if (contact_id && contact_fullname) {
204
+ // setTimeout(() => {
205
+ // self.router.navigateByUrl('conversation-detail/' + contact_id + '/' + contact_fullname + '/new');
206
+ // self.events.publish('directconvid:haschanged', contact_id);
207
+ // }, 0);
208
+
209
+ // } else {
210
+ // // console.log('[APP-COMP] contact_id and contact_fullname are null')
211
+ // }
212
+
213
+ // const conversation_detail = getParameterByName('conversation_detail')
214
+ // // console.log('[APP-COMP] getParameterByName conversation_detail ', conversation_detail)
215
+ // if (conversation_detail) {
216
+ // setTimeout(() => {
217
+ // self.router.navigate(['conversation-detail/'])
218
+ // }, 0);
219
+ // }
220
+ // });
221
+ // }
222
+
223
+ // getPageState() {
224
+ // const getState = () => {
225
+
226
+ // console.log('[APP-COMP] getState')
227
+ // // localStorage.setItem('visibilityState', document.visibilityState)
228
+ // if (document.visibilityState === 'hidden') {
229
+ // return 'hidden';
230
+ // }
231
+ // if (document.hasFocus()) {
232
+ // return 'active';
233
+ // }
234
+ // return 'passive';
235
+ // };
236
+
237
+ // let state = getState();
238
+
239
+ // const logStateChange = (nextState) => {
240
+
241
+ // const prevState = state;
242
+ // if (nextState !== prevState) {
243
+ // console.log(`State change: ${prevState} >>> ${nextState}`);
244
+ // state = nextState;
245
+
246
+ // }
247
+ // };
248
+
249
+ // ['pageshow', 'focus', 'blur', 'visibilitychange', 'resume'].forEach((type) => {
250
+ // window.addEventListener(type, () => logStateChange(getState()), { capture: true });
251
+ // });
252
+
253
+ // // The next two listeners, on the other hand, can determine the next
254
+ // // state from the event itself.
255
+ // window.addEventListener('freeze', () => {
256
+ // // In the freeze event, the next state is always frozen.
257
+ // logStateChange('frozen');
258
+ // }, { capture: true });
259
+
260
+ // window.addEventListener('pagehide', (event) => {
261
+ // if (event.persisted) {
262
+ // // If the event's persisted property is `true` the page is about
263
+ // // to enter the Back-Forward Cache, which is also in the frozen state.
264
+ // logStateChange('frozen');
265
+ // localStorage.setItem('state', 'frozen')
266
+ // } else {
267
+ // // If the event's persisted property is not `true` the page is
268
+ // // about to be unloaded.
269
+ // logStateChange('terminated');
270
+ // localStorage.setItem('state', 'terminated')
271
+ // localStorage.setItem('terminated', 'true')
272
+ // }
273
+ // }, { capture: true });
274
+
275
+ // }
276
+
277
+
278
+ saveInStorageNumberOfOpenedChatTab() {
279
+ this.logger.log('Calling saveInStorageChatOpenedTab!');
280
+
281
+ // https://jsfiddle.net/jjjs5wd3/3/å
282
+ if (+localStorage.tabCount > 0) {
283
+ this.logger.log('Chat IONIC Already open!');
284
+ } else {
285
+ localStorage.tabCount = 0;
286
+
287
+ localStorage.tabCount = +localStorage.tabCount + 1;
288
+ }
289
+ const terminationEvent = 'onpagehide' in self ? 'pagehide' : 'unload';
290
+ window.addEventListener(terminationEvent, (event) => {
291
+ if (localStorage.tabCount > 0) {
292
+ localStorage.tabCount = +localStorage.tabCount - 1;
293
+ }
294
+ }, { capture: true });
155
295
  }
296
+
297
+
298
+
299
+ // param() {
300
+ // // PARAM
301
+ // const url: URL = new URL(window.top.location.href);
302
+ // const params: URLSearchParams = url.searchParams;
303
+ // return params;
304
+ // }
156
305
  /**
157
306
  */
158
307
  ngOnInit() {
159
308
  const appconfig = this.appConfigProvider.getConfig();
160
309
  this.persistence = appconfig.authPersistence;
161
310
  this.appStorageService.initialize(environment.storage_prefix, this.persistence, '')
162
- this.logger.log('[APP-COMP] HELLO ngOnInit !!!!!!!')
163
- this.logger.info('[APP-COMP] ngOnInit this.route.snapshot.params -->', this.route.snapshot.params);
311
+ // this.logger.log('[APP-COMP] HELLO ngOnInit !!!!!!!')
312
+ // this.logger.log('[APP-COMP] ngOnInit this.route.snapshot.params -->', this.route.snapshot.params);
164
313
  // this.initializeApp('oninit');
165
314
  const token = getParameterByName('jwt')
166
- this.logger.info('[APP-COMP] ngOnInit AUTOLOGIN token get with getParameterByName -->', token);
315
+ // this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN token get with getParameterByName -->', token);
167
316
 
168
317
  if (token) {
169
318
  // this.isOnline = false;
@@ -180,11 +329,95 @@ export class AppComponent implements OnInit {
180
329
  this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN the current user already exist DON\'T SAVE ')
181
330
  }
182
331
  }
332
+
333
+
183
334
  this.initializeApp('oninit');
335
+ this.listenToPostMsgs();
336
+ }
337
+
338
+
339
+ listenToPostMsgs() {
340
+ window.addEventListener("message", (event) => {
341
+ this.logger.log("[APP-COMP] message event ", event);
342
+
343
+ if (event && event.data && event.data.action && event.data.parameter) {
344
+ if (event.data.action === 'openJoinConversationModal') {
345
+ // console.log("[APP-COMP] message event action ", event.data.action);
346
+ // console.log("[APP-COMP] message event parameter ", event.data.parameter);
347
+ this.presentAlertConfirmJoinRequest(event.data.parameter, event.data.calledBy)
348
+ }
349
+ }
350
+ // if (event && event.data && event.data.action && event.data.parameter) {
351
+ // if (event.data.action === 'hasArchived') {
352
+ // var iframeWin = <HTMLIFrameElement>document.getElementById("unassigned-convs-iframe")
353
+ // const isIFrame = (input: HTMLElement | null): input is HTMLIFrameElement =>
354
+ // input !== null && input.tagName === 'IFRAME';
355
+ // if (isIFrame(iframeWin) && iframeWin.contentWindow) {
356
+ // const msg = { action: "hasArchived", parameter: event.data.parameter, calledBy: event.data.calledBy }
357
+ // iframeWin.contentWindow.postMessage(msg, '*');
358
+ // }
359
+
360
+ // }
361
+ // }
362
+ if (event && event.data && event.data.action && event.data.text) {
363
+ if (event.data.action === "display_toast_join_complete") {
364
+ this.presentToastJoinComplete(event.data.text)
365
+ }
366
+ }
367
+ })
368
+ }
369
+
370
+ async presentToastJoinComplete(text) {
371
+ const toast = await this.toastController.create({
372
+ message: text,
373
+ duration: 2000,
374
+ color: "success"
375
+ });
376
+ toast.present();
377
+ }
378
+
379
+ async presentAlertConfirmJoinRequest(requestid, calledby) {
380
+ var iframeWin = <HTMLIFrameElement>document.getElementById("unassigned-convs-iframe")
381
+ // console.log("[APP-COMP] message event iframeWin ", iframeWin);
382
+
383
+ const isIFrame = (input: HTMLElement | null): input is HTMLIFrameElement =>
384
+ input !== null && input.tagName === 'IFRAME';
184
385
 
386
+ const keys = ['YouAreAboutToJoinThisChat', 'Cancel', 'AreYouSure'];
387
+ const translationMap = this.translateService.translateLanguage(keys);
388
+
389
+ const alert = await this.alertController.create({
390
+ cssClass: 'my-custom-class',
391
+ header: translationMap.get('AreYouSure'),
392
+ message: translationMap.get('YouAreAboutToJoinThisChat'),
393
+ buttons: [
394
+ {
395
+ text: translationMap.get('Cancel'),
396
+ role: 'cancel',
397
+ cssClass: 'secondary',
398
+ handler: (blah) => {
399
+ // console.log('Confirm Cancel: blah', blah);
400
+ }
401
+ }, {
402
+ text: 'Ok',
403
+ handler: () => {
404
+ // console.log('Confirm Okay');
405
+
406
+ if (isIFrame(iframeWin) && iframeWin.contentWindow) {
407
+ const msg = { action: "joinConversation", parameter: requestid, calledBy: calledby }
408
+ iframeWin.contentWindow.postMessage(msg, '*');
409
+ }
410
+ }
411
+ }
412
+ ]
413
+ });
414
+
415
+ await alert.present();
185
416
  }
186
417
 
187
418
 
419
+
420
+
188
421
  signInWithCustomToken(token) {
189
422
  // this.isOnline = false;
190
423
  this.logger.log('[APP-COMP] SIGNINWITHCUSTOMTOKEN token', token)
@@ -200,18 +433,18 @@ export class AppComponent implements OnInit {
200
433
 
201
434
  /** */
202
435
  initializeApp(calledby: string) {
203
- this.logger.log('[APP-COMP] - X - initializeApp !!! CALLED-BY: ', calledby);
204
- this.logger.log('[APP-COMP] appconfig platform is cordova: ', this.platform.is('cordova'))
436
+ // this.logger.log('[APP-COMP] - X - initializeApp !!! CALLED-BY: ', calledby);
437
+ // console.log('[APP-COMP] appconfig platform is cordova: ', this.platform.is('cordova'))
205
438
 
206
- if (!this.platform.is('cordova')) {
207
- this.splashScreen.show();
208
- }
439
+ // if (!this.platform.is('cordova')) {
440
+ this.splashScreen.show();
441
+ // }
209
442
  this.tabTitle = document.title;
210
443
 
211
444
  this.getRouteParamsAndSetLoggerConfig();
212
445
 
213
446
  const appconfig = this.appConfigProvider.getConfig();
214
- this.logger.info('[APP-COMP] appconfig: ', appconfig)
447
+ // this.logger.info('[APP-COMP] appconfig: ', appconfig)
215
448
  this.version = PACKAGE.version;
216
449
  this.logger.info('[APP-COMP] version: ', this.version)
217
450
 
@@ -223,12 +456,18 @@ export class AppComponent implements OnInit {
223
456
  this.notificationsEnabled = true;
224
457
  this.zone = new NgZone({}); // a cosa serve?
225
458
 
459
+ // ------------------------------------------
460
+ // Platform ready
461
+ // ------------------------------------------
226
462
  this.platform.ready().then(() => {
463
+ // console.log("Check platform");
464
+ this.getPlatformName();
465
+
227
466
  this.setLanguage();
228
467
 
229
- if (this.splashScreen) {
230
- this.splashScreen.hide();
231
- }
468
+ // if (this.splashScreen) {
469
+ this.splashScreen.hide();
470
+ // }
232
471
  this.statusBar.styleDefault();
233
472
  this.navService.init(this.sidebarNav, this.detailNav);
234
473
  // this.persistence = appconfig.authPersistence;
@@ -264,6 +503,59 @@ export class AppComponent implements OnInit {
264
503
  });
265
504
  }
266
505
 
506
+ getPlatformName() {
507
+ if (this.platform.is('cordova')) {
508
+ this.logger.log("the device running Cordova");
509
+ }
510
+ if (!this.platform.is('cordova')) {
511
+ this.logger.log("the device Not running Cordova");
512
+ }
513
+
514
+ if (this.platform.is('android')) {
515
+ this.logger.log("running on Android device!");
516
+ }
517
+ if (this.platform.is('ios')) {
518
+ this.logger.log("running on iOS device!");
519
+ }
520
+ if (this.platform.is('mobileweb')) {
521
+ this.logger.log("running in a browser on mobile!");
522
+ }
523
+ if (this.platform.is('desktop')) {
524
+ this.logger.log("running on desktop!");
525
+ }
526
+ }
527
+
528
+
529
+ getRouteParamsAndSetLoggerConfig() {
530
+ const appconfig = this.appConfigProvider.getConfig();
531
+ this.route.queryParams.subscribe(params => {
532
+ // this.logger.log('[APP-COMP] getRouteParamsAndSetLoggerConfig - queryParams params: ', params)
533
+ if (params.logLevel) {
534
+ this.logger.log('[APP-COMP] getRouteParamsAndSetLoggerConfig - log level get from queryParams: ', params.logLevel)
535
+ this.logger.setLoggerConfig(true, params.logLevel)
536
+ } else {
537
+ this.logger.info('[APP-COMP] getRouteParamsAndSetLoggerConfig - log level get from appconfig: ', appconfig.logLevel)
538
+ this.logger.setLoggerConfig(true, appconfig.logLevel)
539
+ }
540
+ });
541
+ }
542
+
543
+ /** */
544
+ setLanguage() {
545
+ this.translate.setDefaultLang('en');
546
+ this.translate.use('en');
547
+ this.logger.debug('[APP-COMP] navigator.language: ', navigator.language);
548
+ let language;
549
+ if (navigator.language.indexOf('-') !== -1) {
550
+ language = navigator.language.substring(0, navigator.language.indexOf('-'));
551
+ } else if (navigator.language.indexOf('_') !== -1) {
552
+ language = navigator.language.substring(0, navigator.language.indexOf('_'));
553
+ } else {
554
+ language = navigator.language;
555
+ }
556
+ this.translate.use(language);
557
+ }
558
+
267
559
 
268
560
  watchToConnectionStatus() {
269
561
  this.networkService.checkInternetFunc().subscribe(isOnline => {
@@ -317,21 +609,6 @@ export class AppComponent implements OnInit {
317
609
  }
318
610
 
319
611
 
320
- getRouteParamsAndSetLoggerConfig() {
321
- const appconfig = this.appConfigProvider.getConfig();
322
- this.route.queryParams.subscribe(params => {
323
- this.logger.info('[APP-COMP] getRouteParamsAndSetLoggerConfig - queryParams params: ', params)
324
- if (params.logLevel) {
325
- this.logger.info('[APP-COMP] getRouteParamsAndSetLoggerConfig - log level get from queryParams: ', params.logLevel)
326
- this.logger.setLoggerConfig(true, params.logLevel)
327
- } else {
328
- this.logger.info('[APP-COMP] getRouteParamsAndSetLoggerConfig - log level get from appconfig: ', appconfig.logLevel)
329
- this.logger.setLoggerConfig(true, appconfig.logLevel)
330
- }
331
- });
332
- }
333
-
334
-
335
612
  translateToastMsgs() {
336
613
  this.translate.get('AnErrorOccurredWhileUnsubscribingFromNotifications')
337
614
  .subscribe((text: string) => {
@@ -352,6 +629,7 @@ export class AppComponent implements OnInit {
352
629
  /**------- AUTHENTICATION FUNCTIONS --> START <--- +*/
353
630
  private initAuthentication() {
354
631
  const tiledeskToken = this.appStorageService.getItem('tiledeskToken')
632
+
355
633
  this.logger.log('[APP-COMP] >>> INIT-AUTHENTICATION !!! ')
356
634
  this.logger.log('[APP-COMP] >>> initAuthentication tiledeskToken ', tiledeskToken)
357
635
  // const currentUser = JSON.parse(this.appStorageService.getItem('currentUser'));
@@ -360,19 +638,19 @@ export class AppComponent implements OnInit {
360
638
  this.logger.log('[APP-COMP] >>> initAuthentication I LOG IN WITH A TOKEN EXISTING IN THE LOCAL STORAGE OR WITH A TOKEN PASSED IN THE URL PARAMETERS <<<')
361
639
  this.tiledeskAuthService.signInWithCustomToken(tiledeskToken).then(user => {
362
640
  this.logger.log('[APP-COMP] >>> initAuthentication user ', user)
363
- this.messagingAuthService.createCustomToken(tiledeskToken)
641
+ this.messagingAuthService.createCustomToken(tiledeskToken)
364
642
  }).catch(error => {
365
643
  this.logger.error('[APP-COMP] initAuthentication SIGNINWITHCUSTOMTOKEN error::', error)
366
644
  })
367
645
  } else {
368
646
  this.logger.warn('[APP-COMP] >>> I AM NOT LOGGED IN <<<')
369
-
647
+
370
648
  // clearTimeout(this.timeModalLogin);
371
649
  // this.timeModalLogin = setTimeout(() => {
372
- if (!this.hadBeenCalledOpenModal) {
373
- this.authModal = this.presentModal('initAuthentication');
374
- this.hadBeenCalledOpenModal = true;
375
- }
650
+ if (!this.hadBeenCalledOpenModal) {
651
+ this.authModal = this.presentModal('initAuthentication');
652
+ this.hadBeenCalledOpenModal = true;
653
+ }
376
654
  // }, 1000);
377
655
  }
378
656
  }
@@ -385,94 +663,14 @@ export class AppComponent implements OnInit {
385
663
  // }
386
664
  // }
387
665
 
388
- /**
389
- * goOnLine:
390
- * 1 - nascondo splashscreen
391
- * 2 - recupero il tiledeskToken e lo salvo in chat manager
392
- * 3 - carico in d
393
- * @param user
394
- */
395
- goOnLine = () => {
396
- // this.isOnline = true;
397
- // this.logger.info('initialize FROM [APP-COMP] - [APP-COMP] - GO-ONLINE isOnline ', this.isOnline);
398
-
399
- clearTimeout(this.timeModalLogin);
400
- const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
401
- const currentUser = this.tiledeskAuthService.getCurrentUser();
402
- // this.logger.printDebug('APP-COMP - goOnLine****', currentUser);
403
- this.logger.log('[APP-COMP] - GO-ONLINE - currentUser ', currentUser);
404
- this.chatManager.setTiledeskToken(tiledeskToken);
405
- this.chatManager.setCurrentUser(currentUser);
406
- // ----------------------------------------------
407
- // PUSH NOTIFICATIONS
408
- // ----------------------------------------------
409
- const pushEngine = this.appConfigProvider.getConfig().pushEngine
410
-
411
- if (currentUser) {
412
- if (pushEngine && pushEngine !== 'none') {
413
- this.notificationsService.getNotificationPermissionAndSaveToken(currentUser.uid);
414
- }
415
- this.presenceService.setPresence(currentUser.uid);
416
-
417
- this.initConversationsHandler(currentUser.uid);
418
- this.initArchivedConversationsHandler(currentUser.uid);
419
- }
420
- this.checkPlatform();
421
- try {
422
- this.logger.debug('[APP-COMP] ************** closeModal', this.authModal);
423
- if (this.authModal) {
424
- this.closeModal();
425
- }
426
- } catch (err) {
427
- this.logger.error('[APP-COMP] -> error:', err);
428
- }
429
- this.chatManager.startApp();
430
- }
431
-
432
- goOffLine = () => {
433
- this.logger.log('[APP-COMP] - GO-OFFLINE');
434
- // this.isOnline = false;
435
- // this.conversationsHandlerService.conversations = [];
436
-
437
- this.chatManager.setTiledeskToken(null);
438
- this.chatManager.setCurrentUser(null);
439
- this.chatManager.goOffLine();
440
-
441
- this.router.navigateByUrl('conversation-detail/'); //redirect to basePage
442
-
443
- // clearTimeout(this.timeModalLogin);
444
- // this.timeModalLogin = setTimeout(() => {
445
- if (!this.hadBeenCalledOpenModal) {
446
- this.authModal = this.presentModal('goOffLine');
447
- this.hadBeenCalledOpenModal = true
448
- }
449
- // }, 1000);
450
-
451
- // this.unsubscribe$.next();
452
- // this.unsubscribe$.complete();
453
666
 
454
- }
455
667
  /**------- AUTHENTICATION FUNCTIONS --> END <--- +*/
456
668
  /***************************************************+*/
457
669
 
458
- /** */
459
- setLanguage() {
460
- this.translate.setDefaultLang('en');
461
- this.translate.use('en');
462
- this.logger.debug('[APP-COMP] navigator.language: ', navigator.language);
463
- let language;
464
- if (navigator.language.indexOf('-') !== -1) {
465
- language = navigator.language.substring(0, navigator.language.indexOf('-'));
466
- } else if (navigator.language.indexOf('_') !== -1) {
467
- language = navigator.language.substring(0, navigator.language.indexOf('_'));
468
- } else {
469
- language = navigator.language;
470
- }
471
- this.translate.use(language);
472
- }
670
+
473
671
 
474
672
  checkPlatform() {
475
- this.logger.debug('[APP-COMP] checkPlatform');
673
+ // console.log('[APP-COMP] checkPlatform');
476
674
  // let pageUrl = '';
477
675
  // try {
478
676
  // const pathPage = this.route.snapshot.firstChild.routeConfig.path;
@@ -488,21 +686,31 @@ export class AppComponent implements OnInit {
488
686
  // }
489
687
 
490
688
  if (checkPlatformIsMobile()) {
689
+ this.chatManager.startApp();
690
+
691
+ this.logger.log('[APP-COMP] checkPlatformIsMobile', checkPlatformIsMobile());
491
692
  this.platformIs = PLATFORM_MOBILE;
492
693
  const IDConv = this.route.snapshot.firstChild.paramMap.get('IDConv');
493
- this.logger.log('[APP-COMP] PLATFORM_MOBILE2 navigateByUrl', PLATFORM_MOBILE, this.route.snapshot);
694
+
695
+ // console.log('[APP-COMP] platformIs', this.platformIs);
696
+ // console.log('[APP-COMP] PLATFORM', PLATFORM_MOBILE, 'route.snapshot', this.route.snapshot);
494
697
  if (!IDConv) {
495
698
  this.router.navigateByUrl('conversations-list')
496
699
  }
497
700
  // this.router.navigateByUrl(pageUrl);
498
701
  // this.navService.setRoot(ConversationListPage, {});
499
702
  } else {
703
+ this.chatManager.startApp();
704
+ this.logger.log('[APP-COMP] checkPlatformIsMobile', checkPlatformIsMobile());
500
705
  this.platformIs = PLATFORM_DESKTOP;
706
+ // console.log('[APP-COMP] platformIs', this.platformIs);
707
+ // console.log('[APP-COMP] PLATFORM', PLATFORM_DESKTOP, 'route.snapshot', this.route.snapshot);
501
708
  this.logger.log('[APP-COMP] PLATFORM_DESKTOP ', this.navService);
502
709
 
503
710
  this.navService.setRoot(ConversationListPage, {});
504
711
 
505
712
  const IDConv = this.route.snapshot.firstChild.paramMap.get('IDConv');
713
+
506
714
  const FullNameConv = this.route.snapshot.firstChild.paramMap.get('FullNameConv');
507
715
  const Convtype = this.route.snapshot.firstChild.paramMap.get('Convtype');
508
716
 
@@ -537,16 +745,23 @@ export class AppComponent implements OnInit {
537
745
  }
538
746
 
539
747
  private initAudio() {
748
+ // console.log('HERE IS initAudio ')
540
749
  // SET AUDIO
750
+ const href = window.location.href;
751
+ const hrefArray = href.split('/#/');
752
+ const chatBaseUrl = hrefArray[0]
753
+ // console.log('initAudio href', href)
754
+ // console.log('initAudio chatBaseUrl', chatBaseUrl)
755
+
541
756
  this.audio = new Audio();
542
- this.audio.src = URL_SOUND_LIST_CONVERSATION;
757
+ this.audio.src = chatBaseUrl + URL_SOUND_LIST_CONVERSATION;
543
758
  this.audio.load();
544
759
  }
545
760
 
546
761
  private manageTabNotification() {
547
762
  if (!this.isTabVisible) {
548
763
  // TAB IS HIDDEN --> manage title and SOUND
549
-
764
+ // console.log('HERE IS manageTabNotification ')
550
765
  let badgeNewConverstionNumber = this.conversationsHandlerService.countIsNew()
551
766
  badgeNewConverstionNumber > 0 ? badgeNewConverstionNumber : badgeNewConverstionNumber = 1
552
767
  document.title = "(" + badgeNewConverstionNumber + ") " + this.tabTitle
@@ -565,6 +780,7 @@ export class AppComponent implements OnInit {
565
780
  }
566
781
 
567
782
  soundMessage() {
783
+ // console.log('HERE IS soundMessage ')
568
784
  const that = this;
569
785
  // this.audio = new Audio();
570
786
  // // this.audio.src = '/assets/sounds/pling.mp3';
@@ -576,7 +792,7 @@ export class AppComponent implements OnInit {
576
792
  that.audio.play().then(() => {
577
793
  that.logger.debug('[APP-COMP] ****** soundMessage played *****');
578
794
  }).catch((error: any) => {
579
- that.logger.debug('[APP-COMP] ***soundMessage error*', error);
795
+ that.logger.error('[APP-COMP] ***soundMessage error*', error);
580
796
  });
581
797
  }, 1000);
582
798
  }
@@ -591,7 +807,6 @@ export class AppComponent implements OnInit {
591
807
  initSubscriptions() {
592
808
  this.logger.log('initialize FROM [APP-COMP] - initSubscriptions');
593
809
 
594
-
595
810
  // ---------------------------------------------------------------------------------------------------
596
811
  // Protecting from multiple subsciptions due to multiple app initializations (call to initializeApp())
597
812
  // Only one subscriber x application allowed
@@ -601,13 +816,13 @@ export class AppComponent implements OnInit {
601
816
  return;
602
817
  }
603
818
 
604
- this.BSAuthStateChangedSubscriptionRef = this.messagingAuthService.BSAuthStateChanged
605
-
819
+ this.BSAuthStateChangedSubscriptionRef = this.messagingAuthService.BSAuthStateChanged
820
+
606
821
  // .pipe(takeUntil(this.unsubscribe$))
607
822
  .pipe(filter((state) => state !== null))
608
823
  .subscribe((state: any) => {
609
824
  this.logger.log('initialize FROM [APP-COMP] - [APP-COMP] ***** BSAuthStateChanged state', state);
610
- // this.logger.info('initialize FROM [APP-COMP] - [APP-COMP] ***** BSAuthStateChanged isOnline', this.isOnline);
825
+
611
826
  if (state && state === AUTH_STATE_ONLINE) {
612
827
  // const user = this.tiledeskAuthService.getCurrentUser();
613
828
  // if (this.isOnline === false) {
@@ -639,7 +854,7 @@ export class AppComponent implements OnInit {
639
854
 
640
855
  this.conversationsHandlerService.conversationChanged.subscribe((conversation: ConversationModel) => {
641
856
 
642
- this.logger.log('[APP-COMP] ***** subscribeConversationChanged conversation: ', conversation);
857
+ // console.log('[APP-COMP] ***** subscribeConversationChanged conversation: ', conversation);
643
858
  const currentUser = JSON.parse(this.appStorageService.getItem('currentUser'));
644
859
  this.logger.log('[APP-COMP] ***** subscribeConversationChanged current_user: ', currentUser);
645
860
 
@@ -652,13 +867,147 @@ export class AppComponent implements OnInit {
652
867
  });
653
868
  }
654
869
 
870
+ /**
871
+ * goOnLine:
872
+ * 1 - nascondo splashscreen
873
+ * 2 - recupero il tiledeskToken e lo salvo in chat manager
874
+ * 3 - carico in d
875
+ * @param user
876
+ */
877
+ goOnLine = () => {
878
+ this.logger.log('[APP-COMP]- GO-ONLINE ');
879
+ // this.isOnline = true;
880
+ // this.logger.info('initialize FROM [APP-COMP] - [APP-COMP] - GO-ONLINE isOnline ', this.isOnline);
881
+ // clearTimeout(this.timeModalLogin);
882
+ const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
883
+
884
+ const supportmode = this.appConfigProvider.getConfig().supportMode;
885
+ this.logger.log('[APP-COMP] - GO-ONLINE - supportmode ', supportmode);
886
+ if (supportmode === true) {
887
+
888
+ this.connetWebsocket(tiledeskToken)
889
+
890
+ }
891
+ this.events.publish('go:online', true);
892
+ const currentUser = this.tiledeskAuthService.getCurrentUser();
893
+ // this.logger.printDebug('APP-COMP - goOnLine****', currentUser);
894
+ this.logger.log('[APP-COMP] - GO-ONLINE - currentUser ', currentUser);
895
+ this.chatManager.setTiledeskToken(tiledeskToken);
896
+ this.chatManager.setCurrentUser(currentUser);
897
+ // this.chatManager.startApp();
898
+
899
+ // ----------------------------------------------
900
+ // PUSH NOTIFICATIONS
901
+ // ----------------------------------------------
902
+ const pushEngine = this.appConfigProvider.getConfig().pushEngine
903
+
904
+ if (currentUser) {
905
+ if (pushEngine && pushEngine !== 'none') {
906
+ this.notificationsService.getNotificationPermissionAndSaveToken(currentUser.uid);
907
+ }
908
+ this.presenceService.setPresence(currentUser.uid);
909
+
910
+ this.initConversationsHandler(currentUser.uid);
911
+ this.initArchivedConversationsHandler(currentUser.uid);
912
+ }
913
+ this.checkPlatform();
914
+ try {
915
+ this.logger.debug('[APP-COMP] ************** closeModal', this.authModal);
916
+ if (this.authModal) {
917
+ this.closeModal();
918
+ }
919
+ } catch (err) {
920
+ this.logger.error('[APP-COMP] -> error:', err);
921
+ }
922
+ }
923
+
924
+ connetWebsocket(tiledeskToken) {
925
+ const appconfig = this.appConfigProvider.getConfig();
926
+ this.logger.log('connetWebsocket appconfig wsUrl ', appconfig.wsUrl)
927
+ const WS_URL = appconfig.wsUrl + '?token=' + tiledeskToken
928
+ this.webSocketJs.init(
929
+ WS_URL,
930
+ undefined,
931
+ undefined,
932
+ undefined
933
+ );
934
+ }
935
+
936
+
937
+ goOffLine = () => {
938
+ this.logger.log('[APP-COMP] - GO-OFFLINE');
939
+ const supportmode = this.appConfigProvider.getConfig().supportMode;
940
+ this.logger.log('[APP-COMP] - GO-OFFINE - supportmode ', supportmode);
941
+ if (supportmode === true) {
942
+ this.webSocketClose()
943
+ }
944
+ // this.isOnline = false;
945
+ // this.conversationsHandlerService.conversations = [];
946
+ this.chatManager.setTiledeskToken(null);
947
+ this.chatManager.setCurrentUser(null);
948
+ this.chatManager.goOffLine();
949
+
950
+ this.router.navigateByUrl('conversation-detail/'); //redirect to basePage
951
+
952
+ // clearTimeout(this.timeModalLogin);
953
+ // this.timeModalLogin = setTimeout(() => {
954
+ if (!this.hadBeenCalledOpenModal) {
955
+ this.authModal = this.presentModal('goOffLine');
956
+ this.hadBeenCalledOpenModal = true
957
+ }
958
+ // }, 1000);
959
+
960
+ // this.unsubscribe$.next();
961
+ // this.unsubscribe$.complete();
962
+
963
+ }
964
+
965
+
966
+ webSocketClose() {
967
+ this.logger.log('[APP-COMP] - GO-OFFLINE - webSocketClose');
968
+ this.webSocketJs.close()
969
+ this.events.publish('go:offline', true);
970
+ }
971
+
972
+ // BEGIN RESIZE FUNCTIONS //
973
+ @HostListener('window:resize', ['$event'])
974
+ onResize(event: any) {
975
+ const that = this;
976
+ // this.logger.debug('this.doitResize)', this.doitResize)
977
+ // clearTimeout(this.doitResize);
978
+ // this.doitResize = setTimeout(() => {
979
+ let platformIsNow = PLATFORM_DESKTOP;
980
+ if (checkPlatformIsMobile()) {
981
+ platformIsNow = PLATFORM_MOBILE;
982
+ }
983
+ if (!this.platformIs || this.platformIs === '') {
984
+ this.platformIs = platformIsNow;
985
+ }
986
+ this.logger.debug('[APP-COMP] onResize width::::', window.innerWidth);
987
+ this.logger.debug('[APP-COMP] onResize width:::: platformIsNow', platformIsNow);
988
+ this.logger.debug('[APP-COMP] onResize width:::: this.platformIs', this.platformIs);
989
+ this.logger.debug('[APP-COMP] onResize width:::: platformIsNow', platformIsNow);
990
+ if (platformIsNow !== this.platformIs) {
991
+ window.location.reload();
992
+ // this.checkPlatform();
993
+ // this.initializeApp('onresize')
994
+ this.checkPlatform();
995
+ // this.goOnLine()
996
+ // // this.initSubscriptions();
997
+
998
+ }
999
+
1000
+ // }, 0);
1001
+ }
1002
+ // END RESIZE FUNCTIONS //
1003
+
655
1004
  /**
656
1005
  * ::: subscribeChangedConversationSelected :::
657
1006
  * evento richiamato quando si seleziona un utente nell'elenco degli user
658
1007
  * apro dettaglio conversazione
659
1008
  */
660
1009
  subscribeChangedConversationSelected = (user: UserModel, type: string) => {
661
- this.logger.info('[APP-COMP] subscribeUidConvSelectedChanged navigateByUrl', user, type);
1010
+ this.logger.log('[APP-COMP] subscribeUidConvSelectedChanged navigateByUrl', user, type);
662
1011
  // this.router.navigateByUrl('conversation-detail/' + user.uid + '?conversationWithFullname=' + user.fullname);
663
1012
  this.router.navigateByUrl('conversation-detail/' + user.uid + '/' + user.fullname + '/' + type);
664
1013
  }
@@ -686,9 +1035,8 @@ export class AppComponent implements OnInit {
686
1035
  that.removePresenceAndLogout();
687
1036
  // that.presentToast();
688
1037
  }
689
- })
1038
+ });
690
1039
  }
691
-
692
1040
  }
693
1041
  }
694
1042
 
@@ -806,29 +1154,6 @@ export class AppComponent implements OnInit {
806
1154
  this.archivedConversationsHandlerService.initialize(this.tenant, userId, translationMap);
807
1155
  }
808
1156
 
809
- // BEGIN RESIZE FUNCTIONS //
810
- @HostListener('window:resize', ['$event'])
811
- onResize(event: any) {
812
- const that = this;
813
- // this.logger.debug('this.doitResize)', this.doitResize)
814
- clearTimeout(this.doitResize);
815
- this.doitResize = setTimeout(() => {
816
- let platformIsNow = PLATFORM_DESKTOP;
817
- if (checkPlatformIsMobile()) {
818
- platformIsNow = PLATFORM_MOBILE;
819
- }
820
- if (!this.platformIs || this.platformIs === '') {
821
- this.platformIs = platformIsNow;
822
- }
823
- this.logger.debug('[APP-COMP] onResize width::::', window.innerWidth);
824
- this.logger.debug('[APP-COMP] onResize width:::: platformIsNow', platformIsNow);
825
- this.logger.debug('[APP-COMP] onResize width:::: platformIsNow this.platformIs', this.platformIs);
826
- if (platformIsNow !== this.platformIs) {
827
- window.location.reload();
828
- }
829
- }, 500);
830
- }
831
- // END RESIZE FUNCTIONS //
832
1157
 
833
1158
  @HostListener('document:visibilitychange', [])
834
1159
  visibilitychange() {
@@ -848,7 +1173,7 @@ export class AppComponent implements OnInit {
848
1173
  // https://developer.mozilla.org/en-US/docs/Web/API/Window/storage_event
849
1174
  @HostListener('window:storage', ['$event'])
850
1175
  onStorageChanged(event: any) {
851
- // console.log('[APP-COMP] - onStorageChanged event ', event)
1176
+
852
1177
  if (event.key !== 'chat_sv5__tiledeskToken') {
853
1178
  return;
854
1179
  }
@@ -877,7 +1202,7 @@ export class AppComponent implements OnInit {
877
1202
  // this.unsubscribe$.complete();
878
1203
  this.initializeApp('onstoragechanged');
879
1204
 
880
-
1205
+
881
1206
 
882
1207
  // console.log('[APP-COMP] onAuthStateChanged HERE !!! ')
883
1208
  // firebase.auth().onAuthStateChanged(user => {
@@ -887,7 +1212,4 @@ export class AppComponent implements OnInit {
887
1212
  }
888
1213
  }
889
1214
  }
890
-
891
-
892
-
893
1215
  }