@chat21/chat21-ionic 3.0.55-RC6 → 3.0.57
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 +95 -1
- package/package.json +1 -1
- package/src/app/app.component.scss +1 -0
- package/src/app/app.component.ts +615 -515
- package/src/app/app.module.ts +1 -1
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts +2 -1
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +44 -24
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +7 -8
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +9 -7
- package/src/app/chatlib/conversation-detail/message/avatar/avatar.component.ts +1 -1
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +22 -14
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +85 -45
- package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.scss +1 -1
- package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.ts +1 -1
- package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.scss +4 -4
- package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.ts +1 -1
- package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.scss +1 -1
- package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.ts +1 -1
- package/src/app/chatlib/conversation-detail/message/frame/frame.component.ts +4 -2
- package/src/app/chatlib/conversation-detail/message/image/image.component.html +9 -8
- package/src/app/chatlib/conversation-detail/message/image/image.component.scss +3 -2
- package/src/app/chatlib/conversation-detail/message/image/image.component.ts +35 -3
- package/src/app/chatlib/conversation-detail/message/info-message/info-message.component.ts +1 -1
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.html +56 -0
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.scss +169 -0
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.spec.ts +33 -0
- package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.ts +80 -0
- package/src/app/chatlib/conversation-detail/message/return-receipt/return-receipt.component.ts +1 -1
- package/src/app/chatlib/conversation-detail/message/text/text.component.html +2 -1
- package/src/app/chatlib/conversation-detail/message/text/text.component.ts +4 -4
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +40 -13
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.scss +147 -1
- package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +47 -2
- package/src/app/components/authentication/login/login.component.scss +1 -1
- package/src/app/components/contacts-directory/contacts-directory.component.html +3 -2
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +2 -2
- package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +28 -13
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +1 -2
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +10 -6
- package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +46 -43
- package/src/app/components/conversation-info/advanced-info-accordion/advanced-info-accordion.component.html +2 -2
- package/src/app/components/conversation-info/info-content/info-content.component.ts +15 -5
- package/src/app/components/conversation-info/info-group/info-group.component.ts +4 -4
- package/src/app/components/utils/avatar-profile/avatar-profile.component.html +2 -1
- package/src/app/components/utils/user-presence/user-presence.component.ts +8 -6
- package/src/app/pages/contacts-directory/contacts-directory.page.ts +1 -1
- package/src/app/pages/conversation-detail/conversation-detail.page.html +4 -1
- package/src/app/pages/conversation-detail/conversation-detail.page.ts +218 -42
- package/src/app/pages/conversations-list/conversations-list.page.html +1 -1
- package/src/app/pages/conversations-list/conversations-list.page.ts +135 -45
- package/src/app/pages/loader-preview/loader-preview.page.html +1 -1
- package/src/app/pages/loader-preview/loader-preview.page.ts +18 -5
- package/src/app/pages/profile-info/profile-info.page.html +2 -0
- package/src/app/services/nav-proxy.service.ts +2 -2
- package/src/app/services/network-service/network.service.spec.ts +12 -0
- package/src/app/services/network-service/network.service.ts +46 -0
- package/src/app/shared/shared.module.ts +2 -0
- package/src/assets/i18n/en.json +4 -2
- package/src/assets/i18n/it.json +5 -3
- package/src/chat21-core/providers/abstract/app-storage.service.ts +2 -2
- package/src/chat21-core/providers/chat-manager.ts +2 -1
- package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +3 -2
- package/src/chat21-core/providers/firebase/firebase-auth-service.ts +112 -69
- package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +4 -4
- package/src/chat21-core/providers/firebase/firebase-image-repo.ts +1 -1
- package/src/chat21-core/providers/firebase/firebase-notifications.ts +29 -29
- package/src/chat21-core/providers/firebase/firebase-presence.service.ts +1 -0
- package/src/chat21-core/providers/localSessionStorage.ts +155 -154
- package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +42 -12
- package/src/chat21-core/utils/user-typing/user-typing.component.html +6 -11
- package/src/chat21-core/utils/utils.ts +3 -3
- package/src/global.scss +17 -0
- package/src/index.html +27 -59
|
@@ -47,7 +47,9 @@ export class UserPresenceComponent implements OnInit, OnDestroy {
|
|
|
47
47
|
|
|
48
48
|
/** */
|
|
49
49
|
initialize() {
|
|
50
|
-
|
|
50
|
+
if (this.translationMap) {
|
|
51
|
+
this.status = this.translationMap.get('LABEL_ACTIVE_NOW');
|
|
52
|
+
}
|
|
51
53
|
this.logger.log('[USER-PRESENCE-COMP] - initialize - this.translationMap', this.translationMap);
|
|
52
54
|
this.logger.log('[USER-PRESENCE-COMP] - initialize - this.status', this.status);
|
|
53
55
|
this.logger.log('[USER-PRESENCE-COMP] - initialize - idUser ->', this.idUser);
|
|
@@ -68,7 +70,7 @@ export class UserPresenceComponent implements OnInit, OnDestroy {
|
|
|
68
70
|
subscribtionKey = 'BSIsOnline';
|
|
69
71
|
subscribtion = this.subscriptions.find(item => item.key === subscribtionKey);
|
|
70
72
|
if (!subscribtion) {
|
|
71
|
-
subscribtion =
|
|
73
|
+
subscribtion = this.presenceService.BSIsOnline.subscribe((data: any) => {
|
|
72
74
|
this.logger.log('[USER-PRESENCE-COMP] $subs to BSIsOnline - data ', data);
|
|
73
75
|
if (data) {
|
|
74
76
|
const userId = data.uid;
|
|
@@ -78,7 +80,7 @@ export class UserPresenceComponent implements OnInit, OnDestroy {
|
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
});
|
|
81
|
-
const subscribe = {key: subscribtionKey, value: subscribtion };
|
|
83
|
+
const subscribe = { key: subscribtionKey, value: subscribtion };
|
|
82
84
|
this.subscriptions.push(subscribe);
|
|
83
85
|
}
|
|
84
86
|
|
|
@@ -86,7 +88,7 @@ export class UserPresenceComponent implements OnInit, OnDestroy {
|
|
|
86
88
|
subscribtionKey = 'BSLastOnline';
|
|
87
89
|
subscribtion = this.subscriptions.find(item => item.key === subscribtionKey);
|
|
88
90
|
if (!subscribtion) {
|
|
89
|
-
subscribtion =
|
|
91
|
+
subscribtion = this.presenceService.BSLastOnline.subscribe((data: any) => {
|
|
90
92
|
this.logger.log('[USER-PRESENCE-COMP] $subs to BSLastOnline - data ', data);
|
|
91
93
|
if (data) {
|
|
92
94
|
const userId = data.uid;
|
|
@@ -96,7 +98,7 @@ export class UserPresenceComponent implements OnInit, OnDestroy {
|
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
100
|
});
|
|
99
|
-
const subscribe = {key: subscribtionKey, value: subscribtion };
|
|
101
|
+
const subscribe = { key: subscribtionKey, value: subscribtion };
|
|
100
102
|
this.subscriptions.push(subscribe);
|
|
101
103
|
}
|
|
102
104
|
|
|
@@ -138,7 +140,7 @@ export class UserPresenceComponent implements OnInit, OnDestroy {
|
|
|
138
140
|
const lastConnectionDate = setLastDateWithLabels(this.translationMap, timestamp);
|
|
139
141
|
this.logger.log('[USER-PRESENCE-COMP] userLastConnection - lastConnectionDate', lastConnectionDate);
|
|
140
142
|
this.lastConnectionDate = lastConnectionDate;
|
|
141
|
-
if (this.online === false
|
|
143
|
+
if (this.online === false) {
|
|
142
144
|
this.status = this.lastConnectionDate;
|
|
143
145
|
}
|
|
144
146
|
}
|
|
@@ -89,7 +89,7 @@ export class ContactsDirectoryPage implements OnInit {
|
|
|
89
89
|
this.logger.log('[CONTACT-DIRECTORY-PAGE] DSHBRD STORED USER: ', user);
|
|
90
90
|
if (user.token) {
|
|
91
91
|
token = user.token;
|
|
92
|
-
|
|
92
|
+
this.logger.log('[CONTACTS-DIRECTORY] DSHBRD STORED USER > TOKEN: ', user.token);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
return token;
|
|
@@ -9,9 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
<ion-grid style="height: 100%;">
|
|
11
11
|
<ion-row class="ion-justify-content-center ion-align-items-center" style="height: 100%; flex-direction: column">
|
|
12
|
-
<span
|
|
12
|
+
<span *ngIf="isOnline === true"
|
|
13
13
|
style="color: #92949c; font-size: 16px;line-height: 18px;margin-top: -160px;">{{'PleaseSelectChatToStartMessaging'
|
|
14
14
|
| translate }}</span>
|
|
15
|
+
|
|
16
|
+
<span *ngIf="isOnline === false"
|
|
17
|
+
style="color: #92949c; font-size: 16px;line-height: 18px;margin-top: -160px;">Internet is slow or not working</span>
|
|
15
18
|
</ion-row>
|
|
16
19
|
</ion-grid>
|
|
17
20
|
</ion-content>
|
|
@@ -35,9 +35,11 @@ import { isFirstMessage, isInfo, isMine, messageType } from 'src/chat21-core/uti
|
|
|
35
35
|
// Logger
|
|
36
36
|
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
37
37
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
38
|
+
|
|
38
39
|
import { Subject } from 'rxjs';
|
|
39
40
|
import { takeUntil } from 'rxjs/operators';
|
|
40
41
|
import { TiledeskService } from '../../services/tiledesk/tiledesk.service';
|
|
42
|
+
import { NetworkService } from '../../services/network-service/network.service';
|
|
41
43
|
|
|
42
44
|
@Component({
|
|
43
45
|
selector: 'app-conversation-detail',
|
|
@@ -92,7 +94,6 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
92
94
|
public window: any = window;
|
|
93
95
|
public styleMap: Map<string, string> = new Map();
|
|
94
96
|
|
|
95
|
-
|
|
96
97
|
MESSAGE_TYPE_INFO = MESSAGE_TYPE_INFO;
|
|
97
98
|
MESSAGE_TYPE_MINE = MESSAGE_TYPE_MINE;
|
|
98
99
|
MESSAGE_TYPE_OTHERS = MESSAGE_TYPE_OTHERS;
|
|
@@ -113,6 +114,11 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
113
114
|
messageType = messageType;
|
|
114
115
|
// info_content_child_enabled: boolean = false
|
|
115
116
|
private logger: LoggerService = LoggerInstance.getInstance();
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
public isOnline: boolean = true;
|
|
120
|
+
public checkInternet: boolean;
|
|
121
|
+
public msgCount: number
|
|
116
122
|
/**
|
|
117
123
|
* Constructor
|
|
118
124
|
* @param route
|
|
@@ -157,7 +163,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
157
163
|
public imageRepoService: ImageRepoService,
|
|
158
164
|
public presenceService: PresenceService,
|
|
159
165
|
public toastController: ToastController,
|
|
160
|
-
public tiledeskService: TiledeskService
|
|
166
|
+
public tiledeskService: TiledeskService,
|
|
167
|
+
private networkService: NetworkService
|
|
161
168
|
) {
|
|
162
169
|
|
|
163
170
|
// Change list on date change
|
|
@@ -174,8 +181,39 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
174
181
|
// @ Lifehooks
|
|
175
182
|
// -----------------------------------------------------------
|
|
176
183
|
ngOnInit() {
|
|
177
|
-
this.logger.log('[CONVS-DETAIL] > ngOnInit - window.location: ', window.location);
|
|
184
|
+
// this.logger.log('[CONVS-DETAIL] > ngOnInit - window.location: ', window.location);
|
|
185
|
+
// this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept: ', this.appConfigProvider.getConfig().fileUploadAccept);
|
|
186
|
+
// const accept_files = this.appConfigProvider.getConfig().fileUploadAccept;
|
|
187
|
+
// this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept typeof accept_files ', typeof accept_files);
|
|
188
|
+
// const accept_files_array = accept_files.split(',')
|
|
189
|
+
// this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept accept_files_array ', accept_files_array);
|
|
190
|
+
// this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept accept_files_array typeof: ', typeof accept_files_array);
|
|
191
|
+
|
|
192
|
+
// accept_files_array.forEach(accept_file => {
|
|
193
|
+
// this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept accept_file ', accept_file);
|
|
194
|
+
// const accept_file_segment = accept_file.split('/')
|
|
195
|
+
// this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept accept_file_segment ', accept_file_segment);
|
|
196
|
+
// if (accept_file_segment[1] === '*') {
|
|
197
|
+
|
|
198
|
+
// }
|
|
199
|
+
// });
|
|
200
|
+
this.watchToConnectionStatus();
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
watchToConnectionStatus() {
|
|
204
|
+
|
|
205
|
+
this.networkService.checkInternetFunc().subscribe(isOnline => {
|
|
206
|
+
this.checkInternet = isOnline
|
|
207
|
+
// console.log('[CONVS-LIST-PAGE] - watchToConnectionStatus - isOnline', this.checkInternet)
|
|
178
208
|
|
|
209
|
+
// checking internet connection
|
|
210
|
+
if (this.checkInternet == true) {
|
|
211
|
+
|
|
212
|
+
this.isOnline = true;
|
|
213
|
+
} else {
|
|
214
|
+
this.isOnline = false;
|
|
215
|
+
}
|
|
216
|
+
});
|
|
179
217
|
}
|
|
180
218
|
|
|
181
219
|
ngAfterViewInit() {
|
|
@@ -295,17 +333,18 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
295
333
|
// this.openInfoConversation = true;
|
|
296
334
|
}
|
|
297
335
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
336
|
+
if (this.isMobile === false) {
|
|
337
|
+
if (checkWindowWidthIsLessThan991px()) {
|
|
338
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> checkWindowWidthIsLessThan991px ', checkWindowWidthIsLessThan991px())
|
|
339
|
+
this.openInfoConversation = false; // indica se è aperto il box info conversazione
|
|
340
|
+
this.isOpenInfoConversation = false;
|
|
341
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> openInfoConversation ', this.openInfoConversation, ' -> isOpenInfoConversation ', this.isOpenInfoConversation)
|
|
342
|
+
} else {
|
|
343
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> checkWindowWidthIsLessThan991px ', checkWindowWidthIsLessThan991px())
|
|
344
|
+
this.openInfoConversation = true;
|
|
345
|
+
this.isOpenInfoConversation = true;
|
|
346
|
+
this.logger.log('[CONVS-DETAIL] - initialize -> openInfoConversation ', this.openInfoConversation, ' -> isOpenInfoConversation ', this.isOpenInfoConversation)
|
|
347
|
+
}
|
|
309
348
|
}
|
|
310
349
|
|
|
311
350
|
this.online = false;
|
|
@@ -365,7 +404,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
365
404
|
'LABEL_ENTER_MSG_SHORT',
|
|
366
405
|
'LABEL_ENTER_MSG_SHORTER',
|
|
367
406
|
'ONLY_IMAGE_FILES_ARE_ALLOWED_TO_PASTE',
|
|
368
|
-
'
|
|
407
|
+
'FAILED_TO_UPLOAD_THE_FORMAT_IS NOT_SUPPORTED',
|
|
369
408
|
'NO_INFORMATION_AVAILABLE',
|
|
370
409
|
'CONTACT_ID',
|
|
371
410
|
'USER_ID'
|
|
@@ -426,6 +465,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
426
465
|
const that = this;
|
|
427
466
|
this.logger.log('[CONVS-DETAIL] - initConversationHandler that.messages ', that.messages);
|
|
428
467
|
this.logger.log('[CONVS-DETAIL] - initConversationHandler that.messages.length ', that.messages.length);
|
|
468
|
+
this.msgCount = that.messages.length
|
|
429
469
|
setTimeout(() => {
|
|
430
470
|
if (!that.messages || that.messages.length === 0) {
|
|
431
471
|
this.showIonContent = true;
|
|
@@ -487,11 +527,11 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
487
527
|
}
|
|
488
528
|
|
|
489
529
|
setHeaderContent() {
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
530
|
+
// this.logger.log('[CONVS-DETAIL] - setHeaderContent conversationWith', this.conversationWith)
|
|
531
|
+
// this.logger.log('[CONVS-DETAIL] - setHeaderContent conversationsHandlerService', this.conversationsHandlerService)
|
|
532
|
+
// this.logger.log('[CONVS-DETAIL] - setHeaderContent conv_type', this.conv_type)
|
|
533
|
+
if (this.conversationWith && this.conversationsHandlerService && this.conv_type === 'active') {
|
|
534
|
+
this.logger.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail CALLING')
|
|
495
535
|
this.conversationsHandlerService.getConversationDetail(this.conversationWith, (conv) => {
|
|
496
536
|
this.logger.log('[CONVS-DETAIL] - setHeaderContent getConversationDetail (active)', this.conversationWith, conv)
|
|
497
537
|
this.conversationAvatar = setConversationAvatar(
|
|
@@ -542,12 +582,13 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
542
582
|
|
|
543
583
|
|
|
544
584
|
/**
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
585
|
+
* SendMessage
|
|
586
|
+
* @param msg
|
|
587
|
+
* @param type
|
|
588
|
+
* @param metadata
|
|
589
|
+
* @param additional_attributes
|
|
590
|
+
*/
|
|
591
|
+
sendMessage(msg: string, type: string, metadata?: any, additional_attributes?: any) {
|
|
551
592
|
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE - MSG: ', msg);
|
|
552
593
|
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE - type: ', type);
|
|
553
594
|
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE - metadata: ', metadata);
|
|
@@ -556,7 +597,22 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
556
597
|
fullname = this.loggedUser.fullname;
|
|
557
598
|
}
|
|
558
599
|
|
|
559
|
-
|
|
600
|
+
const g_attributes = this.setAttributes();
|
|
601
|
+
// added <any> to resolve the Error occurred during the npm installation: Property 'userFullname' does not exist on type '{}'
|
|
602
|
+
const attributes = <any>{};
|
|
603
|
+
if (g_attributes) {
|
|
604
|
+
for (const [key, value] of Object.entries(g_attributes)) {
|
|
605
|
+
attributes[key] = value;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
if (additional_attributes) {
|
|
609
|
+
for (const [key, value] of Object.entries(additional_attributes)) {
|
|
610
|
+
attributes[key] = value;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
// || type === 'image'
|
|
615
|
+
if (type === 'file') {
|
|
560
616
|
|
|
561
617
|
if (msg) {
|
|
562
618
|
// msg = msg + '<br>' + 'File: ' + metadata.src;
|
|
@@ -568,16 +624,27 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
568
624
|
// ${metadata.name}
|
|
569
625
|
// </a>`
|
|
570
626
|
|
|
571
|
-
// msg =
|
|
627
|
+
// msg =  + [${metadata.name}](${metadata.src})
|
|
572
628
|
msg = `[${metadata.name}](${metadata.src})`
|
|
573
629
|
}
|
|
574
630
|
}
|
|
575
|
-
|
|
576
|
-
//
|
|
577
|
-
//
|
|
631
|
+
|
|
632
|
+
// else if (type === 'image') {
|
|
633
|
+
// if (msg) {
|
|
634
|
+
// // msg = msg + '<br>' + 'File: ' + metadata.src;
|
|
635
|
+
// msg = metadata.name + '\n' + msg
|
|
636
|
+
|
|
637
|
+
// } else {
|
|
638
|
+
|
|
639
|
+
// msg = metadata.name
|
|
640
|
+
// }
|
|
641
|
+
|
|
642
|
+
// }
|
|
643
|
+
|
|
578
644
|
|
|
579
645
|
(metadata) ? metadata = metadata : metadata = '';
|
|
580
646
|
this.logger.log('[CONVS-DETAIL] - SEND MESSAGE msg: ', msg, ' - messages: ', this.messages, ' - loggedUser: ', this.loggedUser);
|
|
647
|
+
|
|
581
648
|
if (msg && msg.trim() !== '' || type !== TYPE_MSG_TEXT) {
|
|
582
649
|
this.conversationHandlerService.sendMessage(
|
|
583
650
|
msg,
|
|
@@ -588,12 +655,11 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
588
655
|
this.loggedUser.uid,
|
|
589
656
|
fullname,
|
|
590
657
|
this.channelType,
|
|
591
|
-
|
|
658
|
+
attributes
|
|
592
659
|
);
|
|
593
660
|
|
|
594
661
|
}
|
|
595
662
|
}
|
|
596
|
-
|
|
597
663
|
// ----------------------------------------------------------
|
|
598
664
|
// InitSubscriptions BS subscriptions
|
|
599
665
|
// ----------------------------------------------------------
|
|
@@ -848,10 +914,20 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
848
914
|
this.logger.log("[CONVS-DETAIL] - loadTagsCanned conversationWith ", conversationWith);
|
|
849
915
|
|
|
850
916
|
const conversationWith_segments = conversationWith.split('-');
|
|
851
|
-
|
|
852
|
-
|
|
917
|
+
// Removes the last element of the array if is = to the separator
|
|
918
|
+
if (conversationWith_segments[conversationWith_segments.length - 1] === '') {
|
|
919
|
+
conversationWith_segments.pop();
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
if (conversationWith_segments.length === 4) {
|
|
923
|
+
const lastArrayElement = conversationWith_segments[conversationWith_segments.length - 1]
|
|
924
|
+
this.logger.log('[CONVS-DETAIL] - lastArrayElement ', lastArrayElement);
|
|
925
|
+
this.logger.log('[CONVS-DETAIL] - lastArrayElement length', lastArrayElement.length);
|
|
926
|
+
if (lastArrayElement.length !== 32) {
|
|
853
927
|
conversationWith_segments.pop();
|
|
854
|
-
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
|
|
855
931
|
this.logger.log("[CONVS-DETAIL] - loadTagsCanned conversationWith_segments ", conversationWith_segments);
|
|
856
932
|
let projectId = ""
|
|
857
933
|
|
|
@@ -1069,7 +1145,35 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1069
1145
|
}
|
|
1070
1146
|
|
|
1071
1147
|
returnOnAttachmentButtonClicked(event: any) {
|
|
1072
|
-
|
|
1148
|
+
this.logger.debug('[CONV-COMP] eventbutton', event)
|
|
1149
|
+
if (!event || !event.target.type) {
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
switch (event.target.type) {
|
|
1153
|
+
case 'url':
|
|
1154
|
+
try {
|
|
1155
|
+
this.openLink(event.target.button);
|
|
1156
|
+
} catch (err) {
|
|
1157
|
+
this.logger.error('[CONV-COMP] url > Error :' + err);
|
|
1158
|
+
}
|
|
1159
|
+
return;
|
|
1160
|
+
case 'action':
|
|
1161
|
+
try {
|
|
1162
|
+
this.actionButton(event.target.button);
|
|
1163
|
+
} catch (err) {
|
|
1164
|
+
this.logger.error('[CONV-COMP] action > Error :' + err);
|
|
1165
|
+
}
|
|
1166
|
+
return false;
|
|
1167
|
+
case 'text':
|
|
1168
|
+
try {
|
|
1169
|
+
const text = event.target.button.value
|
|
1170
|
+
const metadata = { 'button': true };
|
|
1171
|
+
this.sendMessage(text, TYPE_MSG_TEXT, metadata);
|
|
1172
|
+
} catch (err) {
|
|
1173
|
+
this.logger.error('[CONV-COMP] text > Error :' + err);
|
|
1174
|
+
}
|
|
1175
|
+
default: return;
|
|
1176
|
+
}
|
|
1073
1177
|
}
|
|
1074
1178
|
|
|
1075
1179
|
onImageRenderedFN(event) {
|
|
@@ -1079,6 +1183,32 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1079
1183
|
}
|
|
1080
1184
|
}
|
|
1081
1185
|
|
|
1186
|
+
|
|
1187
|
+
private openLink(event: any) {
|
|
1188
|
+
const link = event.link ? event.link : '';
|
|
1189
|
+
const target = event.target ? event.target : '';
|
|
1190
|
+
if (target === 'self' || target === 'parent') {
|
|
1191
|
+
window.open(link, '_parent');
|
|
1192
|
+
} else {
|
|
1193
|
+
window.open(link, '_blank');
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
private actionButton(event: any) {
|
|
1199
|
+
// console.log(event);
|
|
1200
|
+
const action = event.action ? event.action : '';
|
|
1201
|
+
const message = event.value ? event.value : '';
|
|
1202
|
+
const subtype = event.show_reply ? '' : 'info';
|
|
1203
|
+
|
|
1204
|
+
const attributes = {
|
|
1205
|
+
action: action,
|
|
1206
|
+
subtype: subtype
|
|
1207
|
+
};
|
|
1208
|
+
this.sendMessage(message, TYPE_MSG_TEXT, null, attributes);
|
|
1209
|
+
this.logger.debug('[CONV-COMP] > action :');
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1082
1212
|
addUploadingBubbleEvent(event: boolean) {
|
|
1083
1213
|
this.logger.log('[CONVS-DETAIL] addUploadingBubbleEvent event', event);
|
|
1084
1214
|
if (event === true) {
|
|
@@ -1181,11 +1311,53 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1181
1311
|
}
|
|
1182
1312
|
} catch (e) {
|
|
1183
1313
|
this.logger.error('[CONVS-DETAIL] setHeightTextArea - ERROR ', e)
|
|
1184
|
-
this.heightMessageTextArea = '50';
|
|
1314
|
+
// this.heightMessageTextArea = '50';
|
|
1315
|
+
this.heightMessageTextArea = '57'; // NK edited
|
|
1185
1316
|
}
|
|
1186
1317
|
}
|
|
1318
|
+
checkAcceptedFile(draggedFileMimeType) {
|
|
1319
|
+
let isAcceptFile = false;
|
|
1320
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept: ', this.appConfigProvider.getConfig().fileUploadAccept);
|
|
1321
|
+
const accept_files = this.appConfigProvider.getConfig().fileUploadAccept;
|
|
1322
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - mimeType: ', draggedFileMimeType);
|
|
1323
|
+
if (accept_files === "*/*") {
|
|
1324
|
+
isAcceptFile = true;
|
|
1325
|
+
return isAcceptFile
|
|
1326
|
+
} else if (accept_files !== "*/*") {
|
|
1327
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept typeof accept_files ', typeof accept_files);
|
|
1328
|
+
const accept_files_array = accept_files.split(',')
|
|
1329
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_files_array ', accept_files_array);
|
|
1330
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_files_array typeof: ', typeof accept_files_array);
|
|
1331
|
+
|
|
1332
|
+
accept_files_array.forEach(accept_file => {
|
|
1333
|
+
|
|
1334
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_file ', accept_file);
|
|
1335
|
+
const accept_file_segment = accept_file.split('/')
|
|
1336
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept accept_file_segment ', accept_file_segment);
|
|
1337
|
+
if (accept_file_segment[1] === '*') {
|
|
1338
|
+
if (draggedFileMimeType.startsWith(accept_file_segment[0])) {
|
|
1339
|
+
isAcceptFile = true;
|
|
1340
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile', isAcceptFile);
|
|
1341
|
+
return isAcceptFile
|
|
1187
1342
|
|
|
1343
|
+
} else {
|
|
1344
|
+
isAcceptFile = false;
|
|
1345
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile', isAcceptFile);
|
|
1346
|
+
return isAcceptFile
|
|
1188
1347
|
|
|
1348
|
+
}
|
|
1349
|
+
} else if (accept_file_segment[1] !== '*') {
|
|
1350
|
+
if (draggedFileMimeType === accept_file) {
|
|
1351
|
+
isAcceptFile = true;
|
|
1352
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile', isAcceptFile);
|
|
1353
|
+
return isAcceptFile
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
return isAcceptFile
|
|
1357
|
+
});
|
|
1358
|
+
return isAcceptFile
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1189
1361
|
// -------------------------------------------------------------
|
|
1190
1362
|
// DRAG FILE
|
|
1191
1363
|
// -------------------------------------------------------------
|
|
@@ -1206,8 +1378,12 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1206
1378
|
var mimeType = fileList[0].type;
|
|
1207
1379
|
this.logger.log('[CONVS-DETAIL] ----> FILE - DROP mimeType files ', mimeType);
|
|
1208
1380
|
|
|
1209
|
-
if (mimeType.startsWith("image") || mimeType.startsWith("application")) {
|
|
1210
|
-
|
|
1381
|
+
// if (mimeType.startsWith("image") || mimeType.startsWith("application")) {
|
|
1382
|
+
// this.logger.log('[CONVS-DETAIL] ----> FILE - DROP mimeType files: ', this.appConfigProvider.getConfig().fileUploadAccept);
|
|
1383
|
+
// this.checkAcceptedFile(mimeType);
|
|
1384
|
+
const isAccepted = this.checkAcceptedFile(mimeType);
|
|
1385
|
+
this.logger.log('[CONVS-DETAIL] > checkAcceptedFile - fileUploadAccept isAcceptFile FILE - DROP', isAccepted);
|
|
1386
|
+
if (isAccepted === true) {
|
|
1211
1387
|
this.handleDropEvent(ev);
|
|
1212
1388
|
|
|
1213
1389
|
} else {
|
|
@@ -1242,8 +1418,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
|
|
|
1242
1418
|
|
|
1243
1419
|
async presentToastOnlyImageFilesAreAllowedToDrag() {
|
|
1244
1420
|
const toast = await this.toastController.create({
|
|
1245
|
-
message: this.translationMap.get('
|
|
1246
|
-
duration:
|
|
1421
|
+
message: this.translationMap.get('FAILED_TO_UPLOAD_THE_FORMAT_IS_NOT_SUPPORTED'),
|
|
1422
|
+
duration: 5000,
|
|
1247
1423
|
color: "danger",
|
|
1248
1424
|
cssClass: 'toast-custom-class',
|
|
1249
1425
|
});
|