@chat21/chat21-ionic 3.0.64 → 3.0.65-rc1

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 (38) hide show
  1. package/CHANGELOG.md +16 -2
  2. package/deploy_amazon_prod.sh +2 -1
  3. package/deploy_pre.sh +39 -6
  4. package/deploy_prod.sh +3 -0
  5. package/package.json +6 -1
  6. package/publiccode.yml +110 -0
  7. package/src/app/app.component.ts +50 -57
  8. package/src/app/app.module.ts +1 -0
  9. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +2 -2
  10. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +0 -1
  11. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +2 -39
  12. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +18 -6
  13. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +2 -2
  14. package/src/app/chatlib/conversation-detail/message/html/html.component.html +1 -0
  15. package/src/app/chatlib/conversation-detail/message/html/html.component.scss +79 -0
  16. package/src/app/chatlib/conversation-detail/message/html/html.component.spec.ts +25 -0
  17. package/src/app/chatlib/conversation-detail/message/html/html.component.ts +33 -0
  18. package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.ts +0 -1
  19. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +1 -1
  20. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +19 -0
  21. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component_2.html +116 -0
  22. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +2 -2
  23. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +2 -2
  24. package/src/app/directives/safe-html.pipe.ts +2 -2
  25. package/src/app/directives/truncate.pipe.spec.ts +8 -0
  26. package/src/app/directives/truncate.pipe.ts +16 -0
  27. package/src/app/pages/conversation-detail/conversation-detail.module.ts +3 -2
  28. package/src/app/pages/conversation-detail/conversation-detail.page.html +4 -2
  29. package/src/app/pages/conversation-detail/conversation-detail.page.ts +12 -23
  30. package/src/app/pages/conversations-list/conversations-list.page.html +21 -12
  31. package/src/app/pages/conversations-list/conversations-list.page.ts +104 -366
  32. package/src/app/pages/loader-preview/loader-preview.module.ts +1 -2
  33. package/src/app/shared/shared.module.ts +4 -0
  34. package/src/assets/js/chat21client.js +1 -1
  35. package/src/chat21-core/models/conversation.ts +1 -1
  36. package/src/chat21-core/providers/abstract/conversations-handler.service.ts +1 -1
  37. package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +47 -8
  38. package/src/chat21-core/utils/utils-message.ts +2 -3
@@ -7,7 +7,6 @@ import { LoaderPreviewPage } from './loader-preview.page';
7
7
  import { TranslateLoader, TranslateModule} from '@ngx-translate/core';
8
8
  import { createTranslateLoader } from '../../../chat21-core/utils/utils';
9
9
  import { HttpClient } from '@angular/common/http';
10
- import { SafeHtmlPipe } from 'src/app/directives/safe-html.pipe';
11
10
 
12
11
 
13
12
  @NgModule({
@@ -24,6 +23,6 @@ import { SafeHtmlPipe } from 'src/app/directives/safe-html.pipe';
24
23
  }
25
24
  })
26
25
  ],
27
- declarations: [LoaderPreviewPage, SafeHtmlPipe]
26
+ declarations: [LoaderPreviewPage]
28
27
  })
29
28
  export class LoaderPreviewPageModule {}
@@ -1,3 +1,4 @@
1
+ import { HtmlComponent } from './../chatlib/conversation-detail/message/html/html.component';
1
2
  import { BubbleOthersMessageComponent } from './../components/conversation-detail/bubble-others-message/bubble-others-message.component';
2
3
 
3
4
  import { TextComponent } from '../chatlib/conversation-detail/message/text/text.component';
@@ -46,6 +47,7 @@ import { DefaultTooltipOptions } from 'src/chat21-core/utils/utils';
46
47
  import { MatTooltipModule } from '@angular/material/tooltip';
47
48
  import { MatSnackBarModule } from '@angular/material/snack-bar';
48
49
  import { MatSlideToggleModule } from '@angular/material/slide-toggle';
