@chat21/chat21-ionic 3.0.106 → 3.0.107-rc.2

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 (26) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/package.json +1 -1
  3. package/src/app/app.component.html +11 -6
  4. package/src/app/app.component.scss +34 -11
  5. package/src/app/app.component.ts +70 -39
  6. package/src/app/app.module.ts +7 -1
  7. package/src/app/chatlib/conversation-detail/conversation-content/conversation-content.component.ts +0 -5
  8. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.html +0 -1
  9. package/src/app/chatlib/conversation-detail/ion-conversation-detail/ion-conversation-detail.component.scss +4 -4
  10. package/src/app/components/conversations-list/header-conversations-list/header-conversations-list.component.html +2 -3
  11. package/src/app/components/navbar/navbar.component.scss +0 -5
  12. package/src/app/pages/conversation-detail/conversation-detail.page.ts +10 -13
  13. package/src/app/pages/conversations-list/conversations-list.page.ts +10 -20
  14. package/src/app/services/global-settings/global-settings.service.spec.ts +16 -0
  15. package/src/app/services/global-settings/global-settings.service.ts +138 -0
  16. package/src/app/services/triggerEvents/trigerEvents.spec.ts +11 -0
  17. package/src/app/services/triggerEvents/triggerEvents.ts +92 -0
  18. package/src/app/utils/globals.ts +51 -0
  19. package/src/app/utils/toast.ts +1 -1
  20. package/src/assets/test.html +23 -0
  21. package/src/chat21-core/models/department.ts +12 -0
  22. package/src/chat21-core/providers/abstract/upload.service.ts +2 -0
  23. package/src/chat21-core/providers/chat-manager.ts +0 -20
  24. package/src/chat21-core/providers/firebase/firebase-upload.service.ts +83 -0
  25. package/src/chat21-core/providers/native/native-upload-service.ts +46 -0
  26. package/src/chat21-core/utils/utils.ts +33 -86
@@ -400,42 +400,26 @@ export function getDateDifference(startTimestampDate, endTimestampDate){
400
400
  return {days, hours, minutes}
401
401
  }
402
402
 
403
-
404
-
405
- export function popupUrl(html, title) {
406
- const url = this.stripTags(html);
407
- const w = 600;
408
- const h = screen.height - 40;
409
- const left = (screen.width / 2) - (w / 2);
410
- const top = (screen.height / 2) - (h / 2);
411
-
412
- const newWindow = window.open(url, '_blank', 'fullscreen=1, titlebar=0, toolbar=no, location=0, status=0, menubar=0, scrollbars=0, resizable=0, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
413
- if (window.focus) {
414
- newWindow.focus()
403
+ /**
404
+ *
405
+ * @param string
406
+ */
407
+ export function stringToBoolean(string: any): any {
408
+ let val = string;
409
+ if (typeof string !== 'string') {
410
+ val = JSON.stringify(string);
411
+ return val;
415
412
  }
416
- }
417
-
418
- export function isPopupUrl(url) {
419
- let TEMP = url.split('popup=')[1];
420
- // può essere seguito da & oppure "
421
- if (TEMP) {
422
- if (TEMP.startsWith('true')) {
423
- //console.log('isPopupUrl::::: ', TEMP.startsWith('true'));
424
- return true;
425
- }
426
- else {
427
- return false;
428
- }
413
+ if (!string) {
414
+ return;
429
415
  }
430
- else {
431
- return false;
416
+ switch (val.toLowerCase().trim()) {
417
+ case 'true': case 'yes': case '1': return true;
418
+ case 'false': case 'no': case '0': case null: return false;
419
+ default: return val;
432
420
  }
433
421
  }
434
422
 
435
- export function stripTags(html) {
436
- return (html.replace(/<.*?>/g, '')).trim();
437
- }
438
-
439
423
  export function htmlEntities(str) {
440
424
  return String(str)
441
425
  .replace(/&/g, '&amp;')
@@ -475,55 +459,6 @@ export function isInArray(key: string, array: Array<string>) {
475
459
  return false;
476
460
  }
477
461
 
478
- export function createConfirm(translate, alertCtrl, events, title, message, action, onlyOkButton) {
479
-
480
- var LABEL_ANNULLA;// = translate.get('CLOSE_ALERT_CANCEL_LABEL')['value'];
481
- var LABEL_OK;// = translate.get('CLOSE_ALERT_CONFIRM_LABEL')['value'];
482
- translate.get('LABEL_ANNULLA').subscribe((res: string) => {
483
- LABEL_ANNULLA = res;
484
- });
485
- translate.get('LABEL_OK').subscribe((res: string) => {
486
- LABEL_OK = res;
487
- });
488
- var buttons;
489
- if (onlyOkButton) {
490
- buttons = [
491
- {
492
- text: LABEL_OK,
493
- handler: () => {
494
- events.publish('PopupConfirmation', LABEL_OK, action);
495
- // console.log('Agree clicked');
496
- }
497
- }
498
- ]
499
- } else {
500
- buttons = [
501
- {
502
- text: LABEL_ANNULLA,
503
- handler: () => {
504
- events.publish('PopupConfirmation', LABEL_ANNULLA, action);
505
- // console.log('Disagree clicked');
506
- }
507
- },
508
- {
509
- text: LABEL_OK,
510
- handler: () => {
511
- events.publish('PopupConfirmation', LABEL_OK, action);
512
- // console.log('Agree clicked');
513
- }
514
- }
515
- ]
516
- }
517
-
518
- let confirm = alertCtrl.create({
519
- title: title,
520
- message: message,
521
- buttons,
522
- });
523
- // confirm.present();
524
- return confirm;
525
- }
526
-
527
462
  export function createLoading(loadinController, message) {
528
463
  let loading = loadinController.create({
529
464
  spinner: 'circles',
@@ -684,16 +619,28 @@ export function convertColorToRGBA(color, opacity) {
684
619
  return result;
685
620
  }
686
621
 
687
- export function getParameterByName(name: string) {
688
- var url = window.location.href;
622
+ export function getParameterByName(windowContext: any, name: string) {
623
+ const url = windowContext.location.href;
689
624
  name = name.replace(/[\[\]]/g, '\\$&');
690
- var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)', 'i'),
691
- results = regex.exec(url);
692
- if (!results) return null;
693
- if (!results[2]) return '';
625
+ const regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), results = regex.exec(url);
626
+ // console.log('results----> ', results);
627
+ if (!results) { return null; }
628
+ if (!results[2]) {
629
+ return 'true';
630
+ } else if (results[2] === 'false' || results[2] === '0') {
631
+ return 'false';
632
+ }
694
633
  return decodeURIComponent(results[2].replace(/\+/g, ' '));
695
634
  }
696
635
 
636
+ export function getParameterValue(parameter: string, appConfig){
637
+ if(appConfig && appConfig[parameter] === true || appConfig[parameter] === 'true') {
638
+ return true;
639
+ } else if (appConfig && appConfig[parameter] === false || appConfig[parameter] === 'false') {
640
+ return false
641
+ }
642
+ }
643
+
697
644
  // export function emailValidator(str) {
698
645
  // let EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;
699
646
  // if (str != "" && (str.length > 5 || EMAIL_REGEXP.test(str))) {