@chat21/chat21-ionic 3.0.5-8.1 → 3.0.5-9.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.
Files changed (102) hide show
  1. package/CHANGELOG.md +104 -2
  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.scss +10 -5
  22. package/src/app/app.component.ts +496 -174
  23. package/src/app/app.module.ts +16 -8
  24. package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.html +1 -1
  25. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +4 -4
  26. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +8 -2
  27. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.ts +6 -1
  28. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.html +7 -2
  29. package/src/app/chatlib/conversation-detail/message/bubble-message/bubble-message.component.ts +47 -2
  30. package/src/app/chatlib/conversation-detail/message/image/image.component.html +7 -6
  31. package/src/app/chatlib/conversation-detail/message/image/image.component.ts +20 -1
  32. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.html +40 -10
  33. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.scss +8 -144
  34. package/src/app/chatlib/list-conversations-component/ion-list-conversations/ion-list-conversations.component.ts +14 -17
  35. package/src/app/chatlib/list-conversations-component/list-conversations/list-conversations.component.html +1 -1
  36. package/src/app/components/authentication/login/login.component.html +10 -10
  37. package/src/app/components/authentication/login/login.component.ts +2 -1
  38. package/src/app/components/conversation-detail/bubble-my-message/bubble-my-message.component.ts +1 -1
  39. package/src/app/components/conversation-detail/bubble-others-message/bubble-others-message.component.ts +1 -1
  40. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.html +15 -12
  41. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.scss +12 -0
  42. package/src/app/components/conversation-detail/header-conversation-detail/header-conversation-detail.component.ts +27 -6
  43. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.html +3 -2
  44. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.scss +22 -17
  45. package/src/app/components/conversation-detail/message-text-area/message-text-area.component.ts +46 -5
  46. package/src/app/components/ddp-header/ddp-header.component.html +1 -1
  47. package/src/app/components/ddp-header/ddp-header.component.ts +4 -2
  48. package/src/app/components/image-viewer/image-viewer.component.html +23 -0
  49. package/src/app/components/image-viewer/image-viewer.component.scss +107 -0
  50. package/src/app/components/image-viewer/image-viewer.component.spec.ts +24 -0
  51. package/src/app/components/image-viewer/image-viewer.component.ts +38 -0
  52. package/src/app/components/project-item/project-item.component.html +147 -0
  53. package/src/app/components/project-item/project-item.component.scss +669 -0
  54. package/src/app/components/project-item/project-item.component.spec.ts +24 -0
  55. package/src/app/components/project-item/project-item.component.ts +330 -0
  56. package/src/app/components/utils/avatar-profile/avatar-profile.component.html +7 -0
  57. package/src/app/components/utils/avatar-profile/avatar-profile.component.ts +22 -5
  58. package/src/app/pages/authentication/login/login.page.html +1 -2
  59. package/src/app/pages/authentication/login/login.page.ts +1 -1
  60. package/src/app/pages/conversation-detail/conversation-detail.page.html +5 -3
  61. package/src/app/pages/conversation-detail/conversation-detail.page.ts +124 -30
  62. package/src/app/pages/conversations-list/conversations-list.page.html +44 -23
  63. package/src/app/pages/conversations-list/conversations-list.page.scss +290 -127
  64. package/src/app/pages/conversations-list/conversations-list.page.ts +225 -17
  65. package/src/app/pages/unassigned-conversations/unassigned-conversations-routing.module.ts +17 -0
  66. package/src/app/pages/unassigned-conversations/unassigned-conversations.module.ts +22 -0
  67. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.html +22 -0
  68. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.scss +79 -0
  69. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.spec.ts +24 -0
  70. package/src/app/pages/unassigned-conversations/unassigned-conversations.page.ts +116 -0
  71. package/src/app/services/app-config.ts +77 -5
  72. package/src/app/services/nav-proxy.service.ts +1 -1
  73. package/src/app/services/tiledesk/tiledesk.service.ts +22 -1
  74. package/src/app/services/websocket/websocket-js.ts +560 -0
  75. package/src/app/services/websocket/websocket.service.spec.ts +12 -0
  76. package/src/app/services/websocket/websocket.service.ts +292 -0
  77. package/src/app/shared/shared.module.ts +7 -1
  78. package/src/assets/i18n/en.json +9 -1
  79. package/src/assets/i18n/it.json +9 -1
  80. package/src/assets/js/chat21client.js +144 -82
  81. package/src/assets/logo.png +0 -0
  82. package/src/assets/transparent.png +0 -0
  83. package/src/chat-config-pre-test.json +2 -2
  84. package/src/chat-config-template.json +4 -1
  85. package/src/chat-config.json +4 -1
  86. package/src/chat21-core/providers/chat-manager.ts +3 -3
  87. package/src/chat21-core/providers/firebase/firebase-archivedconversations-handler.ts +2 -2
  88. package/src/chat21-core/providers/firebase/firebase-auth-service.ts +6 -6
  89. package/src/chat21-core/providers/firebase/firebase-conversation-handler.ts +1 -1
  90. package/src/chat21-core/providers/firebase/firebase-conversations-handler.ts +1 -1
  91. package/src/chat21-core/providers/firebase/firebase-notifications.ts +32 -24
  92. package/src/chat21-core/providers/firebase/firebase-presence.service.ts +2 -2
  93. package/src/chat21-core/providers/firebase/firebase-typing.service.ts +1 -1
  94. package/src/chat21-core/providers/firebase/firebase-upload.service.ts +1 -1
  95. package/src/chat21-core/providers/mqtt/mqtt-conversation-handler.ts +3 -5
  96. package/src/chat21-core/providers/mqtt/mqtt-conversations-handler.ts +13 -5
  97. package/src/chat21-core/providers/mqtt/mqtt-notifications.ts +101 -11
  98. package/src/chat21-core/providers/tiledesk/tiledesk-auth.service.ts +13 -4
  99. package/src/chat21-core/utils/utils-message.ts +2 -2
  100. package/src/chat21-core/utils/utils.ts +1 -1
  101. package/src/firebase-messaging-sw-template.js +1 -1
  102. 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,29 +96,179 @@ 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.listenSupportConvIdHasChanged();
