From 35978d072a69797d2ebb255186c2455bbf086e13 Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Thu, 26 May 2022 10:22:29 +0200 Subject: [PATCH] Improve camera session in sample wallet (#239) --- Example/ExampleApp.xcodeproj/project.pbxproj | 8 ++++---- Example/ExampleApp/Wallet/ScannerViewController.swift | 8 +++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Example/ExampleApp.xcodeproj/project.pbxproj b/Example/ExampleApp.xcodeproj/project.pbxproj index 0748aaa9b..b0c97ea74 100644 --- a/Example/ExampleApp.xcodeproj/project.pbxproj +++ b/Example/ExampleApp.xcodeproj/project.pbxproj @@ -741,7 +741,7 @@ CODE_SIGN_ENTITLEMENTS = Wallet.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 13; DEVELOPMENT_TEAM = W5R8AG9K22; INFOPLIST_FILE = ExampleApp/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 15.0; @@ -766,7 +766,7 @@ CODE_SIGN_ENTITLEMENTS = Wallet.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 13; DEVELOPMENT_TEAM = W5R8AG9K22; INFOPLIST_FILE = ExampleApp/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 15.0; @@ -791,7 +791,7 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 13; DEVELOPMENT_TEAM = W5R8AG9K22; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = DApp/Info.plist; @@ -825,7 +825,7 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 13; DEVELOPMENT_TEAM = W5R8AG9K22; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = DApp/Info.plist; diff --git a/Example/ExampleApp/Wallet/ScannerViewController.swift b/Example/ExampleApp/Wallet/ScannerViewController.swift index 55657b1f3..b962a3708 100644 --- a/Example/ExampleApp/Wallet/ScannerViewController.swift +++ b/Example/ExampleApp/Wallet/ScannerViewController.swift @@ -50,12 +50,14 @@ extension ScannerViewController: AVCaptureMetadataOutputObjectsDelegate { _ output: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from connection: AVCaptureConnection) { - + if let metadata = metadataObjects.first as? AVMetadataMachineReadableCodeObject, metadata.type == .qr, let qrCode = metadata.stringValue { - delegate?.didScan(qrCode) - dismiss(animated: true) + captureSession.stopRunning() + dismiss(animated: true) { [weak self] in + self?.delegate?.didScan(qrCode) + } } } }