@chat21/chat21-ionic 3.0.67 → 3.0.68
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 +14 -0
- package/deploy_amazon_prod.sh +4 -0
- package/package.json +1 -1
- package/src/app/app.component.ts +35 -17
- package/src/app/app.module.ts +4 -4
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +8 -0
- package/src/app/chatlib/conversation-detail/message/info-message/info-message.component.ts +0 -2
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +1 -3
- package/src/app/components/conversation-info/info-content/info-content.component.ts +22 -25
- package/src/app/components/project-item/project-item.component.ts +28 -50
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +47 -78
- package/src/app/pages/conversations-list/conversations-list.page.ts +23 -30
- package/src/app/pages/create-canned-response/create-canned-response.page.ts +22 -29
- package/src/app/services/websocket/websocket.service.ts +1 -1
- package/src/assets/i18n/ar.json +1 -1
- package/src/assets/i18n/az.json +266 -0
- package/src/assets/i18n/de.json +1 -1
- package/src/assets/i18n/en.json +1 -1
- package/src/assets/i18n/es.json +1 -1
- package/src/assets/i18n/fr.json +1 -1
- package/src/assets/i18n/it.json +1 -1
- package/src/assets/i18n/kk.json +266 -0
- package/src/assets/i18n/pt.json +1 -1
- package/src/assets/i18n/ru.json +1 -1
- package/src/assets/i18n/sr.json +1 -1
- package/src/assets/i18n/sv.json +266 -0
- package/src/assets/i18n/tr.json +1 -1
- package/src/assets/i18n/uk.json +1 -1
- package/src/assets/i18n/uz.json +267 -0
- package/src/assets/images/language_flag/az.png +0 -0
- package/src/assets/images/language_flag/kk.png +0 -0
- package/src/assets/images/language_flag/{sv-SE.png → sv.png} +0 -0
- package/src/assets/images/language_flag/uz.png +0 -0
- package/src/chat-config-mqtt-localhost.json +10 -3
- package/src/chat-config-pre.json +2 -1
- package/src/chat21-core/providers/abstract/conversations-handler.service.ts +2 -0
- package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +0 -2
- package/src/chat21-core/providers/firebase/firebase-auth-service.ts +0 -5
- package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +45 -5
- package/src/chat21-core/providers/firebase/firebase-image-repo.ts +2 -1
- package/src/chat21-core/providers/mqtt/mqtt-archivedconversations-handler.ts +71 -268
- package/src/chat21-core/providers/mqtt/mqtt-auth-service.ts +23 -26
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +3 -24
- package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +14 -47
- package/src/chat21-core/providers/mqtt/mqtt-groups-handler.ts +6 -10
- package/src/chat21-core/providers/mqtt/mqtt-notifications.ts +88 -93
- package/src/chat21-core/providers/native/native-image-repo.ts +9 -2
- package/src/chat21-core/providers/native/native-upload-service.ts +1 -2
- package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +0 -1
- package/src/chat21-core/utils/constants.ts +1 -1
- package/src/chat21-core/utils/utils-message.ts +1 -1
- package/deploy_pre.sh +0 -44
|
@@ -65,13 +65,7 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
65
65
|
/**
|
|
66
66
|
* inizializzo conversation handler
|
|
67
67
|
*/
|
|
68
|
-
initialize(
|
|
69
|
-
recipientId: string,
|
|
70
|
-
recipientFullName: string,
|
|
71
|
-
loggedUser: UserModel,
|
|
72
|
-
tenant: string,
|
|
73
|
-
translationMap: Map<string, string>
|
|
74
|
-
) {
|
|
68
|
+
initialize(recipientId: string,recipientFullName: string,loggedUser: UserModel,tenant: string, translationMap: Map<string, string>) {
|
|
75
69
|
this.logger.log('[MQTTConversationHandler] initWithRecipient:', tenant);
|
|
76
70
|
this.recipientId = recipientId;
|
|
77
71
|
this.recipientFullname = recipientFullName;
|
|
@@ -96,7 +90,7 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
96
90
|
* mi sottoscrivo a change, removed, added
|
|
97
91
|
*/
|
|
98
92
|
connect() {
|
|
99
|
-
this.logger.log('[MQTTConversationHandler] connecting conversation handler...');
|
|
93
|
+
this.logger.log('[MQTTConversationHandler] connecting conversation handler...', this.conversationWith);
|
|
100
94
|
if (this.conversationWith == null) {
|
|
101
95
|
this.logger.error('[MQTTConversationHandler] cant connect invalid this.conversationWith', this.conversationWith);
|
|
102
96
|
return;
|
|
@@ -118,7 +112,6 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
118
112
|
this.logger.log('[MQTTConversationHandler] message updated:', message, 'on topic:', topic);
|
|
119
113
|
this.updatedMessageStatus(message);
|
|
120
114
|
});
|
|
121
|
-
this.logger.log("[MQTTConversationHandler] this.conversationWith,", this.conversationWith);
|
|
122
115
|
}
|
|
123
116
|
|
|
124
117
|
isGroup(groupId) {
|
|
@@ -256,16 +249,6 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
256
249
|
this.messageAdded.next(msg);
|
|
257
250
|
}
|
|
258
251
|
|
|
259
|
-
// /** */
|
|
260
|
-
// private updatedMessage(message: any) {
|
|
261
|
-
// const msg = this.messageGenerate(message);
|
|
262
|
-
// msg.uid = msg.message_id;
|
|
263
|
-
// // imposto il giorno del messaggio per visualizzare o nascondere l'header data
|
|
264
|
-
// // con**** DATAIL messageAdded ***sole.log('>>>>>>>>>>>>>> changed headerDate: ', msg);
|
|
265
|
-
// this.addReplaceMessageInArray(msg.uid, msg);
|
|
266
|
-
// this.messageChanged.next(msg);
|
|
267
|
-
// }
|
|
268
|
-
|
|
269
252
|
/** */
|
|
270
253
|
private updatedMessageStatus(patch: any) {
|
|
271
254
|
if(this.skipInfoMessage && messageType(MESSAGE_TYPE_INFO, patch) ){
|
|
@@ -278,8 +261,6 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
278
261
|
if (message) {
|
|
279
262
|
message.status = patch.status;
|
|
280
263
|
this.logger.log('[MQTTConversationHandler] message found and patched (replacing)', message);
|
|
281
|
-
// imposto il giorno del messaggio per visualizzare o nascondere l'header data
|
|
282
|
-
// con**** DATAIL messageAdded ***sole.log('>>>>>>>>>>>>>> changed headerDate: ', msg);
|
|
283
264
|
this.addReplaceMessageInArray(message.uid, message);
|
|
284
265
|
this.messageChanged.next(message);
|
|
285
266
|
}
|
|
@@ -311,8 +292,7 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
311
292
|
// msg.text = htmlEntities(msg.text);
|
|
312
293
|
// }
|
|
313
294
|
// verifico che il sender è il logged user
|
|
314
|
-
this.logger.log("****>msg.sender:" + msg.sender);
|
|
315
|
-
this.logger.log("****>this.loggedUser.uid:" + this.loggedUser.uid);
|
|
295
|
+
this.logger.log("[MQTTConversationHandler] ****>msg.sender:" + msg.sender);
|
|
316
296
|
msg.isSender = this.isSender(msg.sender, this.loggedUser.uid);
|
|
317
297
|
// traduco messaggi se sono del server
|
|
318
298
|
if (msg.attributes && msg.attributes.subtype) {
|
|
@@ -436,7 +416,6 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
436
416
|
this.listSubsriptions.forEach(sub => {
|
|
437
417
|
this.logger.log('[MQTTConversationHandler] unsubscribe: ', sub.uid, key);
|
|
438
418
|
if (sub.uid === key) {
|
|
439
|
-
this.logger.log('[MQTTConversationHandler] unsubscribe: ', sub.uid, key);
|
|
440
419
|
sub.unsubscribe(key, null);
|
|
441
420
|
return;
|
|
442
421
|
}
|
|
@@ -27,6 +27,7 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
27
27
|
BSConversationDetail: BehaviorSubject<ConversationModel> = new BehaviorSubject<ConversationModel>(null);;
|
|
28
28
|
conversationAdded: BehaviorSubject<ConversationModel> = new BehaviorSubject<ConversationModel>(null);;
|
|
29
29
|
conversationChanged: BehaviorSubject<ConversationModel> = new BehaviorSubject<ConversationModel>(null);;
|
|
30
|
+
conversationChangedDetailed: BehaviorSubject<{value: ConversationModel, previousValue: ConversationModel}> = new BehaviorSubject<{value: ConversationModel, previousValue: ConversationModel}>(null);
|
|
30
31
|
conversationRemoved: BehaviorSubject<ConversationModel> = new BehaviorSubject<ConversationModel>(null);;
|
|
31
32
|
BSConversations: BehaviorSubject<ConversationModel[]>
|
|
32
33
|
// readAllMessages: BehaviorSubject<string>;
|
|
@@ -48,11 +49,7 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
48
49
|
super();
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
initialize(
|
|
52
|
-
tenant: string,
|
|
53
|
-
userId: string,
|
|
54
|
-
translationMap: Map<string, string>
|
|
55
|
-
) {
|
|
52
|
+
initialize(tenant: string, userId: string,translationMap: Map<string, string>) {
|
|
56
53
|
this.logger.debug('[MQTTConversationsHandler] initialize');
|
|
57
54
|
this.loggedUserId = userId;
|
|
58
55
|
this.translationMap = translationMap;
|
|
@@ -61,19 +58,19 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
61
58
|
}
|
|
62
59
|
|
|
63
60
|
public getConversationDetail(conversationWith: string, callback) {
|
|
64
|
-
// 1
|
|
65
|
-
// 2
|
|
61
|
+
// 1 cerco array locale
|
|
62
|
+
// 2 cerco remoto
|
|
66
63
|
// callback
|
|
67
|
-
|
|
64
|
+
|
|
68
65
|
const conversation = this.conversations.find(conv => conv.conversation_with === conversationWith);
|
|
69
|
-
|
|
66
|
+
this.logger.log('[MQTTConversationsHandler] getConversationDetail found locally? *****: ', conversation);
|
|
70
67
|
if (conversation) {
|
|
71
68
|
|
|
72
69
|
callback(conversation);
|
|
73
70
|
} else {
|
|
74
|
-
|
|
71
|
+
this.logger.log('[MQTTConversationsHandler] getConversationDetail Not found locally, remote.getConversationDetail *****: ', conversation);
|
|
75
72
|
this.chat21Service.chatClient.conversationDetail(conversationWith, (err, conversation) => {
|
|
76
|
-
|
|
73
|
+
this.logger.log('[MQTTConversationsHandler] getConversationDetail --REMOTE CONV IS OBJ:', conversation);
|
|
77
74
|
if (conversation) {
|
|
78
75
|
if (callback) {
|
|
79
76
|
callback(this.completeConversation(conversation));
|
|
@@ -153,9 +150,8 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
153
150
|
// lastTimestamp temporarily ignored
|
|
154
151
|
this.logger.debug('[MQTTConversationsHandler] connecting MQTT conversations handler');
|
|
155
152
|
const handlerConversationAdded = this.chat21Service.chatClient.onConversationAdded( (conv) => {
|
|
156
|
-
this.logger.log("onConversationAdded:", conv);
|
|
157
153
|
let conversation = this.completeConversation(conv); // needed to get the "conversation_with", and find the conv in the conv-history
|
|
158
|
-
this.logger.log("onConversationAdded completed:"
|
|
154
|
+
this.logger.log("onConversationAdded completed:",conversation);
|
|
159
155
|
const index = this.searchIndexInArrayForConversationWith(this.conversations, conversation.conversation_with);
|
|
160
156
|
if (index > -1) {
|
|
161
157
|
this.logger.log('[MQTTConversationsHandler] Added conv -> Changed!')
|
|
@@ -194,17 +190,18 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
194
190
|
}
|
|
195
191
|
});
|
|
196
192
|
}
|
|
193
|
+
|
|
194
|
+
getLastConversation(callback: (conv: ConversationModel, error: string) => void): void {
|
|
195
|
+
throw new Error('Method not implemented.');
|
|
196
|
+
}
|
|
197
197
|
|
|
198
198
|
private added(conv: any) {
|
|
199
199
|
this.logger.debug('[MQTTConversationsHandler] NEW CONV childSnapshot', conv)
|
|
200
200
|
let conversation = this.completeConversation(conv);
|
|
201
201
|
if (this.isValidConversation(conversation)) {
|
|
202
202
|
this.setClosingConversation(conversation.conversation_with, false);
|
|
203
|
-
this.logger.debug('[MQTTConversationsHandler]
|
|
204
|
-
this.logger.debug('[MQTTConversationsHandler] conversations:', this.conversations);
|
|
203
|
+
this.logger.debug('[MQTTConversationsHandler] conversations:', conversation.uid, this.conversations);
|
|
205
204
|
const index = this.searchIndexInArrayForConversationWith(this.conversations, conversation.conversation_with);
|
|
206
|
-
this.logger.debug('[MQTTConversationsHandler] found index:', index)
|
|
207
|
-
this.logger.debug('[MQTTConversationsHandler] NUOVA CONVER;.uid2' + conversation.uid)
|
|
208
205
|
if (index > -1) {
|
|
209
206
|
this.logger.debug('[MQTTConversationsHandler] TROVATO')
|
|
210
207
|
this.conversations.splice(index, 1, conversation);
|
|
@@ -215,13 +212,8 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
215
212
|
}
|
|
216
213
|
this.logger.debug('[MQTTConversationsHandler] NUOVA CONVER;.uid3' + conversation.uid)
|
|
217
214
|
this.conversations.sort(compareValues('timestamp', 'desc'));
|
|
218
|
-
this.logger.debug('[MQTTConversationsHandler] NUOVA CONVER;.uid4' + conversation.uid)
|
|
219
215
|
this.logger.debug('[MQTTConversationsHandler] TUTTE:', this.conversations)
|
|
220
|
-
// this.conversationChanged.next(conversation);
|
|
221
|
-
this.logger.debug('[MQTTConversationsHandler] NUOVA CONVER;.uid5' + conversation.uid)
|
|
222
216
|
this.conversationAdded.next(conversation);
|
|
223
|
-
this.logger.debug('[MQTTConversationsHandler] NUOVA CONVER;.uid6' + conversation.uid)
|
|
224
|
-
// this.events.publish('conversationsChanged', this.conversations);
|
|
225
217
|
} else {
|
|
226
218
|
this.logger.error('[MQTTConversationsHandler] ChatConversationsHandler::added::conversations with conversationId: ', conversation.conversation_with, 'is not valid');
|
|
227
219
|
}
|
|
@@ -272,7 +264,6 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
272
264
|
|
|
273
265
|
private updateConversationWithSnapshot(conv: ConversationModel, snap: any) {
|
|
274
266
|
this.logger.debug('[MQTTConversationsHandler] updating conv', conv, 'with snap', snap)
|
|
275
|
-
this.logger.debug('[MQTTConversationsHandler] print snap keys/values')
|
|
276
267
|
Object.keys(snap).forEach(k => {
|
|
277
268
|
this.logger.debug('[MQTTConversationsHandler] key:' + k);
|
|
278
269
|
if (k === 'is_new') {
|
|
@@ -317,27 +308,6 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
317
308
|
conv.type = snap[k];
|
|
318
309
|
}
|
|
319
310
|
});
|
|
320
|
-
// SCHEMA ConversationModel
|
|
321
|
-
// public uid: string,
|
|
322
|
-
// public attributes: any,
|
|
323
|
-
// public channel_type: string,
|
|
324
|
-
// public conversation_with_fullname: string,
|
|
325
|
-
// public conversation_with: string,
|
|
326
|
-
// public recipient: string,
|
|
327
|
-
// public recipient_fullname: string,
|
|
328
|
-
// public image: string,
|
|
329
|
-
// public is_new: boolean,
|
|
330
|
-
// public last_message_text: string,
|
|
331
|
-
// public sender: string,
|
|
332
|
-
// public senderAuthInfo: any,
|
|
333
|
-
// public sender_fullname: string,
|
|
334
|
-
// public status: string,
|
|
335
|
-
// public timestamp: string,
|
|
336
|
-
// public time_last_message: string,
|
|
337
|
-
// public selected: boolean,
|
|
338
|
-
// public color: string,
|
|
339
|
-
// public avatar: string,
|
|
340
|
-
// public archived: boolean
|
|
341
311
|
}
|
|
342
312
|
|
|
343
313
|
|
|
@@ -416,13 +386,10 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
416
386
|
conv.last_message_text = conv.text; // building conv with a message
|
|
417
387
|
}
|
|
418
388
|
conv.uid = conv.conversation_with;
|
|
419
|
-
console.log("uidConvSelected is", this.uidConvSelected);
|
|
420
389
|
if (conv.uid === this.uidConvSelected) {
|
|
421
|
-
this.logger.debug("For selected conversation is_new = false");
|
|
422
390
|
conv.is_new = false;
|
|
423
391
|
}
|
|
424
392
|
if (conv.sender === this.loggedUserId) {
|
|
425
|
-
this.logger.debug("is_new always false if sender it's me")
|
|
426
393
|
conv.is_new = false;
|
|
427
394
|
}
|
|
428
395
|
return conv;
|
|
@@ -35,7 +35,7 @@ import { avatarPlaceholder, getColorBck } from 'src/chat21-core/utils/utils-user
|
|
|
35
35
|
* inizializzo groups handler
|
|
36
36
|
*/
|
|
37
37
|
initialize(tenant: string, loggedUserId: string): void {
|
|
38
|
-
this.logger.log('
|
|
38
|
+
this.logger.log('[MQTT-GROUPS-HANDLER] initialize');
|
|
39
39
|
this.tenant = tenant;
|
|
40
40
|
this.loggedUserId = loggedUserId;
|
|
41
41
|
}
|
|
@@ -64,13 +64,11 @@ import { avatarPlaceholder, getColorBck } from 'src/chat21-core/utils/utils-user
|
|
|
64
64
|
onGroupChange(groupId: string): Observable<GroupModel> {
|
|
65
65
|
if (this.isGroup(groupId)) {
|
|
66
66
|
this.chat21Service.chatClient.groupData(groupId, (err, group) => {
|
|
67
|
-
this.logger.log('got result by REST call:', group);
|
|
68
|
-
this.logger.log('got group by REST call:', group.result);
|
|
67
|
+
this.logger.log('[MQTT-GROUPS-HANDLER] onGroupChange: got result by REST call:', group);
|
|
69
68
|
this.groupValue(group.result);
|
|
70
|
-
this.logger.log('subscribing to group updates...', groupId);
|
|
69
|
+
this.logger.log('[MQTT-GROUPS-HANDLER] onGroupChange: subscribing to group updates...', groupId);
|
|
71
70
|
const handler_group_updated = this.chat21Service.chatClient.onGroupUpdated( (group, topic) => {
|
|
72
71
|
if (topic.conversWith === groupId) {
|
|
73
|
-
this.logger.log('group updated:', group);
|
|
74
72
|
this.groupValue(group);
|
|
75
73
|
}
|
|
76
74
|
});
|
|
@@ -87,13 +85,11 @@ import { avatarPlaceholder, getColorBck } from 'src/chat21-core/utils/utils-user
|
|
|
87
85
|
}
|
|
88
86
|
|
|
89
87
|
private groupValue(childSnapshot: any){
|
|
90
|
-
this.logger.
|
|
91
|
-
const group: GroupModel = childSnapshot;
|
|
92
|
-
this.logger.
|
|
88
|
+
this.logger.debug('[MQTT-GROUPS-SERV] group detail::', childSnapshot.val(), childSnapshot)
|
|
89
|
+
const group: GroupModel = childSnapshot.val();
|
|
90
|
+
this.logger.debug('[MQTT-GROUPS-SERV] groupValue ', group)
|
|
93
91
|
if (group) {
|
|
94
92
|
let groupCompleted = this.completeGroup(group)
|
|
95
|
-
this.logger.log("group:", group);
|
|
96
|
-
this.logger.log("groupCompleted:", groupCompleted);
|
|
97
93
|
this.SgroupDetail.next(groupCompleted)
|
|
98
94
|
}
|
|
99
95
|
}
|
|
@@ -14,109 +14,104 @@ import { Chat21Service } from './chat-service';
|
|
|
14
14
|
@Injectable({
|
|
15
15
|
providedIn: 'root'
|
|
16
16
|
})
|
|
17
|
-
|
|
17
|
+
export class MQTTNotifications extends NotificationsService {
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
public BUILD_VERSION: string;
|
|
20
|
+
private FCMcurrentToken: string;
|
|
21
|
+
private userId: string;
|
|
22
|
+
private tenant: string;
|
|
23
|
+
private vapidkey: string;
|
|
24
|
+
private logger: LoggerService = LoggerInstance.getInstance();
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
constructor(
|
|
27
|
+
public chat21Service: Chat21Service
|
|
28
28
|
) {
|
|
29
|
-
|
|
29
|
+
super();
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
initialize(tenant: string, vapId: string): void {
|
|
33
|
+
this.tenant = tenant;
|
|
34
|
+
this.vapidkey = vapId;
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
getNotificationPermissionAndSaveToken(currentUserUid) {
|
|
39
|
+
console.log("[MQTTNotificationService] getNotificationPermissionAndSaveToken()",currentUserUid );
|
|
40
|
+
this.userId = currentUserUid;
|
|
41
|
+
if (firebase.messaging.isSupported()) {
|
|
42
|
+
console.log("[MQTTNotificationService] 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('[MQTTNotificationService] >>>> requestPermission Notification permission granted.');
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
49
|
+
return messaging.getToken({ vapidKey: this.vapidkey })
|
|
50
|
+
}
|
|
51
|
+
}).then(FCMtoken => {
|
|
52
|
+
this.logger.log('[MQTTNotificationService] >>>> 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('[MQTTNotificationService] >>>> requestPermission ERR: Unable to get permission to notify.', err);
|
|
58
|
+
});
|
|
59
|
+
} else {
|
|
60
|
+
this.logger.log('[MQTTNotificationService] >>>> FIREBASE MESSAGING IS NOT SUPPORTED')
|
|
62
61
|
}
|
|
62
|
+
}
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
|
65
|
+
removeNotificationsInstance(callback: (string) => void) {
|
|
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('[MQTTNotificationService] >>>> 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('[MQTTNotificationService] >>>> connectionsRef ', connectionsRef);
|
|
85
|
+
self.logger.log('[MQTTNotificationService] >>>> connectionsRef url ', connectionsRefURL);
|
|
86
|
+
connectionsRef.off()
|
|
87
|
+
connectionsRef.remove().then(() => {
|
|
88
|
+
self.logger.log("[MQTTNotificationService] >>>> removeNotificationsInstance > Remove succeeded.")
|
|
89
|
+
callback('success')
|
|
90
|
+
}).catch((error) => {
|
|
91
|
+
self.logger.error("[MQTTNotificationService] >>>> removeNotificationsInstance Remove failed: " + error.message)
|
|
92
|
+
callback('error')
|
|
93
|
+
}).finally(() => {
|
|
94
|
+
self.logger.log('[MQTTNotificationService] COMPLETED');
|
|
95
|
+
})
|
|
110
96
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private saveToken(FCMcurrentToken, currentUserUid) {
|
|
100
|
+
this.logger.log('[MQTTNotificationService] >>>> getPermission > updateToken ', FCMcurrentToken);
|
|
101
|
+
if (!currentUserUid || !FCMcurrentToken) {
|
|
102
|
+
return
|
|
103
|
+
};
|
|
104
|
+
const device_model = {
|
|
105
|
+
device_model: navigator.userAgent,
|
|
106
|
+
language: navigator.language,
|
|
107
|
+
platform: 'ionic',
|
|
108
|
+
platform_version: this.BUILD_VERSION
|
|
120
109
|
}
|
|
121
|
-
|
|
110
|
+
this.chat21Service.chatClient.saveInstance(FCMcurrentToken,device_model,(err, response) => {
|
|
111
|
+
if (err) {
|
|
112
|
+
this.logger.error('[MQTTNotificationService] Error saving FCMcurrentToken on chat21 App Instance', FCMcurrentToken);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
122
115
|
}
|
|
116
|
+
|
|
117
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
1
2
|
import { Injectable } from '@angular/core';
|
|
2
3
|
import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service';
|
|
3
4
|
|
|
@@ -7,7 +8,7 @@ export class NativeImageRepoService extends ImageRepoService {
|
|
|
7
8
|
|
|
8
9
|
private baseImageURL: string;
|
|
9
10
|
|
|
10
|
-
constructor() {
|
|
11
|
+
constructor(public http: HttpClient) {
|
|
11
12
|
super();
|
|
12
13
|
}
|
|
13
14
|
|
|
@@ -25,6 +26,12 @@ export class NativeImageRepoService extends ImageRepoService {
|
|
|
25
26
|
const filename_photo = '?path=uploads/users/'+ sender_id + '/images/photo.jpg'
|
|
26
27
|
const filename_thumbnail = '?path=uploads/users/'+ sender_id + '/images/thumbnails_200_200-photo.jpg'
|
|
27
28
|
return this.baseImageURL + filename_photo
|
|
28
|
-
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
checkImageExists(url: string, callback: (exist: boolean) => void): void {
|
|
32
|
+
this.http.get(url).subscribe( res => {
|
|
33
|
+
callback(true)
|
|
34
|
+
},(error) => { console.log('errorrrrrr', url, error);callback(false)})
|
|
35
|
+
}
|
|
29
36
|
|
|
30
37
|
}
|
|
@@ -25,9 +25,8 @@ export class NativeUploadService extends UploadService {
|
|
|
25
25
|
super();
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
29
28
|
initialize(): void {
|
|
30
|
-
this.logger.info('
|
|
29
|
+
this.logger.info('[NATIVE UPLOAD] initialize')
|
|
31
30
|
this.URL_TILEDESK_FILE = this.getBaseUrl() + 'files'
|
|
32
31
|
this.URL_TILEDESK_IMAGES = this.getBaseUrl() + 'images'
|
|
33
32
|
this.tiledeskToken = this.appStorage.getItem('tiledeskToken')
|
|
@@ -119,7 +119,6 @@ export class TiledeskAuthService {
|
|
|
119
119
|
if (data['success'] && data['token']) {
|
|
120
120
|
that.tiledeskToken = data['token'];
|
|
121
121
|
that.createCompleteUser(data['user']);
|
|
122
|
-
|
|
123
122
|
// that.appStorage.setItem('tiledeskToken', that.tiledeskToken); // salvarlo esternamente nell'app.component
|
|
124
123
|
this.checkAndSetInStorageTiledeskToken(that.tiledeskToken)
|
|
125
124
|
resolve(this.currentUser)
|
|
@@ -110,7 +110,7 @@ export const LogLevel = {
|
|
|
110
110
|
'DEBUG': 3
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
export const tranlatedLanguage = ['it', 'en', 'de', 'es', 'pt', 'fr', 'ru', 'tr', 'sr', 'ar', 'uk']
|
|
113
|
+
export const tranlatedLanguage = ['it', 'en', 'de', 'es', 'pt', 'fr', 'ru', 'tr', 'sr', 'ar', 'uk', 'sv', 'az', 'kk', 'uz']
|
|
114
114
|
|
|
115
115
|
|
|
116
116
|
|
|
@@ -109,7 +109,7 @@ export function isEmojii(message: any){
|
|
|
109
109
|
const onlyEmojis = message.replace(new RegExp('[\u0000-\u1eeff]', 'g'), '')
|
|
110
110
|
const visibleChars = message.replace(new RegExp('[\n\r\s]+|( )+', 'g'), '')
|
|
111
111
|
if(onlyEmojis === '' || visibleChars == '') return false
|
|
112
|
-
return onlyEmojis.length === visibleChars.length
|
|
112
|
+
return (onlyEmojis.length === visibleChars.length && onlyEmojis.length <= 2)
|
|
113
113
|
} catch(e) {
|
|
114
114
|
return false
|
|
115
115
|
}
|
package/deploy_pre.sh
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# environment=$(< src/utils/constants.ts)
|
|
2
|
-
# start="CURR_VER_PROD = '0."
|
|
3
|
-
# end="'"
|
|
4
|
-
# one=${environment#*$start}
|
|
5
|
-
# build=${one%%$end*} #two=${one%,*} -> %% prendo la prima istanza; % prendo la seconda
|
|
6
|
-
# NEW_BUILD=$(($build + 1))
|
|
7
|
-
# sed -i -e "s/$start$build/$start$NEW_BUILD/g" src/utils/constants.ts
|
|
8
|
-
|
|
9
|
-
#npm version prerelease --preid=beta
|
|
10
|
-
version=`node -e 'console.log(require("./package.json").version)'`
|
|
11
|
-
echo "version $version"
|
|
12
|
-
|
|
13
|
-
URL_VER=${version//[.]//}
|
|
14
|
-
echo 'URL_VER: ---->'$URL_VER
|
|
15
|
-
|
|
16
|
-
# if [ "$version" != "" ]; then
|
|
17
|
-
# git tag -a "v$version" -m "`git log -1 --format=%s`"
|
|
18
|
-
# echo "Created a new tag, v$version"
|
|
19
|
-
# git push --tags
|
|
20
|
-
# npm publish
|
|
21
|
-
# fi
|
|
22
|
-
|
|
23
|
-
sed -i -e "s/$URL_VER/g" src/utils/constants.ts
|
|
24
|
-
|
|
25
|
-
# ng build --prod --base-href /$NEW_BUILD/
|
|
26
|
-
#ionic cordova build browser --prod
|
|
27
|
-
|
|
28
|
-
ionic cordova platform add browser --save
|
|
29
|
-
#ionic cordova build browser --prod --release
|
|
30
|
-
ionic cordova build --env=pre browser #--prod --verbose
|
|
31
|
-
|
|
32
|
-
cp -p src/firebase-messaging-sw.js platforms/browser/www/
|
|
33
|
-
cp -p src/manifest.json platforms/browser/www/
|
|
34
|
-
cp -p src/chat-config.json platforms/browser/www/
|
|
35
|
-
|
|
36
|
-
cd platforms/browser/www
|
|
37
|
-
aws s3 sync . s3://tiledesk-dashboard-pre/chat-ionic5/$version/
|
|
38
|
-
aws s3 sync . s3://tiledesk-dashboard-pre/chat-ionic5/
|
|
39
|
-
cd ../../../
|
|
40
|
-
|
|
41
|
-
#aws cloudfront create-invalidation --distribution-id E2DTAKWHWQ7C3J --paths "/*"
|
|
42
|
-
|
|
43
|
-
echo new version deployed on s3://tiledesk-dashboard-pre/chat-ionic5/$version/
|
|
44
|
-
echo available on https://s3.eu-west-1.amazonaws.com/tiledesk-dashboard-pre/chat-ionic5/$version/index.html
|