110
+ // this.listenDirectConvIdHasChanged();
111
+ }
86
112
 
113
+ listenSupportConvIdHasChanged() {
114
+ this.events.subscribe('supportconvid:haschanged', (IDConv) => {
115
+ this.logger.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - convId', IDConv);
116
+ if (IDConv) {
117
+ // const conversationSelected = this.conversations.find(item => item.uid === convId);
118
+ // this.onConversationSelected(conversationSelected)
119
+ this.setUidConvSelected(IDConv, 'active');
120
+ }
121
+ if (!IDConv) {
122
+ this.logger.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - is the page without conv select');
123
+
124
+ const chatTabCount = +localStorage.getItem('tabCount')
125
+ this.logger.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - chatTabCount ', chatTabCount);
126
+ if (chatTabCount && chatTabCount > 0) {
127
+ this.logger.log('[CONVS-LIST-PAGE] - listen To convid:haschanged - the chat is already open ', chatTabCount);
128
+ if (checkPlatformIsMobile()) {
129
+ this.logger.log('[CONVS-LIST-PAGE] - the chat is in mobile mode ', checkPlatformIsMobile());
130
+ this.events.publish('noparams:mobile', true);
131
+ }
132
+ }
133
+ }
134
+ });
87
135
  }
88
136
 
137
+ // listenDirectConvIdHasChanged() {
138
+ // this.events.subscribe('directconvid:haschanged', (contact_id) => {
139
+ // // console.log('[CONVS-LIST-PAGE] - listen To directconvid:haschanged - contact_id', contact_id);
140
+ // if (contact_id) {
141
+ // this.uidConvSelected = contact_id
142
+ // }
143
+ // });
144
+ // }
145
+
89
146
 
90
147
  // -----------------------------------------------
91
148
  // @ Lifehooks
92
149
  // -----------------------------------------------
