Skip to content

Commit d2c9dea

Browse files
Release 54.4.0 (#185)
1 parent eb6debf commit d2c9dea

File tree

9 files changed

+45
-33
lines changed

9 files changed

+45
-33
lines changed

example/RNExampleApp/android/app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ android {
8787
minSdkVersion rootProject.ext.minSdkVersion
8888
targetSdkVersion rootProject.ext.targetSdkVersion
8989
versionCode 5
90-
versionName "54.2.2"
90+
versionName "54.4.0"
9191
multiDexEnabled true
9292

9393
buildConfigField("boolean", "REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS", (findProperty("reactNative.unstable_useRuntimeSchedulerAlways") ?: true).toString())

example/RNExampleApp/ios/RNExampleApp.xcodeproj/project.pbxproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@
272272
inputPaths = (
273273
"${PODS_ROOT}/Target Support Files/Pods-RNExampleApp/Pods-RNExampleApp-resources.sh",
274274
"${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle",
275-
"${PODS_ROOT}/Anyline/AnylineSDK_iOS_54.2.1/Framework/AnylineResources.bundle",
275+
"${PODS_ROOT}/Anyline/AnylineSDK_iOS_54.4.0/Framework/AnylineResources.bundle",
276276
);
277277
name = "[CP] Copy Pods Resources";
278278
outputPaths = (
@@ -347,7 +347,7 @@
347347
INFOPLIST_FILE = RNExampleApp/Info.plist;
348348
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
349349
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
350-
MARKETING_VERSION = 54.2.1;
350+
MARKETING_VERSION = 54.4.0;
351351
OTHER_LDFLAGS = (
352352
"$(inherited)",
353353
"-ObjC",
@@ -380,7 +380,7 @@
380380
INFOPLIST_FILE = RNExampleApp/Info.plist;
381381
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
382382
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
383-
MARKETING_VERSION = 54.2.1;
383+
MARKETING_VERSION = 54.4.0;
384384
OTHER_LDFLAGS = (
385385
"$(inherited)",
386386
"-ObjC",

example/RNExampleApp/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-example-app",
3-
"version": "54.2.2",
3+
"version": "54.4.0",
44
"private": true,
55
"scripts": {
66
"initProject": "yarn add expo && yarn add ../../plugin",

example/RNExampleApp/src/index.js

+6
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,12 @@ class Anyline extends Component {
241241
}
242242
this.setState({ titles });
243243
try {
244+
const isInitialized = await AnylineOCR.isInitialized();
245+
console.log(`AnylineOCR.initialized: ` + isInitialized);
246+
if (!isInitialized) {
247+
await AnylineOCR.setupAnylineSDK(demoAppLicenseKey);
248+
}
249+
244250
console.log(`AnylineOCR.setupPromise`);
245251
const result = await AnylineOCR.setupPromise(
246252
JSON.stringify(config),

plugin/android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ repositories {
6161

6262
dependencies {
6363
implementation fileTree(dir: "libs", include: ["*.jar"])
64-
implementation 'io.anyline:anylinesdk:54.2.0'
64+
implementation 'io.anyline:anylinesdk:54.4.0'
6565
implementation "com.facebook.react:react-native:+"
6666
implementation("com.google.android.material:material:1.9.0")
6767
implementation 'androidx.multidex:multidex:2.0.1'

plugin/android/src/main/java/com/anyline/reactnative/AnylineSDKPlugin.java

+13-12
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class AnylineSDKPlugin extends ReactContextBaseJavaModule implements ResultRepor
4040
}
4141

4242
public static final String REACT_CLASS = "AnylineSDKPlugin";
43-
public static final String EXTRA_LICENSE_KEY = "EXTRA_LICENSE_KEY";
4443
public static final String EXTRA_CONFIG_JSON = "EXTRA_CONFIG_JSON";
4544
public static final String EXTRA_SCANVIEW_INITIALIZATION_PARAMETERS = "EXTRA_SCANVIEW_INITIALIZATION_PARAMETERS";
4645
public static final String EXTRA_SCAN_MODE = "EXTRA_SCAN_MODE";
@@ -100,6 +99,11 @@ public void licenseKeyExpiryDate(final Promise promise) {
10099
}
101100
}
102101

102+
@ReactMethod
103+
public void isInitialized(final Promise promise) {
104+
promise.resolve(AnylineSdk.isInitialized());
105+
}
106+
103107
@ReactMethod
104108
@Deprecated
105109
public void setupScanViewWithConfigJson(String config, String scanMode, Callback onResultReact, Callback onErrorReact) {
@@ -315,19 +319,17 @@ private void scan() throws LicenseException, JSONException {
315319

316320
Intent intent = new Intent(getCurrentActivity(), ScanActivity.class);
317321

318-
configObject = new JSONObject(this.config);
319-
320-
if (this.license == null || this.license.isEmpty()) {
321-
if (configObject.has("license")) {
322-
//if there is a license on JSON config then this license will be
323-
//used to init or re-init the SDK
324-
AnylineSdk.init(configObject.getString("license"), reactContext, "", CacheConfig.Preset.Default.INSTANCE, wrapperConfig);
325-
license = configObject.get("license").toString();
326-
} else {
327-
throw new JSONException("No License in config. Please check your configuration.");
322+
if (!AnylineSdk.isInitialized()) {
323+
if (this.license != null) {
324+
AnylineSdk.init(this.license, reactContext, "", CacheConfig.Preset.Default.INSTANCE, wrapperConfig);
325+
}
326+
else {
327+
throw new JSONException("SDK is not initialized. Please initialize SDK before scanning.");
328328
}
329329
}
330330

331+
configObject = new JSONObject(this.config);
332+
331333
JSONObject optionsJSONObject = configObject.optJSONObject("options");
332334

333335
if (optionsJSONObject != null) {
@@ -337,7 +339,6 @@ private void scan() throws LicenseException, JSONException {
337339
);
338340
}
339341

340-
intent.putExtra(EXTRA_LICENSE_KEY, license);
341342
intent.putExtra(EXTRA_CONFIG_JSON, configObject.toString());
342343
intent.putExtra(EXTRA_SCANVIEW_INITIALIZATION_PARAMETERS, scanViewInitializationParameters);
343344

plugin/ios/AnylineReact.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Pod::Spec.new do |s|
1818
s.source = { :git => "https://github.com/Anyline/anyline-ocr-react-native-module.git", :tag => "#{s.version}" }
1919

2020
s.source_files = "*.{h,m}"
21-
s.dependency "Anyline", "54.2.1"
21+
s.dependency "Anyline", "54.4.0"
2222
s.dependency "React"
2323

2424
end

plugin/ios/AnylineSDKPlugin.m

+11-6
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ - (UIView *)view {
126126
resolve([AnylineSDK licenseExpirationDate]);
127127
}
128128

129+
RCT_EXPORT_METHOD(isInitialized:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
130+
BOOL isInitialized = [AnylineSDK isInitialized];
131+
resolve(@(isInitialized));
132+
}
133+
129134
RCT_EXPORT_METHOD(exportCachedEvents:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
130135
_resolveBlock = resolve;
131136
_rejectBlock = reject;
@@ -148,7 +153,7 @@ - (void)initView:(NSString *)scanMode initializationParamsStr:(NSString * _Nulla
148153
if (!data) {
149154
[NSException raise:@"Config could not be loaded from disk" format:@"Config could not be loaded from disk"];
150155
}
151-
156+
152157
NSError *error = nil;
153158
id dictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
154159

@@ -172,7 +177,7 @@ - (void)initView:(NSString *)scanMode initializationParamsStr:(NSString * _Nulla
172177

173178
dispatch_async(dispatch_get_main_queue(), ^{
174179
[[UIApplication sharedApplication] keyWindow].rootViewController.modalPresentationStyle = UIModalPresentationFullScreen;
175-
180+
176181
if ([[scanMode uppercaseString] isEqualToString:[@"scan" uppercaseString]]) {
177182
ALPluginScanViewController *pluginScanViewController =
178183
[[ALPluginScanViewController alloc] initWithLicensekey:self.appKey
@@ -182,7 +187,7 @@ - (void)initView:(NSString *)scanMode initializationParamsStr:(NSString * _Nulla
182187
finished:^(NSDictionary * _Nullable callbackObj, NSError * _Nullable error) {
183188
[self returnCallback:callbackObj andError:error];
184189
}];
185-
190+
186191
if (pluginScanViewController != nil){
187192
[pluginScanViewController setModalPresentationStyle: UIModalPresentationFullScreen];
188193
[[[UIApplication sharedApplication] keyWindow].rootViewController presentViewController:pluginScanViewController animated:YES completion:nil];
@@ -196,7 +201,7 @@ - (void)initView:(NSString *)scanMode initializationParamsStr:(NSString * _Nulla
196201
finished:^(NSDictionary * _Nullable callbackObj, NSError * _Nullable error) {
197202
[self returnCallback:callbackObj andError:error];
198203
}];
199-
204+
200205
if (pluginScanViewController != nil){
201206
[pluginScanViewController setModalPresentationStyle: UIModalPresentationFullScreen];
202207
[[[UIApplication sharedApplication] keyWindow].rootViewController presentViewController:pluginScanViewController animated:YES completion:nil];
@@ -210,12 +215,12 @@ - (void)initView:(NSString *)scanMode initializationParamsStr:(NSString * _Nulla
210215

211216
- (void)pluginScanViewController:(nonnull ALPluginScanViewController *)pluginScanViewController didScan:(nonnull id)scanResult continueScanning:(BOOL)continueScanning {
212217
NSString *resultJson = @"";
213-
218+
214219
NSError *error;
215220
NSData *jsonData = [NSJSONSerialization dataWithJSONObject: scanResult
216221
options:0
217222
error:&error];
218-
223+
219224
if (! jsonData) {
220225
NSLog(@"bv_jsonStringWithPrettyPrint: error: %@", error.localizedDescription);
221226
} else {

plugin/package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
{
2-
"_from": "anyline-ocr-react-native-module@^54.2.2",
3-
"_id": "anyline-ocr-react-native-module@^54.2.2",
2+
"_from": "anyline-ocr-react-native-module@^54.4.0",
3+
"_id": "anyline-ocr-react-native-module@^54.4.0",
44
"_inBundle": false,
55
"_integrity": "sha512-BGi9zNkSsoxXywDBIqzgBRvKUBniQOJHDKBrozZubKthZNRBAj8Ry5tW0Me0yLXt/fauME//hbC0wsenfPJZqw==",
66
"_location": "/anyline-ocr-react-native-module",
77
"_phantomChildren": {},
88
"_requested": {
99
"type": "range",
1010
"registry": true,
11-
"raw": "anyline-ocr-react-native-module@^54.2.2",
11+
"raw": "anyline-ocr-react-native-module@^54.4.0",
1212
"name": "anyline-ocr-react-native-module",
1313
"escapedName": "anyline-ocr-react-native-module",
14-
"rawSpec": "^54.2.2",
14+
"rawSpec": "^54.4.0",
1515
"saveSpec": null,
16-
"fetchSpec": "^54.2.2"
16+
"fetchSpec": "^54.4.0"
1717
},
1818
"_requiredBy": [
1919
"/"
2020
],
21-
"_resolved": "https://registry.npmjs.org/anyline-ocr-react-native-module/-/anyline-ocr-react-native-module-54.2.2.tgz",
21+
"_resolved": "https://registry.npmjs.org/anyline-ocr-react-native-module/-/anyline-ocr-react-native-module-54.4.0.tgz",
2222
"_shasum": "bacbcd260cc662244f59393ed81a6edba009b52c",
23-
"_spec": "anyline-ocr-react-native-module@^54.2.2",
23+
"_spec": "anyline-ocr-react-native-module@^54.4.0",
2424
"_where": "/Users/amiransari/Projects/anyline-ocr-react-native-module1/example/RNExampleApp",
2525
"bugs": {
2626
"url": "https://github.com/Anyline/anyline-ocr-react-native-module/issues"
@@ -47,5 +47,5 @@
4747
"type": "git",
4848
"url": "git+https://github.com/Anyline/anyline-ocr-react-native-module.git"
4949
},
50-
"version": "54.2.2"
50+
"version": "54.4.0"
5151
}

0 commit comments

Comments
 (0)