@chat21/chat21-ionic 3.0.78-rc.2 → 3.0.78-rc.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.
Files changed (47) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/package.json +1 -1
  3. package/src/app/app.component.scss +1 -0
  4. package/src/app/app.component.ts +2 -7
  5. package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts +8 -1
  6. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +25 -10
  7. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +62 -39
  8. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +1 -1
  9. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +3 -1
  10. package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.html +5 -1
  11. package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.scss +22 -15
  12. package/src/app/chatlib/conversation-detail/message/buttons/action-button/action-button.component.ts +25 -5
  13. package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.html +2 -1
  14. package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.scss +14 -15
  15. package/src/app/chatlib/conversation-detail/message/buttons/link-button/link-button.component.ts +24 -5
  16. package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.html +6 -1
  17. package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.scss +12 -13
  18. package/src/app/chatlib/conversation-detail/message/buttons/text-button/text-button.component.ts +26 -5
  19. package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.html +16 -6
  20. package/src/app/chatlib/conversation-detail/message/message-attachment/message-attachment.component.ts +2 -0
  21. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +18 -20
  22. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.scss +3 -3
  23. package/src/app/components/canned-response/canned-response.component.html +4 -4
  24. package/src/app/components/canned-response/canned-response.component.scss +1 -1
  25. package/src/app/components/canned-response/canned-response.component.ts +1 -0
  26. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +4 -13
  27. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +5 -2
  28. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +3 -5
  29. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +4 -4
  30. package/src/app/components/ddp-header/ddp-header.component.html +1 -1
  31. package/src/app/components/ddp-header/ddp-header.component.scss +4 -0
  32. package/src/app/components/project-item/project-item.component.html +1 -1
  33. package/src/app/components/project-item/project-item.component.ts +2 -1
  34. package/src/app/components/utils/user-presence/user-presence.component.html +1 -1
  35. package/src/app/pages/conversation-detail/conversation-detail.page.html +14 -5
  36. package/src/app/pages/conversation-detail/conversation-detail.page.scss +1 -1
  37. package/src/app/pages/conversation-detail/conversation-detail.page.ts +103 -20
  38. package/src/app/pages/conversations-list/conversations-list.page.ts +1 -17
  39. package/src/app/pages/loader-preview/loader-preview.page.html +1 -1
  40. package/src/app/pages/loader-preview/loader-preview.page.scss +4 -0
  41. package/src/chat21-core/providers/firebase/firebase-typing.service.ts +7 -9
  42. package/src/chat21-core/utils/constants.ts +4 -0
  43. package/src/chat21-core/utils/user-typing/user-typing.component.html +8 -5
  44. package/src/chat21-core/utils/user-typing/user-typing.component.scss +87 -17
  45. package/src/chat21-core/utils/user-typing/user-typing.component.ts +12 -94
  46. package/src/global.scss +47 -43
  47. package/src/variables.scss +19 -8
@@ -115,15 +115,12 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
115
115
  public openInfoConversation = false
116
116
  public isMobile = false
117
117
  public isLessThan991px = false // nk added
118
- public isTyping = false
119
- public nameUserTypingNow: string
120
118
 
121
119
  public heightMessageTextArea = ''
122
120
  public translationsMap: Map<string, string> = new Map()
123
121
  public translationsHeaderMap: Map<string, string> = new Map()
124
122
  public translationsContentMap: Map<string, string> = new Map()
125
123
  public conversationAvatar: any
126
- public membersConversation: any
127
124
  public member: UserModel
128
125
  public urlConversationSupportGroup: any
129
126
  public isFileSelected: boolean
@@ -169,6 +166,15 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
169
166
  public disableTextarea: boolean;
170
167
  appsidebarIsWide: boolean;
171
168
 
