@chat21/chat21-ionic 3.0.59-rc2 → 3.0.59-rc21

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 (76) hide show
  1. package/CHANGELOG.md +72 -1
  2. package/README.md +5 -0
  3. package/config.xml +2 -2
  4. package/env.sample +3 -1
  5. package/package.json +1 -1
  6. package/resources/Android/splash/drawable-land-hdpi-screen.png +0 -0
  7. package/resources/Android/splash/drawable-land-ldpi-screen.png +0 -0
  8. package/resources/Android/splash/drawable-land-mdpi-screen.png +0 -0
  9. package/resources/Android/splash/drawable-land-xhdpi-screen.png +0 -0
  10. package/resources/Android/splash/drawable-land-xxhdpi-screen.png +0 -0
  11. package/resources/Android/splash/drawable-land-xxxhdpi-screen.png +0 -0
  12. package/resources/Android/splash/drawable-port-hdpi-screen.png +0 -0
  13. package/resources/Android/splash/drawable-port-ldpi-screen.png +0 -0
  14. package/resources/Android/splash/drawable-port-mdpi-screen.png +0 -0
  15. package/resources/Android/splash/drawable-port-xhdpi-screen.png +0 -0
  16. package/resources/Android/splash/drawable-port-xxhdpi-screen.png +0 -0
  17. package/resources/Android/splash/drawable-port-xxxhdpi-screen.png +0 -0
  18. package/resources/Android/splash.png +0 -0
  19. package/src/app/app-routing.module.ts +21 -17
  20. package/src/app/app.component.scss +10 -5
  21. package/src/app/app.component.ts +339 -65
  22. package/src/app/app.module.ts +16 -8
  23. package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html +1 -1
  24. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +20 -8
  25. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.scss +0 -144
  26. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +14 -17
  27. package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.html +1 -1
  28. package/src/app/components/authentication/login/login.component.html +10 -10
  29. package/src/app/components/authentication/login/login.component.ts +2 -1
  30. package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.ts +1 -1
  31. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +2 -4
  32. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +7 -2
  33. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +20 -15
  34. package/src/app/components/ddp-header/ddp-header.component.html +1 -1
  35. package/src/app/components/ddp-header/ddp-header.component.ts +4 -2
  36. package/src/app/components/project-item/project-item.component.html +147 -0
  37. package/src/app/components/project-item/project-item.component.scss +669 -0
  38. package/src/app/components/project-item/project-item.component.spec.ts +24 -0
  39. package/src/app/components/project-item/project-item.component.ts +317 -0
  40. package/src/app/components/utils/avatar-profile/avatar-profile.component.html +9 -3
  41. package/src/app/pages/authentication/login/login.page.html +1 -2
  42. package/src/app/pages/authentication/login/login.page.ts +1 -1
  43. package/src/app/pages/conversation-detail/conversation-detail.page.ts +26 -22
  44. package/src/app/pages/conversations-list/conversations-list.page.html +45 -23
  45. package/src/app/pages/conversations-list/conversations-list.page.scss +290 -127
  46. package/src/app/pages/conversations-list/conversations-list.page.ts +189 -17
  47. package/src/app/pages/unassigned-conversations/unassigned-conversations-routing.module.ts +17 -0
  48. package/src/app/pages/unassigned-conversations/unassigned-conversations.module.ts +22 -0
  49. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.html +22 -0
  50. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.scss +79 -0
  51. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.spec.ts +24 -0
  52. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.ts +108 -0
  53. package/src/app/services/app-config.ts +77 -5
  54. package/src/app/services/tiledesk/tiledesk.service.ts +22 -1
  55. package/src/app/services/websocket/websocket-js.ts +557 -0
  56. package/src/app/services/websocket/websocket.service.spec.ts +12 -0
  57. package/src/app/services/websocket/websocket.service.ts +274 -0
  58. package/src/app/shared/shared.module.ts +3 -0
  59. package/src/assets/i18n/en.json +9 -1
  60. package/src/assets/i18n/it.json +9 -1
  61. package/src/assets/js/chat21client.js +144 -82
  62. package/src/assets/logo.png +0 -0
  63. package/src/assets/transparent.png +0 -0
  64. package/src/chat-config-pre-test.json +3 -1
  65. package/src/chat-config-template.json +4 -1
  66. package/src/chat-config.json +4 -1
  67. package/src/chat21-core/providers/firebase/firebase-auth-service.ts +2 -2
  68. package/src/chat21-core/providers/firebase/firebase-notifications.ts +31 -23
  69. package/src/chat21-core/providers/mqtt/mqtt-auth-service.ts +27 -27
  70. package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +3 -5
  71. package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +13 -5
  72. package/src/chat21-core/providers/mqtt/mqtt-notifications.ts +101 -11
  73. package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +13 -4
  74. package/src/chat21-core/utils/utils-message.ts +2 -2
  75. package/src/firebase-messaging-sw-template.js +1 -1
  76. package/src/assets/images/tiledesk_logo_50x50.png +0 -0