50
+ import { SafeHtmlPipe } from '../directives/safe-html.pipe';
49
51
 
50
52
  // import { MessageTextAreaComponent } from '../components/conversation-detail/message-text-area/message-text-area.component'; // MessageTextAreaComponent is part of the declarations ConversationDetailPageModule
51
53
 
@@ -75,6 +77,7 @@ import { MatSlideToggleModule } from '@angular/material/slide-toggle';
75
77
  InfoMessageComponent,
76
78
  ReturnReceiptComponent,
77
79
  TextComponent,
80
+ HtmlComponent,
78
81
  BubbleDayMessageComponent,
79
82
  BubbleSystemMessageComponent,
80
83
  BubbleMyMessageComponent,
@@ -87,6 +90,7 @@ import { MatSlideToggleModule } from '@angular/material/slide-toggle';
87
90
  MarkedPipe,
88
91
  AutofocusDirective,
89
92
  HtmlEntitiesEncodePipe,
93
+ SafeHtmlPipe,
90
94
  OptionHeaderComponent
91
95
  ],
92
96
  exports: [
@@ -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('a://99.80.197.164:15675/ws',options)
965
+ this.client = mqtt.connect(this.endpoint,options)
966
966
 
967
967
  this.client.on('connect', // TODO if token is wrong it must reply with an error!
968
968
  () => {
@@ -15,7 +15,7 @@ export class ConversationModel {
15
15
  public senderAuthInfo: any,
16
16
  public sender_fullname: string,
17
17
  public status: string,
18
- public timestamp: string,
18
+ public timestamp: number,
19
19
  public time_last_message: string,
20
20
  public selected: boolean,
21
21
  public color: string,
@@ -29,7 +29,7 @@ export abstract class ConversationsHandlerService {
29
29
  // functions
30
30
  abstract initialize(tenant: string, userId: string, translationMap: Map<string, string>): void;
31
31
  // abstract connect(): void;
32
- abstract subscribeToConversations(callback: any): void;
32
+ abstract subscribeToConversations(lastConversatioTimestamp: number, callback: any): void;
33
33
  abstract countIsNew(): number;
34
34
  abstract setConversationRead(conversationId: string): void;
35
35
  abstract dispose(): void;
@@ -114,21 +114,62 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
114
114
  // ---------------------------------------------------------------------------------
115
115
  // New connect - renamed subscribeToConversation
116
116
  //----------------------------------------------------------------------------------
117
- subscribeToConversations(callback) {
117
+ subscribeToConversations(lastConversationTimestamp: number, callback) {
118
118
  const that = this;
119
119
  const urlNodeFirebase = conversationsPathForUserId(this.tenant, this.loggedUserId);
120
120
  this.logger.debug('[FIREBASEConversationsHandlerSERVICE] SubscribeToConversations conversations::ACTIVE urlNodeFirebase', urlNodeFirebase)
121
121
  this.ref = firebase.database().ref(urlNodeFirebase).orderByChild('timestamp').limitToLast(200);
122
- this.ref.on('child_changed', (childSnapshot) => {
122
+
123
+ // this.ref.once('value').then(snapshot => {
124
+ // snapshot.forEach(childSnapshot => {
125
+ // const childData: ConversationModel = childSnapshot.val();
126
+ // childData.uid = childSnapshot.key
127
+ // that.added(childData)
128
+ // lastConversationTimestamp = childData.timestamp
129
+ // });
130
+
131
+ // callback(that.conversations)
132
+ // return lastConversationTimestamp
133
+ // }).then((timestamp)=> {
134
+ // console.log('timestampppppp',timestamp)
135
+ // this.ref.startAt(timestamp).on('child_changed', (childSnapshot) => {
136
+ // const conv: ConversationModel = childSnapshot.val();
137
+ // conv.uid = childSnapshot.key
138
+ // that.changed(conv);
139
+ // });
140
+ // this.ref.startAt(timestamp).on('child_removed', (childSnapshot) => {
141
+ // const conv: ConversationModel = childSnapshot.val();
142
+ // conv.uid = childSnapshot.key
143
+ // that.removed(conv);
144
+ // });
145
+ // this.ref.startAt(timestamp).on('child_added', (childSnapshot) => {
146
+ // const conv: ConversationModel = childSnapshot.val();
147
+ // console.log('addedddd', conv)
148
+ // conv.uid = childSnapshot.key
149
+ // that.added(conv);
150
+ // });
151
+ // });
152
+ // this.ref.on('value', (snaps) => {
153
+ // if(snaps){
154
+ // console.log('convvvvvv', snaps.val(), snaps.val().length)
155
+ // for(let item=0; item<snaps.val().length; item++){
156
+ // that.added(snaps.val()[item])
157
+ // }
158
+ // callback(this.conversations)
159
+ // }
160
+ // })
161
+ this.ref.startAt(lastConversationTimestamp).on('child_changed', (childSnapshot) => {
123
162
  that.changed(childSnapshot);
124
163
  });
125
- this.ref.on('child_removed', (childSnapshot) => {
164
+ this.ref.startAt(lastConversationTimestamp).on('child_removed', (childSnapshot) => {
126
165
  that.removed(childSnapshot);
127
166
  });
128
- this.ref.on('child_added', (childSnapshot) => {
167
+ this.ref.startAt(lastConversationTimestamp).on('child_added', (childSnapshot) => {
129
168
  that.added(childSnapshot);
130
169
  });
131
170
 
171
+
172
+
132
173
  setTimeout(() => {
133
174
  callback()
134
175
  }, 2000);
@@ -339,7 +380,7 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
339
380
  childData.uid = childSnapshot.key;
340
381
  const conversation = this.completeConversation(childData);
341
382
  if (this.isValidConversation(conversation)) {
342
- this.setClosingConversation(childSnapshot.key, false);
383
+ this.setClosingConversation(conversation.uid, false);
343
384
  const index = searchIndexInArrayForUid(this.conversations, conversation.uid);
344
385
  if (index > -1) {
345
386
  this.conversations.splice(index, 1, conversation);
@@ -491,7 +532,6 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
491
532
  this.translateInfoSupportMessages(conv);
492
533
  }
493
534
  }
494
-
495
535
  // Fixes the bug: if a snippet of code is pasted and sent it is not displayed correctly in the convesations list
496
536
  // conv.time_last_message = this.getTimeLastMessage(conv.timestamp);
497
537
  conv.conversation_with = conversation_with;
@@ -503,7 +543,7 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
503
543
  // getImageUrlThumbFromFirebasestorage(conversation_with, this.FIREBASESTORAGE_BASE_URL_IMAGE, this.urlStorageBucket);
504
544
  return conv;
505
545
  }
506
-
546
+
507
547
 
508
548
  /**BUG-FIX: on Conversation-list, when conversation start, it continuosly change the sender_fullname info from Guest to others name */
509
549
  private changeSenderFullName(conversation: ConversationModel): string {
@@ -520,7 +560,6 @@ export class FirebaseConversationsHandler extends ConversationsHandlerService {
520
560
  return conversation_with_fullname
521
561
  }
522
562
 
523
-
524
563
  translateInfoSupportMessages(conv) {
525
564
  const INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU = this.translationMap.get('INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU');
526
565
  // console.log('[FIREBASEConversationsHandlerSERVICE] INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU', INFO_A_NEW_SUPPORT_REQUEST_HAS_BEEN_ASSIGNED_TO_YOU)
@@ -85,9 +85,8 @@ export function messageType(msgType: string, message: any) {
85
85
  }
86
86
  }
87
87
 
88
- export function isEmojii(message: any) {
89
- // https://localcoder.org/javascript-detect-if-a-string-contains-only-unicode-emojis
90
-
88
+ export function isEmojii(message: any){
89
+
91
90
  // let emoji = '';
92
91
  // try {
93
92
  // emoji = message.trim(); // .charAt(0);