@chat21/chat21-ionic 3.0.59-rc10 → 3.0.59-rc19

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 (27) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +5 -0
  3. package/config.xml +1 -10
  4. package/env.sample +1 -1
  5. package/package.json +1 -1
  6. package/src/app/app.component.ts +123 -45
  7. package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html +1 -1
  8. package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.html +1 -1
  9. package/src/app/components/authentication/login/login.component.html +8 -8
  10. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +2 -4
  11. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +7 -2
  12. package/src/app/components/project-item/project-item.component.html +1 -1
  13. package/src/app/components/project-item/project-item.component.scss +6 -6
  14. package/src/app/components/project-item/project-item.component.ts +3 -2
  15. package/src/app/pages/authentication/login/login.page.html +1 -2
  16. package/src/app/pages/conversations-list/conversations-list.page.html +12 -7
  17. package/src/app/pages/conversations-list/conversations-list.page.scss +279 -261
  18. package/src/app/pages/conversations-list/conversations-list.page.ts +120 -14
  19. package/src/app/services/app-config.ts +77 -5
  20. package/src/app/services/websocket/websocket-js.ts +12 -14
  21. package/src/assets/logo.png +0 -0
  22. package/src/chat-config-template.json +1 -0
  23. package/src/chat-config.json +1 -0
  24. package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +12 -3
  25. package/src/chat21-core/utils/utils-message.ts +2 -2
  26. package/src/firebase-messaging-sw-template.js +1 -1
  27. package/src/assets/images/tiledesk_logo_50x50.png +0 -0
@@ -35,7 +35,8 @@ import { Platform } from '@ionic/angular';
35
35
  import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
36
36
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
37
37
  import { NetworkService } from 'src/app/services/network-service/network.service';
38
-
38
+ import { Subject } from 'rxjs';
39
+ import { takeUntil } from 'rxjs/operators'
39
40
 
40
41
  @Component({
41
42
  selector: 'app-conversations-list',
@@ -43,7 +44,10 @@ import { NetworkService } from 'src/app/services/network-service/network.service
43
44
  styleUrls: ['./conversations-list.page.scss'],
44
45
  })
