From 301ce91f80144fbbcb9910b1303995032b39d358 Mon Sep 17 00:00:00 2001 From: Nick Vahalik Date: Tue, 11 Jul 2023 22:58:18 -0500 Subject: [PATCH 1/2] Tweak the camera choices for scanning The code which picks the camera will pick the last one which is available. The dual wide camera provides better close-up performance, so let's go with that one as the last one. --- ios/Plugin/Plugin.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ios/Plugin/Plugin.swift b/ios/Plugin/Plugin.swift index acd47a7..d40563c 100644 --- a/ios/Plugin/Plugin.swift +++ b/ios/Plugin/Plugin.swift @@ -190,7 +190,8 @@ public class BarcodeScanner: CAPPlugin, AVCaptureMetadataOutputObjectsDelegate { @available(swift, deprecated: 5.6, message: "New Xcode? Check if `AVCaptureDevice.DeviceType` has new types and add them accordingly.") private func discoverCaptureDevices() -> [AVCaptureDevice] { if #available(iOS 13.0, *) { - return AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInTripleCamera, .builtInDualCamera, .builtInTelephotoCamera, .builtInTrueDepthCamera, .builtInUltraWideCamera, .builtInDualWideCamera, .builtInWideAngleCamera], mediaType: .video, position: .unspecified).devices + // The code which picks the camera will pick the last one which is available. The dual wide camera provides better close-up performance, so let's go with that one. + return AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInUltraWideCamera, .builtInWideAngleCamera, .builtInDualCamera, .builtInDualWideCamera], mediaType: .video, position: .unspecified).devices } else { return AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInDualCamera, .builtInWideAngleCamera, .builtInTelephotoCamera, .builtInTrueDepthCamera], mediaType: .video, position: .unspecified).devices } From b35900beae6ad33c685cf61fa8e1b2fd031952ca Mon Sep 17 00:00:00 2001 From: Nick Vahalik Date: Wed, 12 Jul 2023 09:45:01 -0500 Subject: [PATCH 2/2] Update package.json Added prepare to build the `dist` directory when working locally. --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index f17af72..4418c02 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "build": "npm run clean && tsc && rollup -c rollup.config.js --bundleConfigAsCjs", "clean": "rimraf ./dist", "watch": "tsc --watch", + "prepare": "husky install && npm run build", "prepublishOnly": "npm run build", "verify": "npm run verify:ios && npm run verify:android && npm run verify:web", "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination \"platform=iOS Simulator,name=iPhone 12\" && cd ..",