@chat21/chat21-ionic 3.0.71 → 3.0.72-rc.1

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 CHANGED
@@ -1,5 +1,8 @@
1
1
  # chat21-ionic ver 3.0
2
2
 
3
+ ### 3.0.72-rc.1
4
+ - added: user presence on contact-directory component
5
+
3
6
  ### 3.0.71 in PROD
4
7
 
5
8
  ### 3.0.71-rc.1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chat21/chat21-ionic",
3
3
  "author": "Tiledesk SRL",
4
- "version": "3.0.71",
4
+ "version": "3.0.72-rc.1",
5
5
  "license": "AGPL-3.0",
6
6
  "homepage": "https://tiledesk.com/",
7
7
  "repository": {
@@ -10,7 +10,13 @@
10
10
  <div #avatarPlaceholder class="avatar-placeholder" [ngStyle]="{'background': 'linear-gradient(rgb(255,255,255) -125%,' + user.color + ')'}" [innerHTML]="user.avatar"></div>
11
11
  <div *ngIf="user.imageurl" #avatarImage class="avatar-profile" [style.background-image]="'url(' + user.imageurl + ')'"></div>
12
12
  <!-- <div *ngIf="getImageAvatar(conversation.sender)" #avatarImage class="avatar-profile" [style.background-image]="'url(' + getImageAvatar(conversation.sender) + ')'"></div> -->
13
+ <div class="user-presence">
14
+ <app-presence
15
+ [isOnline]="user.online">
16
+ </app-presence>
17
+ </div>
13
18
  </ion-avatar>
19
+
14
20
  <ion-label>
15
21
  <h2>{{ user.fullname }}</h2>
16
22
  <p>{{ user.uid }}</p>
@@ -52,6 +52,13 @@ ion-item {
52
52
  border-style: solid;
53
53
  border-width: 0px;
54
54
  }
55
+ .user-presence{
56
+ position: absolute;
57
+ width: 100%;
58
+ height: 40px;
59
+ top: 30px;
60
+ left: calc(50% + 15px);
61
+ }
55
62
  }
56
63
  ion-label {
57
64
  flex: 1 1 0px;
@@ -81,6 +88,8 @@ ion-item {
81
88
  }
82
89
 
83
90
  }
