@chat21/chat21-ionic 3.0.57 → 3.0.59-rc12
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 +67 -0
- package/README.md +9 -0
- package/config.xml +11 -2
- package/env.sample +2 -0
- 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-routing.module.ts +21 -17
- package/src/app/app.component.html +6 -3
- package/src/app/app.component.ts +264 -75
- package/src/app/app.module.ts +16 -8
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html +1 -1
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +4 -4
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +8 -2
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +6 -1
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +7 -2
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +48 -3
- package/src/app/chatlib/conversation-detail/message/image/image.component.html +7 -6
- package/src/app/chatlib/conversation-detail/message/image/image.component.ts +20 -1
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +39 -9
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.scss +8 -144
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +14 -17
- package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.html +1 -1
- package/src/app/components/authentication/login/login.component.html +10 -10
- package/src/app/components/authentication/login/login.component.ts +2 -1
- package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.ts +1 -1
- package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.ts +1 -1
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +17 -12
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +12 -0
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +21 -5
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +3 -2
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +22 -17
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +46 -5
- package/src/app/components/ddp-header/ddp-header.component.html +1 -1
- package/src/app/components/ddp-header/ddp-header.component.ts +4 -2
- package/src/app/components/image-viewer/image-viewer.component.html +23 -0
- package/src/app/components/image-viewer/image-viewer.component.scss +107 -0
- package/src/app/components/image-viewer/image-viewer.component.spec.ts +24 -0
- package/src/app/components/image-viewer/image-viewer.component.ts +38 -0
- package/src/app/components/project-item/project-item.component.html +147 -0
- package/src/app/components/project-item/project-item.component.scss +669 -0
- package/src/app/components/project-item/project-item.component.spec.ts +24 -0
- package/src/app/components/project-item/project-item.component.ts +317 -0
- package/src/app/components/utils/avatar-profile/avatar-profile.component.html +7 -0
- package/src/app/components/utils/avatar-profile/avatar-profile.component.ts +22 -5
- package/src/app/pages/authentication/login/login.page.html +1 -2
- package/src/app/pages/authentication/login/login.page.ts +2 -2
- package/src/app/pages/conversation-detail/conversation-detail.page.html +5 -3
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +122 -30
- package/src/app/pages/conversations-list/conversations-list.page.html +44 -23
- package/src/app/pages/conversations-list/conversations-list.page.scss +290 -127
- package/src/app/pages/conversations-list/conversations-list.page.ts +131 -8
- package/src/app/pages/unassigned-conversations/unassigned-conversations-routing.module.ts +17 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.module.ts +22 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.html +22 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.scss +79 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.spec.ts +24 -0
- package/src/app/pages/unassigned-conversations/unassigned-conversations.page.ts +108 -0
- package/src/app/services/nav-proxy.service.ts +1 -1
- package/src/app/services/tiledesk/tiledesk.service.ts +22 -1
- package/src/app/services/websocket/websocket-js.ts +557 -0
- package/src/app/services/websocket/websocket.service.spec.ts +12 -0
- package/src/app/services/websocket/websocket.service.ts +274 -0
- package/src/app/shared/shared.module.ts +7 -1
- package/src/assets/i18n/en.json +9 -1
- package/src/assets/i18n/it.json +10 -2
- package/src/assets/js/chat21client.js +141 -67
- package/src/assets/transparent.png +0 -0
- package/src/chat-config-pre-test.json +4 -2
- package/src/chat-config-template.json +3 -1
- package/src/chat-config.json +3 -1
- package/src/chat21-core/providers/chat-manager.ts +3 -3
- package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +1 -1
- package/src/chat21-core/providers/firebase/firebase-auth-service.ts +50 -42
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +1 -1
- package/src/chat21-core/providers/firebase/firebase-notifications.ts +1 -1
- package/src/chat21-core/providers/firebase/firebase-presence.service.ts +2 -2
- package/src/chat21-core/providers/firebase/firebase-typing.service.ts +1 -1
- package/src/chat21-core/providers/firebase/firebase-upload.service.ts +1 -1
- package/src/chat21-core/providers/mqtt/mqtt-auth-service.ts +27 -27
- 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 +13 -4
- package/src/chat21-core/utils/utils.ts +1 -1
- package/src/global.scss +2 -7
- package/src/index.html +1 -1
|
@@ -75,10 +75,10 @@ export class FirebaseAuthService extends MessagingAuthService {
|
|
|
75
75
|
*
|
|
76
76
|
*/
|
|
77
77
|
initialize() {
|
|
78
|
-
|
|
78
|
+
this.logger.log('initialize FROM [APP-COMP] [FIREBASEAuthSERVICE]')
|
|
79
79
|
this.SERVER_BASE_URL = this.getBaseUrl();
|
|
80
80
|
this.URL_TILEDESK_CREATE_CUSTOM_TOKEN = this.SERVER_BASE_URL + 'chat21/firebase/auth/createCustomToken';
|
|
81
|
-
this.logger.
|
|
81
|
+
this.logger.log('[FIREBASEAuthSERVICE] - initialize URL_TILEDESK_CREATE_CUSTOM_TOKEN ', this.URL_TILEDESK_CREATE_CUSTOM_TOKEN)
|
|
82
82
|
|
|
83
83
|
|
|
84
84
|
let firebasePersistence;
|
|
@@ -102,11 +102,11 @@ export class FirebaseAuthService extends MessagingAuthService {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
firebase.auth().setPersistence(firebasePersistence).then(async () => {
|
|
105
|
-
|
|
106
|
-
this.onAuthStateChanged();
|
|
105
|
+
this.logger.log('[FIREBASEAuthSERVICE] firebasePersistence ', firebasePersistence)
|
|
106
|
+
// this.onAuthStateChanged(); // commented for new-login
|
|
107
107
|
})
|
|
108
108
|
.catch((error) => {
|
|
109
|
-
this.logger.error('[FIREBASEAuthSERVICE]
|
|
109
|
+
this.logger.error('[FIREBASEAuthSERVICE] Error: ', error);
|
|
110
110
|
});
|
|
111
111
|
|
|
112
112
|
|
|
@@ -203,12 +203,14 @@ export class FirebaseAuthService extends MessagingAuthService {
|
|
|
203
203
|
// Only one subscriber x application allowed
|
|
204
204
|
// ---------------------------------------------------------------------------------------------------
|
|
205
205
|
if (this.unsubscribe) {
|
|
206
|
-
|
|
206
|
+
this.logger.log('initialize FROM [APP-COMP] - [FIREBASEAuthSERVICE] onAuthStateChanged ALREADY SUBSCRIBED')
|
|
207
207
|
return
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
this.unsubscribe = firebase.auth().onAuthStateChanged(user => {
|
|
211
|
-
|
|
211
|
+
this.logger.log('initialize FROM [APP-COMP] - [FIREBASEAuthSERVICE] onAuthStateChanged', user)
|
|
212
|
+
|
|
213
|
+
|
|
212
214
|
if (!user) {
|
|
213
215
|
this.logger.log('[FIREBASEAuthSERVICE] 1 - PASSO OFFLINE AL CHAT MANAGER')
|
|
214
216
|
// this.logger.info('initialize FROM [APP-COMP] - [APP-COMP] - [FIREBASEAuthSERVICE] onAuthStateChanged user ', user)
|
|
@@ -230,41 +232,6 @@ export class FirebaseAuthService extends MessagingAuthService {
|
|
|
230
232
|
|
|
231
233
|
}
|
|
232
234
|
|
|
233
|
-
/**
|
|
234
|
-
* FIREBASE: signInWithCustomToken
|
|
235
|
-
* @param token
|
|
236
|
-
*/
|
|
237
|
-
signInFirebaseWithCustomToken(token: string): Promise<any> {
|
|
238
|
-
// const that = this;
|
|
239
|
-
// let firebasePersistence;
|
|
240
|
-
// // console.log('FB-AUTH firebasePersistence', this.getPersistence())
|
|
241
|
-
// switch (this.getPersistence()) {
|
|
242
|
-
// case 'SESSION': {
|
|
243
|
-
// firebasePersistence = firebase.auth.Auth.Persistence.SESSION;
|
|
244
|
-
// break;
|
|
245
|
-
// }
|
|
246
|
-
// case 'LOCAL': {
|
|
247
|
-
// firebasePersistence = firebase.auth.Auth.Persistence.LOCAL;
|
|
248
|
-
// break;
|
|
249
|
-
// }
|
|
250
|
-
// case 'NONE': {
|
|
251
|
-
// firebasePersistence = firebase.auth.Auth.Persistence.NONE;
|
|
252
|
-
// break;
|
|
253
|
-
// }
|
|
254
|
-
// default: {
|
|
255
|
-
// firebasePersistence = firebase.auth.Auth.Persistence.NONE;
|
|
256
|
-
// break;
|
|
257
|
-
// }
|
|
258
|
-
// }
|
|
259
|
-
// return firebase.auth().setPersistence(firebasePersistence).then(async () => {
|
|
260
|
-
return firebase.auth().signInWithCustomToken(token).then(async (user) => {
|
|
261
|
-
|
|
262
|
-
// that.firebaseSignInWithCustomToken.next(response);
|
|
263
|
-
}).catch((error) => {
|
|
264
|
-
this.logger.error('[FIREBASEAuthSERVICE] signInFirebaseWithCustomToken Error: ', error);
|
|
265
|
-
// that.firebaseSignInWithCustomToken.next(null);
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
235
|
|
|
269
236
|
/**
|
|
270
237
|
* FIREBASE: createUserWithEmailAndPassword
|
|
@@ -355,12 +322,53 @@ export class FirebaseAuthService extends MessagingAuthService {
|
|
|
355
322
|
});
|
|
356
323
|
}
|
|
357
324
|
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* FIREBASE: signInWithCustomToken
|
|
328
|
+
* @param token
|
|
329
|
+
*/
|
|
330
|
+
signInFirebaseWithCustomToken(token: string): Promise<any> {
|
|
331
|
+
// const that = this;
|
|
332
|
+
// let firebasePersistence;
|
|
333
|
+
// // console.log('FB-AUTH firebasePersistence', this.getPersistence())
|
|
334
|
+
// switch (this.getPersistence()) {
|
|
335
|
+
// case 'SESSION': {
|
|
336
|
+
// firebasePersistence = firebase.auth.Auth.Persistence.SESSION;
|
|
337
|
+
// break;
|
|
338
|
+
// }
|
|
339
|
+
// case 'LOCAL': {
|
|
340
|
+
// firebasePersistence = firebase.auth.Auth.Persistence.LOCAL;
|
|
341
|
+
// break;
|
|
342
|
+
// }
|
|
343
|
+
// case 'NONE': {
|
|
344
|
+
// firebasePersistence = firebase.auth.Auth.Persistence.NONE;
|
|
345
|
+
// break;
|
|
346
|
+
// }
|
|
347
|
+
// default: {
|
|
348
|
+
// firebasePersistence = firebase.auth.Auth.Persistence.NONE;
|
|
349
|
+
// break;
|
|
350
|
+
// }
|
|
351
|
+
// }
|
|
352
|
+
// return firebase.auth().setPersistence(firebasePersistence).then(async () => {
|
|
353
|
+
return firebase.auth().signInWithCustomToken(token).then(async (user) => {
|
|
354
|
+
this.logger.log('[FIREBASEAuthSERVICE] signInWithCustomToken user: ', user);
|
|
355
|
+
if (user) {
|
|
356
|
+
this.BSAuthStateChanged.next('online');
|
|
357
|
+
}
|
|
358
|
+
// that.firebaseSignInWithCustomToken.next(response);
|
|
359
|
+
}).catch((error) => {
|
|
360
|
+
this.logger.error('[FIREBASEAuthSERVICE] signInWithCustomToken Error: ', error);
|
|
361
|
+
// that.firebaseSignInWithCustomToken.next(null);
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
|
|
358
365
|
logout() {
|
|
359
366
|
this.logger.log('[FIREBASEAuthSERVICE] logout');
|
|
360
367
|
this.BSAuthStateChanged.next(null);
|
|
361
368
|
|
|
362
369
|
// cancello token firebase dal local storage e da firebase
|
|
363
370
|
// dovrebbe scattare l'evento authchangeStat
|
|
371
|
+
this.BSAuthStateChanged.next('offline');
|
|
364
372
|
this.signOut();
|
|
365
373
|
// this.unsubscribe();
|
|
366
374
|
}
|
|
@@ -65,7 +65,7 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
|
|
|
65
65
|
* inizializzo conversation handler
|
|
66
66
|
*/
|
|
67
67
|
initialize(recipientId: string,recipientFullName: string,loggedUser: UserModel,tenant: string,translationMap: Map<string, string>) {
|
|
68
|
-
this.logger.
|
|
68
|
+
this.logger.log('[FIREBASEConversationHandlerSERVICE] initWithRecipient',recipientId, recipientFullName, loggedUser, tenant, translationMap)
|
|
69
69
|
this.recipientId = recipientId;
|
|
70
70
|
this.recipientFullname = recipientFullName;
|
|
71
71
|
this.loggedUser = loggedUser;
|
|
@@ -26,7 +26,7 @@ export class FirebaseNotifications extends NotificationsService {
|
|
|
26
26
|
initialize(tenant: string, vapId: string): void {
|
|
27
27
|
this.tenant = tenant
|
|
28
28
|
this.vapidkey = vapId
|
|
29
|
-
this.logger.
|
|
29
|
+
this.logger.log('[FIREBASE-NOTIFICATIONS] initialize - tenant ', this.tenant)
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
if (!('serviceWorker' in navigator)) {
|
|
@@ -49,7 +49,7 @@ export class FirebasePresenceService extends PresenceService {
|
|
|
49
49
|
public initialize(tenant: string) {
|
|
50
50
|
// this.tenant = this.getTenant();
|
|
51
51
|
this.tenant = tenant;
|
|
52
|
-
this.logger.
|
|
52
|
+
this.logger.log('[FIREBASEPresenceSERVICE] initialize this.tenant', this.tenant);
|
|
53
53
|
this.urlNodePresence = '/apps/' + this.tenant + '/presence/';
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -129,7 +129,7 @@ export class FirebasePresenceService extends PresenceService {
|
|
|
129
129
|
* @param userid
|
|
130
130
|
*/
|
|
131
131
|
public setPresence(userid: string): void {
|
|
132
|
-
this.logger.
|
|
132
|
+
this.logger.log('initialize FROM [APP-COMP] - [FIREBASEPresenceSERVICE] - SET PRESENCE userid ', userid)
|
|
133
133
|
this.onlineConnectionsRef = this.referenceOnlineForUser(userid);
|
|
134
134
|
this.lastOnlineConnectionsRef = this.referenceLastOnlineForUser(userid);
|
|
135
135
|
const connectedRefURL = '/.info/connected';
|
|
@@ -52,7 +52,7 @@ export class FirebaseTypingService extends TypingService {
|
|
|
52
52
|
public initialize(tenant: string) {
|
|
53
53
|
// this.tenant = this.getTenant();
|
|
54
54
|
this.tenant = tenant;
|
|
55
|
-
this.logger.
|
|
55
|
+
this.logger.log('[FIREBASETypingSERVICE] initialize - tenant ', this.tenant)
|
|
56
56
|
this.urlNodeTypings = '/apps/' + this.tenant + '/typings/';
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -43,7 +43,7 @@ export class FirebaseUploadService extends UploadService {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
public initialize() {
|
|
46
|
-
this.logger.
|
|
46
|
+
this.logger.log('[FIREBASEUploadSERVICE] initialize');
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
public upload(userId: string, upload: UploadModel): Promise<any> {
|
|
@@ -65,7 +65,7 @@ export class MQTTAuthService extends MessagingAuthService {
|
|
|
65
65
|
// this.URL_TILEDESK_SIGNIN_WITH_CUSTOM_TOKEN = this.SERVER_BASE_URL + 'auth/signinWithCustomToken';
|
|
66
66
|
this.logger.log(' ---------------- login con token url ---------------- ');
|
|
67
67
|
// this.checkIsAuth();
|
|
68
|
-
this.onAuthStateChanged();
|
|
68
|
+
// this.onAuthStateChanged();
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
// logout(callback) {
|
|
@@ -103,33 +103,33 @@ z
|
|
|
103
103
|
|
|
104
104
|
/**
|
|
105
105
|
*/
|
|
106
|
-
onAuthStateChanged() {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
106
|
+
// onAuthStateChanged() {
|
|
107
|
+
// this.logger.log('UserService::onAuthStateChanged');
|
|
108
|
+
// // if (this.appStorage.getItem('tiledeskToken') == null) {
|
|
109
|
+
// // this.currentUser = null;
|
|
110
|
+
// this.BSAuthStateChanged.next('offline');
|
|
111
|
+
// // }
|
|
112
|
+
|
|
113
|
+
// // this.logger.log("STORAGE CHANGED: added listner")
|
|
114
|
+
// // window.addEventListener('storage', (e) => {
|
|
115
|
+
// // this.logger.log('STORAGE CHANGED:', e.key);
|
|
116
|
+
// // if (this.appStorage.getItem('tiledeskToken') == null && this.appStorage.getItem('currentUser') == null) {
|
|
117
|
+
// // this.logger.log('STORAGE CHANGED: CASO TOKEN NULL');
|
|
118
|
+
// // this.currentUser = null;
|
|
119
|
+
// // // that.logout(() => {
|
|
120
|
+
// // // that.BSAuthStateChanged.next('offline');
|
|
121
|
+
// // // });
|
|
122
|
+
// // this.logout();
|
|
123
|
+
// // }
|
|
124
|
+
// // else if (this.currentUser == null && this.appStorage.getItem('tiledeskToken') != null && this.appStorage.getItem('currentUser') != null) {
|
|
125
|
+
// // this.logger.log('STORAGE CHANGED: CASO LOGGED OUTSIDE');
|
|
126
|
+
// // this.currentUser = JSON.parse(this.appStorage.getItem('currentUser'));
|
|
127
|
+
// // const tiledeskToken = this.appStorage.getItem('tiledeskToken');
|
|
128
|
+
// // this.connectWithCustomToken(tiledeskToken);
|
|
129
|
+
// // }
|
|
130
|
+
// // }, false);
|
|
131
131
|
|
|
132
|
-
}
|
|
132
|
+
// }
|
|
133
133
|
|
|
134
134
|
createCustomToken(tiledeskToken: any): void {
|
|
135
135
|
this.connectWithCustomToken(tiledeskToken)
|
|
@@ -59,15 +59,19 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
59
59
|
// 1 search local array
|
|
60
60
|
// 2 search remote
|
|
61
61
|
// callback
|
|
62
|
-
|
|
62
|
+
console.log("SEARCHING CONV:", conversationWith);
|
|
63
63
|
const conversation = this.conversations.find(conv => conv.conversation_with === conversationWith);
|
|
64
|
-
|
|
64
|
+
console.log('[MQTTConversationsHandler] getConversationDetail *****: found locally?', conversation);
|
|
65
65
|
if (conversation) {
|
|
66
|
-
|
|
66
|
+
console.log('[MQTTConversationsHandler] getConversationDetail found LOCALLY!', conversationWith);
|
|
67
67
|
callback(conversation);
|
|
68
68
|
} else {
|
|
69
|
-
|
|
70
|
-
this.chat21Service.chatClient.conversationDetail(conversationWith, (conversation) => {
|
|
69
|
+
console.log('[MQTTConversationsHandler] getConversationDetail *****: Not found locally, SEARCHING REMOTE ', conversation);
|
|
70
|
+
this.chat21Service.chatClient.conversationDetail(conversationWith, (err, conversation) => {
|
|
71
|
+
console.log("--REMOTE CONV IS:" + conversation);
|
|
72
|
+
console.log("--REMOTE CONV IS OBJ:", conversation);
|
|
73
|
+
console.log("--REMOTE ERR IS:" + err);
|
|
74
|
+
|
|
71
75
|
if (conversation) {
|
|
72
76
|
if (callback) {
|
|
73
77
|
callback(this.completeConversation(conversation));
|
|
@@ -381,6 +385,7 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
381
385
|
}
|
|
382
386
|
|
|
383
387
|
private completeConversation(conv): ConversationModel {
|
|
388
|
+
console.log("COMPLETING CONVERSATION:", conv);
|
|
384
389
|
conv.selected = false;
|
|
385
390
|
if (!conv.sender_fullname || conv.sender_fullname === 'undefined' || conv.sender_fullname.trim() === '') {
|
|
386
391
|
conv.sender_fullname = conv.sender;
|
|
@@ -413,6 +418,9 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
413
418
|
}
|
|
414
419
|
|
|
415
420
|
private isGroup(conv: ConversationModel) {
|
|
421
|
+
console.log("CONVIS: " + JSON.stringify(conv));
|
|
422
|
+
console.log("CONVIS OBJ:", conv);
|
|
423
|
+
|
|
416
424
|
if (conv.recipient.startsWith('group-') || conv.recipient.startsWith('support-group')) {
|
|
417
425
|
return true;
|
|
418
426
|
};
|
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
import { Injectable } from '@angular/core';
|
|
3
3
|
// services
|
|
4
4
|
import { NotificationsService } from '../abstract/notifications.service';
|
|
5
|
+
import { LoggerInstance } from '../logger/loggerInstance';
|
|
6
|
+
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
7
|
+
// firebase
|
|
8
|
+
import firebase from "firebase/app";
|
|
9
|
+
import 'firebase/messaging';
|
|
10
|
+
import 'firebase/auth';
|
|
11
|
+
// chat21
|
|
12
|
+
import { Chat21Service } from './chat-service';
|
|
5
13
|
|
|
6
14
|
@Injectable({
|
|
7
15
|
providedIn: 'root'
|
|
@@ -9,24 +17,106 @@ import { NotificationsService } from '../abstract/notifications.service';
|
|
|
9
17
|
export class MQTTNotifications extends NotificationsService {
|
|
10
18
|
|
|
11
19
|
public BUILD_VERSION: string;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
20
|
+
private FCMcurrentToken: string;
|
|
21
|
+
private userId: string;
|
|
22
|
+
private tenant: string;
|
|
23
|
+
private vapidkey: string;
|
|
24
|
+
private logger: LoggerService = LoggerInstance.getInstance();
|
|
25
|
+
|
|
26
|
+
constructor(
|
|
27
|
+
public chat21Service: Chat21Service
|
|
28
|
+
) {
|
|
29
|
+
super();
|
|
30
|
+
}
|
|
15
31
|
|
|
16
|
-
initialize(tenant: string): void {
|
|
17
|
-
|
|
32
|
+
initialize(tenant: string, vapId: string): void {
|
|
33
|
+
this.tenant = tenant;
|
|
34
|
+
this.vapidkey = vapId;
|
|
18
35
|
return;
|
|
19
36
|
}
|
|
20
37
|
|
|
21
|
-
getNotificationPermissionAndSaveToken(
|
|
22
|
-
console.log(
|
|
23
|
-
|
|
38
|
+
getNotificationPermissionAndSaveToken(currentUserUid) {
|
|
39
|
+
console.log("getNotificationPermissionAndSaveToken()",currentUserUid );
|
|
40
|
+
this.userId = currentUserUid;
|
|
41
|
+
if (firebase.messaging.isSupported()) {
|
|
42
|
+
console.log("firebase.messaging.isSupported() YES");
|
|
43
|
+
const messaging = firebase.messaging();
|
|
44
|
+
// messaging.requestPermission()
|
|
45
|
+
Notification.requestPermission().then((permission) => {
|
|
46
|
+
if (permission === 'granted') {
|
|
47
|
+
this.logger.log('[MQTT-FIREBASE-NOTIFICATIONS] >>>> requestPermission Notification permission granted.');
|
|
48
|
+
|
|
49
|
+
return messaging.getToken({ vapidKey: this.vapidkey })
|
|
50
|
+
}
|
|
51
|
+
}).then(FCMtoken => {
|
|
52
|
+
this.logger.log('[MQTT-FIREBASE-NOTIFICATIONS] >>>> requestPermission FCMtoken', FCMtoken)
|
|
53
|
+
// Save FCM Token in Chat21
|
|
54
|
+
this.FCMcurrentToken = FCMtoken;
|
|
55
|
+
this.saveToken(FCMtoken, currentUserUid)
|
|
56
|
+
}).catch((err) => {
|
|
57
|
+
this.logger.error('[FIREBASE-NOTIFICATIONS] >>>> requestPermission ERR: Unable to get permission to notify.', err);
|
|
58
|
+
});
|
|
59
|
+
} else {
|
|
60
|
+
this.logger.log('[FIREBASE-NOTIFICATIONS] >>>> FIREBASE MESSAGING IS NOT SUPPORTED')
|
|
61
|
+
}
|
|
24
62
|
}
|
|
25
63
|
|
|
26
64
|
|
|
27
65
|
removeNotificationsInstance(callback: (string) => void) {
|
|
28
|
-
|
|
29
|
-
|
|
66
|
+
var self = this;
|
|
67
|
+
// firebase.auth().onAuthStateChanged(function (user) {
|
|
68
|
+
// if (user) {
|
|
69
|
+
// self.logger.debug('[FIREBASE-NOTIFICATIONS] - FB User is signed in. ', user)
|
|
70
|
+
// self.logger.log('[FIREBASE-NOTIFICATIONS] >>>> removeNotificationsInstance > this.userId', self.userId);
|
|
71
|
+
// self.logger.log('[FIREBASE-NOTIFICATIONS] >>>> removeNotificationsInstance > FCMcurrentToken', self.FCMcurrentToken);
|
|
72
|
+
// // this.logger.log('[FIREBASE-NOTIFICATIONS] >>>> removeNotificationsInstance > this.tenant', this.tenant);
|
|
73
|
+
// } else {
|
|
74
|
+
// self.logger.debug('[FIREBASE-NOTIFICATIONS] - No FB user is signed in. ', user)
|
|
75
|
+
// }
|
|
76
|
+
// });
|
|
77
|
+
const urlNodeFirebase = '/apps/' + self.tenant
|
|
78
|
+
const connectionsRefinstancesId = urlNodeFirebase + '/users/' + self.userId + '/instances/'
|
|
79
|
+
self.logger.log('[FIREBASE-NOTIFICATIONS] >>>> connectionsRefinstancesId ', connectionsRefinstancesId);
|
|
80
|
+
let connectionsRefURL = '';
|
|
81
|
+
if (connectionsRefinstancesId) {
|
|
82
|
+
connectionsRefURL = connectionsRefinstancesId + self.FCMcurrentToken;
|
|
83
|
+
const connectionsRef = firebase.database().ref().child(connectionsRefURL);
|
|
84
|
+
self.logger.log('[FIREBASE-NOTIFICATIONS] >>>> connectionsRef ', connectionsRef);
|
|
85
|
+
self.logger.log('[FIREBASE-NOTIFICATIONS] >>>> connectionsRef url ', connectionsRefURL);
|
|
86
|
+
connectionsRef.off()
|
|
87
|
+
connectionsRef.remove()
|
|
88
|
+
.then(() => {
|
|
89
|
+
self.logger.log("[FIREBASE-NOTIFICATIONS] >>>> removeNotificationsInstance > Remove succeeded.")
|
|
90
|
+
callback('success')
|
|
91
|
+
}).catch((error) => {
|
|
92
|
+
self.logger.error("[FIREBASE-NOTIFICATIONS] >>>> removeNotificationsInstance Remove failed: " + error.message)
|
|
93
|
+
callback('error')
|
|
94
|
+
}).finally(() => {
|
|
95
|
+
self.logger.log('[FIREBASE-NOTIFICATIONS] COMPLETED');
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private saveToken(FCMcurrentToken, currentUserUid) {
|
|
101
|
+
this.logger.log('[FIREBASE-NOTIFICATIONS] >>>> getPermission > updateToken ', FCMcurrentToken);
|
|
102
|
+
if (!currentUserUid || !FCMcurrentToken) {
|
|
103
|
+
return
|
|
104
|
+
};
|
|
105
|
+
const device_model = {
|
|
106
|
+
device_model: navigator.userAgent,
|
|
107
|
+
language: navigator.language,
|
|
108
|
+
platform: 'ionic',
|
|
109
|
+
platform_version: this.BUILD_VERSION
|
|
110
|
+
}
|
|
111
|
+
this.chat21Service.chatClient.saveInstance(
|
|
112
|
+
FCMcurrentToken,
|
|
113
|
+
device_model,
|
|
114
|
+
(err, response) => {
|
|
115
|
+
if (err) {
|
|
116
|
+
this.logger.error('Error saving FCMcurrentToken on chat21 App Instance', FCMcurrentToken);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
);
|
|
30
120
|
}
|
|
31
|
-
|
|
121
|
+
|
|
32
122
|
}
|
|
@@ -31,11 +31,11 @@ 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) {
|
|
38
|
-
this.logger.
|
|
38
|
+
this.logger.log('[TILEDESK-AUTH-SERV] - initialize serverBaseUrl', serverBaseUrl);
|
|
39
39
|
this.SERVER_BASE_URL = serverBaseUrl;
|
|
40
40
|
this.URL_TILEDESK_SIGNIN = this.SERVER_BASE_URL + 'auth/signin';
|
|
41
41
|
this.URL_TILEDESK_SIGNIN_ANONYMOUSLY = this.SERVER_BASE_URL + 'auth/signinAnonymously'
|
|
@@ -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
|
}
|
|
@@ -497,7 +497,7 @@ export function createConfirm(translate, alertCtrl, events, title, message, acti
|
|
|
497
497
|
text: LABEL_ANNULLA,
|
|
498
498
|
handler: () => {
|
|
499
499
|
events.publish('PopupConfirmation', LABEL_ANNULLA, action);
|
|
500
|
-
console.log('Disagree clicked');
|
|
500
|
+
// console.log('Disagree clicked');
|
|
501
501
|
}
|
|
502
502
|
},
|
|
503
503
|
{
|
package/src/global.scss
CHANGED
|
@@ -572,19 +572,14 @@ select:-webkit-autofill:focus {
|
|
|
572
572
|
}
|
|
573
573
|
/* End rules for the member list refactoring in the "info-group.component.html" (replacement of ion-grid with ion-list) */
|
|
574
574
|
.missing-connection-toast {
|
|
575
|
-
--background
|
|
576
|
-
--color
|
|
575
|
+
--background: #fdd764;
|
|
576
|
+
--color: #2e3939;
|
|
577
577
|
font-weight: 500;
|
|
578
578
|
font-size: 16px;
|
|
579
579
|
}
|
|
580
580
|
|
|
581
|
-
|
|
582
581
|
.missing-connection-toast::part(message) {
|
|
583
582
|
// display: none;
|
|
584
583
|
display: flex;
|
|
585
584
|
align-items: center;
|
|
586
585
|
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
package/src/index.html
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
// || window.navigator.onLine === true
|
|
43
43
|
if (window.navigator.onLine === false ) {
|
|
44
44
|
let app_root_el = document.getElementsByTagName('app-root');
|
|
45
|
-
console.log('index.html app_root_el ', app_root_el);
|
|
45
|
+
// console.log('index.html app_root_el ', app_root_el);
|
|
46
46
|
|
|
47
47
|
setTimeout(function () {
|
|
48
48
|
// console.log('index.html app_root_el > childNodes ', app_root_el[0].childNodes);
|