scandit-react-native-datacapture-parser 8.2.1 → 8.3.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.
Files changed (25) hide show
  1. package/android/build.gradle +29 -1
  2. package/android/generated/java/com/facebook/fbreact/specs/NativeScanditDataCaptureParserSpec.java +75 -0
  3. package/android/generated/jni/CMakeLists.txt +29 -0
  4. package/android/generated/jni/ScanditReactNativeDatacaptureParserSpec-generated.cpp +40 -0
  5. package/android/generated/jni/ScanditReactNativeDatacaptureParserSpec.h +31 -0
  6. package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureParserSpec/ScanditReactNativeDatacaptureParserSpecJSI-generated.cpp +33 -0
  7. package/android/generated/jni/react/renderer/components/ScanditReactNativeDatacaptureParserSpec/ScanditReactNativeDatacaptureParserSpecJSI.h +151 -0
  8. package/android/src/main/kotlin/com/scandit/datacapture/reactnative/parser/{ScanditDataCaptureParserModule.kt → ScanditDataCaptureParserModuleBase.kt} +8 -25
  9. package/android/src/main/newArch/kotlin/com/scandit/datacapture/reactnative/parser/ScanditDataCaptureParserModule.kt +42 -0
  10. package/android/src/main/oldArch/kotlin/com/scandit/datacapture/reactnative/parser/ScanditDataCaptureParserModule.kt +54 -0
  11. package/dist/index.js.map +1 -1
  12. package/dist/tsconfig.tsbuildinfo +1 -1
  13. package/ios/Sources/NewArch/ScanditDataCaptureParser.mm +83 -0
  14. package/ios/Sources/OldArch/ScanditDataCaptureParser.mm +71 -0
  15. package/ios/Sources/ScanditDataCaptureParser.h +29 -0
  16. package/ios/Sources/ScanditDataCaptureParser.swift +41 -21
  17. package/ios/generated/ScanditReactNativeDatacaptureParserSpec/ScanditReactNativeDatacaptureParserSpec-generated.mm +53 -0
  18. package/ios/generated/ScanditReactNativeDatacaptureParserSpec/ScanditReactNativeDatacaptureParserSpec.h +103 -0
  19. package/ios/generated/ScanditReactNativeDatacaptureParserSpecJSI-generated.cpp +33 -0
  20. package/ios/generated/ScanditReactNativeDatacaptureParserSpecJSI.h +151 -0
  21. package/package.json +24 -11
  22. package/react-native.config.js +12 -0
  23. package/scandit-react-native-datacapture-parser.podspec +17 -31
  24. package/specs/NativeScanditDataCaptureParser.ts +28 -0
  25. package/ios/Sources/ScanditDataCaptureParser.m +0 -15
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @type {import('@react-native-community/cli-types').Config}
3
+ */
4
+ module.exports = {
5
+ dependency: {
6
+ platforms: {
7
+ android: {
8
+ cmakeListsPath: 'generated/jni/CMakeLists.txt',
9
+ },
10
+ },
11
+ },
12
+ };
@@ -3,23 +3,6 @@ require "json"
3
3
  package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
4
  version = package["version"]
5
5
 
6
- # Helper to detect React Native version
7
- rn_version_gte = lambda do |min_version|
8
- begin
9
- rn_package_path = File.join(__dir__, "..", "react-native", "package.json")
10
- unless File.exist?(rn_package_path)
11
- # Try node_modules path for samples/apps
12
- rn_package_path = File.join(__dir__, "..", "..", "node_modules", "react-native", "package.json")
13
- end
14
- return false unless File.exist?(rn_package_path)
15
-
16
- rn_package = JSON.parse(File.read(rn_package_path))
17
- rn_version = rn_package["version"]
18
- Gem::Version.new(rn_version) >= Gem::Version.new(min_version)
19
- rescue
20
- false
21
- end
22
- end
23
6
 
24
7
  Pod::Spec.new do |s|
25
8
  s.name = package["name"]
@@ -31,30 +14,33 @@ Pod::Spec.new do |s|
31
14
  s.platforms = { :ios => "15.0" }
