@chat21/chat21-ionic 3.0.91 → 3.0.92-rc.1
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 +11 -0
- package/package.json +1 -1
- package/src/app/app.component.ts +11 -5
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.html +1 -1
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.ts +1 -0
- package/src/app/components/contacts-directory/contacts-directory.component.html +2 -2
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +1 -1
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +27 -22
- package/src/app/components/project-item/project-item.component.ts +1 -1
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +8 -7
- package/src/app/pages/conversations-list/conversations-list.page.ts +1 -1
- package/src/app/services/contacts/contacts.service.ts +0 -6
- package/src/app/services/tiledesk/tiledesk.service.ts +5 -9
- package/src/app/services/websocket/websocket.service.ts +55 -4
- package/src/chat-config-native-prod.json +1 -1
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +4 -31
- package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +3 -29
- package/src/chat21-core/utils/utils-message.ts +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# chat21-ionic ver 3.0
|
|
2
2
|
|
|
3
|
+
### 3.0.92-rc.1
|
|
4
|
+
- added: limit parameter to message-attachment component
|
|
5
|
+
- added: listen to new event related to user presence
|
|
6
|
+
- changed: message-text-area icons
|
|
7
|
+
- changed: moved isSender function from service to utils-message
|
|
8
|
+
- changed: unsubscribe from unserved request directly using wsService and not with wsSocketJs
|
|
9
|
+
- bug-fixed: if user is offline and implicit email is sent, not show flash icon to indicate offline_msg
|
|
10
|
+
- bug-fixed: conversation list not show projectName (cannot set properties of undefined reading 'projectId')
|
|
11
|
+
- bug-fixed: msg.text is undefined while reading trim()
|
|
12
|
+
- removed: user status from contact-directory
|
|
13
|
+
|
|
3
14
|
### 3.0.91 in PROD
|
|
4
15
|
|
|
5
16
|
### 3.0.91-rc.1
|
package/package.json
CHANGED
package/src/app/app.component.ts
CHANGED
|
@@ -374,6 +374,12 @@ export class AppComponent implements OnInit {
|
|
|
374
374
|
this.presentToastJoinComplete(event.data.text)
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
|
+
|
|
378
|
+
if (event && event.data && event.data.action && event.data.parameter) {
|
|
379
|
+
if (event.data.action === "presenceUser") {
|
|
380
|
+
this.events.publish('presenceUser', event.data.parameter)
|
|
381
|
+
}
|
|
382
|
+
}
|
|
377
383
|
})
|
|
378
384
|
}
|
|
379
385
|
|
|
@@ -751,11 +757,11 @@ export class AppComponent implements OnInit {
|
|
|
751
757
|
this.IS_ONLINE = false;
|
|
752
758
|
// clearTimeout(this.timeModalLogin);
|
|
753
759
|
// this.timeModalLogin = setTimeout(() => {
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
this.goToDashboardLogin()
|
|
760
|
+
if (!this.hadBeenCalledOpenModal) {
|
|
761
|
+
this.authModal = this.presentModal('initAuthentication');
|
|
762
|
+
this.hadBeenCalledOpenModal = true;
|
|
763
|
+
}
|
|
764
|
+
// this.goToDashboardLogin()
|
|
759
765
|
// }, 1000);
|
|
760
766
|
}
|
|
761
767
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div id="buttons-in-message">
|
|
2
2
|
|
|
3
|
-
<span *ngFor="let button of buttons" class="div-button">
|
|
3
|
+
<span *ngFor="let button of buttons | slice:0:limit" class="div-button">
|
|
4
4
|
|
|
5
5
|
<chat-text-button-attachment *ngIf="button.type === 'text' && isLastMessage === true" class="div-button"
|
|
6
6
|
[button]="button"
|
|
@@ -15,6 +15,7 @@ export class MessageAttachmentComponent implements OnInit {
|
|
|
15
15
|
@Input() isConversationArchived: boolean;
|
|
16
16
|
@Input() isLastMessage: boolean;
|
|
17
17
|
@Input() fullscreenMode: boolean;
|
|
18
|
+
@Input() limit: number;
|
|
18
19
|
@Input() stylesMap: Map<string, string>;
|
|
19
20
|
@Output() onAttachmentButtonClicked = new EventEmitter<any>();
|
|
20
21
|
@Output() onElementRendered = new EventEmitter<{element: string, status: boolean}>()
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
<div #avatarPlaceholder class="avatar-placeholder" [ngStyle]="{'background': 'linear-gradient(rgb(255,255,255) -125%,' + user.color + ')'}" [innerHTML]="user.avatar"></div>
|
|
9
9
|
<div *ngIf="user.imageurl" #avatarImage class="avatar-profile" [style.background-image]="'url(' + user.imageurl + ')'"></div>
|
|
10
10
|
<!-- <div *ngIf="getImageAvatar(conversation.sender)" #avatarImage class="avatar-profile" [style.background-image]="'url(' + getImageAvatar(conversation.sender) + ')'"></div> -->
|
|
11
|
-
<div class="user-presence">
|
|
11
|
+
<!-- <div class="user-presence">
|
|
12
12
|
<app-presence
|
|
13
13
|
[isOnline]="user.online">
|
|
14
14
|
</app-presence>
|
|
15
|
-
</div>
|
|
15
|
+
</div> -->
|
|
16
16
|
</ion-avatar>
|
|
17
17
|
|
|
18
18
|
<ion-label>
|
package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
|
|
32
32
|
<!-- CANNED RESPONSES -->
|
|
33
33
|
<ng-container *ngIf="areVisibleCAR && supportMode">
|
|
34
|
-
<div class="canned-responses-btn-wpr"
|
|
34
|
+
<div class="canned-responses-btn-wpr"
|
|
35
35
|
tooltip="{{translationMap?.get('CANNED_RESPONSES')}}" [options]="tooltipOptions" placement="top">
|
|
36
36
|
<ion-button ion-button fill="clear" class="canned-responses-btn" (click)="openCannedResponses()"
|
|
37
37
|
[disabled]="!conversationWith?.startsWith(TYPE_SUPPORT_GROUP) || disableTextarea">
|
package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss
CHANGED
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
}
|
|
74
74
|
.buttons-left {
|
|
75
75
|
position: absolute;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
width: 30px;
|
|
79
|
-
height: 100%;
|
|
76
|
+
top: 2px;
|
|
77
|
+
right: 0;
|
|
78
|
+
// width: 30px;
|
|
79
|
+
// height: 100%;
|
|
80
80
|
.attach-button {
|
|
81
81
|
font-size: 24px;
|
|
82
82
|
position: absolute;
|
|
@@ -90,21 +90,25 @@
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
.buttons-right {
|
|
93
|
+
display: flex;
|
|
93
94
|
position: absolute;
|
|
94
|
-
|
|
95
|
+
top: 2px;
|
|
95
96
|
right: 0;
|
|
96
|
-
width: 30px;
|
|
97
|
-
height: 100%;
|
|
97
|
+
// width: 30px;
|
|
98
|
+
// height: 100%;
|
|
98
99
|
.send-button {
|
|
99
100
|
font-size: 12px;
|
|
100
|
-
position: absolute;
|
|
101
|
-
bottom: 0px;
|
|
102
|
-
left: 0px;
|
|
103
|
-
margin: 2px 0;
|
|
101
|
+
// position: absolute;
|
|
102
|
+
// bottom: 0px;
|
|
103
|
+
// left: 0px;
|
|
104
|
+
// margin: 2px 0;
|
|
104
105
|
--padding-top: 0;
|
|
105
106
|
--padding-bottom: 0;
|
|
106
107
|
--padding-start: 0;
|
|
107
108
|
--padding-end: 0;
|
|
109
|
+
--border-radius: 50%;
|
|
110
|
+
width: 30px;
|
|
111
|
+
height: 30px
|
|
108
112
|
}
|
|
109
113
|
}
|
|
110
114
|
.text-message {
|
|
@@ -172,29 +176,30 @@
|
|
|
172
176
|
--padding-bottom: 0px;
|
|
173
177
|
--padding-top: 0px;
|
|
174
178
|
--border-radius: 50%;
|
|
175
|
-
--padding-end:
|
|
176
|
-
--padding-start:
|
|
177
|
-
height:
|
|
179
|
+
--padding-end: 0px;
|
|
180
|
+
--padding-start: 0px;
|
|
181
|
+
height: 30px !important;
|
|
182
|
+
width: 30px;
|
|
178
183
|
}
|
|
179
184
|
|
|
180
185
|
.canned-responses-btn {
|
|
181
186
|
--padding-bottom: 0px;
|
|
182
187
|
--padding-top: 0px;
|
|
183
188
|
--border-radius: 50%;
|
|
184
|
-
--padding-end:
|
|
185
|
-
--padding-start:
|
|
186
|
-
height:
|
|
187
|
-
width:
|
|
189
|
+
--padding-end: 0px;
|
|
190
|
+
--padding-start: 0px;
|
|
191
|
+
height: 30px !important;
|
|
192
|
+
width: 30px;
|
|
188
193
|
}
|
|
189
194
|
|
|
190
195
|
.emoji-picker-btn {
|
|
191
196
|
--padding-bottom: 0px;
|
|
192
197
|
--padding-top: 0px;
|
|
193
198
|
--border-radius: 50%;
|
|
194
|
-
--padding-end:
|
|
195
|
-
--padding-start:
|
|
196
|
-
height:
|
|
197
|
-
width:
|
|
199
|
+
--padding-end: 0px;
|
|
200
|
+
--padding-start: 0px;
|
|
201
|
+
height: 30px !important;
|
|
202
|
+
width: 30px;
|
|
198
203
|
}
|
|
199
204
|
|
|
200
205
|
.no-canned-responses-btn-badge {
|
|
@@ -122,7 +122,7 @@ export class ProjectItemComponent implements OnInit {
|
|
|
122
122
|
if (event.data === 'hasChangedProject') {
|
|
123
123
|
this.unservedRequestCount = 0;
|
|
124
124
|
if (this.project) {
|
|
125
|
-
this.
|
|
125
|
+
this.wsService.unsubscribeToWsConversations(this.project.id_project._id)
|
|
126
126
|
}
|
|
127
127
|
this.getLastProjectStoredAndSubscToWSAvailabilityAndConversations();
|
|
128
128
|
}
|
|
@@ -809,7 +809,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
809
809
|
conversation.attributes.project_name = project['name']
|
|
810
810
|
}
|
|
811
811
|
|
|
812
|
-
}else {
|
|
812
|
+
}else if(conversation.attributes) {
|
|
813
813
|
const projectId = getProjectIdSelectedConversation(this.conversationWith)
|
|
814
814
|
let project = localStorage.getItem(projectId)
|
|
815
815
|
if(project){
|
|
@@ -909,15 +909,16 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
909
909
|
|
|
910
910
|
|
|
911
911
|
getLeadDetail(){
|
|
912
|
+
const that = this;
|
|
912
913
|
if(this.channelType !== TYPE_DIRECT){
|
|
913
914
|
const tiledeskToken= this.tiledeskAuthService.getTiledeskToken();
|
|
914
915
|
const projectId = getProjectIdSelectedConversation(this.conversationWith)
|
|
915
916
|
this.logger.debug('[CONVS-DETAIL] getLeadDetail - section ', projectId)
|
|
916
917
|
this.tiledeskService.getRequest(this.conversationWith, projectId, tiledeskToken).subscribe((request: any)=>{
|
|
917
|
-
|
|
918
|
+
that.logger.debug('[CONVS-DETAIL] getLeadDetail - selected REQUEST detail', request)
|
|
918
919
|
if(request.lead && request.lead.email){
|
|
919
|
-
|
|
920
|
-
|
|
920
|
+
that.leadInfo = {lead_id: request.lead.lead_id, hasEmail: true, email: request.lead.email, projectId: projectId}
|
|
921
|
+
that.presenceService.userIsOnline(projectId);
|
|
921
922
|
}
|
|
922
923
|
}, (error)=>{
|
|
923
924
|
this.logger.error('[CONVS-DETAIL] - getLeadDetail - GET REQUEST DETAIL - ERROR ', error)
|
|
@@ -980,6 +981,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
980
981
|
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE - MSG: ', msg)
|
|
981
982
|
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE - type: ', type)
|
|
982
983
|
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE - metadata: ', metadata)
|
|
984
|
+
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE - additional_attributes: ', additional_attributes)
|
|
983
985
|
let fullname = this.loggedUser.uid
|
|
984
986
|
if (this.loggedUser.fullname) {
|
|
985
987
|
fullname = this.loggedUser.fullname
|
|
@@ -998,7 +1000,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
998
1000
|
attributes[key] = value
|
|
999
1001
|
}
|
|
1000
1002
|
}
|
|
1001
|
-
|
|
1002
1003
|
// || type === 'image'
|
|
1003
1004
|
if (type === 'file') {
|
|
1004
1005
|
if (msg) {
|
|
@@ -1016,11 +1017,11 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1016
1017
|
}
|
|
1017
1018
|
|
|
1018
1019
|
metadata ? (metadata = metadata) : (metadata = '')
|
|
1020
|
+
const emailSectionMsg = (attributes && attributes['channel']===TYPE_MSG_EMAIL)
|
|
1019
1021
|
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE msg: ', msg, ' - messages: ', this.messages, ' - loggedUser: ', this.loggedUser)
|
|
1020
1022
|
|
|
1021
1023
|
if ((msg && msg.trim() !== '') || type !== TYPE_MSG_TEXT) {
|
|
1022
|
-
|
|
1023
|
-
if(this.isEmailEnabled && !this.leadIsOnline && this.leadInfo && this.leadInfo.email){
|
|
1024
|
+
if(this.isEmailEnabled && !this.leadIsOnline && this.leadInfo && this.leadInfo.email && !emailSectionMsg){
|
|
1024
1025
|
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE --> SENDING EMAIL', msg, this.leadInfo.email)
|
|
1025
1026
|
this.sendEmail(msg).subscribe(status => {
|
|
1026
1027
|
if(status){
|
|
@@ -761,7 +761,7 @@ export class ConversationListPage implements OnInit {
|
|
|
761
761
|
project = JSON.parse(project)
|
|
762
762
|
conversation.attributes.project_name = project['name']
|
|
763
763
|
}
|
|
764
|
-
}else{
|
|
764
|
+
}else if(conversation.attributes){
|
|
765
765
|
const projectId = getProjectIdSelectedConversation(conversation.uid)
|
|
766
766
|
let project = localStorage.getItem(projectId)
|
|
767
767
|
if(project){
|
|
@@ -28,19 +28,13 @@ export class ContactsService {
|
|
|
28
28
|
// private
|
|
29
29
|
private urlRemoteContacts: string;
|
|
30
30
|
private contacts: UserModel[];
|
|
31
|
-
private FIREBASESTORAGE_BASE_URL_IMAGE: string;
|
|
32
|
-
private urlStorageBucket: string;
|
|
33
31
|
private logger: LoggerService = LoggerInstance.getInstance();
|
|
34
32
|
|
|
35
33
|
constructor(
|
|
36
34
|
public http: HttpClient,
|
|
37
35
|
public appConfigProvider: AppConfigProvider
|
|
38
36
|
) {
|
|
39
|
-
|
|
40
37
|
this.urlRemoteContacts = appConfigProvider.getConfig().apiUrl + 'chat21/contacts';
|
|
41
|
-
this.FIREBASESTORAGE_BASE_URL_IMAGE = appConfigProvider.getConfig().baseImageUrl;
|
|
42
|
-
this.urlStorageBucket = appConfigProvider.getConfig().firebaseConfig.storageBucket + '/o/profiles%2F';
|
|
43
|
-
|
|
44
38
|
}
|
|
45
39
|
|
|
46
40
|
|
|
@@ -51,7 +51,7 @@ export class TiledeskService {
|
|
|
51
51
|
}))
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
// ---------------------------------------------
|
|
55
55
|
// @ GET request by id
|
|
56
56
|
// ---------------------------------------------
|
|
57
57
|
public getRequest(request_id: string, project_id: string, token: string) {
|
|
@@ -241,7 +241,7 @@ export class TiledeskService {
|
|
|
241
241
|
}))
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
|
|
244
|
+
// -----------------------------------------------------------------------------------------
|
|
245
245
|
// @ Create ticket
|
|
246
246
|
// -----------------------------------------------------------------------------------------
|
|
247
247
|
public createInternalRequest(requester_id: string, request_id: string, subject: string, message: string, departmentid: string, participantid: string, ticketpriority: string, project_id: string, token: string) {
|
|
@@ -272,6 +272,9 @@ export class TiledeskService {
|
|
|
272
272
|
}))
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
+
// -----------------------------------------------------------------------------------------
|
|
276
|
+
// @ Send Email
|
|
277
|
+
// -----------------------------------------------------------------------------------------
|
|
275
278
|
public sendEmail(token: string, projectid: string, form: { to: string, subject: string, text: string, request_id: string}) {
|
|
276
279
|
|
|
277
280
|
const httpOptions = {
|
|
@@ -292,11 +295,4 @@ export class TiledeskService {
|
|
|
292
295
|
}))
|
|
293
296
|
}
|
|
294
297
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
// .post(url, JSON.stringify(body), options)
|
|
300
|
-
// .map((res) => res.json());
|
|
301
|
-
|
|
302
298
|
}
|
|
@@ -12,11 +12,12 @@ import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance'
|
|
|
12
12
|
})
|
|
13
13
|
export class WebsocketService {
|
|
14
14
|
private apiUrl: string;
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
|
|
17
16
|
wsService: WebSocketJs;
|
|
18
17
|
wsRequestsList: any;
|
|
19
18
|
public wsRequestsList$: BehaviorSubject<any[]> = new BehaviorSubject<any[]>([]);
|
|
19
|
+
public currentProjectUserAvailability$: BehaviorSubject<[]> = new BehaviorSubject<[]>([])
|
|
20
|
+
public wsRequesterStatus$: BehaviorSubject<any> = new BehaviorSubject<any>({});
|
|
20
21
|
|
|
21
22
|
private logger: LoggerService = LoggerInstance.getInstance();
|
|
22
23
|
|
|
@@ -32,9 +33,9 @@ export class WebsocketService {
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
|
|
35
|
-
subscriptionToWsCurrentProjectUserAvailability(
|
|
36
|
+
subscriptionToWsCurrentProjectUserAvailability(project_id, prjctuserid) {
|
|
36
37
|
var self = this;
|
|
37
|
-
const path = '/' +
|
|
38
|
+
const path = '/' + project_id + '/project_users/' + prjctuserid
|
|
38
39
|
// console.log('[WS-SERV] - SUBSCR (REF) TO WS CURRENT USERS PATH: ', path);
|
|
39
40
|
|
|
40
41
|
return new Promise(function (resolve, reject) {
|
|
@@ -293,4 +294,54 @@ export class WebsocketService {
|
|
|
293
294
|
}
|
|
294
295
|
|
|
295
296
|
|
|
297
|
+
// -----------------------------------------------
|
|
298
|
+
// @ Subscribe to Requester Presence
|
|
299
|
+
// -----------------------------------------------
|
|
300
|
+
subscribeToWS_RequesterPresence(project_id, requesterid) {
|
|
301
|
+
var self = this;
|
|
302
|
+
|
|
303
|
+
const path = '/' + project_id + '/project_users/users/' + requesterid;
|
|
304
|
+
|
|
305
|
+
this.logger.log("[WS-REQUESTS-SERV] - SUBSCRIBE TO REQUESTER-PRECENCE PATH ", path);
|
|
306
|
+
|
|
307
|
+
this.webSocketJs.ref(path, 'subscribeToWS_RequesterPresence',
|
|
308
|
+
|
|
309
|
+
function (data, notification) {
|
|
310
|
+
// self.logger.log("[WS-REQUESTS-SERV] - SUBSCRIBE TO REQUESTER-PRECENCE - CREATE data ", data);
|
|
311
|
+
|
|
312
|
+
self.wsRequesterStatus$.next(data);
|
|
313
|
+
|
|
314
|
+
}, function (data, notification) {
|
|
315
|
+
self.logger.log("[WS-REQUESTS-SERV] - SUBSCRIBE TO REQUESTER-PRECENCE - UPDATE data ", data);
|
|
316
|
+
|
|
317
|
+
self.wsRequesterStatus$.next(data);
|
|
318
|
+
|
|
319
|
+
}, function (data, notification) {
|
|
320
|
+
|
|
321
|
+
if (data) {
|
|
322
|
+
// self.logger.log("[WS-REQUESTS-SERV] - SUBSCRIBE TO REQUESTER-PRECENCE - ON-DATA data ", data);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// -----------------------------------------------
|
|
329
|
+
// @ Un-Subscribe to Requester Presence
|
|
330
|
+
// -----------------------------------------------
|
|
331
|
+
unsubscribeToWS_RequesterPresence(project_id, requesterid) {
|
|
332
|
+
const path = '/' + project_id + '/project_users/users/' + requesterid;
|
|
333
|
+
this.logger.log("[WS-REQUESTS-SERV] - UNSUBSCRIBE TO REQUESTER-PRECENCE PATH", path);
|
|
334
|
+
this.webSocketJs.unsubscribe(path);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// -----------------------------------------------
|
|
338
|
+
// @ Un-Subscribe to Requests
|
|
339
|
+
// -----------------------------------------------
|
|
340
|
+
unsubscribeToWsConversations(project_id){
|
|
341
|
+
const path = '/' + project_id + '/requests';
|
|
342
|
+
this.logger.log("[WS-REQUESTS-SERV] - UNSUBSCRIBE TO REQUESTS PATH", path);
|
|
343
|
+
this.webSocketJs.unsubscribe(path);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
|
|
296
347
|
}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"apiUrl": "https://api.tiledesk.com/v3/",
|
|
25
25
|
"baseImageUrl": "https://eu.rtmv3.tiledesk.com/api/",
|
|
26
|
-
"dashboardUrl": "https://
|
|
26
|
+
"dashboardUrl": "https://panel.tiledesk.com/v3/dashboard/",
|
|
27
27
|
"testsiteBaseUrl": "https://widget.tiledesk.com/v6/assets/twp/index.html",
|
|
28
28
|
"wsUrl": "wss://eu.rtmv3.tiledesk.com/api/",
|
|
29
29
|
"logLevel": "debug",
|
|
@@ -22,7 +22,7 @@ import { MSG_STATUS_RECEIVED, CHAT_REOPENED, CHAT_CLOSED, MEMBER_JOINED_GROUP, T
|
|
|
22
22
|
import { compareValues, searchIndexInArrayForUid, conversationMessagesRef } from '../../utils/utils';
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
import { messageType, isEmojii } from 'src/chat21-core/utils/utils-message';
|
|
25
|
+
import { messageType, isEmojii, isSender } from 'src/chat21-core/utils/utils-message';
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
@@ -312,7 +312,7 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
|
|
|
312
312
|
// }
|
|
313
313
|
|
|
314
314
|
// verifico che il sender è il logged user
|
|
315
|
-
msg.isSender =
|
|
315
|
+
msg.isSender = isSender(msg.sender, this.loggedUser.uid);
|
|
316
316
|
|
|
317
317
|
//check if message contains only an emojii
|
|
318
318
|
// msg.emoticon = isEmojii(msg.text)
|
|
@@ -326,7 +326,7 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
|
|
|
326
326
|
|
|
327
327
|
private messageCommandGenerate(message:MessageModel){
|
|
328
328
|
const msg: MessageModel = message;
|
|
329
|
-
|
|
329
|
+
msg.text = msg.text? msg.text.trim(): "";//remove black msg with only spaces
|
|
330
330
|
// controllo fatto per i gruppi da rifattorizzare
|
|
331
331
|
if (!msg.sender_fullname || msg.sender_fullname === 'undefined') {
|
|
332
332
|
msg.sender_fullname = msg.sender;
|
|
@@ -338,7 +338,7 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
|
|
|
338
338
|
// }
|
|
339
339
|
|
|
340
340
|
// verifico che il sender è il logged user
|
|
341
|
-
msg.isSender =
|
|
341
|
+
msg.isSender = isSender(msg.sender, this.loggedUser.uid);
|
|
342
342
|
//check if message contains only an emojii
|
|
343
343
|
// msg.emoticon = isEmojii(msg.text)
|
|
344
344
|
|
|
@@ -453,33 +453,6 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
|
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
455
|
|
|
456
|
-
/**
|
|
457
|
-
* controllo se il messaggio è stato inviato da loggerUser
|
|
458
|
-
* richiamato dalla pagina elenco messaggi della conversazione
|
|
459
|
-
*/
|
|
460
|
-
private isSender(sender: string, currentUserId: string) {
|
|
461
|
-
if (currentUserId) {
|
|
462
|
-
if (sender === currentUserId) {
|
|
463
|
-
return true;
|
|
464
|
-
} else {
|
|
465
|
-
return false;
|
|
466
|
-
}
|
|
467
|
-
} else {
|
|
468
|
-
return false;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
/** */
|
|
474
|
-
// updateMetadataMessage(uid: string, metadata: any) {
|
|
475
|
-
// metadata.status = true;
|
|
476
|
-
// const message = {
|
|
477
|
-
// metadata: metadata
|
|
478
|
-
// };
|
|
479
|
-
// const firebaseMessages = firebase.database().ref(this.urlNodeFirebase + uid);
|
|
480
|
-
// firebaseMessages.set(message);
|
|
481
|
-
// }
|
|
482
|
-
|
|
483
456
|
|
|
484
457
|
unsubscribe(key: string) {
|
|
485
458
|
this.listSubsriptions.forEach(sub => {
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
setHeaderDate,
|
|
25
25
|
conversationMessagesRef
|
|
26
26
|
} from '../../utils/utils';
|
|
27
|
-
import { messageType } from '../../utils/utils-message';
|
|
27
|
+
import { isSender, messageType } from '../../utils/utils-message';
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
@Injectable({ providedIn: 'root' })
|
|
@@ -288,7 +288,7 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
288
288
|
this.logger.log("[MQTTConversationHandler] childSnapshot >" + JSON.stringify(childSnapshot));
|
|
289
289
|
const msg = childSnapshot;
|
|
290
290
|
// msg.uid = childSnapshot.key;
|
|
291
|
-
msg.text = msg.text.trim()
|
|
291
|
+
msg.text = msg.text? msg.text.trim(): "";//remove black msg with only spaces
|
|
292
292
|
// controllo fatto per i gruppi da rifattorizzare
|
|
293
293
|
if (!msg.sender_fullname || msg.sender_fullname === 'undefined') {
|
|
294
294
|
msg.sender_fullname = msg.sender;
|
|
@@ -299,7 +299,7 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
299
299
|
// }
|
|
300
300
|
// verifico che il sender è il logged user
|
|
301
301
|
this.logger.log("[MQTTConversationHandler] ****>msg.sender:" + msg.sender);
|
|
302
|
-
msg.isSender =
|
|
302
|
+
msg.isSender = isSender(msg.sender, this.loggedUser.uid);
|
|
303
303
|
// traduco messaggi se sono del server
|
|
304
304
|
if (messageType(MESSAGE_TYPE_INFO, msg)) {
|
|
305
305
|
this.translateInfoSupportMessages(msg);
|
|
@@ -418,32 +418,6 @@ export class MQTTConversationHandler extends ConversationHandlerService {
|
|
|
418
418
|
// }
|
|
419
419
|
}
|
|
420
420
|
|
|
421
|
-
/**
|
|
422
|
-
* controllo se il messaggio è stato inviato da loggerUser
|
|
423
|
-
* richiamato dalla pagina elenco messaggi della conversazione
|
|
424
|
-
*/
|
|
425
|
-
private isSender(sender: string, currentUserId: string) {
|
|
426
|
-
if (currentUserId) {
|
|
427
|
-
if (sender === currentUserId) {
|
|
428
|
-
return true;
|
|
429
|
-
} else {
|
|
430
|
-
return false;
|
|
431
|
-
}
|
|
432
|
-
} else {
|
|
433
|
-
return false;
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
/** */
|
|
439
|
-
// updateMetadataMessage(uid: string, metadata: any) {
|
|
440
|
-
// metadata.status = true;
|
|
441
|
-
// const message = {
|
|
442
|
-
// metadata: metadata
|
|
443
|
-
// };
|
|
444
|
-
// const firebaseMessages = firebase.database().ref(this.urlNodeFirebase + uid);
|
|
445
|
-
// firebaseMessages.set(message);
|
|
446
|
-
// }
|
|
447
421
|
|
|
448
422
|
|
|
449
423
|
unsubscribe(key: string) {
|
|
@@ -62,6 +62,18 @@ export function isMine(message: any) {
|
|
|
62
62
|
return false;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
export function isSender(sender: string, currentUserId: string) {
|
|
66
|
+
if (currentUserId) {
|
|
67
|
+
if (sender === currentUserId) {
|
|
68
|
+
return true;
|
|
69
|
+
} else {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
65
77
|
/** */
|
|
66
78
|
export function messageType(msgType: string, message: any) {
|
|
67
79
|
|