@chat21/chat21-ionic 3.0.59-rc1 → 3.0.59-rc16

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 (95) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +9 -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.html +6 -3
  21. package/src/app/app.component.ts +328 -59
  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/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +4 -4
  25. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +8 -2
  26. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +6 -1
  27. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +1 -1
  28. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +1 -1
  29. package/src/app/chatlib/conversation-detail/message/image/image.component.html +7 -6
  30. package/src/app/chatlib/conversation-detail/message/image/image.component.ts +20 -1
  31. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +39 -9
  32. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.scss +8 -144
  33. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +14 -17
  34. package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.html +1 -1
  35. package/src/app/components/authentication/login/login.component.html +10 -10
  36. package/src/app/components/authentication/login/login.component.ts +2 -1
  37. package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.ts +1 -1
  38. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +3 -2
  39. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +3 -3
  40. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +46 -5
  41. package/src/app/components/ddp-header/ddp-header.component.html +1 -1
  42. package/src/app/components/ddp-header/ddp-header.component.ts +4 -2
  43. package/src/app/components/image-viewer/image-viewer.component.html +23 -0
  44. package/src/app/components/image-viewer/image-viewer.component.scss +107 -0
  45. package/src/app/components/image-viewer/image-viewer.component.spec.ts +24 -0
  46. package/src/app/components/image-viewer/image-viewer.component.ts +38 -0
  47. package/src/app/components/project-item/project-item.component.html +147 -0
  48. package/src/app/components/project-item/project-item.component.scss +669 -0
  49. package/src/app/components/project-item/project-item.component.spec.ts +24 -0
  50. package/src/app/components/project-item/project-item.component.ts +317 -0
  51. package/src/app/components/utils/avatar-profile/avatar-profile.component.html +9 -3
  52. package/src/app/components/utils/avatar-profile/avatar-profile.component.ts +6 -4
  53. package/src/app/pages/authentication/login/login.page.html +1 -2
  54. package/src/app/pages/authentication/login/login.page.ts +1 -1
  55. package/src/app/pages/conversation-detail/conversation-detail.page.html +5 -3
  56. package/src/app/pages/conversation-detail/conversation-detail.page.ts +122 -30
  57. package/src/app/pages/conversations-list/conversations-list.page.html +44 -23
  58. package/src/app/pages/conversations-list/conversations-list.page.scss +290 -127
  59. package/src/app/pages/conversations-list/conversations-list.page.ts +205 -23
  60. package/src/app/pages/unassigned-conversations/unassigned-conversations-routing.module.ts +17 -0
  61. package/src/app/pages/unassigned-conversations/unassigned-conversations.module.ts +22 -0
  62. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.html +22 -0
  63. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.scss +79 -0
  64. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.spec.ts +24 -0
  65. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.ts +108 -0
  66. package/src/app/services/app-config.ts +75 -5
  67. package/src/app/services/nav-proxy.service.ts +1 -1
  68. package/src/app/services/tiledesk/tiledesk.service.ts +22 -1
  69. package/src/app/services/websocket/websocket-js.ts +557 -0
  70. package/src/app/services/websocket/websocket.service.spec.ts +12 -0
  71. package/src/app/services/websocket/websocket.service.ts +274 -0
  72. package/src/app/shared/shared.module.ts +7 -1
  73. package/src/assets/i18n/en.json +9 -1
  74. package/src/assets/i18n/it.json +9 -1
  75. package/src/assets/js/chat21client.js +141 -67
  76. package/src/assets/logo.png +0 -0
  77. package/src/assets/transparent.png +0 -0
  78. package/src/chat-config-pre-test.json +3 -1
  79. package/src/chat-config-template.json +4 -1
  80. package/src/chat-config.json +4 -1
  81. package/src/chat21-core/providers/chat-manager.ts +3 -3
  82. package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +1 -1
  83. package/src/chat21-core/providers/firebase/firebase-auth-service.ts +3 -3
  84. package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +1 -1
  85. package/src/chat21-core/providers/firebase/firebase-notifications.ts +1 -1
  86. package/src/chat21-core/providers/firebase/firebase-presence.service.ts +2 -2
  87. package/src/chat21-core/providers/firebase/firebase-typing.service.ts +1 -1
  88. package/src/chat21-core/providers/firebase/firebase-upload.service.ts +1 -1
  89. package/src/chat21-core/providers/mqtt/mqtt-auth-service.ts +27 -27
  90. package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +13 -5
  91. package/src/chat21-core/providers/mqtt/mqtt-notifications.ts +101 -11
  92. package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +13 -4
  93. package/src/chat21-core/utils/utils.ts +1 -1
  94. package/src/firebase-messaging-sw-template.js +1 -1
  95. package/src/assets/images/tiledesk_logo_50x50.png +0 -0
