Skip to content

Commit

Permalink
Release 54.4.0 (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitlokhandeanyline authored Nov 19, 2024
1 parent eb6debf commit d2c9dea
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 33 deletions.
2 changes: 1 addition & 1 deletion example/RNExampleApp/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 5
versionName "54.2.2"
versionName "54.4.0"
multiDexEnabled true

buildConfigField("boolean", "REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS", (findProperty("reactNative.unstable_useRuntimeSchedulerAlways") ?: true).toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-RNExampleApp/Pods-RNExampleApp-resources.sh",
"${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle",
"${PODS_ROOT}/Anyline/AnylineSDK_iOS_54.2.1/Framework/AnylineResources.bundle",
"${PODS_ROOT}/Anyline/AnylineSDK_iOS_54.4.0/Framework/AnylineResources.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
Expand Down Expand Up @@ -347,7 +347,7 @@
INFOPLIST_FILE = RNExampleApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 54.2.1;
MARKETING_VERSION = 54.4.0;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -380,7 +380,7 @@
INFOPLIST_FILE = RNExampleApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 54.2.1;
MARKETING_VERSION = 54.4.0;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down
2 changes: 1 addition & 1 deletion example/RNExampleApp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-example-app",
"version": "54.2.2",
"version": "54.4.0",
"private": true,
"scripts": {
"initProject": "yarn add expo && yarn add ../../plugin",
Expand Down
6 changes: 6 additions & 0 deletions example/RNExampleApp/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,12 @@ class Anyline extends Component {
}
this.setState({ titles });
try {
const isInitialized = await AnylineOCR.isInitialized();
console.log(`AnylineOCR.initialized: ` + isInitialized);
if (!isInitialized) {
await AnylineOCR.setupAnylineSDK(demoAppLicenseKey);
}

console.log(`AnylineOCR.setupPromise`);
const result = await AnylineOCR.setupPromise(
JSON.stringify(config),
Expand Down
2 changes: 1 addition & 1 deletion plugin/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ repositories {

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'io.anyline:anylinesdk:54.2.0'
implementation 'io.anyline:anylinesdk:54.4.0'
implementation "com.facebook.react:react-native:+"
implementation("com.google.android.material:material:1.9.0")
implementation 'androidx.multidex:multidex:2.0.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class AnylineSDKPlugin extends ReactContextBaseJavaModule implements ResultRepor
}

public static final String REACT_CLASS = "AnylineSDKPlugin";
public static final String EXTRA_LICENSE_KEY = "EXTRA_LICENSE_KEY";
public static final String EXTRA_CONFIG_JSON = "EXTRA_CONFIG_JSON";
public static final String EXTRA_SCANVIEW_INITIALIZATION_PARAMETERS = "EXTRA_SCANVIEW_INITIALIZATION_PARAMETERS";
public static final String EXTRA_SCAN_MODE = "EXTRA_SCAN_MODE";
Expand Down Expand Up @@ -100,6 +99,11 @@ public void licenseKeyExpiryDate(final Promise promise) {
}
}

@ReactMethod
public void isInitialized(final Promise promise) {
promise.resolve(AnylineSdk.isInitialized());
}

@ReactMethod
@Deprecated
public void setupScanViewWithConfigJson(String config, String scanMode, Callback onResultReact, Callback onErrorReact) {
Expand Down Expand Up @@ -315,19 +319,17 @@ private void scan() throws LicenseException, JSONException {

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

configObject = new JSONObject(this.config);

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

configObject = new JSONObject(this.config);

JSONObject optionsJSONObject = configObject.optJSONObject("options");

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

intent.putExtra(EXTRA_LICENSE_KEY, license);
intent.putExtra(EXTRA_CONFIG_JSON, configObject.toString());
intent.putExtra(EXTRA_SCANVIEW_INITIALIZATION_PARAMETERS, scanViewInitializationParameters);

Expand Down
2 changes: 1 addition & 1 deletion plugin/ios/AnylineReact.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/Anyline/anyline-ocr-react-native-module.git", :tag => "#{s.version}" }

s.source_files = "*.{h,m}"
s.dependency "Anyline", "54.2.1"
s.dependency "Anyline", "54.4.0"
s.dependency "React"

end
17 changes: 11 additions & 6 deletions plugin/ios/AnylineSDKPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ - (UIView *)view {
resolve([AnylineSDK licenseExpirationDate]);
}

RCT_EXPORT_METHOD(isInitialized:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
BOOL isInitialized = [AnylineSDK isInitialized];
resolve(@(isInitialized));
}

RCT_EXPORT_METHOD(exportCachedEvents:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
_resolveBlock = resolve;
_rejectBlock = reject;
Expand All @@ -148,7 +153,7 @@ - (void)initView:(NSString *)scanMode initializationParamsStr:(NSString * _Nulla
if (!data) {
[NSException raise:@"Config could not be loaded from disk" format:@"Config could not be loaded from disk"];
}

NSError *error = nil;
id dictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];

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

dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication] keyWindow].rootViewController.modalPresentationStyle = UIModalPresentationFullScreen;

if ([[scanMode uppercaseString] isEqualToString:[@"scan" uppercaseString]]) {
ALPluginScanViewController *pluginScanViewController =
[[ALPluginScanViewController alloc] initWithLicensekey:self.appKey
Expand All @@ -182,7 +187,7 @@ - (void)initView:(NSString *)scanMode initializationParamsStr:(NSString * _Nulla
finished:^(NSDictionary * _Nullable callbackObj, NSError * _Nullable error) {
[self returnCallback:callbackObj andError:error];
}];

if (pluginScanViewController != nil){
[pluginScanViewController setModalPresentationStyle: UIModalPresentationFullScreen];
[[[UIApplication sharedApplication] keyWindow].rootViewController presentViewController:pluginScanViewController animated:YES completion:nil];
Expand All @@ -196,7 +201,7 @@ - (void)initView:(NSString *)scanMode initializationParamsStr:(NSString * _Nulla
finished:^(NSDictionary * _Nullable callbackObj, NSError * _Nullable error) {
[self returnCallback:callbackObj andError:error];
}];

if (pluginScanViewController != nil){
[pluginScanViewController setModalPresentationStyle: UIModalPresentationFullScreen];
[[[UIApplication sharedApplication] keyWindow].rootViewController presentViewController:pluginScanViewController animated:YES completion:nil];
Expand All @@ -210,12 +215,12 @@ - (void)initView:(NSString *)scanMode initializationParamsStr:(NSString * _Nulla

- (void)pluginScanViewController:(nonnull ALPluginScanViewController *)pluginScanViewController didScan:(nonnull id)scanResult continueScanning:(BOOL)continueScanning {
NSString *resultJson = @"";

NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject: scanResult
options:0
error:&error];

if (! jsonData) {
NSLog(@"bv_jsonStringWithPrettyPrint: error: %@", error.localizedDescription);
} else {
Expand Down
16 changes: 8 additions & 8 deletions plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"_from": "anyline-ocr-react-native-module@^54.2.2",
"_id": "anyline-ocr-react-native-module@^54.2.2",
"_from": "anyline-ocr-react-native-module@^54.4.0",
"_id": "anyline-ocr-react-native-module@^54.4.0",
"_inBundle": false,
"_integrity": "sha512-BGi9zNkSsoxXywDBIqzgBRvKUBniQOJHDKBrozZubKthZNRBAj8Ry5tW0Me0yLXt/fauME//hbC0wsenfPJZqw==",
"_location": "/anyline-ocr-react-native-module",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "anyline-ocr-react-native-module@^54.2.2",
"raw": "anyline-ocr-react-native-module@^54.4.0",
"name": "anyline-ocr-react-native-module",
"escapedName": "anyline-ocr-react-native-module",
"rawSpec": "^54.2.2",
"rawSpec": "^54.4.0",
"saveSpec": null,
"fetchSpec": "^54.2.2"
"fetchSpec": "^54.4.0"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/anyline-ocr-react-native-module/-/anyline-ocr-react-native-module-54.2.2.tgz",
"_resolved": "https://registry.npmjs.org/anyline-ocr-react-native-module/-/anyline-ocr-react-native-module-54.4.0.tgz",
"_shasum": "bacbcd260cc662244f59393ed81a6edba009b52c",
"_spec": "anyline-ocr-react-native-module@^54.2.2",
"_spec": "anyline-ocr-react-native-module@^54.4.0",
"_where": "/Users/amiransari/Projects/anyline-ocr-react-native-module1/example/RNExampleApp",
"bugs": {
"url": "https://github.com/Anyline/anyline-ocr-react-native-module/issues"
Expand All @@ -47,5 +47,5 @@
"type": "git",
"url": "git+https://github.com/Anyline/anyline-ocr-react-native-module.git"
},
"version": "54.2.2"
"version": "54.4.0"
}

0 comments on commit d2c9dea

Please sign in to comment.