scandit-react-native-datacapture-core 8.2.0 → 8.3.0-beta.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/THIRD_PARTY.txt +1 -1
- package/android/build.gradle +20 -9
- package/android/generated/java/com/facebook/fbreact/specs/NativeScanditDataCaptureCoreSpec.java +83 -0
- package/android/generated/java/com/facebook/react/viewmanagers/RNTDataCaptureViewManagerDelegate.java +26 -0
- package/android/generated/java/com/facebook/react/viewmanagers/RNTDataCaptureViewManagerInterface.java +16 -0
- package/android/generated/jni/CMakeLists.txt +29 -0
- package/android/generated/jni/ScanditReactNativeDatacaptureCoreSpec-generated.cpp +52 -0
- package/android/generated/jni/ScanditReactNativeDatacaptureCoreSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/ComponentDescriptors.cpp +22 -0
- package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/ComponentDescriptors.h +24 -0
- package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/EventEmitters.cpp +16 -0
- package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/EventEmitters.h +23 -0
- package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/Props.cpp +25 -0
- package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/Props.h +27 -0
- package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/ScanditReactNativeDatacaptureCoreSpecJSI-generated.cpp +47 -0
- package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/ScanditReactNativeDatacaptureCoreSpecJSI.h +169 -0
- package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/ShadowNodes.cpp +17 -0
- package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/ShadowNodes.h +32 -0
- package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/States.cpp +16 -0
- package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureCoreSpec/States.h +29 -0
- package/android/src/main/AndroidManifest.xml +3 -1
- package/android/src/main/AndroidManifestNew.xml +3 -1
- package/android/src/main/kotlin/com/scandit/datacapture/reactnative/core/{ScanditDataCaptureCoreModule.kt → ScanditDataCaptureCoreModuleBase.kt} +15 -40
- package/android/src/main/kotlin/com/scandit/datacapture/reactnative/core/ScanditDataCaptureCorePackage.kt +1 -23
- package/android/src/main/kotlin/com/scandit/datacapture/reactnative/core/ui/{DataCaptureViewManager.kt → DataCaptureViewManagerBase.kt} +9 -4
- package/android/src/main/newArch/kotlin/com/scandit/datacapture/reactnative/core/ScanditDataCaptureCoreModule.kt +72 -0
- package/android/src/main/newArch/kotlin/com/scandit/datacapture/reactnative/core/ScanditReactPackageBase.kt +44 -11
- package/android/src/main/newArch/kotlin/com/scandit/datacapture/reactnative/core/ui/DataCaptureViewManager.kt +31 -0
- package/android/src/main/newArch/kotlin/com/scandit/datacapture/reactnative/core/utils/ReactNativeEventEmitter.kt +39 -0
- package/android/src/main/oldArch/kotlin/com/scandit/datacapture/reactnative/core/ScanditDataCaptureCoreModule.kt +86 -0
- package/android/src/main/oldArch/kotlin/com/scandit/datacapture/reactnative/core/ScanditReactPackageBase.kt +5 -2
- package/android/src/main/oldArch/kotlin/com/scandit/datacapture/reactnative/core/ui/DataCaptureViewManager.kt +18 -0
- package/android/src/main/{kotlin → oldArch/kotlin}/com/scandit/datacapture/reactnative/core/utils/ReactNativeEventEmitter.kt +4 -1
- package/dist/core.js +850 -62
- package/dist/core.js.map +1 -1
- package/dist/dts/DataCaptureView.d.ts +3 -0
- package/dist/dts/index.d.ts +79 -13
- package/dist/dts/native/RNNativeCaller.d.ts +8 -1
- package/dist/index.js +44 -7
- package/dist/index.js.flow +79 -99
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/ios/Sources/NewArch/RCTDataCaptureView.mm +110 -0
- package/ios/Sources/NewArch/ScanditDataCaptureCore.mm +102 -0
- package/ios/Sources/OldArch/RCTFabricDataCaptureViewContainers.mm +17 -0
- package/ios/Sources/OldArch/ScanditDataCaptureCore.mm +92 -0
- package/ios/Sources/RNTSDCDataCaptureViewManager.swift +41 -0
- package/ios/Sources/SDCLogger.h +11 -0
- package/ios/Sources/SDCLogger.m +16 -0
- package/ios/Sources/SDCTurboModuleEventBridge.h +42 -0
- package/ios/Sources/SDCTurboModuleEventBridge.m +20 -0
- package/ios/Sources/ScanditDataCaptureCore-Bridging-Header.h +3 -0
- package/ios/Sources/ScanditDataCaptureCore.h +35 -1
- package/ios/Sources/ScanditDataCaptureCore.swift +134 -60
- package/ios/Sources/Shared/DataCaptureViewWrapper.swift +129 -0
- package/ios/Sources/{Protocols → Shared}/ScanditReactNativeFactoryContainer.swift +7 -3
- package/ios/Sources/Utils/CallbackLock.swift +1 -1
- package/ios/Sources/Utils/ReactNativeEmitter.swift +43 -10
- package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/ComponentDescriptors.cpp +22 -0
- package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/ComponentDescriptors.h +24 -0
- package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/EventEmitters.cpp +16 -0
- package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/EventEmitters.h +23 -0
- package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/Props.cpp +25 -0
- package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/Props.h +27 -0
- package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/RCTComponentViewHelpers.h +20 -0
- package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/ScanditReactNativeDatacaptureCoreSpec-generated.mm +67 -0
- package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/ScanditReactNativeDatacaptureCoreSpec.h +109 -0
- package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/ShadowNodes.cpp +17 -0
- package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/ShadowNodes.h +32 -0
- package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/States.cpp +16 -0
- package/ios/generated/ScanditReactNativeDatacaptureCoreSpec/States.h +29 -0
- package/ios/generated/ScanditReactNativeDatacaptureCoreSpecJSI-generated.cpp +47 -0
- package/ios/generated/ScanditReactNativeDatacaptureCoreSpecJSI.h +169 -0
- package/package.json +26 -7
- package/react-native.config.js +12 -0
- package/scandit-react-native-datacapture-core.podspec +49 -17
- package/specs/NativeScanditDataCaptureCore.ts +36 -0
- package/specs/RNTDataCaptureViewNativeComponent.ts +14 -0
- package/ios/Sources/ScanditDataCaptureCore.m +0 -30
- package/ios/Sources/ScanditDataCaptureViewManager.swift +0 -63
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the Scandit Data Capture SDK
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2026- Scandit AG. All rights reserved.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#import "ScanditDataCaptureCore.h"
|
|
8
|
+
#import "ScanditDataCaptureCore-Swift.h"
|
|
9
|
+
|
|
10
|
+
#import <React/RCTViewComponentView.h>
|
|
11
|
+
#import <React/RCTFabricComponentsPlugins.h>
|
|
12
|
+
#import <ScanditReactNativeDatacaptureCoreSpec/ComponentDescriptors.h>
|
|
13
|
+
#import <ScanditReactNativeDatacaptureCoreSpec/Props.h>
|
|
14
|
+
|
|
15
|
+
using namespace facebook::react;
|
|
16
|
+
|
|
17
|
+
/// Fabric architecture component view for DataCaptureView.
|
|
18
|
+
@interface RCTDataCaptureView : RCTViewComponentView
|
|
19
|
+
@end
|
|
20
|
+
|
|
21
|
+
@implementation RCTDataCaptureView {
|
|
22
|
+
DataCaptureViewContainerWrapper *_containerView;
|
|
23
|
+
BOOL _needsContainerRegistration;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static NSMutableArray<DataCaptureViewContainerWrapper *> *_containers;
|
|
27
|
+
|
|
28
|
+
+ (void)initialize {
|
|
29
|
+
if (self == [RCTDataCaptureView class]) {
|
|
30
|
+
_containers = [NSMutableArray array];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
+ (NSMutableArray<DataCaptureViewContainerWrapper *> *)containers {
|
|
35
|
+
return _containers;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
- (instancetype)initWithFrame:(CGRect)frame {
|
|
39
|
+
if (self = [super initWithFrame:frame]) {
|
|
40
|
+
static const auto defaultProps = std::make_shared<const RNTDataCaptureViewProps>();
|
|
41
|
+
_props = defaultProps;
|
|
42
|
+
|
|
43
|
+
_containerView = [[RCTFabricDataCaptureViewWrapper alloc] init];
|
|
44
|
+
_containerView.autoresizingMask = UIViewAutoresizingFlexibleWidth |
|
|
45
|
+
UIViewAutoresizingFlexibleHeight;
|
|
46
|
+
[RCTDataCaptureView.containers addObject:_containerView];
|
|
47
|
+
self.contentView = _containerView;
|
|
48
|
+
}
|
|
49
|
+
return self;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
- (void)setTag:(NSInteger)tag {
|
|
53
|
+
[super setTag:tag];
|
|
54
|
+
_containerView.tag = tag;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
- (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask {
|
|
58
|
+
[super finalizeUpdates:updateMask];
|
|
59
|
+
if (_needsContainerRegistration) {
|
|
60
|
+
_needsContainerRegistration = NO;
|
|
61
|
+
[RCTDataCaptureView.containers addObject:_containerView];
|
|
62
|
+
|
|
63
|
+
// After recycle, _containerView stays as our child so its didMoveToSuperview
|
|
64
|
+
// won't fire. Manually set the attachment action that cleanupForRecycle cleared.
|
|
65
|
+
__weak DataCaptureViewContainerWrapper *weakContainer = _containerView;
|
|
66
|
+
_containerView.postFrameSetAction = ^{
|
|
67
|
+
[weakContainer attachDataCaptureViewIfAvailable];
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
- (void)didMoveToSuperview {
|
|
73
|
+
[super didMoveToSuperview];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
- (void)layoutSubviews {
|
|
77
|
+
[super layoutSubviews];
|
|
78
|
+
if (_containerView.postFrameSetAction) {
|
|
79
|
+
[_containerView layoutSubviews];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
- (void)prepareForRecycle {
|
|
84
|
+
[super prepareForRecycle];
|
|
85
|
+
[_containerView cleanupForRecycle];
|
|
86
|
+
|
|
87
|
+
NSUInteger index = [RCTDataCaptureView.containers indexOfObject:_containerView];
|
|
88
|
+
if (index != NSNotFound) {
|
|
89
|
+
[RCTDataCaptureView.containers removeObjectAtIndex:index];
|
|
90
|
+
}
|
|
91
|
+
_needsContainerRegistration = YES;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider {
|
|
95
|
+
return concreteComponentDescriptorProvider<RNTDataCaptureViewComponentDescriptor>();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@end
|
|
99
|
+
|
|
100
|
+
Class<RCTComponentViewProtocol> RNTDataCaptureViewCls(void) { return RCTDataCaptureView.class; }
|
|
101
|
+
|
|
102
|
+
/// Implementation of bridge class to expose Fabric containers to Swift code.
|
|
103
|
+
/// Interface is declared in ScanditDataCaptureCore.h
|
|
104
|
+
@implementation RCTFabricDataCaptureViewContainers
|
|
105
|
+
|
|
106
|
+
+ (NSArray<DataCaptureViewContainerWrapper *> *)containers {
|
|
107
|
+
return RCTDataCaptureView.containers;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@end
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the Scandit Data Capture SDK
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2026- Scandit AG. All rights reserved.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#import <React/RCTEventEmitter.h>
|
|
8
|
+
#import <React/RCTBridgeModule.h>
|
|
9
|
+
#import <ScanditReactNativeDatacaptureCoreSpec/ScanditReactNativeDatacaptureCoreSpec.h>
|
|
10
|
+
#import <ReactCommon/RCTTurboModule.h>
|
|
11
|
+
#import "ScanditDataCaptureCore.h"
|
|
12
|
+
#import "ScanditDataCaptureCore-Swift.h"
|
|
13
|
+
#import "SDCTurboModuleEventBridge.h"
|
|
14
|
+
|
|
15
|
+
/// New Architecture (TurboModule/Fabric) adapter for the Core native module.
|
|
16
|
+
/// Inherits from the generated spec base class and uses direct method declarations.
|
|
17
|
+
@implementation NativeScanditDataCaptureCore {
|
|
18
|
+
ScanditDataCaptureCoreImpl *_impl;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
RCT_EXPORT_MODULE(ScanditDataCaptureCore)
|
|
22
|
+
|
|
23
|
+
- (instancetype)init {
|
|
24
|
+
if (self = [super init]) {
|
|
25
|
+
_impl = [[ScanditDataCaptureCoreImpl alloc] init];
|
|
26
|
+
}
|
|
27
|
+
return self;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
31
|
+
return YES;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
- (void)initialize {
|
|
35
|
+
__weak NativeScanditDataCaptureCore *weakSelf = self;
|
|
36
|
+
SDCEventEmitBlock emitterBlock = ^(NSDictionary *_Nonnull payload) {
|
|
37
|
+
__strong NativeScanditDataCaptureCore *strongSelf = weakSelf;
|
|
38
|
+
if (strongSelf) {
|
|
39
|
+
[strongSelf emitOnScanditEvent:payload];
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
[_impl setupWith:nil turboEmitter:emitterBlock];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
- (dispatch_queue_t)methodQueue {
|
|
46
|
+
return [SDCSharedMethodQueue queue];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
- (NSDictionary *)constantsToExport {
|
|
50
|
+
return [self getConstantsOnMainQueue];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
- (NSDictionary *)getConstants {
|
|
54
|
+
return [self getConstantsOnMainQueue];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
- (NSDictionary *)getConstantsOnMainQueue {
|
|
58
|
+
__block NSDictionary *constants;
|
|
59
|
+
if ([NSThread isMainThread]) {
|
|
60
|
+
constants = [_impl getConstants];
|
|
61
|
+
} else {
|
|
62
|
+
dispatch_sync(dispatch_get_main_queue(), ^{
|
|
63
|
+
constants = [_impl getConstants];
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return constants;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
- (NSArray<NSString *> *)supportedEvents {
|
|
70
|
+
return [_impl supportedEvents];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
- (void)invalidate {
|
|
74
|
+
[_impl invalidate];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// MARK: - Native Module Methods
|
|
78
|
+
|
|
79
|
+
- (void)executeCore:(NSDictionary *)data
|
|
80
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
81
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
82
|
+
[_impl executeCore:data resolve:resolve reject:reject];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
- (void)createDataCaptureView:(NSDictionary *)data
|
|
86
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
87
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
88
|
+
[_impl createDataCaptureViewWithData:data resolve:resolve reject:reject];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
- (void)removeDataCaptureView:(NSDictionary *)data
|
|
92
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
93
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
94
|
+
[_impl removeDataCaptureViewWithData:data resolve:resolve reject:reject];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
98
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params {
|
|
99
|
+
return std::make_shared<facebook::react::NativeScanditDataCaptureCoreSpecJSI>(params);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the Scandit Data Capture SDK
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2026- Scandit AG. All rights reserved.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#import "ScanditDataCaptureCore.h"
|
|
8
|
+
|
|
9
|
+
/// Old Architecture stub for the Fabric containers bridge.
|
|
10
|
+
/// Returns an empty array since Fabric views are not used in old architecture.
|
|
11
|
+
@implementation RCTFabricDataCaptureViewContainers
|
|
12
|
+
|
|
13
|
+
+ (NSArray<DataCaptureViewContainerWrapper *> *)containers {
|
|
14
|
+
return @[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the Scandit Data Capture SDK
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2026- Scandit AG. All rights reserved.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#import <React/RCTEventEmitter.h>
|
|
8
|
+
#import <React/RCTBridgeModule.h>
|
|
9
|
+
#import "ScanditDataCaptureCore.h"
|
|
10
|
+
#import "ScanditDataCaptureCore-Swift.h"
|
|
11
|
+
#import "SDCTurboModuleEventBridge.h"
|
|
12
|
+
|
|
13
|
+
/// Old Architecture (Paper/Bridge) adapter for the Core native module.
|
|
14
|
+
/// Inherits from RCTEventEmitter and exports methods via RCT_EXPORT_METHOD macros.
|
|
15
|
+
@implementation NativeScanditDataCaptureCore {
|
|
16
|
+
ScanditDataCaptureCoreImpl *_impl;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
RCT_EXPORT_MODULE(ScanditDataCaptureCore)
|
|
20
|
+
|
|
21
|
+
- (instancetype)init {
|
|
22
|
+
if (self = [super init]) {
|
|
23
|
+
_impl = [[ScanditDataCaptureCoreImpl alloc] init];
|
|
24
|
+
}
|
|
25
|
+
return self;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
29
|
+
return YES;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
- (void)initialize {
|
|
33
|
+
[_impl setupWith:self];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
- (dispatch_queue_t)methodQueue {
|
|
37
|
+
return [SDCSharedMethodQueue queue];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
- (NSDictionary *)constantsToExport {
|
|
41
|
+
return [self getConstantsOnMainQueue];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
- (NSDictionary *)getConstants {
|
|
45
|
+
return [self getConstantsOnMainQueue];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
- (NSDictionary *)getConstantsOnMainQueue {
|
|
49
|
+
__block NSDictionary *constants;
|
|
50
|
+
if ([NSThread isMainThread]) {
|
|
51
|
+
constants = [_impl getConstants];
|
|
52
|
+
} else {
|
|
53
|
+
dispatch_sync(dispatch_get_main_queue(), ^{
|
|
54
|
+
constants = [_impl getConstants];
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return constants;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
- (NSArray<NSString *> *)supportedEvents {
|
|
61
|
+
return [_impl supportedEvents];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
- (void)invalidate {
|
|
65
|
+
[super invalidate];
|
|
66
|
+
[_impl invalidate];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// MARK: - Native Module Methods
|
|
70
|
+
|
|
71
|
+
RCT_EXPORT_METHOD(executeCore
|
|
72
|
+
: (NSDictionary *)data resolve
|
|
73
|
+
: (RCTPromiseResolveBlock)resolve reject
|
|
74
|
+
: (RCTPromiseRejectBlock)reject) {
|
|
75
|
+
[_impl executeCore:data resolve:resolve reject:reject];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
RCT_EXPORT_METHOD(createDataCaptureView
|
|
79
|
+
: (NSDictionary *)data resolve
|
|
80
|
+
: (RCTPromiseResolveBlock)resolve reject
|
|
81
|
+
: (RCTPromiseRejectBlock)reject) {
|
|
82
|
+
[_impl createDataCaptureViewWithData:data resolve:resolve reject:reject];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
RCT_EXPORT_METHOD(removeDataCaptureView
|
|
86
|
+
: (NSDictionary *)data resolve
|
|
87
|
+
: (RCTPromiseResolveBlock)resolve reject
|
|
88
|
+
: (RCTPromiseRejectBlock)reject) {
|
|
89
|
+
[_impl removeDataCaptureViewWithData:data resolve:resolve reject:reject];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the Scandit Data Capture SDK
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2020- Scandit AG. All rights reserved.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import Foundation
|
|
8
|
+
import React
|
|
9
|
+
import ScanditFrameworksCore
|
|
10
|
+
|
|
11
|
+
/// Legacy architecture (Paper) wrapper for DataCaptureView.
|
|
12
|
+
/// Uses reactTag for view identification.
|
|
13
|
+
class RNTSDCDataCaptureViewWrapper: DataCaptureViewContainerWrapper {
|
|
14
|
+
|
|
15
|
+
override func didMoveToSuperview() {
|
|
16
|
+
super.didMoveToSuperview()
|
|
17
|
+
containerManager = RNTSDCDataCaptureViewManager.self
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
override func getViewId() -> Int {
|
|
21
|
+
self.reactTag?.intValue ?? 0
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/// Legacy architecture (Paper) view manager for DataCaptureView.
|
|
26
|
+
@objc(RNTSDCDataCaptureViewManager)
|
|
27
|
+
class RNTSDCDataCaptureViewManager: RCTViewManager, DeserializationLifeCycleObserver, DataCaptureViewContainerManager {
|
|
28
|
+
|
|
29
|
+
static var containers: [DataCaptureViewContainerWrapper] = []
|
|
30
|
+
|
|
31
|
+
override class func requiresMainQueueSetup() -> Bool {
|
|
32
|
+
false
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
override func view() -> UIView! {
|
|
36
|
+
let container = RNTSDCDataCaptureViewWrapper()
|
|
37
|
+
container.containerManager = RNTSDCDataCaptureViewManager.self
|
|
38
|
+
RNTSDCDataCaptureViewManager.containers.append(container)
|
|
39
|
+
return container
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the Scandit Data Capture SDK
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2026- Scandit AG. All rights reserved.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#import "SDCLogger.h"
|
|
8
|
+
#import <React/RCTLog.h>
|
|
9
|
+
|
|
10
|
+
@implementation SDCLogger
|
|
11
|
+
|
|
12
|
+
+ (void)warn:(NSString *)message {
|
|
13
|
+
RCTLogWarn(@"%@", message);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the Scandit Data Capture SDK
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2026- Scandit AG. All rights reserved.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#import <Foundation/Foundation.h>
|
|
8
|
+
|
|
9
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Block type for emitting events via TurboModule's CodegenTypes.EventEmitter.
|
|
13
|
+
* The payload dictionary should contain:
|
|
14
|
+
* - "name": event name (NSString)
|
|
15
|
+
* - "data": JSON string of the event data (NSString)
|
|
16
|
+
* - "viewId": optional view ID (NSNumber)
|
|
17
|
+
* - "modeId": optional mode ID (NSNumber)
|
|
18
|
+
*/
|
|
19
|
+
typedef void (^SDCEventEmitBlock)(NSDictionary *_Nonnull payload);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Bridge class for TurboModule event emission.
|
|
23
|
+
*
|
|
24
|
+
* This enables Swift code to emit events via the new architecture's
|
|
25
|
+
* CodegenTypes.EventEmitter (emitOnScanditEvent:) without requiring
|
|
26
|
+
* Swift to inherit from the generated ObjC spec base class.
|
|
27
|
+
*
|
|
28
|
+
* Pattern mirrors Android's ReactNativeEventEmitter callback injection.
|
|
29
|
+
*/
|
|
30
|
+
@interface SDCTurboModuleEventBridge : NSObject
|
|
31
|
+
|
|
32
|
+
+ (instancetype)sharedInstance;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Event emitter for Core module.
|
|
36
|
+
* Set by ScanditDataCaptureCore.mm when new arch is enabled.
|
|
37
|
+
*/
|
|
38
|
+
@property (nonatomic, copy, nullable) SDCEventEmitBlock coreEventEmitter;
|
|
39
|
+
|
|
40
|
+
@end
|
|
41
|
+
|
|
42
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the Scandit Data Capture SDK
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2026- Scandit AG. All rights reserved.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#import "SDCTurboModuleEventBridge.h"
|
|
8
|
+
|
|
9
|
+
@implementation SDCTurboModuleEventBridge
|
|
10
|
+
|
|
11
|
+
+ (instancetype)sharedInstance {
|
|
12
|
+
static SDCTurboModuleEventBridge *instance;
|
|
13
|
+
static dispatch_once_t onceToken;
|
|
14
|
+
dispatch_once(&onceToken, ^{
|
|
15
|
+
instance = [[SDCTurboModuleEventBridge alloc] init];
|
|
16
|
+
});
|
|
17
|
+
return instance;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@end
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
* Copyright (C) 2020- Scandit AG. All rights reserved.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
#import "SDCLogger.h"
|
|
8
|
+
#import "ScanditDataCaptureCore.h"
|
|
9
|
+
#import "SDCTurboModuleEventBridge.h"
|
|
7
10
|
#import <React/RCTBridgeModule.h>
|
|
8
11
|
#import <React/RCTEventEmitter.h>
|
|
9
12
|
#import <React/RCTViewManager.h>
|
|
@@ -4,4 +4,38 @@
|
|
|
4
4
|
* Copyright (C) 2020- Scandit AG. All rights reserved.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
#import <Foundation/Foundation.h>
|
|
8
|
+
#import <UIKit/UIKit.h>
|
|
9
|
+
#import <React/RCTEventEmitter.h>
|
|
10
|
+
|
|
11
|
+
// Block type for TurboModule event emission (Swift interop)
|
|
12
|
+
// Defined unconditionally for Swift header generation, used only in new arch
|
|
13
|
+
typedef void (^SDCEventEmitBlock)(NSDictionary *_Nonnull payload);
|
|
14
|
+
|
|
15
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
16
|
+
#import <ScanditReactNativeDatacaptureCoreSpec/ScanditReactNativeDatacaptureCoreSpec.h>
|
|
17
|
+
#import <React/RCTInitializing.h>
|
|
18
|
+
#import <React/RCTInvalidating.h>
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
// Forward declaration for Swift class
|
|
22
|
+
@class DataCaptureViewContainerWrapper;
|
|
23
|
+
|
|
24
|
+
/// Bridge class to expose Fabric containers to Swift code.
|
|
25
|
+
/// Returns containers from the Fabric architecture when new arch is enabled,
|
|
26
|
+
/// or an empty array when using the legacy architecture.
|
|
27
|
+
@interface RCTFabricDataCaptureViewContainers : NSObject
|
|
28
|
+
+ (NSArray<DataCaptureViewContainerWrapper *> *)containers;
|
|
29
|
+
@end
|
|
30
|
+
|
|
31
|
+
/// Native module for Scandit Data Capture Core.
|
|
32
|
+
/// This Obj-C++ class conforms to the TurboModule spec and delegates to ScanditDataCaptureCoreImpl
|
|
33
|
+
/// (Swift). Following the Adapter Pattern from React Native's TurboModule Swift guide.
|
|
34
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
35
|
+
@interface NativeScanditDataCaptureCore
|
|
36
|
+
: NativeScanditDataCaptureCoreSpecBase <NativeScanditDataCaptureCoreSpec, RCTInitializing,
|
|
37
|
+
RCTInvalidating>
|
|
38
|
+
#else
|
|
39
|
+
@interface NativeScanditDataCaptureCore : RCTEventEmitter <RCTBridgeModule>
|
|
40
|
+
#endif
|
|
41
|
+
@end
|