react-native-nitro-zxing 0.2.0 → 0.3.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/VisionCameraZxing.podspec +25 -1
- package/cpp/ZXingDecoder.cpp +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
require "json"
|
|
2
|
+
require "pathname"
|
|
2
3
|
|
|
3
4
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
5
|
|
|
6
|
+
# NitroModules' public headers include some of its non-public headers by bare name (e.g.
|
|
7
|
+
# ArrayBuffer.hpp includes "BorrowingReference.hpp"). Other pods find those through header maps,
|
|
8
|
+
# which this pod turns off below, so we search NitroModules' sources directly instead.
|
|
9
|
+
nitro_modules_dir = File.dirname(Pod::Executable.execute_command('node', ['-p',
|
|
10
|
+
'require.resolve("react-native-nitro-modules/package.json", {paths: [process.argv[1]]})',
|
|
11
|
+
__dir__]).strip)
|
|
12
|
+
nitro_modules_cpp_dir = Pathname.new(File.join(nitro_modules_dir, "cpp"))
|
|
13
|
+
.relative_path_from(Pod::Config.instance.project_pods_root).to_s
|
|
14
|
+
|
|
5
15
|
Pod::Spec.new do |s|
|
|
6
16
|
s.name = "VisionCameraZxing"
|
|
7
17
|
s.version = package["version"]
|
|
@@ -30,11 +40,25 @@ Pod::Spec.new do |s|
|
|
|
30
40
|
"cpp/zxing-core/core/src/**/*.h",
|
|
31
41
|
]
|
|
32
42
|
s.compiler_flags = "-DZXING_INTERNAL -Wno-comma"
|
|
43
|
+
# Turning header maps off also drops the overlay that maps each framework header back to its
|
|
44
|
+
# source file. Without it, use_frameworks! builds see NitroModules' headers twice (the copy in
|
|
45
|
+
# NitroModules.framework and the source file found via the search path), so add it back.
|
|
46
|
+
product_headers_vfs = '"$(CPP_HEADERMAP_PRODUCT_HEADERS_VFS_FILE)"'
|
|
33
47
|
s.pod_target_xcconfig = {
|
|
34
|
-
"HEADER_SEARCH_PATHS" =>
|
|
48
|
+
"HEADER_SEARCH_PATHS" => [
|
|
49
|
+
'"$(PODS_TARGET_SRCROOT)/cpp/zxing-core/core/src"',
|
|
50
|
+
'"$(PODS_TARGET_SRCROOT)/cpp/zxing-core/wrappers/ios/Sources/Wrapper"',
|
|
51
|
+
# Our own headers, which static builds also find through Pods/Headers/Private
|
|
52
|
+
'"$(PODS_TARGET_SRCROOT)/cpp"',
|
|
53
|
+
'"$(PODS_TARGET_SRCROOT)/nitrogen/generated/shared/c++"',
|
|
54
|
+
"\"$(PODS_ROOT)/#{nitro_modules_cpp_dir}/**\"",
|
|
55
|
+
].join(" "),
|
|
35
56
|
# Header maps resolve by basename across all pods (e.g. React's Point.h or another
|
|
36
57
|
# barcode pod's BarcodeFormat.hpp would shadow ours); use the search paths above instead.
|
|
37
58
|
"USE_HEADERMAP" => "NO",
|
|
59
|
+
"OTHER_CFLAGS" => "$(inherited) -ivfsoverlay #{product_headers_vfs}",
|
|
60
|
+
"OTHER_CPLUSPLUSFLAGS" => "$(inherited) -ivfsoverlay #{product_headers_vfs}",
|
|
61
|
+
"OTHER_SWIFT_FLAGS" => "$(inherited) -Xcc -ivfsoverlay -Xcc #{product_headers_vfs}",
|
|
38
62
|
}
|
|
39
63
|
|
|
40
64
|
load 'nitrogen/generated/ios/VisionCameraZxing+autolinking.rb'
|
package/cpp/ZXingDecoder.cpp
CHANGED
|
@@ -142,7 +142,7 @@ ZXingDecoder::ZXingDecoder(const std::vector<TargetBarcodeFormat>& formats, Mode
|
|
|
142
142
|
_attempts.push_back({makeOptions(zxingFormats, false, false, false), 0, 1});
|
|
143
143
|
// Rotation handling costs several times a plain scan, so look for rotated codes periodically
|
|
144
144
|
// instead of on every frame that finds nothing.
|
|
145
|
-
_attempts.push_back({makeOptions(zxingFormats, false, true, false), 0, kLiveRotationPeriod});
|
|
145
|
+
_attempts.push_back({makeOptions(zxingFormats, false, true, false).setTryInvert(true), 0, kLiveRotationPeriod});
|
|
146
146
|
} else {
|
|
147
147
|
// A still is usually many megapixels: scan a reduced copy first, then the full image, and
|
|
148
148
|
// only then the expensive heuristics that help with blurred or inverted captures.
|