169
+ // ========== begin:: typying =======
170
+ public isTypings = false;
171
+ public isDirect = false;
172
+ public idUserTypingNow: string;
173
+ public nameUserTypingNow: string;
174
+ private setTimeoutWritingMessages;
175
+ membersConversation = ['SYSTEM'];
176
+ // ========== end:: typying =======
177
+
172
178
  /**
173
179
  * Constructor
174
180
  * @param route
@@ -237,21 +243,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
237
243
  // -----------------------------------------------------------
238
244
  ngOnInit() {
239
245
  this.logger.log('[CONVS-DETAIL] > ngOnInit - window.location: ', window.location);
240
- // this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept: ', this.appConfigProvider.getConfig().fileUploadAccept);
241
- // const accept_files = this.appConfigProvider.getConfig().fileUploadAccept;
242
- // this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept typeof accept_files ', typeof accept_files);
243
- // const accept_files_array = accept_files.split(',')
244
- // this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept accept_files_array ', accept_files_array);
245
- // this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept accept_files_array typeof: ', typeof accept_files_array);
246
-
247
- // accept_files_array.forEach(accept_file => {
248
- // this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept accept_file ', accept_file);
249
- // const accept_file_segment = accept_file.split('/')
250
- // this.logger.log('[CONVS-DETAIL] > ngOnInit - fileUploadAccept accept_file_segment ', accept_file_segment);
251
- // if (accept_file_segment[1] === '*') {
252
-
253
- // }
254
- // });
246
+
255
247
  this.getConversations();
256
248
  this.watchToConnectionStatus();
257
249
  this.getOSCODE();
@@ -479,6 +471,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
479
471
  this.loggedUser = this.tiledeskAuthService.getCurrentUser()
480
472
  this.logger.log('[CONVS-DETAIL] - initialize -> loggedUser: ', this.loggedUser)
481
473
  this.translations()
474
+ this.setStyleMap()
482
475
  // this.conversationSelected = localStorage.getItem('conversationSelected');
483
476
  this.showButtonToBottom = false
484
477
  this.showMessageWelcome = false
@@ -531,6 +524,8 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
531
524
  this.addEventsKeyboard()
532
525
  this.startConversation()
533
526
  this.updateConversationBadge() // AGGIORNO STATO DELLA CONVERSAZIONE A 'LETTA' (is_new = false)
527
+
528
+ this.initializeTyping();
534
529
  }
535
530
 
536
531
  _getProjectIdByConversationWith(conversationWith: string) {
@@ -589,7 +584,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
589
584
  'LABEL_TO',
590
585
  'LABEL_LAST_ACCESS',
591
586
  'ARRAY_DAYS',
592
- 'LABEL_IS_WRITING',
587
+
593
588
  'LABEL_INFO_ADVANCED',
594
589
  'ID_CONVERSATION',
595
590
  'UPLOAD_FILE_ERROR',
@@ -625,11 +620,13 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
625
620
  'LABEL_TO',
626
621
  'LABEL_LAST_ACCESS',
627
622
  'ARRAY_DAYS',
623
+ 'Resolve',
628
624
  ]
629
625
 
630
626
  const keysContentDetail = [
631
627
  'LABEL_OPEN_INFO_CONVERSATION',
632
- 'LABEL_CLOSE_GROUP'
628
+ 'LABEL_CLOSE_GROUP',
629
+ 'LABEL_IS_WRITING',
633
630
  ]
634
631
 
635
632
  this.translationsMap = this.customTranslateService.translateLanguage(keys)
@@ -662,6 +659,19 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
662
659
  return this.customTranslateService.translateLanguage(keys)
663
660
  }
664
661
 
662
+ private setStyleMap(){
663
+ this.styleMap.set('themeColor', 'var(--basic-blue)')
664
+ .set('bubbleReceivedBackground','var(--bck-msg-received)')
665
+ .set('bubbleReceivedTextColor', 'var(--col-msg-received)')
666
+ .set('bubbleSentBackground', 'var(--bck-msg-sent)')
667
+ .set('bubbleSentTextColor', 'var(--col-msg-sent)')
668
+ .set('buttonFontSize','var(--button-in-msg-font-size)')
669
+ .set('buttonBackgroundColor', 'var(--buttonBackgroundColor)')
670
+ .set('buttonTextColor', 'var(--buttonTextColor)')
671
+ .set('buttonHoverBackgroundColor', 'var(--buttonHoverBackgroundColor)')
672
+ .set('buttonHoverTextColor', 'var(--buttonHoverTextColor)')
673
+
674
+ }
665
675
  // -------------------------------------------------------------------------------------
666
676
  // * retrieving the handler from chatManager
667
677
  // * if it DOESN'T EXIST I create a handler and connect and store it in the chatmanager
@@ -1000,6 +1010,22 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1000
1010
  this.subscriptions.push(subscribe)
1001
1011
  }
1002
1012
 
1013
+ subscriptionKey = 'conversationTyping';
1014
+ subscription = this.subscriptions.find(item => item.key === subscriptionKey);
1015
+ if (!subscription) {
1016
+ subscription = this.typingService.BSIsTyping.pipe(takeUntil(this.unsubscribe$)).subscribe((data: any) => {
1017
+ this.logger.debug('[CONVS-DETAIL] ***** BSIsTyping *****', data);
1018
+ if (data) {
1019
+ const isTypingUid = data.uid; //support-group-...
1020
+ if (this.conversationWith === isTypingUid) {
1021
+ that.subscribeTypings(data);
1022
+ }
1023
+ }
1024
+ });
1025
+ const subscribe = {key: subscriptionKey, value: subscription };
1026
+ this.subscriptions.push(subscribe);
1027
+ }
1028
+
1003
1029
  // subscriptionKey = 'onGroupChange';
1004
1030
  // subscription = this.subscriptions.find(item => item.key === subscriptionKey);
1005
1031
  // if (!subscription) {
@@ -1684,6 +1710,63 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
1684
1710
  return isAcceptFile
1685
1711
  }
1686
1712
  }
1713
+
1714
+
1715
+ initializeTyping() {
1716
+ this.logger.debug('[CONVS-DETAIL] membersconversation', this.membersConversation)
1717
+ this.membersConversation.push(this.loggedUser.uid)
1718
+ //this.setSubscriptions();
1719
+ this.typingService.isTyping(this.conversationWith, this.loggedUser.uid, this.isDirect);
1720
+
1721
+ }
1722
+
1723
+ /** */
1724
+ subscribeTypings(data: any) {
1725
+ const that = this;
1726
+ try {
1727
+ const key = data.uidUserTypingNow;
1728
+ const waitTime = data.waitTime
1729
+ this.nameUserTypingNow = null;
1730
+ this.idUserTypingNow = null;
1731
+
1732
+ if (data.nameUserTypingNow) {
1733
+ this.nameUserTypingNow = data.nameUserTypingNow;
1734
+ }
1735
+ if (data.uidUserTypingNow){
1736
+ this.idUserTypingNow = data.uidUserTypingNow
1737
+ }
1738
+ this.logger.debug('[CONV-COMP] subscribeTypings data:', data);
1739
+ const userTyping = this.membersConversation.includes(key);
1740
+ if ( !userTyping && key) {
1741
+ this.isTypings = true;
1742
+ setTimeout(function () {
1743
+ that.scrollBottom(0)
1744
+ }, 0);
1745
+ // clearTimeout(this.setTimeoutWritingMessages);
1746
+ this.setTimeoutWritingMessages = setTimeout(() => {
1747
+ that.isTypings = false;
1748
+ }, waitTime);
1749
+ // this.initiTimeout(waitTime)
1750
+ }
1751
+ } catch (error) {
1752
+ this.logger.error('[CONV-COMP] error: ', error);
1753
+ }
1754
+
1755
+ }
1756
+
1757
+ initiTimeout(waitTime){
1758
+ const that = this;
1759
+ this.setTimeoutWritingMessages = setTimeout(() => {
1760
+ that.isTypings = false;
1761
+ }, waitTime);
1762
+ }
1763
+
1764
+ resetTimeout(){
1765
+ this.isTypings = false
1766
+ this.setTimeoutWritingMessages = null;
1767
+ clearTimeout(this.setTimeoutWritingMessages)
1768
+ }
1769
+
1687
1770
  // -------------------------------------------------------------
