scandit-react-native-datacapture-core 6.16.0 → 6.16.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.
@@ -1,5 +1,5 @@
1
1
  def DEFAULT_COMPILE_SDK_VERSION = 32
2
- def DEFAULT_MIN_SDK_VERSION = 24
2
+ def DEFAULT_MIN_SDK_VERSION = 23
3
3
  def DEFAULT_TARGET_SDK_VERSION = 32
4
4
 
5
5
  def safeExtGet(prop, fallback) {
@@ -42,7 +42,7 @@ android {
42
42
  }
43
43
 
44
44
  dependencies {
45
- def sdk_version = "6.16.0"
45
+ def sdk_version = "6.16.2"
46
46
 
47
47
  api "com.scandit.datacapture:core:$sdk_version"
48
48
 
@@ -7,60 +7,67 @@
7
7
  import Foundation
8
8
  import ScanditCaptureCore
9
9
 
10
- @objc(RNTSDCDataCaptureViewManager)
11
- class RNTSDCDataCaptureViewManager: RCTViewManager, RNTDataCaptureViewListener {
12
-
13
- internal var container = UIView()
10
+ class RNTSDCDataCaptureViewWrapper: UIView {
11
+ weak var viewManager: RNTSDCDataCaptureViewManager?
14
12
 
15
- var dataCaptureView: DataCaptureView? {
16
- willSet {
17
- dataCaptureView?.removeFromSuperview()
18
- }
19
-
20
- didSet {
21
- guard let dataCaptureView = dataCaptureView else { return }
22
- dataCaptureView.frame = container.bounds
23
- dataCaptureView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
24
- container.addSubview(dataCaptureView)
13
+ override func removeFromSuperview() {
14
+ if let viewManager = viewManager,
15
+ let index = viewManager.containers.firstIndex(of: self) {
16
+ viewManager.containers.remove(at: index)
17
+ viewManager.addCaptureViewToLastContainer()
25
18
  }
19
+ super.removeFromSuperview()
26
20
  }
21
+ }
22
+
23
+ @objc(RNTSDCDataCaptureViewManager)
24
+ class RNTSDCDataCaptureViewManager: RCTViewManager {
25
+
26
+ internal var containers: [RNTSDCDataCaptureViewWrapper] = []
27
27
 
28
28
  override class func requiresMainQueueSetup() -> Bool {
29
29
  true
30
30
  }
31
31
 
32
- deinit {
33
- if bridge == nil {
34
- return;
32
+ var isObserving = false
33
+
34
+ func addCaptureViewToLastContainer() {
35
+ guard let container = containers.last,
36
+ let coreModule = bridge.module(for: ScanditDataCaptureCore.self) as? ScanditDataCaptureCore,
37
+ let captureView = coreModule.dataCaptureView else {
38
+ return
39
+ }
40
+ if captureView.superview != nil {
41
+ captureView.removeFromSuperview()
35
42
  }
36
- guard let coreModule =
37
- bridge.module(for: ScanditDataCaptureCore.self) as? ScanditDataCaptureCore else { return }
38
- coreModule.removeRNTDataCaptureViewListener(self)
43
+ captureView.frame = container.bounds
44
+ captureView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
45
+ container.addSubview(captureView)
39
46
  }
40
47
 
41
- var isObserving = false
42
-
43
48
  override func view() -> UIView! {
44
49
 
45
- if !isObserving, let coreModule = bridge.module(for: ScanditDataCaptureCore.self) as? ScanditDataCaptureCore {
50
+ if !isObserving {
46
51
  isObserving = true
47
- coreModule.addRNTDataCaptureViewListener(self)
52
+ }
53
+
54
+ guard let coreModule = bridge.module(for: ScanditDataCaptureCore.self) as? ScanditDataCaptureCore else {
55
+ return nil
48
56
  }
49
57
 
50
- container = UIView()
58
+ let container = RNTSDCDataCaptureViewWrapper()
51
59
 
52
- if let dataCaptureview = dataCaptureView {
60
+ if let dataCaptureview = coreModule.dataCaptureView {
61
+ if dataCaptureview.superview != nil {
62
+ dataCaptureview.removeFromSuperview()
63
+ }
53
64
  dataCaptureview.frame = container.bounds
54
65
  dataCaptureview.autoresizingMask = [.flexibleWidth, .flexibleHeight]
55
66
  container.addSubview(dataCaptureview)
56
67
  }
68
+ container.viewManager = self
69
+ containers.append(container)
57
70
 
58
71
  return container
59
72
  }
60
-
61
- func didUpdate(dataCaptureView: DataCaptureView?) {
62
- DispatchQueue.main.async {
63
- self.dataCaptureView = dataCaptureView
64
- }
65
- }
66
73
  }
@@ -9,7 +9,7 @@ var DataCaptureVersion = /** @class */ (function () {
9
9
  }
10
10
  Object.defineProperty(DataCaptureVersion, "pluginVersion", {
11
11
  get: function () {
12
- return '6.16.0';
12
+ return '6.16.2';
13
13
  },
14
14
  enumerable: false,
15
15
  configurable: true
package/js/Feedback.js CHANGED
@@ -59,7 +59,7 @@ var Vibration = /** @class */ (function (_super) {
59
59
  configurable: true
60
60
  });
61
61
  Vibration.fromJSON = function (json) {
62
- if (json.type === "waveForm") {
62
+ if (json.type === 'waveForm') {
63
63
  return new WaveFormVibration(json.timings, json.amplitudes);
64
64
  }
65
65
  return new Vibration(json.type);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scandit-react-native-datacapture-core",
3
- "version": "6.16.0",
3
+ "version": "6.16.2",
4
4
  "description": "Scandit Data Capture SDK for React Native",
5
5
  "homepage": "https://github.com/Scandit/scandit-react-native-datacapture-core",
6
6
  "main": "js/index.js",
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
16
16
  s.requires_arc = true
17
17
  s.module_name = "ScanditDataCaptureCore"
18
18
  s.header_dir = "ScanditDataCaptureCore"
19
- s.dependency 'ScanditCaptureCore', '= 6.16.0'
19
+ s.dependency 'ScanditCaptureCore', '= 6.16.2'
20
20
 
21
21
  s.dependency "React"
22
22
  end