91
+
92
+
84
93
  ion-note {
85
94
  position: absolute;
86
95
  right: 8px;
@@ -1,3 +1,4 @@
1
+ import { PresenceService } from 'src/chat21-core/providers/abstract/presence.service';
1
2
  import { Component, OnInit, Input, Output, EventEmitter, OnChanges } from '@angular/core';
2
3
  import { UserModel } from 'src/chat21-core/models/user';
3
4
  import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service';
@@ -5,6 +6,7 @@ import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.
5
6
  // Logger
6
7
  import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
7
8
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
9
+ import { filter } from 'rxjs/operators';
8
10
 
9
11
  @Component({
10
12
  selector: 'component-contacts-directory',
@@ -12,6 +14,7 @@ import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance'
12
14
  styleUrls: ['./contacts-directory.component.scss'],
13
15
  })
14
16
  export class ContactsDirectoryComponent implements OnInit, OnChanges {
17
+
15
18
  @Input() contacts: Array<UserModel>;
16
19
  @Output() onOpenNewChat = new EventEmitter<UserModel>();
17
20
 
@@ -20,7 +23,8 @@ export class ContactsDirectoryComponent implements OnInit, OnChanges {
20
23
  private logger: LoggerService = LoggerInstance.getInstance();
21
24
 
22
25
  constructor(
23
- public imageRepoService: ImageRepoService
26
+ public imageRepoService: ImageRepoService,
27
+ public presenceService: PresenceService
24
28
  ) { }
25
29
 
26
30
  /**
@@ -35,6 +39,7 @@ export class ContactsDirectoryComponent implements OnInit, OnChanges {
35
39
  if(this.contacts){
36
40
  this.contacts.forEach(contact => {
37
41
  contact.imageurl = this.imageRepoService.getImagePhotoUrl(contact.uid)
42
+ this.presenceService.userIsOnline(contact.uid).pipe(filter((isOnline) => isOnline !== null)).subscribe((status)=> {contact.online = status.isOnline })
38
43
  });
39
44
  }
40
45
  }
@@ -10,6 +10,7 @@ export class OptionHeaderComponent implements OnInit {
10
10
 
11
11
  @Input() headerTitle: string
12
12
  @Output() onBackButton = new EventEmitter<boolean>();
13
+ static UserPresenceComponent: any[] | any;
13
14
 
14
15
  constructor() { }
15
16
 
@@ -148,10 +148,7 @@ export class InfoGroupComponent implements OnInit, AfterViewInit, OnChanges {
148
148
  for (const [key, value] of Object.entries(this.groupDetail.members)) {
149
149
  this.logger.log('CONVERSATION-DETAIL group detail Key:', key, ' -Value: ', value);
150
150
 
151
- this.presenceService.userIsOnline(key)
152
- .pipe(takeUntil(this.unsubscribe$))
153
- .pipe(filter((isOnline) => isOnline !== null))
154
- .subscribe((isOnline: any) => {
151
+ this.presenceService.userIsOnline(key).pipe(takeUntil(this.unsubscribe$)).pipe(filter((isOnline) => isOnline !== null)).subscribe((isOnline: any) => {
155
152
  this.logger.log('InfoGroupComponent group detail BSIsOnline isOnline', isOnline)
156
153
  members_isonline_array[key]['isSignin'] = isOnline.isOnline
157
154
  if (this.member_array.length > 0) {
@@ -0,0 +1,2 @@
1
+ <div class="status-icon" [class.online]="isOnline" [style.border-color]="borderColor"></div>
2
+ <div class="online-point" [style.color]="fontColor">{{status}}</div>
@@ -0,0 +1,24 @@
1
+ .status-icon {
2
+ position: absolute;
3
+ width: 14px;
4
+ height: 14px;
5
+ top: 0px;
6
+ left: 0;
7
+ border: 2px solid #ffffff;
8
+ border-radius: 50%;
9
+ background-color: #f44336;
10
+ &.online {
11
+ background-color: #4caf50;
12
+ }
13
+
14
+ }
15
+ .online-point {
16
+ position: absolute;
17
+ display: inline-block;
18
+ top: 0;
19
+ left: 20px;
20
+ color: rgba(255, 255, 255, 0.5);
21
+ font-size: 12px;
22
+ line-height: 14px;
23
+ text-align: left;
24
+ }
@@ -0,0 +1,24 @@
1
+ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { IonicModule } from '@ionic/angular';
3
+
4
+ import { PresenceComponent } from './presence.component';
5
+
6
+ describe('PresenceComponent', () => {
7
+ let component: PresenceComponent;
8
+ let fixture: ComponentFixture<PresenceComponent>;
9
+
10
+ beforeEach(async(() => {
11
+ TestBed.configureTestingModule({
12
+ declarations: [ PresenceComponent ],
13
+ imports: [IonicModule.forRoot()]
14
+ }).compileComponents();
15
+
16
+ fixture = TestBed.createComponent(PresenceComponent);
17
+ component = fixture.componentInstance;
18
+ fixture.detectChanges();
19
+ }));
20
+
21
+ it('should create', () => {
22
+ expect(component).toBeTruthy();
23
+ });
24
+ });
@@ -0,0 +1,22 @@
1
+ import { Component, Input, OnInit } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: 'app-presence',
5
+ templateUrl: './presence.component.html',
6
+ styleUrls: ['./presence.component.scss'],
7
+ })
8
+ export class PresenceComponent implements OnInit {
9
+
10
+ @Input() isOnline: boolean = false;
11
+ @Input() translationMap: Map<string, string>;
12
+ // @Input() fontColor: string;
13
+ // @Input() borderColor: string;
14
+
15
+ borderColor = '#ffffff';
16
+ fontColor = '#949494';
17
+
18
+ constructor() { }
19
+
20
+ ngOnInit() {}
21
+
22
+ }
@@ -1,8 +1,9 @@
1
+ import { PresenceComponent } from '../../components/presence/presence.component';
1
2
  import { NgModule } from '@angular/core';
2
3
  import { CommonModule } from '@angular/common';
3
4
  import { FormsModule } from '@angular/forms';
4
5
  import { IonicModule } from '@ionic/angular';
5
- import {TranslateLoader, TranslateModule, TranslatePipe} from '@ngx-translate/core';
6
+ import {TranslateModule} from '@ngx-translate/core';
6
7
 
7
8
  import { ContactsDirectoryPageRoutingModule } from './contacts-directory-routing.module';
8
9
  import { ContactsDirectoryComponent } from '../../components/contacts-directory/contacts-directory.component';
@@ -10,7 +11,6 @@ import { ContactsDirectoryComponent } from '../../components/contacts-directory/
10
11
  import { ContactsDirectoryPage } from './contacts-directory.page';
11
12
  // import { ContactsDirectoryService } from '../../services/contacts-directory.service';
12
13
  // import { TiledeskContactsDirectoryService } from '../../services/tiledesk/tiledesk-contacts-directory.service';
13
- import { HttpClient } from '@angular/common/http';
14
14
 
15
15
 
16
16
  // export function contactsFactory(http: HttpClient) {
@@ -36,7 +36,8 @@ import { HttpClient } from '@angular/common/http';
36
36
  ],
37
37
  declarations: [
38
38
  ContactsDirectoryPage,
39
- ContactsDirectoryComponent
39
+ ContactsDirectoryComponent,
40
+ PresenceComponent
40
41
  ]
41
42
  })
42
43
  export class ContactsDirectoryPageModule {}
@@ -974,7 +974,7 @@ export class ConversationDetailPage implements OnInit, OnDestroy, AfterViewInit
974
974
  subscriptionKey = 'messageInfo'
975
975
  subscription = this.subscriptions.find((item) => item.key === subscriptionKey)
976
976
  if (!subscription) {
977
- subscription = this.conversationHandlerService.messageInfo.subscribe((msg: any) => {
977
+ subscription = this.conversationHandlerService.messageInfo.pipe(takeUntil(this.unsubscribe$)).subscribe((msg: any) => {
978
978
  this.logger.log('[CONVS-DETAIL] subscribe to messageInfo - messageId ', msg)
979
979
  if (msg) {
980
980
  that.updateLeadInfo(msg)
@@ -1,3 +1,4 @@
1
+ import { ContactsDirectoryComponent } from './../components/contacts-directory/contacts-directory.component';
1
2
  import { HtmlComponent } from './../chatlib/conversation-detail/message/html/html.component';
2
3
  import { BubbleOthersMessageComponent } from './../components/conversation-detail/bubble-others-message/bubble-others-message.component';
3
4
 
@@ -91,7 +92,7 @@ import { SafeHtmlPipe } from '../directives/safe-html.pipe';
91
92
  AutofocusDirective,
92
93
  HtmlEntitiesEncodePipe,
93
94
  SafeHtmlPipe,
94
- OptionHeaderComponent
95
+ OptionHeaderComponent,
95
96
  ],
96
97
  exports: [
97
98
  // MessageTextAreaComponent,