@sodyo/react-native-sodyo-sdk 3.8.6 → 3.9.0

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.
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
 
2
2
  # React Native Sodyo SDK Plugin that wraps Sodyo sdk for Android and iOS
3
3
 
4
- [SodyoSDK for iOS](https://github.com/sodyo-ltd/SodyoSDKPod) v3.60.06
4
+ [SodyoSDK for iOS](https://github.com/sodyo-ltd/SodyoSDKPod) v3.60.07
5
5
 
6
- [SodyoSDK for Android](https://search.maven.org/search?q=a:sodyo-android-sdk) v3.60.03
6
+ [SodyoSDK for Android](https://search.maven.org/search?q=a:sodyo-android-sdk) v3.60.05
7
7
 
8
8
 
9
9
  ## Install
@@ -12,11 +12,11 @@ Pod::Spec.new do |s|
12
12
  s.author = package['author']
13
13
  s.homepage = package['homepage']
14
14
  s.platform = :ios, "11.0"
15
- s.source = { :git => "https://github.com/sodyo-ltd/SodyoSDKPod", :commit => "d9110b4" }
15
+ s.source = { :git => "https://github.com/sodyo-ltd/SodyoSDKPod", :commit => "7c30b89" }
16
16
  s.source_files = "ios/**/*.{h,m}"
17
17
  s.requires_arc = true
18
18
 
19
19
  s.dependency "React"
20
- s.dependency "SodyoSDK", "3.60.06"
20
+ s.dependency "SodyoSDK", "3.60.07"
21
21
  end
22
22
 
@@ -55,7 +55,7 @@ repositories {
55
55
 
56
56
  dependencies {
57
57
  implementation ('com.facebook.react:react-native:+')
58
- implementation ('com.sodyo:sodyo-android-sdk:3.60.03') {
58
+ implementation ('com.sodyo:sodyo-android-sdk:3.60.05') {
59
59
  transitive = true
60
60
  exclude group: 'com.parse.bolts', module: 'bolts-android'
61
61
  }
@@ -10,6 +10,8 @@ package com.sodyo.RNSodyoSDK;
10
10
  import com.facebook.react.bridge.ReadableArray;
11
11
  import com.facebook.react.bridge.ReadableMap;
12
12
  import com.facebook.react.bridge.ReadableType;
13
+ import com.facebook.react.bridge.WritableArray;
14
+ import com.facebook.react.bridge.Arguments;
13
15
 
14
16
  import java.util.ArrayList;
15
17
  import java.util.HashMap;
@@ -13,7 +13,7 @@ import android.app.FragmentManager;
13
13
  import android.app.FragmentTransaction;
14
14
  import javax.annotation.Nullable;
15
15
 
16
- import com.sodyo.sdk.SodyoScannerFragment;
16
+ import com.sodyo.sdk.SodyoOpenCvScannerFragment;
17
17
 
18
18
  public class RNSodyoSdkView extends SimpleViewManager<FrameLayout> {
19
19
  static final String TAG = "RNSodyoSdkView";
@@ -24,10 +24,6 @@ public class RNSodyoSdkView extends SimpleViewManager<FrameLayout> {
24
24
 
25
25
  private final @Nullable ReactApplicationContext mCallerContext;
26
26
 
27
- private @Nullable SodyoScannerFragment sodyoFragment;
28
-
29
- private boolean isCameraEnabled = true;
30
-
31
27
  @Override
32
28
  public String getName() {
33
29
  return REACT_CLASS;
@@ -39,19 +35,22 @@ public class RNSodyoSdkView extends SimpleViewManager<FrameLayout> {
39
35
 
40
36
  @Override
41
37
  public FrameLayout createViewInstance(ThemedReactContext context) {
42
- Log.i(TAG,"createViewInstance");
38
+ Log.i(TAG, "createViewInstance");
43
39
 
44
40
  final FrameLayout view = new FrameLayout(context);
45
-
46
- if (sodyoFragment == null) {
47
- Log.i(TAG,"init SodyoScannerFragment");
48
- sodyoFragment = new SodyoScannerFragment();
49
- }
41
+ SodyoOpenCvScannerFragment sodyoFragment = new SodyoOpenCvScannerFragment();
50
42
 
51
43
  FragmentManager fragmentManager = mCallerContext.getCurrentActivity().getFragmentManager();
44
+ Fragment fragment = fragmentManager.findFragmentByTag(TAG_FRAGMENT);
52
45
  FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
53
46
 
54
- fragmentTransaction.add(sodyoFragment, TAG_FRAGMENT).commit();
47
+
48
+ if (fragment != null) {
49
+ fragmentTransaction.remove(fragment);
50
+ }
51
+
52
+ fragmentTransaction.add(sodyoFragment, TAG_FRAGMENT);
53
+ fragmentTransaction.commit();
55
54
 
56
55
  fragmentManager.executePendingTransactions();
57
56
 
@@ -63,10 +62,7 @@ public class RNSodyoSdkView extends SimpleViewManager<FrameLayout> {
63
62
  public void onDropViewInstance(FrameLayout view) {
64
63
  super.onDropViewInstance(view);
65
64
 
66
- Log.i(TAG,"onDropViewInstance");
67
-
68
- sodyoFragment = null;
69
- isCameraEnabled = true;
65
+ Log.i(TAG, "onDropViewInstance");
70
66
 
71
67
  try {
72
68
  FragmentManager fragmentManager = mCallerContext.getCurrentActivity().getFragmentManager();
@@ -75,27 +71,9 @@ public class RNSodyoSdkView extends SimpleViewManager<FrameLayout> {
75
71
  if (fragment != null) {
76
72
  fragmentManager.beginTransaction().remove(fragment).commit();
77
73
  }
74
+
78
75
  } catch (Exception e) {
79
- e.printStackTrace();
76
+ e.printStackTrace();
80
77
  }
81
78
  }
82
-
83
- @ReactProp(name = "isEnabled", defaultBoolean=true)
84
- public void setIsEnabled(FrameLayout view, boolean isEnabled) {
85
- if (sodyoFragment == null) {
86
- return;
87
- }
88
-
89
- if (isEnabled && !isCameraEnabled) {
90
- Log.i(TAG,"start camera");
91
- isCameraEnabled = true;
92
- sodyoFragment.startCamera();
93
- }
94
-
95
- if (!isEnabled && isCameraEnabled) {
96
- Log.i(TAG,"stop camera");
97
- isCameraEnabled = false;
98
- sodyoFragment.stopCamera();
99
- }
100
- }
101
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sodyo/react-native-sodyo-sdk",
3
- "version": "3.8.6",
3
+ "version": "3.9.0",
4
4
  "description": "RNSodyoSdk",
5
5
  "main": "sodyosdk.js",
6
6
  "typings": "./sodyosdk.d.ts",
package/sodyosdk.js CHANGED
@@ -183,25 +183,11 @@ export default {
183
183
  };
184
184
 
185
185
  export class Scanner extends Component {
186
- static defaultProps = {
187
- isEnabled: true,
188
- isTroubleShootingEnabled: false,
189
- };
190
-
191
- componentDidUpdate(prevProps: Readonly<P>, prevState: Readonly<S>, snapshot: SS) {
192
- if (this.props.isTroubleShootingEnabled) {
193
- if (Platform.OS !== 'ios') {
194
- return RNSodyoSdk.startTroubleshoot()
195
- }
196
- }
197
- }
198
-
199
186
  render () {
200
- const { isEnabled, isTroubleShootingEnabled, children } = this.props;
187
+ const { children, isTroubleShootingEnabled } = this.props;
201
188
  return (
202
189
  <Fragment>
203
190
  <RNSodyoSdkView
204
- isEnabled={isEnabled}
205
191
  isTroubleShootingEnabled={isTroubleShootingEnabled}
206
192
  style={{ height: '100%', width: '100%' }}
207
193
  />