@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
package/src/app/app.module.ts
CHANGED
|
@@ -117,7 +117,7 @@ export function authenticationFactory(http: HttpClient, appConfig: AppConfigProv
|
|
|
117
117
|
} else {
|
|
118
118
|
|
|
119
119
|
FirebaseInitService.initFirebase(config.firebaseConfig)
|
|
120
|
-
console.log('[APP-MOD] FirebaseInitService config ', config)
|
|
120
|
+
// console.log('[APP-MOD] FirebaseInitService config ', config)
|
|
121
121
|
const auth = new FirebaseAuthService(http, network, connectionService);
|
|
122
122
|
auth.setBaseUrl(config.apiUrl)
|
|
123
123
|
|
package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts
CHANGED
|
@@ -117,7 +117,8 @@ export class ConversationContentComponent implements OnInit {
|
|
|
117
117
|
listenToUploadFileProgress() {
|
|
118
118
|
this.uploadService.BSStateUpload.subscribe((data: any) => {
|
|
119
119
|
this.logger.log('[CONV-CONTENT-W] BSStateUpload', data);
|
|
120
|
-
|
|
120
|
+
// && data.type.startsWith("application")
|
|
121
|
+
if (data ) {
|
|
121
122
|
data.upload === 100 || isNaN(data.upload) ? this.showUploadProgress = false : this.showUploadProgress = true
|
|
122
123
|
this.uploadProgress = data.upload
|
|
123
124
|
this.fileType = 'file'
|
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
<div *ngFor="let message of messages; let i = index">
|
|
3
3
|
|
|
4
4
|
<ion-item class="align-center" class="ion-text-center" *ngIf="messageType(MESSAGE_TYPE_INFO, message)" class="msg_info_container">
|
|
5
|
-
<
|
|
5
|
+
<chat-info-message class="messages"
|
|
6
6
|
[message]="message">
|
|
7
|
-
</
|
|
7
|
+
</chat-info-message>
|
|
8
8
|
</ion-item>
|
|
9
9
|
|
|
10
10
|
<!- - message SENDER:: - ->
|
|
11
11
|
<ion-item role="messaggio" *ngIf="messageType(MESSAGE_TYPE_MINE, message)" class="msg_container base_sent">
|
|
12
12
|
|
|
13
13
|
<!- -backgroundColor non viene ancora usato - ->
|
|
14
|
-
<
|
|
14
|
+
<chat-bubble-message class="messages msg_sent slide-in-right"
|
|
15
15
|
[ngClass]="{'button-in-msg' : message.metadata && message.metadata.button}"
|
|
16
16
|
[message]="message"
|
|
17
17
|
[textColor]="'col-msg-sent'"
|
|
18
18
|
(onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
|
|
19
19
|
(onAfterMessageRender)="returnOnAfterMessageRender($event)">
|
|
20
|
-
</
|
|
20
|
+
</chat-bubble-message>
|
|
21
21
|
|
|
22
22
|
<!- - icon status message - ->
|
|
23
|
-
<
|
|
23
|
+
<chat-return-receipt class="slide-in-right"
|
|
24
24
|
[status]="message.status">
|
|
25
|
-
</
|
|
25
|
+
</chat-return-receipt>
|
|
26
26
|
|
|
27
27
|
</ion-item>
|
|
28
28
|
|
|
@@ -30,19 +30,19 @@
|
|
|
30
30
|
<div role="messaggio" *ngIf="messageType(MESSAGE_TYPE_OTHERS, message) && isChannelTypeGroup(channelType)" class="message_sender_fullname slide-in-left">{{message.sender_fullname}}</div>
|
|
31
31
|
<div role="messaggio" *ngIf="messageType(MESSAGE_TYPE_OTHERS, message)" class="msg_container base_receive">
|
|
32
32
|
|
|
33
|
-
<!- - <
|
|
33
|
+
<!- - <chat-avatar-image class="slide-in-left"
|
|
34
34
|
[senderID]="message.sender"
|
|
35
35
|
[senderFullname]="message.sender_fullname"
|
|
36
36
|
[baseLocation]="baseLocation">
|
|
37
|
-
</
|
|
37
|
+
</chat-avatar-image> - ->
|
|
38
38
|
|
|
39
39
|
<!- -backgroundColor non viene ancora usato - ->
|
|
40
|
-
<
|
|
40
|
+
<chat-bubble-message class="messages msg_receive slide-in-left"
|
|
41
41
|
[message]="message"
|
|
42
42
|
[textColor]="'black'"
|
|
43
43
|
(onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
|
|
44
44
|
(onAfterMessageRender)="returnOnAfterMessageRender($event)">
|
|
45
|
-
</
|
|
45
|
+
</chat-bubble-message>
|
|
46
46
|
|
|
47
47
|
</div>
|
|
48
48
|
|
|
@@ -58,23 +58,27 @@
|
|
|
58
58
|
|
|
59
59
|
<div class="align-center" class="ion-text-center" *ngIf="messageType(MESSAGE_TYPE_INFO, message)"
|
|
60
60
|
class="msg_info_container">
|
|
61
|
-
<
|
|
62
|
-
|
|
61
|
+
<chat-info-message class="messages"
|
|
62
|
+
[message]="message">
|
|
63
|
+
</chat-info-message>
|
|
63
64
|
</div>
|
|
64
65
|
|
|
65
66
|
<!-- message SENDER:: -->
|
|
66
67
|
<div role="messaggio" *ngIf="messageType(MESSAGE_TYPE_MINE, message)" class="msg_container base_sent">
|
|
67
68
|
|
|
68
69
|
<!--backgroundColor non viene ancora usato -->
|
|
69
|
-
<
|
|
70
|
+
<chat-bubble-message
|
|
71
|
+
class="messages msg_sent" id="{{'message'+'_'+ i}}"
|
|
70
72
|
[ngClass]="{'button-in-msg' : message.metadata && message.metadata.button}" [message]="message"
|
|
71
|
-
[textColor]="'col-msg-sent'"
|
|
72
|
-
(
|
|
73
|
-
|
|
73
|
+
[textColor]="'col-msg-sent'"
|
|
74
|
+
(onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
|
|
75
|
+
(onAfterMessageRender)="returnOnAfterMessageRender($event)"
|
|
76
|
+
(onImageRendered)="onImageRenderedFN($event)">
|
|
77
|
+
</chat-bubble-message>
|
|
74
78
|
|
|
75
79
|
<!-- icon status message -->
|
|
76
|
-
<
|
|
77
|
-
</
|
|
80
|
+
<chat-return-receipt [status]="message.status" [message]="message" [senderId]="senderId">
|
|
81
|
+
</chat-return-receipt>
|
|
78
82
|
|
|
79
83
|
</div>
|
|
80
84
|
|
|
@@ -87,22 +91,38 @@
|
|
|
87
91
|
|
|
88
92
|
<div role="messaggio" *ngIf="messageType(MESSAGE_TYPE_OTHERS, message)" class="msg_container base_receive">
|
|
89
93
|
|
|
90
|
-
<!-- <
|
|
94
|
+
<!-- <chat-avatar-image class="slide-in-left"
|
|
91
95
|
[senderID]="message.sender"
|
|
92
96
|
[senderFullname]="message.sender_fullname"
|
|
93
97
|
[baseLocation]="baseLocation">
|
|
94
|
-
</
|
|
98
|
+
</chat-avatar-image> -->
|
|
95
99
|
|
|
96
100
|
<!--backgroundColor non viene ancora usato -->
|
|
97
101
|
|
|
98
|
-
<
|
|
102
|
+
<chat-bubble-message class="messages msg_receive"
|
|
103
|
+
[message]="message"
|
|
104
|
+
[textColor]="'black'"
|
|
99
105
|
(onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
|
|
100
|
-
(onAfterMessageRender)="returnOnAfterMessageRender($event)"
|
|
101
|
-
|
|
106
|
+
(onAfterMessageRender)="returnOnAfterMessageRender($event)"
|
|
107
|
+
(onImageRendered)="onImageRenderedFN($event)">
|
|
108
|
+
</chat-bubble-message>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<!-- message type:: button && -->
|
|
112
|
+
<div *ngIf="message?.attributes && message?.attributes?.attachment " class="slide-in-left" >
|
|
113
|
+
<chat-message-attachment
|
|
114
|
+
style="height: 100%; display: block;"
|
|
115
|
+
[message]="message"
|
|
116
|
+
[isLastMessage] = "isLastMessage(message?.uid)"
|
|
117
|
+
[stylesMap]="stylesMap"
|
|
118
|
+
(onAttachmentButtonClicked)="returnOnAttachmentButtonClicked($event)">
|
|
119
|
+
</chat-message-attachment>
|
|
102
120
|
</div>
|
|
103
121
|
</div>
|
|
122
|
+
<!-- (fileType === 'file' && uploadProgress !== 100) -->
|
|
104
123
|
|
|
105
|
-
|
|
124
|
+
<!-- uploadProgress -> {{ uploadProgress }} -->
|
|
125
|
+
<div *ngIf="uploadProgress !== 100" class="msg_container base_sent"
|
|
106
126
|
style="margin-right: 20px;">
|
|
107
127
|
<div class="messages msg_sent">
|
|
108
128
|
<div class="spinner">
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
:host .base_sent .msg_sent ::ng-deep div > div > div >
|
|
1
|
+
:host .base_sent .msg_sent ::ng-deep div > div > div > chat-text > p > p > a {
|
|
2
2
|
color: lightblue;
|
|
3
|
-
|
|
4
3
|
}
|
|
5
4
|
|
|
6
|
-
:host .base_sent .msg_sent ::ng-deep div > div > div >
|
|
5
|
+
:host .base_sent .msg_sent ::ng-deep div > div > div > chat-text > p > p {
|
|
7
6
|
margin-top:12px !important;
|
|
8
|
-
white-space: nowrap;
|
|
9
|
-
overflow: hidden;
|
|
10
|
-
text-overflow: ellipsis;
|
|
7
|
+
// white-space: nowrap;
|
|
8
|
+
// overflow: hidden;
|
|
9
|
+
// text-overflow: ellipsis;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
|
-
:host .base_sent .msg_sent ::ng-deep > div > div >
|
|
12
|
+
:host .base_sent .msg_sent ::ng-deep > div > div > chat-image > div {
|
|
14
13
|
// display: none !important;
|
|
15
14
|
// border-radius: unset !important;
|
|
16
15
|
img, .loader {
|
|
@@ -22,7 +21,7 @@
|
|
|
22
21
|
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
:host .base_receive .msg_receive ::ng-deep > div > div >
|
|
24
|
+
:host .base_receive .msg_receive ::ng-deep > div > div > chat-image > div > img {
|
|
26
25
|
// display: none !important;
|
|
27
26
|
// border-radius: unset !important;
|
|
28
27
|
img, .loader {
|
|
@@ -22,7 +22,7 @@ export class IonConversationDetailComponent extends ConversationContentComponent
|
|
|
22
22
|
@Output() onAddUploadingBubble = new EventEmitter<boolean>();
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
public uploadProgress: number
|
|
25
|
+
public uploadProgress: number = 100
|
|
26
26
|
public fileType: any
|
|
27
27
|
|
|
28
28
|
isMine = isMine;
|
|
@@ -45,10 +45,12 @@ export class IonConversationDetailComponent extends ConversationContentComponent
|
|
|
45
45
|
public uploadService: UploadService
|
|
46
46
|
) {
|
|
47
47
|
super(cdref, uploadService)
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
ngOnInit() {
|
|
51
|
+
ngOnInit() {
|
|
52
|
+
this.listenToUploadFileProgress()
|
|
53
|
+
}
|
|
52
54
|
|
|
53
55
|
listenToUploadFileProgress() {
|
|
54
56
|
this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] FIREBASE-UPLOAD - calling BSStateUpload ');
|
|
@@ -65,14 +67,14 @@ export class IonConversationDetailComponent extends ConversationContentComponent
|
|
|
65
67
|
this.uploadProgress = 100
|
|
66
68
|
}
|
|
67
69
|
// if (data.type.startsWith("application")) {
|
|
68
|
-
if (!data.type.startsWith("image")) {
|
|
70
|
+
// if (!data.type.startsWith("image")) {
|
|
69
71
|
|
|
70
|
-
this.fileType = 'file'
|
|
72
|
+
// this.fileType = 'file'
|
|
71
73
|
|
|
72
74
|
this.addUploadingBubblePlaceholder(true)
|
|
73
75
|
|
|
74
|
-
this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] FIREBASE-UPLOAD - BSStateUpload this.fileType', this.fileType);
|
|
75
|
-
}
|
|
76
|
+
// this.logger.log('[CONVS-DETAIL][ION-CONVS-DETAIL] FIREBASE-UPLOAD - BSStateUpload this.fileType', this.fileType);
|
|
77
|
+
// }
|
|
76
78
|
}
|
|
77
79
|
});
|
|
78
80
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Component, Input, OnInit } from '@angular/core';
|
|
2
2
|
import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service';
|
|
3
3
|
@Component({
|
|
4
|
-
selector: '
|
|
4
|
+
selector: 'chat-avatar-image',
|
|
5
5
|
templateUrl: './avatar.component.html',
|
|
6
6
|
styleUrls: ['./avatar.component.scss']
|
|
7
7
|
})
|
package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<!-- [ngClass]="{'button-in-msg' : message.metadata && message.metadata.button}" -->
|
|
2
|
-
|
|
2
|
+
<!-- [ngStyle]="{'padding': (isImage(message) || isFrame(message))?'0px':'0 8px'}" -->
|
|
3
|
+
<!-- isImage >{{isImage(message) }} message.metadata.width {{message?.metadata?.width }} -->
|
|
4
|
+
<div [ngStyle]="{'padding': (isImage(message) || isFrame(message))?'0px':'0 8px', 'width': (isImage(message) || isFrame(message))? message?.metadata?.width + 'px' : null }"
|
|
5
|
+
class="messages primary-color"
|
|
3
6
|
[class.emoticon]="message?.emoticon">
|
|
4
7
|
|
|
5
8
|
|
|
@@ -13,24 +16,29 @@
|
|
|
13
16
|
[src]="message.metadata.src" [width]="getSizeImg(message).width"
|
|
14
17
|
[height]="getSizeImg(message).height" /> -->
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
<!-- [width]="getMetadataSize(message.metadata).width"
|
|
20
|
+
[height]="getMetadataSize(message.metadata).height" -->
|
|
21
|
+
<chat-image *ngIf="isImage(message)"
|
|
17
22
|
[metadata]="message.metadata"
|
|
18
|
-
|
|
19
|
-
[
|
|
23
|
+
|
|
24
|
+
[width]="message.metadata.width"
|
|
25
|
+
[height]="message.metadata.height"
|
|
20
26
|
(onImageRendered)="onImageRenderedFN($event)">
|
|
21
|
-
</
|
|
27
|
+
</chat-image>
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
<!-- [width]="getMetadataSize(message.metadata).width" -->
|
|
30
|
+
<!-- [height]="getMetadataSize(message.metadata).height"> -->
|
|
31
|
+
<chat-frame *ngIf="isFrame(message)"
|
|
24
32
|
[metadata]="message.metadata"
|
|
25
|
-
[width]="
|
|
26
|
-
[height]="
|
|
27
|
-
</
|
|
33
|
+
[width]="message.metadata.width"
|
|
34
|
+
[height]="message.metadata.height">
|
|
35
|
+
</chat-frame>
|
|
28
36
|
|
|
29
|
-
<!-- <
|
|
37
|
+
<!-- <chat-frame *ngIf="message.metadata && message.metadata.type && message.metadata.type.includes('video')"
|
|
30
38
|
[metadata]="message.metadata"
|
|
31
39
|
[width]="message.metadata.width"
|
|
32
40
|
[height]="message.metadata.height">
|
|
33
|
-
</
|
|
41
|
+
</chat-frame> -->
|
|
34
42
|
|
|
35
43
|
<!-- message type:: text -->
|
|
36
44
|
<!-- <div *ngIf="message.type == 'text'"> -->
|
|
@@ -40,13 +48,13 @@
|
|
|
40
48
|
<span>{{message.timestamp | amTimeAgo}}</span>
|
|
41
49
|
</ng-template>
|
|
42
50
|
|
|
43
|
-
<
|
|
51
|
+
<chat-text
|
|
44
52
|
[text]="message?.text"
|
|
45
53
|
[color]="textColor"
|
|
46
|
-
|
|
54
|
+
[message]="message"
|
|
47
55
|
(onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
|
|
48
56
|
(onAfterMessageRender)="returnOnAfterMessageRender($event)">
|
|
49
|
-
</
|
|
57
|
+
</chat-text>
|
|
50
58
|
<!-- <p #messageEl class="message_innerhtml marked" [innerHTML]="printMessage(message, messageEl, this) | marked"></p> -->
|
|
51
59
|
<!-- <div *ngIf="isPopupUrl(message.text); then contentPopup else contentNewTab">here
|
|
52
60
|
is ignored</div>
|
package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
1
|
+
import { Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core';
|
|
2
2
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
3
3
|
import { MessageModel } from 'src/chat21-core/models/message';
|
|
4
|
-
import { MAX_WIDTH_IMAGES} from 'src/chat21-core/utils/constants';
|
|
4
|
+
import { MAX_WIDTH_IMAGES } from 'src/chat21-core/utils/constants';
|
|
5
5
|
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
6
6
|
import { isFile, isFrame, isImage } from 'src/chat21-core/utils/utils-message';
|
|
7
7
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
8
8
|
@Component({
|
|
9
|
-
selector: '
|
|
9
|
+
selector: 'chat-bubble-message',
|
|
10
10
|
templateUrl: './bubble-message.component.html',
|
|
11
11
|
styleUrls: ['./bubble-message.component.scss']
|
|
12
12
|
})
|
|
13
|
-
export class BubbleMessageComponent implements OnInit {
|
|
13
|
+
export class BubbleMessageComponent implements OnInit, OnChanges {
|
|
14
14
|
|
|
15
15
|
@Input() message: MessageModel;
|
|
16
16
|
@Input() textColor: string;
|
|
@@ -20,7 +20,7 @@ export class BubbleMessageComponent implements OnInit {
|
|
|
20
20
|
isImage = isImage;
|
|
21
21
|
isFile = isFile;
|
|
22
22
|
isFrame = isFrame;
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
tooltipOptions = {
|
|
25
25
|
'show-delay': 500,
|
|
26
26
|
'tooltip-class': 'chat-tooltip',
|
|
@@ -32,61 +32,101 @@ export class BubbleMessageComponent implements OnInit {
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
private logger: LoggerService = LoggerInstance.getInstance()
|
|
35
|
-
constructor(public sanitizer: DomSanitizer) {
|
|
35
|
+
constructor(public sanitizer: DomSanitizer) {
|
|
36
|
+
console.log('BUBBLE-MSG Hello !!!!')
|
|
37
|
+
}
|
|
36
38
|
|
|
37
39
|
ngOnInit() {
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
ngOnChanges() {
|
|
44
|
+
// console.log('BUBBLE-MSG Hello !!!! this.message ', this.message)
|
|
45
|
+
if (this.message && this.message.metadata) {
|
|
46
|
+
this.getMetadataSize(this.message.metadata)
|
|
47
|
+
// console.log('BUBBLE-MSG ngOnChanges message > metadata', this.message.metadata)
|
|
48
|
+
}
|
|
49
|
+
|
|
38
50
|
}
|
|
39
51
|
|
|
52
|
+
|
|
40
53
|
/**
|
|
41
54
|
*
|
|
42
55
|
* @param message
|
|
43
56
|
*/
|
|
57
|
+
// getMetadataSize(metadata): any {
|
|
58
|
+
// if(metadata.width === undefined){
|
|
59
|
+
// metadata.width= MAX_WIDTH_IMAGES
|
|
60
|
+
// }
|
|
61
|
+
// if(metadata.height === undefined){
|
|
62
|
+
// metadata.height = MAX_WIDTH_IMAGES
|
|
63
|
+
// }
|
|
64
|
+
// // const MAX_WIDTH_IMAGES = 300;
|
|
65
|
+
// const sizeImage = {
|
|
66
|
+
// width: metadata.width,
|
|
67
|
+
// height: metadata.height
|
|
68
|
+
// };
|
|
69
|
+
// // that.g.wdLog(['message::: ', metadata);
|
|
70
|
+
// if (metadata.width && metadata.width > MAX_WIDTH_IMAGES) {
|
|
71
|
+
// const rapporto = (metadata['width'] / metadata['height']);
|
|
72
|
+
// sizeImage.width = MAX_WIDTH_IMAGES;
|
|
73
|
+
// sizeImage.height = MAX_WIDTH_IMAGES / rapporto;
|
|
74
|
+
// }
|
|
75
|
+
// return sizeImage; // h.toString();
|
|
76
|
+
// }
|
|
77
|
+
|
|
44
78
|
getMetadataSize(metadata): any {
|
|
45
|
-
if(metadata.width === undefined){
|
|
46
|
-
metadata.width= MAX_WIDTH_IMAGES
|
|
79
|
+
if (metadata.width === undefined) {
|
|
80
|
+
metadata.width = MAX_WIDTH_IMAGES
|
|
47
81
|
}
|
|
48
|
-
if(metadata.height === undefined){
|
|
82
|
+
if (metadata.height === undefined) {
|
|
49
83
|
metadata.height = MAX_WIDTH_IMAGES
|
|
50
84
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
85
|
+
|
|
86
|
+
if (metadata.width && metadata.width < MAX_WIDTH_IMAGES) {
|
|
87
|
+
if (metadata.width <= 55) {
|
|
88
|
+
const ratio = (metadata['width'] / metadata['height']);
|
|
89
|
+
metadata.width = 200;
|
|
90
|
+
metadata.height = 200 / ratio;
|
|
91
|
+
} else if (metadata.width > 55) {
|
|
92
|
+
metadata.width = this.message.metadata.width;
|
|
93
|
+
metadata.height = this.message.metadata.height;
|
|
94
|
+
}
|
|
95
|
+
} else if (metadata.width && metadata.width > MAX_WIDTH_IMAGES) {
|
|
96
|
+
const ratio = (metadata['width'] / metadata['height']);
|
|
97
|
+
metadata.width = MAX_WIDTH_IMAGES;
|
|
98
|
+
metadata.height = MAX_WIDTH_IMAGES / ratio;
|
|
61
99
|
}
|
|
62
|
-
return sizeImage; // h.toString();
|
|
63
100
|
}
|
|
64
101
|
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
65
105
|
/**
|
|
66
106
|
* function customize tooltip
|
|
67
107
|
*/
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
setTimeout(function () {
|
|
80
|
-
if (item.classList.contains('tooltip-show')) {
|
|
81
|
-
item.classList.remove('tooltip-show');
|
|
108
|
+
handleTooltipEvents(event) {
|
|
109
|
+
const that = this;
|
|
110
|
+
const showDelay = this.tooltipOptions['show-delay'];
|
|
111
|
+
setTimeout(function () {
|
|
112
|
+
try {
|
|
113
|
+
const domRepresentation = document.getElementsByClassName('chat-tooltip');
|
|
114
|
+
if (domRepresentation) {
|
|
115
|
+
const item = domRepresentation[0] as HTMLInputElement;
|
|
116
|
+
if (!item.classList.contains('tooltip-show')) {
|
|
117
|
+
item.classList.add('tooltip-show');
|
|
82
118
|
}
|
|
83
|
-
|
|
119
|
+
setTimeout(function () {
|
|
120
|
+
if (item.classList.contains('tooltip-show')) {
|
|
121
|
+
item.classList.remove('tooltip-show');
|
|
122
|
+
}
|
|
123
|
+
}, that.tooltipOptions['hideDelayAfterClick']);
|
|
124
|
+
}
|
|
125
|
+
} catch (err) {
|
|
126
|
+
that.logger.error('[BUBBLE-MESSAGE] handleTooltipEvents >>>> Error :' + err);
|
|
84
127
|
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
}, showDelay);
|
|
89
|
-
}
|
|
128
|
+
}, showDelay);
|
|
129
|
+
}
|
|
90
130
|
|
|
91
131
|
// ========= begin:: event emitter function ============//
|
|
92
132
|
|
|
@@ -99,17 +139,17 @@ export class BubbleMessageComponent implements OnInit {
|
|
|
99
139
|
// this.onClickAttachmentButton.emit(event)
|
|
100
140
|
// }
|
|
101
141
|
|
|
102
|
-
returnOnBeforeMessageRender(event){
|
|
103
|
-
const messageOBJ = { message: this.message, sanitizer: this.sanitizer, messageEl: event.messageEl, component: event.component}
|
|
142
|
+
returnOnBeforeMessageRender(event) {
|
|
143
|
+
const messageOBJ = { message: this.message, sanitizer: this.sanitizer, messageEl: event.messageEl, component: event.component }
|
|
104
144
|
this.onBeforeMessageRender.emit(messageOBJ)
|
|
105
145
|
}
|
|
106
146
|
|
|
107
|
-
returnOnAfterMessageRender(event){
|
|
108
|
-
const messageOBJ = { message: this.message, sanitizer: this.sanitizer, messageEl: event.messageEl, component: event.component}
|
|
147
|
+
returnOnAfterMessageRender(event) {
|
|
148
|
+
const messageOBJ = { message: this.message, sanitizer: this.sanitizer, messageEl: event.messageEl, component: event.component }
|
|
109
149
|
this.onAfterMessageRender.emit(messageOBJ)
|
|
110
150
|
}
|
|
111
151
|
|
|
112
|
-
onImageRenderedFN(event){
|
|
152
|
+
onImageRenderedFN(event) {
|
|
113
153
|
this.onImageRendered.emit(event)
|
|
114
154
|
}
|
|
115
155
|
|
package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
2
2
|
|
|
3
3
|
@Component({
|
|
4
|
-
selector: '
|
|
4
|
+
selector: 'chat-action-button-attachment',
|
|
5
5
|
templateUrl: './action-button.component.html',
|
|
6
6
|
styleUrls: ['./action-button.component.scss']
|
|
7
7
|
})
|
package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.scss
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @import '../../../../../sass/variables';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
div {
|
|
4
4
|
--bck-msg-sent: #62a8ea;
|
|
5
5
|
--col-msg-sent:#ffffff;
|
|
6
6
|
--light-white: #f7f7f7;
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
transition: background-color .6s ease;
|
|
36
36
|
.icon-button-action {
|
|
37
37
|
position: absolute;
|
|
38
|
-
top: -
|
|
39
|
-
right:
|
|
38
|
+
top: -1px;
|
|
39
|
+
right: 1px;
|
|
40
40
|
svg {
|
|
41
41
|
fill: var(--blue);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
.icon-button-action-self{
|
|
45
45
|
position: absolute;
|
|
46
|
-
right:
|
|
46
|
+
right: 1px;
|
|
47
47
|
svg {
|
|
48
48
|
fill: var(--blue);
|
|
49
49
|
}
|
package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
|
2
2
|
|
|
3
3
|
@Component({
|
|
4
|
-
selector: '
|
|
4
|
+
selector: 'chat-link-button-attachment',
|
|
5
5
|
templateUrl: './link-button.component.html',
|
|
6
6
|
styleUrls: ['./link-button.component.scss']
|
|
7
7
|
})
|
package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@ang
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
@Component({
|
|
5
|
-
selector: '
|
|
5
|
+
selector: 'chat-text-button-attachment',
|
|
6
6
|
templateUrl: './text-button.component.html',
|
|
7
7
|
styleUrls: ['./text-button.component.scss']
|
|
8
8
|
})
|
|
@@ -2,7 +2,7 @@ import { DomSanitizer } from '@angular/platform-browser';
|
|
|
2
2
|
import { Component, Input, OnInit } from '@angular/core';
|
|
3
3
|
|
|
4
4
|
@Component({
|
|
5
|
-
selector: '
|
|
5
|
+
selector: 'chat-frame',
|
|
6
6
|
templateUrl: './frame.component.html',
|
|
7
7
|
styleUrls: ['./frame.component.scss']
|
|
8
8
|
})
|
|
@@ -16,12 +16,14 @@ export class FrameComponent implements OnInit {
|
|
|
16
16
|
constructor(private sanitizer: DomSanitizer) { }
|
|
17
17
|
|
|
18
18
|
ngOnInit() {
|
|
19
|
-
if(this.metadata && this.metadata.
|
|
19
|
+
if(this.metadata && this.metadata.src){
|
|
20
20
|
this.url = this.sanitizer.bypassSecurityTrustResourceUrl(this.metadata.src);
|
|
21
21
|
}
|
|
22
22
|
// this.width = this.getSizeImg(this.metadata).width;
|
|
23
23
|
// this.height = this.getSizeImg(this.metadata).height;
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
|
|
25
27
|
|
|
26
28
|
ngOnDestroy(){
|
|
27
29
|
this.url = null;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
<div [ngStyle]
|
|
2
|
-
<div *ngIf="loading" class="loader" [ngStyle]
|
|
3
|
-
<img
|
|
4
|
-
class="message-contentX message-content-imageX"
|
|
5
|
-
[
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
</
|
|
1
|
+
<div [ngStyle]="{ 'max-width': width +'px', 'max-height': height +'px' }" style="position: relative; ">
|
|
2
|
+
<div *ngIf="loading" class="loader" [ngStyle]="{ 'width': width +'px', 'height': height +'px' }"></div>
|
|
3
|
+
<img [ngStyle]="{ 'width': width +'px', 'height': height +'px' }" style="cursor:pointer" [tooltip]="timeTooltipRight" [options]="tooltipOptions" placement="bottom"
|
|
4
|
+
content-type="template" class="message-contentX message-content-imageX" [ngClass]="{'isLoadingImage': loading}"
|
|
5
|
+
[src]="metadata.src" (load)="onLoaded($event)" (click)="downloadImage(metadata.src, metadata.name)" />
|
|
6
|
+
<ng-template #timeTooltipRight>
|
|
7
|
+
<span>{{ tooltipMessage }}</span>
|
|
8
|
+
</ng-template>
|
|
9
|
+
</div>
|