1688
1771
  // DRAG FILE
1689
1772
  // -------------------------------------------------------------
@@ -502,22 +502,6 @@ export class ConversationListPage implements OnInit {
502
502
  this.logger.log('[CONVS-LIST-PAGE] - subscribeLoggedUserLogout uidConvSelected ',this.uidConvSelected)
503
503
  }
504
504
 
505
- // ------------------------------------------------------------------------------------
506
- // @ SUBSCRIBE TO CONVERSATION CHANGED ??????????? SEEMS NOT USED ?????????????????
507
- // ------------------------------------------------------------------------------------
508
- conversationsChanged = (conversations: ConversationModel[]) => {
509
- this.numberOpenConv = this.conversationsHandlerService.countIsNew()
510
- this.logger.log('[CONVS-LIST-PAGE] - conversationsChanged - NUMB OF CONVERSATIONS: ',this.numberOpenConv)
511
- // console.log('conversationsChanged »»»»»»»»» uidConvSelected', that.conversations[0], that.uidConvSelected);
512
- if (this.uidConvSelected && !this.conversationSelected) {
513
- const conversationSelected = this.conversations.find((item) => item.uid === this.uidConvSelected)
514
- if (conversationSelected) {
515
- this.conversationSelected = conversationSelected
516
- this.setUidConvSelected(this.uidConvSelected)
517
- }
518
- }
519
- }
520
-
521
505
  /**
522
506
  * ::: subscribeChangedConversationSelected :::
523
507
  * evento richiamato quando si seleziona un utente nell'elenco degli user
@@ -654,7 +638,7 @@ export class ConversationListPage implements OnInit {
654
638
  * ::: setUidConvSelected :::
655
639
  */
