@chat21/chat21-ionic 3.0.59-rc9 → 3.0.59
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.
- package/CHANGELOG.md +53 -0
- package/README.md +5 -0
- package/config.xml +2 -2
- package/env.sample +1 -1
- package/package.json +1 -1
- package/resources/Android/splash/drawable-land-hdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-land-ldpi-screen.png +0 -0
- package/resources/Android/splash/drawable-land-mdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-land-xhdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-land-xxhdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-land-xxxhdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-hdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-ldpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-mdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-xhdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-xxhdpi-screen.png +0 -0
- package/resources/Android/splash/drawable-port-xxxhdpi-screen.png +0 -0
- package/resources/Android/splash.png +0 -0
- package/src/app/app.component.scss +10 -5
- package/src/app/app.component.ts +377 -228
- package/src/app/app.module.ts +12 -7
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html +1 -1
- package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.html +1 -1
- package/src/app/components/authentication/login/login.component.html +8 -8
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +2 -4
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +7 -2
- package/src/app/components/project-item/project-item.component.html +2 -2
- package/src/app/components/project-item/project-item.component.scss +6 -6
- package/src/app/components/project-item/project-item.component.ts +46 -32
- package/src/app/pages/authentication/login/login.page.html +1 -2
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +2 -0
- package/src/app/pages/conversations-list/conversations-list.page.html +12 -7
- package/src/app/pages/conversations-list/conversations-list.page.scss +279 -261
- package/src/app/pages/conversations-list/conversations-list.page.ts +138 -13
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.ts +10 -2
- package/src/app/services/app-config.ts +77 -5
- package/src/app/services/websocket/websocket-js.ts +12 -14
- package/src/app/services/websocket/websocket.service.ts +26 -8
- package/src/assets/js/chat21client.js +144 -82
- package/src/assets/logo.png +0 -0
- package/src/assets/transparent.png +0 -0
- package/src/chat-config-template.json +1 -0
- package/src/chat-config.json +1 -0
- package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +1 -1
- package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +1 -1
- package/src/chat21-core/providers/firebase/firebase-notifications.ts +31 -23
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +3 -5
- package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +13 -5
- package/src/chat21-core/providers/mqtt/mqtt-notifications.ts +101 -11
- package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +12 -3
- package/src/chat21-core/utils/utils-message.ts +2 -2
- package/src/firebase-messaging-sw-template.js +1 -1
- package/src/assets/images/tiledesk_logo_50x50.png +0 -0
package/src/app/app.component.ts
CHANGED
|
@@ -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';
|
|
@@ -57,7 +57,7 @@ import { NetworkService } from './services/network-service/network.service';
|
|
|
57
57
|
import * as PACKAGE from 'package.json';
|
|
58
58
|
import { filter } from 'rxjs/operators'
|
|
59
59
|
import { WebSocketJs } from './services/websocket/websocket-js';
|
|
60
|
-
|
|
60
|
+
import { Location } from '@angular/common'
|
|
61
61
|
// import { filter } from 'rxjs/operators';
|
|
62
62
|
|
|
63
63
|
@Component({
|
|
@@ -108,7 +108,7 @@ export class AppComponent implements OnInit {
|
|
|
108
108
|
private splashScreen: SplashScreen,
|
|
109
109
|
private statusBar: StatusBar,
|
|
110
110
|
private appConfigProvider: AppConfigProvider,
|
|
111
|
-
|
|
111
|
+
public events: EventsService,
|
|
112
112
|
public config: Config,
|
|
113
113
|
public chatManager: ChatManager,
|
|
114
114
|
public translate: TranslateService,
|
|
@@ -139,86 +139,156 @@ export class AppComponent implements OnInit {
|
|
|
139
139
|
// private tiledeskService: TiledeskService,
|
|
140
140
|
private networkService: NetworkService,
|
|
141
141
|
public webSocketJs: WebSocketJs,
|
|
142
|
+
public location: Location
|
|
142
143
|
) {
|
|
143
144
|
|
|
144
|
-
// this.saveInStorageChatOpenedTab();
|
|
145
|
-
// FOR TEST
|
|
146
|
-
// const last_project = { "user_available": true, "number_assigned_requests": 59, "last_login_at": "2021-08-09T17:30:55.234Z", "status": "active", "_id": "6112bc8f58c958003495a2cb", "id_project": { "status": 100, "_id": "60ffe291f725db00347661ef", "name": "27-LUGLIO-21-STRIPE-TEST", "activeOperatingHours": false, "createdBy": "608ad02d3a4dc000344ade17", "profile": { "name": "pro", "trialDays": 30, "agents": 5, "type": "payment", "subStart": "2021-11-18T10:42:41.000Z", "subEnd": "2021-11-19T10:42:41.000Z", "subscriptionId": "sub_Jvf4kABe9t8JvX", "last_stripe_event": "invoice.payment_succeeded" }, "versions": 20115, "channels": [{ "name": "chat21" }], "createdAt": "2021-07-27T10:40:17.752Z", "updatedAt": "2021-11-18T11:55:01.346Z", "__v": 0, "widget": { "preChatForm": true, "preChatFormJson": [{ "name": "userFullname", "type": "text", "mandatory": true, "label": { "en": "Your name", "it": "Il tuo nome" } }, { "name": "userEmail", "type": "text", "mandatory": true, "regex": "/^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)+$/", "label": { "en": "Your email", "it": "La tua email" }, "errorLabel": { "en": "Invalid email address", "it": "Indirizzo email non valido" } }, { "name": "tel", "mandatory": true, "label": { "en": "Your phone number", "it": "Il tuo numero di telefono" } }], "preChatFormCustomFieldsEnabled": true }, "trialExpired": true, "trialDaysLeft": 84, "isActiveSubscription": true, "id": "60ffe291f725db00347661ef" }, "id_user": "60aa0fef1482fe00346854a7", "role": "admin", "createdBy": "608ad02d3a4dc000344ade17", "createdAt": "2021-08-10T17:51:11.318Z", "updatedAt": "2021-11-19T08:08:21.437Z", "__v": 0, "presence": { "status": "online", "changedAt": "2021-11-19T08:08:21.432Z" }, "isAuthenticated": true, "id": "6112bc8f58c958003495a2cb" }
|
|
147
|
-
// localStorage.setItem('last_project', JSON.stringify(last_project))
|
|
148
|
-
}
|
|
149
|
-
saveInStorageChatOpenedTab() {
|
|
150
|
-
// if (+localStorage.tabCount > 0) {
|
|
151
|
-
// alert('Already open!');
|
|
152
|
-
// } else {
|
|
153
|
-
// localStorage.tabCount = 0;
|
|
154
|
-
// }
|
|
155
145
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
//
|
|
160
|
-
//
|
|
161
|
-
|
|
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
|
+
// }
|
|
162
165
|
// });
|
|
166
|
+
}
|
|
163
167
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
// }, { capture: true });
|
|
170
|
-
const getState = () => {
|
|
171
|
-
if (document.visibilityState === 'hidden') {
|
|
172
|
-
return 'hidden';
|
|
173
|
-
}
|
|
174
|
-
if (document.hasFocus()) {
|
|
175
|
-
return 'active';
|
|
168
|
+
listenChatAlreadyOpenWithoutParamsInMobileMode() {
|
|
169
|
+
this.events.subscribe('noparams:mobile', (isAlreadyOpenInMobileMode) => {
|
|
170
|
+
// console.log('[APP-COMP] Chat is Already Open In Mobile Mode ', isAlreadyOpenInMobileMode)
|
|
171
|
+
if (isAlreadyOpenInMobileMode === true) {
|
|
172
|
+
this.checkPlatform()
|
|
176
173
|
}
|
|
177
|
-
|
|
178
|
-
|
|
174
|
+
});
|
|
175
|
+
}
|
|
179
176
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
177
|
+
// listenToUrlChanges() {
|
|
178
|
+
// const self = this;
|
|
179
|
+
// // window.addEventListener('hashchange', function () {
|
|
180
|
+
// window.addEventListener('locationchange', function () {
|
|
185
181
|
|
|
186
|
-
|
|
187
|
-
const prevState = state;
|
|
188
|
-
if (nextState !== prevState) {
|
|
189
|
-
console.log(`State change: ${prevState} >>> ${nextState}`);
|
|
190
|
-
state = nextState;
|
|
191
|
-
}
|
|
192
|
-
};
|
|
182
|
+
// console.log('location changed!');
|
|
193
183
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
184
|
+
// const convId = getParameterByName('convId')
|
|
185
|
+
// console.log('[APP-COMP] getParameterByName convId ', convId)
|
|
186
|
+
// if (convId) {
|
|
187
|
+
// setTimeout(() => {
|
|
188
|
+
// self.events.publish('supportconvid:haschanged', convId);
|
|
189
|
+
// }, 0);
|
|
190
|
+
// }
|
|
197
191
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
192
|
+
// const contact_id = getParameterByName('contact_id')
|
|
193
|
+
// console.log('[APP-COMP] getParameterByName contact_id ', contact_id)
|
|
194
|
+
// const contact_fullname = getParameterByName('contact_fullname')
|
|
195
|
+
// console.log('[APP-COMP] getParameterByName contact_fullname ', contact_fullname)
|
|
196
|
+
// if (contact_id && contact_fullname) {
|
|
197
|
+
// setTimeout(() => {
|
|
198
|
+
// self.router.navigateByUrl('conversation-detail/' + contact_id + '/' + contact_fullname + '/new');
|
|
199
|
+
// self.events.publish('directconvid:haschanged', contact_id);
|
|
200
|
+
// }, 0);
|
|
201
|
+
|
|
202
|
+
// } else {
|
|
203
|
+
// // console.log('[APP-COMP] contact_id and contact_fullname are null')
|
|
204
|
+
// }
|
|
204
205
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
206
|
+
// const conversation_detail = getParameterByName('conversation_detail')
|
|
207
|
+
// // console.log('[APP-COMP] getParameterByName conversation_detail ', conversation_detail)
|
|
208
|
+
// if (conversation_detail) {
|
|
209
|
+
// setTimeout(() => {
|
|
210
|
+
// self.router.navigate(['conversation-detail/'])
|
|
211
|
+
// }, 0);
|
|
212
|
+
// }
|
|
213
|
+
// });
|
|
214
|
+
// }
|
|
215
|
+
|
|
216
|
+
// getPageState() {
|
|
217
|
+
// const getState = () => {
|
|
218
|
+
|
|
219
|
+
// console.log('[APP-COMP] getState')
|
|
220
|
+
// // localStorage.setItem('visibilityState', document.visibilityState)
|
|
221
|
+
// if (document.visibilityState === 'hidden') {
|
|
222
|
+
// return 'hidden';
|
|
223
|
+
// }
|
|
224
|
+
// if (document.hasFocus()) {
|
|
225
|
+
// return 'active';
|
|
226
|
+
// }
|
|
227
|
+
// return 'passive';
|
|
228
|
+
// };
|
|
229
|
+
|
|
230
|
+
// let state = getState();
|
|
231
|
+
|
|
232
|
+
// const logStateChange = (nextState) => {
|
|
233
|
+
|
|
234
|
+
// const prevState = state;
|
|
235
|
+
// if (nextState !== prevState) {
|
|
236
|
+
// console.log(`State change: ${prevState} >>> ${nextState}`);
|
|
237
|
+
// state = nextState;
|
|
238
|
+
|
|
239
|
+
// }
|
|
240
|
+
// };
|
|
241
|
+
|
|
242
|
+
// ['pageshow', 'focus', 'blur', 'visibilitychange', 'resume'].forEach((type) => {
|
|
243
|
+
// window.addEventListener(type, () => logStateChange(getState()), { capture: true });
|
|
244
|
+
// });
|
|
245
|
+
|
|
246
|
+
// // The next two listeners, on the other hand, can determine the next
|
|
247
|
+
// // state from the event itself.
|
|
248
|
+
// window.addEventListener('freeze', () => {
|
|
249
|
+
// // In the freeze event, the next state is always frozen.
|
|
250
|
+
// logStateChange('frozen');
|
|
251
|
+
// }, { capture: true });
|
|
252
|
+
|
|
253
|
+
// window.addEventListener('pagehide', (event) => {
|
|
254
|
+
// if (event.persisted) {
|
|
255
|
+
// // If the event's persisted property is `true` the page is about
|
|
256
|
+
// // to enter the Back-Forward Cache, which is also in the frozen state.
|
|
257
|
+
// logStateChange('frozen');
|
|
258
|
+
// localStorage.setItem('state', 'frozen')
|
|
259
|
+
// } else {
|
|
260
|
+
// // If the event's persisted property is not `true` the page is
|
|
261
|
+
// // about to be unloaded.
|
|
262
|
+
// logStateChange('terminated');
|
|
263
|
+
// localStorage.setItem('state', 'terminated')
|
|
264
|
+
// localStorage.setItem('terminated', 'true')
|
|
265
|
+
// }
|
|
266
|
+
// }, { capture: true });
|
|
267
|
+
|
|
268
|
+
// }
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
saveInStorageNumberOfOpenedChatTab() {
|
|
272
|
+
this.logger.log('Calling saveInStorageChatOpenedTab!');
|
|
273
|
+
|
|
274
|
+
// https://jsfiddle.net/jjjs5wd3/3/å
|
|
275
|
+
if (+localStorage.tabCount > 0) {
|
|
276
|
+
this.logger.log('Chat IONIC Already open!');
|
|
277
|
+
} else {
|
|
278
|
+
localStorage.tabCount = 0;
|
|
279
|
+
|
|
280
|
+
localStorage.tabCount = +localStorage.tabCount + 1;
|
|
281
|
+
}
|
|
282
|
+
const terminationEvent = 'onpagehide' in self ? 'pagehide' : 'unload';
|
|
283
|
+
window.addEventListener(terminationEvent, (event) => {
|
|
284
|
+
if (localStorage.tabCount > 0) {
|
|
285
|
+
localStorage.tabCount = +localStorage.tabCount - 1;
|
|
216
286
|
}
|
|
217
287
|
}, { capture: true });
|
|
218
|
-
|
|
219
288
|
}
|
|
220
289
|
|
|
221
290
|
|
|
291
|
+
|
|
222
292
|
// param() {
|
|
223
293
|
// // PARAM
|
|
224
294
|
// const url: URL = new URL(window.top.location.href);
|
|
@@ -252,16 +322,16 @@ export class AppComponent implements OnInit {
|
|
|
252
322
|
this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN the current user already exist DON\'T SAVE ')
|
|
253
323
|
}
|
|
254
324
|
}
|
|
255
|
-
this.initializeApp('oninit');
|
|
256
325
|
|
|
326
|
+
|
|
327
|
+
this.initializeApp('oninit');
|
|
257
328
|
this.listenToPostMsgs();
|
|
258
329
|
}
|
|
259
330
|
|
|
260
331
|
|
|
261
|
-
|
|
262
332
|
listenToPostMsgs() {
|
|
263
333
|
window.addEventListener("message", (event) => {
|
|
264
|
-
|
|
334
|
+
this.logger.log("[APP-COMP] message event ", event);
|
|
265
335
|
|
|
266
336
|
if (event && event.data && event.data.action && event.data.parameter) {
|
|
267
337
|
if (event.data.action === 'openJoinConversationModal') {
|
|
@@ -270,6 +340,18 @@ export class AppComponent implements OnInit {
|
|
|
270
340
|
this.presentAlertConfirmJoinRequest(event.data.parameter, event.data.calledBy)
|
|
271
341
|
}
|
|
272
342
|
}
|
|
343
|
+
// if (event && event.data && event.data.action && event.data.parameter) {
|
|
344
|
+
// if (event.data.action === 'hasArchived') {
|
|
345
|
+
// var iframeWin = <HTMLIFrameElement>document.getElementById("unassigned-convs-iframe")
|
|
346
|
+
// const isIFrame = (input: HTMLElement | null): input is HTMLIFrameElement =>
|
|
347
|
+
// input !== null && input.tagName === 'IFRAME';
|
|
348
|
+
// if (isIFrame(iframeWin) && iframeWin.contentWindow) {
|
|
349
|
+
// const msg = { action: "hasArchived", parameter: event.data.parameter, calledBy: event.data.calledBy }
|
|
350
|
+
// iframeWin.contentWindow.postMessage(msg, '*');
|
|
351
|
+
// }
|
|
352
|
+
|
|
353
|
+
// }
|
|
354
|
+
// }
|
|
273
355
|
if (event && event.data && event.data.action && event.data.text) {
|
|
274
356
|
if (event.data.action === "display_toast_join_complete") {
|
|
275
357
|
this.presentToastJoinComplete(event.data.text)
|
|
@@ -345,11 +427,11 @@ export class AppComponent implements OnInit {
|
|
|
345
427
|
/** */
|
|
346
428
|
initializeApp(calledby: string) {
|
|
347
429
|
// this.logger.log('[APP-COMP] - X - initializeApp !!! CALLED-BY: ', calledby);
|
|
348
|
-
//
|
|
430
|
+
// console.log('[APP-COMP] appconfig platform is cordova: ', this.platform.is('cordova'))
|
|
349
431
|
|
|
350
|
-
if (!this.platform.is('cordova')) {
|
|
351
|
-
|
|
352
|
-
}
|
|
432
|
+
// if (!this.platform.is('cordova')) {
|
|
433
|
+
this.splashScreen.show();
|
|
434
|
+
// }
|
|
353
435
|
this.tabTitle = document.title;
|
|
354
436
|
|
|
355
437
|
this.getRouteParamsAndSetLoggerConfig();
|
|
@@ -367,12 +449,18 @@ export class AppComponent implements OnInit {
|
|
|
367
449
|
this.notificationsEnabled = true;
|
|
368
450
|
this.zone = new NgZone({}); // a cosa serve?
|
|
369
451
|
|
|
452
|
+
// ------------------------------------------
|
|
453
|
+
// Platform ready
|
|
454
|
+
// ------------------------------------------
|
|
370
455
|
this.platform.ready().then(() => {
|
|
456
|
+
// console.log("Check platform");
|
|
457
|
+
this.getPlatformName();
|
|
458
|
+
|
|
371
459
|
this.setLanguage();
|
|
372
460
|
|
|
373
|
-
if (this.splashScreen) {
|
|
374
|
-
|
|
375
|
-
}
|
|
461
|
+
// if (this.splashScreen) {
|
|
462
|
+
this.splashScreen.hide();
|
|
463
|
+
// }
|
|
376
464
|
this.statusBar.styleDefault();
|
|
377
465
|
this.navService.init(this.sidebarNav, this.detailNav);
|
|
378
466
|
// this.persistence = appconfig.authPersistence;
|
|
@@ -408,6 +496,59 @@ export class AppComponent implements OnInit {
|
|
|
408
496
|
});
|
|
409
497
|
}
|
|
410
498
|
|
|
499
|
+
getPlatformName() {
|
|
500
|
+
if (this.platform.is('cordova')) {
|
|
501
|
+
this.logger.log("the device running Cordova");
|
|
502
|
+
}
|
|
503
|
+
if (!this.platform.is('cordova')) {
|
|
504
|
+
this.logger.log("the device Not running Cordova");
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
if (this.platform.is('android')) {
|
|
508
|
+
this.logger.log("running on Android device!");
|
|
509
|
+
}
|
|
510
|
+
if (this.platform.is('ios')) {
|
|
511
|
+
this.logger.log("running on iOS device!");
|
|
512
|
+
}
|
|
513
|
+
if (this.platform.is('mobileweb')) {
|
|
514
|
+
this.logger.log("running in a browser on mobile!");
|
|
515
|
+
}
|
|
516
|
+
if (this.platform.is('desktop')) {
|
|
517
|
+
this.logger.log("running on desktop!");
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
getRouteParamsAndSetLoggerConfig() {
|
|
523
|
+
const appconfig = this.appConfigProvider.getConfig();
|
|
524
|
+
this.route.queryParams.subscribe(params => {
|
|
525
|
+
// this.logger.log('[APP-COMP] getRouteParamsAndSetLoggerConfig - queryParams params: ', params)
|
|
526
|
+
if (params.logLevel) {
|
|
527
|
+
this.logger.log('[APP-COMP] getRouteParamsAndSetLoggerConfig - log level get from queryParams: ', params.logLevel)
|
|
528
|
+
this.logger.setLoggerConfig(true, params.logLevel)
|
|
529
|
+
} else {
|
|
530
|
+
this.logger.info('[APP-COMP] getRouteParamsAndSetLoggerConfig - log level get from appconfig: ', appconfig.logLevel)
|
|
531
|
+
this.logger.setLoggerConfig(true, appconfig.logLevel)
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/** */
|
|
537
|
+
setLanguage() {
|
|
538
|
+
this.translate.setDefaultLang('en');
|
|
539
|
+
this.translate.use('en');
|
|
540
|
+
this.logger.debug('[APP-COMP] navigator.language: ', navigator.language);
|
|
541
|
+
let language;
|
|
542
|
+
if (navigator.language.indexOf('-') !== -1) {
|
|
543
|
+
language = navigator.language.substring(0, navigator.language.indexOf('-'));
|
|
544
|
+
} else if (navigator.language.indexOf('_') !== -1) {
|
|
545
|
+
language = navigator.language.substring(0, navigator.language.indexOf('_'));
|
|
546
|
+
} else {
|
|
547
|
+
language = navigator.language;
|
|
548
|
+
}
|
|
549
|
+
this.translate.use(language);
|
|
550
|
+
}
|
|
551
|
+
|
|
411
552
|
|
|
412
553
|
watchToConnectionStatus() {
|
|
413
554
|
this.networkService.checkInternetFunc().subscribe(isOnline => {
|
|
@@ -461,21 +602,6 @@ export class AppComponent implements OnInit {
|
|
|
461
602
|
}
|
|
462
603
|
|
|
463
604
|
|
|
464
|
-
getRouteParamsAndSetLoggerConfig() {
|
|
465
|
-
const appconfig = this.appConfigProvider.getConfig();
|
|
466
|
-
this.route.queryParams.subscribe(params => {
|
|
467
|
-
// this.logger.log('[APP-COMP] getRouteParamsAndSetLoggerConfig - queryParams params: ', params)
|
|
468
|
-
if (params.logLevel) {
|
|
469
|
-
this.logger.log('[APP-COMP] getRouteParamsAndSetLoggerConfig - log level get from queryParams: ', params.logLevel)
|
|
470
|
-
this.logger.setLoggerConfig(true, params.logLevel)
|
|
471
|
-
} else {
|
|
472
|
-
this.logger.info('[APP-COMP] getRouteParamsAndSetLoggerConfig - log level get from appconfig: ', appconfig.logLevel)
|
|
473
|
-
this.logger.setLoggerConfig(true, appconfig.logLevel)
|
|
474
|
-
}
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
|
|
479
605
|
translateToastMsgs() {
|
|
480
606
|
this.translate.get('AnErrorOccurredWhileUnsubscribingFromNotifications')
|
|
481
607
|
.subscribe((text: string) => {
|
|
@@ -530,116 +656,14 @@ export class AppComponent implements OnInit {
|
|
|
530
656
|
// }
|
|
531
657
|
// }
|
|
532
658
|
|
|
533
|
-
connetWebsocket(tiledeskToken) {
|
|
534
|
-
const appconfig = this.appConfigProvider.getConfig();
|
|
535
|
-
this.logger.log('connetWebsocket appconfig wsUrl ', appconfig.wsUrl)
|
|
536
|
-
const WS_URL = appconfig.wsUrl + '?token=' + tiledeskToken
|
|
537
|
-
this.webSocketJs.init(
|
|
538
|
-
WS_URL,
|
|
539
|
-
undefined,
|
|
540
|
-
undefined,
|
|
541
|
-
undefined
|
|
542
|
-
);
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
/**
|
|
546
|
-
* goOnLine:
|
|
547
|
-
* 1 - nascondo splashscreen
|
|
548
|
-
* 2 - recupero il tiledeskToken e lo salvo in chat manager
|
|
549
|
-
* 3 - carico in d
|
|
550
|
-
* @param user
|
|
551
|
-
*/
|
|
552
|
-
goOnLine = () => {
|
|
553
|
-
// this.isOnline = true;
|
|
554
|
-
// this.logger.info('initialize FROM [APP-COMP] - [APP-COMP] - GO-ONLINE isOnline ', this.isOnline);
|
|
555
|
-
|
|
556
|
-
// clearTimeout(this.timeModalLogin);
|
|
557
|
-
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
|
|
558
|
-
this.connetWebsocket(tiledeskToken)
|
|
559
|
-
|
|
560
|
-
const currentUser = this.tiledeskAuthService.getCurrentUser();
|
|
561
|
-
// this.logger.printDebug('APP-COMP - goOnLine****', currentUser);
|
|
562
|
-
this.logger.log('[APP-COMP] - GO-ONLINE - currentUser ', currentUser);
|
|
563
|
-
this.chatManager.setTiledeskToken(tiledeskToken);
|
|
564
|
-
this.chatManager.setCurrentUser(currentUser);
|
|
565
|
-
// ----------------------------------------------
|
|
566
|
-
// PUSH NOTIFICATIONS
|
|
567
|
-
// ----------------------------------------------
|
|
568
|
-
const pushEngine = this.appConfigProvider.getConfig().pushEngine
|
|
569
|
-
|
|
570
|
-
if (currentUser) {
|
|
571
|
-
if (pushEngine && pushEngine !== 'none') {
|
|
572
|
-
this.notificationsService.getNotificationPermissionAndSaveToken(currentUser.uid);
|
|
573
|
-
}
|
|
574
|
-
this.presenceService.setPresence(currentUser.uid);
|
|
575
|
-
|
|
576
|
-
this.initConversationsHandler(currentUser.uid);
|
|
577
|
-
this.initArchivedConversationsHandler(currentUser.uid);
|
|
578
|
-
}
|
|
579
|
-
this.checkPlatform();
|
|
580
|
-
try {
|
|
581
|
-
this.logger.debug('[APP-COMP] ************** closeModal', this.authModal);
|
|
582
|
-
if (this.authModal) {
|
|
583
|
-
this.closeModal();
|
|
584
|
-
}
|
|
585
|
-
} catch (err) {
|
|
586
|
-
this.logger.error('[APP-COMP] -> error:', err);
|
|
587
|
-
}
|
|
588
|
-
this.chatManager.startApp();
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
webSocketClose() {
|
|
593
|
-
this.logger.log('[APP-COMP] - GO-OFFLINE - webSocketClose');
|
|
594
|
-
this.webSocketJs.close()
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
goOffLine = () => {
|
|
598
|
-
this.logger.log('[APP-COMP] - GO-OFFLINE');
|
|
599
|
-
|
|
600
|
-
this.webSocketClose()
|
|
601
|
-
// this.isOnline = false;
|
|
602
|
-
// this.conversationsHandlerService.conversations = [];
|
|
603
|
-
|
|
604
|
-
this.chatManager.setTiledeskToken(null);
|
|
605
|
-
this.chatManager.setCurrentUser(null);
|
|
606
|
-
this.chatManager.goOffLine();
|
|
607
|
-
|
|
608
|
-
this.router.navigateByUrl('conversation-detail/'); //redirect to basePage
|
|
609
|
-
|
|
610
|
-
// clearTimeout(this.timeModalLogin);
|
|
611
|
-
// this.timeModalLogin = setTimeout(() => {
|
|
612
|
-
if (!this.hadBeenCalledOpenModal) {
|
|
613
|
-
this.authModal = this.presentModal('goOffLine');
|
|
614
|
-
this.hadBeenCalledOpenModal = true
|
|
615
|
-
}
|
|
616
|
-
// }, 1000);
|
|
617
|
-
|
|
618
|
-
// this.unsubscribe$.next();
|
|
619
|
-
// this.unsubscribe$.complete();
|
|
620
659
|
|
|
621
|
-
}
|
|
622
660
|
/**------- AUTHENTICATION FUNCTIONS --> END <--- +*/
|
|
623
661
|
/***************************************************+*/
|
|
624
662
|
|
|
625
|
-
|
|
626
|
-
setLanguage() {
|
|
627
|
-
this.translate.setDefaultLang('en');
|
|
628
|
-
this.translate.use('en');
|
|
629
|
-
this.logger.debug('[APP-COMP] navigator.language: ', navigator.language);
|
|
630
|
-
let language;
|
|
631
|
-
if (navigator.language.indexOf('-') !== -1) {
|
|
632
|
-
language = navigator.language.substring(0, navigator.language.indexOf('-'));
|
|
633
|
-
} else if (navigator.language.indexOf('_') !== -1) {
|
|
634
|
-
language = navigator.language.substring(0, navigator.language.indexOf('_'));
|
|
635
|
-
} else {
|
|
636
|
-
language = navigator.language;
|
|
637
|
-
}
|
|
638
|
-
this.translate.use(language);
|
|
639
|
-
}
|
|
663
|
+
|
|
640
664
|
|
|
641
665
|
checkPlatform() {
|
|
642
|
-
|
|
666
|
+
// console.log('[APP-COMP] checkPlatform');
|
|
643
667
|
// let pageUrl = '';
|
|
644
668
|
// try {
|
|
645
669
|
// const pathPage = this.route.snapshot.firstChild.routeConfig.path;
|
|
@@ -655,21 +679,31 @@ export class AppComponent implements OnInit {
|
|
|
655
679
|
// }
|
|
656
680
|
|
|
657
681
|
if (checkPlatformIsMobile()) {
|
|
682
|
+
// this.chatManager.startApp()
|
|
683
|
+
|
|
684
|
+
this.logger.log('[APP-COMP] checkPlatformIsMobile', checkPlatformIsMobile());
|
|
658
685
|
this.platformIs = PLATFORM_MOBILE;
|
|
659
686
|
const IDConv = this.route.snapshot.firstChild.paramMap.get('IDConv');
|
|
660
|
-
|
|
687
|
+
|
|
688
|
+
// console.log('[APP-COMP] platformIs', this.platformIs);
|
|
689
|
+
// console.log('[APP-COMP] PLATFORM', PLATFORM_MOBILE, 'route.snapshot', this.route.snapshot);
|
|
661
690
|
if (!IDConv) {
|
|
662
691
|
this.router.navigateByUrl('conversations-list')
|
|
663
692
|
}
|
|
664
693
|
// this.router.navigateByUrl(pageUrl);
|
|
665
694
|
// this.navService.setRoot(ConversationListPage, {});
|
|
666
695
|
} else {
|
|
696
|
+
// this.chatManager.startApp()
|
|
697
|
+
this.logger.log('[APP-COMP] checkPlatformIsMobile', checkPlatformIsMobile());
|
|
667
698
|
this.platformIs = PLATFORM_DESKTOP;
|
|
699
|
+
// console.log('[APP-COMP] platformIs', this.platformIs);
|
|
700
|
+
// console.log('[APP-COMP] PLATFORM', PLATFORM_DESKTOP, 'route.snapshot', this.route.snapshot);
|
|
668
701
|
this.logger.log('[APP-COMP] PLATFORM_DESKTOP ', this.navService);
|
|
669
702
|
|
|
670
703
|
this.navService.setRoot(ConversationListPage, {});
|
|
671
704
|
|
|
672
705
|
const IDConv = this.route.snapshot.firstChild.paramMap.get('IDConv');
|
|
706
|
+
|
|
673
707
|
const FullNameConv = this.route.snapshot.firstChild.paramMap.get('FullNameConv');
|
|
674
708
|
const Convtype = this.route.snapshot.firstChild.paramMap.get('Convtype');
|
|
675
709
|
|
|
@@ -704,16 +738,23 @@ export class AppComponent implements OnInit {
|
|
|
704
738
|
}
|
|
705
739
|
|
|
706
740
|
private initAudio() {
|
|
741
|
+
// console.log('HERE IS initAudio ')
|
|
707
742
|
// SET AUDIO
|
|
743
|
+
const href = window.location.href;
|
|
744
|
+
const hrefArray = href.split('/#/');
|
|
745
|
+
const chatBaseUrl = hrefArray[0]
|
|
746
|
+
// console.log('initAudio href', href)
|
|
747
|
+
// console.log('initAudio chatBaseUrl', chatBaseUrl)
|
|
748
|
+
|
|
708
749
|
this.audio = new Audio();
|
|
709
|
-
this.audio.src = URL_SOUND_LIST_CONVERSATION;
|
|
750
|
+
this.audio.src = chatBaseUrl + URL_SOUND_LIST_CONVERSATION;
|
|
710
751
|
this.audio.load();
|
|
711
752
|
}
|
|
712
753
|
|
|
713
754
|
private manageTabNotification() {
|
|
714
755
|
if (!this.isTabVisible) {
|
|
715
756
|
// TAB IS HIDDEN --> manage title and SOUND
|
|
716
|
-
|
|
757
|
+
// console.log('HERE IS manageTabNotification ')
|
|
717
758
|
let badgeNewConverstionNumber = this.conversationsHandlerService.countIsNew()
|
|
718
759
|
badgeNewConverstionNumber > 0 ? badgeNewConverstionNumber : badgeNewConverstionNumber = 1
|
|
719
760
|
document.title = "(" + badgeNewConverstionNumber + ") " + this.tabTitle
|
|
@@ -732,6 +773,7 @@ export class AppComponent implements OnInit {
|
|
|
732
773
|
}
|
|
733
774
|
|
|
734
775
|
soundMessage() {
|
|
776
|
+
// console.log('HERE IS soundMessage ')
|
|
735
777
|
const that = this;
|
|
736
778
|
// this.audio = new Audio();
|
|
737
779
|
// // this.audio.src = '/assets/sounds/pling.mp3';
|
|
@@ -743,7 +785,7 @@ export class AppComponent implements OnInit {
|
|
|
743
785
|
that.audio.play().then(() => {
|
|
744
786
|
that.logger.debug('[APP-COMP] ****** soundMessage played *****');
|
|
745
787
|
}).catch((error: any) => {
|
|
746
|
-
that.logger.
|
|
788
|
+
that.logger.error('[APP-COMP] ***soundMessage error*', error);
|
|
747
789
|
});
|
|
748
790
|
}, 1000);
|
|
749
791
|
}
|
|
@@ -758,7 +800,6 @@ export class AppComponent implements OnInit {
|
|
|
758
800
|
initSubscriptions() {
|
|
759
801
|
this.logger.log('initialize FROM [APP-COMP] - initSubscriptions');
|
|
760
802
|
|
|
761
|
-
|
|
762
803
|
// ---------------------------------------------------------------------------------------------------
|
|
763
804
|
// Protecting from multiple subsciptions due to multiple app initializations (call to initializeApp())
|
|
764
805
|
// Only one subscriber x application allowed
|
|
@@ -806,7 +847,7 @@ export class AppComponent implements OnInit {
|
|
|
806
847
|
|
|
807
848
|
this.conversationsHandlerService.conversationChanged.subscribe((conversation: ConversationModel) => {
|
|
808
849
|
|
|
809
|
-
|
|
850
|
+
// console.log('[APP-COMP] ***** subscribeConversationChanged conversation: ', conversation);
|
|
810
851
|
const currentUser = JSON.parse(this.appStorageService.getItem('currentUser'));
|
|
811
852
|
this.logger.log('[APP-COMP] ***** subscribeConversationChanged current_user: ', currentUser);
|
|
812
853
|
|
|
@@ -819,6 +860,138 @@ export class AppComponent implements OnInit {
|
|
|
819
860
|
});
|
|
820
861
|
}
|
|
821
862
|
|
|
863
|
+
/**
|
|
864
|
+
* goOnLine:
|
|
865
|
+
* 1 - nascondo splashscreen
|
|
866
|
+
* 2 - recupero il tiledeskToken e lo salvo in chat manager
|
|
867
|
+
* 3 - carico in d
|
|
868
|
+
* @param user
|
|
869
|
+
*/
|
|
870
|
+
goOnLine = () => {
|
|
871
|
+
// console.log('[APP-COMP] - GO-ONLINE ');
|
|
872
|
+
// this.isOnline = true;
|
|
873
|
+
// this.logger.info('initialize FROM [APP-COMP] - [APP-COMP] - GO-ONLINE isOnline ', this.isOnline);
|
|
874
|
+
// clearTimeout(this.timeModalLogin);
|
|
875
|
+
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
|
|
876
|
+
|
|
877
|
+
const supportmode = this.appConfigProvider.getConfig().supportMode;
|
|
878
|
+
this.logger.log('[APP-COMP] - GO-ONLINE - supportmode ', supportmode);
|
|
879
|
+
// if (supportmode === true) {
|
|
880
|
+
this.connetWebsocket(tiledeskToken)
|
|
881
|
+
// }
|
|
882
|
+
this.events.publish('go:online', true);
|
|
883
|
+
const currentUser = this.tiledeskAuthService.getCurrentUser();
|
|
884
|
+
// this.logger.printDebug('APP-COMP - goOnLine****', currentUser);
|
|
885
|
+
this.logger.log('[APP-COMP] - GO-ONLINE - currentUser ', currentUser);
|
|
886
|
+
this.chatManager.setTiledeskToken(tiledeskToken);
|
|
887
|
+
this.chatManager.setCurrentUser(currentUser);
|
|
888
|
+
this.chatManager.startApp();
|
|
889
|
+
|
|
890
|
+
// ----------------------------------------------
|
|
891
|
+
// PUSH NOTIFICATIONS
|
|
892
|
+
// ----------------------------------------------
|
|
893
|
+
const pushEngine = this.appConfigProvider.getConfig().pushEngine
|
|
894
|
+
|
|
895
|
+
if (currentUser) {
|
|
896
|
+
if (pushEngine && pushEngine !== 'none') {
|
|
897
|
+
this.notificationsService.getNotificationPermissionAndSaveToken(currentUser.uid);
|
|
898
|
+
}
|
|
899
|
+
this.presenceService.setPresence(currentUser.uid);
|
|
900
|
+
|
|
901
|
+
this.initConversationsHandler(currentUser.uid);
|
|
902
|
+
this.initArchivedConversationsHandler(currentUser.uid);
|
|
903
|
+
}
|
|
904
|
+
this.checkPlatform();
|
|
905
|
+
try {
|
|
906
|
+
this.logger.debug('[APP-COMP] ************** closeModal', this.authModal);
|
|
907
|
+
if (this.authModal) {
|
|
908
|
+
this.closeModal();
|
|
909
|
+
}
|
|
910
|
+
} catch (err) {
|
|
911
|
+
this.logger.error('[APP-COMP] -> error:', err);
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
connetWebsocket(tiledeskToken) {
|
|
916
|
+
const appconfig = this.appConfigProvider.getConfig();
|
|
917
|
+
this.logger.log('connetWebsocket appconfig wsUrl ', appconfig.wsUrl)
|
|
918
|
+
const WS_URL = appconfig.wsUrl + '?token=' + tiledeskToken
|
|
919
|
+
this.webSocketJs.init(
|
|
920
|
+
WS_URL,
|
|
921
|
+
undefined,
|
|
922
|
+
undefined,
|
|
923
|
+
undefined
|
|
924
|
+
);
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
goOffLine = () => {
|
|
929
|
+
console.log('[APP-COMP] - GO-OFFLINE');
|
|
930
|
+
const supportmode = this.appConfigProvider.getConfig().supportMode;
|
|
931
|
+
this.logger.log('[APP-COMP] - GO-OFFINE - supportmode ', supportmode);
|
|
932
|
+
// if (supportmode === true) {
|
|
933
|
+
this.webSocketClose()
|
|
934
|
+
// }
|
|
935
|
+
// this.isOnline = false;
|
|
936
|
+
// this.conversationsHandlerService.conversations = [];
|
|
937
|
+
this.chatManager.setTiledeskToken(null);
|
|
938
|
+
this.chatManager.setCurrentUser(null);
|
|
939
|
+
this.chatManager.goOffLine();
|
|
940
|
+
|
|
941
|
+
this.router.navigateByUrl('conversation-detail/'); //redirect to basePage
|
|
942
|
+
|
|
943
|
+
// clearTimeout(this.timeModalLogin);
|
|
944
|
+
// this.timeModalLogin = setTimeout(() => {
|
|
945
|
+
if (!this.hadBeenCalledOpenModal) {
|
|
946
|
+
this.authModal = this.presentModal('goOffLine');
|
|
947
|
+
this.hadBeenCalledOpenModal = true
|
|
948
|
+
}
|
|
949
|
+
// }, 1000);
|
|
950
|
+
|
|
951
|
+
// this.unsubscribe$.next();
|
|
952
|
+
// this.unsubscribe$.complete();
|
|
953
|
+
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
|
|
957
|
+
webSocketClose() {
|
|
958
|
+
this.logger.log('[APP-COMP] - GO-OFFLINE - webSocketClose');
|
|
959
|
+
this.webSocketJs.close()
|
|
960
|
+
this.events.publish('go:offline', true);
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
// BEGIN RESIZE FUNCTIONS //
|
|
964
|
+
@HostListener('window:resize', ['$event'])
|
|
965
|
+
onResize(event: any) {
|
|
966
|
+
const that = this;
|
|
967
|
+
// this.logger.debug('this.doitResize)', this.doitResize)
|
|
968
|
+
// clearTimeout(this.doitResize);
|
|
969
|
+
// this.doitResize = setTimeout(() => {
|
|
970
|
+
let platformIsNow = PLATFORM_DESKTOP;
|
|
971
|
+
if (checkPlatformIsMobile()) {
|
|
972
|
+
platformIsNow = PLATFORM_MOBILE;
|
|
973
|
+
}
|
|
974
|
+
if (!this.platformIs || this.platformIs === '') {
|
|
975
|
+
this.platformIs = platformIsNow;
|
|
976
|
+
}
|
|
977
|
+
this.logger.debug('[APP-COMP] onResize width::::', window.innerWidth);
|
|
978
|
+
this.logger.debug('[APP-COMP] onResize width:::: platformIsNow', platformIsNow);
|
|
979
|
+
this.logger.debug('[APP-COMP] onResize width:::: this.platformIs', this.platformIs);
|
|
980
|
+
this.logger.debug('[APP-COMP] onResize width:::: platformIsNow', platformIsNow);
|
|
981
|
+
if (platformIsNow !== this.platformIs) {
|
|
982
|
+
window.location.reload();
|
|
983
|
+
// this.checkPlatform();
|
|
984
|
+
// this.initializeApp('onresize')
|
|
985
|
+
this.checkPlatform();
|
|
986
|
+
// this.goOnLine()
|
|
987
|
+
// // this.initSubscriptions();
|
|
988
|
+
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
// }, 0);
|
|
992
|
+
}
|
|
993
|
+
// END RESIZE FUNCTIONS //
|
|
994
|
+
|
|
822
995
|
/**
|
|
823
996
|
* ::: subscribeChangedConversationSelected :::
|
|
824
997
|
* evento richiamato quando si seleziona un utente nell'elenco degli user
|
|
@@ -853,9 +1026,8 @@ export class AppComponent implements OnInit {
|
|
|
853
1026
|
that.removePresenceAndLogout();
|
|
854
1027
|
// that.presentToast();
|
|
855
1028
|
}
|
|
856
|
-
})
|
|
1029
|
+
});
|
|
857
1030
|
}
|
|
858
|
-
|
|
859
1031
|
}
|
|
860
1032
|
}
|
|
861
1033
|
|
|
@@ -973,29 +1145,6 @@ export class AppComponent implements OnInit {
|
|
|
973
1145
|
this.archivedConversationsHandlerService.initialize(this.tenant, userId, translationMap);
|
|
974
1146
|
}
|
|
975
1147
|
|
|
976
|
-
// BEGIN RESIZE FUNCTIONS //
|
|
977
|
-
@HostListener('window:resize', ['$event'])
|
|
978
|
-
onResize(event: any) {
|
|
979
|
-
const that = this;
|
|
980
|
-
// this.logger.debug('this.doitResize)', this.doitResize)
|
|
981
|
-
clearTimeout(this.doitResize);
|
|
982
|
-
this.doitResize = setTimeout(() => {
|
|
983
|
-
let platformIsNow = PLATFORM_DESKTOP;
|
|
984
|
-
if (checkPlatformIsMobile()) {
|
|
985
|
-
platformIsNow = PLATFORM_MOBILE;
|
|
986
|
-
}
|
|
987
|
-
if (!this.platformIs || this.platformIs === '') {
|
|
988
|
-
this.platformIs = platformIsNow;
|
|
989
|
-
}
|
|
990
|
-
this.logger.debug('[APP-COMP] onResize width::::', window.innerWidth);
|
|
991
|
-
this.logger.debug('[APP-COMP] onResize width:::: platformIsNow', platformIsNow);
|
|
992
|
-
this.logger.debug('[APP-COMP] onResize width:::: platformIsNow this.platformIs', this.platformIs);
|
|
993
|
-
if (platformIsNow !== this.platformIs) {
|
|
994
|
-
window.location.reload();
|
|
995
|
-
}
|
|
996
|
-
}, 500);
|
|
997
|
-
}
|
|
998
|
-
// END RESIZE FUNCTIONS //
|
|
999
1148
|
|
|
1000
1149
|
@HostListener('document:visibilitychange', [])
|
|
1001
1150
|
visibilitychange() {
|
|
@@ -1015,7 +1164,7 @@ export class AppComponent implements OnInit {
|
|
|
1015
1164
|
// https://developer.mozilla.org/en-US/docs/Web/API/Window/storage_event
|
|
1016
1165
|
@HostListener('window:storage', ['$event'])
|
|
1017
1166
|
onStorageChanged(event: any) {
|
|
1018
|
-
|
|
1167
|
+
|
|
1019
1168
|
if (event.key !== 'chat_sv5__tiledeskToken') {
|
|
1020
1169
|
return;
|
|
1021
1170
|
}
|