@chat21/chat21-ionic 3.0.6-2.3 → 3.0.6-2.4
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 +4 -0
- package/package.json +1 -1
- package/src/app/app.component.ts +81 -6
- package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html +2 -0
- 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 +33 -21
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +26 -11
- package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +3 -1
- package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.scss +1 -1
- package/src/app/pages/authentication/login/login.page.ts +12 -1
- package/src/assets/js/chat21client.js +1 -1
- package/src/chat-config-pre-test.json +1 -1
- package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +2 -3
- package/src/chat21-core/providers/logger/customLogger.ts +2 -10
- package/src/chat21-core/utils/utils-message.ts +22 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# chat21-ionic ver 3.0
|
|
2
2
|
|
|
3
|
+
### 3.0.62.4
|
|
4
|
+
- Fixed bug: when the user profile is updated in the dashboard it is not updated in the chat
|
|
5
|
+
- Fixed bug: when is sent a message with only emojis, some emojis have the chat balloon background
|
|
6
|
+
|
|
3
7
|
### 3.0.62.3
|
|
4
8
|
- Fixes the bug: the method setTyping fired twice after that a message is sent
|
|
5
9
|
- Other minor improvements
|
package/package.json
CHANGED
package/src/app/app.component.ts
CHANGED
|
@@ -299,7 +299,7 @@ export class AppComponent implements OnInit {
|
|
|
299
299
|
ngOnInit() {
|
|
300
300
|
const appconfig = this.appConfigProvider.getConfig();
|
|
301
301
|
this.logger.log('[APP-COMP] ngOnInit appconfig', appconfig)
|
|
302
|
-
if (appconfig && appconfig.supportMode &&
|
|
302
|
+
if (appconfig && appconfig.supportMode && (appconfig.supportMode === true || appconfig.supportMode === 'true')) {
|
|
303
303
|
this.SUPPORT_MODE = true;
|
|
304
304
|
this.logger.log('[APP-COMP] appconfig > SUPPORT_MODE', this.SUPPORT_MODE)
|
|
305
305
|
} else {
|
|
@@ -564,16 +564,16 @@ export class AppComponent implements OnInit {
|
|
|
564
564
|
} else if (browserLang && stored_preferred_lang) {
|
|
565
565
|
chat_lang = stored_preferred_lang
|
|
566
566
|
}
|
|
567
|
-
|
|
567
|
+
|
|
568
568
|
this.logger.log('[APP-COMP] - chat_lang', chat_lang)
|
|
569
|
-
|
|
569
|
+
|
|
570
570
|
if (tranlatedLanguage.includes(chat_lang)) {
|
|
571
|
-
this.logger.log('[APP-COMP] tranlatedLanguage includes',chat_lang
|
|
571
|
+
this.logger.log('[APP-COMP] tranlatedLanguage includes', chat_lang, ': ', tranlatedLanguage.includes(chat_lang))
|
|
572
572
|
this.translate.setDefaultLang(chat_lang)
|
|
573
573
|
this.translate.use(chat_lang);
|
|
574
574
|
}
|
|
575
575
|
else {
|
|
576
|
-
this.logger.log('[APP-COMP] tranlatedLanguage includes',chat_lang
|
|
576
|
+
this.logger.log('[APP-COMP] tranlatedLanguage includes', chat_lang, ': ', tranlatedLanguage.includes(chat_lang))
|
|
577
577
|
this.translate.setDefaultLang('en');
|
|
578
578
|
this.translate.use('en');
|
|
579
579
|
}
|
|
@@ -659,6 +659,78 @@ export class AppComponent implements OnInit {
|
|
|
659
659
|
}
|
|
660
660
|
|
|
661
661
|
|
|
662
|
+
updateStoredCurrentUser() {
|
|
663
|
+
const currentUser = JSON.parse(this.appStorageService.getItem('currentUser'));
|
|
664
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser', currentUser)
|
|
665
|
+
const dshbrdUser = JSON.parse(localStorage.getItem('user'));
|
|
666
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser', dshbrdUser)
|
|
667
|
+
|
|
668
|
+
if (currentUser.color !== dshbrdUser.fillColour) {
|
|
669
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color !== dshbrdUser.fillColour')
|
|
670
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color ', currentUser.color)
|
|
671
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fillColour ', dshbrdUser.fillColour)
|
|
672
|
+
currentUser.color = dshbrdUser.fillColour;
|
|
673
|
+
} else {
|
|
674
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color === dshbrdUser.fillColour')
|
|
675
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.color ', currentUser.color)
|
|
676
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fillColour ', dshbrdUser.fillColour)
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
if (currentUser.firstname !== dshbrdUser.firstname) {
|
|
680
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname !== dshbrdUser.firstname')
|
|
681
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname ', currentUser.firstname)
|
|
682
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.firstname ', dshbrdUser.firstname)
|
|
683
|
+
currentUser.firstname = dshbrdUser.firstname
|
|
684
|
+
} else {
|
|
685
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname === dshbrdUser.firstname')
|
|
686
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.firstname ', currentUser.firstname)
|
|
687
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.firstname ', dshbrdUser.firstname)
|
|
688
|
+
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
if (currentUser.lastname !== dshbrdUser.lastname) {
|
|
692
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname !== dshbrdUser.lastname')
|
|
693
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname ', currentUser.lastname)
|
|
694
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.lastname ', dshbrdUser.lastname)
|
|
695
|
+
currentUser.lastname = dshbrdUser.lastname
|
|
696
|
+
} else {
|
|
697
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname === dshbrdUser.lastname')
|
|
698
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.lastname ', currentUser.lastname)
|
|
699
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.lastname ', dshbrdUser.lastname)
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
if (currentUser.avatar !== dshbrdUser.fullname_initial) {
|
|
703
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar !== dshbrdUser.fullname_initial')
|
|
704
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar ', currentUser.avatar)
|
|
705
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname_initial ', dshbrdUser.fullname_initial )
|
|
706
|
+
} else {
|
|
707
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar === dshbrdUser.fullname_initial')
|
|
708
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.avatar ', currentUser.avatar)
|
|
709
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname_initial ', dshbrdUser.fullname_initial )
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
let fullname = ""
|
|
713
|
+
if (dshbrdUser.firstname && !dshbrdUser.lastname ) {
|
|
714
|
+
fullname = dshbrdUser.firstname
|
|
715
|
+
} else if (dshbrdUser.firstname && dshbrdUser.lastname) {
|
|
716
|
+
fullname = dshbrdUser.firstname + ' ' + dshbrdUser.lastname
|
|
717
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - fullname ', fullname)
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
if (fullname !== currentUser.fullname) {
|
|
721
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname !== dshbrdUser.fullname ')
|
|
722
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname ' , fullname)
|
|
723
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname ', currentUser.fullname )
|
|
724
|
+
currentUser.fullname = fullname
|
|
725
|
+
} else {
|
|
726
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname === dshbrdUser.fullname ')
|
|
727
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - currentUser.fullname ' , fullname)
|
|
728
|
+
this.logger.log('[APP-COMP] updateStoredCurrentUser - dshbrdUser.fullname ', currentUser.fullname )
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
this.appStorageService.setItem('currentUser', JSON.stringify(currentUser));
|
|
732
|
+
}
|
|
733
|
+
|
|
662
734
|
/***************************************************+*/
|
|
663
735
|
/**------- AUTHENTICATION FUNCTIONS --> START <--- +*/
|
|
664
736
|
private initAuthentication() {
|
|
@@ -672,6 +744,9 @@ export class AppComponent implements OnInit {
|
|
|
672
744
|
this.logger.log('[APP-COMP] >>> initAuthentication I LOG IN WITH A TOKEN EXISTING IN THE LOCAL STORAGE OR WITH A TOKEN PASSED IN THE URL PARAMETERS <<<')
|
|
673
745
|
this.tiledeskAuthService.signInWithCustomToken(tiledeskToken).then(user => {
|
|
674
746
|
this.logger.log('[APP-COMP] >>> initAuthentication user ', user)
|
|
747
|
+
|
|
748
|
+
this.updateStoredCurrentUser()
|
|
749
|
+
|
|
675
750
|
this.messagingAuthService.createCustomToken(tiledeskToken)
|
|
676
751
|
}).catch(error => {
|
|
677
752
|
this.logger.error('[APP-COMP] initAuthentication SIGNINWITHCUSTOMTOKEN error::', error)
|
|
@@ -1007,7 +1082,7 @@ export class AppComponent implements OnInit {
|
|
|
1007
1082
|
let platformIsNow = PLATFORM_DESKTOP;
|
|
1008
1083
|
if (checkPlatformIsMobile()) {
|
|
1009
1084
|
platformIsNow = PLATFORM_MOBILE;
|
|
1010
|
-
this.logger.log('onResize platformIsNow ', platformIsNow)
|
|
1085
|
+
this.logger.log('onResize platformIsNow ', platformIsNow)
|
|
1011
1086
|
}
|
|
1012
1087
|
if (!this.platformIs || this.platformIs === '') {
|
|
1013
1088
|
this.platformIs = platformIsNow;
|
package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html
CHANGED
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
<!--backgroundColor non viene ancora usato -->
|
|
29
29
|
<tiledeskwidget-bubble-message class="messages msg_sent slide-in-right"
|
|
30
30
|
[ngClass]="{'button-in-msg' : message?.metadata && message?.metadata?.button}"
|
|
31
|
+
[class.chat-text-emoticon]="isEmojii(message?.text)"
|
|
31
32
|
[message]="message"
|
|
32
33
|
[textColor]="'col-msg-sent'"
|
|
33
34
|
(onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
|
|
@@ -54,6 +55,7 @@
|
|
|
54
55
|
|
|
55
56
|
<!--backgroundColor non viene ancora usato -->
|
|
56
57
|
<tiledeskwidget-bubble-message class="messages msg_receive slide-in-left"
|
|
58
|
+
[class.chat-text-emoticon]="isEmojii(message?.text)"
|
|
57
59
|
[message]="message"
|
|
58
60
|
[textColor]="'black'"
|
|
59
61
|
(onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
|
package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { MSG_STATUS_SENT, MSG_STATUS_RETURN_RECEIPT, MSG_STATUS_SENT_SERVER, MAX
|
|
|
5
5
|
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
6
6
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
7
7
|
import { UploadService } from 'src/chat21-core/providers/abstract/upload.service';
|
|
8
|
-
import { isInfo, isMine, messageType } from 'src/chat21-core/utils/utils-message';
|
|
8
|
+
import { isEmojii, isInfo, isMine, messageType } from 'src/chat21-core/utils/utils-message';
|
|
9
9
|
@Component({
|
|
10
10
|
selector: 'tiledeskwidget-conversation-content',
|
|
11
11
|
templateUrl: './conversation-content.component.html',
|
|
@@ -49,6 +49,7 @@ export class ConversationContentComponent implements OnInit {
|
|
|
49
49
|
isMine = isMine;
|
|
50
50
|
isInfo = isInfo;
|
|
51
51
|
messageType = messageType;
|
|
52
|
+
isEmojii = isEmojii;
|
|
52
53
|
|
|
53
54
|
MESSAGE_TYPE_INFO = MESSAGE_TYPE_INFO;
|
|
54
55
|
MESSAGE_TYPE_MINE = MESSAGE_TYPE_MINE;
|
|
@@ -68,9 +68,9 @@
|
|
|
68
68
|
</div>
|
|
69
69
|
</ng-container>
|
|
70
70
|
|
|
71
|
-
<div class="align-center
|
|
72
|
-
class="
|
|
73
|
-
|
|
71
|
+
<div class="align-center ion-text-center msg_info_container" *ngIf="messageType(MESSAGE_TYPE_INFO, message)">
|
|
72
|
+
<chat-info-message class="messages"
|
|
73
|
+
[message]="message">
|
|
74
74
|
</chat-info-message>
|
|
75
75
|
</div>
|
|
76
76
|
|
|
@@ -78,19 +78,25 @@
|
|
|
78
78
|
<div role="messaggio" *ngIf="messageType(MESSAGE_TYPE_MINE, message)" class="msg_container base_sent">
|
|
79
79
|
|
|
80
80
|
<!--backgroundColor non viene ancora usato -->
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
[
|
|
84
|
-
|
|
85
|
-
[message]="message"
|
|
86
|
-
|
|
87
|
-
[addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText"
|
|
81
|
+
<chat-bubble-message class="messages msg_sent" id="message_msg_sent" style="position: relative;"
|
|
82
|
+
[ngClass]="{'has-metadata': (isImage(message) || isFrame(message))}"
|
|
83
|
+
[class.emoticon]="isEmojii_2(message?.text)"
|
|
84
|
+
[ngClass]="{'button-in-msg' : message.metadata && message.metadata.button}"
|
|
85
|
+
[message]="message"
|
|
86
|
+
[textColor]="'col-msg-sent'"
|
|
87
|
+
[addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText"
|
|
88
|
+
[areVisibleCAR]="areVisibleCAR"
|
|
88
89
|
[support_mode]="support_mode"
|
|
89
|
-
|
|
90
|
+
(onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
|
|
91
|
+
(onAfterMessageRender)="returnOnAfterMessageRender($event)"
|
|
92
|
+
(onImageRendered)="onImageRenderedFN($event)">
|
|
90
93
|
</chat-bubble-message>
|
|
91
94
|
|
|
92
95
|
<!-- icon status message -->
|
|
93
|
-
<chat-return-receipt
|
|
96
|
+
<chat-return-receipt
|
|
97
|
+
[status]="message.status"
|
|
98
|
+
[message]="message"
|
|
99
|
+
[senderId]="senderId">
|
|
94
100
|
</chat-return-receipt>
|
|
95
101
|
|
|
96
102
|
</div>
|
|
@@ -112,21 +118,27 @@
|
|
|
112
118
|
|
|
113
119
|
<!--backgroundColor non viene ancora usato -->
|
|
114
120
|
|
|
115
|
-
<chat-bubble-message style="position: relative;"
|
|
116
|
-
[ngClass]="{'has-metadata': (isImage(message) || isFrame(message))}"
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
[addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText"
|
|
121
|
+
<chat-bubble-message class="messages msg_receive" id="message_msg_receive" style="position: relative;"
|
|
122
|
+
[ngClass]="{'has-metadata': (isImage(message) || isFrame(message))}"
|
|
123
|
+
[class.emoticon]="isEmojii_2(message?.text)"
|
|
124
|
+
[message]="message"
|
|
125
|
+
[textColor]="'black'"
|
|
126
|
+
[addAsCannedResponseTooltipText]="addAsCannedResponseTooltipText"
|
|
127
|
+
[areVisibleCAR]="areVisibleCAR"
|
|
121
128
|
[support_mode]="support_mode"
|
|
122
|
-
|
|
129
|
+
(onBeforeMessageRender)="returnOnBeforeMessageRender($event)"
|
|
130
|
+
(onAfterMessageRender)="returnOnAfterMessageRender($event)"
|
|
131
|
+
(onImageRendered)="onImageRenderedFN($event)"
|
|
132
|
+
>
|
|
123
133
|
</chat-bubble-message>
|
|
124
134
|
</div>
|
|
125
135
|
|
|
126
136
|
<!-- message type:: button && -->
|
|
127
137
|
<div *ngIf="message?.attributes && message?.attributes?.attachment " class="slide-in-left">
|
|
128
|
-
<chat-message-attachment style="height: 100%; display: block;"
|
|
129
|
-
[
|
|
138
|
+
<chat-message-attachment style="height: 100%; display: block;"
|
|
139
|
+
[message]="message"
|
|
140
|
+
[isLastMessage]="isLastMessage(message?.uid)"
|
|
141
|
+
[stylesMap]="stylesMap"
|
|
130
142
|
(onAttachmentButtonClicked)="returnOnAttachmentButtonClicked($event)">
|
|
131
143
|
</chat-message-attachment>
|
|
132
144
|
</div>
|
|
@@ -59,9 +59,11 @@ ion-item {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
.message_sender_fullname {
|
|
62
|
-
font-size: 0.
|
|
62
|
+
font-size: 0.9em;
|
|
63
63
|
margin: 0 0 1px 10px;
|
|
64
|
-
color: var(--gray);
|
|
64
|
+
// color: var(--gray);
|
|
65
|
+
font-weight: 500;
|
|
66
|
+
color: #080f1a;
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
.messages {
|
|
@@ -94,7 +96,7 @@ ion-item {
|
|
|
94
96
|
.emoticon {
|
|
95
97
|
background: unset !important;
|
|
96
98
|
font-size: 4em;
|
|
97
|
-
padding-bottom: 21px;
|
|
99
|
+
// padding-bottom: 21px;
|
|
98
100
|
padding-top: 30px;
|
|
99
101
|
}
|
|
100
102
|
.has-metadata {
|
|
@@ -297,13 +299,26 @@ ion-item {
|
|
|
297
299
|
// emoticon
|
|
298
300
|
// ---------------------------------------------------------
|
|
299
301
|
|
|
300
|
-
:host .base_sent .msg_sent ::ng-deep div > div > div > .chat-text-emoticon > p > p {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
}
|
|
302
|
+
// :host .base_sent .msg_sent ::ng-deep div > div > div > .chat-text-emoticon > p > p {
|
|
303
|
+
// margin-bottom: 6px !important;
|
|
304
|
+
// margin-right: -7px !important;
|
|
305
|
+
// }
|
|
306
|
+
|
|
307
|
+
// :host .base_receive .msg_receive ::ng-deep div > div > div > .chat-text-emoticon > p > p {
|
|
308
|
+
// margin-bottom: 41px !important;
|
|
309
|
+
// margin-left: -8px !important;
|
|
310
|
+
// margin-top: 49px !important;
|
|
311
|
+
// }
|
|
312
|
+
|
|
304
313
|
|
|
305
|
-
:host .
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
314
|
+
// :host .base_sent .msg_sent .emoticon ::ng-deep div > div > div > chat-text > p > p {
|
|
315
|
+
// margin-bottom: 38px;
|
|
316
|
+
// }
|
|
317
|
+
|
|
318
|
+
:host .base_sent .emoticon ::ng-deep div > div > div > chat-text > p > p {
|
|
319
|
+
margin-bottom: 38px;
|
|
309
320
|
}
|
|
321
|
+
|
|
322
|
+
:host .base_receive .emoticon ::ng-deep div > div > div > chat-text > p > p {
|
|
323
|
+
margin-bottom: 38px;
|
|
324
|
+
}
|
|
@@ -3,7 +3,7 @@ import { ChangeDetectorRef, Component, Input, OnInit, Output, EventEmitter } fro
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
import { MESSAGE_TYPE_INFO, MESSAGE_TYPE_MINE, MESSAGE_TYPE_OTHERS } from 'src/chat21-core/utils/constants';
|
|
6
|
-
import { isChannelTypeGroup, isFirstMessage, isInfo, isMine, messageType } from 'src/chat21-core/utils/utils-message';
|
|
6
|
+
import { isChannelTypeGroup, isEmojii,isEmojii_2, isFirstMessage, isInfo, isMine, messageType } from 'src/chat21-core/utils/utils-message';
|
|
7
7
|
import { UploadService } from 'src/chat21-core/providers/abstract/upload.service';
|
|
8
8
|
import { isFile, isFrame, isImage } from 'src/chat21-core/utils/utils-message';
|
|
9
9
|
|
|
@@ -41,6 +41,8 @@ export class IonConversationDetailComponent extends ConversationContentComponent
|
|
|
41
41
|
isFirstMessage = isFirstMessage;
|
|
42
42
|
messageType = messageType;
|
|
43
43
|
isChannelTypeGroup = isChannelTypeGroup;
|
|
44
|
+
isEmojii = isEmojii;
|
|
45
|
+
isEmojii_2 =isEmojii_2
|
|
44
46
|
|
|
45
47
|
MESSAGE_TYPE_INFO = MESSAGE_TYPE_INFO;
|
|
46
48
|
MESSAGE_TYPE_MINE = MESSAGE_TYPE_MINE;
|
|
@@ -16,6 +16,7 @@ import { isInArray } from 'src/chat21-core/utils/utils';
|
|
|
16
16
|
// Logger
|
|
17
17
|
import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
|
|
18
18
|
import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
|
|
19
|
+
import { AppStorageService } from 'src/chat21-core/providers/abstract/app-storage.service';
|
|
19
20
|
|
|
20
21
|
@Component({
|
|
21
22
|
selector: 'app-login',
|
|
@@ -39,7 +40,8 @@ export class LoginPage implements OnInit {
|
|
|
39
40
|
private translateService: CustomTranslateService,
|
|
40
41
|
private events: EventsService,
|
|
41
42
|
private loginComponent: LoginComponent,
|
|
42
|
-
public toastController: ToastController
|
|
43
|
+
public toastController: ToastController,
|
|
44
|
+
public appStorageService: AppStorageService
|
|
43
45
|
) { }
|
|
44
46
|
|
|
45
47
|
ngOnInit() {
|
|
@@ -123,6 +125,8 @@ export class LoginPage implements OnInit {
|
|
|
123
125
|
this.tiledeskAuthService.signInWithEmailAndPassword(auth.email, auth.password)
|
|
124
126
|
.then(tiledeskToken => {
|
|
125
127
|
this.messagingAuthService.createCustomToken(tiledeskToken)
|
|
128
|
+
// Here edit stored current user
|
|
129
|
+
// this.updateStoredCurrentUser()
|
|
126
130
|
})
|
|
127
131
|
.catch(error => {
|
|
128
132
|
this.showSpinnerInLoginBtn = false;
|
|
@@ -151,6 +155,13 @@ export class LoginPage implements OnInit {
|
|
|
151
155
|
// this.authService.signInWithEmailAndPassword(auth.email, auth.password);
|
|
152
156
|
}
|
|
153
157
|
|
|
158
|
+
updateStoredCurrentUser() {
|
|
159
|
+
const currentUser = JSON.parse(this.appStorageService.getItem('currentUser'));
|
|
160
|
+
console.log('[LOGIN PAGE] updateStoredCurrentUser - currentUser' , currentUser)
|
|
161
|
+
const dshbrdUser = JSON.parse(localStorage.getItem('user'));
|
|
162
|
+
console.log('[LOGIN PAGE] updateStoredCurrentUser - dshbrdUser' , dshbrdUser)
|
|
163
|
+
}
|
|
164
|
+
|
|
154
165
|
async presentToast(errormsg: string) {
|
|
155
166
|
const toast = await this.toastController.create({
|
|
156
167
|
message: errormsg,
|
|
@@ -962,7 +962,7 @@ class Chat21Client {
|
|
|
962
962
|
}
|
|
963
963
|
if (this.log) {console.log("starting mqtt connection with LWT on:", presence_topic, this.endpoint)}
|
|
964
964
|
// client = mqtt.connect('mqtt://127.0.0.1:15675/ws',options)
|
|
965
|
-
this.client = mqtt.connect(
|
|
965
|
+
this.client = mqtt.connect('a://99.80.197.164:15675/ws',options)
|
|
966
966
|
|
|
967
967
|
this.client.on('connect', // TODO if token is wrong it must reply with an error!
|
|
968
968
|
() => {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"apiUrl": "https://tiledesk-server-pre.herokuapp.com/",
|
|
31
31
|
"baseImageUrl": "https://firebasestorage.googleapis.com/v0/b/",
|
|
32
|
-
"dashboardUrl": "
|
|
32
|
+
"dashboardUrl": "/dashboard/",
|
|
33
33
|
"wsUrl": "wss://tiledesk-server-pre.herokuapp.com/"
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -156,8 +156,7 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
|
|
|
156
156
|
typeMsg,
|
|
157
157
|
attributes,
|
|
158
158
|
channelType,
|
|
159
|
-
false
|
|
160
|
-
isEmojii(msg)
|
|
159
|
+
false
|
|
161
160
|
);
|
|
162
161
|
const messageRef = firebaseMessagesCustomUid.push({
|
|
163
162
|
language: lang,
|
|
@@ -291,7 +290,7 @@ export class FirebaseConversationHandler extends ConversationHandlerService {
|
|
|
291
290
|
msg.isSender = this.isSender(msg.sender, this.loggedUser.uid);
|
|
292
291
|
|
|
293
292
|
//check if message contains only an emojii
|
|
294
|
-
msg.emoticon = isEmojii(msg.text)
|
|
293
|
+
// msg.emoticon = isEmojii(msg.text)
|
|
295
294
|
|
|
296
295
|
// traduco messaggi se sono del server
|
|
297
296
|
if (msg.attributes && msg.attributes.subtype) {
|
|
@@ -17,18 +17,10 @@ export class CustomLogger implements LoggerService {
|
|
|
17
17
|
constructor(private logger: NGXLogger) { }
|
|
18
18
|
|
|
19
19
|
setLoggerConfig(isLogEnabled: boolean, logLevel: string) {
|
|
20
|
-
|
|
21
20
|
this.isLogEnabled = isLogEnabled;
|
|
22
|
-
// console.log('LoggerService this.logLevel ', this.logLevel)
|
|
23
|
-
|
|
24
21
|
if (logLevel) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this.logLevel = LogLevel[logLevel.toUpperCase()];
|
|
28
|
-
// console.log('LoggerService this.logLevel toUpperCase', this.logLevel)
|
|
29
|
-
} else {
|
|
30
|
-
console.error('logLevel is not a string. See the chat21-ionic README.md')
|
|
31
|
-
}
|
|
22
|
+
this.logLevel = LogLevel[logLevel.toUpperCase()];
|
|
23
|
+
console.log('LoggerService this.logLevel ', this.logLevel)
|
|
32
24
|
}
|
|
33
25
|
}
|
|
34
26
|
|
|
@@ -85,25 +85,37 @@ export function messageType(msgType: string, message: any) {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
export function isEmojii_2(message: any){
|
|
89
|
+
// https://localcoder.org/javascript-detect-if-a-string-contains-only-unicode-emojis
|
|
90
|
+
const onlyEmojis = message.replace(new RegExp('[\u0000-\u1eeff]', 'g'), '')
|
|
91
|
+
const visibleChars = message.replace(new RegExp('[\n\r\s]+|( )+', 'g'), '')
|
|
92
|
+
return onlyEmojis.length === visibleChars.length
|
|
93
|
+
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
88
97
|
export function isEmojii(message: any){
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
let fistChar = '';
|
|
98
|
+
|
|
99
|
+
let emoji = '';
|
|
93
100
|
try {
|
|
94
|
-
|
|
101
|
+
emoji = message.trim(); // .charAt(0);
|
|
102
|
+
if (emoji.length > 2) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
95
105
|
} catch (e) {
|
|
96
106
|
return false;
|
|
97
107
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (
|
|
108
|
+
const ranges =['(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|[\ud83c\ude32-\ude3a]|[\ud83c\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])'];
|
|
109
|
+
|
|
110
|
+
if (emoji.match(ranges.join('|'))) {
|
|
101
111
|
return true;
|
|
102
112
|
} else {
|
|
103
113
|
return false;
|
|
104
114
|
}
|
|
105
115
|
}
|
|
106
116
|
|
|
117
|
+
|
|
118
|
+
|
|
107
119
|
/** */
|
|
108
120
|
export function getSizeImg(message: any, maxWidthImage?: number): any {
|
|
109
121
|
try {
|
|
@@ -134,3 +146,5 @@ export function isChannelTypeGroup(channelType: string) {
|
|
|
134
146
|
}
|
|
135
147
|
return false;
|
|
136
148
|
}
|
|
149
|
+
|
|
150
|
+
|