@chat21/chat21-ionic 3.0.64 → 3.0.65
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 +34 -2
- package/deploy_amazon_beta.sh +0 -0
- package/deploy_amazon_prod.sh +1 -0
- package/deploy_pre.sh +39 -6
- package/package.json +8 -3
- package/publiccode.yml +110 -0
- package/src/app/app.component.ts +40 -66
- package/src/app/app.module.ts +1 -0
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +2 -2
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +0 -1
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +2 -39
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +18 -6
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +1 -11
- package/src/app/chatlib/conversation-detail/message/html/html.component.html +1 -0
- package/src/app/chatlib/conversation-detail/message/html/html.component.scss +79 -0
- package/src/app/chatlib/conversation-detail/message/html/html.component.spec.ts +25 -0
- package/src/app/chatlib/conversation-detail/message/html/html.component.ts +33 -0
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +1 -1
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +18 -30
- package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.ts +0 -1
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +7 -5
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +21 -0
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component_2.html +116 -0
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +2 -2
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +2 -2
- package/src/app/components/project-item/project-item.component.ts +5 -0
- package/src/app/components/sidebar/sidebar.component.ts +8 -15
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.html +12 -23
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.scss +3 -0
- package/src/app/components/sidebar-user-details/sidebar-user-details.component.ts +88 -136
- package/src/app/directives/safe-html.pipe.ts +2 -2
- package/src/app/directives/truncate.pipe.spec.ts +8 -0
- package/src/app/directives/truncate.pipe.ts +15 -0
- package/src/app/pages/authentication/login/login.page.ts +0 -1
- package/src/app/pages/conversation-detail/conversation-detail.module.ts +3 -2
- package/src/app/pages/conversation-detail/conversation-detail.page.html +4 -2
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +56 -71
- package/src/app/pages/conversations-list/conversations-list.page.html +21 -12
- package/src/app/pages/conversations-list/conversations-list.page.ts +129 -367
- package/src/app/pages/loader-preview/loader-preview.module.ts +1 -2
- package/src/app/shared/shared.module.ts +4 -0
- package/src/assets/i18n/ar.json +266 -0
- package/src/assets/js/chat21client.js +58 -60
- package/src/chat21-core/models/conversation.ts +2 -2
- package/src/chat21-core/providers/abstract/conversations-handler.service.ts +1 -1
- package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +26 -21
- package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +78 -23
- package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +16 -13
- package/src/chat21-core/utils/constants.ts +1 -1
- package/src/chat21-core/utils/utils-message.ts +2 -3
- package/src/global.scss +2 -2
- package/deploy_prod.sh +0 -11
|
@@ -53,6 +53,7 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
|
|
|
53
53
|
private BASE_URL: string;
|
|
54
54
|
// private audio: any;
|
|
55
55
|
// private setTimeoutSound: any;
|
|
56
|
+
private subscribe: any
|
|
56
57
|
|
|
57
58
|
constructor(
|
|
58
59
|
//public databaseProvider: DatabaseProvider
|
|
@@ -114,11 +115,41 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
|
|
|
114
115
|
// ---------------------------------------------------------------------------------
|
|
115
116
|
// New connect - renamed subscribeToConversation
|
|
116
117
|
//----------------------------------------------------------------------------------
|
|
117
|
-
subscribeToConversations(callback) {
|
|
118
|
+
subscribeToConversations(lastConversationTimestamp: number, callback) {
|
|
118
119
|
const that = this;
|
|
119
120
|
const urlNodeFirebase = conversationsPathForUserId(this.tenant, this.loggedUserId);
|
|
120
121
|
this.logger.debug('[FIREBASEConversationsHandlerSERVICE] SubscribeToConversations conversations::ACTIVE urlNodeFirebase', urlNodeFirebase)
|
|
121
122
|
this.ref = firebase.database().ref(urlNodeFirebase).orderByChild('timestamp').limitToLast(200);
|
|
123
|
+
|
|
124
|
+
// this.ref.once('value').then(snapshot => {
|
|
125
|
+
// if(snapshot && snapshot.val()){
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
// snapshot.forEach(childSnapshot => {
|
|
129
|
+
// // const childData: ConversationModel = childSnapshot.val();
|
|
130
|
+
// // childData.uid = childSnapshot.key
|
|
131
|
+
// // that.added(childData)
|
|
132
|
+
// // lastConversationTimestamp = childData.timestamp
|
|
133
|
+
// that.added(childSnapshot)
|
|
134
|
+
// });
|
|
135
|
+
// this.logger.debug('[FIREBASEConversationsHandlerSERVICE] # of remote conversations on Firebase:', Object.keys(snapshot.val()).length)
|
|
136
|
+
// this.logger.debug('[FIREBASEConversationsHandlerSERVICE] # of conversation added:', that.conversations)
|
|
137
|
+
// callback(that.conversations)
|
|
138
|
+
// return lastConversationTimestamp
|
|
139
|
+
// }
|
|
140
|
+
|
|
141
|
+
// }).then(()=> {
|
|
142
|
+
// this.ref.on('child_changed', (childSnapshot) => {
|
|
143
|
+
// that.changed(childSnapshot);
|
|
144
|
+
// });
|
|
145
|
+
// this.ref.on('child_removed', (childSnapshot) => {
|
|
146
|
+
// that.removed(childSnapshot);
|
|
147
|
+
// });
|
|
148
|
+
// this.ref.on('child_added', (childSnapshot) => {
|
|
149
|
+
// that.added(childSnapshot);
|
|
150
|
+
// });
|
|
151
|
+
// })
|
|
152
|
+
|
|
122
153
|
this.ref.on('child_changed', (childSnapshot) => {
|
|
123
154
|
that.changed(childSnapshot);
|
|
124
155
|
});
|
|
@@ -132,10 +163,6 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
|
|
|
132
163
|
setTimeout(() => {
|
|
133
164
|
callback()
|
|
134
165
|
}, 2000);
|
|
135
|
-
// SET AUDIO
|
|
136
|
-
// this.audio = new Audio();
|
|
137
|
-
// this.audio.src = URL_SOUND;
|
|
138
|
-
// this.audio.load();
|
|
139
166
|
}
|
|
140
167
|
|
|
141
168
|
/**
|
|
@@ -275,24 +302,44 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
|
|
|
275
302
|
} else {
|
|
276
303
|
this.logger.log('[FIREBASEConversationsHandlerSERVICE] getConversationDetail ***** ELSE')
|
|
277
304
|
// const urlNodeFirebase = '/apps/' + this.tenant + '/users/' + this.loggedUserId + '/conversations/' + conversationId;
|
|
278
|
-
const urlNodeFirebase = conversationsPathForUserId(this.tenant, this.loggedUserId) + '/' + conversationId;
|
|
305
|
+
const urlNodeFirebase = conversationsPathForUserId(this.tenant, this.loggedUserId) // + '/' + conversationId;
|
|
279
306
|
this.logger.log('[FIREBASEConversationsHandlerSERVICE] conversationDetail urlNodeFirebase *****', urlNodeFirebase)
|
|
280
307
|
const firebaseMessages = firebase.database().ref(urlNodeFirebase);
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
// && childData.uid
|
|
286
|
-
if (childSnapshot && childSnapshot.key && childData) {
|
|
287
|
-
childData.uid = childSnapshot.key;
|
|
288
|
-
const conversation = this.completeConversation(childData);
|
|
289
|
-
if (conversation) {
|
|
290
|
-
callback(conversation)
|
|
291
|
-
} else {
|
|
292
|
-
callback(null)
|
|
293
|
-
}
|
|
308
|
+
if(this.subscribe){
|
|
309
|
+
this.logger.log('[FIREBASEConversationsHandlerSERVICE] getConversationDetail ALREADY SUBSCRIBED')
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
294
312
|
|
|
313
|
+
this.subscribe = firebaseMessages.on('value', (snap) => {
|
|
314
|
+
const childSnapshot = snap.child('/'+conversationId)
|
|
315
|
+
if(!childSnapshot.exists()){
|
|
316
|
+
this.logger.log('[FIREBASEConversationsHandlerSERVICE] getConversationDetail conversation NOT exist', conversationId)
|
|
317
|
+
callback(null)
|
|
318
|
+
} else {
|
|
319
|
+
const childData: ConversationModel = childSnapshot.val();
|
|
320
|
+
this.logger.debug('[FIREBASEConversationsHandlerSERVICE] getConversationDetail conversation exist', childSnapshot.val(), childSnapshot.key)
|
|
321
|
+
if (childSnapshot && childSnapshot.key && childData) {
|
|
322
|
+
childData.uid = childSnapshot.key;
|
|
323
|
+
const conversation = this.completeConversation(childData);
|
|
324
|
+
if (conversation) {
|
|
325
|
+
callback(conversation)
|
|
326
|
+
} else {
|
|
327
|
+
callback(null)
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
// this.BSConversationDetail.next(conversation);
|
|
295
331
|
}
|
|
332
|
+
// const childData: ConversationModel = childSnapshot.val();
|
|
333
|
+
// this.logger.debug('[FIREBASEConversationsHandlerSERVICE] conversationDetail childSnapshot *****', childSnapshot.val())
|
|
334
|
+
// if (childSnapshot && childSnapshot.key && childData) {
|
|
335
|
+
// childData.uid = childSnapshot.key;
|
|
336
|
+
// const conversation = this.completeConversation(childData);
|
|
337
|
+
// if (conversation) {
|
|
338
|
+
// callback(conversation)
|
|
339
|
+
// } else {
|
|
340
|
+
// callback(null)
|
|
341
|
+
// }
|
|
342
|
+
// }
|
|
296
343
|
// this.BSConversationDetail.next(conversation);
|
|
297
344
|
});
|
|
298
345
|
}
|
|
@@ -339,7 +386,7 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
|
|
|
339
386
|
childData.uid = childSnapshot.key;
|
|
340
387
|
const conversation = this.completeConversation(childData);
|
|
341
388
|
if (this.isValidConversation(conversation)) {
|
|
342
|
-
this.setClosingConversation(
|
|
389
|
+
this.setClosingConversation(conversation.uid, false);
|
|
343
390
|
const index = searchIndexInArrayForUid(this.conversations, conversation.uid);
|
|
344
391
|
if (index > -1) {
|
|
345
392
|
this.conversations.splice(index, 1, conversation);
|
|
@@ -464,7 +511,7 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
|
|
|
464
511
|
* @param conv
|
|
465
512
|
*/
|
|
466
513
|
private completeConversation(conv): ConversationModel {
|
|
467
|
-
conv.selected = false;
|
|
514
|
+
// conv.selected = false;
|
|
468
515
|
if (!conv.sender_fullname || conv.sender_fullname === 'undefined' || conv.sender_fullname.trim() === '') {
|
|
469
516
|
conv.sender_fullname = conv.sender;
|
|
470
517
|
}
|
|
@@ -491,6 +538,14 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
|
|
|
491
538
|
this.translateInfoSupportMessages(conv);
|
|
492
539
|
}
|
|
493
540
|
}
|
|
541
|
+
/** START: UPDATE CONVERSATIONS is_new IF conv is selected or sender is me */
|
|
542
|
+
if(conv.uid === this.uidConvSelected){
|
|
543
|
+
conv.is_new = false
|
|
544
|
+
}
|
|
545
|
+
if(conv.sender === this.loggedUserId){
|
|
546
|
+
conv.is_new = false
|
|
547
|
+
}
|
|
548
|
+
/** END: UPDATE CONVERSATIONS is_new IF conv is selected or sender is me */
|
|
494
549
|
|
|
495
550
|
// Fixes the bug: if a snippet of code is pasted and sent it is not displayed correctly in the convesations list
|
|
496
551
|
// conv.time_last_message = this.getTimeLastMessage(conv.timestamp);
|
|
@@ -503,7 +558,7 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
|
|
|
503
558
|
// getImageUrlThumbFromFirebasestorage(conversation_with, this.FIREBASESTORAGE_BASE_URL_IMAGE, this.urlStorageBucket);
|
|
504
559
|
return conv;
|
|
505
560
|
}
|
|
506
|
-
|
|
561
|
+
|
|
507
562
|
|
|
508
563
|
/**BUG-FIX: on Conversation-list, when conversation start, it continuosly change the sender_fullname info from Guest to others name */
|
|
509
564
|
private changeSenderFullName(conversation: ConversationModel): string {
|
|
@@ -520,7 +575,6 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
|
|
|
520
575
|
return conversation_with_fullname
|
|
521
576
|
}
|
|
522
577
|
|
|
523
|
-
|
|
524
578
|
translateInfoSupportMessages(conv) {
|
|
525
579
|
const INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU = this.translationMap.get('INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU');
|
|
526
580
|
// console.log('[FIREBASEConversationsHandlerSERVICE] INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU', INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU)
|
|
@@ -608,3 +662,4 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
|
|
|
608
662
|
// END PRIVATE FUNCTIONS
|
|
609
663
|
// ---------------------------------------------------------- //
|
|
610
664
|
}
|
|
665
|
+
|
|
@@ -59,18 +59,15 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
59
59
|
// 1 search local array
|
|
60
60
|
// 2 search remote
|
|
61
61
|
// callback
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
const conversation = this.conversations.find(conv => conv.conversation_with === conversationWith);
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
if (conversation) {
|
|
66
|
-
|
|
66
|
+
|
|
67
67
|
callback(conversation);
|
|
68
68
|
} else {
|
|
69
|
-
|
|
69
|
+
|
|
70
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
72
|
if (conversation) {
|
|
76
73
|
if (callback) {
|
|
@@ -147,7 +144,8 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
147
144
|
// ---------------------------------------------------------------------------------
|
|
148
145
|
// New connect - renamed subscribeToConversation
|
|
149
146
|
//----------------------------------------------------------------------------------
|
|
150
|
-
subscribeToConversations(loaded) {
|
|
147
|
+
subscribeToConversations(lastTimestamp, loaded) {
|
|
148
|
+
// lastTimestamp temporarily ignored
|
|
151
149
|
this.logger.debug('[MQTTConversationsHandler] connecting MQTT conversations handler');
|
|
152
150
|
const handlerConversationAdded = this.chat21Service.chatClient.onConversationAdded( (conv) => {
|
|
153
151
|
this.logger.log("onConversationAdded:", conv);
|
|
@@ -385,8 +383,7 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
385
383
|
}
|
|
386
384
|
|
|
387
385
|
private completeConversation(conv): ConversationModel {
|
|
388
|
-
|
|
389
|
-
conv.selected = false;
|
|
386
|
+
// conv.selected = false;
|
|
390
387
|
if (!conv.sender_fullname || conv.sender_fullname === 'undefined' || conv.sender_fullname.trim() === '') {
|
|
391
388
|
conv.sender_fullname = conv.sender;
|
|
392
389
|
}
|
|
@@ -414,13 +411,19 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
414
411
|
conv.last_message_text = conv.text; // building conv with a message
|
|
415
412
|
}
|
|
416
413
|
conv.uid = conv.conversation_with;
|
|
414
|
+
console.log("uidConvSelected is", this.uidConvSelected);
|
|
415
|
+
if (conv.uid === this.uidConvSelected) {
|
|
416
|
+
this.logger.debug("For selected conversation is_new = false");
|
|
417
|
+
conv.is_new = false;
|
|
418
|
+
}
|
|
419
|
+
if (conv.sender === this.loggedUserId) {
|
|
420
|
+
this.logger.debug("is_new always false if sender it's me")
|
|
421
|
+
conv.is_new = false;
|
|
422
|
+
}
|
|
417
423
|
return conv;
|
|
418
424
|
}
|
|
419
425
|
|
|
420
426
|
private isGroup(conv: ConversationModel) {
|
|
421
|
-
console.log("CONVIS: " + JSON.stringify(conv));
|
|
422
|
-
console.log("CONVIS OBJ:", conv);
|
|
423
|
-
|
|
424
427
|
if (conv.recipient.startsWith('group-') || conv.recipient.startsWith('support-group')) {
|
|
425
428
|
return true;
|
|
426
429
|
};
|
|
@@ -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']
|
|
113
|
+
export const tranlatedLanguage = ['it', 'en', 'de', 'es', 'pt', 'fr', 'ru', 'tr', 'sr', 'ar']
|
|
114
114
|
|
|
115
115
|
|
|
116
116
|
|
|
@@ -85,9 +85,8 @@ export function messageType(msgType: string, message: any) {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
export function isEmojii(message: any)
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
export function isEmojii(message: any){
|
|
89
|
+
|
|
91
90
|
// let emoji = '';
|
|
92
91
|
// try {
|
|
93
92
|
// emoji = message.trim(); // .charAt(0);
|
package/src/global.scss
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
@import "~@ionic/angular/css/text-transformation.css";
|
|
26
26
|
@import "~@ionic/angular/css/flex-utils.css";
|
|
27
27
|
|
|
28
|
-
@import
|
|
28
|
+
@import 'material-icons/iconfont/material-icons.css';
|
|
29
29
|
@import "variables.scss";
|
|
30
30
|
|
|
31
31
|
// http://ionicframework.com/docs/v2/theming/
|
|
@@ -974,7 +974,7 @@ ul.dropdown-menu > li > a {
|
|
|
974
974
|
|
|
975
975
|
.sidebar .nav i {
|
|
976
976
|
// font-size: 20px;
|
|
977
|
-
float: left;
|
|
977
|
+
// float: left;
|
|
978
978
|
// margin-right: 15px;
|
|
979
979
|
// line-height: 30px;
|
|
980
980
|
width: 60px;
|
package/deploy_prod.sh
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# npm version patch
|
|
2
|
-
version=`node -e 'console.log(require("./package.json").version)'`
|
|
3
|
-
echo "version $version"
|
|
4
|
-
|
|
5
|
-
if [ "$version" != "" ]; then
|
|
6
|
-
git tag -a "$version" -m "`git log -1 --format=%s`"
|
|
7
|
-
echo "Created a new tag, $version"
|
|
8
|
-
git push --tags
|
|
9
|
-
npm publish
|
|
10
|
-
fi
|
|
11
|
-
|