ngx-scandoc 15.2.0 → 15.2.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.
@@ -358,12 +358,16 @@ class WebcamComponent extends BaseComponent {
358
358
  if (max &&
359
359
  currentWidth &&
360
360
  max > currentWidth &&
361
- conWidth != max) {
362
- console.log('[SET NEW RESOLUTION]');
361
+ conWidth != max &&
362
+ currentWidth != 1920) {
363
+ console.log('[SET NEW RESOLUTION] ', max, currentWidth);
363
364
  this.setupAttempt++;
364
365
  if (this.setupAttempt < 4) {
365
366
  this.setup(videoTrackConstraints);
366
367
  }
368
+ else {
369
+ this.setDeviceId(stream);
370
+ }
367
371
  }
368
372
  else {
369
373
  this.setDeviceId(stream);
@@ -804,11 +808,12 @@ class ScanProvider {
804
808
  });
805
809
  return $request;
806
810
  }
807
- burst(Images) {
811
+ burst(Images, BlurValues) {
808
812
  const data = {
809
813
  AcceptTermsAndConditions: true,
810
814
  DataFields: {
811
815
  Images,
816
+ BlurValues,
812
817
  },
813
818
  };
814
819
  const $request = this.http.post(this.config.validationPath, data);
@@ -2489,6 +2494,7 @@ class ScanComponent extends BaseComponent {
2489
2494
  Response: null,
2490
2495
  ExpectedOutput: null,
2491
2496
  };
2497
+ this.blurValues = [];
2492
2498
  this.scanDatas = [];
2493
2499
  this.idScan = null;
2494
2500
  this.validation = false;
@@ -2586,6 +2592,7 @@ class ScanComponent extends BaseComponent {
2586
2592
  this.scannedImages = [];
2587
2593
  const imagesArray = images.map((m) => m.imageResized.split(',')[1]);
2588
2594
  this.validation = true;
2595
+ // console.log('BURST');
2589
2596
  this.handleBurstData(imagesArray, images);
2590
2597
  }
2591
2598
  else {
@@ -2596,7 +2603,7 @@ class ScanComponent extends BaseComponent {
2596
2603
  });
2597
2604
  }
2598
2605
  handleBurstData(imagesArray, images, type = 'plain') {
2599
- this.__subs(this.scanProvider.burst(imagesArray)).subscribe((resp) => {
2606
+ this.__subs(this.scanProvider.burst(imagesArray, this.blurValues)).subscribe((resp) => {
2600
2607
  this.displayInfo = 'scandoc.info.c' + resp.InfoCode;
2601
2608
  // console.timeEnd('validationPOST');
2602
2609
  // console.log('AnalysisTime', resp.AnalysisTime);
@@ -2605,6 +2612,13 @@ class ScanComponent extends BaseComponent {
2605
2612
  // this.handleLongValidationError(image);
2606
2613
  // }
2607
2614
  // console.warn(resp.Validated, this.numberOfValidations);
2615
+ if (resp.DetectedBlurValue) {
2616
+ this.blurValues.push(resp.DetectedBlurValue);
2617
+ }
2618
+ else {
2619
+ this.blurValues = [];
2620
+ }
2621
+ console.log();
2608
2622
  if (resp.Validated) {
2609
2623
  this.numberOfValidations++;
2610
2624
  this.validationDebug.push(resp);
@@ -2613,7 +2627,7 @@ class ScanComponent extends BaseComponent {
2613
2627
  this.numberOfValidations = 0;
2614
2628
  this.validationDebug = [];
2615
2629
  }
2616
- if (this.numberOfValidations >= 3) {
2630
+ if (resp.Validated) {
2617
2631
  this.displayInfo = '';
2618
2632
  // console.log('[SCANNED INDEX]', resp.Index);
2619
2633
  const selectedImage = images[resp.Index];
@@ -2642,6 +2656,7 @@ class ScanComponent extends BaseComponent {
2642
2656
  this.scanBlastFinish();
2643
2657
  }
2644
2658
  else {
2659
+ this.blurValues = [];
2645
2660
  this.numberOfValidations = 0;
2646
2661
  // console.warn('DEBUG',Side,this.validationDebug)
2647
2662
  this.validationDebug = [];
@@ -2757,43 +2772,6 @@ class ScanComponent extends BaseComponent {
2757
2772
  this.isMobile = !v.matches || this.platform.IOS || this.platform.ANDROID;
2758
2773
  console.log('MNOBILE', this.isMobile);
2759
2774
  });
2760
- // this.imageHandlerSubscription = this.imageHandler.subscribe(
2761
- // (webcamImage: any) => {
2762
- // // return;
2763
- // if (this.startTime === 0) {
2764
- // this.startTime = Date.now();
2765
- // }
2766
- // this.zone.runOutsideAngular(() => {
2767
- // if (webcamImage.base64) {
2768
- // const time = new Date().getTime();
2769
- // if (this.scanImageTimestamps.load > 0) {
2770
- // const { load } = this.scanImageTimestamps;
2771
- // const diff = time - load;
2772
- // // console.warn('TIME', diff);
2773
- // this.scanDelay = diff;
2774
- // }
2775
- // this.scanImageTimestamps.load = time;
2776
- // this.scannedImages.push(webcamImage);
2777
- // this.handleLongValidationError(webcamImage, 'worker');
2778
- // }
2779
- // // this.cd.detectChanges();
2780
- // if (this.scannedImages.length > 4 && !this.validation) {
2781
- // // get last 10
2782
- // console.timeEnd('validationTOTAL_UI');
2783
- // console.time('validationTOTAL_UI');
2784
- // const images = this.scannedImages.slice(-5);
2785
- // // set images to 0
2786
- // this.scannedImages = [];
2787
- // console.log(images);
2788
- // const imagesArray = images.map((m) => m.base64.split(',')[1]);
2789
- // this.validation = true;
2790
- // // this.handleBurstData(imagesArray, images, 'worker');
2791
- // console.time('validationPOST');
2792
- // }
2793
- // this.cd.detectChanges();
2794
- // });
2795
- // }
2796
- // );
2797
2775
  }
2798
2776
  handleBitmapImage(bitmap) {
2799
2777
  const { width, height } = bitmap;