@regulaforensics/react-native-document-reader-api 7.1.0 → 7.2.1
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/RNDocumentReaderApi.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/regula/documentreader/Config.kt +10 -8
- package/android/src/main/java/com/regula/documentreader/JSONConstructor.kt +15 -5
- package/android/src/main/java/com/regula/documentreader/RNRegulaDocumentReaderModule.kt +13 -15
- package/android/src/main/java/com/regula/documentreader/Utils.kt +21 -16
- package/example/App.tsx +5 -5
- package/example/android/gradle.properties +1 -1
- package/example/ios/Podfile +2 -20
- package/example/package-lock.json +1064 -932
- package/example/package.json +27 -28
- package/example/react-native.config.js +5 -0
- package/index.d.ts +1234 -466
- package/index.js +659 -207
- package/ios/RGLWConfig.m +24 -37
- package/ios/RGLWJSONConstructor.m +30 -39
- package/ios/RNRegulaDocumentReader.h +4 -4
- package/ios/RNRegulaDocumentReader.m +21 -28
- package/package.json +1 -1
package/ios/RGLWConfig.m
CHANGED
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
functionality.orientation = [self interfaceOrientationMaskWithNumber:[options valueForKey:@"orientation"]];
|
|
54
54
|
if([options valueForKey:@"captureMode"] != nil)
|
|
55
55
|
functionality.captureMode = [[options valueForKey:@"captureMode"] integerValue];
|
|
56
|
-
if([
|
|
57
|
-
functionality.cameraPosition = [
|
|
56
|
+
if(options[@"cameraPositionIOS"])
|
|
57
|
+
functionality.cameraPosition = [options[@"cameraPositionIOS"] integerValue];
|
|
58
58
|
|
|
59
59
|
// String
|
|
60
60
|
if([options valueForKey:@"cameraFrame"] != nil)
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
result[@"forcePagesCount"] = functionality.forcePagesCount;
|
|
106
106
|
result[@"orientation"] = [self generateInterfaceOrientationMask:functionality.orientation];
|
|
107
107
|
result[@"captureMode"] = [NSNumber numberWithInteger:functionality.captureMode];
|
|
108
|
-
result[@"
|
|
108
|
+
result[@"cameraPositionIOS"] = @(functionality.cameraPosition);
|
|
109
109
|
|
|
110
110
|
// String
|
|
111
111
|
result[@"cameraFrame"] = [self generateDocReaderFrame:functionality.cameraFrame];
|
|
@@ -641,6 +641,8 @@
|
|
|
641
641
|
rfidScenario.applyAmendments = [[options valueForKey:@"applyAmendments"] boolValue];
|
|
642
642
|
if([options valueForKey:@"autoSettings"] != nil)
|
|
643
643
|
rfidScenario.autoSettings = [[options valueForKey:@"autoSettings"] boolValue];
|
|
644
|
+
if([options valueForKey:@"proceedReadingAlways"] != nil)
|
|
645
|
+
rfidScenario.proceedReadingAlways = [[options valueForKey:@"proceedReadingAlways"] boolValue];
|
|
644
646
|
|
|
645
647
|
// Int
|
|
646
648
|
if([options valueForKey:@"signManagementAction"] != nil)
|
|
@@ -722,6 +724,7 @@
|
|
|
722
724
|
result[@"authorizedInstallQCert"] = [NSNumber numberWithBool:rfidScenario.authorizedInstallQCert];
|
|
723
725
|
result[@"applyAmendments"] = [NSNumber numberWithBool:rfidScenario.applyAmendments];
|
|
724
726
|
result[@"autoSettings"] = [NSNumber numberWithBool:rfidScenario.autoSettings];
|
|
727
|
+
result[@"proceedReadingAlways"] = [NSNumber numberWithBool:rfidScenario.proceedReadingAlways];
|
|
725
728
|
|
|
726
729
|
// Int
|
|
727
730
|
result[@"signManagementAction"] = [NSNumber numberWithInteger:rfidScenario.signManagementAction];
|
|
@@ -861,10 +864,9 @@
|
|
|
861
864
|
result.colornessCheck = [input valueForKey:@"colornessCheck"];
|
|
862
865
|
if([input valueForKey:@"screenCapture"] != nil)
|
|
863
866
|
result.screenCapture = [input valueForKey:@"screenCapture"];
|
|
864
|
-
if([
|
|
865
|
-
NSMutableArray<RGLImageQualityCheckType
|
|
866
|
-
for(
|
|
867
|
-
[expectedPass addObject:str];
|
|
867
|
+
if (input[@"expectedPass"]) {
|
|
868
|
+
NSMutableArray<RGLImageQualityCheckType>* expectedPass = @[].mutableCopy;
|
|
869
|
+
for(NSNumber* item in input[@"expectedPass"]) [expectedPass addObject:[self imageQualityCheckTypeWithNumber:item]];
|
|
868
870
|
result.expectedPass = expectedPass;
|
|
869
871
|
}
|
|
870
872
|
if([input valueForKey:@"documentPositionIndent"] != nil)
|
|
@@ -884,7 +886,11 @@
|
|
|
884
886
|
result[@"glaresCheck"] = input.glaresCheck;
|
|
885
887
|
result[@"colornessCheck"] = input.colornessCheck;
|
|
886
888
|
result[@"screenCapture"] = input.screenCapture;
|
|
887
|
-
|
|
889
|
+
if (input.expectedPass) {
|
|
890
|
+
NSMutableArray<NSNumber*>* expectedPass = @[].mutableCopy;
|
|
891
|
+
for(RGLImageQualityCheckType item in input.expectedPass) [expectedPass addObject:[self generateImageQualityCheckType:item]];
|
|
892
|
+
result[@"expectedPass"] = expectedPass;
|
|
893
|
+
}
|
|
888
894
|
result[@"documentPositionIndent"] = input.documentPositionIndent;
|
|
889
895
|
result[@"glaresCheckParams"] = [RGLWJSONConstructor generateGlaresCheckParams:input.glaresCheckParams];
|
|
890
896
|
result[@"brightnessThreshold"] = input.brightnessThreshold;
|
|
@@ -1172,39 +1178,20 @@
|
|
|
1172
1178
|
|
|
1173
1179
|
+(UIInterfaceOrientationMask)interfaceOrientationMaskWithNumber:(NSNumber*)value {
|
|
1174
1180
|
int input = [value intValue];
|
|
1175
|
-
if(input == 0) return
|
|
1176
|
-
if(input == 1) return
|
|
1177
|
-
if(input == 2) return
|
|
1178
|
-
if(input == 3) return
|
|
1179
|
-
if(input == 4) return
|
|
1180
|
-
if(input == 5) return UIInterfaceOrientationMaskAll;
|
|
1181
|
-
if(input == 6) return UIInterfaceOrientationMaskAllButUpsideDown;
|
|
1181
|
+
if(input == 0) return UIInterfaceOrientationMaskAll;
|
|
1182
|
+
if(input == 1) return UIInterfaceOrientationMaskPortrait;
|
|
1183
|
+
if(input == 2) return UIInterfaceOrientationMaskLandscape;
|
|
1184
|
+
if(input == 3) return UIInterfaceOrientationMaskLandscapeLeft;
|
|
1185
|
+
if(input == 4) return UIInterfaceOrientationMaskLandscapeRight;
|
|
1182
1186
|
return UIInterfaceOrientationMaskPortrait;
|
|
1183
1187
|
}
|
|
1184
1188
|
|
|
1185
1189
|
+(NSNumber*)generateInterfaceOrientationMask:(UIInterfaceOrientationMask)value {
|
|
1186
|
-
if(value ==
|
|
1187
|
-
if(value ==
|
|
1188
|
-
if(value ==
|
|
1189
|
-
if(value ==
|
|
1190
|
-
if(value ==
|
|
1191
|
-
if(value == UIInterfaceOrientationMaskAll) return @5;
|
|
1192
|
-
if(value == UIInterfaceOrientationMaskAllButUpsideDown) return @6;
|
|
1193
|
-
return @0;
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
|
-
+(AVCaptureDevicePosition)captureDevicePositionWithNumber:(NSNumber*)value {
|
|
1197
|
-
int input = [value intValue];
|
|
1198
|
-
if(input == 0) return AVCaptureDevicePositionUnspecified;
|
|
1199
|
-
if(input == 1) return AVCaptureDevicePositionBack;
|
|
1200
|
-
if(input == 2) return AVCaptureDevicePositionFront;
|
|
1201
|
-
return AVCaptureDevicePositionUnspecified;
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
+(NSNumber*)generateCaptureDevicePosition:(AVCaptureDevicePosition)value {
|
|
1205
|
-
if(value == AVCaptureDevicePositionUnspecified) return @0;
|
|
1206
|
-
if(value == AVCaptureDevicePositionBack) return @1;
|
|
1207
|
-
if(value == AVCaptureDevicePositionFront) return @2;
|
|
1190
|
+
if(value == UIInterfaceOrientationMaskAll) return @0;
|
|
1191
|
+
if(value == UIInterfaceOrientationMaskPortrait) return @1;
|
|
1192
|
+
if(value == UIInterfaceOrientationMaskLandscape) return @2;
|
|
1193
|
+
if(value == UIInterfaceOrientationMaskLandscapeLeft) return @3;
|
|
1194
|
+
if(value == UIInterfaceOrientationMaskLandscapeRight) return @4;
|
|
1208
1195
|
return @0;
|
|
1209
1196
|
}
|
|
1210
1197
|
|
|
@@ -170,18 +170,17 @@
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
+(RGLScannerConfig*)scannerConfigFromJson:(NSDictionary*)input {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
173
|
+
RGLScannerConfig *config = [RGLScannerConfig alloc];
|
|
174
|
+
if (input[@"scenario"]) config = [config initWithScenario:input[@"scenario"]];
|
|
175
|
+
else config = [config initWithOnlineProcessingConfig:[self onlineProcessingConfigFromJson:input[@"onlineProcessingConfig"]]];
|
|
176
|
+
|
|
177
|
+
if(input[@"onlineProcessingConfig"])
|
|
178
|
+
config.onlineProcessingConfig = [self onlineProcessingConfigFromJson:input[@"onlineProcessingConfig"]];
|
|
179
|
+
if(input[@"livePortrait"])
|
|
180
|
+
config.livePortrait = [self imageWithBase64:input[@"livePortrait"]];
|
|
181
|
+
if(input[@"extPortrait"])
|
|
182
|
+
config.extPortrait = [self imageWithBase64:input[@"extPortrait"]];
|
|
183
|
+
|
|
185
184
|
return config;
|
|
186
185
|
}
|
|
187
186
|
|
|
@@ -198,37 +197,29 @@
|
|
|
198
197
|
}
|
|
199
198
|
|
|
200
199
|
+(RGLRecognizeConfig*)recognizeConfigFromJson:(NSDictionary*)input {
|
|
201
|
-
if([input valueForKey:@"scenario"] == nil && [input valueForKey:@"onlineProcessingConfig"] == nil) return nil;
|
|
202
|
-
if([input valueForKey:@"image"] == nil && [input valueForKey:@"data"] == nil && [input valueForKey:@"images"] == nil && [input valueForKey:@"imageInputs"] == nil) return nil;
|
|
203
200
|
RGLRecognizeConfig *config = [RGLRecognizeConfig alloc];
|
|
201
|
+
if (input[@"scenario"]) config = [config initWithScenario:input[@"scenario"]];
|
|
202
|
+
else config = [config initWithOnlineProcessingConfig:[self onlineProcessingConfigFromJson:input[@"onlineProcessingConfig"]]];
|
|
204
203
|
|
|
205
|
-
if([
|
|
206
|
-
|
|
207
|
-
if([
|
|
208
|
-
config = [config initWithImageData:[RGLWJSONConstructor base64Decode:[input valueForKey:@"data"]]];
|
|
209
|
-
if([input valueForKey:@"images"] != nil) {
|
|
204
|
+
if (input[@"image"]) config.image = [RGLWJSONConstructor imageWithBase64:input[@"image"]];
|
|
205
|
+
if (input[@"data"]) config.imageData = [RGLWJSONConstructor base64Decode:input[@"data"]];
|
|
206
|
+
if (input[@"images"]) {
|
|
210
207
|
NSMutableArray<UIImage*>* images = [NSMutableArray new];
|
|
211
|
-
for(NSString* base64 in [
|
|
208
|
+
for(NSString* base64 in input[@"images"])
|
|
212
209
|
[images addObject:[RGLWJSONConstructor imageWithBase64:base64]];
|
|
213
|
-
config =
|
|
214
|
-
}
|
|
215
|
-
if([
|
|
216
|
-
NSMutableArray<RGLImageInput*>*
|
|
217
|
-
for(NSDictionary*
|
|
218
|
-
[
|
|
219
|
-
config =
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if([
|
|
223
|
-
|
|
224
|
-
if([
|
|
225
|
-
|
|
226
|
-
if([input valueForKey:@"livePortrait"] != nil)
|
|
227
|
-
config.livePortrait = [self imageWithBase64:[input valueForKey:@"livePortrait"]];
|
|
228
|
-
if([input valueForKey:@"extPortrait"] != nil)
|
|
229
|
-
config.extPortrait = [self imageWithBase64:[input valueForKey:@"extPortrait"]];
|
|
230
|
-
if([input valueForKey:@"oneShotIdentification"] != nil)
|
|
231
|
-
config.oneShotIdentification = [input valueForKey:@"oneShotIdentification"];
|
|
210
|
+
config.images = images;
|
|
211
|
+
}
|
|
212
|
+
if(input[@"imageInputData"]) {
|
|
213
|
+
NSMutableArray<RGLImageInput*>* imageInputs = [NSMutableArray new];
|
|
214
|
+
for(NSDictionary* imageInput in input[@"imageInputData"])
|
|
215
|
+
[imageInputs addObject:[RGLWJSONConstructor imageInputFromJson: imageInput]];
|
|
216
|
+
config.imageInputs = imageInputs;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (input[@"scenario"]) config.scenario = input[@"scenario"];
|
|
220
|
+
if (input[@"livePortrait"]) config.livePortrait = [self imageWithBase64:input[@"livePortrait"]];
|
|
221
|
+
if (input[@"extPortrait"]) config.extPortrait = [self imageWithBase64:input[@"extPortrait"]];
|
|
222
|
+
if (input[@"oneShotIdentification"]) config.oneShotIdentification = input[@"oneShotIdentification"];
|
|
232
223
|
|
|
233
224
|
return config;
|
|
234
225
|
}
|
|
@@ -9,11 +9,11 @@ typedef void (^RGLWEventSender)(NSString* _Nonnull event, id _Nullable data);
|
|
|
9
9
|
typedef void (^RGLWRFIDSignatureCallback)(NSData * _Nonnull signature);
|
|
10
10
|
|
|
11
11
|
@interface RNRegulaDocumentReader : RCTEventEmitter <RCTBridgeModule,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
RGLRecordScanningProcessDelegate,
|
|
13
|
+
RGLDocReaderRFIDDelegate,
|
|
14
|
+
RGLCustomizationActionDelegate,
|
|
15
|
+
RGLDocReaderDatabaseFetchDelegate>
|
|
15
16
|
|
|
16
|
-
@property (class) NSNumber* _Nullable databasePercentageDownloaded;
|
|
17
17
|
@property NSNumber* _Nonnull doRequestPACertificates;
|
|
18
18
|
@property NSNumber* _Nonnull doRequestTACertificates;
|
|
19
19
|
@property NSNumber* _Nonnull doRequestTASignature;
|
|
@@ -77,8 +77,6 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
|
|
|
77
77
|
[self resetConfiguration :successCallback :errorCallback];
|
|
78
78
|
else if([action isEqualToString:@"initializeReader"])
|
|
79
79
|
[self initializeReader :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
80
|
-
else if([action isEqualToString:@"initializeReaderAutomatically"])
|
|
81
|
-
[self initializeReaderAutomatically :successCallback :errorCallback];
|
|
82
80
|
else if([action isEqualToString:@"initializeReaderWithBleDeviceConfig"])
|
|
83
81
|
[self initializeReaderWithBleDeviceConfig :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
84
82
|
else if([action isEqualToString:@"deinitializeReader"])
|
|
@@ -169,18 +167,14 @@ RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(R
|
|
|
169
167
|
[self containers :[args objectAtIndex:0] :[args objectAtIndex:1] :successCallback :errorCallback];
|
|
170
168
|
else if([action isEqualToString:@"encryptedContainers"])
|
|
171
169
|
[self encryptedContainers :[args objectAtIndex:0] :successCallback :errorCallback];
|
|
172
|
-
else if([action isEqualToString:@"getTranslation"])
|
|
173
|
-
[self getTranslation :[args objectAtIndex:0] :[args objectAtIndex:1] :successCallback :errorCallback];
|
|
174
170
|
else if([action isEqualToString:@"finalizePackage"])
|
|
175
171
|
[self finalizePackage :successCallback :errorCallback];
|
|
172
|
+
else if([action isEqualToString:@"getTranslation"])
|
|
173
|
+
[self getTranslation :[args objectAtIndex:0] :[args objectAtIndex:1] :successCallback :errorCallback];
|
|
176
174
|
else
|
|
177
175
|
errorCallback([NSString stringWithFormat:@"%@/%@", @"method not implemented: ", action]);
|
|
178
176
|
}
|
|
179
177
|
|
|
180
|
-
static NSNumber * _databasePercentageDownloaded;
|
|
181
|
-
+ (NSNumber*)databasePercentageDownloaded{ return _databasePercentageDownloaded; }
|
|
182
|
-
+ (void)setDatabasePercentageDownloaded:(NSNumber *)value { _databasePercentageDownloaded = value; }
|
|
183
|
-
|
|
184
178
|
NSString* RGLWCompletionEvent = @"completion";
|
|
185
179
|
NSString* RGLWDatabaseProgressEvent = @"database_progress";
|
|
186
180
|
|
|
@@ -271,20 +265,12 @@ NSString* RGLWOnCustomButtonTappedEvent = @"onCustomButtonTappedEvent";
|
|
|
271
265
|
RGLDocReader.shared.processParams = [RGLProcessParams new];
|
|
272
266
|
RGLDocReader.shared.customization = [RGLCustomization new];
|
|
273
267
|
RGLDocReader.shared.rfidScenario = [RGLRFIDScenario new];
|
|
274
|
-
RGLDocReader.shared.functionality.recordScanningProcessDelegate = self;
|
|
275
|
-
RGLDocReader.shared.customization.actionDelegate = self;
|
|
276
268
|
}
|
|
277
269
|
|
|
278
270
|
- (void) initializeReader:(NSDictionary*)config :(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
|
|
279
271
|
[RGLDocReader.shared initializeReaderWithConfig:[RGLWJSONConstructor configFromJson:config] completion:[self getInitCompletion :successCallback :errorCallback]];
|
|
280
272
|
}
|
|
281
273
|
|
|
282
|
-
- (void) initializeReaderAutomatically:(RGLWCallback)successCallback :(RGLWCallback)errorCallback {
|
|
283
|
-
NSString *dataPath = [[NSBundle mainBundle] pathForResource:@"regula.license" ofType:nil];
|
|
284
|
-
NSData *licenseData = [NSData dataWithContentsOfFile:dataPath];
|
|
285
|
-
[RGLDocReader.shared initializeReaderWithConfig:[RGLConfig configWithLicenseData:licenseData] completion:[self getInitCompletion :successCallback :errorCallback]];
|
|
286
|
-
}
|
|
287
|
-
|
|
288
274
|
- (void) initializeReaderWithBleDeviceConfig:(NSDictionary*)config :(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
|
|
289
275
|
errorCallback(@"initializeReaderWithBleDeviceConfig() is an android-only method");
|
|
290
276
|
}
|
|
@@ -295,7 +281,7 @@ NSString* RGLWOnCustomButtonTappedEvent = @"onCustomButtonTappedEvent";
|
|
|
295
281
|
}
|
|
296
282
|
|
|
297
283
|
- (void) prepareDatabase:(NSString*)databaseID :(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
|
|
298
|
-
[RGLDocReader.shared prepareDatabase:databaseID progressHandler:
|
|
284
|
+
[RGLDocReader.shared prepareDatabase:databaseID progressHandler:nil completion:[self getPrepareCompletion :successCallback :errorCallback]];
|
|
299
285
|
}
|
|
300
286
|
|
|
301
287
|
- (void) removeDatabase:(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
|
|
@@ -305,7 +291,7 @@ NSString* RGLWOnCustomButtonTappedEvent = @"onCustomButtonTappedEvent";
|
|
|
305
291
|
}
|
|
306
292
|
|
|
307
293
|
-(void) runAutoUpdate:(NSString*)databaseID :(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
|
|
308
|
-
[RGLDocReader.shared runAutoUpdate:databaseID progressHandler:
|
|
294
|
+
[RGLDocReader.shared runAutoUpdate:databaseID progressHandler:nil completion:[self getPrepareCompletion :successCallback :errorCallback]];
|
|
309
295
|
}
|
|
310
296
|
|
|
311
297
|
- (void) cancelDBUpdate:(RGLWCallback)successCallback :(RGLWCallback)errorCallback{
|
|
@@ -599,20 +585,12 @@ NSString* RGLWOnCustomButtonTappedEvent = @"onCustomButtonTappedEvent";
|
|
|
599
585
|
}
|
|
600
586
|
|
|
601
587
|
-(RGLDocumentReaderPrepareCompletion _Nonnull)getPrepareCompletion:(RGLWCallback)successCallback :(RGLWCallback)errorCallback {
|
|
588
|
+
RGLDocReader.shared.databaseFetchDelegate = self;
|
|
602
589
|
return ^(BOOL success, NSError * _Nullable error) {
|
|
603
590
|
successCallback([RGLWJSONConstructor generateSuccessCompletion:success :error]);
|
|
604
591
|
};
|
|
605
592
|
}
|
|
606
593
|
|
|
607
|
-
-(void (^_Nullable)(NSProgress * _Nonnull progress))getProgressHandler {
|
|
608
|
-
return ^(NSProgress * _Nonnull progress) {
|
|
609
|
-
if(RNRegulaDocumentReader.databasePercentageDownloaded != [NSNumber numberWithDouble:progress.fractionCompleted * 100]){
|
|
610
|
-
sendEvent(RGLWDatabaseProgressEvent, [NSNumber numberWithInt:(int)(progress.fractionCompleted * 100)]);
|
|
611
|
-
[RNRegulaDocumentReader setDatabasePercentageDownloaded:[NSNumber numberWithDouble:progress.fractionCompleted * 100]];
|
|
612
|
-
}
|
|
613
|
-
};
|
|
614
|
-
}
|
|
615
|
-
|
|
616
594
|
-(RGLDocumentReaderInitializationCompletion)getInitCompletion:(RGLWCallback)successCallback :(RGLWCallback)errorCallback {
|
|
617
595
|
return ^(BOOL success, NSError * _Nullable error ) {
|
|
618
596
|
if (success) {
|
|
@@ -624,9 +602,24 @@ NSString* RGLWOnCustomButtonTappedEvent = @"onCustomButtonTappedEvent";
|
|
|
624
602
|
};
|
|
625
603
|
}
|
|
626
604
|
|
|
605
|
+
// RGLDocReaderDatabaseFetchDelegate
|
|
606
|
+
- (void)onProgressChanged:(NSNumber *)downloadedBytes totalBytes:(NSNumber *)totalBytes {
|
|
607
|
+
int progress = 0;
|
|
608
|
+
if (downloadedBytes > 0 && totalBytes > 0) {
|
|
609
|
+
double percent = [downloadedBytes doubleValue] / [totalBytes doubleValue];
|
|
610
|
+
progress = (int) (percent * 100);
|
|
611
|
+
}
|
|
612
|
+
NSDictionary* result = @{
|
|
613
|
+
@"downloadedBytes":downloadedBytes,
|
|
614
|
+
@"totalBytes":totalBytes,
|
|
615
|
+
@"progress":@(progress)
|
|
616
|
+
};
|
|
617
|
+
sendEvent(RGLWDatabaseProgressEvent, [RGLWJSONConstructor dictToString: result]);
|
|
618
|
+
}
|
|
619
|
+
|
|
627
620
|
// RGLCustomizationActionDelegate
|
|
628
621
|
- (void)onCustomButtonTappedWithTag:(NSInteger)tag {
|
|
629
|
-
sendEvent(RGLWOnCustomButtonTappedEvent,
|
|
622
|
+
sendEvent(RGLWOnCustomButtonTappedEvent, @(tag));
|
|
630
623
|
}
|
|
631
624
|
|
|
632
625
|
// RGLRecordScanningProcessDelegate
|
package/package.json
CHANGED