45
46
  export class ConversationListPage implements OnInit {
47
+
46
48
  @ViewChild('ioncontentconvlist', { static: false }) ionContentConvList: IonContent;
49
+
50
+ private unsubscribe$: Subject<any> = new Subject<any>();
47
51
  private subscriptions: Array<string>;
48
52
  public tenant: string;
49
53
  public loggedUserUid: string;
@@ -72,6 +76,11 @@ export class ConversationListPage implements OnInit {
72
76
  public lastProjectId: string;
73
77
  public isOnline: boolean = true;
74
78
  public checkInternet: boolean;
79
+
80
+ public displayNewConvsItem: boolean = true
81
+
82
+
83
+
75
84
  constructor(
76
85
  private router: Router,
77
86
  private route: ActivatedRoute,
@@ -90,12 +99,35 @@ export class ConversationListPage implements OnInit {
90
99
  public appConfigProvider: AppConfigProvider,
91
100
  public platform: Platform,
92
101
  private networkService: NetworkService,
93
-
102
+
94
103
  ) {
95
104
  this.listenToAppCompConvsLengthOnInitConvs();
96
105
  this.listenToLogoutEvent();
106
+ this.listenGoOnline();
107
+ this.listenGoOffline();
97
108
  this.listenToSwPostMessage();
109
+ this.listenSupportConvIdHasChanged();
110
+ this.listenDirectConvIdHasChanged();
111
+ }
98
112
 
113
+ listenSupportConvIdHasChanged() {
114
+ this.events.subscribe('supportconvid:haschanged', (convId) => {
115
+ // console.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - convId', convId);
116
+ if (convId) {
117
+ const conversationSelected = this.conversations.find(item => item.uid === convId);
118
+ // console.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - conversationSelected', conversationSelected);
119
+ this.onConversationSelected(conversationSelected)
120
+ }
121
+ });
122
+ }
123
+
124
+ listenDirectConvIdHasChanged() {
125
+ this.events.subscribe('directconvid:haschanged', (contact_id) => {
126
+ // console.log('[CONVS-LIST-PAGE] - listen To directconvid:haschanged - contact_id', contact_id);
127
+ if (contact_id) {
128
+ this.uidConvSelected = contact_id
129
+ }
130
+ });
99
131
  }
100
132
 
101
133
 
@@ -105,8 +137,45 @@ export class ConversationListPage implements OnInit {
105
137
  ngOnInit() {
106
138
  this.watchToConnectionStatus();
107
139
  this.getSupportMode();
140
+
141
+ const currentUrl = this.router.url;
142
+ this.logger.log('[CONVS-LIST-PAGE] current_url ngOnInit ', currentUrl);
143
+ // this.route.queryParams.subscribe(params => {
144
+ // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params', params);
145
+ // if (params && params.convselected) {
146
+ // console.log('[CONVS-LIST-PAGE] ngOnInit params convselected:', params.convselected);
147
+
148
+ // const conversationSelected = this.conversations.find(item => item.uid === params.convselected);
149
+ // if (conversationSelected) {
150
+ // this.conversationSelected = conversationSelected;
151
+ // console.log('[CONVS-LIST-PAGE] ngOnInit params convselected - conversationSelected: ', this.conversationSelected);
152
+ // this.navigateByUrl('active', params.convselected)
153
+ // }
154
+
155
+ // } else {
156
+ // console.log('[CONVS-LIST-PAGE] ngOnInit params NoParams ');
157
+ // }
158
+ // if (params && params.contact_id && params.contact_fullname) {
159
+ // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params contact_id:', params.contact_id, 'contact_fullname ', params.contact_fullname);
160
+ // this.router.navigateByUrl('conversation-detail/' + params.contact_id + '/' + params.contact_fullname + '/new');
161
+ // this.uidConvSelected = params.contact_id
162
+ // } else {
163
+ // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params NoParams ');
164
+ // }
165
+
166
+ // if (params && params.conversation_detail) {
167
+ // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params conversation_detail:', params.conversation_detail);
168
+ // this.router.navigateByUrl('conversation-detail/');
169
+
170
+ // } else {
171
+ // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params NoParams ');
172
+ // }
173
+
174
+ // });
108
175
  }
109
176
 
177
+
178
+
110
179
  getSupportMode() {
111
180
  this.supportMode = this.appConfigProvider.getConfig().supportMode;
112
181
  // console.log('[ION-LIST-CONVS-COMP] - supportMode ', this.supportMode)
@@ -218,12 +287,20 @@ export class ConversationListPage implements OnInit {
218
287
 
219
288
  private listnerStart() {
220
289
  const that = this;
221
- this.chatManager.BSStart.subscribe((data: any) => {
222
- this.logger.log('[CONVS-LIST-PAGE] ***** BSStart Current user *****', data);
223
- if (data) {
224
- that.initialize();
225
- }
226
- });
290
+ this.chatManager.BSStart
291
+ .pipe(
292
+ takeUntil(that.unsubscribe$)
293
+ )
294
+ .subscribe((data: any) => {
295
+ this.logger.log('[CONVS-LIST-PAGE] - BSStart SUBSCR DATA - Current user *****', data);
296
+ if (data) {
297
+ that.initialize();
298
+ }
299
+ }, error => {
300
+ this.logger.error('[CONVS-LIST-PAGE] - BSStart SUBSCR - ERROR: ', error);
301
+ }, () => {
302
+ this.logger.log('[CONVS-LIST-PAGE] - BSStart SUBSCR * COMPLETE *')
303
+ });
227
304
  }
228
305
 
229
306
 
@@ -259,7 +336,6 @@ export class ConversationListPage implements OnInit {
259
336
  if (!this.archivedConversations || this.archivedConversations.length === 0) {
260
337
  this.loadingIsActive = false;
261
338
  }
262
-
263
339
  }
264
340
 
265
341
 
@@ -279,9 +355,32 @@ export class ConversationListPage implements OnInit {
279
355
  });
280
356
  }
281
357
 
358
+ listenGoOnline() {
359
+ this.events.subscribe('go:online', (goonline) => {
360
+ this.logger.info('[CONVS-LIST-PAGE] - listen To go:online - goonline', goonline);
361
+ // this.events.unsubscribe('profileInfoButtonClick:logout')
362
+ if (goonline === true) {
363
+ this.displayNewConvsItem = true
364
+ }
365
+ });
366
+ }
367
+
368
+ listenGoOffline() {
369
+
370
+ this.events.subscribe('go:offline', (offline) => {
371
+ this.logger.info('[CONVS-LIST-PAGE] - listen To go:offline - offline', offline);
372
+ // this.events.unsubscribe('profileInfoButtonClick:logout')
373
+ if (offline === true) {
374
+ this.displayNewConvsItem = false
375
+ }
376
+ });
377
+ }
378
+
282
379
  listenToLogoutEvent() {
283
380
  this.events.subscribe('profileInfoButtonClick:logout', (hasclickedlogout) => {
284
381
  this.logger.info('[CONVS-LIST-PAGE] - listenToLogoutEvent - hasclickedlogout', hasclickedlogout);
382
+
383
+
285
384
  this.conversations = []
286
385
  this.conversationsHandlerService.conversations = [];
287
386
  this.uidConvSelected = null;
@@ -392,8 +491,11 @@ export class ConversationListPage implements OnInit {
392
491
  * evento richiamato quando si seleziona un utente nell'elenco degli user
393
492
  * apro dettaglio conversazione
394
493
  */
494
+ // --------------------------------
495
+ // !!!!!! IS USED? ?????
496
+ // ------------------------------
395
497
  subscribeChangedConversationSelected = (user: UserModel, type: string) => {
396
- this.logger.log('[CONVS-LIST-PAGE] ************** subscribeUidConvSelectedChanged navigateByUrl', user, type);
498
+ console.log('[CONVS-LIST-PAGE] ************** subscribeUidConvSelectedChanged navigateByUrl', user, type);
397
499
  this.uidConvSelected = user.uid;
398
500
  this.logger.log('[CONVS-LIST-PAGE] ************** uidConvSelected ', this.uidConvSelected);
399
501
  // this.conversationsHandlerService.uidConvSelected = user.uid;
@@ -482,6 +584,7 @@ export class ConversationListPage implements OnInit {
482
584
  this.initConversationsHandler();
483
585
  this.initVariables();
484
586
  this.initSubscriptions();
587
+
485
588
  // this.initHandlerEventEmitter();
486
589
  }
487
590
 
@@ -536,7 +639,7 @@ export class ConversationListPage implements OnInit {
536
639
  }
537
640
  if (conversationSelected) {
538
641
  this.logger.log('[CONVS-LIST-PAGE] conversationSelected', conversationSelected);
539
- this.logger.log('[CONVS-LIST-PAGE] la conv ', this.conversationSelected, ' has already been loaded');
642
+ this.logger.log('[CONVS-LIST-PAGE] the conversation ', this.conversationSelected, ' has already been loaded');
540
643
  this.conversationSelected = conversationSelected;
541
644
  this.logger.log('[CONVS-LIST-PAGE] setUidConvSelected: ', this.conversationSelected);
542
645
  }
@@ -544,7 +647,7 @@ export class ConversationListPage implements OnInit {
544
647
  }
545
648
 
546
649
  onConversationSelected(conversation: ConversationModel) {
547
- //console.log('returnSelectedConversation::', conversation)
650
+ this.logger.log('onConversationSelected conversation', conversation)
548
651
  if (conversation.archived) {
549
652
  this.navigateByUrl('archived', conversation.uid)
550
653
  this.logger.log('[CONVS-LIST-PAGE] onConversationSelected archived conversation.uid ', conversation.uid)
@@ -641,6 +744,7 @@ export class ConversationListPage implements OnInit {
641
744
 
642
745
 
643
746
  navigateByUrl(converationType: string, uidConvSelected: string) {
747
+ this.logger.log('[CONVS-LIST-PAGE] calling navigateByUrl: ');
644
748
  this.logger.log('[CONVS-LIST-PAGE] navigateByUrl uidConvSelected: ', uidConvSelected);
645
749
  this.logger.log('[CONVS-LIST-PAGE] navigateByUrl run this.setUidConvSelected');
646
750
  this.logger.log('[CONVS-LIST-PAGE] navigateByUrl this.uidConvSelected ', this.uidConvSelected);
@@ -648,12 +752,14 @@ export class ConversationListPage implements OnInit {
648
752
 
649
753
  this.setUidConvSelected(uidConvSelected, converationType);
650
754
  if (checkPlatformIsMobile()) {
651
- this.logger.log('[CONVS-LIST-PAGE] PLATFORM_MOBILE 1', this.navService);
755
+ this.logger.log('[CONVS-LIST-PAGE] checkPlatformIsMobile(): ', checkPlatformIsMobile());
756
+ this.logger.log('[CONVS-LIST-PAGE] DESKTOP (window >= 768)', this.navService);
652
757
  let pageUrl = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname + '/' + converationType;
653
758
  this.logger.log('[CONVS-LIST-PAGE] pageURL', pageUrl)
654
759
  this.router.navigateByUrl(pageUrl);
655
760
  } else {
656
- this.logger.log('[CONVS-LIST-PAGE] PLATFORM_DESKTOP 2', this.navService);
761
+ console.log('[CONVS-LIST-PAGE] checkPlatformIsMobile(): ', checkPlatformIsMobile());
762
+ this.logger.log('[CONVS-LIST-PAGE] MOBILE (window < 768) ', this.navService);
657
763
  let pageUrl = 'conversation-detail/' + this.uidConvSelected;
658
764
  if (this.conversationSelected && this.conversationSelected.conversation_with_fullname) {
659
765
  pageUrl = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname + '/' + converationType;
@@ -18,18 +18,90 @@ export class AppConfigProvider {
18
18
 
19
19
  /** */
20
20
  loadAppConfig() {
21
- const that = this;
22
- return this.http.get(this.appConfig.remoteConfigUrl).toPromise().then(data => {
23
- that.appConfig = data;
21
+ // const that = this;
22
+ // return this.http.get(this.appConfig.remoteConfigUrl).toPromise().then(data => {
23
+ // that.appConfig = data;
24
+ // }).catch(err => {
25
+ // console.log('error loadAppConfig' + err);
26
+ // });
27
+
28
+ // ---- new
29
+
30
+
31
+ return this.http.get(this.appConfig.remoteConfigUrl)
32
+ .toPromise().then((data: any ) => {
33
+ // console.log('AppConfigService loadAppConfig data: ', data);
34
+
35
+ const allconfig = data
36
+ // console.log('[APP-CONFIG-SERVICE] - loadAppConfig allconfig: ', allconfig);
37
+
38
+ if (allconfig.hasOwnProperty('wsUrlRel')) {
39
+
40
+ // console.log('[APP-CONFIG-SERVICE] - loadAppConfig allconfig !!!! exist wsUrlRel ->: ', allconfig.wsUrlRel);
41
+ var wsUrlRelIsEmpty = this.isEmpty(allconfig.wsUrlRel)
42
+ // console.log('[APP-CONFIG-SERVICE] - loadAppConfig allconfig !!!! exist wsUrlRel -> wsUrlRelIsEmpty ?', wsUrlRelIsEmpty);
43
+
44
+ if (wsUrlRelIsEmpty === false) {
45
+ // console.log('[APP-CONFIG-SERVICE]- loadAppConfig allconfig !!!! exist - SERVER_BASE_URL', data.apiUrl);
46
+
47
+ // if (allconfig.apiUrl.indexOf("http://") !== -1) {
48
+
49
+ // const ws_url = allconfig.apiUrl.replace("http://", "ws://").slice(0, -1) + allconfig.wsUrlRel;
50
+ // // console.log('AppConfigService loadAppConfig allconfig !!!! exist - SERVER_BASE_URL protocol is HTTP - wsUrl', ws_url);
51
+
52
+ // allconfig.wsUrl = ws_url
53
+
54
+ // } else if (allconfig.apiUrl.indexOf("https://") !== -1) {
55
+
56
+ // const ws_url = allconfig.apiUrl.replace("https://", "wss://").slice(0, -1) + allconfig.wsUrlRel;
57
+
58
+ // allconfig.wsUrl = ws_url
59
+
60
+ // // console.log('AppConfigService loadAppConfig allconfig !!!! exist - SERVER_BASE_URL protocol is HTTPS - wsUrl', ws_url);
61
+ // } else {
62
+
63
+
64
+ // console.log('AppConfigService loadAppConfig allconfig !!!! exist - SERVER_BASE_URL !!! IS RELATIVE - window.location ', window.location);
65
+
66
+ // console.log(window.location)
67
+
68
+ if (window.location.protocol === 'http:') {
69
+ allconfig.wsUrl = 'ws://' + window.location.hostname + allconfig.wsUrlRel
70
+
71
+ } else if (window.location.protocol === 'https:') {
72
+
73
+ allconfig.wsUrl = 'wss://' + window.location.hostname + allconfig.wsUrlRel
74
+ } else {
75
+
76
+ allconfig.wsUrl = 'ws://' + window.location.hostname + allconfig.wsUrlRel
77
+ }
78
+ // }
79
+
80
+ } else {
81
+ // console.log('[APP-CONFIG-SERVICE] loadAppConfig allconfig !!!! exist wsUrlRel but IS EMPTY');
82
+ }
83
+
84
+ } else {
85
+
86
+ // console.log('[APP-CONFIG-SERVICE] loadAppConfig allconfig !!!! does not exist wsUrlRel');
87
+ }
88
+
89
+ this.appConfig = allconfig;
90
+
91
+
24
92
  }).catch(err => {
25
- // console.log('error loadAppConfig' + err);
93
+ console.error('error loadAppConfig' + err);
26
94
  });
27
95
  }
28
96
 
97
+ isEmpty(wsUrlRel: string) {
98
+ return (wsUrlRel === undefined || wsUrlRel == null || wsUrlRel.length <= 0) ? true : false;
99
+ }
100
+
29
101
  /** */
30
102
  getConfig() {
31
103
  return this.appConfig;
32
104
  }
33
-
105
+
34
106
 
35
107
  }
@@ -78,10 +78,8 @@ export class WebSocketJs {
78
78
  this.callbacks.set(topic, { onCreate: onCreate, onUpdate: onUpdate, onData: onData });
79
79
  this.logger.log('[WEBSOCKET-JS] - CALLBACK-SET - callbacks', this.callbacks);
80
80
 
81
- this.logger.log('[WEBSOCKET-JS] - REF - READY STATE ', this.ws.readyState);
82
-
83
81
  if (this.ws && this.ws.readyState == 1) {
84
-
82
+ this.logger.log('[WEBSOCKET-JS] - REF - READY STATE ', this.ws.readyState);
85
83
  this.logger.log('[WEBSOCKET-JS] - REF - READY STATE = 1 > SUBSCRIBE TO TOPICS ');
86
84
 
87
85
  this.subscribe(topic);
@@ -172,11 +170,11 @@ export class WebSocketJs {
172
170
  var str = JSON.stringify(message);
173
171
  this.logger.log("[WEBSOCKET-JS] - UN-SUBSCRIBE str " + str);
174
172
 
175
- if (this.ws.readyState == 1) {
173
+ if (this.ws && this.ws.readyState == 1) {
176
174
  this.logger.log("[WEBSOCKET-JS] - UN-SUBSCRIBE TO TOPIC - STRING TO SEND " + str, " FOR UNSUBSCRIBE TO TOPIC: ", topic);
177
175
  this.send(str, `UNSUSCRIBE from ${topic}`);
178
176
 
179
- } else {
177
+ } else if (this.ws) {
180
178
  this.logger.log("[WEBSOCKET-JS] - UN-SUBSCRIBE TRY 'SEND' BUT READY STASTE IS : ", this.ws.readyState);
181
179
  }
182
180
  }
@@ -196,7 +194,7 @@ export class WebSocketJs {
196
194
  // -----------------------------------------------------------------------------------------------------
197
195
  close() {
198
196
  this.topics = [];
199
- this.callbacks = [];
197
+ this.callbacks = [];
200
198
  this.logger.log("[WEBSOCKET-JS] - CALLED CLOSE - TOPICS ", this.topics, ' - CALLLBACKS ', this.callbacks);
201
199
 
202
200
  if (this.ws) {
@@ -277,13 +275,13 @@ export class WebSocketJs {
277
275
 
278
276
  // Qui viene inviato un battito cardiaco Dopo averlo ricevuto, viene restituito un messaggio di battito cardiaco.
279
277
  // onmessage Ottieni il battito cardiaco restituito per indicare che la connessione è normale
280
- if (this.ws.readyState == 1) {
278
+ if (this.ws && this.ws.readyState == 1) {
281
279
 
282
280
  // this.logger.log("[WEBSOCKET-JS] - HEART-START - SEND PING-MSG");
283
281
 
284
282
  this.send(JSON.stringify(this.pingMsg), 'HEART-START')
285
283
 
286
- } else {
284
+ } else if (this.ws) {
287
285
 
288
286
  this.logger.log("[WEBSOCKET-JS] - HEART-START - TRY TO SEND PING-MSG BUT READY STATE IS ", this.ws.readyState);
289
287
 
@@ -442,7 +440,7 @@ export class WebSocketJs {
442
440
  // @ send PONG
443
441
  // -------------------
444
442
  // that.logger.log('[WEBSOCKET-JS] - RECEIVED PING -> SEND PONG MSG');
445
-
443
+
446
444
  that.send(JSON.stringify(that.pongMsg), 'ON-MESSAGE')
447
445
 
448
446
  } else {
@@ -465,15 +463,15 @@ export class WebSocketJs {
465
463
  if (json && json.payload && json.payload.message && that.isArray(json.payload.message)) {
466
464
 
467
465
  json.payload.message.forEach(element => {
468
-
466
+
469
467
  //let insUp = that.insertOrUpdate(element);
470
468
  let insUp = json.payload.method;
471
-
469
+
472
470
  var object = { event: json.payload, data: element };
473
471
 
474
472
  var callbackObj = that.callbacks.get(object.event.topic);
475
473
 
476
-
474
+
477
475
  if (insUp == "CREATE") {
478
476
  if (that.onCreate) {
479
477
  that.onCreate(element, object);
@@ -499,10 +497,10 @@ export class WebSocketJs {
499
497
  } else {
500
498
  //let insUp = that.insertOrUpdate(json.payload.message);
501
499
  let insUp = json.payload.method;
502
-
500
+
503
501
  var object = { event: json.payload, data: json };
504
502
  var callbackObj = that.callbacks.get(object.event.topic);
505
-
503
+
506
504
 
507
505
  if (insUp == "CREATE") {
508
506
  if (that.onCreate) {
Binary file
@@ -25,5 +25,6 @@
25
25
  "baseImageUrl": "${API_BASEIMAGE_URL}",
26
26
  "dashboardUrl": "${DASHBOARD_URL}",
27
27
  "wsUrl": "${WS_URL}",
28
+ "wsUrlRel": "${WS_URL_RELATIVE}",
28
29
  "supportMode": "${SUPPORT_MODE}"
29
30
  }
@@ -25,5 +25,6 @@
25
25
  "baseImageUrl": "https://firebasestorage.googleapis.com/v0/b/",
26
26
  "dashboardUrl": "https://support-pre.tiledesk.com/dashboard/",
27
27
  "wsUrl": "ws://localhost:3000/",
28
+ "wsUrlRel": "${WS_URL_RELATIVE}",
28
29
  "supportMode": false
29
30
  }
@@ -31,7 +31,7 @@ export class TiledeskAuthService {
31
31
  public http: HttpClient,
32
32
  public appStorage: AppStorageService,
33
33
  // private events: EventsService,
34
- ) { }
34
+ ) { }
35
35
 
36
36
 
37
37
  initialize(serverBaseUrl: string) {
@@ -134,10 +134,19 @@ export class TiledeskAuthService {
134
134
  logOut() {
135
135
  this.logger.log('[TILEDESK-AUTH] - LOGOUT')
136
136
  this.appStorage.removeItem('tiledeskToken')
137
+ this.appStorage.removeItem('currentUser')
138
+
137
139
  this.appStorage.removeItem('currentUser')
138
140
  this.setCurrentUser(null);
139
141
  // this.isOnline$.next(false)
140
-
142
+ const stored_project = localStorage.getItem('last_project')
143
+ if (stored_project) {
144
+ localStorage.removeItem('last_project')
145
+ }
146
+ const stored_contacts = localStorage.getItem('contacts')
147
+ if (stored_contacts) {
148
+ localStorage.removeItem('contacts')
149
+ }
141
150
  }
142
151
 
143
152
 
@@ -183,7 +192,7 @@ export class TiledeskAuthService {
183
192
  } else if (storedTiledeskToken && storedTiledeskToken !== tiledeskToken) {
184
193
  this.logger.log('[TILEDESK-AUTH] - checkAndSetInStorageTiledeskToken STORED-TOKEN EXIST BUT IS != FROM TOKEN - RUN SET ')
185
194
  this.appStorage.setItem('tiledeskToken', tiledeskToken);
186
- } else if (storedTiledeskToken && storedTiledeskToken === tiledeskToken){
195
+ } else if (storedTiledeskToken && storedTiledeskToken === tiledeskToken) {
187
196
  this.logger.log('[TILEDESK-AUTH] - checkAndSetInStorageTiledeskToken STORED-TOKEN EXIST AND IS = TO TOKEN ')
188
197
  }
189
198
  }
@@ -19,7 +19,7 @@ export function isFirstMessage(i: number) {
19
19
  }
20
20
  return false;
21
21
  } catch (err) {
22
- console.log('error: ', err);
22
+ console.error('error: ', err);
23
23
  }
24
24
  }
25
25
  }
@@ -103,7 +103,7 @@ export function getSizeImg(message: any, maxWidthImage?: number): any {
103
103
  }
104
104
  return sizeImage;
105
105
  } catch (err) {
106
- console.log('error: ', err);
106
+ console.error('error: ', err);
107
107
  return;
108
108
  }
109
109
  }
@@ -43,7 +43,7 @@ importScripts('https://www.gstatic.com/firebasejs/5.8.6/firebase.js');
43
43
  // implement this optional method.
44
44
  // [START background_handler]
45
45
  messaging.setBackgroundMessageHandler(function(payload) {
46
- console.log('[firebase-messaging-sw.js] Received background message ', payload);
46
+ // console.log('[firebase-messaging-sw.js] Received background message ', payload);
47
47
  // Customize notification here
48
48
  const notificationTitle = 'Background Message Title';
49
49
  const notificationOptions = {