32
15
  s.source = { :git => package["homepage"] + ".git", :tag => "#{s.version}" }
33
16
  s.swift_version = '5.0'
34
- s.source_files = "ios/Sources/**/*.{h,m,swift}"
35
17
  s.requires_arc = true
36
18
  s.module_name = "ScanditDataCaptureParser"
37
19
  s.header_dir = "ScanditDataCaptureParser"
38
20
 
39
- s.dependency "React"
40
21
  s.dependency "scandit-react-native-datacapture-core", "= #{version}"
41
- s.dependency "scandit-datacapture-frameworks-parser", '= 8.2.1'
22
+ s.dependency "scandit-datacapture-frameworks-parser", '= 8.3.0'
42
23
 
43
- # New Architecture specific dependencies and compiler flags
44
- if ENV['RCT_NEW_ARCH_ENABLED'] == '1'
45
- s.dependency "React-RCTAppDelegate"
24
+ is_new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
46
25
 
47
- swift_flags = ['-DRCT_NEW_ARCH_ENABLED']
48
- # RCTReactNativeFactory was introduced in RN 0.78
49
- if rn_version_gte.call("0.78.0")
50
- swift_flags << '-DRCT_REACT_NATIVE_FACTORY_AVAILABLE'
51
- end
26
+ if is_new_arch_enabled
27
+ s.source_files = "ios/Sources/**/*.{h,m,mm,swift}", "ios/generated/**/*.{h,m,mm,cpp}"
28
+ s.private_header_files = "ios/generated/**/*.h"
29
+ s.exclude_files = "ios/Sources/OldArch/**/*"
30
+ s.dependency "React-RCTAppDelegate"
52
31
 
53
32
  s.pod_target_xcconfig = {
54
- 'OTHER_SWIFT_FLAGS' => swift_flags.join(' ')
33
+ 'OTHER_SWIFT_FLAGS' => '-DRCT_NEW_ARCH_ENABLED',
34
+ 'HEADER_SEARCH_PATHS' => '"$(PODS_TARGET_SRCROOT)/ios/generated"'
55
35
  }
36
+ else
37
+ s.source_files = "ios/Sources/**/*.{h,m,mm,swift}"
38
+ s.exclude_files = "ios/Sources/NewArch/**/*"
56
39
  end
57
40
 
58
- install_modules_dependencies(s)
41
+ if respond_to?(:install_modules_dependencies, true)
42
+ install_modules_dependencies(s)
43
+ else
44
+ s.dependency "React-Core"
45
+ end
59
46
  end
60
-
@@ -0,0 +1,28 @@
1
+ import { TurboModule, TurboModuleRegistry} from 'react-native';
2
+ import type {EventEmitter} from 'react-native/Libraries/Types/CodegenTypes';
3
+
4
+ /**
5
+ * Unified event payload for all Scandit events.
6
+ * Events are filtered by name on the JS side.
7
+ */
8
+ export type ScanditEventPayload = {
9
+ name: string;
10
+ data: string;
11
+ viewId?: number;
12
+ modeId?: number;
13
+ };
14
+
15
+ export interface Spec extends TurboModule {
16
+ // Events - unified event emitter for all Barcode events
17
+ readonly onScanditEvent: EventEmitter<ScanditEventPayload>;
18
+ readonly getConstants: () => {
19
+ // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types
20
+ Defaults: Object;
21
+ };
22
+
23
+ // Single entry point for all Parser operations - use Object so codegen produces NSDictionary on iOS
24
+ // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types
25
+ executeParser(data: Object): Promise<void>;
26
+ }
27
+
28
+ export default TurboModuleRegistry.getEnforcing<Spec>('ScanditDataCaptureParser');
@@ -1,15 +0,0 @@
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 <React/RCTBridgeModule.h>
8
- #import <React/RCTEventEmitter.h>
9
-
10
- @interface RCT_EXTERN_MODULE (ScanditDataCaptureParser, RCTEventEmitter)
11
- RCT_EXTERN_METHOD(executeParser
12
- : (NSDictionary *)data resolve
13
- : (RCTPromiseResolveBlock)resolve reject
14
- : (RCTPromiseRejectBlock)reject)
15
- @end