@chat21/chat21-ionic 3.4.27-rc23 → 3.4.27-rc25
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 +6 -0
- package/package.json +1 -1
- package/src/app/app.component.ts +9 -4
- package/src/app/components/navbar/navbar.component.ts +1 -1
- package/src/app/pages/conversations-list/conversations-list.page.ts +1 -1
- package/src/app/services/global-settings/global-settings.service.ts +0 -1
- package/src/app/services/websocket/websocket-js.ts +1 -1
- package/src/app/services/websocket/websocket.worker.ts +16 -0
- package/src/assets/js/chat21client.js +3 -1
- package/src/assets/js/mqtt-keepalive-worker.js +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
### **Copyrigth**:
|
|
9
9
|
*Tiledesk SRL*
|
|
10
10
|
|
|
11
|
+
# 3.4.27-rc25
|
|
12
|
+
- **bug-fixed**: projectUserService is not initialized
|
|
13
|
+
|
|
14
|
+
# 3.4.27-rc24
|
|
15
|
+
- **added**: implementation of multiple message in wss onmessage
|
|
16
|
+
|
|
11
17
|
# 3.4.27-rc23
|
|
12
18
|
- **added**: keepAlive worker for MQTT connection
|
|
13
19
|
|
package/package.json
CHANGED
package/src/app/app.component.ts
CHANGED
|
@@ -543,9 +543,6 @@ export class AppComponent implements OnInit {
|
|
|
543
543
|
this.statusBar.styleLightContent();
|
|
544
544
|
this.navService.init(this.sidebarNav, this.detailNav);
|
|
545
545
|
this.tiledeskAuthService.initialize(this.appConfigProvider.getConfig().apiUrl);
|
|
546
|
-
this.tiledeskService.initialize(this.appConfigProvider.getConfig().apiUrl)
|
|
547
|
-
this.projectService.initialize(this.appConfigProvider.getConfig().apiUrl);
|
|
548
|
-
this.contactsService.initialize(this.appConfigProvider.getConfig().apiUrl)
|
|
549
546
|
|
|
550
547
|
// this.currentUserService.initialize();
|
|
551
548
|
this.chatManager.initialize();
|
|
@@ -1184,12 +1181,13 @@ export class AppComponent implements OnInit {
|
|
|
1184
1181
|
// this.logger.info('initialize FROM [APP-COMP] - [APP-COMP] - GO-ONLINE isOnline ', this.isOnline);
|
|
1185
1182
|
// clearTimeout(this.timeModalLogin);
|
|
1186
1183
|
const tiledeskToken = this.tiledeskAuthService.getTiledeskToken();
|
|
1184
|
+
const serverBaseURL = this.appConfigProvider.getConfig().apiUrl
|
|
1187
1185
|
// const supportmode = this.appConfigProvider.getConfig().supportMode;
|
|
1188
1186
|
// this.logger.log('[APP-COMP] - GO-ONLINE - supportmode ', supportmode);
|
|
1189
1187
|
// if (supportmode === true) {
|
|
1190
1188
|
// this.connetWebsocket() // moved in the comp project-item
|
|
1191
1189
|
// }
|
|
1192
|
-
|
|
1190
|
+
|
|
1193
1191
|
const currentUser = this.tiledeskAuthService.getCurrentUser();
|
|
1194
1192
|
this.setLanguage(currentUser);
|
|
1195
1193
|
// this.logger.printDebug('APP-COMP - goOnLine****', currentUser);
|
|
@@ -1197,6 +1195,13 @@ export class AppComponent implements OnInit {
|
|
|
1197
1195
|
this.chatManager.setTiledeskToken(tiledeskToken);
|
|
1198
1196
|
this.chatManager.setCurrentUser(currentUser);
|
|
1199
1197
|
|
|
1198
|
+
this.tiledeskService.initialize(serverBaseURL)
|
|
1199
|
+
this.projectUsersService.initialize(serverBaseURL)
|
|
1200
|
+
this.projectService.initialize(serverBaseURL)
|
|
1201
|
+
this.contactsService.initialize(serverBaseURL)
|
|
1202
|
+
|
|
1203
|
+
|
|
1204
|
+
this.events.publish('go:online', true);
|
|
1200
1205
|
// this.chatManager.startApp();
|
|
1201
1206
|
|
|
1202
1207
|
|
|
@@ -111,7 +111,7 @@ export class NavbarComponent implements OnInit {
|
|
|
111
111
|
this.USER_ROLE = project.role;
|
|
112
112
|
this.projectUser = await this.projectUsersService.getProjectUserByProjectId(project.id_project.id)
|
|
113
113
|
this.roles = this.checkRoles()
|
|
114
|
-
|
|
114
|
+
this.logger.log('[SIDEBAR] roles ', this.roles)
|
|
115
115
|
}
|
|
116
116
|
})
|
|
117
117
|
}
|
|
@@ -486,7 +486,7 @@ export class ConversationListPage implements OnInit {
|
|
|
486
486
|
listenToCurrentStoredProject() {
|
|
487
487
|
this.events.subscribe('storage:last_project', async(projectObjct) => {
|
|
488
488
|
if (projectObjct && projectObjct !== 'undefined') {
|
|
489
|
-
|
|
489
|
+
this.logger.log('[CONVS-LIST-PAGE] - GET STORED PROJECT ', projectObjct)
|
|
490
490
|
|
|
491
491
|
//TODO: recuperare info da root e non da id_project
|
|
492
492
|
this.project = {
|
|
@@ -111,7 +111,6 @@ export class GlobalSettingsService {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
TEMP = getParameterByName(windowContext, 'tiledesk_supportMode');
|
|
114
|
-
console.log('TEMP supportMode', TEMP);
|
|
115
114
|
if (TEMP) {
|
|
116
115
|
globals.supportMode = stringToBoolean(TEMP);
|
|
117
116
|
this.appStorageService.setItem('supportMode', String(globals.supportMode))
|
|
@@ -38,7 +38,7 @@ export class WebSocketJs {
|
|
|
38
38
|
const sub = this.subscriptions.get(msg.topic);
|
|
39
39
|
if (!sub) return;
|
|
40
40
|
|
|
41
|
-
let object = { event: msg.payload, data: msg };
|
|
41
|
+
let object = { event: msg.payload, data: msg.data };
|
|
42
42
|
switch (msg.method) {
|
|
43
43
|
case 'CREATE': sub.onCreate?.(msg.payload, object); break;
|
|
44
44
|
case 'UPDATE': sub.onUpdate?.(msg.payload, object); break;
|
|
@@ -151,7 +151,23 @@ function handleMessage(msg: WSMessage) {
|
|
|
151
151
|
|
|
152
152
|
if (!topic) return;
|
|
153
153
|
|
|
154
|
+
// --- GESTIONE ARRAY DI MESSAGGI ---
|
|
155
|
+
const messages = Array.isArray(msg.payload.message) ? msg.payload.message : [msg.payload.message];
|
|
154
156
|
// Notifica solo le subscription che matchano
|
|
157
|
+
subscriptions.forEach(sub => {
|
|
158
|
+
if (sub.topic === topic) {
|
|
159
|
+
messages.forEach(element => {
|
|
160
|
+
postMessage({
|
|
161
|
+
topic,
|
|
162
|
+
method,
|
|
163
|
+
payload: element, // singolo elemento
|
|
164
|
+
data: msg // payload completo per eventuali onData globali
|
|
165
|
+
}, undefined);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
|
|
155
171
|
subscriptions.forEach(sub => {
|
|
156
172
|
if (sub.topic === topic) {
|
|
157
173
|
postMessage({ topic, method, payload, msg }, undefined);
|
|
@@ -1035,7 +1035,9 @@ class Chat21Client {
|
|
|
1035
1035
|
|
|
1036
1036
|
initKeepAliveWorker(){
|
|
1037
1037
|
this.worker= new Worker('assets/js/mqtt-keepalive-worker.js');
|
|
1038
|
-
|
|
1038
|
+
if (this.log) {
|
|
1039
|
+
console.log("Chat21Client - initKeepAliveWorker() - worker created", this.worker);
|
|
1040
|
+
}
|
|
1039
1041
|
// this.worker.postMessage({
|
|
1040
1042
|
// action: 'start',
|
|
1041
1043
|
// user_id: this.user_id,
|
|
@@ -6,7 +6,7 @@ let pingIntervalId = null;
|
|
|
6
6
|
self.onmessage = function(event) {
|
|
7
7
|
const data = event.data;
|
|
8
8
|
|
|
9
|
-
console.log('MQTT KEEPALIVE WORKER - received message ', data);
|
|
9
|
+
// console.log('MQTT KEEPALIVE WORKER - received message ', data);
|
|
10
10
|
if (data.action === 'start') {
|
|
11
11
|
user_id = data.user_id;
|
|
12
12
|
const endpoint = data.endpoint;
|
|
@@ -27,7 +27,7 @@ self.onmessage = function(event) {
|
|
|
27
27
|
// start ping
|
|
28
28
|
pingIntervalId = setInterval(() => {
|
|
29
29
|
if (client && client.connected) {
|
|
30
|
-
console.log('MQTT KEEPALIVE WORKER - sending keepalive ping for user ', user_id);
|
|
30
|
+
// console.log('MQTT KEEPALIVE WORKER - sending keepalive ping for user ', user_id);
|
|
31
31
|
client.publish(`apps/tilechat/users/${user_id}/keepalive`,
|
|
32
32
|
JSON.stringify({ ts: new Date().getTime() }));
|
|
33
33
|
}
|
|
@@ -40,6 +40,7 @@ self.onmessage = function(event) {
|
|
|
40
40
|
});
|
|
41
41
|
}else if (data.action === 'ping') {
|
|
42
42
|
if (self.timer) return;
|
|
43
|
+
|
|
43
44
|
self.timer = setInterval(() => {
|
|
44
45
|
postMessage({ action: 'ping' });
|
|
45
46
|
}, 3000);
|