656
640
  setUidConvSelected(uidConvSelected: string, conversationType?: string) {
657
- this.logger.log('[CONVS-LIST-PAGE] setuidCOnvSelected', uidConvSelected)
641
+ this.logger.log('[CONVS-LIST-PAGE] setuidCOnvSelected', uidConvSelected, conversationType)
658
642
  this.uidConvSelected = uidConvSelected
659
643
  // this.conversationsHandlerService.uidConvSelected = uidConvSelected;
660
644
  if (uidConvSelected) {
@@ -55,7 +55,7 @@
55
55
 
56
56
  <!-- fab placed to the (vertical) center and end -->
57
57
  <ion-fab vertical="end" horizontal="end" slot="fixed" class="sendButton">
58
- <ion-fab-button color="primary" (click)="onSendMessage()">
58
+ <ion-fab-button (click)="onSendMessage()">
59
59
  <ion-icon name="send"></ion-icon>
60
60
  </ion-fab-button>
61
61
  </ion-fab>
@@ -11,6 +11,10 @@
11
11
  transform: translateX(-50%);
12
12
  }
13
13
 
14
+ ion-fab-button{
15
+ --background: var(--basic-blue);
16
+ }
17
+
14
18
  .previewSelected {
15
19
  width: 100%;
16
20
  height: auto;
@@ -12,11 +12,11 @@ import 'firebase/database';
12
12
  import { TypingService } from '../abstract/typing.service';
13
13
  import { CustomLogger } from '../logger/customLogger';
14
14
  import { LoggerInstance } from '../logger/loggerInstance';
15
+ import { TIME_TYPING_MESSAGE } from 'src/chat21-core/utils/constants';
15
16
 
16
17
 
17
18
  export class TypingModel {
18
19
 
19
-
20
20
  constructor(
21
21
  public uid: string,
22
22
  public timestamp: any,
@@ -35,14 +35,11 @@ export class FirebaseTypingService extends TypingService {
35
35
  BSIsTyping: BehaviorSubject<any> = new BehaviorSubject<any>(null);
36
36
  BSSetTyping: BehaviorSubject<any> = new BehaviorSubject<any>(null);
37
37
 
38
- // public params
39
- // public tenant: string;
40
- private tenant: string;
41
-
42
- // private params
43
38
  private urlNodeTypings: string;
44
39
  private setTimeoutWritingMessages: any;
40
+ private tenant: string;
45
41
  private logger: LoggerService = LoggerInstance.getInstance();
42
+ private ref: firebase.database.Query;
46
43
 
47
44
  constructor() {
48
45
  super();
@@ -64,10 +61,11 @@ export class FirebaseTypingService extends TypingService {
64
61
  urlTyping = this.urlNodeTypings + idCurrentUser + '/' + idConversation;
65
62
  }
66
63
  this.logger.debug('[FIREBASETypingSERVICE] urlTyping: ', urlTyping);
67
- const ref = firebase.database().ref(urlTyping);
68
- ref.on('child_changed', (childSnapshot) => {
64
+ this.ref = firebase.database().ref(urlTyping);
65
+ this.ref.on('child_changed', (childSnapshot) => {
69
66
  const precence: TypingModel = childSnapshot.val();
70
- this.BSIsTyping.next({uid: idConversation, uidUserTypingNow: precence.uid, nameUserTypingNow: precence.name});
67
+ this.logger.debug('[FIREBASETypingSERVICE] child_changed: ', precence);
68
+ this.BSIsTyping.next({uid: idConversation, uidUserTypingNow: precence.uid, nameUserTypingNow: precence.name, waitTime: TIME_TYPING_MESSAGE});
71
69
  });
72
70
  }
73
71
 
@@ -43,8 +43,12 @@ export const CHANNEL_TYPE_GROUP = 'group';
43
43
  // TYPES MESSAGES
44
44
  export const TYPE_MSG_TEXT = 'text';
45
45
  export const TYPE_MSG_IMAGE = 'image';
46
+ export const TYPE_MSG_FILE = 'file';
47
+ export const TYPE_MSG_BUTTON = 'button';
48
+
46
49
  export const MAX_WIDTH_IMAGES = 300;
47
50
  export const MIN_WIDTH_IMAGES = 130;
51
+ export const TIME_TYPING_MESSAGE = 2000;
48
52
  export const TYPE_DIRECT = 'direct';
49
53
  export const TYPE_GROUP = 'group';
50
54
  export const SYSTEM = 'system';
@@ -1,6 +1,9 @@
1
- <div class="tile-typing-now" [class.active]="isTyping">
2
- <span *ngIf="nameUserTypingNow">
3
- {{nameUserTypingNow}}
4
- </span>
5
- {{ translationMap?.get('LABEL_IS_WRITING') }}
1
+ <div class="tile-typing-now" *ngIf="typingLocation === 'header'">
2
+ <span *ngIf="nameUserTypingNow">{{nameUserTypingNow}} </span>
3
+ {{ translationMap?.get('LABEL_WRITING') }}
4
+ </div>
5
+ <div class="spinner" *ngIf="typingLocation === 'content'">
6
+ <div class="bounce1"></div>
7
+ <div class="bounce2"></div>
8
+ <div class="bounce3"></div>
6
9
  </div>
@@ -1,10 +1,24 @@
1
+ :root {
2
+ --themeColor: rgb(240, 242, 247);
3
+ --foregroundColor: black;
4
+ }
5
+
6
+
1
7
  .tile-typing-now {
2
- font-size: 12px;
3
- background-color: #fff;
4
- display: none;
5
- &.active {
6
- display: block;
7
- }
8
+ position: absolute;
9
+ left: 40px;
10
+ right: 40px;
11
+ bottom: 3px;
12
+ width: auto;
13
+ text-align: center;
14
+ margin: 0px;
15
+ padding: 0px;
16
+ font-size: 1.1em;
17
+ color: var(--foregroundColor);
18
+ //display: none;
19
+ // &.active {
20
+ // display: block;
21
+ // }
8
22
  }
9
23
 
10
24
  /* BEGIN LOADING */
@@ -14,49 +28,105 @@
14
28
  left: 0;
15
29
  top: 0;
16
30
  margin: 0;
17
- &.active {
18
- display: inline-block;
19
- width: 30px;
20
- }
31
+ // &.active {
32
+ // display: inline-block;
33
+ // width: 30px;
34
+ // }
21
35
  }
22
36
  #tile-spinner > div {
23
37
  width: 6px;
24
38
  height: 6px;
25
39
  background-color: var(--basic-blue);
26
40
  }
41
+ // .spinner {
42
+ // margin: 100px auto 0;
43
+ // width: 70px;
44
+ // text-align: center;
45
+ // }
46
+ // .spinner > div {
47
+ // width: 18px;
48
+ // height: 18px;
49
+ // background-color: #333;
50
+ // border-radius: 100%;
51
+ // display: inline-block;
52
+ // -webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
53
+ // animation: sk-bouncedelay 1.4s infinite ease-in-out both;
54
+ // }
55
+ // .spinner .bounce1 {
56
+ // -webkit-animation-delay: -0.32s;
57
+ // animation-delay: -0.32s;
58
+ // }
59
+ // .spinner .bounce2 {
60
+ // -webkit-animation-delay: -0.16s;
61
+ // animation-delay: -0.16s;
62
+ // }
63
+ // @-webkit-keyframes sk-bouncedelay {
64
+ // 0%, 80%, 100% { -webkit-transform: scale(0) }
65
+ // 40% { -webkit-transform: scale(1.0) }
66
+ // }
67
+ // @keyframes sk-bouncedelay {
68
+ // 0%, 80%, 100% {
69
+ // -webkit-transform: scale(0);
70
+ // transform: scale(0);
71
+ // } 40% {
72
+ // -webkit-transform: scale(1.0);
73
+ // transform: scale(1.0);
74
+ // }
75
+ // }
76
+ /* END LOADING */
77
+
78
+
79
+ /* ******BOUNCE SPINNER START****** */
27
80
  .spinner {
28
- margin: 100px auto 0;
81
+ margin: 15px 10px; //remove it if activate avatar image
29
82
  width: 70px;
30
- text-align: center;
83
+ // text-align: center;
84
+ min-height: 20px;
85
+ display: block;
31
86
  }
87
+
32
88
  .spinner > div {
33
- width: 18px;
34
- height: 18px;
89
+ width: 9px;
90
+ height: 9px;
35
91
  background-color: #333;
92
+
36
93
  border-radius: 100%;
37
94
  display: inline-block;
38
95
  -webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
39
96
  animation: sk-bouncedelay 1.4s infinite ease-in-out both;
40
97
  }
98
+
41
99
  .spinner .bounce1 {
42
100
  -webkit-animation-delay: -0.32s;
43
101
  animation-delay: -0.32s;
102
+ background-color: var(--themeColor)
44
103
  }
104
+
45
105
  .spinner .bounce2 {
46
106
  -webkit-animation-delay: -0.16s;
47
107
  animation-delay: -0.16s;
108
+ background-color: var(--themeColor);
109
+ opacity: 0.4
48
110
  }
111
+
112
+ .spinner .bounce3 {
113
+ background-color: var(--themeColor);
114
+ opacity: 0.6
115
+ }
116
+
117
+
49
118
  @-webkit-keyframes sk-bouncedelay {
50
119
  0%, 80%, 100% { -webkit-transform: scale(0) }
51
120
  40% { -webkit-transform: scale(1.0) }
52
121
  }
122
+
53
123
  @keyframes sk-bouncedelay {
54
124
  0%, 80%, 100% {
55
- -webkit-transform: scale(0);
56
- transform: scale(0);
125
+ -webkit-transform: scale(0);
126
+ transform: scale(0);
57
127
  } 40% {
58
128
  -webkit-transform: scale(1.0);
59
129
  transform: scale(1.0);
60
130
  }
61
131
  }
62
- /* END LOADING */
132
+ /* ******BOUNCE SPINNER END****** */
@@ -1,113 +1,31 @@
1
- import { Component, OnInit, OnDestroy, Input } from '@angular/core';
2
-
3
- // services
4
- import { TypingService } from '../../providers/abstract/typing.service';
5
-
6
- // Logger
7
- import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
8
- import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
1
+ import { Component, OnInit, OnDestroy, Input, ElementRef } from '@angular/core';
9
2
 
10
3
  @Component({
11
- selector: 'app-user-typing',
4
+ selector: 'user-typing',
12
5
  templateUrl: './user-typing.component.html',
13
6
  styleUrls: ['./user-typing.component.scss'],
14
7
  })
15
8
  export class UserTypingComponent implements OnInit, OnDestroy {
16
9
 
17
- @Input() idConversation: string;
18
- @Input() idCurrentUser: string;
19
- @Input() isDirect: boolean;
10
+ // @Input() idConversation: string;
11
+ // @Input() idCurrentUser: string;
12
+ // @Input() isDirect: boolean;
13
+ @Input() typingLocation: string = 'content'
20
14
  @Input() translationMap: Map<string, string>;
21
- @Input() color: string;
22
- @Input() membersConversation: [string];
23
-
24
- public status = '';
25
- public isTyping = false;
26
- public nameUserTypingNow: string;
27
-
28
- private setTimeoutWritingMessages: any;
29
- private subscriptions = [];
30
-
31
- private logger: LoggerService = LoggerInstance.getInstance();
15
+ @Input() themeColor: string;
16
+ @Input() idUserTypingNow: string;
17
+ @Input() nameUserTypingNow: string;
18
+ // @Input() membersConversation: [string];
32
19
 
33
- constructor(
34
- public typingService: TypingService
35
- ) { }
20
+ constructor(private elementRef: ElementRef) { }
36
21
 
37
22
  /** */
38
23
  ngOnInit() {
39
- this.logger.log('[USER-TYPING-COMPONENT] - ngOnInit');
40
- this.initialize();
24
+ this.elementRef.nativeElement.style.setProperty('--themeColor', this.themeColor);
41
25
  }
42
26
 
43
27
  /** */
44
28
  ngOnDestroy() {
45
- this.logger.log('UserTypingComponent - ngOnDestroy');
46
- // this.unsubescribeAll();
47
- }
48
-
49
- /** */
50
- initialize() {
51
- this.status = ''; // this.translationMap.get('LABEL_AVAILABLE');
52
- this.logger.log('this.translationMap', this.translationMap);
53
- this.logger.log('this.status', this.status);
54
- this.setSubscriptions();
55
- this.typingService.isTyping(this.idConversation, this.idCurrentUser, this.isDirect);
56
- }
57
-
58
- /** */
59
- private setSubscriptions() {
60
- const that = this;
61
- const conversationSelected = this.subscriptions.find(item => item.key === this.idConversation);
62
- if (!conversationSelected) {
63
- const subscribeBSIsTyping = this.typingService.BSIsTyping.subscribe((data: any) => {
64
- this.logger.log('***** BSIsTyping *****', data);
65
- if (data) {
66
- const isTypingUid = data.uid;
67
- if (this.idConversation === isTypingUid) {
68
- that.subscribeTypings(data);
69
- }
70
- }
71
- });
72
- const subscribe = {key: this.idConversation, value: subscribeBSIsTyping };
73
- this.subscriptions.push(subscribe);
74
- }
75
- }
76
-
77
- /** */
78
- subscribeTypings(data: any) {
79
- const that = this;
80
- try {
81
- const key = data.uidUserTypingNow;
82
- this.nameUserTypingNow = null;
83
- if (data.nameUserTypingNow) {
84
- this.nameUserTypingNow = data.nameUserTypingNow;
85
- }
86
- this.logger.log('subscribeTypings data:', data);
87
- const userTyping = this.membersConversation.includes(key);
88
- if ( !userTyping ) {
89
- this.isTyping = true;
90
- this.logger.log('child_changed key', key);
91
- this.logger.log('child_changed name', this.nameUserTypingNow);
92
- clearTimeout(this.setTimeoutWritingMessages);
93
- this.setTimeoutWritingMessages = setTimeout(() => {
94
- that.isTyping = false;
95
- }, 2000);
96
- }
97
- } catch (error) {
98
- this.logger.log('error: ', error);
99
- }
100
- }
101
-
102
-
103
- /** */
104
- private unsubescribeAll() {
105
- this.logger.log('UserTypingComponent unsubescribeAll: ', this.subscriptions);
106
- this.subscriptions.forEach((subscription: any) => {
107
- this.logger.log('unsubescribe: ', subscription);
108
- subscription.unsubescribe();
109
- });
110
- this.subscriptions = [];
111
29
  }
112
30
 
113
31