@chat21/chat21-ionic 3.0.106 → 3.0.107-rc.2
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 +9 -0
- package/package.json +1 -1
- package/src/app/app.component.html +11 -6
- package/src/app/app.component.scss +34 -11
- package/src/app/app.component.ts +70 -39
- package/src/app/app.module.ts +7 -1
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts +0 -5
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +0 -1
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +4 -4
- package/src/app/components/conversations-list/header-conversations-list/header-conversations-list.component.html +2 -3
- package/src/app/components/navbar/navbar.component.scss +0 -5
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +10 -13
- package/src/app/pages/conversations-list/conversations-list.page.ts +10 -20
- package/src/app/services/global-settings/global-settings.service.spec.ts +16 -0
- package/src/app/services/global-settings/global-settings.service.ts +138 -0
- package/src/app/services/triggerEvents/trigerEvents.spec.ts +11 -0
- package/src/app/services/triggerEvents/triggerEvents.ts +92 -0
- package/src/app/utils/globals.ts +51 -0
- package/src/app/utils/toast.ts +1 -1
- package/src/assets/test.html +23 -0
- package/src/chat21-core/models/department.ts +12 -0
- package/src/chat21-core/providers/abstract/upload.service.ts +2 -0
- package/src/chat21-core/providers/chat-manager.ts +0 -20
- package/src/chat21-core/providers/firebase/firebase-upload.service.ts +83 -0
- package/src/chat21-core/providers/native/native-upload-service.ts +46 -0
- package/src/chat21-core/utils/utils.ts +33 -86
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# chat21-ionic ver 3.0
|
|
2
2
|
|
|
3
|
+
### 3.0.107.rc.2
|
|
4
|
+
- added: moved eventTrigger method from conversation-deatil and conversation-list pages to app.component.ts
|
|
5
|
+
|
|
6
|
+
### 3.0.107.rc.1
|
|
7
|
+
- added: globals and globals-settings services to manage env and option variables globally
|
|
8
|
+
- added: eventTrigger service to expose custom chat event to parent chat-iframe container
|
|
9
|
+
- added: new UI home management for supportMode
|
|
10
|
+
- bug-fixed: privateMsg colors not visible
|
|
11
|
+
|
|
3
12
|
### 3.0.106 in PROD
|
|
4
13
|
- changed: testsitebaseurl with widgetBaseUrl
|
|
5
14
|
- changed: WIDGET_TEST_LOCATION with WIDGET_LOCATION
|
package/package.json
CHANGED
|
@@ -7,28 +7,33 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
<app-navbar *ngIf="!IS_ON_MOBILE_DEVICE && lang"
|
|
10
|
+
[ngClass]="{'sidebar-hidden': IS_ON_MOBILE_DEVICE || SUPPORT_MODE === false }"
|
|
10
11
|
[isSoundEnabled]="isSoundEnabled"
|
|
11
12
|
(onSoundChange)="onSoundChange($event)">
|
|
12
13
|
</app-navbar>
|
|
13
14
|
|
|
14
|
-
<
|
|
15
|
+
<app-sidebar class="sidebar"
|
|
16
|
+
[ngClass]="{'sidebar-hidden': IS_ONLINE === false || IS_ON_MOBILE_DEVICE || SUPPORT_MODE === false}">
|
|
17
|
+
</app-sidebar>
|
|
18
|
+
|
|
19
|
+
<!-- <div class="sidebar" [ngClass]="{'hide-sidebar': IS_ONLINE === false || IS_ON_MOBILE_DEVICE === true || SUPPORT_MODE === false}">
|
|
15
20
|
<app-sidebar></app-sidebar>
|
|
16
|
-
</div>
|
|
21
|
+
</div> -->
|
|
17
22
|
|
|
18
|
-
<div class="user-details-sidebar" [ngClass]="{'hide-sidebar': IS_ONLINE === false || IS_ON_MOBILE_DEVICE
|
|
23
|
+
<div class="user-details-sidebar" [ngClass]="{'hide-sidebar': IS_ONLINE === false || IS_ON_MOBILE_DEVICE || SUPPORT_MODE === false}">
|
|
19
24
|
<app-sidebar-user-details> </app-sidebar-user-details>
|
|
20
25
|
</div>
|
|
21
26
|
|
|
22
|
-
<ion-split-pane when="md" contentId="main" [ngClass]="{'mobile': IS_ON_MOBILE_DEVICE}">
|
|
27
|
+
<ion-split-pane when="md" contentId="main" [ngClass]="{'mobile': IS_ON_MOBILE_DEVICE, 'sidebar-hidden': IS_ON_MOBILE_DEVICE || SUPPORT_MODE === false}">
|
|
23
28
|
<!-- 'sidebar-visible': IS_ONLINE === true && SUPPORT_MODE === true, -->
|
|
24
|
-
<ion-nav #sidebarNav [root]="sidebarPage"
|
|
29
|
+
<ion-nav #sidebarNav [root]="sidebarPage"></ion-nav>
|
|
25
30
|
<!-- our side menu -->
|
|
26
31
|
<!-- <ion-router-outlet id="sidebar" name='sidebar' animated="false" #masterNav> -->
|
|
27
32
|
<!-- <app-conversations-list></app-conversations-list> -->
|
|
28
33
|
<!-- </ion-router-outlet> -->
|
|
29
34
|
<!-- the main content -->
|
|
30
35
|
<!-- -->
|
|
31
|
-
<ion-router-outlet id="main" #detailNav animated="false"
|
|
36
|
+
<ion-router-outlet id="main" #detailNav animated="false">
|
|
32
37
|
</ion-router-outlet>
|
|
33
38
|
</ion-split-pane>
|
|
34
39
|
</div>
|
|
@@ -3,29 +3,52 @@
|
|
|
3
3
|
.split-pane-md.split-pane-visible > .split-pane-side {
|
|
4
4
|
min-width: 320px; //360px; //312px;
|
|
5
5
|
display: block; // Safari bug fix
|
|
6
|
-
margin-left: var(--sidebar-width);
|
|
7
6
|
--border: 0px;
|
|
8
|
-
background-color: var(--list-bkg-color);
|
|
7
|
+
// background-color: var(--list-bkg-color);
|
|
9
8
|
}
|
|
10
9
|
|
|
11
|
-
.split-pane-md:not(.mobile){
|
|
10
|
+
// .split-pane-md:not(.mobile){
|
|
11
|
+
// height: calc( 100% - var(--nav-bar-heigth));
|
|
12
|
+
// margin-top: var(--nav-bar-heigth);
|
|
13
|
+
// }
|
|
14
|
+
|
|
15
|
+
ion-split-pane:not(.mobile) {
|
|
12
16
|
height: calc( 100% - var(--nav-bar-heigth));
|
|
13
17
|
margin-top: var(--nav-bar-heigth);
|
|
18
|
+
margin-left: var(--sidebar-width);
|
|
19
|
+
// display: block; // Safari bug fix
|
|
20
|
+
// --border: 0px;
|
|
21
|
+
background-color: var(--list-bkg-color);
|
|
22
|
+
&.sidebar-hidden{
|
|
23
|
+
margin-left: 0px;
|
|
24
|
+
margin-top: 0px;
|
|
25
|
+
height: 100%;
|
|
26
|
+
}
|
|
14
27
|
}
|
|
15
28
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
display: flex;
|
|
19
|
-
position: fixed;
|
|
29
|
+
app-navbar{
|
|
30
|
+
position: absolute;
|
|
20
31
|
top: 0px;
|
|
32
|
+
width: calc(100% - var(--sidebar-width));
|
|
33
|
+
margin-left: var(--sidebar-width);
|
|
34
|
+
|
|
35
|
+
&.sidebar-hidden{
|
|
36
|
+
width: 100%;
|
|
37
|
+
margin-left: 0px;
|
|
38
|
+
}
|
|
21
39
|
}
|
|
22
40
|
|
|
23
|
-
|
|
24
|
-
|
|
41
|
+
app-sidebar{
|
|
42
|
+
&.sidebar-hidden{
|
|
43
|
+
display: none;
|
|
44
|
+
}
|
|
25
45
|
}
|
|
26
46
|
|
|
27
|
-
|
|
28
|
-
|
|
47
|
+
|
|
48
|
+
.navbar{
|
|
49
|
+
display: flex;
|
|
50
|
+
position: fixed;
|
|
51
|
+
top: 0px;
|
|
29
52
|
}
|
|
30
53
|
|
|
31
54
|
.hide-sidebar {
|
package/src/app/app.component.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, HostListener, NgZone, OnInit, ViewChild } from '@angular/core';
|
|
1
|
+
import { Component, ElementRef, HostListener, NgZone, OnInit, ViewChild } from '@angular/core';
|
|
2
2
|
|
|
3
3
|
import { AlertController, Config, IonNav, IonRouterOutlet, ModalController, NavController, Platform, ToastController } from '@ionic/angular';
|
|
4
4
|
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
|
|
@@ -8,7 +8,7 @@ import { Subscription } from 'rxjs';
|
|
|
8
8
|
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
9
9
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
10
10
|
import { WebSocketJs } from './services/websocket/websocket-js';
|
|
11
|
-
import { checkPlatformIsMobile, getParameterByName, isOnMobileDevice } from 'src/chat21-core/utils/utils';
|
|
11
|
+
import { checkPlatformIsMobile, getDateDifference, getParameterByName, isOnMobileDevice } from 'src/chat21-core/utils/utils';
|
|
12
12
|
import { EventsService } from './services/events-service';
|
|
13
13
|
import { NavProxyService } from './services/nav-proxy.service';
|
|
14
14
|
import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service';
|
|
@@ -37,6 +37,10 @@ import { ConversationListPage } from './pages/conversations-list/conversations-l
|
|
|
37
37
|
import { Location } from '@angular/common'
|
|
38
38
|
import { FCM } from 'cordova-plugin-fcm-with-dependecy-updated/ionic/ngx'
|
|
39
39
|
import { Deeplinks } from '@ionic-native/deeplinks/ngx';
|
|
40
|
+
import { TriggerEvents } from './services/triggerEvents/triggerEvents';
|
|
41
|
+
import { Globals } from './utils/globals';
|
|
42
|
+
import { GlobalSettingsService } from './services/global-settings/global-settings.service';
|
|
43
|
+
import { commandToMessage, conversationToMessage, isSender } from 'src/chat21-core/utils/utils-message';
|
|
40
44
|
|
|
41
45
|
@Component({
|
|
42
46
|
selector: 'app-root',
|
|
@@ -98,6 +102,7 @@ export class AppComponent implements OnInit {
|
|
|
98
102
|
private deeplinks: Deeplinks,
|
|
99
103
|
private appConfigProvider: AppConfigProvider,
|
|
100
104
|
public events: EventsService,
|
|
105
|
+
public triggerEvents: TriggerEvents,
|
|
101
106
|
public config: Config,
|
|
102
107
|
public chatManager: ChatManager,
|
|
103
108
|
public translate: TranslateService,
|
|
@@ -129,7 +134,10 @@ export class AppComponent implements OnInit {
|
|
|
129
134
|
public webSocketJs: WebSocketJs,
|
|
130
135
|
public scriptService: ScriptService,
|
|
131
136
|
public location: Location,
|
|
132
|
-
public fcm: FCM
|
|
137
|
+
public fcm: FCM,
|
|
138
|
+
public el: ElementRef,
|
|
139
|
+
public g: Globals,
|
|
140
|
+
public globalSettingsService: GlobalSettingsService,
|
|
133
141
|
) {
|
|
134
142
|
|
|
135
143
|
this.saveInStorageNumberOfOpenedChatTab();
|
|
@@ -261,19 +269,34 @@ export class AppComponent implements OnInit {
|
|
|
261
269
|
ngOnInit(): void {
|
|
262
270
|
const appconfig = this.appConfigProvider.getConfig();
|
|
263
271
|
this.logger.log('[APP-COMP] ngOnInit appconfig', appconfig)
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
272
|
+
|
|
273
|
+
this.globalSettingsService.obsSettingsService.subscribe((resp) => {
|
|
274
|
+
if(resp){
|
|
275
|
+
this.logger.log('[APP-COMP] ngOnInit globalSettingsService', this.g)
|
|
276
|
+
// /** INIT */
|
|
277
|
+
// this.getRouteParamsAndSetLoggerConfig();
|
|
278
|
+
|
|
279
|
+
// this.logger.info('[APP-COMP] appconfig: ', appconfig)
|
|
280
|
+
this.version = environment.version;
|
|
281
|
+
|
|
282
|
+
this.logger.setLoggerConfig(true, this.g.logLevel)
|
|
283
|
+
this.logger.info('[APP-COMP] logLevel: ', this.g.logLevel);
|
|
284
|
+
this.tabTitle = document.title;
|
|
285
|
+
// this.appStorageService.initialize(environment.storage_prefix, this.persistence, '') /** moved to globals-settings.service */
|
|
286
|
+
|
|
287
|
+
this.tenant = this.g.tenant;
|
|
288
|
+
this.persistence = this.g.persistence
|
|
289
|
+
this.logger.info('[APP-COMP] appconfig firebaseConfig tenant: ', this.tenant);
|
|
290
|
+
this.notificationsEnabled = true;
|
|
291
|
+
this.zone = new NgZone({}); // a cosa serve?
|
|
292
|
+
|
|
293
|
+
this.SUPPORT_MODE = this.g.supportMode
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
});
|
|
297
|
+
this.globalSettingsService.initParamiters(this.g, this.el);
|
|
298
|
+
|
|
299
|
+
const token = getParameterByName(window,'jwt')
|
|
277
300
|
// this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN token get with getParameterByName -->', token);
|
|
278
301
|
if (token) {
|
|
279
302
|
// this.isOnline = false;
|
|
@@ -291,6 +314,7 @@ export class AppComponent implements OnInit {
|
|
|
291
314
|
}
|
|
292
315
|
}
|
|
293
316
|
|
|
317
|
+
this.triggerEvents.setWindowContext(window.parent)
|
|
294
318
|
|
|
295
319
|
this.initializeApp('oninit');
|
|
296
320
|
this.loadCustomScript(appconfig)
|
|
@@ -397,22 +421,6 @@ export class AppComponent implements OnInit {
|
|
|
397
421
|
if (!this.platform.is('desktop')) {
|
|
398
422
|
this.splashScreen.show();
|
|
399
423
|
}
|
|
400
|
-
this.tabTitle = document.title;
|
|
401
|
-
|
|
402
|
-
this.getRouteParamsAndSetLoggerConfig();
|
|
403
|
-
|
|
404
|
-
const appconfig = this.appConfigProvider.getConfig();
|
|
405
|
-
// this.logger.info('[APP-COMP] appconfig: ', appconfig)
|
|
406
|
-
this.version = environment.version;
|
|
407
|
-
this.logger.info('[APP-COMP] version: ', this.version)
|
|
408
|
-
|
|
409
|
-
this.logger.setLoggerConfig(true, appconfig.logLevel)
|
|
410
|
-
this.logger.info('[APP-COMP] logLevel: ', appconfig.logLevel);
|
|
411
|
-
|
|
412
|
-
this.tenant = appconfig.firebaseConfig.tenant;
|
|
413
|
-
this.logger.info('[APP-COMP] appconfig firebaseConfig tenant: ', this.tenant);
|
|
414
|
-
this.notificationsEnabled = true;
|
|
415
|
-
this.zone = new NgZone({}); // a cosa serve?
|
|
416
424
|
|
|
417
425
|
this.platform.ready().then(() => {
|
|
418
426
|
let platform = this.getPlatformName();
|
|
@@ -445,7 +453,6 @@ export class AppComponent implements OnInit {
|
|
|
445
453
|
this.initAuthentication();
|
|
446
454
|
this.initSubscriptions();
|
|
447
455
|
this.initAudio();
|
|
448
|
-
|
|
449
456
|
this.logger.debug('[APP-COMP] initializeApp:: ', this.sidebarNav, this.detailNav);
|
|
450
457
|
|
|
451
458
|
this.translateToastMsgs();
|
|
@@ -732,7 +739,7 @@ export class AppComponent implements OnInit {
|
|
|
732
739
|
}
|
|
733
740
|
}, 1000)
|
|
734
741
|
}else{
|
|
735
|
-
this.goToDashboardLogin()
|
|
742
|
+
// this.goToDashboardLogin()
|
|
736
743
|
}
|
|
737
744
|
}
|
|
738
745
|
}
|
|
@@ -978,12 +985,14 @@ export class AppComponent implements OnInit {
|
|
|
978
985
|
this.IS_ONLINE = true;
|
|
979
986
|
// console.log('[APP-COMP] IS_ONLINE', this.IS_ONLINE)
|
|
980
987
|
this.goOnLine();
|
|
988
|
+
this.triggerOnAuthStateChanged(state)
|
|
981
989
|
// }
|
|
982
990
|
} else if (state === AUTH_STATE_OFFLINE) {
|
|
983
991
|
// this.checkTokenAndGoOffline() //se c'è un tiledeskToken salvato, allora aspetta, altrimenti vai offline
|
|
984
992
|
this.IS_ONLINE = false;
|
|
985
993
|
// console.log('[APP-COMP] IS_ONLINE', this.IS_ONLINE)
|
|
986
994
|
this.goOffLine()
|
|
995
|
+
this.triggerOnAuthStateChanged(state)
|
|
987
996
|
}
|
|
988
997
|
}, error => {
|
|
989
998
|
this.logger.error('initialize FROM [APP-COMP] - [APP-COMP] ***** BSAuthStateChanged * error * ', error)
|
|
@@ -998,8 +1007,9 @@ export class AppComponent implements OnInit {
|
|
|
998
1007
|
this.events.subscribe('convList:onConversationSelected', this.subscribeConversationSelected)
|
|
999
1008
|
this.conversationsHandlerService.conversationAdded.subscribe((conversation: ConversationModel) => {
|
|
1000
1009
|
this.logger.log('[APP-COMP] ***** subscribeConversationAdded *****', conversation);
|
|
1001
|
-
if (conversation && conversation.is_new === true) {
|
|
1010
|
+
if (conversation && conversation.is_new === true && this.isInitialized) {
|
|
1002
1011
|
this.manageTabNotification('conv_added', conversation.sound)
|
|
1012
|
+
this.manageEventNewConversation(conversation)
|
|
1003
1013
|
}
|
|
1004
1014
|
if(conversation) this.updateConversationsOnStorage()
|
|
1005
1015
|
});
|
|
@@ -1007,7 +1017,6 @@ export class AppComponent implements OnInit {
|
|
|
1007
1017
|
this.conversationsHandlerService.conversationChanged.subscribe((conversation: ConversationModel) => {
|
|
1008
1018
|
// console.log('[APP-COMP] ***** subscribeConversationChanged conversation: ', conversation);
|
|
1009
1019
|
if(conversation) this.updateConversationsOnStorage();
|
|
1010
|
-
const currentUser = this.tiledeskAuthService.getCurrentUser()
|
|
1011
1020
|
});
|
|
1012
1021
|
|
|
1013
1022
|
this.conversationsHandlerService.conversationChangedDetailed.subscribe((changes: {value: ConversationModel, previousValue: ConversationModel}) => {
|
|
@@ -1022,6 +1031,7 @@ export class AppComponent implements OnInit {
|
|
|
1022
1031
|
this.manageTabNotification('new_message', true);
|
|
1023
1032
|
}
|
|
1024
1033
|
}
|
|
1034
|
+
this.manageEventNewMessage(changes.value)
|
|
1025
1035
|
}
|
|
1026
1036
|
});
|
|
1027
1037
|
|
|
@@ -1095,9 +1105,7 @@ export class AppComponent implements OnInit {
|
|
|
1095
1105
|
goOffLine = () => {
|
|
1096
1106
|
this.logger.log('[APP-COMP] - GO-OFFLINE');
|
|
1097
1107
|
this.logger.log('[APP-COMP] - GO-OFFINE - supportmode ', this.SUPPORT_MODE);
|
|
1098
|
-
|
|
1099
|
-
this.webSocketClose()
|
|
1100
|
-
}
|
|
1108
|
+
this.webSocketClose()
|
|
1101
1109
|
// this.isOnline = false;
|
|
1102
1110
|
// this.conversationsHandlerService.conversations = [];
|
|
1103
1111
|
this.chatManager.setTiledeskToken(null);
|
|
@@ -1506,6 +1514,23 @@ export class AppComponent implements OnInit {
|
|
|
1506
1514
|
}
|
|
1507
1515
|
|
|
1508
1516
|
|
|
1517
|
+
private manageEventNewMessage(conversation: ConversationModel){
|
|
1518
|
+
const currentUser = this.tiledeskAuthService.getCurrentUser();
|
|
1519
|
+
let message = conversationToMessage(conversation, currentUser.uid)
|
|
1520
|
+
let duration = getDateDifference(message.timestamp, Date.now())
|
|
1521
|
+
if(duration.minutes > 1) return;
|
|
1522
|
+
if(message.isSender){
|
|
1523
|
+
this.triggerEvents.triggerAfterSendMessageEvent(message)
|
|
1524
|
+
}else if(!message.isSender){
|
|
1525
|
+
this.triggerEvents.triggerAfterMessageReceived(message)
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
private manageEventNewConversation(conversation){
|
|
1530
|
+
this.triggerEvents.triggerOnNewConversationInit(conversation)
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
|
|
1509
1534
|
@HostListener('document:visibilitychange', [])
|
|
1510
1535
|
visibilitychange() {
|
|
1511
1536
|
// this.logger.debug("document TITLE", document.hidden, document.title);
|
|
@@ -1571,6 +1596,12 @@ export class AppComponent implements OnInit {
|
|
|
1571
1596
|
}
|
|
1572
1597
|
|
|
1573
1598
|
|
|
1599
|
+
private triggerOnAuthStateChanged(event){
|
|
1600
|
+
const detailOBJ = { event: event, isLogged: true, user: this.tiledeskAuthService.getCurrentUser() , appConfigs: this.appConfigProvider.getConfig() }
|
|
1601
|
+
this.triggerEvents.triggerOnAuthStateChanged(detailOBJ)
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
|
|
1574
1605
|
// @HostListener('mouseenter', ['$event'])
|
|
1575
1606
|
// onMouseEnter(event: any) {
|
|
1576
1607
|
// console.log('HostListener onMouseEnter-->', event)
|
package/src/app/app.module.ts
CHANGED
|
@@ -114,6 +114,9 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
|
114
114
|
import { MapsPageModule } from './modals/maps/maps.module';
|
|
115
115
|
import { GoogleMapsModule } from '@angular/google-maps';
|
|
116
116
|
import { Deeplinks } from '@ionic-native/deeplinks/ngx';
|
|
117
|
+
import { TriggerEvents } from './services/triggerEvents/triggerEvents';
|
|
118
|
+
import { Globals } from './utils/globals';
|
|
119
|
+
import { GlobalSettingsService } from './services/global-settings/global-settings.service';
|
|
117
120
|
|
|
118
121
|
// FACTORIES
|
|
119
122
|
export function createTranslateLoader(http: HttpClient) {
|
|
@@ -314,6 +317,8 @@ const appInitializerFn = (appConfig: AppConfigProvider, logger: NGXLogger) => {
|
|
|
314
317
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
315
318
|
providers: [
|
|
316
319
|
AppConfigProvider, // https://juristr.com/blog/2018/01/ng-app-runtime-config/
|
|
320
|
+
Globals,
|
|
321
|
+
GlobalSettingsService,
|
|
317
322
|
{
|
|
318
323
|
provide: APP_INITIALIZER,
|
|
319
324
|
useFactory: appInitializerFn,
|
|
@@ -393,7 +398,8 @@ const appInitializerFn = (appConfig: AppConfigProvider, logger: NGXLogger) => {
|
|
|
393
398
|
ScriptService,
|
|
394
399
|
FCM,
|
|
395
400
|
InAppBrowser,
|
|
396
|
-
Deeplinks
|
|
401
|
+
Deeplinks,
|
|
402
|
+
TriggerEvents
|
|
397
403
|
]
|
|
398
404
|
})
|
|
399
405
|
export class AppModule { }
|
package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild, SimpleChanges } from '@angular/core';
|
|
2
2
|
import { MessageModel } from 'src/chat21-core/models/message';
|
|
3
|
-
import { isPopupUrl, popupUrl, stripTags } from 'src/chat21-core/utils/utils';
|
|
4
3
|
import { MSG_STATUS_SENT, MSG_STATUS_RETURN_RECEIPT, MSG_STATUS_SENT_SERVER, MAX_WIDTH_IMAGES, MESSAGE_TYPE_INFO, MESSAGE_TYPE_MINE, MESSAGE_TYPE_OTHERS } from 'src/chat21-core/utils/constants';
|
|
5
4
|
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
6
5
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
@@ -40,10 +39,6 @@ export class ConversationContentComponent implements OnInit {
|
|
|
40
39
|
firstScroll = true;
|
|
41
40
|
// ========= end:: gestione scroll view messaggi ======= //
|
|
42
41
|
|
|
43
|
-
// ========= begin:: dichiarazione funzioni ======= //
|
|
44
|
-
isPopupUrl = isPopupUrl;
|
|
45
|
-
popupUrl = popupUrl;
|
|
46
|
-
// ========= end:: dichiarazione funzioni ======= //
|
|
47
42
|
|
|
48
43
|
// ========== begin:: set icon status message ======= //
|
|
49
44
|
MSG_STATUS_SENT = MSG_STATUS_SENT;
|
|
@@ -162,7 +162,6 @@
|
|
|
162
162
|
</chat-avatar-image> -->
|
|
163
163
|
|
|
164
164
|
<div class="bubble-container">
|
|
165
|
-
|
|
166
165
|
<!--backgroundColor non viene ancora usato -->
|
|
167
166
|
<chat-bubble-message class="messages msg_receive" id="message_msg_receive"
|
|
168
167
|
[ngClass]="{'has-metadata': (isImage(message) || isFrame(message)), 'privateMsg': (message?.attributes && message?.attributes?.subtype === 'private')}"
|
|
@@ -222,8 +222,8 @@ ion-item {
|
|
|
222
222
|
border-bottom-right-radius: 0px;
|
|
223
223
|
|
|
224
224
|
&.privateMsg{
|
|
225
|
-
background-color: var(--bubble-privateMsg);
|
|
226
|
-
color: var(--bubble-privateMsgColor)
|
|
225
|
+
background-color: var(--bubble-privateMsg) !important;
|
|
226
|
+
color: var(--bubble-privateMsgColor) !important;
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
.no-background{
|
|
@@ -324,8 +324,8 @@ ion-item {
|
|
|
324
324
|
border-bottom-left-radius: 0px;
|
|
325
325
|
|
|
326
326
|
&.privateMsg{
|
|
327
|
-
background-color: var(--bubble-privateMsg);
|
|
328
|
-
color: var(--bubble-privateMsgColor)
|
|
327
|
+
background-color: var(--bubble-privateMsg) !important;
|
|
328
|
+
color: var(--bubble-privateMsgColor) !important;
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
.no-background{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<ion-toolbar [class.mobile]="isMobile">
|
|
2
2
|
|
|
3
|
-
<ion-buttons *ngIf="isMobile || supportMode
|
|
3
|
+
<ion-buttons *ngIf="isMobile || !supportMode" slot="start" style="height:60px">
|
|
4
4
|
<ion-button ion-button icon-only fill="clear" (click)="onOpenProfileInfo($event)">
|
|
5
5
|
<ion-icon slot="icon-only" name="reorder-three-outline"></ion-icon>
|
|
6
6
|
</ion-button>
|
|
@@ -22,8 +22,7 @@
|
|
|
22
22
|
</ion-buttons>
|
|
23
23
|
|
|
24
24
|
<ion-buttons slot="end">
|
|
25
|
-
|
|
26
|
-
<ion-button *ngIf="!isMobile" ion-button fill="clear" (click)="presentCreateTicketModal()"
|
|
25
|
+
<ion-button *ngIf="!isMobile && supportMode" ion-button fill="clear" (click)="presentCreateTicketModal()"
|
|
27
26
|
tooltip="{{translationMap?.get('CreateTicket')}}" placement="bottom">
|
|
28
27
|
<ion-icon slot="icon-only" name="ticket-outline"></ion-icon>
|
|
29
28
|
</ion-button>
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
.navbar-absolute{
|
|
2
|
-
position: absolute;
|
|
3
|
-
width: calc(100% - var(--sidebar-width));
|
|
4
|
-
margin-left: var(--sidebar-width);
|
|
5
2
|
padding-top: 5px;
|
|
6
3
|
z-index: 1;
|
|
7
4
|
padding-bottom: 5px;
|
|
8
5
|
border-bottom: 1px solid #e7e7e7;
|
|
9
|
-
top: 0;
|
|
10
|
-
|
|
11
6
|
-webkit-font-smoothing: auto;
|
|
12
7
|
}
|
|
13
8
|
|
|
@@ -46,7 +46,7 @@ import { ArchivedConversationsHandlerService } from 'src/chat21-core/providers/a
|
|
|
46
46
|
import { ConversationHandlerService } from 'src/chat21-core/providers/abstract/conversation-handler.service'
|
|
47
47
|
import { ContactsService } from 'src/app/services/contacts/contacts.service'
|
|
48
48
|
import { CannedResponsesService } from '../../services/canned-responses/canned-responses.service'
|
|
49
|
-
import {
|
|
49
|
+
import {getDateDifference} from 'src/chat21-core/utils/utils'
|
|
50
50
|
import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service'
|
|
51
51
|
import { PresenceService } from 'src/chat21-core/providers/abstract/presence.service'
|
|
52
52
|
import { CreateCannedResponsePage } from 'src/app/modals/create-canned-response/create-canned-response.page'
|
|
@@ -89,6 +89,9 @@ import { EventsService } from '../../services/events-service'
|
|
|
89
89
|
import { ScrollbarThemeDirective } from 'src/app/utils/scrollbar-theme.directive'
|
|
90
90
|
import { WebsocketService } from 'src/app/services/websocket/websocket.service';
|
|
91
91
|
import { Project } from 'src/chat21-core/models/projects';
|
|
92
|
+
import { AppStorageService } from 'src/chat21-core/providers/abstract/app-storage.service';
|
|
93
|
+
import { Globals } from 'src/app/utils/globals';
|
|
94
|
+
import { TriggerEvents } from 'src/app/services/triggerEvents/triggerEvents';
|
|
92
95
|
|
|
93
96
|
@Component({
|
|
94
97
|
selector: 'app-conversation-detail',
|
|
@@ -238,7 +241,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
238
241
|
private networkService: NetworkService,
|
|
239
242
|
private events: EventsService,
|
|
240
243
|
private webSocketService: WebsocketService,
|
|
241
|
-
private sanitizer: DomSanitizer
|
|
244
|
+
private sanitizer: DomSanitizer,
|
|
245
|
+
private g: Globals,
|
|
242
246
|
) {
|
|
243
247
|
// Change list on date change
|
|
244
248
|
this.route.paramMap.subscribe((params) => {
|
|
@@ -361,14 +365,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
361
365
|
}
|
|
362
366
|
|
|
363
367
|
getOSCODE() {
|
|
364
|
-
this.supportMode =
|
|
365
|
-
if (this.appConfigProvider.getConfig().supportMode === true || this.appConfigProvider.getConfig().supportMode === 'true') {
|
|
366
|
-
this.supportMode = true
|
|
367
|
-
} else if (this.appConfigProvider.getConfig().supportMode === false || this.appConfigProvider.getConfig().supportMode === 'false') {
|
|
368
|
-
this.supportMode = false
|
|
369
|
-
} else if (!this.appConfigProvider.getConfig().supportMode) {
|
|
370
|
-
this.supportMode = false
|
|
371
|
-
}
|
|
368
|
+
this.supportMode = this.g.supportMode
|
|
372
369
|
this.logger.log('[CONVS-DETAIL] AppConfigService getAppConfig supportMode', this.supportMode)
|
|
373
370
|
this.public_Key = this.appConfigProvider.getConfig().t2y12PruGU9wUtEGzBJfolMIgK
|
|
374
371
|
this.logger.log('[CONVS-DETAIL] AppConfigService getAppConfig public_Key', this.public_Key)
|
|
@@ -1178,7 +1175,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1178
1175
|
subscriptionKey = 'messageAdded'
|
|
1179
1176
|
subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
|
|
1180
1177
|
if (!subscription) {
|
|
1181
|
-
subscription = this.conversationHandlerService.messageAdded.subscribe((msg:
|
|
1178
|
+
subscription = this.conversationHandlerService.messageAdded.subscribe((msg: MessageModel) => {
|
|
1182
1179
|
this.logger.log('[CONVS-DETAIL] subscribe to messageAdded - msg ', msg)
|
|
1183
1180
|
if (msg) {
|
|
1184
1181
|
that.newMessageAdded(msg)
|
|
@@ -1193,7 +1190,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1193
1190
|
subscriptionKey = 'messageChanged'
|
|
1194
1191
|
subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
|
|
1195
1192
|
if (!subscription) {
|
|
1196
|
-
subscription = this.conversationHandlerService.messageChanged.subscribe((msg:
|
|
1193
|
+
subscription = this.conversationHandlerService.messageChanged.subscribe((msg: MessageModel) => {
|
|
1197
1194
|
this.logger.log('[CONVS-DETAIL] subscribe to messageChanged - msg ', msg)
|
|
1198
1195
|
})
|
|
1199
1196
|
const subscribe = { key: subscriptionKey, value: subscription }
|
|
@@ -1213,7 +1210,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1213
1210
|
subscriptionKey = 'messageInfo'
|
|
1214
1211
|
subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
|
|
1215
1212
|
if (!subscription) {
|
|
1216
|
-
subscription = this.conversationHandlerService.messageInfo.pipe(takeUntil(this.unsubscribe$)).subscribe((msg:
|
|
1213
|
+
subscription = this.conversationHandlerService.messageInfo.pipe(takeUntil(this.unsubscribe$)).subscribe((msg: MessageModel) => {
|
|
1217
1214
|
this.logger.log('[CONVS-DETAIL] subscribe to messageInfo - messageId ', msg, this.conversation)
|
|
1218
1215
|
if (msg) {
|
|
1219
1216
|
that.updateLeadInfo(msg)
|
|
@@ -18,8 +18,8 @@ import {
|
|
|
18
18
|
closeModal,
|
|
19
19
|
convertMessage,
|
|
20
20
|
isGroup,
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
getParameterValue,
|
|
22
|
+
getDateDifference,
|
|
23
23
|
} from '../../../chat21-core/utils/utils'
|
|
24
24
|
|
|
25
25
|
import { EventsService } from '../../services/events-service'
|
|
@@ -49,6 +49,9 @@ import { skip, takeUntil } from 'rxjs/operators'
|
|
|
49
49
|
import { REQUEST_ARCHIVED, TYPE_DIRECT } from 'src/chat21-core/utils/constants';
|
|
50
50
|
import { getProjectIdSelectedConversation } from 'src/chat21-core/utils/utils-message';
|
|
51
51
|
import { WebsocketService } from 'src/app/services/websocket/websocket.service';
|
|
52
|
+
import { Globals } from 'src/app/utils/globals';
|
|
53
|
+
import { TriggerEvents } from 'src/app/services/triggerEvents/triggerEvents';
|
|
54
|
+
import { MessageModel } from 'src/chat21-core/models/message';
|
|
52
55
|
|
|
53
56
|
@Component({
|
|
54
57
|
selector: 'app-conversations-list',
|
|
@@ -127,6 +130,7 @@ export class ConversationListPage implements OnInit {
|
|
|
127
130
|
public appConfigProvider: AppConfigProvider,
|
|
128
131
|
public platform: Platform,
|
|
129
132
|
public wsService: WebsocketService,
|
|
133
|
+
private g: Globals,
|
|
130
134
|
) {
|
|
131
135
|
this.checkPlatform();
|
|
132
136
|
this.translations();
|
|
@@ -216,24 +220,10 @@ export class ConversationListPage implements OnInit {
|
|
|
216
220
|
getAppConfigToHideDiplayBtns() {
|
|
217
221
|
const appConfig = this.appConfigProvider.getConfig()
|
|
218
222
|
// console.log('[CONVS-LIST-PAGE] - appConfig ', appConfig)
|
|
219
|
-
this.supportMode =
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
this.supportMode = false
|
|
224
|
-
}
|
|
225
|
-
this.archived_btn = null
|
|
226
|
-
if (appConfig && appConfig.archivedButton === true || appConfig.archivedButton === 'true') {
|
|
227
|
-
this.archived_btn = true;
|
|
228
|
-
} else if (appConfig && appConfig.archivedButton === false || appConfig.archivedButton === 'false') {
|
|
229
|
-
this.archived_btn = false;
|
|
230
|
-
}
|
|
231
|
-
this.writeto_btn = null
|
|
232
|
-
if (appConfig && appConfig.writeToButton === true || appConfig.writeToButton === 'true') {
|
|
233
|
-
this.writeto_btn = true;
|
|
234
|
-
} else if (appConfig && appConfig.writeToButton === false || appConfig.writeToButton === 'false') {
|
|
235
|
-
this.writeto_btn = false;
|
|
236
|
-
}
|
|
223
|
+
this.supportMode = this.g.supportMode;
|
|
224
|
+
this.archived_btn = getParameterValue('archivedButton', appConfig)
|
|
225
|
+
this.writeto_btn = getParameterValue('writeToButton', appConfig)
|
|
226
|
+
this.logger.debug('[CONVS-LIST-PAGE] parameters supportMode/archived_btn/writeto_btn', this.supportMode, this.archived_btn, this.writeto_btn)
|
|
237
227
|
|
|
238
228
|
|
|
239
229
|
const sound_status = localStorage.getItem('dshbrd----sound')
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { GlobalSettingsService } from './global-settings.service';
|
|
4
|
+
|
|
5
|
+
describe('GlobalSettingsService', () => {
|
|
6
|
+
let service: GlobalSettingsService;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
TestBed.configureTestingModule({});
|
|
10
|
+
service = TestBed.inject(GlobalSettingsService);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should be created', () => {
|
|
14
|
+
expect(service).toBeTruthy();
|
|
15
|
+
});
|
|
16
|
+
});
|