@@ -22,16 +22,21 @@ 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';
28
29
  import { ImageRepoService } from 'src/chat21-core/providers/abstract/image-repo.service';
29
30
  import { TiledeskAuthService } from 'src/chat21-core/providers/tiledesk/tiledesk-auth.service';
30
31
  import { AppConfigProvider } from '../../services/app-config';
31
-
32
+ import { Subscription } from 'rxjs';
33
+ import { Platform } from '@ionic/angular';
32
34
  // Logger
33
35
  import { LoggerService } from 'src/chat21-core/providers/abstract/logger.service';
34
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'
35
40
 
36
41
  @Component({
37
42
  selector: 'app-conversations-list',
@@ -39,7 +44,10 @@ import { LoggerInstance } from 'src/chat21-core/providers/logger/loggerInstance'
39
44
  styleUrls: ['./conversations-list.page.scss'],
40
45
  })
41
46
  export class ConversationListPage implements OnInit {
47
+
42
48
  @ViewChild('ioncontentconvlist', { static: false }) ionContentConvList: IonContent;
49
+
50
+ private unsubscribe$: Subject<any> = new Subject<any>();
43
51
  private subscriptions: Array<string>;
44
52
  public tenant: string;
45
53
  public loggedUserUid: string;
@@ -51,7 +59,7 @@ export class ConversationListPage implements OnInit {
51
59
  public showPlaceholder = true;
52
60
  public numberOpenConv = 0;
53
61
  public loadingIsActive = true;
54
- public supportMode = environment.supportMode;
62
+ public supportMode: boolean;
55
63
 
56
64
  public convertMessage = convertMessage;
57
65
  private isShowMenuPage = false;
@@ -61,6 +69,16 @@ export class ConversationListPage implements OnInit {
61
69
 
62
70
  public conversationType = 'active'
63
71
  headerTitle: string;
72
+ subscription: Subscription;
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
+
64
82
 
65
83
 
66
84
  constructor(
@@ -78,11 +96,32 @@ export class ConversationListPage implements OnInit {
78
96
  private translateService: CustomTranslateService,
79
97
  public tiledeskService: TiledeskService,
80
98
  public tiledeskAuthService: TiledeskAuthService,
81
- public appConfigProvider: AppConfigProvider
99
+ public appConfigProvider: AppConfigProvider,
100
+ public platform: Platform,
101
+ private networkService: NetworkService,
102
+
82
103
  ) {
83
104
  this.listenToAppCompConvsLengthOnInitConvs();
84
105
  this.listenToLogoutEvent();
106
+ this.listenGoOnline();
107
+ this.listenGoOffline();
85
108
  this.listenToSwPostMessage();
109
+ this.listenConvIdHasChanged();
110
+
111
+ }
112
+
113
+ listenConvIdHasChanged() {
114
+ this.events.subscribe('convid:haschanged', (convId) => {
115
+ console.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - convId', convId);
116
+ // this.events.unsubscribe('profileInfoButtonClick:logout')
117
+ // this.setUidConvSelected(uid , 'active')
118
+ // const conversation = {}
119
+ if (convId) {
120
+ const conversationSelected = this.conversations.find(item => item.uid === convId);
121
+ console.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - conversationSelected', conversationSelected);
122
+ this.onConversationSelected(conversationSelected)
123
+ }
124
+ });
86
125
 
87
126
  }
88
127
 
@@ -91,16 +130,122 @@ export class ConversationListPage implements OnInit {
91
130
  // @ Lifehooks
92
131
  // -----------------------------------------------
93
132
  ngOnInit() {
133
+ this.watchToConnectionStatus();
134
+ this.getSupportMode();
135
+
136
+ const currentUrl = this.router.url;
137
+ this.logger.log('[CONVS-LIST-PAGE] current_url ngOnInit ', currentUrl);
138
+ this.route.queryParams.subscribe(params => {
139
+ this.logger.log('[CONVS-LIST-PAGE] ngOnInit params', params);
140
+ // if (params && params.convselected) {
141
+ // console.log('[CONVS-LIST-PAGE] ngOnInit params convselected:', params.convselected);
142
+
143
+ // const conversationSelected = this.conversations.find(item => item.uid === params.convselected);
144
+ // if (conversationSelected) {
145
+ // this.conversationSelected = conversationSelected;
146
+ // console.log('[CONVS-LIST-PAGE] ngOnInit params convselected - conversationSelected: ', this.conversationSelected);
147
+ // this.navigateByUrl('active', params.convselected)
148
+ // }
149
+
150
+ // } else {
151
+ // console.log('[CONVS-LIST-PAGE] ngOnInit params NoParams ');
152
+ // }
153
+ if (params && params.contact_id && params.contact_fullname) {
154
+ this.logger.log('[CONVS-LIST-PAGE] ngOnInit params contact_id:', params.contact_id, 'contact_fullname ', params.contact_fullname);
155
+ this.router.navigateByUrl('conversation-detail/' + params.contact_id + '/' + params.contact_fullname + '/new');
156
+ this.uidConvSelected = params.contact_id
157
+ } else {
158
+ this.logger.log('[CONVS-LIST-PAGE] ngOnInit params NoParams ');
159
+ }
160
+
161
+ if (params && params.conversation_detail) {
162
+ this.logger.log('[CONVS-LIST-PAGE] ngOnInit params conversation_detail:', params.conversation_detail);
163
+ this.router.navigateByUrl('conversation-detail/');
164
+
165
+ } else {
166
+ this.logger.log('[CONVS-LIST-PAGE] ngOnInit params NoParams ');
167
+ }
94
168
 
169
+ });
170
+ }
171
+
172
+
173
+
174
+ getSupportMode() {
175
+ this.supportMode = this.appConfigProvider.getConfig().supportMode;
176
+ // console.log('[ION-LIST-CONVS-COMP] - supportMode ', this.supportMode)
177
+ }
178
+
179
+ watchToConnectionStatus() {
180
+ this.networkService.checkInternetFunc().subscribe(isOnline => {
181
+ this.checkInternet = isOnline
182
+ this.logger.log('[ION-LIST-CONVS-COMP] - watchToConnectionStatus - isOnline', this.checkInternet)
183
+
184
+ // checking internet connection
185
+ if (this.checkInternet == true) {
186
+
187
+ this.isOnline = true;
188
+ } else {
189
+ this.isOnline = false;
190
+ }
191
+ });
95
192
  }
96
193
 
194
+
97
195
  ionViewWillEnter() {
196
+ this.logger.log('Called ionViewDidEnter')
98
197
  this.logger.log('[CONVS-LIST-PAGE] ionViewWillEnter uidConvSelected', this.uidConvSelected);
99
198
  this.listnerStart();
199
+
200
+ // exit from app with hardware back button
201
+ this.subscription = this.platform.backButton.subscribe(() => {
202
+ navigator['app'].exitApp();
203
+ });
204
+ }
205
+
206
+ // unsubscribe backButton.subscribe method to not use from other page
207
+ ionViewWillLeave() {
208
+ this.logger.log('Called ionViewWillLeave')
209
+ this.subscription.unsubscribe();
100
210
  }
101
211
 
102
212
  ionViewDidEnter() { }
103
213
 
214
+ getLastProjectId(projectid: string) {
215
+ this.logger.log('[CONVS-LIST-PAGE] - GET LAST PROJECT ID', projectid);
216
+ this.lastProjectId = projectid;
217
+ }
218
+
219
+ openUnsevedConversationIframe() {
220
+ this.hasClickedOpenUnservedConvIframe = true
221
+ this.logger.log('[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME', this.hasClickedOpenUnservedConvIframe);
222
+ const DASHBOARD_BASE_URL = this.appConfigProvider.getConfig().dashboardUrl;
223
+ this.UNASSIGNED_CONVS_URL = DASHBOARD_BASE_URL + '#/project/' + this.lastProjectId + '/unserved-request-for-panel';
224
+ this.logger.log('[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME > UNASSIGNED CONVS URL', this.UNASSIGNED_CONVS_URL);
225
+ this.openUnassignedConversations(this.UNASSIGNED_CONVS_URL)
226
+ }
227
+
228
+ // ---------------------------------------------------------
229
+ // Opens the Unassigned Conversations iframe
230
+ // ---------------------------------------------------------
231
+ openUnassignedConversations(UNASSIGNED_CONVS_URL) {
232
+
233
+ if (checkPlatformIsMobile()) {
234
+ presentModal(this.modalController, UnassignedConversationsPage, { unassigned_convs_url: UNASSIGNED_CONVS_URL });
235
+ } else {
236
+ this.navService.push(UnassignedConversationsPage, { unassigned_convs_url: UNASSIGNED_CONVS_URL });
237
+ }
238
+ }
239
+
240
+ _closeContactsDirectory() {
241
+ try {
242
+ closeModal(this.modalController);
243
+ } catch (err) {
244
+ this.logger.error('[CONVS-LIST-PAGE] closeContactsDirectory -> error:', err);
245
+ }
246
+ }
247
+
248
+
104
249
  listenToSwPostMessage() {
105
250
  this.logger.log('[CONVS-LIST-PAGE] listenToNotificationCLick - CALLED: ');
106
251
  const that = this;
@@ -137,12 +282,20 @@ export class ConversationListPage implements OnInit {
137
282
 
138
283
  private listnerStart() {
139
284
  const that = this;
140
- this.chatManager.BSStart.subscribe((data: any) => {
141
- this.logger.log('[CONVS-LIST-PAGE] ***** BSStart Current user *****', data);
142
- if (data) {
143
- that.initialize();
144
- }
145
- });
285
+ this.chatManager.BSStart
286
+ .pipe(
287
+ takeUntil(that.unsubscribe$)
288
+ )
289
+ .subscribe((data: any) => {
290
+ this.logger.log('[CONVS-LIST-PAGE] - BSStart SUBSCR DATA - Current user *****', data);
291
+ if (data) {
292
+ that.initialize();
293
+ }
294
+ }, error => {
295
+ this.logger.error('[CONVS-LIST-PAGE] - BSStart SUBSCR - ERROR: ', error);
296
+ }, () => {
297
+ this.logger.log('[CONVS-LIST-PAGE] - BSStart SUBSCR * COMPLETE *')
298
+ });
146
299
  }
147
300
 
148
301
 
@@ -178,7 +331,6 @@ export class ConversationListPage implements OnInit {
178
331
  if (!this.archivedConversations || this.archivedConversations.length === 0) {
179
332
  this.loadingIsActive = false;
180
333
  }
181
-
182
334
  }
183
335
 
184
336
 
@@ -198,9 +350,32 @@ export class ConversationListPage implements OnInit {
198
350
  });
199
351
  }
200
352
 
353
+ listenGoOnline() {
354
+ this.events.subscribe('go:online', (goonline) => {
355
+ this.logger.info('[CONVS-LIST-PAGE] - listen To go:online - goonline', goonline);
356
+ // this.events.unsubscribe('profileInfoButtonClick:logout')
357
+ if (goonline === true) {
358
+ this.displayNewConvsItem = true
359
+ }
360
+ });
361
+ }
362
+
363
+ listenGoOffline() {
364
+
365
+ this.events.subscribe('go:offline', (offline) => {
366
+ this.logger.info('[CONVS-LIST-PAGE] - listen To go:offline - offline', offline);
367
+ // this.events.unsubscribe('profileInfoButtonClick:logout')
368
+ if (offline === true) {
369
+ this.displayNewConvsItem = false
370
+ }
371
+ });
372
+ }
373
+
201
374
  listenToLogoutEvent() {
202
375
  this.events.subscribe('profileInfoButtonClick:logout', (hasclickedlogout) => {
203
376
  this.logger.info('[CONVS-LIST-PAGE] - listenToLogoutEvent - hasclickedlogout', hasclickedlogout);
377
+
378
+
204
379
  this.conversations = []
205
380
  this.conversationsHandlerService.conversations = [];
206
381
  this.uidConvSelected = null;
@@ -311,8 +486,11 @@ export class ConversationListPage implements OnInit {
311
486
  * evento richiamato quando si seleziona un utente nell'elenco degli user
312
487
  * apro dettaglio conversazione
313
488
  */
489
+ // --------------------------------
490
+ // !!!!!! IS USED? ?????
491
+ // ------------------------------
314
492
  subscribeChangedConversationSelected = (user: UserModel, type: string) => {
315
- this.logger.log('[CONVS-LIST-PAGE] ************** subscribeUidConvSelectedChanged navigateByUrl', user, type);
493
+ console.log('[CONVS-LIST-PAGE] ************** subscribeUidConvSelectedChanged navigateByUrl', user, type);
316
494
  this.uidConvSelected = user.uid;
317
495
  this.logger.log('[CONVS-LIST-PAGE] ************** uidConvSelected ', this.uidConvSelected);
318
496
  // this.conversationsHandlerService.uidConvSelected = user.uid;
@@ -401,6 +579,7 @@ export class ConversationListPage implements OnInit {
401
579
  this.initConversationsHandler();
402
580
  this.initVariables();
403
581
  this.initSubscriptions();
582
+
404
583
  // this.initHandlerEventEmitter();
405
584
  }
406
585
 
@@ -426,7 +605,7 @@ export class ConversationListPage implements OnInit {
426
605
 
427
606
  if (this.route && this.route.snapshot && this.route.snapshot.firstChild) {
428
607
  const IDConv = this.route.snapshot.firstChild.paramMap.get('IDConv');
429
- this.logger.log('[CONVS-LIST-PAGE] conversationWith 2: ', IDConv);
608
+ console.log('[CONVS-LIST-PAGE] conversationWith 2: ', IDConv);
430
609
  if (IDConv) {
431
610
  this.setUidConvSelected(IDConv);
432
611
  } else {
@@ -443,7 +622,7 @@ export class ConversationListPage implements OnInit {
443
622
  * ::: setUidConvSelected :::
444
623
  */
445
624
  setUidConvSelected(uidConvSelected: string, conversationType?: string,) {
446
- this.logger.log('[CONVS-LIST-PAGE] setuidCOnvSelected', uidConvSelected)
625
+ console.log('[CONVS-LIST-PAGE] setuidCOnvSelected', uidConvSelected)
447
626
  this.uidConvSelected = uidConvSelected;
448
627
  // this.conversationsHandlerService.uidConvSelected = uidConvSelected;
449
628
  if (uidConvSelected) {
@@ -455,7 +634,7 @@ export class ConversationListPage implements OnInit {
455
634
  }
456
635
  if (conversationSelected) {
457
636
  this.logger.log('[CONVS-LIST-PAGE] conversationSelected', conversationSelected);
458
- this.logger.log('[CONVS-LIST-PAGE] la conv ', this.conversationSelected, ' has already been loaded');
637
+ this.logger.log('[CONVS-LIST-PAGE] the conversation ', this.conversationSelected, ' has already been loaded');
459
638
  this.conversationSelected = conversationSelected;
460
639
  this.logger.log('[CONVS-LIST-PAGE] setUidConvSelected: ', this.conversationSelected);
461
640
  }
@@ -463,7 +642,7 @@ export class ConversationListPage implements OnInit {
463
642
  }
464
643
 
465
644
  onConversationSelected(conversation: ConversationModel) {
466
- //console.log('returnSelectedConversation::', conversation)
645
+ console.log('onConversationSelected conversation', conversation)
467
646
  if (conversation.archived) {
468
647
  this.navigateByUrl('archived', conversation.uid)
469
648
  this.logger.log('[CONVS-LIST-PAGE] onConversationSelected archived conversation.uid ', conversation.uid)
@@ -493,8 +672,8 @@ export class ConversationListPage implements OnInit {
493
672
  }
494
673
 
495
674
  onConversationLoaded(conversation: ConversationModel) {
496
- this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded ', conversation)
497
- this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded is new? ', conversation.is_new)
675
+ // this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded ', conversation)
676
+ // this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded is new? ', conversation.is_new)
498
677
  // if (conversation.is_new === false) {
499
678
  // this.ionContentConvList.scrollToTop(0);
500
679
  // }
@@ -560,19 +739,22 @@ export class ConversationListPage implements OnInit {
560
739
 
561
740
 
562
741
  navigateByUrl(converationType: string, uidConvSelected: string) {
563
- this.logger.log('[CONVS-LIST-PAGE] navigateByUrl uidConvSelected: ', uidConvSelected);
564
- this.logger.log('[CONVS-LIST-PAGE] navigateByUrl run this.setUidConvSelected');
565
- this.logger.log('[CONVS-LIST-PAGE] navigateByUrl this.uidConvSelected ', this.uidConvSelected);
566
- this.logger.log('[CONVS-LIST-PAGE] navigateByUrl this.conversationSelected ', this.conversationSelected)
742
+ console.log('[CONVS-LIST-PAGE] calling navigateByUrl: ');
743
+ console.log('[CONVS-LIST-PAGE] navigateByUrl uidConvSelected: ', uidConvSelected);
744
+ console.log('[CONVS-LIST-PAGE] navigateByUrl run this.setUidConvSelected');
745
+ console.log('[CONVS-LIST-PAGE] navigateByUrl this.uidConvSelected ', this.uidConvSelected);
746
+ console.log('[CONVS-LIST-PAGE] navigateByUrl this.conversationSelected ', this.conversationSelected)
567
747
 
568
748
  this.setUidConvSelected(uidConvSelected, converationType);
569
749
  if (checkPlatformIsMobile()) {
570
- this.logger.log('[CONVS-LIST-PAGE] PLATFORM_MOBILE 1', this.navService);
750
+ console.log('[CONVS-LIST-PAGE] checkPlatformIsMobile(): ', checkPlatformIsMobile());
751
+ console.log('[CONVS-LIST-PAGE] DESKTOP (window >= 768)', this.navService);
571
752
  let pageUrl = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname + '/' + converationType;
572
753
  this.logger.log('[CONVS-LIST-PAGE] pageURL', pageUrl)
573
754
  this.router.navigateByUrl(pageUrl);
574
755
  } else {
575
- this.logger.log('[CONVS-LIST-PAGE] PLATFORM_DESKTOP 2', this.navService);
756
+ console.log('[CONVS-LIST-PAGE] checkPlatformIsMobile(): ', checkPlatformIsMobile());
757
+ this.logger.log('[CONVS-LIST-PAGE] MOBILE (window < 768) ', this.navService);
576
758
  let pageUrl = 'conversation-detail/' + this.uidConvSelected;
577
759
  if (this.conversationSelected && this.conversationSelected.conversation_with_fullname) {
578
760
  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
+ }