93
150
  ngOnInit() {
151
+ this.watchToConnectionStatus();
152
+ this.getSupportMode();
153
+
154
+ // const currentUrl = this.router.url;
155
+ // this.logger.log('[CONVS-LIST-PAGE] current_url ngOnInit ', currentUrl);
156
+ // this.route.queryParams.subscribe(params => {
157
+ // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params', params);
158
+ // if (params && params.convId) {
159
+ // console.log('[CONVS-LIST-PAGE] ngOnInit params convId:', params.convId);
160
+
161
+ // const conversationSelected = this.conversations.find(item => item.uid === params.convId);
162
+ // if (conversationSelected) {
163
+ // this.conversationSelected = conversationSelected;
164
+ // console.log('[CONVS-LIST-PAGE] ngOnInit params convselected - conversationSelected: ', this.conversationSelected);
165
+ // setTimeout(() => {
166
+ // // this.navigateByUrl('active', params.convId)
167
+ // }, 0);
168
+ // }
169
+
170
+ // } else {
171
+ // console.log('[CONVS-LIST-PAGE] ngOnInit params No convId Params ');
172
+ // }
173
+ // if (params && params.contact_id && params.contact_fullname) {
174
+ // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params contact_id:', params.contact_id, 'contact_fullname ', params.contact_fullname);
175
+ // setTimeout(() => {
176
+ // this.router.navigateByUrl('conversation-detail/' + params.contact_id + '/' + params.contact_fullname + '/new');
177
+ // }, 0);
178
+ // this.uidConvSelected = params.contact_id
179
+ // } else {
180
+ // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params No contact_id and contact_fullname Params ');
181
+ // }
182
+
183
+ // if (params && params.conversation_detail) {
184
+ // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params conversation_detail:', params.conversation_detail);
185
+ // setTimeout(() => {
186
+ // this.router.navigateByUrl('conversation-detail/');
187
+ // }, 0);
188
+ // } else {
189
+ // this.logger.log('[CONVS-LIST-PAGE] ngOnInit params No conversation_detail Params ');
190
+ // }
94
191
 
192
+ // });
95
193
  }
96
194
 
195
+
196
+
197
+ getSupportMode() {
198
+ this.supportMode = this.appConfigProvider.getConfig().supportMode;
199
+ // console.log('[ION-LIST-CONVS-COMP] - supportMode ', this.supportMode)
200
+ }
201
+
202
+ watchToConnectionStatus() {
203
+ this.networkService.checkInternetFunc().subscribe(isOnline => {
204
+ this.checkInternet = isOnline
205
+ this.logger.log('[ION-LIST-CONVS-COMP] - watchToConnectionStatus - isOnline', this.checkInternet)
206
+
207
+ // checking internet connection
208
+ if (this.checkInternet == true) {
209
+
210
+ this.isOnline = true;
211
+ } else {
212
+ this.isOnline = false;
213
+ }
214
+ });
215
+ }
216
+
217
+
97
218
  ionViewWillEnter() {
219
+ this.logger.log('Called ionViewDidEnter')
98
220
  this.logger.log('[CONVS-LIST-PAGE] ionViewWillEnter uidConvSelected', this.uidConvSelected);
99
221
  this.listnerStart();
222
+
223
+ // exit from app with hardware back button
224
+ this.subscription = this.platform.backButton.subscribe(() => {
225
+ navigator['app'].exitApp();
226
+ });
227
+ }
228
+
229
+ // unsubscribe backButton.subscribe method to not use from other page
230
+ ionViewWillLeave() {
231
+ this.logger.log('Called ionViewWillLeave')
232
+ this.subscription.unsubscribe();
100
233
  }
101
234
 
102
235
  ionViewDidEnter() { }
103
236
 