@@ -22,6 +22,7 @@ import { NavProxyService } from '../../services/nav-proxy.service';
22
22
  import { TiledeskService } from '../../services/tiledesk/tiledesk.service';
23
23
  import { ConversationDetailPage } from '../conversation-detail/conversation-detail.page';
24
24
  import { ContactsDirectoryPage } from '../contacts-directory/contacts-directory.page';
25
+ import { UnassignedConversationsPage } from '../unassigned-conversations/unassigned-conversations.page';
25
26
  import { ProfileInfoPage } from '../profile-info/profile-info.page';
26
27
  import { MessagingAuthService } from 'src/chat21-core/providers/abstract/messagingAuth.service';
27
28
  import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service';
@@ -33,6 +34,9 @@ import { Platform } from '@ionic/angular';
33
34
  // Logger
34
35
  import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
35
36
  import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
37
+ import { NetworkService } from 'src/app/services/network-service/network.service';
38
+ import { Subject } from 'rxjs';
39
+ import { takeUntil } from 'rxjs/operators'
36
40
 
37
41
  @Component({
38
42
  selector: 'app-conversations-list',
@@ -40,7 +44,10 @@ import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance'
40
44
  styleUrls: ['./conversations-list.page.scss'],
41
45
  })
42
46
  export class ConversationListPage implements OnInit {
47
+
43
48
  @ViewChild('ioncontentconvlist', { static: false }) ionContentConvList: IonContent;
49
+
50
+ private unsubscribe$: Subject<any> = new Subject<any>();
44
51
  private subscriptions: Array<string>;
45
52
  public tenant: string;
46
53
  public loggedUserUid: string;
@@ -52,7 +59,7 @@ export class ConversationListPage implements OnInit {
52
59
  public showPlaceholder = true;
53
60
  public numberOpenConv = 0;
54
61
  public loadingIsActive = true;
55
- public supportMode = environment.supportMode;
62
+ public supportMode: boolean;
56
63
 
57
64
  public convertMessage = convertMessage;
58
65
  private isShowMenuPage = false;
@@ -64,6 +71,16 @@ export class ConversationListPage implements OnInit {
64
71
  headerTitle: string;
65
72
  subscription: Subscription;
66
73
 
74
+ public UNASSIGNED_CONVS_URL: any;
75
+ public hasClickedOpenUnservedConvIframe: boolean = false;
76
+ public lastProjectId: string;
77
+ public isOnline: boolean = true;
78
+ public checkInternet: boolean;
79
+
80
+ public displayNewConvsItem: boolean = true
81
+
82
+
83
+
67
84
  constructor(
68
85
  private router: Router,
69
86
  private route: ActivatedRoute,
@@ -80,21 +97,104 @@ export class ConversationListPage implements OnInit {
80
97
  public tiledeskService: TiledeskService,
81
98
  public tiledeskAuthService: TiledeskAuthService,
82
99
  public appConfigProvider: AppConfigProvider,
83
- public platform: Platform
100
+ public platform: Platform,
101
+ private networkService: NetworkService,
102
+
84
103
  ) {
85
104
  this.listenToAppCompConvsLengthOnInitConvs();
86
105
  this.listenToLogoutEvent();
106
+ this.listenGoOnline();
107
+ this.listenGoOffline();
87
108
  this.listenToSwPostMessage();
109
+ this.listenSupportConvIdHasChanged();
110
+ this.listenDirectConvIdHasChanged();
111
+ }
88
112
 
113
+ listenSupportConvIdHasChanged() {
114
+ this.events.subscribe('supportconvid:haschanged', (convId) => {
115
+ // console.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - convId', convId);
116
+ if (convId) {
117
+ const conversationSelected = this.conversations.find(item => item.uid === convId);
118
+ // console.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - conversationSelected', conversationSelected);
119
+ this.onConversationSelected(conversationSelected)
120
+ }
121
+ });
122
+ }
123
+
124
+ listenDirectConvIdHasChanged() {
125
+ this.events.subscribe('directconvid:haschanged', (contact_id) => {
126
+ // console.log('[CONVS-LIST-PAGE] - listen To directconvid:haschanged - contact_id', contact_id);
127
+ if (contact_id) {
128
+ this.uidConvSelected = contact_id
129
+ }
130
+ });
89
131
  }
90
132
 
91
133
 
92
134
  // -----------------------------------------------
93
135
  // @ Lifehooks
94
136
  // -----------------------------------------------
95
- ngOnInit() { }
137
+ ngOnInit() {
138
+ this.watchToConnectionStatus();
139
+ this.getSupportMode();
140
+
141
+ const currentUrl = this.router.url;
142
+ this.logger.log('[CONVS-LIST-PAGE] current_url ngOnInit ', currentUrl);
143
+ // this.route.queryParams.subscribe(params => {
144
+ // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params', params);
145
+ // if (params && params.convselected) {
146
+ // console.log('[CONVS-LIST-PAGE] ngOnInit params convselected:', params.convselected);
147
+
148
+ // const conversationSelected = this.conversations.find(item => item.uid === params.convselected);
149
+ // if (conversationSelected) {
150
+ // this.conversationSelected = conversationSelected;
151
+ // console.log('[CONVS-LIST-PAGE] ngOnInit params convselected - conversationSelected: ', this.conversationSelected);
152
+ // this.navigateByUrl('active', params.convselected)
153
+ // }
154
+
155
+ // } else {
156
+ // console.log('[CONVS-LIST-PAGE] ngOnInit params NoParams ');
157
+ // }
158
+ // if (params && params.contact_id && params.contact_fullname) {
159
+ // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params contact_id:', params.contact_id, 'contact_fullname ', params.contact_fullname);
160
+ // this.router.navigateByUrl('conversation-detail/' + params.contact_id + '/' + params.contact_fullname + '/new');
161
+ // this.uidConvSelected = params.contact_id
162
+ // } else {
163
+ // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params NoParams ');
164
+ // }
165
+
166
+ // if (params && params.conversation_detail) {
167
+ // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params conversation_detail:', params.conversation_detail);
168
+ // this.router.navigateByUrl('conversation-detail/');
169
+
170
+ // } else {
171
+ // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params NoParams ');
172
+ // }
173
+
174
+ // });
175
+ }
176
+
177
+
178
+
179
+ getSupportMode() {
180
+ this.supportMode = this.appConfigProvider.getConfig().supportMode;
181
+ // console.log('[ION-LIST-CONVS-COMP] - supportMode ', this.supportMode)
182
+ }
183
+
184
+ watchToConnectionStatus() {
185
+ this.networkService.checkInternetFunc().subscribe(isOnline => {
186
+ this.checkInternet = isOnline
187
+ this.logger.log('[ION-LIST-CONVS-COMP] - watchToConnectionStatus - isOnline', this.checkInternet)
96
188
 
189
+ // checking internet connection
190
+ if (this.checkInternet == true) {
97
191
 
192
+ this.isOnline = true;
193
+ } else {
194
+ this.isOnline = false;
195
+ }
196
+ });
197
+ }
98
198
 
99
199
 
100
200
  ionViewWillEnter() {
@@ -116,6 +216,41 @@ export class ConversationListPage implements OnInit {
116
216
 
117
217
  ionViewDidEnter() { }
118
218
 
219
+ getLastProjectId(projectid: string) {
220
+ this.logger.log('[CONVS-LIST-PAGE] - GET LAST PROJECT ID', projectid);
221
+ this.lastProjectId = projectid;
222
+ }
223
+
224
+ openUnsevedConversationIframe() {
225
+ this.hasClickedOpenUnservedConvIframe = true
226
+ this.logger.log('[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME', this.hasClickedOpenUnservedConvIframe);
227
+ const DASHBOARD_BASE_URL = this.appConfigProvider.getConfig().dashboardUrl;
228
+ this.UNASSIGNED_CONVS_URL = DASHBOARD_BASE_URL + '#/project/' + this.lastProjectId + '/unserved-request-for-panel';
229
+ this.logger.log('[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME > UNASSIGNED CONVS URL', this.UNASSIGNED_CONVS_URL);
230
+ this.openUnassignedConversations(this.UNASSIGNED_CONVS_URL)
231
+ }
232
+
233
+ // ---------------------------------------------------------
234
+ // Opens the Unassigned Conversations iframe
235
+ // ---------------------------------------------------------
236
+ openUnassignedConversations(UNASSIGNED_CONVS_URL) {
237
+
238
+ if (checkPlatformIsMobile()) {
239
+ presentModal(this.modalController, UnassignedConversationsPage, { unassigned_convs_url: UNASSIGNED_CONVS_URL });
240
+ } else {
241
+ this.navService.push(UnassignedConversationsPage, { unassigned_convs_url: UNASSIGNED_CONVS_URL });
242
+ }
243
+ }
244
+
245
+ _closeContactsDirectory() {
246
+ try {
247
+ closeModal(this.modalController);
248
+ } catch (err) {
249
+ this.logger.error('[CONVS-LIST-PAGE] closeContactsDirectory -> error:', err);
250
+ }
251
+ }
252
+
253
+
119
254
  listenToSwPostMessage() {
120
255
  this.logger.log('[CONVS-LIST-PAGE] listenToNotificationCLick - CALLED: ');
121
256
  const that = this;
@@ -152,12 +287,20 @@ export class ConversationListPage implements OnInit {
152
287
 
153
288
  private listnerStart() {
154
289
  const that = this;
155
- this.chatManager.BSStart.subscribe((data: any) => {
156
- this.logger.log('[CONVS-LIST-PAGE] ***** BSStart Current user *****', data);
157
- if (data) {
158
- that.initialize();
159
- }
160
- });
290
+ this.chatManager.BSStart
291
+ .pipe(
292
+ takeUntil(that.unsubscribe$)
293
+ )
294
+ .subscribe((data: any) => {
295
+ this.logger.log('[CONVS-LIST-PAGE] - BSStart SUBSCR DATA - Current user *****', data);
296
+ if (data) {
297
+ that.initialize();
298
+ }
299
+ }, error => {
300
+ this.logger.error('[CONVS-LIST-PAGE] - BSStart SUBSCR - ERROR: ', error);
301
+ }, () => {
302
+ this.logger.log('[CONVS-LIST-PAGE] - BSStart SUBSCR * COMPLETE *')
303
+ });
161
304
  }
162
305
 
163
306
 
@@ -193,7 +336,6 @@ export class ConversationListPage implements OnInit {
193
336
  if (!this.archivedConversations || this.archivedConversations.length === 0) {
194
337
  this.loadingIsActive = false;
195
338
  }
196
-
197
339
  }
198
340
 
199
341
 
@@ -213,9 +355,32 @@ export class ConversationListPage implements OnInit {
213
355
  });
214
356
  }
215
357
 
358
+ listenGoOnline() {
359
+ this.events.subscribe('go:online', (goonline) => {
360
+ this.logger.info('[CONVS-LIST-PAGE] - listen To go:online - goonline', goonline);
361
+ // this.events.unsubscribe('profileInfoButtonClick:logout')
362
+ if (goonline === true) {
363
+ this.displayNewConvsItem = true
364
+ }
365
+ });
366
+ }
367
+
368
+ listenGoOffline() {
369
+
370
+ this.events.subscribe('go:offline', (offline) => {
371
+ this.logger.info('[CONVS-LIST-PAGE] - listen To go:offline - offline', offline);
372
+ // this.events.unsubscribe('profileInfoButtonClick:logout')
373
+ if (offline === true) {
374
+ this.displayNewConvsItem = false
375
+ }
376
+ });
377
+ }
378
+
216
379
  listenToLogoutEvent() {
217
380
  this.events.subscribe('profileInfoButtonClick:logout', (hasclickedlogout) => {
218
381
  this.logger.info('[CONVS-LIST-PAGE] - listenToLogoutEvent - hasclickedlogout', hasclickedlogout);
382
+
383
+
219
384
  this.conversations = []
220
385
  this.conversationsHandlerService.conversations = [];
221
386
  this.uidConvSelected = null;
@@ -326,8 +491,11 @@ export class ConversationListPage implements OnInit {
326
491
  * evento richiamato quando si seleziona un utente nell'elenco degli user
327
492
  * apro dettaglio conversazione
328
493
  */
494
+ // --------------------------------
495
+ // !!!!!! IS USED? ?????
496
+ // ------------------------------
329
497
  subscribeChangedConversationSelected = (user: UserModel, type: string) => {
330
- this.logger.log('[CONVS-LIST-PAGE] ************** subscribeUidConvSelectedChanged navigateByUrl', user, type);
498
+ console.log('[CONVS-LIST-PAGE] ************** subscribeUidConvSelectedChanged navigateByUrl', user, type);
331
499
  this.uidConvSelected = user.uid;
332
500
  this.logger.log('[CONVS-LIST-PAGE] ************** uidConvSelected ', this.uidConvSelected);
333
501
  // this.conversationsHandlerService.uidConvSelected = user.uid;
@@ -416,6 +584,7 @@ export class ConversationListPage implements OnInit {
416
584
  this.initConversationsHandler();
417
585
  this.initVariables();
418
586
  this.initSubscriptions();
587
+
419
588
  // this.initHandlerEventEmitter();
420
589
  }
421
590
 
@@ -470,7 +639,7 @@ export class ConversationListPage implements OnInit {
470
639
  }
471
640
  if (conversationSelected) {
472
641
  this.logger.log('[CONVS-LIST-PAGE] conversationSelected', conversationSelected);
473
- this.logger.log('[CONVS-LIST-PAGE] la conv ', this.conversationSelected, ' has already been loaded');
642
+ this.logger.log('[CONVS-LIST-PAGE] the conversation ', this.conversationSelected, ' has already been loaded');
474
643
  this.conversationSelected = conversationSelected;
475
644
  this.logger.log('[CONVS-LIST-PAGE] setUidConvSelected: ', this.conversationSelected);
476
645
  }
@@ -478,7 +647,7 @@ export class ConversationListPage implements OnInit {
478
647
  }
479
648
 
480
649
  onConversationSelected(conversation: ConversationModel) {
481
- //console.log('returnSelectedConversation::', conversation)
650
+ this.logger.log('onConversationSelected conversation', conversation)
482
651
  if (conversation.archived) {
483
652
  this.navigateByUrl('archived', conversation.uid)
484
653
  this.logger.log('[CONVS-LIST-PAGE] onConversationSelected archived conversation.uid ', conversation.uid)
@@ -508,8 +677,8 @@ export class ConversationListPage implements OnInit {
508
677
  }
509
678
 
510
679
  onConversationLoaded(conversation: ConversationModel) {
511
- this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded ', conversation)
512
- this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded is new? ', conversation.is_new)
680
+ // this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded ', conversation)
681
+ // this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded is new? ', conversation.is_new)
513
682
  // if (conversation.is_new === false) {
514
683
  // this.ionContentConvList.scrollToTop(0);
515
684
  // }
@@ -575,6 +744,7 @@ export class ConversationListPage implements OnInit {
575
744
 
576
745
 
577
746
  navigateByUrl(converationType: string, uidConvSelected: string) {
747
+ this.logger.log('[CONVS-LIST-PAGE] calling navigateByUrl: ');
578
748
  this.logger.log('[CONVS-LIST-PAGE] navigateByUrl uidConvSelected: ', uidConvSelected);
579
749
  this.logger.log('[CONVS-LIST-PAGE] navigateByUrl run this.setUidConvSelected');
580
750
  this.logger.log('[CONVS-LIST-PAGE] navigateByUrl this.uidConvSelected ', this.uidConvSelected);
@@ -582,12 +752,14 @@ export class ConversationListPage implements OnInit {
582
752
 
583
753
  this.setUidConvSelected(uidConvSelected, converationType);
584
754
  if (checkPlatformIsMobile()) {
585
- this.logger.log('[CONVS-LIST-PAGE] PLATFORM_MOBILE 1', this.navService);
755
+ this.logger.log('[CONVS-LIST-PAGE] checkPlatformIsMobile(): ', checkPlatformIsMobile());
756
+ this.logger.log('[CONVS-LIST-PAGE] DESKTOP (window >= 768)', this.navService);
586
757
  let pageUrl = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname + '/' + converationType;
587
758
  this.logger.log('[CONVS-LIST-PAGE] pageURL', pageUrl)
588
759
  this.router.navigateByUrl(pageUrl);
589
760
  } else {
590
- this.logger.log('[CONVS-LIST-PAGE] PLATFORM_DESKTOP 2', this.navService);
761
+ console.log('[CONVS-LIST-PAGE] checkPlatformIsMobile(): ', checkPlatformIsMobile());
762
+ this.logger.log('[CONVS-LIST-PAGE] MOBILE (window < 768) ', this.navService);
591
763
  let pageUrl = 'conversation-detail/' + this.uidConvSelected;
592
764
  if (this.conversationSelected && this.conversationSelected.conversation_with_fullname) {
593
765
  pageUrl = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname + '/' + converationType;
@@ -0,0 +1,17 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { Routes, RouterModule } from '@angular/router';
3
+
4
+ import { UnassignedConversationsPage } from './unassigned-conversations.page';
5
+
6
+ const routes: Routes = [
7
+ {
8
+ path: '',
9
+ component: UnassignedConversationsPage
10
+ }
11
+ ];
12
+
13
+ @NgModule({
14
+ imports: [RouterModule.forChild(routes)],
15
+ exports: [RouterModule],
16
+ })
17
+ export class UnassignedConversationsPageRoutingModule {}
@@ -0,0 +1,22 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { FormsModule } from '@angular/forms';
4
+
5
+ import { IonicModule } from '@ionic/angular';
6
+
7
+ import { UnassignedConversationsPageRoutingModule } from './unassigned-conversations-routing.module';
8
+
9
+ import { UnassignedConversationsPage } from './unassigned-conversations.page';
10
+
11
+ @NgModule({
12
+ imports: [
13
+ CommonModule,
14
+ FormsModule,
15
+ IonicModule,
16
+ UnassignedConversationsPageRoutingModule
17
+ ],
18
+ declarations: [
19
+ UnassignedConversationsPage,
20
+ ]
21
+ })
22
+ export class UnassignedConversationsPageModule {}
@@ -0,0 +1,22 @@
1
+ <ion-header>
2
+ <ion-toolbar>
3
+ <ion-title>{{translationMap?.get('NewConversations') }}</ion-title>
4
+ <ion-buttons slot="end">
5
+ <ion-button ion-button fill="clear" (click)="onClose()">
6
+ <ion-icon slot="icon-only" name="close"></ion-icon>
7
+ </ion-button>
8
+ </ion-buttons>
9
+ </ion-toolbar>
10
+ </ion-header>
11
+
12
+ <ion-content overflow-scroll="true" id="iframe-ion-content"
13
+ [ngClass]="{'ion-content-black-background' : isProjectsForPanel === true}">
14
+ <!-- <iframe id="i_frame" style="width:100%; height:99%" frameBorder="0" allowfullscreen [src]="unassigned_convs_url_sanitized"></iframe> -->
15
+ <!-- <div class="stretchspinner-unassigned-convs">
16
+ <div class="rect1"></div>
17
+ <div class="rect2"></div>
18
+ <div class="rect3"></div>
19
+ <div class="rect4"></div>
20
+ <div class="rect5"></div>
21
+ </div> -->
22
+ </ion-content>
@@ -0,0 +1,79 @@
1
+ .ion-content-black-background {
2
+ --background: #2d323e
3
+ }
4
+
5
+ // -------------------------------------------------
6
+ // stretch spinner https://tobiasahlin.com/spinkit/
7
+ // -------------------------------------------------
8
+ .stretchspinner-unassigned-convs {
9
+ margin: 100px auto;
10
+ width: 50px;
11
+ height: 40px;
12
+ text-align: center;
13
+ font-size: 10px;
14
+ position: absolute;
15
+ margin: auto;
16
+ top: 0;
17
+ left: 0;
18
+ bottom: 0;
19
+ right: 0;
20
+ }
21
+
22
+ .stretchspinner-unassigned-convs > div {
23
+ background-color: #3ea9f5;
24
+ height: 100%;
25
+ width: 6px;
26
+ display: inline-block;
27
+
28
+ -webkit-animation: sk-stretchdelay 1.2s infinite ease-in-out;
29
+ animation: sk-stretchdelay 1.2s infinite ease-in-out;
30
+ }
31
+
32
+ .stretchspinner-unassigned-convs .rect2 {
33
+ -webkit-animation-delay: -1.1s;
34
+ animation-delay: -1.1s;
35
+ }
36
+
37
+ .stretchspinner-unassigned-convs .rect3 {
38
+ -webkit-animation-delay: -1s;
39
+ animation-delay: -1s;
40
+ }
41
+
42
+ .stretchspinner-unassigned-convs .rect4 {
43
+ -webkit-animation-delay: -0.9s;
44
+ animation-delay: -0.9s;
45
+ }
46
+
47
+ .stretchspinner-unassigned-convs .rect5 {
48
+ -webkit-animation-delay: -0.8s;
49
+ animation-delay: -0.8s;
50
+ }
51
+
52
+ @-webkit-keyframes sk-stretchdelay {
53
+ 0%,
54
+ 40%,
55
+ 100% {
56
+ -webkit-transform: scaleY(0.4);
57
+ }
58
+ 20% {
59
+ -webkit-transform: scaleY(1);
60
+ }
61
+ }
62
+
63
+ @keyframes sk-stretchdelay {
64
+ 0%,
65
+ 40%,
66
+ 100% {
67
+ transform: scaleY(0.4);
68
+ -webkit-transform: scaleY(0.4);
69
+ }
70
+ 20% {
71
+ transform: scaleY(1);
72
+ -webkit-transform: scaleY(1);
73
+ }
74
+ }
75
+
76
+
77
+ .hide-stretchspinner {
78
+ display: none;
79
+ }
@@ -0,0 +1,24 @@
1
+ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { IonicModule } from '@ionic/angular';
3
+
4
+ import { UnassignedConversationsPage } from './unassigned-conversations.page';
5
+
6
+ describe('UnassignedConversationsPage', () => {
7
+ let component: UnassignedConversationsPage;
8
+ let fixture: ComponentFixture<UnassignedConversationsPage>;
9
+
10
+ beforeEach(async(() => {
11
+ TestBed.configureTestingModule({
12
+ declarations: [ UnassignedConversationsPage ],
13
+ imports: [IonicModule.forRoot()]
14
+ }).compileComponents();
15
+
16
+ fixture = TestBed.createComponent(UnassignedConversationsPage);
17
+ component = fixture.componentInstance;
18
+ fixture.detectChanges();
19
+ }));
20
+
21
+ it('should create', () => {
22
+ expect(component).toBeTruthy();
23
+ });
24
+ });
@@ -0,0 +1,108 @@
1
+ import { Component, Input, OnInit, SecurityContext } from '@angular/core';
2
+ import { ModalController } from '@ionic/angular';
3
+ import { NavProxyService } from 'src/app/services/nav-proxy.service';
4
+ import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
5
+ import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance';
6
+ import { DomSanitizer } from '@angular/platform-browser'
7
+ import { CustomTranslateService } from 'src/chat21-core/providers/custom-translate.service';
8
+
9
+
10
+ @Component({
11
+ selector: 'app-unassigned-conversations',
12
+ templateUrl: './unassigned-conversations.page.html',
13
+ styleUrls: ['./unassigned-conversations.page.scss'],
14
+ })
15
+ export class UnassignedConversationsPage implements OnInit {
16
+
17
+ @Input() unassigned_convs_url: any;
18
+ unassigned_convs_url_sanitized: any;
19
+ private logger: LoggerService = LoggerInstance.getInstance();
20
+ // has_loaded: boolean;
21
+ ion_content: any;
22
+ iframe: any;
23
+
24
+ isProjectsForPanel: boolean = false
25
+
26
+ public translationMap: Map<string, string>;
27
+ constructor(
28
+ private modalController: ModalController,
29
+ private navService: NavProxyService,
30
+ private sanitizer: DomSanitizer,
31
+ private translateService: CustomTranslateService,
32
+ ) { }
33
+
34
+ ngOnInit() {
35
+ const keys = ['UnassignedConversations', 'NewConversations'];
36
+ this.translationMap = this.translateService.translateLanguage(keys);
37
+ this.buildIFRAME();
38
+ this.listenToPostMsg();
39
+ }
40
+
41
+ buildIFRAME() {
42
+ this.logger.log('[UNASSIGNED-CONVS-PAGE] - UNASSIGNED CONVS URL (ngOnInit)', this.unassigned_convs_url);
43
+ this.unassigned_convs_url_sanitized = this.sanitizer.sanitize(SecurityContext.URL, this.unassigned_convs_url)
44
+ this.logger.log('[UNASSIGNED-CONVS-PAGE] - UNASSIGNED CONVS URL SANITIZED (ngOnInit)', this.unassigned_convs_url_sanitized);
45
+ // this.has_loaded = false
46
+
47
+ this.ion_content = document.getElementById("iframe-ion-content");
48
+ this.iframe = document.createElement("iframe");
49
+ this.iframe.src = this.unassigned_convs_url_sanitized;
50
+ this.iframe.width = "100%";
51
+ this.iframe.height = "99%";
52
+ this.iframe.id = "unassigned-convs-iframe"
53
+ this.iframe.frameBorder = "0";
54
+ this.iframe.style.border = "none";
55
+ this.iframe.style.background = "white";
56
+ this.ion_content.appendChild(this.iframe);
57
+
58
+ // this.getIframeHaLoaded()
59
+ }
60
+
61
+ getIframeHaLoaded() {
62
+ var self = this;
63
+ var iframe = document.getElementById('unassigned-convs-iframe') as HTMLIFrameElement;;
64
+ this.logger.log('[APP-STORE-INSTALL] GET iframe ', iframe)
65
+ if (iframe) {
66
+ iframe.addEventListener("load", function () {
67
+ self.logger.log("[APP-STORE-INSTALL] GET - Finish");
68
+ let spinnerElem = <HTMLElement>document.querySelector('.stretchspinner-unassigned-convs')
69
+
70
+ self.logger.log('[APP-STORE-INSTALL] GET iframeDoc readyState spinnerElem', spinnerElem)
71
+ spinnerElem.classList.add("hide-stretchspinner")
72
+
73
+ });
74
+ }
75
+ }
76
+
77
+ listenToPostMsg() {
78
+ window.addEventListener("message", (event) => {
79
+ // console.log("[UNASSIGNED-CONVS-PAGE] message event ", event);
80
+
81
+ if (event && event.data) {
82
+ if (event.data === 'onInitProjectsForPanel') {
83
+ this.isProjectsForPanel = true;
84
+ }
85
+ if (event.data === 'onDestroyProjectsForPanel') {
86
+ this.isProjectsForPanel = false;
87
+ }
88
+ }
89
+ });
90
+ }
91
+
92
+
93
+ async onClose() {
94
+ this.logger.log('[UNASSIGNED-CONVS-PAGE] - onClose MODAL')
95
+ this.logger.log('[UNASSIGNED-CONVS-PAGE] - onClose MODAL isModalOpened ', await this.modalController.getTop())
96
+ const isModalOpened = await this.modalController.getTop();
97
+
98
+ if (isModalOpened) {
99
+ this.modalController.dismiss({
100
+
101
+ confirmed: true
102
+ });
103
+ } else {
104
+ this.navService.pop();
105
+ }
106
+ }
107
+
108
+ }