scandit-react-native-datacapture-core 6.27.2 → 6.28.0-beta.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.
@@ -15,6 +15,14 @@ class RNTSDCDataCaptureViewWrapper: UIView {
15
15
  if let viewManager = viewManager,
16
16
  let index = viewManager.containers.firstIndex(of: self) {
17
17
  viewManager.containers.remove(at: index)
18
+
19
+ if let droppedView = viewManager.dataCaptureView {
20
+ viewManager.dataCaptureView = nil
21
+ // on iOS we don't have a callback like the android onDropViewInstance where we can remove the dropped instance.
22
+ // here we just override the willRemoveSubview of the wrapper and notify the core module that the dcview has been removed.
23
+ DeserializationLifeCycleDispatcher.shared.dispatchDataCaptureViewRemoved(view: droppedView)
24
+ }
25
+
18
26
  viewManager.addCaptureViewToLastContainer()
19
27
  }
20
28
  super.removeFromSuperview()
@@ -22,7 +30,7 @@ class RNTSDCDataCaptureViewWrapper: UIView {
22
30
  }
23
31
 
24
32
  @objc(RNTSDCDataCaptureViewManager)
25
- class RNTSDCDataCaptureViewManager: RCTViewManager, DeserializationLifeCycleObserver, RCTInvalidating {
33
+ class RNTSDCDataCaptureViewManager: RCTViewManager, DeserializationLifeCycleObserver {
26
34
 
27
35
  internal var containers: [RNTSDCDataCaptureViewWrapper] = []
28
36
 
@@ -33,9 +41,6 @@ class RNTSDCDataCaptureViewManager: RCTViewManager, DeserializationLifeCycleObse
33
41
  }
34
42
 
35
43
  guard let dcView = dataCaptureView else {
36
- container.subviews.forEach {
37
- $0.removeFromSuperview()
38
- }
39
44
  return
40
45
  }
41
46
 
@@ -61,33 +66,13 @@ class RNTSDCDataCaptureViewManager: RCTViewManager, DeserializationLifeCycleObse
61
66
 
62
67
  var isObserving = false
63
68
 
64
- override init() {
65
- super.init()
66
- DeserializationLifeCycleDispatcher.shared.attach(observer: self)
67
- }
68
-
69
- func invalidate() {
70
- DeserializationLifeCycleDispatcher.shared.detach(observer: self)
71
- }
72
-
73
69
  func addCaptureViewToLastContainer() {
74
70
  guard let container = containers.last,
75
- let captureView = dataCaptureView else {
71
+ let captureView = DataCaptureViewHandler.shared.topmostDataCaptureView else {
76
72
  return
77
73
  }
78
- if captureView.superview != nil && captureView.superview == container {
79
- // if attached to the same container do nothing. Removing and adding
80
- // it again might trigger something in the DataCaptureView that we don't
81
- // want. (overlay re-drawn, black screen, etc.)
82
- return
83
- }
84
-
85
- if captureView.superview != nil {
86
- captureView.removeFromSuperview()
87
- }
88
- captureView.frame = container.bounds
89
- captureView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
90
- container.addSubview(captureView)
74
+
75
+ dataCaptureView = captureView
91
76
  }
92
77
 
93
78
  override func view() -> UIView! {
@@ -111,8 +96,4 @@ class RNTSDCDataCaptureViewManager: RCTViewManager, DeserializationLifeCycleObse
111
96
 
112
97
  return container
113
98
  }
114
-
115
- func dataCaptureView(deserialized view: DataCaptureView?) {
116
- dataCaptureView = view
117
- }
118
99
  }
@@ -18,17 +18,6 @@ public struct ReactNativeResult: FrameworksResult {
18
18
  }
19
19
 
20
20
  public func success(result object: Any?) {
21
- if let resultDict = object as? [String: Any] {
22
- do {
23
- let jsonData = try JSONSerialization.data(withJSONObject: resultDict, options: [])
24
- if let jsonString = String(data: jsonData, encoding: .utf8) {
25
- resolve(jsonString)
26
- }
27
- } catch let error {
28
- reject(code: "JSON_ERROR", message: "Failed to convert to JSON", details: error)
29
- }
30
- return
31
- }
32
21
  resolve(object)
33
22
  }
34
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scandit-react-native-datacapture-core",
3
- "version": "6.27.2",
3
+ "version": "6.28.0-beta.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": "dist/index.js",
@@ -49,6 +49,6 @@
49
49
  "typescript": "4.9.5"
50
50
  },
51
51
  "dependencies": {
52
- "scandit-datacapture-frameworks-core": "6.27.2"
52
+ "scandit-datacapture-frameworks-core": "6.28.0-beta.2"
53
53
  }
54
54
  }
@@ -18,6 +18,6 @@ Pod::Spec.new do |s|
18
18
  s.module_name = "ScanditDataCaptureCore"
19
19
  s.header_dir = "ScanditDataCaptureCore"
20
20
 
21
- s.dependency "scandit-datacapture-frameworks-core", '= 6.27.2'
21
+ s.dependency "scandit-datacapture-frameworks-core", '= 6.28.0-beta.2'
22
22
  s.dependency "React"
23
23
  end