237
+ getLastProjectId(projectid: string) {
238
+ this.logger.log('[CONVS-LIST-PAGE] - GET LAST PROJECT ID', projectid);
239
+ this.lastProjectId = projectid;
240
+ }
241
+
242
+ openUnsevedConversationIframe() {
243
+ this.hasClickedOpenUnservedConvIframe = true
244
+ this.logger.log('[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME', this.hasClickedOpenUnservedConvIframe);
245
+ const DASHBOARD_BASE_URL = this.appConfigProvider.getConfig().dashboardUrl;
246
+ this.UNASSIGNED_CONVS_URL = DASHBOARD_BASE_URL + '#/project/' + this.lastProjectId + '/unserved-request-for-panel';
247
+ this.logger.log('[CONVS-LIST-PAGE] - HAS CLIKED OPEN UNSERVED REQUEST IFRAME > UNASSIGNED CONVS URL', this.UNASSIGNED_CONVS_URL);
248
+ this.openUnassignedConversations(this.UNASSIGNED_CONVS_URL)
249
+ }
250
+
251
+ // ---------------------------------------------------------
252
+ // Opens the Unassigned Conversations iframe
253
+ // ---------------------------------------------------------
254
+ openUnassignedConversations(UNASSIGNED_CONVS_URL) {
255
+
256
+ if (checkPlatformIsMobile()) {
257
+ presentModal(this.modalController, UnassignedConversationsPage, { unassigned_convs_url: UNASSIGNED_CONVS_URL });
258
+ } else {
259
+ this.navService.push(UnassignedConversationsPage, { unassigned_convs_url: UNASSIGNED_CONVS_URL });
260
+ }
261
+ }
262
+
263
+ _closeContactsDirectory() {
264
+ try {
265
+ closeModal(this.modalController);
266
+ } catch (err) {
267
+ this.logger.error('[CONVS-LIST-PAGE] closeContactsDirectory -> error:', err);
268
+ }
269
+ }
270
+
271
+
104
272
  listenToSwPostMessage() {
105
273
  this.logger.log('[CONVS-LIST-PAGE] listenToNotificationCLick - CALLED: ');
106
274
  const that = this;
@@ -137,12 +305,20 @@ export class ConversationListPage implements OnInit {
137
305
 
138
306
  private listnerStart() {
139
307
  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
- });
308
+ this.chatManager.BSStart
309
+ .pipe(
310
+ takeUntil(that.unsubscribe$)
311
+ )
312
+ .subscribe((data: any) => {
313
+ this.logger.log('[CONVS-LIST-PAGE] - BSStart SUBSCR DATA - Current user *****', data);
314
+ if (data) {
315
+ that.initialize();
316
+ }
317
+ }, error => {
318
+ this.logger.error('[CONVS-LIST-PAGE] - BSStart SUBSCR - ERROR: ', error);
319
+ }, () => {
320
+ this.logger.log('[CONVS-LIST-PAGE] - BSStart SUBSCR * COMPLETE *')
321
+ });
146
322
  }
147
323
 
148
324
 
@@ -178,7 +354,6 @@ export class ConversationListPage implements OnInit {
178
354
  if (!this.archivedConversations || this.archivedConversations.length === 0) {
179
355
  this.loadingIsActive = false;
180
356
  }
181
-
182
357
  }
183
358
 
184
359
 
@@ -198,9 +373,32 @@ export class ConversationListPage implements OnInit {
198
373
  });
199
374
  }
200
375
 
