@chat21/chat21-ionic 3.0.103 → 3.0.105-rc1
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 +9 -0
- package/package.json +1 -1
- package/src/app/app.component.ts +18 -13
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +4 -4
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +3 -3
- package/src/app/components/authentication/login/login.component.ts +1 -1
- package/src/app/components/utils/user-presence/user-presence.component.ts +1 -1
- package/src/app/pages/authentication/login/login.page.ts +1 -0
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +16 -15
- package/src/app/pages/conversations-list/conversations-list.page.ts +1 -103
- package/src/assets/js/chat21client.js +7 -4
- package/src/chat21-core/models/conversation.ts +2 -1
- package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +8 -0
- package/src/chat21-core/providers/mqtt/mqtt-presence.service.ts +1 -1
- package/src/chat21-core/utils/convertRequestToConversation.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# chat21-ionic ver 3.0
|
|
2
2
|
|
|
3
|
+
### 3.0.105.rc.1
|
|
4
|
+
- added: get tiledeskToken from tiledesk_token key in favour of appStorageService.getItem('tiledeskToken')
|
|
5
|
+
|
|
6
|
+
### 3.0.104.1 in PROD
|
|
7
|
+
- minor bug fixing
|
|
8
|
+
|
|
9
|
+
### 3.0.104 in PROD
|
|
10
|
+
- bug-fixed: messages are lost after chrome close all websocket connections due to inactivity and mqtt not reconnected automatically
|
|
11
|
+
|
|
3
12
|
### 3.0.103 in PROD
|
|
4
13
|
|
|
5
14
|
### 3.0.103-rc.2
|
package/package.json
CHANGED
package/src/app/app.component.ts
CHANGED
|
@@ -281,11 +281,11 @@ export class AppComponent implements OnInit {
|
|
|
281
281
|
this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN token get with getParameterByName ', token)
|
|
282
282
|
// save token in local storage then
|
|
283
283
|
|
|
284
|
-
const storedToken =
|
|
284
|
+
const storedToken = localStorage.getItem('tiledesk_token')
|
|
285
285
|
this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN storedToken ', storedToken)
|
|
286
286
|
this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN SAVE THE PARAMS TOKEN ', token)
|
|
287
287
|
if (storedToken !== token) {
|
|
288
|
-
|
|
288
|
+
localStorage.setItem('tiledesk_token', token)
|
|
289
289
|
} else {
|
|
290
290
|
this.logger.log('[APP-COMP] ngOnInit AUTOLOGIN the current user already exist DON\'T SAVE ')
|
|
291
291
|
}
|
|
@@ -506,7 +506,7 @@ export class AppComponent implements OnInit {
|
|
|
506
506
|
this.deeplinks.route({'/conversation-detail': ConversationListPage}).subscribe(match => {
|
|
507
507
|
this.logger.log('[APP-COMP] deeplinks match route', JSON.stringify(match.$args))
|
|
508
508
|
if(match.$args && match.$args.jwt){
|
|
509
|
-
|
|
509
|
+
localStorage.setItem('tiledesk_token', decodeURIComponent(match.$args.jwt))
|
|
510
510
|
this.initAuthentication()
|
|
511
511
|
}
|
|
512
512
|
}, (nomatch)=> {
|
|
@@ -697,7 +697,7 @@ export class AppComponent implements OnInit {
|
|
|
697
697
|
/***************************************************+*/
|
|
698
698
|
/**------- AUTHENTICATION FUNCTIONS --> START <--- +*/
|
|
699
699
|
private initAuthentication() {
|
|
700
|
-
const tiledeskToken =
|
|
700
|
+
const tiledeskToken = localStorage.getItem('tiledesk_token')
|
|
701
701
|
|
|
702
702
|
this.logger.log('[APP-COMP] >>> INIT-AUTHENTICATION !!! ')
|
|
703
703
|
this.logger.log('[APP-COMP] >>> initAuthentication tiledeskToken ', tiledeskToken)
|
|
@@ -847,7 +847,7 @@ export class AppComponent implements OnInit {
|
|
|
847
847
|
}
|
|
848
848
|
}
|
|
849
849
|
|
|
850
|
-
private manageTabNotification(sound_type: string, badgeNotificationCount?: number) {
|
|
850
|
+
private manageTabNotification(sound_type: string, canSound: boolean, badgeNotificationCount?: number) {
|
|
851
851
|
if (!this.isTabVisible) {
|
|
852
852
|
// TAB IS HIDDEN --> manage title and SOUND
|
|
853
853
|
let badgeNewConverstionNumber = badgeNotificationCount? badgeNotificationCount : this.conversationsHandlerService.countIsNew()
|
|
@@ -870,8 +870,8 @@ export class AppComponent implements OnInit {
|
|
|
870
870
|
if(sound_status && sound_status !== 'undefined'){
|
|
871
871
|
this.isSoundEnabled = sound_status === 'enabled'? true: false
|
|
872
872
|
}
|
|
873
|
-
this.logger.debug('[APP-COMP] manageTabNotification can saund?',
|
|
874
|
-
if(this.
|
|
873
|
+
this.logger.debug('[APP-COMP] manageTabNotification can saund?', canSound, this.isSoundEnabled, sound_type)
|
|
874
|
+
if(this.isSoundEnabled && canSound) {
|
|
875
875
|
switch(sound_type){
|
|
876
876
|
case 'conv_added': {
|
|
877
877
|
this.soundConversationAdded();
|
|
@@ -997,9 +997,9 @@ export class AppComponent implements OnInit {
|
|
|
997
997
|
this.events.subscribe('unservedRequest:count', this.subscribeUnservedRequestCount)
|
|
998
998
|
this.events.subscribe('convList:onConversationSelected', this.subscribeConversationSelected)
|
|
999
999
|
this.conversationsHandlerService.conversationAdded.subscribe((conversation: ConversationModel) => {
|
|
1000
|
-
|
|
1000
|
+
this.logger.log('[APP-COMP] ***** subscribeConversationAdded *****', conversation);
|
|
1001
1001
|
if (conversation && conversation.is_new === true) {
|
|
1002
|
-
this.manageTabNotification('conv_added')
|
|
1002
|
+
this.manageTabNotification('conv_added', conversation.sound)
|
|
1003
1003
|
}
|
|
1004
1004
|
if(conversation) this.updateConversationsOnStorage()
|
|
1005
1005
|
});
|
|
@@ -1019,7 +1019,7 @@ export class AppComponent implements OnInit {
|
|
|
1019
1019
|
let checkIfStatusChanged = changes.value.is_new === changes.previousValue.is_new? true: false
|
|
1020
1020
|
let checkIfUidChanged = changes.value.uid === changes.previousValue.uid? true: false
|
|
1021
1021
|
if(changes.value.is_new && checkIfStatusChanged && checkIfUidChanged){
|
|
1022
|
-
this.manageTabNotification('new_message');
|
|
1022
|
+
this.manageTabNotification('new_message', true);
|
|
1023
1023
|
}
|
|
1024
1024
|
}
|
|
1025
1025
|
}
|
|
@@ -1195,7 +1195,7 @@ export class AppComponent implements OnInit {
|
|
|
1195
1195
|
if (hasClickedLogout === true) {
|
|
1196
1196
|
this.segmentSignedOut()
|
|
1197
1197
|
this.appStorageService.removeItem('conversations')
|
|
1198
|
-
|
|
1198
|
+
|
|
1199
1199
|
// ----------------------------------------------
|
|
1200
1200
|
// PUSH NOTIFICATIONS
|
|
1201
1201
|
// ----------------------------------------------
|
|
@@ -1223,7 +1223,7 @@ export class AppComponent implements OnInit {
|
|
|
1223
1223
|
if(unservedRequestCount && unservedRequestCount > 0){
|
|
1224
1224
|
this.logger.debug("subscribeUnservedRequestCount appIsInitialized::::",this.isInitialized)
|
|
1225
1225
|
if(this.isInitialized){
|
|
1226
|
-
this.manageTabNotification('conv_unassigned', unservedRequestCount) //sound and alternate title
|
|
1226
|
+
this.manageTabNotification('conv_unassigned', true, unservedRequestCount) //sound and alternate title
|
|
1227
1227
|
}
|
|
1228
1228
|
}
|
|
1229
1229
|
}
|
|
@@ -1284,6 +1284,8 @@ export class AppComponent implements OnInit {
|
|
|
1284
1284
|
this.presenceService.removePresence();
|
|
1285
1285
|
this.tiledeskAuthService.logOut()
|
|
1286
1286
|
this.messagingAuthService.logout()
|
|
1287
|
+
this.isInitialized = false;
|
|
1288
|
+
this.events.publish('appComp:appIsInitialized', false)
|
|
1287
1289
|
}
|
|
1288
1290
|
|
|
1289
1291
|
private initConversationsHandler(userId: string) {
|
|
@@ -1379,10 +1381,13 @@ export class AppComponent implements OnInit {
|
|
|
1379
1381
|
}
|
|
1380
1382
|
|
|
1381
1383
|
private segmentSignIn(){
|
|
1384
|
+
const that = this
|
|
1382
1385
|
let user = this.tiledeskAuthService.getCurrentUser()
|
|
1383
1386
|
if(window['analytics']){
|
|
1384
1387
|
try {
|
|
1385
|
-
window['analytics'].page("Chat Auth Page, Signin", {
|
|
1388
|
+
window['analytics'].page("Chat Auth Page, Signin", {
|
|
1389
|
+
version: that.version
|
|
1390
|
+
});
|
|
1386
1391
|
} catch (err) {
|
|
1387
1392
|
this.logger.error('Event:Signed In [page] error', err);
|
|
1388
1393
|
}
|
|
@@ -117,10 +117,10 @@ export class IonConversationDetailComponent extends ConversationContentComponent
|
|
|
117
117
|
// console.log('[CONVS-DETAIL] translations: ', labels);
|
|
118
118
|
// });
|
|
119
119
|
this.translate.get(['AddAsCannedResponse', 'ViewedPage']).subscribe((text: string) => {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
this.logger.log('[CONVS-DETAIL] AddAsCannedResponse translated: ', text);
|
|
121
|
+
this.addAsCannedResponseTooltipText = text['AddAsCannedResponse']
|
|
122
|
+
this.viewedPageTooltipText = text['ViewedPage']
|
|
123
|
+
})
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
listenToUploadFileProgress() {
|
|
@@ -160,13 +160,13 @@
|
|
|
160
160
|
</ion-note>
|
|
161
161
|
|
|
162
162
|
<ion-buttons slot="end">
|
|
163
|
-
<ion-button *ngIf="!conversation.archived"
|
|
163
|
+
<ion-button *ngIf="!conversation.archived" placement="bottom"
|
|
164
164
|
[ngClass]="{'hide': !isApp, 'button-on-desktop': !isApp, 'button-on-mobile': isApp }"
|
|
165
165
|
id="{{ 'close_conversation_button' + conversation.uid }}" class="close-conversation-button" ion-button clear
|
|
166
166
|
item-end (click)="closeConversation(conversation);$event.stopPropagation();" padding>
|
|
167
167
|
<ion-icon slot="icon-only" style="display:block;" id="{{ 'close_button_icon' + conversation.uid }}" name="archive-outline" item-end></ion-icon>
|
|
168
|
-
<div *ngIf="conversation?.recipient.startsWith('support-group')" tooltip="{{ translationsMap?.get('Resolve')}}"></div>
|
|
169
|
-
<div *ngIf="conversation?.recipient.startsWith('support-group')" tooltip="{{ translationsMap?.get('Archive')}}"></div>
|
|
168
|
+
<!-- <div *ngIf="conversation?.recipient.startsWith('support-group')" tooltip="{{ translationsMap?.get('Resolve')}}"></div>
|
|
169
|
+
<div *ngIf="conversation?.recipient.startsWith('support-group')" tooltip="{{ translationsMap?.get('Archive')}}"></div> -->
|
|
170
170
|
</ion-button>
|
|
171
171
|
|
|
172
172
|
<!-- <ion-button *ngIf="conversation?.recipient.startsWith('support-group') && !conversation.archived" [tooltip]="joinTooltip" [options]="tooltip_options" placement="bottom" content-type="template"
|
|
@@ -137,7 +137,7 @@ export class LoginComponent implements OnInit {
|
|
|
137
137
|
signInWithGoogle(){
|
|
138
138
|
// const url = this.SERVER_BASE_PATH + "auth/google"
|
|
139
139
|
const url = "https://eu.rtmv3.tiledesk.com/api/auth/google" + '?forced_redirect_url=chat://conversation-detail?from=google'
|
|
140
|
-
this.iab.create(url, '_system', '
|
|
140
|
+
this.iab.create(url, '_system', 'location=yes')
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
/** */
|
|
@@ -67,7 +67,7 @@ export class UserPresenceComponent implements OnInit, OnDestroy {
|
|
|
67
67
|
subscribtion = this.subscriptions.find(item => item.key === subscribtionKey);
|
|
68
68
|
if (!subscribtion) {
|
|
69
69
|
subscribtion = this.presenceService.BSIsOnline.subscribe((data: any) => {
|
|
70
|
-
this.logger.log('[USER-PRESENCE-COMP] $subs to BSIsOnline - data ', data);
|
|
70
|
+
// this.logger.log('[USER-PRESENCE-COMP] $subs to BSIsOnline - data ', data);
|
|
71
71
|
if (data) {
|
|
72
72
|
const userId = data.uid;
|
|
73
73
|
const isOnline = data.isOnline;
|
|
@@ -124,6 +124,7 @@ export class LoginPage implements OnInit {
|
|
|
124
124
|
this.tiledeskAuthService.signInWithEmailAndPassword(auth.email, auth.password)
|
|
125
125
|
.then(tiledeskToken => {
|
|
126
126
|
this.messagingAuthService.createCustomToken(tiledeskToken)
|
|
127
|
+
localStorage.setItem('tiledesk_token', tiledeskToken)
|
|
127
128
|
// Here edit stored current user
|
|
128
129
|
// this.updateStoredCurrentUser()
|
|
129
130
|
})
|
|
@@ -325,10 +325,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
325
325
|
// console.log('[CONVS-DETAIL] conversations', conversations);
|
|
326
326
|
this.conversation_count = conversations.length
|
|
327
327
|
if (conv && this.loggedUser && conv.sender !== this.loggedUser.uid) {
|
|
328
|
-
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange
|
|
328
|
+
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange ', conv)
|
|
329
329
|
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange this.loggedUser.uid ', this.loggedUser.uid)
|
|
330
|
-
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange is_new ', conv.is_new)
|
|
331
|
-
this.logger.log('[CONVS-DETAIL] subscribe to BSConversationsChange showButtonToBottom ', this.showButtonToBottom)
|
|
332
330
|
// UPDATE THE CONVERSATION TO 'READ' IF IT IS ME WHO WRITES THE LAST MESSAGE OF THE CONVERSATION
|
|
333
331
|
// AND IF THE POSITION OF THE SCROLL IS AT THE END
|
|
334
332
|
// if (!this.showButtonToBottom && conv.is_new) {
|
|
@@ -748,15 +746,15 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
748
746
|
// .set('buttonHoverBackgroundColor', 'var(--buttonHoverBackgroundColor)')
|
|
749
747
|
// .set('buttonHoverTextColor', 'var(--buttonHoverTextColor)')
|
|
750
748
|
this.styleMap.set('themeColor', '#2a69c1')
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
749
|
+
.set('bubbleReceivedBackground', '#f0f2f7')
|
|
750
|
+
.set('bubbleReceivedTextColor', '#06132b')
|
|
751
|
+
.set('bubbleSentBackground', '#2a6ac1')
|
|
752
|
+
.set('bubbleSentTextColor', '#ffffff')
|
|
753
|
+
.set('buttonFontSize', '15px')
|
|
754
|
+
.set('buttonBackgroundColor', '#ffffff')
|
|
755
|
+
.set('buttonTextColor', '#2a6ac1')
|
|
756
|
+
.set('buttonHoverBackgroundColor', '#2a6ac1')
|
|
757
|
+
.set('buttonHoverTextColor', ' #ffffff')
|
|
760
758
|
|
|
761
759
|
}
|
|
762
760
|
// -------------------------------------------------------------------------------------
|
|
@@ -1116,14 +1114,17 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1116
1114
|
|
|
1117
1115
|
|
|
1118
1116
|
const emailSectionMsg = (attributes && attributes['offline_channel'] === TYPE_MSG_EMAIL)
|
|
1119
|
-
const
|
|
1117
|
+
const channelIsNotEmailOrFormOrWhatsappOrTelegram = (attributes && attributes['request_channel'] && (attributes['request_channel'] === TYPE_MSG_EMAIL ||
|
|
1118
|
+
attributes['request_channel'] === TYPE_MSG_FORM ||
|
|
1119
|
+
attributes['request_channel'] === CHANNEL_TYPE_WHATSAPP ||
|
|
1120
|
+
attributes['request_channel'] === CHANNEL_TYPE_TELEGRAM))
|
|
1120
1121
|
|
|
1121
1122
|
if ((msg && msg.trim() !== '') || type !== TYPE_MSG_TEXT) {
|
|
1122
1123
|
|
|
1123
1124
|
|
|
1124
1125
|
if (this.isEmailEnabled &&
|
|
1125
1126
|
this.leadInfo && this.leadInfo.presence && this.leadInfo.presence['status'] === 'offline' &&
|
|
1126
|
-
this.leadInfo.email && !emailSectionMsg && !
|
|
1127
|
+
this.leadInfo.email && !emailSectionMsg && !channelIsNotEmailOrFormOrWhatsappOrTelegram) {
|
|
1127
1128
|
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE --> SENDING EMAIL', msg, this.leadInfo.email)
|
|
1128
1129
|
let msgText = this.createEmailText(msg)
|
|
1129
1130
|
this.sendEmail(msgText).subscribe(status => {
|
|
@@ -1244,7 +1245,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1244
1245
|
subscription = this.subscriptions.find(item => item.key === subscriptionKey);
|
|
1245
1246
|
if (!subscription) {
|
|
1246
1247
|
subscription = this.presenceService.BSIsOnline.subscribe((data: any) => {
|
|
1247
|
-
this.logger.log('[USER-PRESENCE-COMP] $subs to BSIsOnline - data ', data);
|
|
1248
|
+
// this.logger.log('[USER-PRESENCE-COMP] $subs to BSIsOnline - data ', data);
|
|
1248
1249
|
if (data) {
|
|
1249
1250
|
const userId = data.uid;
|
|
1250
1251
|
const isOnline = data.isOnline;
|
|
@@ -583,7 +583,7 @@ export class ConversationListPage implements OnInit {
|
|
|
583
583
|
if (conversation) {
|
|
584
584
|
this.onImageLoaded(conversation)
|
|
585
585
|
this.onConversationLoaded(conversation)
|
|
586
|
-
conversation.is_new && this.isInitialized? this.segmentNewConversationAdded(conversation) : null;
|
|
586
|
+
// conversation.is_new && this.isInitialized? this.segmentNewConversationAdded(conversation) : null;
|
|
587
587
|
}
|
|
588
588
|
})
|
|
589
589
|
|
|
@@ -852,9 +852,6 @@ export class ConversationListPage implements OnInit {
|
|
|
852
852
|
conversation.attributes.project_name = project['name']
|
|
853
853
|
}
|
|
854
854
|
}
|
|
855
|
-
// if(conversation.conversation_with_fullname === 'Guest '){
|
|
856
|
-
// conversation.conversation_with_fullname = 'guest' + '#' + this.getUUidConversation(conversation.uid)
|
|
857
|
-
// }
|
|
858
855
|
|
|
859
856
|
}
|
|
860
857
|
|
|
@@ -1142,103 +1139,4 @@ export class ConversationListPage implements OnInit {
|
|
|
1142
1139
|
}
|
|
1143
1140
|
}
|
|
1144
1141
|
|
|
1145
|
-
// ------------------------------------------------------------------
|
|
1146
|
-
// !!! Not used methods !!!
|
|
1147
|
-
// ------------------------------------------------------------------
|
|
1148
|
-
|
|
1149
|
-
// /**
|
|
1150
|
-
// * ::: openArchivedConversationsPage :::
|
|
1151
|
-
// * Open the archived conversations page
|
|
1152
|
-
// * (metodo richiamato da html)
|
|
1153
|
-
// */
|
|
1154
|
-
// openArchivedConversationsPage() {
|
|
1155
|
-
// this.logger.log('[CONVS-LIST-PAGE] openArchivedConversationsPage');
|
|
1156
|
-
// }
|
|
1157
|
-
|
|
1158
|
-
// // info page
|
|
1159
|
-
// returnCloseInfoPage() {
|
|
1160
|
-
// this.logger.log('[CONVS-LIST-PAGE] returnCloseInfoPage');
|
|
1161
|
-
// // this.isShowMenuPage = false;
|
|
1162
|
-
// this.initialize();
|
|
1163
|
-
|
|
1164
|
-
// }
|
|
1165
|
-
|
|
1166
|
-
// private navigatePage() {
|
|
1167
|
-
// this.logger.log('[CONVS-LIST-PAGE] navigatePage:: >>>> conversationSelected ', this.conversationSelected);
|
|
1168
|
-
// let urlPage = 'detail/';
|
|
1169
|
-
// if (this.conversationSelected) {
|
|
1170
|
-
// // urlPage = 'conversation-detail/' + this.uidConvSelected;
|
|
1171
|
-
// urlPage = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname;
|
|
1172
|
-
// // this.openDetailsWithState(this.conversationSelected);
|
|
1173
|
-
// }
|
|
1174
|
-
// // else {
|
|
1175
|
-
// // this.router.navigateByUrl('detail');
|
|
1176
|
-
// // }
|
|
1177
|
-
|
|
1178
|
-
// const navigationExtras: NavigationExtras = {
|
|
1179
|
-
// state: {
|
|
1180
|
-
// conversationSelected: this.conversationSelected
|
|
1181
|
-
// }
|
|
1182
|
-
// };
|
|
1183
|
-
// this.navService.openPage(urlPage, ConversationDetailPage, navigationExtras);
|
|
1184
|
-
// }
|
|
1185
|
-
|
|
1186
|
-
// openDetailsWithState(conversationSelected) {
|
|
1187
|
-
// console.log('openDetailsWithState:: >>>> conversationSelected ', conversationSelected);
|
|
1188
|
-
// let navigationExtras: NavigationExtras = {
|
|
1189
|
-
// state: {
|
|
1190
|
-
// conversationSelected: conversationSelected
|
|
1191
|
-
// }
|
|
1192
|
-
// };
|
|
1193
|
-
// this.router.navigate(['conversation-detail/' + this.uidConvSelected], navigationExtras);
|
|
1194
|
-
// }
|
|
1195
|
-
|
|
1196
|
-
// /**
|
|
1197
|
-
// * ::: subscribeLoggedUserLogin :::
|
|
1198
|
-
// * effettuato il login:
|
|
1199
|
-
// * 1 - imposto loggedUser
|
|
1200
|
-
// * 2 - dismetto modale
|
|
1201
|
-
// * 3 - inizializzo elenco conversazioni
|
|
1202
|
-
// */
|
|
1203
|
-
// subscribeLoggedUserLogin = (user: any) => {
|
|
1204
|
-
// console.log('3 ************** subscribeLoggedUserLogin', user);
|
|
1205
|
-
// this.loggedUser = user;
|
|
1206
|
-
// try {
|
|
1207
|
-
// closeModal(this.modalController);
|
|
1208
|
-
// } catch (err) {
|
|
1209
|
-
// console.error('-> error:', err);
|
|
1210
|
-
// }
|
|
1211
|
-
// this.initialize();
|
|
1212
|
-
// }
|
|
1213
|
-
|
|
1214
|
-
/**
|
|
1215
|
-
* ::: conversationsChanged :::
|
|
1216
|
-
* evento richiamato su add, change, remove dell'elenco delle conversazioni
|
|
1217
|
-
* 1 - aggiorno elenco conversazioni
|
|
1218
|
-
* 2 - aggiorno il conto delle nuove conversazioni
|
|
1219
|
-
* 4 - se esiste un uidReciverFromUrl (passato nell'url)
|
|
1220
|
-
* e se esiste una conversazione con lo stesso id di uidReciverFromUrl
|
|
1221
|
-
* imposto questa come conversazione attiva (operazione da fare una sola volta al caricamento delle conversazioni)
|
|
1222
|
-
* e la carico nella pagina di dettaglio e azzero la variabile uidReciverFromUrl!!!
|
|
1223
|
-
* 5 - altrimenti se esiste una conversazione con lo stesso id della conversazione attiva
|
|
1224
|
-
* e la pagina di dettaglio è vuota (placeholder), carico la conversazione attiva (uidConvSelected) nella pagina di dettaglio
|
|
1225
|
-
* (operazione da fare una sola volta al caricamento delle conversazioni)
|
|
1226
|
-
*/
|
|
1227
|
-
|
|
1228
|
-
// ------------------------------------------------------------------------------------
|
|
1229
|
-
// ::: readAllMessages ::: ??????????? SEEMS NOT USED ?????????????????
|
|
1230
|
-
// when all chat messages are displayed,
|
|
1231
|
-
// that is when in the conversation detail I go to the bottom of the page,
|
|
1232
|
-
// the readAllMessages event is triggered and is intercepted in the conversation list
|
|
1233
|
-
// and modify the current conversation by bringing is_new to false
|
|
1234
|
-
// ------------------------------------------------------------------------------------
|
|
1235
|
-
// readAllMessages = (uid: string) => {
|
|
1236
|
-
// this.logger.log('[CONVS-LIST-PAGE] readAllMessages', uid);
|
|
1237
|
-
// const conversationSelected = this.conversations.find(item => item.uid === this.uidConvSelected);
|
|
1238
|
-
// if (conversationSelected) {
|
|
1239
|
-
// conversationSelected.is_new = false;
|
|
1240
|
-
// conversationSelected.status = '0';
|
|
1241
|
-
// conversationSelected.selected = true;
|
|
1242
|
-
// }
|
|
1243
|
-
// }
|
|
1244
1142
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Chat21Client
|
|
3
3
|
|
|
4
|
-
v0.1.12.
|
|
4
|
+
v0.1.12.7
|
|
5
5
|
|
|
6
6
|
@Author Andrea Sponziello
|
|
7
7
|
@Member Gabriele Panico
|
|
@@ -24,7 +24,6 @@ class Chat21Client {
|
|
|
24
24
|
this.reconnections = 0 // just to check how many reconnections
|
|
25
25
|
this.client_id = this.uuidv4();
|
|
26
26
|
this.log = options.log ? true : false;
|
|
27
|
-
|
|
28
27
|
if (options && options.MQTTendpoint) {
|
|
29
28
|
if (options.MQTTendpoint.startsWith('/')) {
|
|
30
29
|
if (this.log) {
|
|
@@ -545,7 +544,7 @@ class Chat21Client {
|
|
|
545
544
|
if (this.log) {
|
|
546
545
|
console.log("this.on_message_handler already subscribed. Reconnected num", this.reconnections)
|
|
547
546
|
}
|
|
548
|
-
|
|
547
|
+
subscribedCallback();
|
|
549
548
|
return
|
|
550
549
|
}
|
|
551
550
|
this.subscribeToMyConversations(() => {
|
|
@@ -999,7 +998,10 @@ class Chat21Client {
|
|
|
999
998
|
|
|
1000
999
|
this.client.on('connect', // TODO if token is wrong it must reply with an error!
|
|
1001
1000
|
() => {
|
|
1002
|
-
if (this.log) {
|
|
1001
|
+
if (this.log) {
|
|
1002
|
+
console.log("Chat client connected. User:" + user_id)
|
|
1003
|
+
console.log("Chat client connected. this.connected:" + this.connected)
|
|
1004
|
+
}
|
|
1003
1005
|
if (!this.connected) {
|
|
1004
1006
|
if (this.log) {console.log("Chat client first connection for:" + user_id)}
|
|
1005
1007
|
this.connected = true
|
|
@@ -1026,6 +1028,7 @@ class Chat21Client {
|
|
|
1026
1028
|
);
|
|
1027
1029
|
this.client.on('close',
|
|
1028
1030
|
() => {
|
|
1031
|
+
this.connected = false
|
|
1029
1032
|
if (this.log) {console.log("Chat client close event");}
|
|
1030
1033
|
}
|
|
1031
1034
|
);
|
|
@@ -153,6 +153,7 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
153
153
|
this.logger.debug('[MQTTConversationsHandler] connecting MQTT conversations handler');
|
|
154
154
|
const handlerConversationAdded = this.chat21Service.chatClient.onConversationAdded( (conv) => {
|
|
155
155
|
let conversation = this.completeConversation(conv); // needed to get the "conversation_with", and find the conv in the conv-history
|
|
156
|
+
conversation.sound = true
|
|
156
157
|
this.logger.log("onConversationAdded completed:",conversation);
|
|
157
158
|
const index = this.searchIndexInArrayForConversationWith(this.conversations, conversation.conversation_with);
|
|
158
159
|
if (index > -1) {
|
|
@@ -165,6 +166,7 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
165
166
|
}
|
|
166
167
|
});
|
|
167
168
|
const handlerConversationUpdated = this.chat21Service.chatClient.onConversationUpdated( (conv, topic) => {
|
|
169
|
+
conv.sound = true;
|
|
168
170
|
this.logger.debug('[MQTTConversationsHandler] conversation updated:', JSON.stringify(conv));
|
|
169
171
|
this.changed(conv);
|
|
170
172
|
});
|
|
@@ -187,6 +189,7 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
187
189
|
this.logger.debug('[MQTTConversationsHandler] Last conversations', conversations, 'err', err);
|
|
188
190
|
if (!err) {
|
|
189
191
|
conversations.forEach(conv => {
|
|
192
|
+
conv.sound = false;
|
|
190
193
|
this.added(conv);
|
|
191
194
|
});
|
|
192
195
|
loaded();
|
|
@@ -320,6 +323,11 @@ export class MQTTConversationsHandler extends ConversationsHandlerService {
|
|
|
320
323
|
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
321
324
|
conv.type = snap[k];
|
|
322
325
|
}
|
|
326
|
+
if (k === 'conversation_with_fullname') {
|
|
327
|
+
// this.logger.debug('[MQTTConversationsHandler] aggiorno key:' + k);
|
|
328
|
+
conv.conversation_with_fullname = snap[k];
|
|
329
|
+
}
|
|
330
|
+
conv = this.completeConversation(conv)
|
|
323
331
|
});
|
|
324
332
|
}
|
|
325
333
|
|
|
@@ -45,7 +45,7 @@ export class MQTTPresenceService extends PresenceService {
|
|
|
45
45
|
const that = this;
|
|
46
46
|
let local_BSIsOnline = new BehaviorSubject<any>(null);
|
|
47
47
|
this.webSocketService.wsRequesterStatus$.subscribe((data: any) => {
|
|
48
|
-
this.logger.log('[NATIVEPresenceSERVICE] $subs to wsService - data ', data, userid);
|
|
48
|
+
// this.logger.log('[NATIVEPresenceSERVICE] $subs to wsService - data ', data, userid);
|
|
49
49
|
if (data && data.presence && data.presence.status === 'online' ) {
|
|
50
50
|
that.BSIsOnline.next({ uid: data.uuid_user, isOnline: true });
|
|
51
51
|
local_BSIsOnline.next({ uid: data.uuid_user, isOnline: true });
|