anyline-ocr-react-native-module 55.2.1 → 55.5.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/AnylineReact.podspec +1 -1
- package/android/build.gradle +1 -3
- package/android/src/main/AndroidManifest.xml +1 -3
- package/android/src/main/java/com/anyline/reactnative/AnylineSDKPlugin.java +241 -254
- package/index.js +1 -15
- package/ios/AnylineSDKPlugin.h +4 -4
- package/ios/AnylineSDKPlugin.m +275 -214
- package/package.json +1 -1
- package/android/.gradle/7.6/checksums/checksums.lock +0 -0
- package/android/.gradle/7.6/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.6/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.6/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.6/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.6/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/src/main/java/com/anyline/reactnative/FeedbackConfig.java +0 -59
- package/android/src/main/java/com/anyline/reactnative/ImageTextConfig.java +0 -49
- package/android/src/main/java/com/anyline/reactnative/InstructionConfig.java +0 -20
- package/android/src/main/java/com/anyline/reactnative/Offset.java +0 -21
- package/android/src/main/java/com/anyline/reactnative/RotateButtonConfig.java +0 -32
- package/android/src/main/java/com/anyline/reactnative/ScanActivity.java +0 -426
- package/android/src/main/java/com/anyline/reactnative/updateAsset/AnylineUpdateDelegateImpl.java +0 -50
- package/android/src/main/java/com/anyline/reactnative/updateAsset/AssetContextJsonParser.java +0 -28
- package/android/src/main/res/drawable/rotate_screen_background.xml +0 -18
- package/android/src/main/res/drawable/rotate_screen_white.png +0 -0
- package/android/src/main/res/drawable-hdpi/ic_flash_auto.png +0 -0
- package/android/src/main/res/drawable-hdpi/ic_flash_off.png +0 -0
- package/android/src/main/res/drawable-hdpi/ic_flash_on.png +0 -0
- package/android/src/main/res/drawable-mdpi/ic_flash_auto.png +0 -0
- package/android/src/main/res/drawable-mdpi/ic_flash_off.png +0 -0
- package/android/src/main/res/drawable-mdpi/ic_flash_on.png +0 -0
- package/android/src/main/res/drawable-xhdpi/ic_flash_auto.png +0 -0
- package/android/src/main/res/drawable-xhdpi/ic_flash_off.png +0 -0
- package/android/src/main/res/drawable-xhdpi/ic_flash_on.png +0 -0
- package/android/src/main/res/drawable-xxhdpi/ic_flash_auto.png +0 -0
- package/android/src/main/res/drawable-xxhdpi/ic_flash_off.png +0 -0
- package/android/src/main/res/drawable-xxhdpi/ic_flash_on.png +0 -0
- package/android/src/main/res/drawable-xxxhdpi/ic_flash_auto.png +0 -0
- package/android/src/main/res/drawable-xxxhdpi/ic_flash_off.png +0 -0
- package/android/src/main/res/drawable-xxxhdpi/ic_flash_on.png +0 -0
- package/android/src/main/res/layout/activity_scan.xml +0 -93
- package/ios/ALJsonUIConfiguration.h +0 -54
- package/ios/ALJsonUIConfiguration.m +0 -251
- package/ios/ALPluginHelper.h +0 -48
- package/ios/ALPluginHelper.m +0 -332
- package/ios/ALPluginScanViewController.h +0 -18
- package/ios/ALPluginScanViewController.m +0 -476
- package/ios/ALRoundedView.h +0 -25
- package/ios/ALRoundedView.m +0 -107
package/android/src/main/java/com/anyline/reactnative/updateAsset/AssetContextJsonParser.java
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
package com.anyline.reactnative.updateAsset;
|
|
2
|
-
|
|
3
|
-
import android.content.Context;
|
|
4
|
-
|
|
5
|
-
import org.json.JSONException;
|
|
6
|
-
import org.json.JSONObject;
|
|
7
|
-
|
|
8
|
-
import javax.annotation.Nullable;
|
|
9
|
-
|
|
10
|
-
import io.anyline2.legacy.products.ProductContext;
|
|
11
|
-
import io.anyline2.legacy.trainer.AssetContext;
|
|
12
|
-
import io.anyline2.legacy.trainer.ProjectContext;
|
|
13
|
-
|
|
14
|
-
public class AssetContextJsonParser {
|
|
15
|
-
|
|
16
|
-
@Nullable
|
|
17
|
-
public AssetContext parseJson(Context context, String json) throws JSONException {
|
|
18
|
-
JSONObject jsonObject = new JSONObject(json);
|
|
19
|
-
|
|
20
|
-
if (jsonObject.has("projectID")) {
|
|
21
|
-
return new ProjectContext(context, jsonObject);
|
|
22
|
-
}
|
|
23
|
-
if (jsonObject.has("product")) {
|
|
24
|
-
return new ProductContext(context, jsonObject);
|
|
25
|
-
}
|
|
26
|
-
throw new IllegalStateException("Neither 'projectID' nor 'product' was provided in the configuration JSON!");
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
|
|
3
|
-
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
|
4
|
-
<solid
|
|
5
|
-
android:color="#A5000000"/>
|
|
6
|
-
<stroke
|
|
7
|
-
android:color="@android:color/white"
|
|
8
|
-
android:width="1dp"/>
|
|
9
|
-
<corners
|
|
10
|
-
android:radius="30dp" />
|
|
11
|
-
|
|
12
|
-
<padding
|
|
13
|
-
android:left="4dp"
|
|
14
|
-
android:top="4dp"
|
|
15
|
-
android:right="4dp"
|
|
16
|
-
android:bottom="4dp" />
|
|
17
|
-
|
|
18
|
-
</shape>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
-
android:layout_width="match_parent"
|
|
3
|
-
android:layout_height="match_parent">
|
|
4
|
-
|
|
5
|
-
<io.anyline2.view.ScanView
|
|
6
|
-
android:id="@+id/scan_view"
|
|
7
|
-
android:layout_width="match_parent"
|
|
8
|
-
android:layout_height="match_parent" />
|
|
9
|
-
|
|
10
|
-
<LinearLayout
|
|
11
|
-
android:id="@+id/layout_change_orientation"
|
|
12
|
-
android:layout_width="wrap_content"
|
|
13
|
-
android:layout_height="wrap_content"
|
|
14
|
-
android:layout_gravity="right|top"
|
|
15
|
-
android:gravity="center"
|
|
16
|
-
android:padding="40px">
|
|
17
|
-
|
|
18
|
-
<ImageView
|
|
19
|
-
android:id="@+id/imageview_change_orientation"
|
|
20
|
-
android:layout_width="56dp"
|
|
21
|
-
android:layout_height="56dp"
|
|
22
|
-
android:background="@drawable/rotate_screen_background"
|
|
23
|
-
android:scaleType="fitStart"
|
|
24
|
-
android:src="@drawable/rotate_screen_white" />
|
|
25
|
-
</LinearLayout>
|
|
26
|
-
|
|
27
|
-
<LinearLayout
|
|
28
|
-
android:id="@+id/layout_instruction"
|
|
29
|
-
android:layout_width="match_parent"
|
|
30
|
-
android:layout_height="wrap_content"
|
|
31
|
-
android:layout_gravity="bottom"
|
|
32
|
-
android:layout_marginVertical="30dp"
|
|
33
|
-
android:gravity="bottom"
|
|
34
|
-
android:orientation="vertical"
|
|
35
|
-
android:paddingBottom="30dp"
|
|
36
|
-
android:visibility="gone">
|
|
37
|
-
|
|
38
|
-
<TextView
|
|
39
|
-
android:id="@+id/textview_instruction"
|
|
40
|
-
android:layout_width="match_parent"
|
|
41
|
-
android:layout_height="wrap_content"
|
|
42
|
-
android:gravity="bottom|center_horizontal"
|
|
43
|
-
android:padding="10dp"
|
|
44
|
-
android:text=""
|
|
45
|
-
android:textColor="@color/white"
|
|
46
|
-
android:textSize="14sp" />
|
|
47
|
-
</LinearLayout>
|
|
48
|
-
|
|
49
|
-
<LinearLayout
|
|
50
|
-
android:id="@+id/layout_bright_distance_feedback"
|
|
51
|
-
android:layout_width="match_parent"
|
|
52
|
-
android:layout_height="wrap_content"
|
|
53
|
-
android:layout_centerHorizontal="true"
|
|
54
|
-
android:layout_gravity="top"
|
|
55
|
-
android:gravity="top|center_horizontal"
|
|
56
|
-
android:orientation="vertical"
|
|
57
|
-
android:paddingTop="20dp"
|
|
58
|
-
android:paddingBottom="5dp"
|
|
59
|
-
android:visibility="gone">
|
|
60
|
-
|
|
61
|
-
<ImageView
|
|
62
|
-
android:id="@+id/imageview_bright_distance_feedback"
|
|
63
|
-
android:layout_width="wrap_content"
|
|
64
|
-
android:layout_height="wrap_content"
|
|
65
|
-
android:layout_marginVertical="5dp"
|
|
66
|
-
android:layout_weight="2"
|
|
67
|
-
android:gravity="top|center_horizontal"
|
|
68
|
-
android:scaleType="centerInside" />
|
|
69
|
-
|
|
70
|
-
<TextView
|
|
71
|
-
android:id="@+id/textview_bright_distance_feedback"
|
|
72
|
-
android:layout_width="wrap_content"
|
|
73
|
-
android:layout_height="wrap_content"
|
|
74
|
-
android:layout_weight="0"
|
|
75
|
-
android:gravity="top|center_horizontal"
|
|
76
|
-
android:text=""
|
|
77
|
-
android:textColor="@color/white"
|
|
78
|
-
android:textSize="14sp" />
|
|
79
|
-
|
|
80
|
-
<LinearLayout
|
|
81
|
-
android:layout_width="match_parent"
|
|
82
|
-
android:layout_height="wrap_content"
|
|
83
|
-
android:layout_weight="3"
|
|
84
|
-
android:orientation="vertical" />
|
|
85
|
-
</LinearLayout>
|
|
86
|
-
|
|
87
|
-
<ImageView
|
|
88
|
-
android:id="@+id/imageview_cutout_overlay"
|
|
89
|
-
android:layout_width="wrap_content"
|
|
90
|
-
android:layout_height="wrap_content"
|
|
91
|
-
android:scaleType="fitStart"
|
|
92
|
-
android:visibility="gone" />
|
|
93
|
-
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
#import <Foundation/Foundation.h>
|
|
2
|
-
#import <UIKit/UIKit.h>
|
|
3
|
-
|
|
4
|
-
typedef NS_ENUM(NSUInteger, ALButtonXAlignment) {
|
|
5
|
-
ALButtonXAlignmentLeft=0,
|
|
6
|
-
ALButtonXAlignmentCenter=1,
|
|
7
|
-
ALButtonXAlignmentRight=2
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
typedef NS_ENUM(NSUInteger, ALButtonYAlignment) {
|
|
11
|
-
ALButtonYAlignmentTop=0,
|
|
12
|
-
ALButtonYAlignmentCenter=1,
|
|
13
|
-
ALButtonYAlignmentBottom=2
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
typedef NS_ENUM(NSUInteger, ALButtonType) {
|
|
17
|
-
ALButtonTypeFullWidth=0,
|
|
18
|
-
ALButtonTypeRect=1,
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@interface ALJSONUIConfiguration : NSObject
|
|
23
|
-
|
|
24
|
-
// Done Button
|
|
25
|
-
@property (nonatomic, strong) NSString *buttonDoneTitle;
|
|
26
|
-
@property (nonatomic, assign) CGFloat buttonDoneFontSize;
|
|
27
|
-
@property (nonatomic, strong) NSString *buttonDoneFontName;
|
|
28
|
-
@property (nonatomic, strong) UIColor *buttonDoneTextColor;
|
|
29
|
-
@property (nonatomic, strong) UIColor *buttonDoneTextColorHighlighted;
|
|
30
|
-
@property (nonatomic, strong) UIColor *buttonDoneBackgroundColor;
|
|
31
|
-
@property (nonatomic, assign) ALButtonType buttonType;
|
|
32
|
-
@property (nonatomic, assign) CGFloat buttonDoneCornerRadius;
|
|
33
|
-
@property (nonatomic, assign) ALButtonXAlignment buttonDoneXAlignment;
|
|
34
|
-
@property (nonatomic, assign) ALButtonYAlignment buttonDoneYAlignment;
|
|
35
|
-
@property (nonatomic, assign) CGFloat buttonDoneXPositionOffset;
|
|
36
|
-
@property (nonatomic, assign) CGFloat buttonDoneYPositionOffset;
|
|
37
|
-
|
|
38
|
-
@property (nonatomic, strong) NSArray<NSString *> *segmentTitles;
|
|
39
|
-
@property (nonatomic, strong) NSArray<NSString *> *segmentModes;
|
|
40
|
-
@property (nonatomic, strong) UIColor *segmentTintColor;
|
|
41
|
-
@property (nonatomic, assign) CGFloat segmentXPositionOffset;
|
|
42
|
-
@property (nonatomic, assign) CGFloat segmentYPositionOffset;
|
|
43
|
-
|
|
44
|
-
@property (nonatomic, copy) NSString *labelText;
|
|
45
|
-
@property (nonatomic, assign) CGFloat labelSize;
|
|
46
|
-
@property (nonatomic, strong) UIColor *labelColor;
|
|
47
|
-
@property (nonatomic, assign) CGFloat labelXPositionOffset;
|
|
48
|
-
@property (nonatomic, assign) CGFloat labelYPositionOffset;
|
|
49
|
-
|
|
50
|
-
@property (nonatomic, strong) NSArray<NSString *> *nativeBarcodeFormats;
|
|
51
|
-
|
|
52
|
-
- (instancetype)initWithDictionary:(NSDictionary *)dictionary;
|
|
53
|
-
|
|
54
|
-
@end
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
#import "ALJsonUIConfiguration.h"
|
|
2
|
-
#import <Anyline/Anyline.h>
|
|
3
|
-
|
|
4
|
-
NSString * const DONE_BUTTON = @"doneButtonConfig";
|
|
5
|
-
NSString * const DONE_BUTTON_TITLE = @"title";
|
|
6
|
-
NSString * const DONE_BUTTON_COLOR = @"textColor";
|
|
7
|
-
NSString * const DONE_BUTTON_COLOR_HIGHLIGHTED = @"textColorHighlighted";
|
|
8
|
-
NSString * const DONE_BUTTON_FONT_SIZE = @"fontSize";
|
|
9
|
-
NSString * const DONE_BUTTON_FONT_NAME = @"fontName";
|
|
10
|
-
NSString * const DONE_BUTTON_X_ALIGNMENT = @"positionXAlignment";
|
|
11
|
-
NSString * const DONE_BUTTON_Y_ALIGNMENT = @"positionYAlignment";
|
|
12
|
-
NSString * const DONE_BUTTON_BACKGROUND_COLOR = @"backgroundColor";
|
|
13
|
-
NSString * const DONE_BUTTON_TYPE = @"type";
|
|
14
|
-
NSString * const DONE_BUTTON_CORNER_RADIUS = @"cornerRadius";
|
|
15
|
-
|
|
16
|
-
NSString * const SEGMENT = @"segmentConfig";
|
|
17
|
-
NSString * const SEGMENT_TITLES = @"titles";
|
|
18
|
-
NSString * const SEGMENT_MODES = @"modes";
|
|
19
|
-
NSString * const SEGMENT_TINT_COLOR = @"tintColor";
|
|
20
|
-
|
|
21
|
-
NSString * const OFFSET = @"offset";
|
|
22
|
-
NSString * const OFFSET_X = @"offset.x";
|
|
23
|
-
NSString * const OFFSET_Y = @"offset.y";
|
|
24
|
-
|
|
25
|
-
NSString * const LABEL = @"labelConfig";
|
|
26
|
-
NSString * const LABEL_TEXT = @"text";
|
|
27
|
-
NSString * const LABEL_COLOR = @"color";
|
|
28
|
-
NSString * const LABEL_SIZE = @"size";
|
|
29
|
-
|
|
30
|
-
NSString * const LABEL_OFFSET = @"labelOffset";
|
|
31
|
-
NSString * const LABEL_OFFSET_X = @"offset.x";
|
|
32
|
-
NSString * const LABEL_OFFSET_Y = @"offset.y";
|
|
33
|
-
|
|
34
|
-
NSString * const ENABLE_NATIVE_BARCODE = @"nativeBarcodeScanningFormats";
|
|
35
|
-
|
|
36
|
-
@implementation ALJSONUIConfiguration
|
|
37
|
-
|
|
38
|
-
- (instancetype)initWithDictionary:(NSDictionary *)dictionary {
|
|
39
|
-
if (self = [super init]) {
|
|
40
|
-
|
|
41
|
-
_buttonDoneFontName = @"Avenir Next"; // @"HelveticaNeue";
|
|
42
|
-
_buttonDoneTextColor = [UIColor whiteColor];
|
|
43
|
-
_buttonDoneTextColorHighlighted = [UIColor grayColor];
|
|
44
|
-
_buttonDoneBackgroundColor = [UIColor clearColor];
|
|
45
|
-
_buttonDoneFontSize = 32.0;
|
|
46
|
-
_buttonType = ALButtonTypeFullWidth;
|
|
47
|
-
_buttonDoneTitle = NSLocalizedString(@"OK", @"Done button title");
|
|
48
|
-
_buttonDoneXAlignment = ALButtonXAlignmentCenter;
|
|
49
|
-
_buttonDoneYAlignment = ALButtonYAlignmentBottom;
|
|
50
|
-
_buttonDoneYPositionOffset = -88.0;
|
|
51
|
-
_buttonDoneXPositionOffset = 0;
|
|
52
|
-
_buttonDoneCornerRadius = 4.0;
|
|
53
|
-
|
|
54
|
-
_labelSize = 32.0f;
|
|
55
|
-
_labelText = @"";
|
|
56
|
-
_labelColor = UIColor.whiteColor;
|
|
57
|
-
_labelXPositionOffset = 0.0f;
|
|
58
|
-
_labelYPositionOffset = 0.0f;
|
|
59
|
-
|
|
60
|
-
// (ACO) 20230313
|
|
61
|
-
// nativeBarcodeFormats = [] would be interpreted as ['ALL']
|
|
62
|
-
_nativeBarcodeFormats = nil;
|
|
63
|
-
|
|
64
|
-
if ([dictionary valueForKey:ENABLE_NATIVE_BARCODE]) {
|
|
65
|
-
NSArray<NSString *> *formats = [dictionary valueForKey:ENABLE_NATIVE_BARCODE];
|
|
66
|
-
|
|
67
|
-
NSMutableArray *nativeBarcodeFormats = [NSMutableArray arrayWithCapacity:formats.count];
|
|
68
|
-
|
|
69
|
-
for (NSString *format in formats) {
|
|
70
|
-
NSString *nativeBarcodeFormat = [self.class barcodeFormatToNativeString:format];
|
|
71
|
-
if (nativeBarcodeFormat) {
|
|
72
|
-
[nativeBarcodeFormats addObject:nativeBarcodeFormat];
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
self.nativeBarcodeFormats = nativeBarcodeFormats;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if ([dictionary valueForKey:DONE_BUTTON]) {
|
|
80
|
-
NSDictionary *btnDict = [dictionary valueForKey:DONE_BUTTON];
|
|
81
|
-
|
|
82
|
-
if ([btnDict valueForKey:DONE_BUTTON_FONT_NAME]) {
|
|
83
|
-
_buttonDoneFontName = [btnDict valueForKeyPath:DONE_BUTTON_FONT_NAME];
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if ([btnDict valueForKey:DONE_BUTTON_COLOR]) {
|
|
87
|
-
_buttonDoneTextColor = [ALJSONUIConfiguration colorFromHexString:[btnDict valueForKeyPath:DONE_BUTTON_COLOR]];
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if ([btnDict valueForKey:DONE_BUTTON_COLOR_HIGHLIGHTED]) {
|
|
91
|
-
_buttonDoneTextColorHighlighted = [ALJSONUIConfiguration colorFromHexString:[btnDict valueForKeyPath:DONE_BUTTON_COLOR_HIGHLIGHTED]];
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if ([btnDict valueForKey:DONE_BUTTON_FONT_SIZE]) {
|
|
95
|
-
_buttonDoneFontSize = [[btnDict valueForKeyPath:DONE_BUTTON_FONT_SIZE] floatValue];
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if ([btnDict valueForKey:DONE_BUTTON_TYPE]) {
|
|
99
|
-
_buttonType = [ALJSONUIConfiguration stringToButtonType:[btnDict valueForKeyPath:DONE_BUTTON_TYPE]];
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if ([btnDict valueForKey:DONE_BUTTON_BACKGROUND_COLOR]) {
|
|
103
|
-
_buttonDoneBackgroundColor = [ALJSONUIConfiguration colorFromHexString:[btnDict valueForKey:DONE_BUTTON_BACKGROUND_COLOR]];
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if ([btnDict valueForKey:DONE_BUTTON_TITLE]) {
|
|
107
|
-
_buttonDoneTitle = [btnDict valueForKeyPath:DONE_BUTTON_TITLE];
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if ([btnDict valueForKey:DONE_BUTTON_X_ALIGNMENT]) {
|
|
111
|
-
_buttonDoneXAlignment = [ALJSONUIConfiguration stringToButtonXAlignment:[btnDict valueForKeyPath:DONE_BUTTON_X_ALIGNMENT]];
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if ([btnDict valueForKey:DONE_BUTTON_Y_ALIGNMENT]) {
|
|
115
|
-
_buttonDoneYAlignment = [ALJSONUIConfiguration stringToButtonYAlignment:[btnDict valueForKeyPath:DONE_BUTTON_Y_ALIGNMENT]];
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if ([btnDict valueForKeyPath:OFFSET_X]) {
|
|
119
|
-
_buttonDoneXPositionOffset = [[btnDict valueForKeyPath:OFFSET_X] floatValue];
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if ([btnDict valueForKeyPath:OFFSET_Y]) {
|
|
123
|
-
_buttonDoneYPositionOffset = [[btnDict valueForKeyPath:OFFSET_Y] floatValue];
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if ([btnDict valueForKey:DONE_BUTTON_CORNER_RADIUS]) {
|
|
127
|
-
_buttonDoneCornerRadius = [[btnDict valueForKeyPath:DONE_BUTTON_CORNER_RADIUS] floatValue];
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if ([dictionary valueForKey:SEGMENT]) {
|
|
132
|
-
NSDictionary *segDict = [dictionary valueForKey:SEGMENT];
|
|
133
|
-
|
|
134
|
-
if ([segDict valueForKey:SEGMENT_TITLES]) {
|
|
135
|
-
_segmentTitles = [segDict valueForKey:SEGMENT_TITLES];
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if ([segDict valueForKey:SEGMENT_MODES]) {
|
|
139
|
-
_segmentModes = [segDict valueForKey:SEGMENT_MODES];
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if ([segDict valueForKey:SEGMENT_TINT_COLOR]) {
|
|
143
|
-
_segmentTintColor = [ALJSONUIConfiguration colorFromHexString:[segDict valueForKey:SEGMENT_TINT_COLOR]];
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if ([segDict valueForKeyPath:OFFSET_X]) {
|
|
147
|
-
_segmentXPositionOffset = [[segDict valueForKeyPath:OFFSET_X] floatValue];
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if ([segDict valueForKeyPath:OFFSET_Y]) {
|
|
151
|
-
_segmentYPositionOffset = [[segDict valueForKeyPath:OFFSET_Y] floatValue];
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if ([dictionary valueForKey:LABEL]) {
|
|
156
|
-
NSDictionary *labDict = [dictionary valueForKey:LABEL];
|
|
157
|
-
|
|
158
|
-
if ([labDict valueForKey:LABEL_TEXT]) {
|
|
159
|
-
_labelText = [labDict valueForKey:LABEL_TEXT];
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if ([labDict valueForKey:LABEL_SIZE]) {
|
|
163
|
-
_labelSize = [[labDict valueForKeyPath:LABEL_SIZE] floatValue];
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
if ([labDict valueForKey:LABEL_COLOR]) {
|
|
167
|
-
_labelColor = [ALJSONUIConfiguration colorFromHexString:[labDict valueForKey:LABEL_COLOR]];
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
if ([labDict valueForKeyPath:LABEL_OFFSET_X]) {
|
|
171
|
-
_labelXPositionOffset = [[labDict valueForKeyPath:LABEL_OFFSET_X] floatValue];
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
if ([labDict valueForKeyPath:LABEL_OFFSET_Y]) {
|
|
175
|
-
_labelYPositionOffset = [[labDict valueForKeyPath:LABEL_OFFSET_Y] floatValue];
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
return self;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
+ (ALButtonXAlignment)stringToButtonXAlignment:(NSString *)str {
|
|
184
|
-
NSDictionary *map = @{
|
|
185
|
-
@"LEFT": @(ALButtonXAlignmentLeft),
|
|
186
|
-
@"CENTER": @(ALButtonXAlignmentCenter),
|
|
187
|
-
@"RIGHT": @(ALButtonXAlignmentRight),
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
return [[map valueForKey:str.uppercaseString] integerValue];
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
+ (ALButtonYAlignment)stringToButtonYAlignment:(NSString *)str {
|
|
194
|
-
NSDictionary *map = @{
|
|
195
|
-
@"TOP": @(ALButtonYAlignmentTop),
|
|
196
|
-
@"CENTER": @(ALButtonYAlignmentCenter),
|
|
197
|
-
@"BOTTOM": @(ALButtonYAlignmentBottom),
|
|
198
|
-
};
|
|
199
|
-
return [[map valueForKey:str.uppercaseString] integerValue];
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
+ (ALButtonType)stringToButtonType:(NSString *)str {
|
|
203
|
-
NSDictionary *map = @{
|
|
204
|
-
@"FULLWIDTH": @(ALButtonTypeFullWidth),
|
|
205
|
-
@"RECT": @(ALButtonTypeRect)
|
|
206
|
-
};
|
|
207
|
-
return [[map valueForKey:str.uppercaseString] integerValue];
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
+ (UIColor *)colorFromHexString:(NSString *)hexString {
|
|
211
|
-
if (!hexString) {
|
|
212
|
-
return nil;
|
|
213
|
-
}
|
|
214
|
-
unsigned rgbValue = 0;
|
|
215
|
-
NSScanner *scanner = [NSScanner scannerWithString:hexString];
|
|
216
|
-
// [scanner setScanLocation:1]; // bypass '#' character
|
|
217
|
-
[scanner scanHexInt:&rgbValue];
|
|
218
|
-
return [UIColor colorWithRed:((rgbValue & 0xFF0000) >> 16)/255.0
|
|
219
|
-
green:((rgbValue & 0xFF00) >> 8)/255.0
|
|
220
|
-
blue:(rgbValue & 0xFF)/255.0 alpha:1.0];
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
+ (NSString * _Nullable)barcodeFormatToNativeString:(NSString *)barcodeType {
|
|
225
|
-
static NSDictionary<NSString *, NSString *> * barcodeFormats = nil;
|
|
226
|
-
static dispatch_once_t onceToken;
|
|
227
|
-
dispatch_once(&onceToken, ^{
|
|
228
|
-
barcodeFormats = @{
|
|
229
|
-
kCodeTypeAztec: @"org.iso.Aztec",
|
|
230
|
-
kCodeTypeCode128: @"org.iso.Code128",
|
|
231
|
-
kCodeTypeCode39: @"org.iso.Code39",
|
|
232
|
-
kCodeTypeCode93: @"com.intermec.Code93",
|
|
233
|
-
kCodeTypeDataMatrix: @"org.iso.DataMatrix",
|
|
234
|
-
kCodeTypeEAN13: @"org.gs1.EAN-13",
|
|
235
|
-
kCodeTypeEAN8: @"org.gs1.EAN-8",
|
|
236
|
-
kCodeTypeMATRIX_2_5: @"org.ansi.Interleaved2of5",
|
|
237
|
-
kCodeTypeITF: @"org.gs1.ITF14",
|
|
238
|
-
kCodeTypePDF417: @"org.iso.PDF417",
|
|
239
|
-
kCodeTypeQR: @"org.iso.QRCode",
|
|
240
|
-
kCodeTypeUPCE: @"org.gs1.UPC-E",
|
|
241
|
-
kCodeTypeCodabar: @"Codabar",
|
|
242
|
-
kCodeTypeDATABAR: @"org.gs1.GS1DataBar",
|
|
243
|
-
kCodeTypeMICRO_QR: @"org.iso.MicroQR",
|
|
244
|
-
kCodeTypeMICRO_PDF: @"org.iso.MicroPDF417"
|
|
245
|
-
};
|
|
246
|
-
});
|
|
247
|
-
return barcodeFormats[barcodeType.uppercaseString];
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
@end
|
|
251
|
-
|
package/ios/ALPluginHelper.h
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
#import "ALJsonUIConfiguration.h"
|
|
2
|
-
#import "ALRoundedView.h"
|
|
3
|
-
|
|
4
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
5
|
-
|
|
6
|
-
@class ALPluginConfig;
|
|
7
|
-
|
|
8
|
-
typedef void (^ALPluginCallback)(NSDictionary * _Nullable callbackObj, NSError * _Nullable error);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
@interface ALPluginHelper : NSObject
|
|
12
|
-
|
|
13
|
-
+ (void)startScan:(NSDictionary *)config initializationParamsStr:(NSString *)initializationParamsStr finished:(ALPluginCallback)callback;
|
|
14
|
-
|
|
15
|
-
+ (NSString *)saveImageToFileSystem:(UIImage *)image;
|
|
16
|
-
|
|
17
|
-
+ (NSString *)saveImageToFileSystem:(UIImage *)image
|
|
18
|
-
compressionQuality:(CGFloat)compressionQuality;
|
|
19
|
-
|
|
20
|
-
+ (NSString * _Nullable)applicationCachePath;
|
|
21
|
-
|
|
22
|
-
+ (UILabel *)createLabelForView:(UIView *)view;
|
|
23
|
-
|
|
24
|
-
+ (UIButton *)createButtonForViewController:(UIViewController *)viewController
|
|
25
|
-
config:(ALJSONUIConfiguration *)config;
|
|
26
|
-
|
|
27
|
-
+ (ALRoundedView *)createRoundedViewForViewController:(UIViewController *)viewController;
|
|
28
|
-
|
|
29
|
-
+ (UISegmentedControl * _Nullable)createSegmentForViewController:(UIViewController *)viewController
|
|
30
|
-
config:(ALJSONUIConfiguration *)config
|
|
31
|
-
initialScanMode:(NSString *)scanMode;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
+ (void)showErrorAlertWithTitle:(NSString *)title
|
|
35
|
-
message:(NSString *)message
|
|
36
|
-
presentingViewController:(UIViewController *)presentingViewController;
|
|
37
|
-
|
|
38
|
-
+ (BOOL)showErrorAlertIfNeeded:(NSError *)error pluginCallback:(ALPluginCallback)callback;
|
|
39
|
-
|
|
40
|
-
+ (NSError *)errorWithMessage:(NSString *)message;
|
|
41
|
-
|
|
42
|
-
+ (NSString *)stringForDate:(NSDate *)date;
|
|
43
|
-
|
|
44
|
-
+ (NSString * _Nullable)confPropKeyWithScanModeForPluginConfig:(ALPluginConfig *)pluginConfig;
|
|
45
|
-
|
|
46
|
-
@end
|
|
47
|
-
|
|
48
|
-
NS_ASSUME_NONNULL_END
|