@chat21/chat21-ionic 3.0.65-rc1 → 3.0.66
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 +23 -1
- package/deploy_amazon_beta.sh +0 -0
- package/deploy_amazon_prod.sh +3 -3
- package/package.json +3 -3
- package/src/app/app.component.ts +18 -61
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +0 -10
- package/src/app/chatlib/conversation-detail/message/return-receipt/return-receipt.component.html +49 -4
- 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/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +6 -4
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +2 -0
- package/src/app/components/project-item/project-item.component.ts +5 -0
- package/src/app/components/sidebar/sidebar.component.ts +28 -29
- 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/truncate.pipe.ts +0 -1
- package/src/app/pages/authentication/login/login.page.ts +0 -1
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +44 -48
- package/src/app/pages/conversations-list/conversations-list.page.ts +27 -3
- package/src/assets/i18n/ar.json +266 -0
- package/src/assets/i18n/uk.json +266 -0
- package/src/assets/js/chat21client.js +57 -59
- package/src/chat21-core/models/conversation.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 +72 -56
- package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +16 -13
- package/src/chat21-core/utils/constants.ts +1 -1
- package/src/global.scss +2 -2
- package/deploy_prod.sh +0 -14
|
@@ -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
|
|
@@ -121,62 +122,47 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
|
|
|
121
122
|
this.ref = firebase.database().ref(urlNodeFirebase).orderByChild('timestamp').limitToLast(200);
|
|
122
123
|
|
|
123
124
|
// this.ref.once('value').then(snapshot => {
|
|
124
|
-
// snapshot.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
//
|
|
128
|
-
//
|
|
129
|
-
//
|
|
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
|
+
// }
|
|
130
140
|
|
|
131
|
-
//
|
|
132
|
-
//
|
|
133
|
-
//
|
|
134
|
-
// console.log('timestampppppp',timestamp)
|
|
135
|
-
// this.ref.startAt(timestamp).on('child_changed', (childSnapshot) => {
|
|
136
|
-
// const conv: ConversationModel = childSnapshot.val();
|
|
137
|
-
// conv.uid = childSnapshot.key
|
|
138
|
-
// that.changed(conv);
|
|
141
|
+
// }).then(()=> {
|
|
142
|
+
// this.ref.on('child_changed', (childSnapshot) => {
|
|
143
|
+
// that.changed(childSnapshot);
|
|
139
144
|
// });
|
|
140
|
-
// this.ref.
|
|
141
|
-
//
|
|
142
|
-
// conv.uid = childSnapshot.key
|
|
143
|
-
// that.removed(conv);
|
|
145
|
+
// this.ref.on('child_removed', (childSnapshot) => {
|
|
146
|
+
// that.removed(childSnapshot);
|
|
144
147
|
// });
|
|
145
|
-
// this.ref.
|
|
146
|
-
//
|
|
147
|
-
// console.log('addedddd', conv)
|
|
148
|
-
// conv.uid = childSnapshot.key
|
|
149
|
-
// that.added(conv);
|
|
148
|
+
// this.ref.on('child_added', (childSnapshot) => {
|
|
149
|
+
// that.added(childSnapshot);
|
|
150
150
|
// });
|
|
151
|
-
// });
|
|
152
|
-
// this.ref.on('value', (snaps) => {
|
|
153
|
-
// if(snaps){
|
|
154
|
-
// console.log('convvvvvv', snaps.val(), snaps.val().length)
|
|
155
|
-
// for(let item=0; item<snaps.val().length; item++){
|
|
156
|
-
// that.added(snaps.val()[item])
|
|
157
|
-
// }
|
|
158
|
-
// callback(this.conversations)
|
|
159
|
-
// }
|
|
160
151
|
// })
|
|
161
|
-
|
|
152
|
+
|
|
153
|
+
this.ref.on('child_changed', (childSnapshot) => {
|
|
162
154
|
that.changed(childSnapshot);
|
|
163
155
|
});
|
|
164
|
-
this.ref.
|
|
156
|
+
this.ref.on('child_removed', (childSnapshot) => {
|
|
165
157
|
that.removed(childSnapshot);
|
|
166
158
|
});
|
|
167
|
-
this.ref.
|
|
159
|
+
this.ref.on('child_added', (childSnapshot) => {
|
|
168
160
|
that.added(childSnapshot);
|
|
169
161
|
});
|
|
170
162
|
|
|
171
|
-
|
|
172
|
-
|
|
173
163
|
setTimeout(() => {
|
|
174
164
|
callback()
|
|
175
165
|
}, 2000);
|
|
176
|
-
// SET AUDIO
|
|
177
|
-
// this.audio = new Audio();
|
|
178
|
-
// this.audio.src = URL_SOUND;
|
|
179
|
-
// this.audio.load();
|
|
180
166
|
}
|
|
181
167
|
|
|
182
168
|
/**
|
|
@@ -316,24 +302,44 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
|
|
|
316
302
|
} else {
|
|
317
303
|
this.logger.log('[FIREBASEConversationsHandlerSERVICE] getConversationDetail ***** ELSE')
|
|
318
304
|
// const urlNodeFirebase = '/apps/' + this.tenant + '/users/' + this.loggedUserId + '/conversations/' + conversationId;
|
|
319
|
-
const urlNodeFirebase = conversationsPathForUserId(this.tenant, this.loggedUserId) + '/' + conversationId;
|
|
305
|
+
const urlNodeFirebase = conversationsPathForUserId(this.tenant, this.loggedUserId) // + '/' + conversationId;
|
|
320
306
|
this.logger.log('[FIREBASEConversationsHandlerSERVICE] conversationDetail urlNodeFirebase *****', urlNodeFirebase)
|
|
321
307
|
const firebaseMessages = firebase.database().ref(urlNodeFirebase);
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
// && childData.uid
|
|
327
|
-
if (childSnapshot && childSnapshot.key && childData) {
|
|
328
|
-
childData.uid = childSnapshot.key;
|
|
329
|
-
const conversation = this.completeConversation(childData);
|
|
330
|
-
if (conversation) {
|
|
331
|
-
callback(conversation)
|
|
332
|
-
} else {
|
|
333
|
-
callback(null)
|
|
334
|
-
}
|
|
308
|
+
if(this.subscribe){
|
|
309
|
+
this.logger.log('[FIREBASEConversationsHandlerSERVICE] getConversationDetail ALREADY SUBSCRIBED')
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
335
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);
|
|
336
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
|
+
// }
|
|
337
343
|
// this.BSConversationDetail.next(conversation);
|
|
338
344
|
});
|
|
339
345
|
}
|
|
@@ -505,7 +511,7 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
|
|
|
505
511
|
* @param conv
|
|
506
512
|
*/
|
|
507
513
|
private completeConversation(conv): ConversationModel {
|
|
508
|
-
conv.selected = false;
|
|
514
|
+
// conv.selected = false;
|
|
509
515
|
if (!conv.sender_fullname || conv.sender_fullname === 'undefined' || conv.sender_fullname.trim() === '') {
|
|
510
516
|
conv.sender_fullname = conv.sender;
|
|
511
517
|
}
|
|
@@ -532,6 +538,15 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
|
|
|
532
538
|
this.translateInfoSupportMessages(conv);
|
|
533
539
|
}
|
|
534
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 */
|
|
549
|
+
|
|
535
550
|
// Fixes the bug: if a snippet of code is pasted and sent it is not displayed correctly in the convesations list
|
|
536
551
|
// conv.time_last_message = this.getTimeLastMessage(conv.timestamp);
|
|
537
552
|
conv.conversation_with = conversation_with;
|
|
@@ -647,3 +662,4 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
|
|
|
647
662
|
// END PRIVATE FUNCTIONS
|
|
648
663
|
// ---------------------------------------------------------- //
|
|
649
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', 'uk']
|
|
114
114
|
|
|
115
115
|
|
|
116
116
|
|
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,14 +0,0 @@
|
|
|
1
|
-
# npm version patch
|
|
2
|
-
version=`node -e 'console.log(require("./package.json").version)'`
|
|
3
|
-
echo "version $version"
|
|
4
|
-
|
|
5
|
-
URL_VER=${version//[.]//}
|
|
6
|
-
echo 'URL_VER: ---->'$URL_VER
|
|
7
|
-
|
|
8
|
-
if [ "$version" != "" ]; then
|
|
9
|
-
git tag -a "$version" -m "`git log -1 --format=%s`"
|
|
10
|
-
echo "Created a new tag, $version"
|
|
11
|
-
git push --tags
|
|
12
|
-
npm publish
|
|
13
|
-
fi
|
|
14
|
-
|