376
+ listenGoOnline() {
377
+ this.events.subscribe('go:online', (goonline) => {
378
+ this.logger.info('[CONVS-LIST-PAGE] - listen To go:online - goonline', goonline);
379
+ // this.events.unsubscribe('profileInfoButtonClick:logout')
380
+ if (goonline === true) {
381
+ this.displayNewConvsItem = true
382
+ }
383
+ });
384
+ }
385
+
386
+ listenGoOffline() {
387
+
388
+ this.events.subscribe('go:offline', (offline) => {
389
+ this.logger.info('[CONVS-LIST-PAGE] - listen To go:offline - offline', offline);
390
+ // this.events.unsubscribe('profileInfoButtonClick:logout')
391
+ if (offline === true) {
392
+ this.displayNewConvsItem = false
393
+ }
394
+ });
395
+ }
396
+
201
397
  listenToLogoutEvent() {
202
398
  this.events.subscribe('profileInfoButtonClick:logout', (hasclickedlogout) => {
203
399
  this.logger.info('[CONVS-LIST-PAGE] - listenToLogoutEvent - hasclickedlogout', hasclickedlogout);
400
+
401
+
204
402
  this.conversations = []
205
403
  this.conversationsHandlerService.conversations = [];
206
404
  this.uidConvSelected = null;
@@ -311,6 +509,9 @@ export class ConversationListPage implements OnInit {
311
509
  * evento richiamato quando si seleziona un utente nell'elenco degli user
312
510
  * apro dettaglio conversazione
313
511
  */
512
+ // --------------------------------
513
+ // !!!!!! IS USED? ?????
514
+ // ------------------------------
314
515
  subscribeChangedConversationSelected = (user: UserModel, type: string) => {
315
516
  this.logger.log('[CONVS-LIST-PAGE] ************** subscribeUidConvSelectedChanged navigateByUrl', user, type);
316
517
  this.uidConvSelected = user.uid;
@@ -396,11 +597,14 @@ export class ConversationListPage implements OnInit {
396
597
  this.tenant = appconfig.firebaseConfig.tenant;
397
598
  this.logger.log('[CONVS-LIST-PAGE] - initialize -> firebaseConfig tenant ', this.tenant);
398
599
 
399
- this.loggedUserUid = this.tiledeskAuthService.getCurrentUser().uid;
600
+ if (this.tiledeskAuthService.getCurrentUser()) {
601
+ this.loggedUserUid = this.tiledeskAuthService.getCurrentUser().uid;
602
+ }
400
603
  this.subscriptions = [];
401
604
  this.initConversationsHandler();
402
605
  this.initVariables();
403
606
  this.initSubscriptions();
607
+
404
608
  // this.initHandlerEventEmitter();
405
609
  }
406
610
 
@@ -445,6 +649,7 @@ export class ConversationListPage implements OnInit {
445
649
  setUidConvSelected(uidConvSelected: string, conversationType?: string,) {
446
650
  this.logger.log('[CONVS-LIST-PAGE] setuidCOnvSelected', uidConvSelected)
447
651
  this.uidConvSelected = uidConvSelected;
652
+ this.logger.log('uidConvSelected', uidConvSelected)
448
653
  // this.conversationsHandlerService.uidConvSelected = uidConvSelected;
449
654
  if (uidConvSelected) {
450
655
  let conversationSelected;
@@ -455,7 +660,7 @@ export class ConversationListPage implements OnInit {
455
660
  }
456
661
  if (conversationSelected) {
457
662
  this.logger.log('[CONVS-LIST-PAGE] conversationSelected', conversationSelected);
458
- this.logger.log('[CONVS-LIST-PAGE] la conv ', this.conversationSelected, ' has already been loaded');
663
+ this.logger.log('[CONVS-LIST-PAGE] the conversation ', this.conversationSelected, ' has already been loaded');
459
664
  this.conversationSelected = conversationSelected;
460
665
  this.logger.log('[CONVS-LIST-PAGE] setUidConvSelected: ', this.conversationSelected);
461
666
  }
@@ -463,7 +668,7 @@ export class ConversationListPage implements OnInit {
463
668
  }
464
669
 
465
670
  onConversationSelected(conversation: ConversationModel) {
466
- //console.log('returnSelectedConversation::', conversation)
671
+ this.logger.log('onConversationSelected conversation', conversation)
467
672
  if (conversation.archived) {
468
673
  this.navigateByUrl('archived', conversation.uid)
469
674
  this.logger.log('[CONVS-LIST-PAGE] onConversationSelected archived conversation.uid ', conversation.uid)
@@ -493,8 +698,8 @@ export class ConversationListPage implements OnInit {
493
698
  }
494
699
 
495
700
  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)
701
+ // this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded ', conversation)
702
+ // this.logger.log('[CONVS-LIST-PAGE] onConversationLoaded is new? ', conversation.is_new)
498
703
  // if (conversation.is_new === false) {
499
704
  // this.ionContentConvList.scrollToTop(0);
500
705
  // }
@@ -560,6 +765,7 @@ export class ConversationListPage implements OnInit {
560
765
 
561
766
 
562
767
  navigateByUrl(converationType: string, uidConvSelected: string) {
768
+ this.logger.log('[CONVS-LIST-PAGE] calling navigateByUrl: ');
563
769
  this.logger.log('[CONVS-LIST-PAGE] navigateByUrl uidConvSelected: ', uidConvSelected);
564
770
  this.logger.log('[CONVS-LIST-PAGE] navigateByUrl run this.setUidConvSelected');
565
771
  this.logger.log('[CONVS-LIST-PAGE] navigateByUrl this.uidConvSelected ', this.uidConvSelected);
@@ -567,12 +773,14 @@ export class ConversationListPage implements OnInit {
567
773
 
568
774
  this.setUidConvSelected(uidConvSelected, converationType);
569
775
  if (checkPlatformIsMobile()) {
570
- this.logger.log('[CONVS-LIST-PAGE] PLATFORM_MOBILE 1', this.navService);
776
+ this.logger.log('[CONVS-LIST-PAGE] checkPlatformIsMobile(): ', checkPlatformIsMobile());
777
+ this.logger.log('[CONVS-LIST-PAGE] DESKTOP (window >= 768)', this.navService);
571
778
  let pageUrl = 'conversation-detail/' + this.uidConvSelected + '/' + this.conversationSelected.conversation_with_fullname + '/' + converationType;
572
779
  this.logger.log('[CONVS-LIST-PAGE] pageURL', pageUrl)
573
780
  this.router.navigateByUrl(pageUrl);
574
781
  } else {
575
- this.logger.log('[CONVS-LIST-PAGE] PLATFORM_DESKTOP 2', this.navService);
782
+ this.logger.log('[CONVS-LIST-PAGE] checkPlatformIsMobile(): ', checkPlatformIsMobile());
783
+ this.logger.log('[CONVS-LIST-PAGE] MOBILE (window < 768) ', this.navService);
576
784
  let pageUrl = 'conversation-detail/' + this.uidConvSelected;
577
785
  if (this.conversationSelected && this.conversationSelected.conversation_with_fullname) {
578
786
  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,116 @@
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
+ this.hideHotjarFeedbackBtn();
40
+ }
41
+
42
+ hideHotjarFeedbackBtn() {
43
+ const hotjarFeedbackBtn = <HTMLElement>document.querySelector("#_hj_feedback_container > div > button")
44
+ if (hotjarFeedbackBtn) {
45
+ hotjarFeedbackBtn.style.display = "none";
46
+ }
47
+ }
48
+
49
+ buildIFRAME() {
50
+ this.logger.log('[UNASSIGNED-CONVS-PAGE] - UNASSIGNED CONVS URL (ngOnInit)', this.unassigned_convs_url);
51
+ this.unassigned_convs_url_sanitized = this.sanitizer.sanitize(SecurityContext.URL, this.unassigned_convs_url)
52
+ this.logger.log('[UNASSIGNED-CONVS-PAGE] - UNASSIGNED CONVS URL SANITIZED (ngOnInit)', this.unassigned_convs_url_sanitized);
53
+ // this.has_loaded = false
54
+
55
+ this.ion_content = document.getElementById("iframe-ion-content");
56
+ this.iframe = document.createElement("iframe");
57
+ this.iframe.src = this.unassigned_convs_url_sanitized;
58
+ this.iframe.width = "100%";
59
+ this.iframe.height = "99%";
60
+ this.iframe.id = "unassigned-convs-iframe"
61
+ this.iframe.frameBorder = "0";
62
+ this.iframe.style.border = "none";
63
+ this.iframe.style.background = "white";
64
+ this.ion_content.appendChild(this.iframe);
65
+
66
+ // this.getIframeHaLoaded()
67
+ }
68
+
69
+ getIframeHaLoaded() {
70
+ var self = this;
71
+ var iframe = document.getElementById('unassigned-convs-iframe') as HTMLIFrameElement;;
72
+ this.logger.log('[APP-STORE-INSTALL] GET iframe ', iframe)
73
+ if (iframe) {
74
+ iframe.addEventListener("load", function () {
75
+ self.logger.log("[APP-STORE-INSTALL] GET - Finish");
76
+ let spinnerElem = <HTMLElement>document.querySelector('.stretchspinner-unassigned-convs')
77
+
78
+ self.logger.log('[APP-STORE-INSTALL] GET iframeDoc readyState spinnerElem', spinnerElem)
79
+ spinnerElem.classList.add("hide-stretchspinner")
80
+
81
+ });
82
+ }
83
+ }
84
+
85
+ listenToPostMsg() {
86
+ window.addEventListener("message", (event) => {
87
+ // console.log("[UNASSIGNED-CONVS-PAGE] message event ", event);
88
+
89
+ if (event && event.data) {
90
+ if (event.data === 'onInitProjectsForPanel') {
91
+ this.isProjectsForPanel = true;
92
+ }
93
+ if (event.data === 'onDestroyProjectsForPanel') {
94
+ this.isProjectsForPanel = false;
95
+ }
96
+ }
97
+ });
98
+ }
99
+
100
+
101
+ async onClose() {
102
+ this.logger.log('[UNASSIGNED-CONVS-PAGE] - onClose MODAL')
103
+ this.logger.log('[UNASSIGNED-CONVS-PAGE] - onClose MODAL isModalOpened ', await this.modalController.getTop())
104
+ const isModalOpened = await this.modalController.getTop();
105
+
106
+ if (isModalOpened) {
107
+ this.modalController.dismiss({
108
+
109
+ confirmed: true
110
+ });
111
+ } else {
112
+ this.navService.pop();
113
+ }
114
+ }
115
+
116
+ }