From 10413825c432ced72f5ae6a8414af1304b09e184 Mon Sep 17 00:00:00 2001 From: Oleg Petrunko Date: Mon, 27 Apr 2020 17:19:50 +0300 Subject: [PATCH 01/26] DDOS-189 - Need to add QR code recognition in DDCameraViewController pod - added DDQrCodeViewController; - added DDQrViewController; - changed Main.storyboard; - changed DDCameraViewController-umbrella.h --- DDQrCodeViewController.h | 34 +++ DDQrCodeViewController.m | 40 +++ .../project.pbxproj | 6 + .../Base.lproj/Main.storyboard | 229 ++++++++++++++++-- .../DDQrViewController.h | 12 + .../DDQrViewController.m | 77 ++++++ Example/Pods/Pods.xcodeproj/project.pbxproj | 8 + .../DDCameraViewController-umbrella.h | 1 + 8 files changed, 392 insertions(+), 15 deletions(-) create mode 100644 DDQrCodeViewController.h create mode 100644 DDQrCodeViewController.m create mode 100644 Example/DDCameraViewController/DDQrViewController.h create mode 100644 Example/DDCameraViewController/DDQrViewController.m diff --git a/DDQrCodeViewController.h b/DDQrCodeViewController.h new file mode 100644 index 0000000..f48709b --- /dev/null +++ b/DDQrCodeViewController.h @@ -0,0 +1,34 @@ +// +// DDQrCodeViewController.h +// DDCameraViewController +// +// Copyright (c) 2020 dashdevs.com. All rights reserved. +// + +#import +#import "DDCameraViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@protocol DDQrCodeViewControllerDelegate; + +/** + Camera view subclass that allows to capture scanned result from current capture session + */ +@interface DDQrCodeViewController: DDCameraViewController + +/** + Delegate object that will receive events from qr code view controller + */ +@property (weak, nonatomic, nullable) id delegate; + +@end + +@protocol DDQrCodeViewControllerDelegate + +- (void)qrCodeViewController:(DDQrCodeViewController *)controller didTakeScannedResult:(NSString *)string; +- (void)qrCodeViewController:(DDQrCodeViewController *)controller didFailWithError:(NSError *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DDQrCodeViewController.m b/DDQrCodeViewController.m new file mode 100644 index 0000000..adfec29 --- /dev/null +++ b/DDQrCodeViewController.m @@ -0,0 +1,40 @@ +// +// DDQrCodeViewController.m +// DDCameraViewController +// +// Copyright (c) 2020 dashdevs.com. All rights reserved. +// + +#import "DDQrCodeViewController.h" + +@interface DDQrCodeViewController () +@property (strong, nonatomic, readonly, nullable) NSArray *metadataObjectTypes; +@end + +@implementation DDQrCodeViewController + +- (void)initializeCaptureSession { + [super initializeCaptureSession]; + + AVCaptureMetadataOutput *output = [[AVCaptureMetadataOutput alloc] init]; + [self.captureSession addOutput:output]; + [output setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()]; + _metadataObjectTypes = @[AVMetadataObjectTypeQRCode]; + [output setMetadataObjectTypes:_metadataObjectTypes]; +} + +- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection { + for (AVMetadataObject *current in metadataObjects) { + if ([current isKindOfClass:[AVMetadataMachineReadableCodeObject class]] + && [_metadataObjectTypes containsObject:current.type]) { + NSString *scannedResult = [(AVMetadataMachineReadableCodeObject *)current stringValue]; + if ([self.delegate respondsToSelector:@selector(qrCodeViewController:didTakeScannedResult:)]) { + [self.captureSession stopRunning]; + [self.delegate qrCodeViewController:self didTakeScannedResult:scannedResult]; + } + break; + } + } +} + +@end diff --git a/Example/DDCameraViewController.xcodeproj/project.pbxproj b/Example/DDCameraViewController.xcodeproj/project.pbxproj index 7440be6..f15724c 100644 --- a/Example/DDCameraViewController.xcodeproj/project.pbxproj +++ b/Example/DDCameraViewController.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 10D16D5C2456FEAB0049218E /* DDQrViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 10D16D5B2456FEAB0049218E /* DDQrViewController.m */; }; 5DCA21F76EEDC8B7EE91D784 /* Pods_DDCameraViewController_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 128F4D521EEF06DF99397F0A /* Pods_DDCameraViewController_Example.framework */; }; 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; @@ -43,6 +44,8 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 10D16D5A2456FEAB0049218E /* DDQrViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDQrViewController.h; sourceTree = ""; }; + 10D16D5B2456FEAB0049218E /* DDQrViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDQrViewController.m; sourceTree = ""; }; 128F4D521EEF06DF99397F0A /* Pods_DDCameraViewController_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DDCameraViewController_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 1EFDFE4191BDB8C3BEB1AC8C /* TODO.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = TODO.md; path = ../TODO.md; sourceTree = ""; }; 6003F58A195388D20070C39A /* DDCameraViewController_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DDCameraViewController_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -153,6 +156,8 @@ 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */, 6003F5A5195388D20070C39A /* DDViewController.h */, 6003F5A6195388D20070C39A /* DDViewController.m */, + 10D16D5A2456FEAB0049218E /* DDQrViewController.h */, + 10D16D5B2456FEAB0049218E /* DDQrViewController.m */, 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */, 6003F5A8195388D20070C39A /* Images.xcassets */, 6003F594195388D20070C39A /* Supporting Files */, @@ -402,6 +407,7 @@ buildActionMask = 2147483647; files = ( 6003F59E195388D20070C39A /* DDAppDelegate.m in Sources */, + 10D16D5C2456FEAB0049218E /* DDQrViewController.m in Sources */, 6003F5A7195388D20070C39A /* DDViewController.m in Sources */, 6003F59A195388D20070C39A /* main.m in Sources */, ); diff --git a/Example/DDCameraViewController/Base.lproj/Main.storyboard b/Example/DDCameraViewController/Base.lproj/Main.storyboard index e54725d..c6f8307 100644 --- a/Example/DDCameraViewController/Base.lproj/Main.storyboard +++ b/Example/DDCameraViewController/Base.lproj/Main.storyboard @@ -1,15 +1,74 @@ - - - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -28,10 +87,10 @@ - + - + + @@ -111,7 +171,146 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/DDCameraViewController/DDQrViewController.h b/Example/DDCameraViewController/DDQrViewController.h new file mode 100644 index 0000000..dcedb20 --- /dev/null +++ b/Example/DDCameraViewController/DDQrViewController.h @@ -0,0 +1,12 @@ +// +// DDQrViewController.h +// DDCameraViewController_Example +// +// Copyright (c) 2020 dashdevs.com. All rights reserved. +// + +#import "DDQrCodeViewController.h" + +@interface DDQrViewController : DDQrCodeViewController + +@end diff --git a/Example/DDCameraViewController/DDQrViewController.m b/Example/DDCameraViewController/DDQrViewController.m new file mode 100644 index 0000000..307daf3 --- /dev/null +++ b/Example/DDCameraViewController/DDQrViewController.m @@ -0,0 +1,77 @@ +// +// DDQrViewController.m +// DDCameraViewController_Example +// +// Copyright (c) 2020 dashdevs.com. All rights reserved. +// + +#import "DDQrViewController.h" +#import "AVCaptureDevice+DDCaptureDeviceModesSwitch.h" +#import "DDCameraViewController+DDCaptureDeviceInputSwitch.h" + +NS_INLINE NSString* DDDeviceFlashModeHintText(AVCaptureFlashMode mode) { + switch (mode) { + case AVCaptureFlashModeOff: return NSLocalizedString(@"Flash off", nil); + case AVCaptureFlashModeOn: return NSLocalizedString(@"Flash on", nil); + case AVCaptureFlashModeAuto: return NSLocalizedString(@"Flash auto", nil); + default: return NSLocalizedString(@"Flash not found", nil); + } +}; + +NS_INLINE NSString* DDDeviceTorchModeHintText(AVCaptureTorchMode mode) { + switch (mode) { + case AVCaptureTorchModeOff: return NSLocalizedString(@"Torch off", nil); + case AVCaptureTorchModeOn: return NSLocalizedString(@"Torch on", nil); + case AVCaptureTorchModeAuto: return NSLocalizedString(@"Torch auto", nil); + default: return NSLocalizedString(@"Torch not found", nil); + } +}; + +@interface DDQrViewController () +@property (weak, nonatomic) IBOutlet UILabel *flashModeLabel; +@property (weak, nonatomic) IBOutlet UILabel *torchModeLabel; +@end + +@implementation DDQrViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.delegate = self; + [self updateHints]; +} + +- (IBAction)cancelButtonTapped:(UIButton *)sender { + [self dismissViewControllerAnimated:YES completion:NULL]; +} + +- (IBAction)switchCameraButtonTapped:(UIButton*)sender { + [self switchCaptureDeviceInputWithError:nil]; +} + +- (IBAction)switchFlashButtonTapped:(UIButton*)sender { + [self.captureDevice dd_switchFlashMode:nil]; + [self updateHints]; +} + +- (IBAction)switchTorchButtonTapped:(UIButton*)sender { + [self.captureDevice dd_switchTorchMode:nil]; + [self updateHints]; +} + +- (void)updateHints { + self.flashModeLabel.text = DDDeviceFlashModeHintText(self.captureDevice.flashMode); + self.torchModeLabel.text = DDDeviceTorchModeHintText(self.captureDevice.torchMode); +} + +#pragma mark - DDQrCodeViewControllerDelegate + +- (void)qrCodeViewController:(DDQrCodeViewController *)controller didFailWithError:(NSError *)error { + NSLog(@"Failed to take a photo with error: %@", error.localizedDescription); +} + +- (void)qrCodeViewController:(DDQrCodeViewController *)controller didTakeScannedResult:(NSString *)string { + NSLog(@"Your Scann Result %@", string); + [self dismissViewControllerAnimated:YES completion:NULL]; +} + +@end diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index ee2d3fd..f7e23af 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -16,6 +16,8 @@ 073A9660A1A127B92D5E6FF2DF621275 /* OCMLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = D9AC401B51C29F4DF6C8B124C8338D1C /* OCMLocation.h */; settings = {ATTRIBUTES = (Public, ); }; }; 07DDE5733255A1D75CB92E2AF73B51B3 /* OCMExceptionReturnValueProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 70063C02AFD65F93A65F15B93E734FE5 /* OCMExceptionReturnValueProvider.h */; settings = {ATTRIBUTES = (Project, ); }; }; 0E6C4F0AA7B846DD75246693901C938D /* OCMObserverRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 970EDBB999D51175C9DBE916CD9DBBC4 /* OCMObserverRecorder.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + 10D16D582456F3D50049218E /* DDQrCodeViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 10D16D562456F3D50049218E /* DDQrCodeViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 10D16D592456F3D50049218E /* DDQrCodeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 10D16D572456F3D50049218E /* DDQrCodeViewController.m */; }; 14ECEBC338600515A76F40E12C9B82E9 /* AVCaptureDevice+DDCaptureDeviceModesSwitch.h in Headers */ = {isa = PBXBuildFile; fileRef = 42AC94E275E74A61452A339083905430 /* AVCaptureDevice+DDCaptureDeviceModesSwitch.h */; settings = {ATTRIBUTES = (Public, ); }; }; 15E05D1398E023D3D15F30CBA19DF58B /* OCMInvocationMatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = D30AF1F899FD60591E89712D3E3FAD34 /* OCMInvocationMatcher.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 17D66FFBBBADF6B03CF95D1E1B70DC54 /* OCMBoxedReturnValueProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 857F8021D52BB3BF529AFECD3DA2D7F1 /* OCMBoxedReturnValueProvider.h */; settings = {ATTRIBUTES = (Project, ); }; }; @@ -132,6 +134,8 @@ 09BCCA72FED51A01414395CD6EE6B0D4 /* Pods-DDCameraViewController_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-DDCameraViewController_Tests.debug.xcconfig"; sourceTree = ""; }; 0D0DD873228D479C209B4D3844A9FE84 /* OCClassMockObject.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = OCClassMockObject.m; path = Source/OCMock/OCClassMockObject.m; sourceTree = ""; }; 0E3913A0EE93B47F99253EF2F76702BB /* Pods-DDCameraViewController_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-DDCameraViewController_Tests.release.xcconfig"; sourceTree = ""; }; + 10D16D562456F3D50049218E /* DDQrCodeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDQrCodeViewController.h; sourceTree = ""; }; + 10D16D572456F3D50049218E /* DDQrCodeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDQrCodeViewController.m; sourceTree = ""; }; 189E844DF5F02337A748A42FA45BE56C /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 1961671E2800A5C38CC04D0BE8553B9B /* NSNotificationCenter+OCMAdditions.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSNotificationCenter+OCMAdditions.h"; path = "Source/OCMock/NSNotificationCenter+OCMAdditions.h"; sourceTree = ""; }; 1AC588DEF82617F2AAAB67FC05AAEF37 /* Pods-DDCameraViewController_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-DDCameraViewController_Example.release.xcconfig"; sourceTree = ""; }; @@ -482,6 +486,8 @@ 6F3D49933FD39B462CA2C3ADB054CB44 /* DDCameraViewController_Private.h */, 704D6A6FDCBC6FC6A58D48DF6D00A43A /* DDStillImageViewController.h */, FDE09A1CA7841D885426FD79C3118AA9 /* DDStillImageViewController.m */, + 10D16D562456F3D50049218E /* DDQrCodeViewController.h */, + 10D16D572456F3D50049218E /* DDQrCodeViewController.m */, FC36DF0F9AC0619419A467E32FEBCD6B /* DDCameraView */, BB8B0E8F9A2AD0B65F4838CA97FAD320 /* DDCameraViewController */, 8443A3FE3801EE5A2C357BDA7D4AA046 /* Pod */, @@ -557,6 +563,7 @@ 14ECEBC338600515A76F40E12C9B82E9 /* AVCaptureDevice+DDCaptureDeviceModesSwitch.h in Headers */, 6BDA1EB2489555F578B98CB24E9BC0B9 /* AVCaptureDevice+DDCaptureDevicePosition.h in Headers */, 92378DEBFFC9981F081AD31FB5DD1D7B /* DDCameraView.h in Headers */, + 10D16D582456F3D50049218E /* DDQrCodeViewController.h in Headers */, 883161B40DCD936C15BDBE162C792B88 /* DDCameraViewController+DDCaptureDeviceInputSwitch.h in Headers */, DED9A023783CCD5192F9FE4D122D65EE /* DDCameraViewController+DDCaptureStillImageOutput.h in Headers */, E5CBFCED435CB113125FAF3918087603 /* DDCameraViewController-umbrella.h in Headers */, @@ -777,6 +784,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 10D16D592456F3D50049218E /* DDQrCodeViewController.m in Sources */, 299D80B739ACBBEC1A0C36FCB277EE3E /* AVCaptureDevice+DDCaptureDeviceModesSwitch.m in Sources */, 44E48B8FF213A1F7007D23D0BBA52B0B /* AVCaptureDevice+DDCaptureDevicePosition.m in Sources */, 3675233D1ACD4B72363E75C0FBDD7256 /* DDCameraView.m in Sources */, diff --git a/Example/Pods/Target Support Files/DDCameraViewController/DDCameraViewController-umbrella.h b/Example/Pods/Target Support Files/DDCameraViewController/DDCameraViewController-umbrella.h index b0dcedf..08d16c3 100644 --- a/Example/Pods/Target Support Files/DDCameraViewController/DDCameraViewController-umbrella.h +++ b/Example/Pods/Target Support Files/DDCameraViewController/DDCameraViewController-umbrella.h @@ -19,6 +19,7 @@ #import "DDStillImageViewController.h" #import "DDCameraView.h" #import "DDCameraViewController.h" +#import "DDQrCodeViewController.h" FOUNDATION_EXPORT double DDCameraViewControllerVersionNumber; FOUNDATION_EXPORT const unsigned char DDCameraViewControllerVersionString[]; From 2758def95f3653d8fbef01f8d7381fe3ab5dac70 Mon Sep 17 00:00:00 2001 From: Oleg Petrunko Date: Tue, 28 Apr 2020 19:51:29 +0300 Subject: [PATCH 02/26] DDOS-189 - Need to add QR code recognition in DDCameraViewController pod - changed DDQrCodeViewController --- DDQrCodeViewController.h | 6 ++---- DDQrCodeViewController.m | 10 +++------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/DDQrCodeViewController.h b/DDQrCodeViewController.h index f48709b..5685cef 100644 --- a/DDQrCodeViewController.h +++ b/DDQrCodeViewController.h @@ -5,7 +5,6 @@ // Copyright (c) 2020 dashdevs.com. All rights reserved. // -#import #import "DDCameraViewController.h" NS_ASSUME_NONNULL_BEGIN @@ -13,9 +12,9 @@ NS_ASSUME_NONNULL_BEGIN @protocol DDQrCodeViewControllerDelegate; /** - Camera view subclass that allows to capture scanned result from current capture session + Camera view subclass that allows to scanned QR code */ -@interface DDQrCodeViewController: DDCameraViewController +@interface DDQrCodeViewController: DDCameraViewController /** Delegate object that will receive events from qr code view controller @@ -27,7 +26,6 @@ NS_ASSUME_NONNULL_BEGIN @protocol DDQrCodeViewControllerDelegate - (void)qrCodeViewController:(DDQrCodeViewController *)controller didTakeScannedResult:(NSString *)string; -- (void)qrCodeViewController:(DDQrCodeViewController *)controller didFailWithError:(NSError *)error; @end diff --git a/DDQrCodeViewController.m b/DDQrCodeViewController.m index adfec29..76c29a9 100644 --- a/DDQrCodeViewController.m +++ b/DDQrCodeViewController.m @@ -7,10 +7,6 @@ #import "DDQrCodeViewController.h" -@interface DDQrCodeViewController () -@property (strong, nonatomic, readonly, nullable) NSArray *metadataObjectTypes; -@end - @implementation DDQrCodeViewController - (void)initializeCaptureSession { @@ -19,16 +15,16 @@ - (void)initializeCaptureSession { AVCaptureMetadataOutput *output = [[AVCaptureMetadataOutput alloc] init]; [self.captureSession addOutput:output]; [output setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()]; - _metadataObjectTypes = @[AVMetadataObjectTypeQRCode]; - [output setMetadataObjectTypes:_metadataObjectTypes]; + [output setMetadataObjectTypes:@[AVMetadataObjectTypeQRCode]]; } - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection { for (AVMetadataObject *current in metadataObjects) { if ([current isKindOfClass:[AVMetadataMachineReadableCodeObject class]] - && [_metadataObjectTypes containsObject:current.type]) { + && [@[AVMetadataObjectTypeQRCode] containsObject:current.type]) { NSString *scannedResult = [(AVMetadataMachineReadableCodeObject *)current stringValue]; if ([self.delegate respondsToSelector:@selector(qrCodeViewController:didTakeScannedResult:)]) { + //TODO: - it is necessary to add scannedResult parsing and pass the model [self.captureSession stopRunning]; [self.delegate qrCodeViewController:self didTakeScannedResult:scannedResult]; } From 918e9546a9d2f88bb03e63c8731aa5af63cb3172 Mon Sep 17 00:00:00 2001 From: Oleg Petrunko Date: Thu, 30 Apr 2020 17:27:51 +0300 Subject: [PATCH 03/26] DDOS-189 - Need to add QR code recognition in DDCameraViewController pod - changed DDQrCodeViewController; - added DDQrCodeScannerViewController; - changed DDQrViewController; - changed Main.storyboard --- DDQrCodeViewController.m | 5 +++- .../project.pbxproj | 6 ++++ .../Base.lproj/Main.storyboard | 10 +++---- .../DDQrCodeScannerViewController.h | 16 ++++++++++ .../DDQrCodeScannerViewController.m | 30 +++++++++++++++++++ .../DDQrViewController.h | 10 +++++++ .../DDQrViewController.m | 9 ++---- 7 files changed, 74 insertions(+), 12 deletions(-) create mode 100644 Example/DDCameraViewController/DDQrCodeScannerViewController.h create mode 100644 Example/DDCameraViewController/DDQrCodeScannerViewController.m diff --git a/DDQrCodeViewController.m b/DDQrCodeViewController.m index 76c29a9..3b35961 100644 --- a/DDQrCodeViewController.m +++ b/DDQrCodeViewController.m @@ -15,7 +15,10 @@ - (void)initializeCaptureSession { AVCaptureMetadataOutput *output = [[AVCaptureMetadataOutput alloc] init]; [self.captureSession addOutput:output]; [output setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()]; - [output setMetadataObjectTypes:@[AVMetadataObjectTypeQRCode]]; + NSMutableSet *available = [NSMutableSet setWithArray:[output availableMetadataObjectTypes]]; + NSSet *set = [NSSet setWithArray:@[AVMetadataObjectTypeQRCode]]; + [available intersectSet:set]; + [output setMetadataObjectTypes:available.allObjects]; } - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection { diff --git a/Example/DDCameraViewController.xcodeproj/project.pbxproj b/Example/DDCameraViewController.xcodeproj/project.pbxproj index f15724c..4ff016e 100644 --- a/Example/DDCameraViewController.xcodeproj/project.pbxproj +++ b/Example/DDCameraViewController.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 1063A273245AE694007EB6F3 /* DDQrCodeScannerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1063A272245AE694007EB6F3 /* DDQrCodeScannerViewController.m */; }; 10D16D5C2456FEAB0049218E /* DDQrViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 10D16D5B2456FEAB0049218E /* DDQrViewController.m */; }; 5DCA21F76EEDC8B7EE91D784 /* Pods_DDCameraViewController_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 128F4D521EEF06DF99397F0A /* Pods_DDCameraViewController_Example.framework */; }; 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; @@ -44,6 +45,8 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 1063A271245AE694007EB6F3 /* DDQrCodeScannerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDQrCodeScannerViewController.h; sourceTree = ""; }; + 1063A272245AE694007EB6F3 /* DDQrCodeScannerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDQrCodeScannerViewController.m; sourceTree = ""; }; 10D16D5A2456FEAB0049218E /* DDQrViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDQrViewController.h; sourceTree = ""; }; 10D16D5B2456FEAB0049218E /* DDQrViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDQrViewController.m; sourceTree = ""; }; 128F4D521EEF06DF99397F0A /* Pods_DDCameraViewController_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DDCameraViewController_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -156,6 +159,8 @@ 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */, 6003F5A5195388D20070C39A /* DDViewController.h */, 6003F5A6195388D20070C39A /* DDViewController.m */, + 1063A271245AE694007EB6F3 /* DDQrCodeScannerViewController.h */, + 1063A272245AE694007EB6F3 /* DDQrCodeScannerViewController.m */, 10D16D5A2456FEAB0049218E /* DDQrViewController.h */, 10D16D5B2456FEAB0049218E /* DDQrViewController.m */, 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */, @@ -409,6 +414,7 @@ 6003F59E195388D20070C39A /* DDAppDelegate.m in Sources */, 10D16D5C2456FEAB0049218E /* DDQrViewController.m in Sources */, 6003F5A7195388D20070C39A /* DDViewController.m in Sources */, + 1063A273245AE694007EB6F3 /* DDQrCodeScannerViewController.m in Sources */, 6003F59A195388D20070C39A /* main.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Example/DDCameraViewController/Base.lproj/Main.storyboard b/Example/DDCameraViewController/Base.lproj/Main.storyboard index c6f8307..5140995 100644 --- a/Example/DDCameraViewController/Base.lproj/Main.storyboard +++ b/Example/DDCameraViewController/Base.lproj/Main.storyboard @@ -176,7 +176,7 @@ - + @@ -188,18 +188,18 @@ - + @@ -207,7 +207,7 @@ - + diff --git a/Example/DDCameraViewController/DDQrCodeScannerViewController.h b/Example/DDCameraViewController/DDQrCodeScannerViewController.h new file mode 100644 index 0000000..246eb99 --- /dev/null +++ b/Example/DDCameraViewController/DDQrCodeScannerViewController.h @@ -0,0 +1,16 @@ +// +// DDQrCodeScannerViewController.h +// DDCameraViewController_Example +// +// Copyright (c) 2020 dashdevs.com. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface DDQrCodeScannerViewController : UIViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/Example/DDCameraViewController/DDQrCodeScannerViewController.m b/Example/DDCameraViewController/DDQrCodeScannerViewController.m new file mode 100644 index 0000000..bb72c5a --- /dev/null +++ b/Example/DDCameraViewController/DDQrCodeScannerViewController.m @@ -0,0 +1,30 @@ +// +// DDQrCodeScannerViewController.m +// DDCameraViewController_Example +// +// Copyright (c) 2020 dashdevs.com. All rights reserved. +// + +#import "DDQrCodeScannerViewController.h" +#import "DDQrViewController.h" + +@interface DDQrCodeScannerViewController () +@end + +@implementation DDQrCodeScannerViewController + +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + if ([segue.identifier isEqualToString:@"showDDQrViewController"]) { + DDQrViewController *viewController = [segue destinationViewController]; + viewController.qrDelegate = self; + } +} + +- (void)ddQrViewController:(DDQrViewController *)controller didTakeScannedResult:(NSString *)string { + UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"Scan Result" message:string preferredStyle:UIAlertControllerStyleAlert]; + UIAlertAction* okButton = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:nil]; + [alert addAction:okButton]; + [self presentViewController:alert animated:YES completion:nil]; +} + +@end diff --git a/Example/DDCameraViewController/DDQrViewController.h b/Example/DDCameraViewController/DDQrViewController.h index dcedb20..898dadb 100644 --- a/Example/DDCameraViewController/DDQrViewController.h +++ b/Example/DDCameraViewController/DDQrViewController.h @@ -7,6 +7,16 @@ #import "DDQrCodeViewController.h" +@protocol DDQrViewControllerDelegate; + @interface DDQrViewController : DDQrCodeViewController +@property (weak, nonatomic) id qrDelegate; + +@end + +@protocol DDQrViewControllerDelegate + +- (void)ddQrViewController:(DDQrViewController *)controller didTakeScannedResult:(NSString *)string; + @end diff --git a/Example/DDCameraViewController/DDQrViewController.m b/Example/DDCameraViewController/DDQrViewController.m index 307daf3..38f6d24 100644 --- a/Example/DDCameraViewController/DDQrViewController.m +++ b/Example/DDCameraViewController/DDQrViewController.m @@ -65,13 +65,10 @@ - (void)updateHints { #pragma mark - DDQrCodeViewControllerDelegate -- (void)qrCodeViewController:(DDQrCodeViewController *)controller didFailWithError:(NSError *)error { - NSLog(@"Failed to take a photo with error: %@", error.localizedDescription); -} - - (void)qrCodeViewController:(DDQrCodeViewController *)controller didTakeScannedResult:(NSString *)string { - NSLog(@"Your Scann Result %@", string); - [self dismissViewControllerAnimated:YES completion:NULL]; + [self dismissViewControllerAnimated:YES completion:^{ + [self.qrDelegate ddQrViewController:self didTakeScannedResult:string]; + }]; } @end From bc2836fd13b7c760028f241da455a120df6a8269 Mon Sep 17 00:00:00 2001 From: Oleg Petrunko Date: Thu, 30 Apr 2020 17:42:34 +0300 Subject: [PATCH 04/26] DDOS-189 - Need to add QR code recognition in DDCameraViewController pod - changed DDQrViewController --- Example/DDCameraViewController/DDQrViewController.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Example/DDCameraViewController/DDQrViewController.m b/Example/DDCameraViewController/DDQrViewController.m index 38f6d24..d8ba417 100644 --- a/Example/DDCameraViewController/DDQrViewController.m +++ b/Example/DDCameraViewController/DDQrViewController.m @@ -67,7 +67,10 @@ - (void)updateHints { - (void)qrCodeViewController:(DDQrCodeViewController *)controller didTakeScannedResult:(NSString *)string { [self dismissViewControllerAnimated:YES completion:^{ - [self.qrDelegate ddQrViewController:self didTakeScannedResult:string]; + if ([self.qrDelegate respondsToSelector:@selector(ddQrViewController:didTakeScannedResult:)]) { + //TODO: - in the future the Scanned Result model will be transmitted + [self.qrDelegate ddQrViewController:self didTakeScannedResult:string]; + } }]; } From 26c58497c509458596fb6fe0f108d5620043bfb9 Mon Sep 17 00:00:00 2001 From: Oleg Petrunko Date: Thu, 30 Apr 2020 18:09:27 +0300 Subject: [PATCH 05/26] DDOS-189 - Need to add QR code recognition in DDCameraViewController pod - deleted duplicates DDCameraViewController-umbrella.h --- .../DDCameraViewController/DDCameraViewController-umbrella.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/Example/Pods/Target Support Files/DDCameraViewController/DDCameraViewController-umbrella.h b/Example/Pods/Target Support Files/DDCameraViewController/DDCameraViewController-umbrella.h index 08d16c3..00da015 100644 --- a/Example/Pods/Target Support Files/DDCameraViewController/DDCameraViewController-umbrella.h +++ b/Example/Pods/Target Support Files/DDCameraViewController/DDCameraViewController-umbrella.h @@ -17,8 +17,6 @@ #import "DDCameraViewController+DDCaptureStillImageOutput.h" #import "DDCameraViewController.h" #import "DDStillImageViewController.h" -#import "DDCameraView.h" -#import "DDCameraViewController.h" #import "DDQrCodeViewController.h" FOUNDATION_EXPORT double DDCameraViewControllerVersionNumber; From 379d9f7af5ace87f88103150404f265149ece21a Mon Sep 17 00:00:00 2001 From: Oleg Petrunko Date: Mon, 4 May 2020 11:18:14 +0300 Subject: [PATCH 06/26] DDOS-189 - Need to add QR code recognition in DDCameraViewController pod - rename DDQr -> DDQR; - changed Main.storyboard; --- DDQRCodeViewController.h | 32 +++++++++++++++++++ ...ewController.m => DDQRCodeViewController.m | 13 +++++--- DDQrCodeViewController.h | 32 ------------------- .../project.pbxproj | 24 +++++++------- .../Base.lproj/Main.storyboard | 6 ++-- ...ller.h => DDQRCodeScannerViewController.h} | 4 +-- ...ller.m => DDQRCodeScannerViewController.m} | 16 +++++----- .../DDQRViewController.h | 22 +++++++++++++ ...rViewController.m => DDQRViewController.m} | 16 +++++----- .../DDQrViewController.h | 22 ------------- Example/Pods/Pods.xcodeproj/project.pbxproj | 16 +++++----- .../DDCameraViewController-umbrella.h | 2 +- 12 files changed, 104 insertions(+), 101 deletions(-) create mode 100644 DDQRCodeViewController.h rename DDQrCodeViewController.m => DDQRCodeViewController.m (76%) delete mode 100644 DDQrCodeViewController.h rename Example/DDCameraViewController/{DDQrCodeScannerViewController.h => DDQRCodeScannerViewController.h} (65%) rename Example/DDCameraViewController/{DDQrCodeScannerViewController.m => DDQRCodeScannerViewController.m} (62%) create mode 100644 Example/DDCameraViewController/DDQRViewController.h rename Example/DDCameraViewController/{DDQrViewController.m => DDQRViewController.m} (85%) delete mode 100644 Example/DDCameraViewController/DDQrViewController.h diff --git a/DDQRCodeViewController.h b/DDQRCodeViewController.h new file mode 100644 index 0000000..fb66a27 --- /dev/null +++ b/DDQRCodeViewController.h @@ -0,0 +1,32 @@ +// +// DDQRCodeViewController.h +// DDCameraViewController +// +// Copyright (c) 2020 dashdevs.com. All rights reserved. +// + +#import "DDCameraViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@protocol DDQRCodeViewControllerDelegate; + +/** + Camera view subclass that allows to scanned QR code + */ +@interface DDQRCodeViewController: DDCameraViewController + +/** + Delegate object that will receive events from qr code view controller + */ +@property (weak, nonatomic, nullable) id delegate; + +@end + +@protocol DDQRCodeViewControllerDelegate + +- (void)ddQRCodeViewController:(DDQRCodeViewController *)controller didTakeScannedResult:(NSString *)string; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DDQrCodeViewController.m b/DDQRCodeViewController.m similarity index 76% rename from DDQrCodeViewController.m rename to DDQRCodeViewController.m index 3b35961..9e9f32a 100644 --- a/DDQrCodeViewController.m +++ b/DDQRCodeViewController.m @@ -1,13 +1,16 @@ // -// DDQrCodeViewController.m +// DDQRCodeViewController.m // DDCameraViewController // // Copyright (c) 2020 dashdevs.com. All rights reserved. // -#import "DDQrCodeViewController.h" +#import "DDQRCodeViewController.h" -@implementation DDQrCodeViewController +@interface DDQRCodeViewController () +@end + +@implementation DDQRCodeViewController - (void)initializeCaptureSession { [super initializeCaptureSession]; @@ -26,10 +29,10 @@ - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects: if ([current isKindOfClass:[AVMetadataMachineReadableCodeObject class]] && [@[AVMetadataObjectTypeQRCode] containsObject:current.type]) { NSString *scannedResult = [(AVMetadataMachineReadableCodeObject *)current stringValue]; - if ([self.delegate respondsToSelector:@selector(qrCodeViewController:didTakeScannedResult:)]) { + if ([self.delegate respondsToSelector:@selector(ddQRCodeViewController:didTakeScannedResult:)]) { //TODO: - it is necessary to add scannedResult parsing and pass the model [self.captureSession stopRunning]; - [self.delegate qrCodeViewController:self didTakeScannedResult:scannedResult]; + [self.delegate ddQRCodeViewController:self didTakeScannedResult:scannedResult]; } break; } diff --git a/DDQrCodeViewController.h b/DDQrCodeViewController.h deleted file mode 100644 index 5685cef..0000000 --- a/DDQrCodeViewController.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// DDQrCodeViewController.h -// DDCameraViewController -// -// Copyright (c) 2020 dashdevs.com. All rights reserved. -// - -#import "DDCameraViewController.h" - -NS_ASSUME_NONNULL_BEGIN - -@protocol DDQrCodeViewControllerDelegate; - -/** - Camera view subclass that allows to scanned QR code - */ -@interface DDQrCodeViewController: DDCameraViewController - -/** - Delegate object that will receive events from qr code view controller - */ -@property (weak, nonatomic, nullable) id delegate; - -@end - -@protocol DDQrCodeViewControllerDelegate - -- (void)qrCodeViewController:(DDQrCodeViewController *)controller didTakeScannedResult:(NSString *)string; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/DDCameraViewController.xcodeproj/project.pbxproj b/Example/DDCameraViewController.xcodeproj/project.pbxproj index 4ff016e..d155d13 100644 --- a/Example/DDCameraViewController.xcodeproj/project.pbxproj +++ b/Example/DDCameraViewController.xcodeproj/project.pbxproj @@ -7,8 +7,8 @@ objects = { /* Begin PBXBuildFile section */ - 1063A273245AE694007EB6F3 /* DDQrCodeScannerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1063A272245AE694007EB6F3 /* DDQrCodeScannerViewController.m */; }; - 10D16D5C2456FEAB0049218E /* DDQrViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 10D16D5B2456FEAB0049218E /* DDQrViewController.m */; }; + 1063A273245AE694007EB6F3 /* DDQRCodeScannerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1063A272245AE694007EB6F3 /* DDQRCodeScannerViewController.m */; }; + 10D16D5C2456FEAB0049218E /* DDQRViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 10D16D5B2456FEAB0049218E /* DDQRViewController.m */; }; 5DCA21F76EEDC8B7EE91D784 /* Pods_DDCameraViewController_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 128F4D521EEF06DF99397F0A /* Pods_DDCameraViewController_Example.framework */; }; 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; @@ -45,10 +45,10 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 1063A271245AE694007EB6F3 /* DDQrCodeScannerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDQrCodeScannerViewController.h; sourceTree = ""; }; - 1063A272245AE694007EB6F3 /* DDQrCodeScannerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDQrCodeScannerViewController.m; sourceTree = ""; }; - 10D16D5A2456FEAB0049218E /* DDQrViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDQrViewController.h; sourceTree = ""; }; - 10D16D5B2456FEAB0049218E /* DDQrViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDQrViewController.m; sourceTree = ""; }; + 1063A271245AE694007EB6F3 /* DDQRCodeScannerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDQRCodeScannerViewController.h; sourceTree = ""; }; + 1063A272245AE694007EB6F3 /* DDQRCodeScannerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDQRCodeScannerViewController.m; sourceTree = ""; }; + 10D16D5A2456FEAB0049218E /* DDQRViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDQRViewController.h; sourceTree = ""; }; + 10D16D5B2456FEAB0049218E /* DDQRViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDQRViewController.m; sourceTree = ""; }; 128F4D521EEF06DF99397F0A /* Pods_DDCameraViewController_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DDCameraViewController_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 1EFDFE4191BDB8C3BEB1AC8C /* TODO.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = TODO.md; path = ../TODO.md; sourceTree = ""; }; 6003F58A195388D20070C39A /* DDCameraViewController_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DDCameraViewController_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -159,10 +159,10 @@ 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */, 6003F5A5195388D20070C39A /* DDViewController.h */, 6003F5A6195388D20070C39A /* DDViewController.m */, - 1063A271245AE694007EB6F3 /* DDQrCodeScannerViewController.h */, - 1063A272245AE694007EB6F3 /* DDQrCodeScannerViewController.m */, - 10D16D5A2456FEAB0049218E /* DDQrViewController.h */, - 10D16D5B2456FEAB0049218E /* DDQrViewController.m */, + 1063A271245AE694007EB6F3 /* DDQRCodeScannerViewController.h */, + 1063A272245AE694007EB6F3 /* DDQRCodeScannerViewController.m */, + 10D16D5A2456FEAB0049218E /* DDQRViewController.h */, + 10D16D5B2456FEAB0049218E /* DDQRViewController.m */, 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */, 6003F5A8195388D20070C39A /* Images.xcassets */, 6003F594195388D20070C39A /* Supporting Files */, @@ -412,9 +412,9 @@ buildActionMask = 2147483647; files = ( 6003F59E195388D20070C39A /* DDAppDelegate.m in Sources */, - 10D16D5C2456FEAB0049218E /* DDQrViewController.m in Sources */, + 10D16D5C2456FEAB0049218E /* DDQRViewController.m in Sources */, 6003F5A7195388D20070C39A /* DDViewController.m in Sources */, - 1063A273245AE694007EB6F3 /* DDQrCodeScannerViewController.m in Sources */, + 1063A273245AE694007EB6F3 /* DDQRCodeScannerViewController.m in Sources */, 6003F59A195388D20070C39A /* main.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Example/DDCameraViewController/Base.lproj/Main.storyboard b/Example/DDCameraViewController/Base.lproj/Main.storyboard index 5140995..7e5effb 100644 --- a/Example/DDCameraViewController/Base.lproj/Main.storyboard +++ b/Example/DDCameraViewController/Base.lproj/Main.storyboard @@ -176,7 +176,7 @@ - + @@ -193,7 +193,7 @@ - + @@ -212,7 +212,7 @@ - + diff --git a/Example/DDCameraViewController/DDQrCodeScannerViewController.h b/Example/DDCameraViewController/DDQRCodeScannerViewController.h similarity index 65% rename from Example/DDCameraViewController/DDQrCodeScannerViewController.h rename to Example/DDCameraViewController/DDQRCodeScannerViewController.h index 246eb99..285ba87 100644 --- a/Example/DDCameraViewController/DDQrCodeScannerViewController.h +++ b/Example/DDCameraViewController/DDQRCodeScannerViewController.h @@ -1,5 +1,5 @@ // -// DDQrCodeScannerViewController.h +// DDQRCodeScannerViewController.h // DDCameraViewController_Example // // Copyright (c) 2020 dashdevs.com. All rights reserved. @@ -9,7 +9,7 @@ NS_ASSUME_NONNULL_BEGIN -@interface DDQrCodeScannerViewController : UIViewController +@interface DDQRCodeScannerViewController : UIViewController @end diff --git a/Example/DDCameraViewController/DDQrCodeScannerViewController.m b/Example/DDCameraViewController/DDQRCodeScannerViewController.m similarity index 62% rename from Example/DDCameraViewController/DDQrCodeScannerViewController.m rename to Example/DDCameraViewController/DDQRCodeScannerViewController.m index bb72c5a..de58d14 100644 --- a/Example/DDCameraViewController/DDQrCodeScannerViewController.m +++ b/Example/DDCameraViewController/DDQRCodeScannerViewController.m @@ -1,26 +1,26 @@ // -// DDQrCodeScannerViewController.m +// DDQRCodeScannerViewController.m // DDCameraViewController_Example // // Copyright (c) 2020 dashdevs.com. All rights reserved. // -#import "DDQrCodeScannerViewController.h" -#import "DDQrViewController.h" +#import "DDQRCodeScannerViewController.h" +#import "DDQRViewController.h" -@interface DDQrCodeScannerViewController () +@interface DDQRCodeScannerViewController () @end -@implementation DDQrCodeScannerViewController +@implementation DDQRCodeScannerViewController - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - if ([segue.identifier isEqualToString:@"showDDQrViewController"]) { - DDQrViewController *viewController = [segue destinationViewController]; + if ([segue.identifier isEqualToString:@"showDDQRViewController"]) { + DDQRViewController *viewController = [segue destinationViewController]; viewController.qrDelegate = self; } } -- (void)ddQrViewController:(DDQrViewController *)controller didTakeScannedResult:(NSString *)string { +- (void)ddQRViewController:(DDQRViewController *)controller didTakeScannedResult:(NSString *)string { UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"Scan Result" message:string preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction* okButton = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:nil]; [alert addAction:okButton]; diff --git a/Example/DDCameraViewController/DDQRViewController.h b/Example/DDCameraViewController/DDQRViewController.h new file mode 100644 index 0000000..685ab24 --- /dev/null +++ b/Example/DDCameraViewController/DDQRViewController.h @@ -0,0 +1,22 @@ +// +// DDQRViewController.h +// DDCameraViewController_Example +// +// Copyright (c) 2020 dashdevs.com. All rights reserved. +// + +#import "DDQRCodeViewController.h" + +@protocol DDQRViewControllerDelegate; + +@interface DDQRViewController : DDQRCodeViewController + +@property (weak, nonatomic) id qrDelegate; + +@end + +@protocol DDQRViewControllerDelegate + +- (void)ddQRViewController:(DDQRViewController *)controller didTakeScannedResult:(NSString *)string; + +@end diff --git a/Example/DDCameraViewController/DDQrViewController.m b/Example/DDCameraViewController/DDQRViewController.m similarity index 85% rename from Example/DDCameraViewController/DDQrViewController.m rename to Example/DDCameraViewController/DDQRViewController.m index d8ba417..4dcb6f7 100644 --- a/Example/DDCameraViewController/DDQrViewController.m +++ b/Example/DDCameraViewController/DDQRViewController.m @@ -1,11 +1,11 @@ // -// DDQrViewController.m +// DDQRViewController.m // DDCameraViewController_Example // // Copyright (c) 2020 dashdevs.com. All rights reserved. // -#import "DDQrViewController.h" +#import "DDQRViewController.h" #import "AVCaptureDevice+DDCaptureDeviceModesSwitch.h" #import "DDCameraViewController+DDCaptureDeviceInputSwitch.h" @@ -27,12 +27,12 @@ } }; -@interface DDQrViewController () +@interface DDQRViewController () @property (weak, nonatomic) IBOutlet UILabel *flashModeLabel; @property (weak, nonatomic) IBOutlet UILabel *torchModeLabel; @end -@implementation DDQrViewController +@implementation DDQRViewController - (void)viewDidLoad { [super viewDidLoad]; @@ -63,13 +63,13 @@ - (void)updateHints { self.torchModeLabel.text = DDDeviceTorchModeHintText(self.captureDevice.torchMode); } -#pragma mark - DDQrCodeViewControllerDelegate +#pragma mark - DDQRCodeViewControllerDelegate -- (void)qrCodeViewController:(DDQrCodeViewController *)controller didTakeScannedResult:(NSString *)string { +- (void)qrCodeViewController:(DDQRCodeViewController *)controller didTakeScannedResult:(NSString *)string { [self dismissViewControllerAnimated:YES completion:^{ - if ([self.qrDelegate respondsToSelector:@selector(ddQrViewController:didTakeScannedResult:)]) { + if ([self.qrDelegate respondsToSelector:@selector(ddQRViewController:didTakeScannedResult:)]) { //TODO: - in the future the Scanned Result model will be transmitted - [self.qrDelegate ddQrViewController:self didTakeScannedResult:string]; + [self.qrDelegate ddQRViewController:self didTakeScannedResult:string]; } }]; } diff --git a/Example/DDCameraViewController/DDQrViewController.h b/Example/DDCameraViewController/DDQrViewController.h deleted file mode 100644 index 898dadb..0000000 --- a/Example/DDCameraViewController/DDQrViewController.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// DDQrViewController.h -// DDCameraViewController_Example -// -// Copyright (c) 2020 dashdevs.com. All rights reserved. -// - -#import "DDQrCodeViewController.h" - -@protocol DDQrViewControllerDelegate; - -@interface DDQrViewController : DDQrCodeViewController - -@property (weak, nonatomic) id qrDelegate; - -@end - -@protocol DDQrViewControllerDelegate - -- (void)ddQrViewController:(DDQrViewController *)controller didTakeScannedResult:(NSString *)string; - -@end diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index f7e23af..a4013c4 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -16,8 +16,8 @@ 073A9660A1A127B92D5E6FF2DF621275 /* OCMLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = D9AC401B51C29F4DF6C8B124C8338D1C /* OCMLocation.h */; settings = {ATTRIBUTES = (Public, ); }; }; 07DDE5733255A1D75CB92E2AF73B51B3 /* OCMExceptionReturnValueProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 70063C02AFD65F93A65F15B93E734FE5 /* OCMExceptionReturnValueProvider.h */; settings = {ATTRIBUTES = (Project, ); }; }; 0E6C4F0AA7B846DD75246693901C938D /* OCMObserverRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 970EDBB999D51175C9DBE916CD9DBBC4 /* OCMObserverRecorder.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - 10D16D582456F3D50049218E /* DDQrCodeViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 10D16D562456F3D50049218E /* DDQrCodeViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 10D16D592456F3D50049218E /* DDQrCodeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 10D16D572456F3D50049218E /* DDQrCodeViewController.m */; }; + 10D16D582456F3D50049218E /* DDQRCodeViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 10D16D562456F3D50049218E /* DDQRCodeViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 10D16D592456F3D50049218E /* DDQRCodeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 10D16D572456F3D50049218E /* DDQRCodeViewController.m */; }; 14ECEBC338600515A76F40E12C9B82E9 /* AVCaptureDevice+DDCaptureDeviceModesSwitch.h in Headers */ = {isa = PBXBuildFile; fileRef = 42AC94E275E74A61452A339083905430 /* AVCaptureDevice+DDCaptureDeviceModesSwitch.h */; settings = {ATTRIBUTES = (Public, ); }; }; 15E05D1398E023D3D15F30CBA19DF58B /* OCMInvocationMatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = D30AF1F899FD60591E89712D3E3FAD34 /* OCMInvocationMatcher.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 17D66FFBBBADF6B03CF95D1E1B70DC54 /* OCMBoxedReturnValueProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 857F8021D52BB3BF529AFECD3DA2D7F1 /* OCMBoxedReturnValueProvider.h */; settings = {ATTRIBUTES = (Project, ); }; }; @@ -134,8 +134,8 @@ 09BCCA72FED51A01414395CD6EE6B0D4 /* Pods-DDCameraViewController_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-DDCameraViewController_Tests.debug.xcconfig"; sourceTree = ""; }; 0D0DD873228D479C209B4D3844A9FE84 /* OCClassMockObject.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = OCClassMockObject.m; path = Source/OCMock/OCClassMockObject.m; sourceTree = ""; }; 0E3913A0EE93B47F99253EF2F76702BB /* Pods-DDCameraViewController_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-DDCameraViewController_Tests.release.xcconfig"; sourceTree = ""; }; - 10D16D562456F3D50049218E /* DDQrCodeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDQrCodeViewController.h; sourceTree = ""; }; - 10D16D572456F3D50049218E /* DDQrCodeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDQrCodeViewController.m; sourceTree = ""; }; + 10D16D562456F3D50049218E /* DDQRCodeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDQRCodeViewController.h; sourceTree = ""; }; + 10D16D572456F3D50049218E /* DDQRCodeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDQRCodeViewController.m; sourceTree = ""; }; 189E844DF5F02337A748A42FA45BE56C /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 1961671E2800A5C38CC04D0BE8553B9B /* NSNotificationCenter+OCMAdditions.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSNotificationCenter+OCMAdditions.h"; path = "Source/OCMock/NSNotificationCenter+OCMAdditions.h"; sourceTree = ""; }; 1AC588DEF82617F2AAAB67FC05AAEF37 /* Pods-DDCameraViewController_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-DDCameraViewController_Example.release.xcconfig"; sourceTree = ""; }; @@ -486,8 +486,8 @@ 6F3D49933FD39B462CA2C3ADB054CB44 /* DDCameraViewController_Private.h */, 704D6A6FDCBC6FC6A58D48DF6D00A43A /* DDStillImageViewController.h */, FDE09A1CA7841D885426FD79C3118AA9 /* DDStillImageViewController.m */, - 10D16D562456F3D50049218E /* DDQrCodeViewController.h */, - 10D16D572456F3D50049218E /* DDQrCodeViewController.m */, + 10D16D562456F3D50049218E /* DDQRCodeViewController.h */, + 10D16D572456F3D50049218E /* DDQRCodeViewController.m */, FC36DF0F9AC0619419A467E32FEBCD6B /* DDCameraView */, BB8B0E8F9A2AD0B65F4838CA97FAD320 /* DDCameraViewController */, 8443A3FE3801EE5A2C357BDA7D4AA046 /* Pod */, @@ -563,7 +563,7 @@ 14ECEBC338600515A76F40E12C9B82E9 /* AVCaptureDevice+DDCaptureDeviceModesSwitch.h in Headers */, 6BDA1EB2489555F578B98CB24E9BC0B9 /* AVCaptureDevice+DDCaptureDevicePosition.h in Headers */, 92378DEBFFC9981F081AD31FB5DD1D7B /* DDCameraView.h in Headers */, - 10D16D582456F3D50049218E /* DDQrCodeViewController.h in Headers */, + 10D16D582456F3D50049218E /* DDQRCodeViewController.h in Headers */, 883161B40DCD936C15BDBE162C792B88 /* DDCameraViewController+DDCaptureDeviceInputSwitch.h in Headers */, DED9A023783CCD5192F9FE4D122D65EE /* DDCameraViewController+DDCaptureStillImageOutput.h in Headers */, E5CBFCED435CB113125FAF3918087603 /* DDCameraViewController-umbrella.h in Headers */, @@ -784,7 +784,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 10D16D592456F3D50049218E /* DDQrCodeViewController.m in Sources */, + 10D16D592456F3D50049218E /* DDQRCodeViewController.m in Sources */, 299D80B739ACBBEC1A0C36FCB277EE3E /* AVCaptureDevice+DDCaptureDeviceModesSwitch.m in Sources */, 44E48B8FF213A1F7007D23D0BBA52B0B /* AVCaptureDevice+DDCaptureDevicePosition.m in Sources */, 3675233D1ACD4B72363E75C0FBDD7256 /* DDCameraView.m in Sources */, diff --git a/Example/Pods/Target Support Files/DDCameraViewController/DDCameraViewController-umbrella.h b/Example/Pods/Target Support Files/DDCameraViewController/DDCameraViewController-umbrella.h index 00da015..f510b02 100644 --- a/Example/Pods/Target Support Files/DDCameraViewController/DDCameraViewController-umbrella.h +++ b/Example/Pods/Target Support Files/DDCameraViewController/DDCameraViewController-umbrella.h @@ -17,7 +17,7 @@ #import "DDCameraViewController+DDCaptureStillImageOutput.h" #import "DDCameraViewController.h" #import "DDStillImageViewController.h" -#import "DDQrCodeViewController.h" +#import "DDQRCodeViewController.h" FOUNDATION_EXPORT double DDCameraViewControllerVersionNumber; FOUNDATION_EXPORT const unsigned char DDCameraViewControllerVersionString[]; From 8f272141b78506b9701ac728a6f32c4474e77aa8 Mon Sep 17 00:00:00 2001 From: Oleg Petrunko Date: Mon, 4 May 2020 11:38:09 +0300 Subject: [PATCH 07/26] DDOS-189 - Need to add QR code recognition in DDCameraViewController pod - changed DDQRViewController --- Example/DDCameraViewController/DDQRViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Example/DDCameraViewController/DDQRViewController.m b/Example/DDCameraViewController/DDQRViewController.m index 4dcb6f7..12e48db 100644 --- a/Example/DDCameraViewController/DDQRViewController.m +++ b/Example/DDCameraViewController/DDQRViewController.m @@ -65,7 +65,7 @@ - (void)updateHints { #pragma mark - DDQRCodeViewControllerDelegate -- (void)qrCodeViewController:(DDQRCodeViewController *)controller didTakeScannedResult:(NSString *)string { +- (void)ddQRCodeViewController:(DDQRCodeViewController *)controller didTakeScannedResult:(NSString *)string { [self dismissViewControllerAnimated:YES completion:^{ if ([self.qrDelegate respondsToSelector:@selector(ddQRViewController:didTakeScannedResult:)]) { //TODO: - in the future the Scanned Result model will be transmitted From 58a73f4ccbd6762eb705fdaaf1155342c088d0f1 Mon Sep 17 00:00:00 2001 From: Oleg Petrunko Date: Mon, 4 May 2020 12:44:51 +0300 Subject: [PATCH 08/26] DDOS-189 - Need to add QR code recognition in DDCameraViewController pod - in progress --- DDQRCodeViewController.h | 2 +- DDQRCodeViewController.m | 2 +- .../project.pbxproj | 2 ++ .../DDCameraViewController/DDCameraHints.h | 24 +++++++++++++++++++ .../DDQRCodeScannerViewController.m | 2 +- .../DDQRViewController.h | 4 ++-- .../DDQRViewController.m | 21 ++-------------- .../DDCameraViewController/DDViewController.m | 19 +-------------- 8 files changed, 34 insertions(+), 42 deletions(-) create mode 100644 Example/DDCameraViewController/DDCameraHints.h diff --git a/DDQRCodeViewController.h b/DDQRCodeViewController.h index fb66a27..2f7fa35 100644 --- a/DDQRCodeViewController.h +++ b/DDQRCodeViewController.h @@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN @protocol DDQRCodeViewControllerDelegate -- (void)ddQRCodeViewController:(DDQRCodeViewController *)controller didTakeScannedResult:(NSString *)string; +- (void)ddQRCodeViewController:(DDQRCodeViewController * _Nullable)controller didTakeScannedResult:(NSString * _Nullable)string; @end diff --git a/DDQRCodeViewController.m b/DDQRCodeViewController.m index 9e9f32a..b60269a 100644 --- a/DDQRCodeViewController.m +++ b/DDQRCodeViewController.m @@ -7,7 +7,7 @@ #import "DDQRCodeViewController.h" -@interface DDQRCodeViewController () +@interface DDQRCodeViewController () @end @implementation DDQRCodeViewController diff --git a/Example/DDCameraViewController.xcodeproj/project.pbxproj b/Example/DDCameraViewController.xcodeproj/project.pbxproj index d155d13..f222351 100644 --- a/Example/DDCameraViewController.xcodeproj/project.pbxproj +++ b/Example/DDCameraViewController.xcodeproj/project.pbxproj @@ -47,6 +47,7 @@ /* Begin PBXFileReference section */ 1063A271245AE694007EB6F3 /* DDQRCodeScannerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDQRCodeScannerViewController.h; sourceTree = ""; }; 1063A272245AE694007EB6F3 /* DDQRCodeScannerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDQRCodeScannerViewController.m; sourceTree = ""; }; + 107F67562460100500EF7EDC /* DDCameraHints.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDCameraHints.h; sourceTree = ""; }; 10D16D5A2456FEAB0049218E /* DDQRViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDQRViewController.h; sourceTree = ""; }; 10D16D5B2456FEAB0049218E /* DDQRViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDQRViewController.m; sourceTree = ""; }; 128F4D521EEF06DF99397F0A /* Pods_DDCameraViewController_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DDCameraViewController_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -157,6 +158,7 @@ 6003F59C195388D20070C39A /* DDAppDelegate.h */, 6003F59D195388D20070C39A /* DDAppDelegate.m */, 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */, + 107F67562460100500EF7EDC /* DDCameraHints.h */, 6003F5A5195388D20070C39A /* DDViewController.h */, 6003F5A6195388D20070C39A /* DDViewController.m */, 1063A271245AE694007EB6F3 /* DDQRCodeScannerViewController.h */, diff --git a/Example/DDCameraViewController/DDCameraHints.h b/Example/DDCameraViewController/DDCameraHints.h new file mode 100644 index 0000000..74187c8 --- /dev/null +++ b/Example/DDCameraViewController/DDCameraHints.h @@ -0,0 +1,24 @@ +// +// DDCameraHints.h +// DDCameraViewController +// +// Copyright (c) 2019 dashdevs.com. All rights reserved. +// + +NS_INLINE NSString* DDDeviceFlashModeHintText(AVCaptureFlashMode mode) { + switch (mode) { + case AVCaptureFlashModeOff: return NSLocalizedString(@"Flash off", nil); + case AVCaptureFlashModeOn: return NSLocalizedString(@"Flash on", nil); + case AVCaptureFlashModeAuto: return NSLocalizedString(@"Flash auto", nil); + default: return NSLocalizedString(@"Flash not found", nil); + } +}; + +NS_INLINE NSString* DDDeviceTorchModeHintText(AVCaptureTorchMode mode) { + switch (mode) { + case AVCaptureTorchModeOff: return NSLocalizedString(@"Torch off", nil); + case AVCaptureTorchModeOn: return NSLocalizedString(@"Torch on", nil); + case AVCaptureTorchModeAuto: return NSLocalizedString(@"Torch auto", nil); + default: return NSLocalizedString(@"Torch not found", nil); + } +}; diff --git a/Example/DDCameraViewController/DDQRCodeScannerViewController.m b/Example/DDCameraViewController/DDQRCodeScannerViewController.m index de58d14..4677246 100644 --- a/Example/DDCameraViewController/DDQRCodeScannerViewController.m +++ b/Example/DDCameraViewController/DDQRCodeScannerViewController.m @@ -20,7 +20,7 @@ - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { } } -- (void)ddQRViewController:(DDQRViewController *)controller didTakeScannedResult:(NSString *)string { +- (void)ddQRViewController:(DDQRViewController *)controller didTakeScannedResult:(NSString * _Nullable)string { UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"Scan Result" message:string preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction* okButton = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:nil]; [alert addAction:okButton]; diff --git a/Example/DDCameraViewController/DDQRViewController.h b/Example/DDCameraViewController/DDQRViewController.h index 685ab24..ae1e97d 100644 --- a/Example/DDCameraViewController/DDQRViewController.h +++ b/Example/DDCameraViewController/DDQRViewController.h @@ -11,12 +11,12 @@ @interface DDQRViewController : DDQRCodeViewController -@property (weak, nonatomic) id qrDelegate; +@property (weak, nonatomic, nullable) id qrDelegate; @end @protocol DDQRViewControllerDelegate -- (void)ddQRViewController:(DDQRViewController *)controller didTakeScannedResult:(NSString *)string; +- (void)ddQRViewController:(DDQRViewController * _Nullable)controller didTakeScannedResult:(NSString * _Nullable)string; @end diff --git a/Example/DDCameraViewController/DDQRViewController.m b/Example/DDCameraViewController/DDQRViewController.m index 12e48db..8b9a3e1 100644 --- a/Example/DDCameraViewController/DDQRViewController.m +++ b/Example/DDCameraViewController/DDQRViewController.m @@ -8,24 +8,7 @@ #import "DDQRViewController.h" #import "AVCaptureDevice+DDCaptureDeviceModesSwitch.h" #import "DDCameraViewController+DDCaptureDeviceInputSwitch.h" - -NS_INLINE NSString* DDDeviceFlashModeHintText(AVCaptureFlashMode mode) { - switch (mode) { - case AVCaptureFlashModeOff: return NSLocalizedString(@"Flash off", nil); - case AVCaptureFlashModeOn: return NSLocalizedString(@"Flash on", nil); - case AVCaptureFlashModeAuto: return NSLocalizedString(@"Flash auto", nil); - default: return NSLocalizedString(@"Flash not found", nil); - } -}; - -NS_INLINE NSString* DDDeviceTorchModeHintText(AVCaptureTorchMode mode) { - switch (mode) { - case AVCaptureTorchModeOff: return NSLocalizedString(@"Torch off", nil); - case AVCaptureTorchModeOn: return NSLocalizedString(@"Torch on", nil); - case AVCaptureTorchModeAuto: return NSLocalizedString(@"Torch auto", nil); - default: return NSLocalizedString(@"Torch not found", nil); - } -}; +#import "DDCameraHints.h" @interface DDQRViewController () @property (weak, nonatomic) IBOutlet UILabel *flashModeLabel; @@ -65,7 +48,7 @@ - (void)updateHints { #pragma mark - DDQRCodeViewControllerDelegate -- (void)ddQRCodeViewController:(DDQRCodeViewController *)controller didTakeScannedResult:(NSString *)string { +- (void)ddQRCodeViewController:(DDQRCodeViewController * _Nullable)controller didTakeScannedResult:(NSString * _Nullable)string { [self dismissViewControllerAnimated:YES completion:^{ if ([self.qrDelegate respondsToSelector:@selector(ddQRViewController:didTakeScannedResult:)]) { //TODO: - in the future the Scanned Result model will be transmitted diff --git a/Example/DDCameraViewController/DDViewController.m b/Example/DDCameraViewController/DDViewController.m index 025ec6f..bcd04f0 100644 --- a/Example/DDCameraViewController/DDViewController.m +++ b/Example/DDCameraViewController/DDViewController.m @@ -8,24 +8,7 @@ #import "DDViewController.h" #import "AVCaptureDevice+DDCaptureDeviceModesSwitch.h" #import "DDCameraViewController+DDCaptureDeviceInputSwitch.h" - -NS_INLINE NSString* DDDeviceFlashModeHintText(AVCaptureFlashMode mode) { - switch (mode) { - case AVCaptureFlashModeOff: return NSLocalizedString(@"Flash off", nil); - case AVCaptureFlashModeOn: return NSLocalizedString(@"Flash on", nil); - case AVCaptureFlashModeAuto: return NSLocalizedString(@"Flash auto", nil); - default: return NSLocalizedString(@"Flash not found", nil); - } -}; - -NS_INLINE NSString* DDDeviceTorchModeHintText(AVCaptureTorchMode mode) { - switch (mode) { - case AVCaptureTorchModeOff: return NSLocalizedString(@"Torch off", nil); - case AVCaptureTorchModeOn: return NSLocalizedString(@"Torch on", nil); - case AVCaptureTorchModeAuto: return NSLocalizedString(@"Torch auto", nil); - default: return NSLocalizedString(@"Torch not found", nil); - } -}; +#import "DDCameraHints.h" @interface DDViewController () @property (weak, nonatomic) IBOutlet UIImageView *imageView; From de9e97a0ecf0d9c9096d144f552bacd5bfd2331d Mon Sep 17 00:00:00 2001 From: Oleg Petrunko Date: Mon, 4 May 2020 13:29:35 +0300 Subject: [PATCH 09/26] DDOS-202 - created DDNbuPaymentDetailsModel model for the algorithm NBU - in progress --- DDQRCodeViewController.h | 2 +- Example/DDCameraViewController/DDQRViewController.h | 6 +++++- Example/DDCameraViewController/DDQRViewController.m | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/DDQRCodeViewController.h b/DDQRCodeViewController.h index 2f7fa35..a25e30e 100644 --- a/DDQRCodeViewController.h +++ b/DDQRCodeViewController.h @@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN @protocol DDQRCodeViewControllerDelegate -- (void)ddQRCodeViewController:(DDQRCodeViewController * _Nullable)controller didTakeScannedResult:(NSString * _Nullable)string; +- (void)ddQRCodeViewController:(DDQRCodeViewController *)controller didTakeScannedResult:(NSString * _Nullable)string; @end diff --git a/Example/DDCameraViewController/DDQRViewController.h b/Example/DDCameraViewController/DDQRViewController.h index ae1e97d..136a83c 100644 --- a/Example/DDCameraViewController/DDQRViewController.h +++ b/Example/DDCameraViewController/DDQRViewController.h @@ -7,6 +7,8 @@ #import "DDQRCodeViewController.h" +NS_ASSUME_NONNULL_BEGIN + @protocol DDQRViewControllerDelegate; @interface DDQRViewController : DDQRCodeViewController @@ -17,6 +19,8 @@ @protocol DDQRViewControllerDelegate -- (void)ddQRViewController:(DDQRViewController * _Nullable)controller didTakeScannedResult:(NSString * _Nullable)string; +- (void)ddQRViewController:(DDQRViewController *)controller didTakeScannedResult:(NSString * _Nullable)string; @end + +NS_ASSUME_NONNULL_END diff --git a/Example/DDCameraViewController/DDQRViewController.m b/Example/DDCameraViewController/DDQRViewController.m index 8b9a3e1..d978831 100644 --- a/Example/DDCameraViewController/DDQRViewController.m +++ b/Example/DDCameraViewController/DDQRViewController.m @@ -48,7 +48,7 @@ - (void)updateHints { #pragma mark - DDQRCodeViewControllerDelegate -- (void)ddQRCodeViewController:(DDQRCodeViewController * _Nullable)controller didTakeScannedResult:(NSString * _Nullable)string { +- (void)ddQRCodeViewController:(DDQRCodeViewController *)controller didTakeScannedResult:(NSString * _Nullable)string { [self dismissViewControllerAnimated:YES completion:^{ if ([self.qrDelegate respondsToSelector:@selector(ddQRViewController:didTakeScannedResult:)]) { //TODO: - in the future the Scanned Result model will be transmitted From 83f03912588ee5cd9030826dc0bc8976b5962973 Mon Sep 17 00:00:00 2001 From: Oleg Petrunko Date: Mon, 4 May 2020 17:30:18 +0300 Subject: [PATCH 10/26] DDOS-189 - Need to add QR code recognition in DDCameraViewController pod - in progress --- .../Classes/DDCameraViewController.m | 9 ----- .../Classes/DDCameraViewController_Private.h | 9 +++++ DDQRCodeViewController.h | 2 ++ DDQRCodeViewController.m | 33 ++++++++++++------- .../DDQRViewController.m | 11 ++++++- 5 files changed, 43 insertions(+), 21 deletions(-) diff --git a/DDCameraViewController/Classes/DDCameraViewController.m b/DDCameraViewController/Classes/DDCameraViewController.m index 244648c..f19665e 100644 --- a/DDCameraViewController/Classes/DDCameraViewController.m +++ b/DDCameraViewController/Classes/DDCameraViewController.m @@ -8,15 +8,6 @@ #import "DDCameraViewController.h" #import "DDCameraViewController_Private.h" -static dispatch_queue_t dd_capture_session_queue() { - static dispatch_queue_t capture_session_queue; - static dispatch_once_t onceToken = 0; - dispatch_once(&onceToken, ^{ - capture_session_queue = dispatch_queue_create("com.dashdevs.capture.session", DISPATCH_QUEUE_SERIAL); - }); - return capture_session_queue; -} - NSString *const DDCameraViewControllerErrorDomain = @"DDCameraViewControllerErrorDomain"; @implementation DDCameraViewController diff --git a/DDCameraViewController/Classes/DDCameraViewController_Private.h b/DDCameraViewController/Classes/DDCameraViewController_Private.h index af8a5d5..931b9a1 100644 --- a/DDCameraViewController/Classes/DDCameraViewController_Private.h +++ b/DDCameraViewController/Classes/DDCameraViewController_Private.h @@ -7,6 +7,15 @@ #import "DDCameraViewController.h" +static dispatch_queue_t dd_capture_session_queue() { + static dispatch_queue_t capture_session_queue; + static dispatch_once_t onceToken = 0; + dispatch_once(&onceToken, ^{ + capture_session_queue = dispatch_queue_create("com.dashdevs.capture.session", DISPATCH_QUEUE_SERIAL); + }); + return capture_session_queue; +} + NS_ASSUME_NONNULL_BEGIN @interface DDCameraViewController () diff --git a/DDQRCodeViewController.h b/DDQRCodeViewController.h index a25e30e..8a28d30 100644 --- a/DDQRCodeViewController.h +++ b/DDQRCodeViewController.h @@ -21,6 +21,8 @@ NS_ASSUME_NONNULL_BEGIN */ @property (weak, nonatomic, nullable) id delegate; +- (void)setMetadataObjectTypes:(NSArray * _Nullable)types; + @end @protocol DDQRCodeViewControllerDelegate diff --git a/DDQRCodeViewController.m b/DDQRCodeViewController.m index b60269a..9fcee46 100644 --- a/DDQRCodeViewController.m +++ b/DDQRCodeViewController.m @@ -6,33 +6,44 @@ // #import "DDQRCodeViewController.h" +#import "DDCameraViewController_Private.h" @interface DDQRCodeViewController () +@property (strong, nonatomic, nullable) NSString *scannedResult; +@property (strong, nonatomic, nullable) NSArray *metadataObjectTypes; +@property (strong, nonatomic, nullable) AVCaptureMetadataOutput *output; @end @implementation DDQRCodeViewController - (void)initializeCaptureSession { [super initializeCaptureSession]; - - AVCaptureMetadataOutput *output = [[AVCaptureMetadataOutput alloc] init]; - [self.captureSession addOutput:output]; - [output setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()]; - NSMutableSet *available = [NSMutableSet setWithArray:[output availableMetadataObjectTypes]]; - NSSet *set = [NSSet setWithArray:@[AVMetadataObjectTypeQRCode]]; + _output = [[AVCaptureMetadataOutput alloc] init]; + [self.captureSession addOutput:_output]; + [_output setMetadataObjectsDelegate:self queue:dd_capture_session_queue()]; + [self setMetadataObjectTypes:nil]; +} + +- (void)setMetadataObjectTypes:(NSArray * _Nullable)types { + _metadataObjectTypes = types; + NSSet *set = [NSSet setWithArray:_metadataObjectTypes]; + NSMutableSet *available = [NSMutableSet setWithArray:[_output availableMetadataObjectTypes]]; [available intersectSet:set]; - [output setMetadataObjectTypes:available.allObjects]; + [_output setMetadataObjectTypes:available.allObjects]; } - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection { for (AVMetadataObject *current in metadataObjects) { if ([current isKindOfClass:[AVMetadataMachineReadableCodeObject class]] - && [@[AVMetadataObjectTypeQRCode] containsObject:current.type]) { + && [_metadataObjectTypes containsObject:current.type]) { NSString *scannedResult = [(AVMetadataMachineReadableCodeObject *)current stringValue]; if ([self.delegate respondsToSelector:@selector(ddQRCodeViewController:didTakeScannedResult:)]) { - //TODO: - it is necessary to add scannedResult parsing and pass the model - [self.captureSession stopRunning]; - [self.delegate ddQRCodeViewController:self didTakeScannedResult:scannedResult]; + if (![scannedResult isEqualToString:_scannedResult]) { + _scannedResult = scannedResult; + dispatch_async(dispatch_get_main_queue(), ^(void){ + [self.delegate ddQRCodeViewController:self didTakeScannedResult:scannedResult]; + }); + } } break; } diff --git a/Example/DDCameraViewController/DDQRViewController.m b/Example/DDCameraViewController/DDQRViewController.m index d978831..0492090 100644 --- a/Example/DDCameraViewController/DDQRViewController.m +++ b/Example/DDCameraViewController/DDQRViewController.m @@ -23,6 +23,10 @@ - (void)viewDidLoad { [self updateHints]; } +- (void)setMetadataObjectTypes:(NSArray *)types { + [super setMetadataObjectTypes:@[AVMetadataObjectTypeQRCode]]; +} + - (IBAction)cancelButtonTapped:(UIButton *)sender { [self dismissViewControllerAnimated:YES completion:NULL]; } @@ -51,7 +55,12 @@ - (void)updateHints { - (void)ddQRCodeViewController:(DDQRCodeViewController *)controller didTakeScannedResult:(NSString * _Nullable)string { [self dismissViewControllerAnimated:YES completion:^{ if ([self.qrDelegate respondsToSelector:@selector(ddQRViewController:didTakeScannedResult:)]) { - //TODO: - in the future the Scanned Result model will be transmitted + /* + Depending on your task you can call stopRunning + Or dont call stopRunning and dont leave the screen + Each scan result is unique + */ + [self.captureSession stopRunning]; [self.qrDelegate ddQRViewController:self didTakeScannedResult:string]; } }]; From bcc9ebaa6849d610f879cc2f40ff1160bb20cc8e Mon Sep 17 00:00:00 2001 From: Oleg Petrunko Date: Mon, 4 May 2020 17:49:22 +0300 Subject: [PATCH 11/26] DDOS-189 - Need to add QR code recognition in DDCameraViewController pod - renamed QR -> Scanner --- DDQRCodeViewController.h | 34 ------------------- DDScannerViewController.h | 34 +++++++++++++++++++ ...wController.m => DDScannerViewController.m | 12 +++---- .../DDQRViewController.h | 4 +-- .../DDQRViewController.m | 8 ++--- Example/Pods/Pods.xcodeproj/project.pbxproj | 16 ++++----- .../DDCameraViewController-umbrella.h | 2 +- 7 files changed, 55 insertions(+), 55 deletions(-) delete mode 100644 DDQRCodeViewController.h create mode 100644 DDScannerViewController.h rename DDQRCodeViewController.m => DDScannerViewController.m (81%) diff --git a/DDQRCodeViewController.h b/DDQRCodeViewController.h deleted file mode 100644 index 8a28d30..0000000 --- a/DDQRCodeViewController.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// DDQRCodeViewController.h -// DDCameraViewController -// -// Copyright (c) 2020 dashdevs.com. All rights reserved. -// - -#import "DDCameraViewController.h" - -NS_ASSUME_NONNULL_BEGIN - -@protocol DDQRCodeViewControllerDelegate; - -/** - Camera view subclass that allows to scanned QR code - */ -@interface DDQRCodeViewController: DDCameraViewController - -/** - Delegate object that will receive events from qr code view controller - */ -@property (weak, nonatomic, nullable) id delegate; - -- (void)setMetadataObjectTypes:(NSArray * _Nullable)types; - -@end - -@protocol DDQRCodeViewControllerDelegate - -- (void)ddQRCodeViewController:(DDQRCodeViewController *)controller didTakeScannedResult:(NSString * _Nullable)string; - -@end - -NS_ASSUME_NONNULL_END diff --git a/DDScannerViewController.h b/DDScannerViewController.h new file mode 100644 index 0000000..ba6e3f5 --- /dev/null +++ b/DDScannerViewController.h @@ -0,0 +1,34 @@ +// +// DDScannerViewController.h +// DDCameraViewController +// +// Copyright (c) 2020 dashdevs.com. All rights reserved. +// + +#import "DDCameraViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@protocol DDScannerViewControllerDelegate; + +/** + Camera view subclass that allows to scanned + */ +@interface DDScannerViewController: DDCameraViewController + +/** + Delegate object that will receive events from code view controller + */ +@property (weak, nonatomic, nullable) id delegate; + +- (void)setMetadataObjectTypes:(NSArray * _Nullable)types; + +@end + +@protocol DDScannerViewControllerDelegate + +- (void)ddScannerViewController:(DDScannerViewController *)controller didTakeScannedResult:(NSString * _Nullable)resultAsString; + +@end + +NS_ASSUME_NONNULL_END diff --git a/DDQRCodeViewController.m b/DDScannerViewController.m similarity index 81% rename from DDQRCodeViewController.m rename to DDScannerViewController.m index 9fcee46..97059a5 100644 --- a/DDQRCodeViewController.m +++ b/DDScannerViewController.m @@ -1,20 +1,20 @@ // -// DDQRCodeViewController.m +// DDScannerViewController.m // DDCameraViewController // // Copyright (c) 2020 dashdevs.com. All rights reserved. // -#import "DDQRCodeViewController.h" +#import "DDScannerViewController.h" #import "DDCameraViewController_Private.h" -@interface DDQRCodeViewController () +@interface DDScannerViewController () @property (strong, nonatomic, nullable) NSString *scannedResult; @property (strong, nonatomic, nullable) NSArray *metadataObjectTypes; @property (strong, nonatomic, nullable) AVCaptureMetadataOutput *output; @end -@implementation DDQRCodeViewController +@implementation DDScannerViewController - (void)initializeCaptureSession { [super initializeCaptureSession]; @@ -37,11 +37,11 @@ - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects: if ([current isKindOfClass:[AVMetadataMachineReadableCodeObject class]] && [_metadataObjectTypes containsObject:current.type]) { NSString *scannedResult = [(AVMetadataMachineReadableCodeObject *)current stringValue]; - if ([self.delegate respondsToSelector:@selector(ddQRCodeViewController:didTakeScannedResult:)]) { + if ([self.delegate respondsToSelector:@selector(ddScannerViewController:didTakeScannedResult:)]) { if (![scannedResult isEqualToString:_scannedResult]) { _scannedResult = scannedResult; dispatch_async(dispatch_get_main_queue(), ^(void){ - [self.delegate ddQRCodeViewController:self didTakeScannedResult:scannedResult]; + [self.delegate ddScannerViewController:self didTakeScannedResult:scannedResult]; }); } } diff --git a/Example/DDCameraViewController/DDQRViewController.h b/Example/DDCameraViewController/DDQRViewController.h index 136a83c..55be38e 100644 --- a/Example/DDCameraViewController/DDQRViewController.h +++ b/Example/DDCameraViewController/DDQRViewController.h @@ -5,13 +5,13 @@ // Copyright (c) 2020 dashdevs.com. All rights reserved. // -#import "DDQRCodeViewController.h" +#import "DDScannerViewController.h" NS_ASSUME_NONNULL_BEGIN @protocol DDQRViewControllerDelegate; -@interface DDQRViewController : DDQRCodeViewController +@interface DDQRViewController : DDScannerViewController @property (weak, nonatomic, nullable) id qrDelegate; diff --git a/Example/DDCameraViewController/DDQRViewController.m b/Example/DDCameraViewController/DDQRViewController.m index 0492090..2902952 100644 --- a/Example/DDCameraViewController/DDQRViewController.m +++ b/Example/DDCameraViewController/DDQRViewController.m @@ -10,7 +10,7 @@ #import "DDCameraViewController+DDCaptureDeviceInputSwitch.h" #import "DDCameraHints.h" -@interface DDQRViewController () +@interface DDQRViewController () @property (weak, nonatomic) IBOutlet UILabel *flashModeLabel; @property (weak, nonatomic) IBOutlet UILabel *torchModeLabel; @end @@ -50,9 +50,9 @@ - (void)updateHints { self.torchModeLabel.text = DDDeviceTorchModeHintText(self.captureDevice.torchMode); } -#pragma mark - DDQRCodeViewControllerDelegate +#pragma mark - DDCodeScannerViewControllerDelegate -- (void)ddQRCodeViewController:(DDQRCodeViewController *)controller didTakeScannedResult:(NSString * _Nullable)string { +- (void)ddScannerViewController:(DDScannerViewController *)controller didTakeScannedResult:(NSString * _Nullable)resultAsString { [self dismissViewControllerAnimated:YES completion:^{ if ([self.qrDelegate respondsToSelector:@selector(ddQRViewController:didTakeScannedResult:)]) { /* @@ -61,7 +61,7 @@ - (void)ddQRCodeViewController:(DDQRCodeViewController *)controller didTakeScann Each scan result is unique */ [self.captureSession stopRunning]; - [self.qrDelegate ddQRViewController:self didTakeScannedResult:string]; + [self.qrDelegate ddQRViewController:self didTakeScannedResult:resultAsString]; } }]; } diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index a4013c4..c3e65f6 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -16,8 +16,8 @@ 073A9660A1A127B92D5E6FF2DF621275 /* OCMLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = D9AC401B51C29F4DF6C8B124C8338D1C /* OCMLocation.h */; settings = {ATTRIBUTES = (Public, ); }; }; 07DDE5733255A1D75CB92E2AF73B51B3 /* OCMExceptionReturnValueProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 70063C02AFD65F93A65F15B93E734FE5 /* OCMExceptionReturnValueProvider.h */; settings = {ATTRIBUTES = (Project, ); }; }; 0E6C4F0AA7B846DD75246693901C938D /* OCMObserverRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 970EDBB999D51175C9DBE916CD9DBBC4 /* OCMObserverRecorder.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - 10D16D582456F3D50049218E /* DDQRCodeViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 10D16D562456F3D50049218E /* DDQRCodeViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 10D16D592456F3D50049218E /* DDQRCodeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 10D16D572456F3D50049218E /* DDQRCodeViewController.m */; }; + 10D16D582456F3D50049218E /* DDScannerViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 10D16D562456F3D50049218E /* DDScannerViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 10D16D592456F3D50049218E /* DDScannerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 10D16D572456F3D50049218E /* DDScannerViewController.m */; }; 14ECEBC338600515A76F40E12C9B82E9 /* AVCaptureDevice+DDCaptureDeviceModesSwitch.h in Headers */ = {isa = PBXBuildFile; fileRef = 42AC94E275E74A61452A339083905430 /* AVCaptureDevice+DDCaptureDeviceModesSwitch.h */; settings = {ATTRIBUTES = (Public, ); }; }; 15E05D1398E023D3D15F30CBA19DF58B /* OCMInvocationMatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = D30AF1F899FD60591E89712D3E3FAD34 /* OCMInvocationMatcher.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 17D66FFBBBADF6B03CF95D1E1B70DC54 /* OCMBoxedReturnValueProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 857F8021D52BB3BF529AFECD3DA2D7F1 /* OCMBoxedReturnValueProvider.h */; settings = {ATTRIBUTES = (Project, ); }; }; @@ -134,8 +134,8 @@ 09BCCA72FED51A01414395CD6EE6B0D4 /* Pods-DDCameraViewController_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-DDCameraViewController_Tests.debug.xcconfig"; sourceTree = ""; }; 0D0DD873228D479C209B4D3844A9FE84 /* OCClassMockObject.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = OCClassMockObject.m; path = Source/OCMock/OCClassMockObject.m; sourceTree = ""; }; 0E3913A0EE93B47F99253EF2F76702BB /* Pods-DDCameraViewController_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-DDCameraViewController_Tests.release.xcconfig"; sourceTree = ""; }; - 10D16D562456F3D50049218E /* DDQRCodeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDQRCodeViewController.h; sourceTree = ""; }; - 10D16D572456F3D50049218E /* DDQRCodeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDQRCodeViewController.m; sourceTree = ""; }; + 10D16D562456F3D50049218E /* DDScannerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDScannerViewController.h; sourceTree = ""; }; + 10D16D572456F3D50049218E /* DDScannerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDScannerViewController.m; sourceTree = ""; }; 189E844DF5F02337A748A42FA45BE56C /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 1961671E2800A5C38CC04D0BE8553B9B /* NSNotificationCenter+OCMAdditions.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSNotificationCenter+OCMAdditions.h"; path = "Source/OCMock/NSNotificationCenter+OCMAdditions.h"; sourceTree = ""; }; 1AC588DEF82617F2AAAB67FC05AAEF37 /* Pods-DDCameraViewController_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-DDCameraViewController_Example.release.xcconfig"; sourceTree = ""; }; @@ -486,8 +486,8 @@ 6F3D49933FD39B462CA2C3ADB054CB44 /* DDCameraViewController_Private.h */, 704D6A6FDCBC6FC6A58D48DF6D00A43A /* DDStillImageViewController.h */, FDE09A1CA7841D885426FD79C3118AA9 /* DDStillImageViewController.m */, - 10D16D562456F3D50049218E /* DDQRCodeViewController.h */, - 10D16D572456F3D50049218E /* DDQRCodeViewController.m */, + 10D16D562456F3D50049218E /* DDScannerViewController.h */, + 10D16D572456F3D50049218E /* DDScannerViewController.m */, FC36DF0F9AC0619419A467E32FEBCD6B /* DDCameraView */, BB8B0E8F9A2AD0B65F4838CA97FAD320 /* DDCameraViewController */, 8443A3FE3801EE5A2C357BDA7D4AA046 /* Pod */, @@ -563,7 +563,7 @@ 14ECEBC338600515A76F40E12C9B82E9 /* AVCaptureDevice+DDCaptureDeviceModesSwitch.h in Headers */, 6BDA1EB2489555F578B98CB24E9BC0B9 /* AVCaptureDevice+DDCaptureDevicePosition.h in Headers */, 92378DEBFFC9981F081AD31FB5DD1D7B /* DDCameraView.h in Headers */, - 10D16D582456F3D50049218E /* DDQRCodeViewController.h in Headers */, + 10D16D582456F3D50049218E /* DDScannerViewController.h in Headers */, 883161B40DCD936C15BDBE162C792B88 /* DDCameraViewController+DDCaptureDeviceInputSwitch.h in Headers */, DED9A023783CCD5192F9FE4D122D65EE /* DDCameraViewController+DDCaptureStillImageOutput.h in Headers */, E5CBFCED435CB113125FAF3918087603 /* DDCameraViewController-umbrella.h in Headers */, @@ -784,7 +784,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 10D16D592456F3D50049218E /* DDQRCodeViewController.m in Sources */, + 10D16D592456F3D50049218E /* DDScannerViewController.m in Sources */, 299D80B739ACBBEC1A0C36FCB277EE3E /* AVCaptureDevice+DDCaptureDeviceModesSwitch.m in Sources */, 44E48B8FF213A1F7007D23D0BBA52B0B /* AVCaptureDevice+DDCaptureDevicePosition.m in Sources */, 3675233D1ACD4B72363E75C0FBDD7256 /* DDCameraView.m in Sources */, diff --git a/Example/Pods/Target Support Files/DDCameraViewController/DDCameraViewController-umbrella.h b/Example/Pods/Target Support Files/DDCameraViewController/DDCameraViewController-umbrella.h index f510b02..74bad27 100644 --- a/Example/Pods/Target Support Files/DDCameraViewController/DDCameraViewController-umbrella.h +++ b/Example/Pods/Target Support Files/DDCameraViewController/DDCameraViewController-umbrella.h @@ -17,7 +17,7 @@ #import "DDCameraViewController+DDCaptureStillImageOutput.h" #import "DDCameraViewController.h" #import "DDStillImageViewController.h" -#import "DDQRCodeViewController.h" +#import "DDScannerViewController.h" FOUNDATION_EXPORT double DDCameraViewControllerVersionNumber; FOUNDATION_EXPORT const unsigned char DDCameraViewControllerVersionString[]; From 71cfc84899716763b173a15528f079dccf6c2206 Mon Sep 17 00:00:00 2001 From: Oleg Petrunko Date: Mon, 4 May 2020 18:07:44 +0300 Subject: [PATCH 12/26] DDOS-189 - Need to add QR code recognition in DDCameraViewController pod - renamed DDViewController -> DDCustomCameraViewController --- .../DDCameraViewController.xcodeproj/project.pbxproj | 12 ++++++------ .../Base.lproj/Main.storyboard | 2 +- ...ewController.h => DDCustomCameraViewController.h} | 4 ++-- ...ewController.m => DDCustomCameraViewController.m} | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) rename Example/DDCameraViewController/{DDViewController.h => DDCustomCameraViewController.h} (60%) rename Example/DDCameraViewController/{DDViewController.m => DDCustomCameraViewController.m} (88%) diff --git a/Example/DDCameraViewController.xcodeproj/project.pbxproj b/Example/DDCameraViewController.xcodeproj/project.pbxproj index f222351..c5b052b 100644 --- a/Example/DDCameraViewController.xcodeproj/project.pbxproj +++ b/Example/DDCameraViewController.xcodeproj/project.pbxproj @@ -16,7 +16,7 @@ 6003F598195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F596195388D20070C39A /* InfoPlist.strings */; }; 6003F59A195388D20070C39A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F599195388D20070C39A /* main.m */; }; 6003F59E195388D20070C39A /* DDAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F59D195388D20070C39A /* DDAppDelegate.m */; }; - 6003F5A7195388D20070C39A /* DDViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5A6195388D20070C39A /* DDViewController.m */; }; + 6003F5A7195388D20070C39A /* DDCustomCameraViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5A6195388D20070C39A /* DDCustomCameraViewController.m */; }; 6003F5A9195388D20070C39A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5A8195388D20070C39A /* Images.xcassets */; }; 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F5AF195388D20070C39A /* XCTest.framework */; }; 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; @@ -62,8 +62,8 @@ 6003F59B195388D20070C39A /* DDCameraViewController-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "DDCameraViewController-Prefix.pch"; sourceTree = ""; }; 6003F59C195388D20070C39A /* DDAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDAppDelegate.h; sourceTree = ""; }; 6003F59D195388D20070C39A /* DDAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDAppDelegate.m; sourceTree = ""; }; - 6003F5A5195388D20070C39A /* DDViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDViewController.h; sourceTree = ""; }; - 6003F5A6195388D20070C39A /* DDViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDViewController.m; sourceTree = ""; }; + 6003F5A5195388D20070C39A /* DDCustomCameraViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDCustomCameraViewController.h; sourceTree = ""; }; + 6003F5A6195388D20070C39A /* DDCustomCameraViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDCustomCameraViewController.m; sourceTree = ""; }; 6003F5A8195388D20070C39A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 6003F5AE195388D20070C39A /* DDCameraViewController_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DDCameraViewController_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 6003F5AF195388D20070C39A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; @@ -159,8 +159,8 @@ 6003F59D195388D20070C39A /* DDAppDelegate.m */, 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */, 107F67562460100500EF7EDC /* DDCameraHints.h */, - 6003F5A5195388D20070C39A /* DDViewController.h */, - 6003F5A6195388D20070C39A /* DDViewController.m */, + 6003F5A5195388D20070C39A /* DDCustomCameraViewController.h */, + 6003F5A6195388D20070C39A /* DDCustomCameraViewController.m */, 1063A271245AE694007EB6F3 /* DDQRCodeScannerViewController.h */, 1063A272245AE694007EB6F3 /* DDQRCodeScannerViewController.m */, 10D16D5A2456FEAB0049218E /* DDQRViewController.h */, @@ -415,7 +415,7 @@ files = ( 6003F59E195388D20070C39A /* DDAppDelegate.m in Sources */, 10D16D5C2456FEAB0049218E /* DDQRViewController.m in Sources */, - 6003F5A7195388D20070C39A /* DDViewController.m in Sources */, + 6003F5A7195388D20070C39A /* DDCustomCameraViewController.m in Sources */, 1063A273245AE694007EB6F3 /* DDQRCodeScannerViewController.m in Sources */, 6003F59A195388D20070C39A /* main.m in Sources */, ); diff --git a/Example/DDCameraViewController/Base.lproj/Main.storyboard b/Example/DDCameraViewController/Base.lproj/Main.storyboard index 7e5effb..ddb6fa9 100644 --- a/Example/DDCameraViewController/Base.lproj/Main.storyboard +++ b/Example/DDCameraViewController/Base.lproj/Main.storyboard @@ -71,7 +71,7 @@ - + diff --git a/Example/DDCameraViewController/DDViewController.h b/Example/DDCameraViewController/DDCustomCameraViewController.h similarity index 60% rename from Example/DDCameraViewController/DDViewController.h rename to Example/DDCameraViewController/DDCustomCameraViewController.h index 4abe78a..97f8fa3 100644 --- a/Example/DDCameraViewController/DDViewController.h +++ b/Example/DDCameraViewController/DDCustomCameraViewController.h @@ -1,5 +1,5 @@ // -// DDViewController.h +// DDCustomCameraViewController.h // DDCameraViewController // // Copyright (c) 2019 dashdevs.com. All rights reserved. @@ -9,6 +9,6 @@ #import "DDStillImageViewController.h" -@interface DDViewController : DDStillImageViewController +@interface DDCustomCameraViewController : DDStillImageViewController @end diff --git a/Example/DDCameraViewController/DDViewController.m b/Example/DDCameraViewController/DDCustomCameraViewController.m similarity index 88% rename from Example/DDCameraViewController/DDViewController.m rename to Example/DDCameraViewController/DDCustomCameraViewController.m index bcd04f0..1800464 100644 --- a/Example/DDCameraViewController/DDViewController.m +++ b/Example/DDCameraViewController/DDCustomCameraViewController.m @@ -1,23 +1,23 @@ // -// DDViewController.m +// DDCustomCameraViewController.m // DDCameraViewController // // Copyright (c) 2019 dashdevs.com. All rights reserved. // -#import "DDViewController.h" +#import "DDCustomCameraViewController.h" #import "AVCaptureDevice+DDCaptureDeviceModesSwitch.h" #import "DDCameraViewController+DDCaptureDeviceInputSwitch.h" #import "DDCameraHints.h" -@interface DDViewController () +@interface DDCustomCameraViewController () @property (weak, nonatomic) IBOutlet UIImageView *imageView; @property (weak, nonatomic) IBOutlet UILabel *flashModeLabel; @property (weak, nonatomic) IBOutlet UILabel *torchModeLabel; @end -@implementation DDViewController +@implementation DDCustomCameraViewController - (void)viewDidLoad { [super viewDidLoad]; From 370fab16e1c195acdb7b08f67f6b4e3e9c1a686f Mon Sep 17 00:00:00 2001 From: Oleg Petrunko Date: Mon, 4 May 2020 18:14:09 +0300 Subject: [PATCH 13/26] DDOS-189 - Need to add QR code recognition in DDCameraViewController pod - renamed DDQRCodeScannerViewController -> DDViewController; - changed Main.storyboard --- .../project.pbxproj | 12 ++--- .../Base.lproj/Main.storyboard | 44 ++----------------- ...nerViewController.h => DDViewController.h} | 4 +- ...nerViewController.m => DDViewController.m} | 10 ++--- 4 files changed, 17 insertions(+), 53 deletions(-) rename Example/DDCameraViewController/{DDQRCodeScannerViewController.h => DDViewController.h} (65%) rename Example/DDCameraViewController/{DDQRCodeScannerViewController.m => DDViewController.m} (75%) diff --git a/Example/DDCameraViewController.xcodeproj/project.pbxproj b/Example/DDCameraViewController.xcodeproj/project.pbxproj index c5b052b..14d8be3 100644 --- a/Example/DDCameraViewController.xcodeproj/project.pbxproj +++ b/Example/DDCameraViewController.xcodeproj/project.pbxproj @@ -7,7 +7,7 @@ objects = { /* Begin PBXBuildFile section */ - 1063A273245AE694007EB6F3 /* DDQRCodeScannerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1063A272245AE694007EB6F3 /* DDQRCodeScannerViewController.m */; }; + 1063A273245AE694007EB6F3 /* DDViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1063A272245AE694007EB6F3 /* DDViewController.m */; }; 10D16D5C2456FEAB0049218E /* DDQRViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 10D16D5B2456FEAB0049218E /* DDQRViewController.m */; }; 5DCA21F76EEDC8B7EE91D784 /* Pods_DDCameraViewController_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 128F4D521EEF06DF99397F0A /* Pods_DDCameraViewController_Example.framework */; }; 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; @@ -45,8 +45,8 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 1063A271245AE694007EB6F3 /* DDQRCodeScannerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDQRCodeScannerViewController.h; sourceTree = ""; }; - 1063A272245AE694007EB6F3 /* DDQRCodeScannerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDQRCodeScannerViewController.m; sourceTree = ""; }; + 1063A271245AE694007EB6F3 /* DDViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDViewController.h; sourceTree = ""; }; + 1063A272245AE694007EB6F3 /* DDViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDViewController.m; sourceTree = ""; }; 107F67562460100500EF7EDC /* DDCameraHints.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDCameraHints.h; sourceTree = ""; }; 10D16D5A2456FEAB0049218E /* DDQRViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDQRViewController.h; sourceTree = ""; }; 10D16D5B2456FEAB0049218E /* DDQRViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDQRViewController.m; sourceTree = ""; }; @@ -161,8 +161,8 @@ 107F67562460100500EF7EDC /* DDCameraHints.h */, 6003F5A5195388D20070C39A /* DDCustomCameraViewController.h */, 6003F5A6195388D20070C39A /* DDCustomCameraViewController.m */, - 1063A271245AE694007EB6F3 /* DDQRCodeScannerViewController.h */, - 1063A272245AE694007EB6F3 /* DDQRCodeScannerViewController.m */, + 1063A271245AE694007EB6F3 /* DDViewController.h */, + 1063A272245AE694007EB6F3 /* DDViewController.m */, 10D16D5A2456FEAB0049218E /* DDQRViewController.h */, 10D16D5B2456FEAB0049218E /* DDQRViewController.m */, 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */, @@ -416,7 +416,7 @@ 6003F59E195388D20070C39A /* DDAppDelegate.m in Sources */, 10D16D5C2456FEAB0049218E /* DDQRViewController.m in Sources */, 6003F5A7195388D20070C39A /* DDCustomCameraViewController.m in Sources */, - 1063A273245AE694007EB6F3 /* DDQRCodeScannerViewController.m in Sources */, + 1063A273245AE694007EB6F3 /* DDViewController.m in Sources */, 6003F59A195388D20070C39A /* main.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Example/DDCameraViewController/Base.lproj/Main.storyboard b/Example/DDCameraViewController/Base.lproj/Main.storyboard index ddb6fa9..9503680 100644 --- a/Example/DDCameraViewController/Base.lproj/Main.storyboard +++ b/Example/DDCameraViewController/Base.lproj/Main.storyboard @@ -26,7 +26,7 @@ - + @@ -47,9 +47,9 @@ @@ -173,42 +173,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -310,7 +274,7 @@ - + diff --git a/Example/DDCameraViewController/DDQRCodeScannerViewController.h b/Example/DDCameraViewController/DDViewController.h similarity index 65% rename from Example/DDCameraViewController/DDQRCodeScannerViewController.h rename to Example/DDCameraViewController/DDViewController.h index 285ba87..a3d93e6 100644 --- a/Example/DDCameraViewController/DDQRCodeScannerViewController.h +++ b/Example/DDCameraViewController/DDViewController.h @@ -1,5 +1,5 @@ // -// DDQRCodeScannerViewController.h +// DDViewController.h // DDCameraViewController_Example // // Copyright (c) 2020 dashdevs.com. All rights reserved. @@ -9,7 +9,7 @@ NS_ASSUME_NONNULL_BEGIN -@interface DDQRCodeScannerViewController : UIViewController +@interface DDViewController : UIViewController @end diff --git a/Example/DDCameraViewController/DDQRCodeScannerViewController.m b/Example/DDCameraViewController/DDViewController.m similarity index 75% rename from Example/DDCameraViewController/DDQRCodeScannerViewController.m rename to Example/DDCameraViewController/DDViewController.m index 4677246..5adbd3f 100644 --- a/Example/DDCameraViewController/DDQRCodeScannerViewController.m +++ b/Example/DDCameraViewController/DDViewController.m @@ -1,20 +1,20 @@ // -// DDQRCodeScannerViewController.m +// DDViewController.m // DDCameraViewController_Example // // Copyright (c) 2020 dashdevs.com. All rights reserved. // -#import "DDQRCodeScannerViewController.h" +#import "DDViewController.h" #import "DDQRViewController.h" -@interface DDQRCodeScannerViewController () +@interface DDViewController () @end -@implementation DDQRCodeScannerViewController +@implementation DDViewController - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - if ([segue.identifier isEqualToString:@"showDDQRViewController"]) { + if ([segue.identifier isEqualToString:@"showDDScannerCameraViewController"]) { DDQRViewController *viewController = [segue destinationViewController]; viewController.qrDelegate = self; } From c8368cda6818e85353ebcf1aa293672e1366862d Mon Sep 17 00:00:00 2001 From: Oleg Petrunko Date: Mon, 4 May 2020 18:36:51 +0300 Subject: [PATCH 14/26] DDOS-189 - Need to add QR code recognition in DDCameraViewController pod - renamed DDQRViewController -> DDScannerCameraViewController; - changed Main.storyboard --- .../project.pbxproj | 16 ++++++------ .../Base.lproj/Main.storyboard | 2 +- .../DDQRViewController.h | 26 ------------------- .../DDScannerCameraViewController.h | 26 +++++++++++++++++++ ...ller.m => DDScannerCameraViewController.m} | 12 ++++----- .../DDCameraViewController/DDViewController.m | 8 +++--- 6 files changed, 45 insertions(+), 45 deletions(-) delete mode 100644 Example/DDCameraViewController/DDQRViewController.h create mode 100644 Example/DDCameraViewController/DDScannerCameraViewController.h rename Example/DDCameraViewController/{DDQRViewController.m => DDScannerCameraViewController.m} (81%) diff --git a/Example/DDCameraViewController.xcodeproj/project.pbxproj b/Example/DDCameraViewController.xcodeproj/project.pbxproj index 14d8be3..e7f1c79 100644 --- a/Example/DDCameraViewController.xcodeproj/project.pbxproj +++ b/Example/DDCameraViewController.xcodeproj/project.pbxproj @@ -8,7 +8,7 @@ /* Begin PBXBuildFile section */ 1063A273245AE694007EB6F3 /* DDViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1063A272245AE694007EB6F3 /* DDViewController.m */; }; - 10D16D5C2456FEAB0049218E /* DDQRViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 10D16D5B2456FEAB0049218E /* DDQRViewController.m */; }; + 10D16D5C2456FEAB0049218E /* DDScannerCameraViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 10D16D5B2456FEAB0049218E /* DDScannerCameraViewController.m */; }; 5DCA21F76EEDC8B7EE91D784 /* Pods_DDCameraViewController_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 128F4D521EEF06DF99397F0A /* Pods_DDCameraViewController_Example.framework */; }; 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; @@ -48,8 +48,8 @@ 1063A271245AE694007EB6F3 /* DDViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDViewController.h; sourceTree = ""; }; 1063A272245AE694007EB6F3 /* DDViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDViewController.m; sourceTree = ""; }; 107F67562460100500EF7EDC /* DDCameraHints.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDCameraHints.h; sourceTree = ""; }; - 10D16D5A2456FEAB0049218E /* DDQRViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDQRViewController.h; sourceTree = ""; }; - 10D16D5B2456FEAB0049218E /* DDQRViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDQRViewController.m; sourceTree = ""; }; + 10D16D5A2456FEAB0049218E /* DDScannerCameraViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDScannerCameraViewController.h; sourceTree = ""; }; + 10D16D5B2456FEAB0049218E /* DDScannerCameraViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDScannerCameraViewController.m; sourceTree = ""; }; 128F4D521EEF06DF99397F0A /* Pods_DDCameraViewController_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DDCameraViewController_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 1EFDFE4191BDB8C3BEB1AC8C /* TODO.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = TODO.md; path = ../TODO.md; sourceTree = ""; }; 6003F58A195388D20070C39A /* DDCameraViewController_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DDCameraViewController_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -159,12 +159,12 @@ 6003F59D195388D20070C39A /* DDAppDelegate.m */, 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */, 107F67562460100500EF7EDC /* DDCameraHints.h */, - 6003F5A5195388D20070C39A /* DDCustomCameraViewController.h */, - 6003F5A6195388D20070C39A /* DDCustomCameraViewController.m */, 1063A271245AE694007EB6F3 /* DDViewController.h */, 1063A272245AE694007EB6F3 /* DDViewController.m */, - 10D16D5A2456FEAB0049218E /* DDQRViewController.h */, - 10D16D5B2456FEAB0049218E /* DDQRViewController.m */, + 6003F5A5195388D20070C39A /* DDCustomCameraViewController.h */, + 6003F5A6195388D20070C39A /* DDCustomCameraViewController.m */, + 10D16D5A2456FEAB0049218E /* DDScannerCameraViewController.h */, + 10D16D5B2456FEAB0049218E /* DDScannerCameraViewController.m */, 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */, 6003F5A8195388D20070C39A /* Images.xcassets */, 6003F594195388D20070C39A /* Supporting Files */, @@ -414,7 +414,7 @@ buildActionMask = 2147483647; files = ( 6003F59E195388D20070C39A /* DDAppDelegate.m in Sources */, - 10D16D5C2456FEAB0049218E /* DDQRViewController.m in Sources */, + 10D16D5C2456FEAB0049218E /* DDScannerCameraViewController.m in Sources */, 6003F5A7195388D20070C39A /* DDCustomCameraViewController.m in Sources */, 1063A273245AE694007EB6F3 /* DDViewController.m in Sources */, 6003F59A195388D20070C39A /* main.m in Sources */, diff --git a/Example/DDCameraViewController/Base.lproj/Main.storyboard b/Example/DDCameraViewController/Base.lproj/Main.storyboard index 9503680..39091b1 100644 --- a/Example/DDCameraViewController/Base.lproj/Main.storyboard +++ b/Example/DDCameraViewController/Base.lproj/Main.storyboard @@ -176,7 +176,7 @@ - + diff --git a/Example/DDCameraViewController/DDQRViewController.h b/Example/DDCameraViewController/DDQRViewController.h deleted file mode 100644 index 55be38e..0000000 --- a/Example/DDCameraViewController/DDQRViewController.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// DDQRViewController.h -// DDCameraViewController_Example -// -// Copyright (c) 2020 dashdevs.com. All rights reserved. -// - -#import "DDScannerViewController.h" - -NS_ASSUME_NONNULL_BEGIN - -@protocol DDQRViewControllerDelegate; - -@interface DDQRViewController : DDScannerViewController - -@property (weak, nonatomic, nullable) id qrDelegate; - -@end - -@protocol DDQRViewControllerDelegate - -- (void)ddQRViewController:(DDQRViewController *)controller didTakeScannedResult:(NSString * _Nullable)string; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Example/DDCameraViewController/DDScannerCameraViewController.h b/Example/DDCameraViewController/DDScannerCameraViewController.h new file mode 100644 index 0000000..5672915 --- /dev/null +++ b/Example/DDCameraViewController/DDScannerCameraViewController.h @@ -0,0 +1,26 @@ +// +// DDScannerCameraViewController.h +// DDCameraViewController_Example +// +// Copyright (c) 2020 dashdevs.com. All rights reserved. +// + +#import "DDScannerViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@protocol DDScannerCameraViewControllerDelegate; + +@interface DDScannerCameraViewController : DDScannerViewController + +@property (weak, nonatomic, nullable) id qrDelegate; + +@end + +@protocol DDScannerCameraViewControllerDelegate + +- (void)ddScannerCameraViewController:(DDScannerCameraViewController *)controller didTakeScannedResult:(NSString * _Nullable)string; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Example/DDCameraViewController/DDQRViewController.m b/Example/DDCameraViewController/DDScannerCameraViewController.m similarity index 81% rename from Example/DDCameraViewController/DDQRViewController.m rename to Example/DDCameraViewController/DDScannerCameraViewController.m index 2902952..928e515 100644 --- a/Example/DDCameraViewController/DDQRViewController.m +++ b/Example/DDCameraViewController/DDScannerCameraViewController.m @@ -1,21 +1,21 @@ // -// DDQRViewController.m +// DDScannerCameraViewController.m // DDCameraViewController_Example // // Copyright (c) 2020 dashdevs.com. All rights reserved. // -#import "DDQRViewController.h" +#import "DDScannerCameraViewController.h" #import "AVCaptureDevice+DDCaptureDeviceModesSwitch.h" #import "DDCameraViewController+DDCaptureDeviceInputSwitch.h" #import "DDCameraHints.h" -@interface DDQRViewController () +@interface DDScannerCameraViewController () @property (weak, nonatomic) IBOutlet UILabel *flashModeLabel; @property (weak, nonatomic) IBOutlet UILabel *torchModeLabel; @end -@implementation DDQRViewController +@implementation DDScannerCameraViewController - (void)viewDidLoad { [super viewDidLoad]; @@ -54,14 +54,14 @@ - (void)updateHints { - (void)ddScannerViewController:(DDScannerViewController *)controller didTakeScannedResult:(NSString * _Nullable)resultAsString { [self dismissViewControllerAnimated:YES completion:^{ - if ([self.qrDelegate respondsToSelector:@selector(ddQRViewController:didTakeScannedResult:)]) { + if ([self.qrDelegate respondsToSelector:@selector(ddScannerCameraViewController:didTakeScannedResult:)]) { /* Depending on your task you can call stopRunning Or dont call stopRunning and dont leave the screen Each scan result is unique */ [self.captureSession stopRunning]; - [self.qrDelegate ddQRViewController:self didTakeScannedResult:resultAsString]; + [self.qrDelegate ddScannerCameraViewController:self didTakeScannedResult:resultAsString]; } }]; } diff --git a/Example/DDCameraViewController/DDViewController.m b/Example/DDCameraViewController/DDViewController.m index 5adbd3f..f24a442 100644 --- a/Example/DDCameraViewController/DDViewController.m +++ b/Example/DDCameraViewController/DDViewController.m @@ -6,21 +6,21 @@ // #import "DDViewController.h" -#import "DDQRViewController.h" +#import "DDScannerCameraViewController.h" -@interface DDViewController () +@interface DDViewController () @end @implementation DDViewController - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"showDDScannerCameraViewController"]) { - DDQRViewController *viewController = [segue destinationViewController]; + DDScannerCameraViewController *viewController = [segue destinationViewController]; viewController.qrDelegate = self; } } -- (void)ddQRViewController:(DDQRViewController *)controller didTakeScannedResult:(NSString * _Nullable)string { +- (void)ddScannerCameraViewController:(DDScannerCameraViewController *)controller didTakeScannedResult:(NSString * _Nullable)string { UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"Scan Result" message:string preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction* okButton = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:nil]; [alert addAction:okButton]; From d6348a801cb8d314e43d176a010eef5ffce9c55d Mon Sep 17 00:00:00 2001 From: Oleg Petrunko Date: Thu, 7 May 2020 10:26:42 +0300 Subject: [PATCH 15/26] DDOS-189 - Need to add QR code recognition in DDCameraViewController pod - small changes --- .../Classes/DDScannerViewController.h | 0 .../Classes/DDScannerViewController.m | 0 .../DDScannerCameraViewController.m | 7 +------ .../DDCameraViewController/DDViewController.m | 2 +- Example/Pods/Pods.xcodeproj/project.pbxproj | 16 ++++++++-------- 5 files changed, 10 insertions(+), 15 deletions(-) rename DDScannerViewController.h => DDCameraViewController/Classes/DDScannerViewController.h (100%) rename DDScannerViewController.m => DDCameraViewController/Classes/DDScannerViewController.m (100%) diff --git a/DDScannerViewController.h b/DDCameraViewController/Classes/DDScannerViewController.h similarity index 100% rename from DDScannerViewController.h rename to DDCameraViewController/Classes/DDScannerViewController.h diff --git a/DDScannerViewController.m b/DDCameraViewController/Classes/DDScannerViewController.m similarity index 100% rename from DDScannerViewController.m rename to DDCameraViewController/Classes/DDScannerViewController.m diff --git a/Example/DDCameraViewController/DDScannerCameraViewController.m b/Example/DDCameraViewController/DDScannerCameraViewController.m index 928e515..5c3d999 100644 --- a/Example/DDCameraViewController/DDScannerCameraViewController.m +++ b/Example/DDCameraViewController/DDScannerCameraViewController.m @@ -50,16 +50,11 @@ - (void)updateHints { self.torchModeLabel.text = DDDeviceTorchModeHintText(self.captureDevice.torchMode); } -#pragma mark - DDCodeScannerViewControllerDelegate +#pragma mark - DDScannerViewControllerDelegate - (void)ddScannerViewController:(DDScannerViewController *)controller didTakeScannedResult:(NSString * _Nullable)resultAsString { [self dismissViewControllerAnimated:YES completion:^{ if ([self.qrDelegate respondsToSelector:@selector(ddScannerCameraViewController:didTakeScannedResult:)]) { - /* - Depending on your task you can call stopRunning - Or dont call stopRunning and dont leave the screen - Each scan result is unique - */ [self.captureSession stopRunning]; [self.qrDelegate ddScannerCameraViewController:self didTakeScannedResult:resultAsString]; } diff --git a/Example/DDCameraViewController/DDViewController.m b/Example/DDCameraViewController/DDViewController.m index f24a442..2fbb6dd 100644 --- a/Example/DDCameraViewController/DDViewController.m +++ b/Example/DDCameraViewController/DDViewController.m @@ -8,7 +8,7 @@ #import "DDViewController.h" #import "DDScannerCameraViewController.h" -@interface DDViewController () +@interface DDViewController () @end @implementation DDViewController diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index c3e65f6..8131cae 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -16,8 +16,8 @@ 073A9660A1A127B92D5E6FF2DF621275 /* OCMLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = D9AC401B51C29F4DF6C8B124C8338D1C /* OCMLocation.h */; settings = {ATTRIBUTES = (Public, ); }; }; 07DDE5733255A1D75CB92E2AF73B51B3 /* OCMExceptionReturnValueProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 70063C02AFD65F93A65F15B93E734FE5 /* OCMExceptionReturnValueProvider.h */; settings = {ATTRIBUTES = (Project, ); }; }; 0E6C4F0AA7B846DD75246693901C938D /* OCMObserverRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 970EDBB999D51175C9DBE916CD9DBBC4 /* OCMObserverRecorder.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - 10D16D582456F3D50049218E /* DDScannerViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 10D16D562456F3D50049218E /* DDScannerViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 10D16D592456F3D50049218E /* DDScannerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 10D16D572456F3D50049218E /* DDScannerViewController.m */; }; + 10EE54752463E39D00FD86DF /* DDScannerViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 10EE54732463E39D00FD86DF /* DDScannerViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 10EE54762463E39D00FD86DF /* DDScannerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 10EE54742463E39D00FD86DF /* DDScannerViewController.m */; }; 14ECEBC338600515A76F40E12C9B82E9 /* AVCaptureDevice+DDCaptureDeviceModesSwitch.h in Headers */ = {isa = PBXBuildFile; fileRef = 42AC94E275E74A61452A339083905430 /* AVCaptureDevice+DDCaptureDeviceModesSwitch.h */; settings = {ATTRIBUTES = (Public, ); }; }; 15E05D1398E023D3D15F30CBA19DF58B /* OCMInvocationMatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = D30AF1F899FD60591E89712D3E3FAD34 /* OCMInvocationMatcher.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 17D66FFBBBADF6B03CF95D1E1B70DC54 /* OCMBoxedReturnValueProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 857F8021D52BB3BF529AFECD3DA2D7F1 /* OCMBoxedReturnValueProvider.h */; settings = {ATTRIBUTES = (Project, ); }; }; @@ -134,8 +134,8 @@ 09BCCA72FED51A01414395CD6EE6B0D4 /* Pods-DDCameraViewController_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-DDCameraViewController_Tests.debug.xcconfig"; sourceTree = ""; }; 0D0DD873228D479C209B4D3844A9FE84 /* OCClassMockObject.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = OCClassMockObject.m; path = Source/OCMock/OCClassMockObject.m; sourceTree = ""; }; 0E3913A0EE93B47F99253EF2F76702BB /* Pods-DDCameraViewController_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-DDCameraViewController_Tests.release.xcconfig"; sourceTree = ""; }; - 10D16D562456F3D50049218E /* DDScannerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDScannerViewController.h; sourceTree = ""; }; - 10D16D572456F3D50049218E /* DDScannerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDScannerViewController.m; sourceTree = ""; }; + 10EE54732463E39D00FD86DF /* DDScannerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DDScannerViewController.h; path = DDCameraViewController/Classes/DDScannerViewController.h; sourceTree = ""; }; + 10EE54742463E39D00FD86DF /* DDScannerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DDScannerViewController.m; path = DDCameraViewController/Classes/DDScannerViewController.m; sourceTree = ""; }; 189E844DF5F02337A748A42FA45BE56C /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 1961671E2800A5C38CC04D0BE8553B9B /* NSNotificationCenter+OCMAdditions.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSNotificationCenter+OCMAdditions.h"; path = "Source/OCMock/NSNotificationCenter+OCMAdditions.h"; sourceTree = ""; }; 1AC588DEF82617F2AAAB67FC05AAEF37 /* Pods-DDCameraViewController_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-DDCameraViewController_Example.release.xcconfig"; sourceTree = ""; }; @@ -484,10 +484,10 @@ 3C192142E8086E0041DEE9AB4062B47E /* DDCameraViewController+DDCaptureStillImageOutput.h */, 5ACCDC068A59D82BAE7089A84008DDDE /* DDCameraViewController+DDCaptureStillImageOutput.m */, 6F3D49933FD39B462CA2C3ADB054CB44 /* DDCameraViewController_Private.h */, + 10EE54732463E39D00FD86DF /* DDScannerViewController.h */, + 10EE54742463E39D00FD86DF /* DDScannerViewController.m */, 704D6A6FDCBC6FC6A58D48DF6D00A43A /* DDStillImageViewController.h */, FDE09A1CA7841D885426FD79C3118AA9 /* DDStillImageViewController.m */, - 10D16D562456F3D50049218E /* DDScannerViewController.h */, - 10D16D572456F3D50049218E /* DDScannerViewController.m */, FC36DF0F9AC0619419A467E32FEBCD6B /* DDCameraView */, BB8B0E8F9A2AD0B65F4838CA97FAD320 /* DDCameraViewController */, 8443A3FE3801EE5A2C357BDA7D4AA046 /* Pod */, @@ -560,10 +560,10 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + 10EE54752463E39D00FD86DF /* DDScannerViewController.h in Headers */, 14ECEBC338600515A76F40E12C9B82E9 /* AVCaptureDevice+DDCaptureDeviceModesSwitch.h in Headers */, 6BDA1EB2489555F578B98CB24E9BC0B9 /* AVCaptureDevice+DDCaptureDevicePosition.h in Headers */, 92378DEBFFC9981F081AD31FB5DD1D7B /* DDCameraView.h in Headers */, - 10D16D582456F3D50049218E /* DDScannerViewController.h in Headers */, 883161B40DCD936C15BDBE162C792B88 /* DDCameraViewController+DDCaptureDeviceInputSwitch.h in Headers */, DED9A023783CCD5192F9FE4D122D65EE /* DDCameraViewController+DDCaptureStillImageOutput.h in Headers */, E5CBFCED435CB113125FAF3918087603 /* DDCameraViewController-umbrella.h in Headers */, @@ -784,8 +784,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 10D16D592456F3D50049218E /* DDScannerViewController.m in Sources */, 299D80B739ACBBEC1A0C36FCB277EE3E /* AVCaptureDevice+DDCaptureDeviceModesSwitch.m in Sources */, + 10EE54762463E39D00FD86DF /* DDScannerViewController.m in Sources */, 44E48B8FF213A1F7007D23D0BBA52B0B /* AVCaptureDevice+DDCaptureDevicePosition.m in Sources */, 3675233D1ACD4B72363E75C0FBDD7256 /* DDCameraView.m in Sources */, 275BE603C232BFA4E00E2E1081797451 /* DDCameraViewController+DDCaptureDeviceInputSwitch.m in Sources */, From 9ea6ce7e062f1b1e0539a7824c014d46192f496b Mon Sep 17 00:00:00 2001 From: Oleg Petrunko Date: Thu, 7 May 2020 11:05:34 +0300 Subject: [PATCH 16/26] DDOS-189 - Need to add QR code recognition in DDCameraViewController pod - changed DDScannerViewController.m; - changed DDScannerCameraViewController.h; - changed DDScannerCameraViewController.m; - changed DDViewController.h; - changed DDViewController.m --- .../Classes/DDScannerViewController.m | 13 ++++++------- .../DDScannerCameraViewController.h | 2 +- .../DDScannerCameraViewController.m | 4 ++-- Example/DDCameraViewController/DDViewController.h | 10 +++------- Example/DDCameraViewController/DDViewController.m | 4 ++-- 5 files changed, 14 insertions(+), 19 deletions(-) diff --git a/DDCameraViewController/Classes/DDScannerViewController.m b/DDCameraViewController/Classes/DDScannerViewController.m index 97059a5..a30b824 100644 --- a/DDCameraViewController/Classes/DDScannerViewController.m +++ b/DDCameraViewController/Classes/DDScannerViewController.m @@ -37,13 +37,12 @@ - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects: if ([current isKindOfClass:[AVMetadataMachineReadableCodeObject class]] && [_metadataObjectTypes containsObject:current.type]) { NSString *scannedResult = [(AVMetadataMachineReadableCodeObject *)current stringValue]; - if ([self.delegate respondsToSelector:@selector(ddScannerViewController:didTakeScannedResult:)]) { - if (![scannedResult isEqualToString:_scannedResult]) { - _scannedResult = scannedResult; - dispatch_async(dispatch_get_main_queue(), ^(void){ - [self.delegate ddScannerViewController:self didTakeScannedResult:scannedResult]; - }); - } + if ([self.delegate respondsToSelector:@selector(ddScannerViewController:didTakeScannedResult:)] + && ![scannedResult isEqualToString:_scannedResult]) { + _scannedResult = scannedResult; + dispatch_async(dispatch_get_main_queue(), ^(void){ + [self.delegate ddScannerViewController:self didTakeScannedResult:scannedResult]; + }); } break; } diff --git a/Example/DDCameraViewController/DDScannerCameraViewController.h b/Example/DDCameraViewController/DDScannerCameraViewController.h index 5672915..0ad0240 100644 --- a/Example/DDCameraViewController/DDScannerCameraViewController.h +++ b/Example/DDCameraViewController/DDScannerCameraViewController.h @@ -1,6 +1,6 @@ // // DDScannerCameraViewController.h -// DDCameraViewController_Example +// DDCameraViewController // // Copyright (c) 2020 dashdevs.com. All rights reserved. // diff --git a/Example/DDCameraViewController/DDScannerCameraViewController.m b/Example/DDCameraViewController/DDScannerCameraViewController.m index 5c3d999..78dc21d 100644 --- a/Example/DDCameraViewController/DDScannerCameraViewController.m +++ b/Example/DDCameraViewController/DDScannerCameraViewController.m @@ -1,6 +1,6 @@ // // DDScannerCameraViewController.m -// DDCameraViewController_Example +// DDCameraViewController // // Copyright (c) 2020 dashdevs.com. All rights reserved. // @@ -23,7 +23,7 @@ - (void)viewDidLoad { [self updateHints]; } -- (void)setMetadataObjectTypes:(NSArray *)types { +- (void)setMetadataObjectTypes:(NSArray *)types { [super setMetadataObjectTypes:@[AVMetadataObjectTypeQRCode]]; } diff --git a/Example/DDCameraViewController/DDViewController.h b/Example/DDCameraViewController/DDViewController.h index a3d93e6..3d1a759 100644 --- a/Example/DDCameraViewController/DDViewController.h +++ b/Example/DDCameraViewController/DDViewController.h @@ -1,16 +1,12 @@ // // DDViewController.h -// DDCameraViewController_Example +// DDCameraViewController // -// Copyright (c) 2020 dashdevs.com. All rights reserved. +// Copyright (c) 2019 dashdevs.com. All rights reserved. // -#import - -NS_ASSUME_NONNULL_BEGIN +@import UIKit; @interface DDViewController : UIViewController @end - -NS_ASSUME_NONNULL_END diff --git a/Example/DDCameraViewController/DDViewController.m b/Example/DDCameraViewController/DDViewController.m index 2fbb6dd..7b23b1f 100644 --- a/Example/DDCameraViewController/DDViewController.m +++ b/Example/DDCameraViewController/DDViewController.m @@ -1,8 +1,8 @@ // // DDViewController.m -// DDCameraViewController_Example +// DDCameraViewController // -// Copyright (c) 2020 dashdevs.com. All rights reserved. +// Copyright (c) 2019 dashdevs.com. All rights reserved. // #import "DDViewController.h" From 7b1e317c5dde4dd0a96115eb09b30b5b83e5a700 Mon Sep 17 00:00:00 2001 From: Oleg Petrunko Date: Thu, 7 May 2020 11:20:20 +0300 Subject: [PATCH 17/26] DDOS-189 - Need to add QR code recognition in DDCameraViewController pod - changed DDCameraViewController.podspec; - changed DDCameraViewController_Private.h --- DDCameraViewController.podspec | 7 +++++++ .../Classes/DDCameraViewController_Private.h | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/DDCameraViewController.podspec b/DDCameraViewController.podspec index c71624d..57a8b22 100644 --- a/DDCameraViewController.podspec +++ b/DDCameraViewController.podspec @@ -52,6 +52,13 @@ Pod::Spec.new do |s| subspec.dependency 'DDCameraViewController/DDCaptureStillImageOutput' end + s.subspec 'DDScannerViewController' do |subspec| + subspec.source_files = 'DDCameraViewController/Classes/DDScannerViewController.{h,m}, + 'DDCameraViewController/Classes/DDCameraViewController_Private.h' + subspec.public_header_files = 'DDCameraViewController/Classes/DDScannerViewController.h' + subspec.ios.deployment_target = '9.0' + end + s.subspec 'DDCaptureDeviceInputSwitch' do |subspec| subspec.source_files = 'DDCameraViewController/Classes/AVCaptureDevice+DDCaptureDevicePosition.{h,m}', 'DDCameraViewController/Classes/DDCameraViewController+DDCaptureDeviceInputSwitch.{h,m}' diff --git a/DDCameraViewController/Classes/DDCameraViewController_Private.h b/DDCameraViewController/Classes/DDCameraViewController_Private.h index 931b9a1..082f244 100644 --- a/DDCameraViewController/Classes/DDCameraViewController_Private.h +++ b/DDCameraViewController/Classes/DDCameraViewController_Private.h @@ -7,6 +7,8 @@ #import "DDCameraViewController.h" +NS_ASSUME_NONNULL_BEGIN + static dispatch_queue_t dd_capture_session_queue() { static dispatch_queue_t capture_session_queue; static dispatch_once_t onceToken = 0; @@ -16,8 +18,6 @@ static dispatch_queue_t dd_capture_session_queue() { return capture_session_queue; } -NS_ASSUME_NONNULL_BEGIN - @interface DDCameraViewController () @property (nonatomic, strong, readwrite, nullable) AVCaptureSession *captureSession; From b42878fc1679289bb0bd324a786b1d8722053d32 Mon Sep 17 00:00:00 2001 From: Oleg Petrunko Date: Thu, 7 May 2020 11:52:52 +0300 Subject: [PATCH 18/26] DDOS-189 - Need to add QR code recognition in DDCameraViewController pod - changed DDCameraViewController.podspec --- DDCameraViewController.podspec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DDCameraViewController.podspec b/DDCameraViewController.podspec index 57a8b22..a5ad207 100644 --- a/DDCameraViewController.podspec +++ b/DDCameraViewController.podspec @@ -53,10 +53,11 @@ Pod::Spec.new do |s| end s.subspec 'DDScannerViewController' do |subspec| - subspec.source_files = 'DDCameraViewController/Classes/DDScannerViewController.{h,m}, + subspec.source_files = 'DDCameraViewController/Classes/DDScannerViewController.{h,m}', 'DDCameraViewController/Classes/DDCameraViewController_Private.h' subspec.public_header_files = 'DDCameraViewController/Classes/DDScannerViewController.h' subspec.ios.deployment_target = '9.0' + subspec.dependency 'DDCameraViewController/DDCameraViewController' end s.subspec 'DDCaptureDeviceInputSwitch' do |subspec| From 482dcaac2a838e91f090765a270822d74f69d957 Mon Sep 17 00:00:00 2001 From: Oleg Petrunko Date: Thu, 7 May 2020 14:08:33 +0300 Subject: [PATCH 19/26] DDOS-189 - Need to add QR code recognition in DDCameraViewController pod - changed DDCameraViewController.podspec --- DDCameraViewController.podspec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/DDCameraViewController.podspec b/DDCameraViewController.podspec index a5ad207..27fa433 100644 --- a/DDCameraViewController.podspec +++ b/DDCameraViewController.podspec @@ -53,8 +53,7 @@ Pod::Spec.new do |s| end s.subspec 'DDScannerViewController' do |subspec| - subspec.source_files = 'DDCameraViewController/Classes/DDScannerViewController.{h,m}', - 'DDCameraViewController/Classes/DDCameraViewController_Private.h' + subspec.source_files = 'DDCameraViewController/Classes/DDScannerViewController.{h,m}' subspec.public_header_files = 'DDCameraViewController/Classes/DDScannerViewController.h' subspec.ios.deployment_target = '9.0' subspec.dependency 'DDCameraViewController/DDCameraViewController' From 2b815feee1b550ae423e471d0cef755018ab8d51 Mon Sep 17 00:00:00 2001 From: George Ulanov Date: Thu, 7 May 2020 19:39:45 +0300 Subject: [PATCH 20/26] DDOS-189 - added scanner camera in DDCameraViewController pod - names corrected --- .../Classes/DDScannerViewController.h | 2 +- .../Classes/DDScannerViewController.m | 12 ++++++------ .../DDScannerCameraViewController.h | 2 +- .../DDScannerCameraViewController.m | 6 +++--- Example/DDCameraViewController/DDViewController.m | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/DDCameraViewController/Classes/DDScannerViewController.h b/DDCameraViewController/Classes/DDScannerViewController.h index ba6e3f5..692d311 100644 --- a/DDCameraViewController/Classes/DDScannerViewController.h +++ b/DDCameraViewController/Classes/DDScannerViewController.h @@ -27,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN @protocol DDScannerViewControllerDelegate -- (void)ddScannerViewController:(DDScannerViewController *)controller didTakeScannedResult:(NSString * _Nullable)resultAsString; +- (void)scannerViewController:(DDScannerViewController *)controller didScanMachineReadableCode:(NSString * _Nullable)code; @end diff --git a/DDCameraViewController/Classes/DDScannerViewController.m b/DDCameraViewController/Classes/DDScannerViewController.m index a30b824..e511d54 100644 --- a/DDCameraViewController/Classes/DDScannerViewController.m +++ b/DDCameraViewController/Classes/DDScannerViewController.m @@ -9,7 +9,7 @@ #import "DDCameraViewController_Private.h" @interface DDScannerViewController () -@property (strong, nonatomic, nullable) NSString *scannedResult; +@property (strong, nonatomic, nullable) NSString *machineReadableCode; @property (strong, nonatomic, nullable) NSArray *metadataObjectTypes; @property (strong, nonatomic, nullable) AVCaptureMetadataOutput *output; @end @@ -36,12 +36,12 @@ - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects: for (AVMetadataObject *current in metadataObjects) { if ([current isKindOfClass:[AVMetadataMachineReadableCodeObject class]] && [_metadataObjectTypes containsObject:current.type]) { - NSString *scannedResult = [(AVMetadataMachineReadableCodeObject *)current stringValue]; - if ([self.delegate respondsToSelector:@selector(ddScannerViewController:didTakeScannedResult:)] - && ![scannedResult isEqualToString:_scannedResult]) { - _scannedResult = scannedResult; + NSString *code = [(AVMetadataMachineReadableCodeObject *)current stringValue]; + if ([self.delegate respondsToSelector:@selector(scannerViewController:didScanMachineReadableCode:)] + && ![code isEqualToString:_machineReadableCode]) { + _machineReadableCode = code; dispatch_async(dispatch_get_main_queue(), ^(void){ - [self.delegate ddScannerViewController:self didTakeScannedResult:scannedResult]; + [self.delegate scannerViewController:self didScanMachineReadableCode:code]; }); } break; diff --git a/Example/DDCameraViewController/DDScannerCameraViewController.h b/Example/DDCameraViewController/DDScannerCameraViewController.h index 0ad0240..4053905 100644 --- a/Example/DDCameraViewController/DDScannerCameraViewController.h +++ b/Example/DDCameraViewController/DDScannerCameraViewController.h @@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN @protocol DDScannerCameraViewControllerDelegate -- (void)ddScannerCameraViewController:(DDScannerCameraViewController *)controller didTakeScannedResult:(NSString * _Nullable)string; +- (void)scannerCameraViewController:(DDScannerCameraViewController *)controller didScanMachineReadableCode:(NSString * _Nullable)code; @end diff --git a/Example/DDCameraViewController/DDScannerCameraViewController.m b/Example/DDCameraViewController/DDScannerCameraViewController.m index 78dc21d..0226c87 100644 --- a/Example/DDCameraViewController/DDScannerCameraViewController.m +++ b/Example/DDCameraViewController/DDScannerCameraViewController.m @@ -52,11 +52,11 @@ - (void)updateHints { #pragma mark - DDScannerViewControllerDelegate -- (void)ddScannerViewController:(DDScannerViewController *)controller didTakeScannedResult:(NSString * _Nullable)resultAsString { +- (void)scannerViewController:(DDScannerViewController *)controller didScanMachineReadableCode:(NSString * _Nullable)code { [self dismissViewControllerAnimated:YES completion:^{ - if ([self.qrDelegate respondsToSelector:@selector(ddScannerCameraViewController:didTakeScannedResult:)]) { + if ([self.qrDelegate respondsToSelector:@selector(scannerCameraViewController:didScanMachineReadableCode:)]) { [self.captureSession stopRunning]; - [self.qrDelegate ddScannerCameraViewController:self didTakeScannedResult:resultAsString]; + [self.qrDelegate scannerCameraViewController:self didScanMachineReadableCode:code]; } }]; } diff --git a/Example/DDCameraViewController/DDViewController.m b/Example/DDCameraViewController/DDViewController.m index 7b23b1f..ce9368e 100644 --- a/Example/DDCameraViewController/DDViewController.m +++ b/Example/DDCameraViewController/DDViewController.m @@ -20,8 +20,8 @@ - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { } } -- (void)ddScannerCameraViewController:(DDScannerCameraViewController *)controller didTakeScannedResult:(NSString * _Nullable)string { - UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"Scan Result" message:string preferredStyle:UIAlertControllerStyleAlert]; +- (void)scannerCameraViewController:(DDScannerCameraViewController *)controller didScanMachineReadableCode:(NSString * _Nullable)code { + UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"Scan Result" message:code preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction* okButton = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:nil]; [alert addAction:okButton]; [self presentViewController:alert animated:YES completion:nil]; From f655a6c5c821745893433f5fb04986455f10a250 Mon Sep 17 00:00:00 2001 From: George Ulanov Date: Tue, 29 Dec 2020 12:35:54 +0200 Subject: [PATCH 21/26] DDOS-189 - added all scan types - changed DDScannerCameraViewController --- .../DDScannerCameraViewController.m | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Example/DDCameraViewController/DDScannerCameraViewController.m b/Example/DDCameraViewController/DDScannerCameraViewController.m index 0226c87..b2ee18c 100644 --- a/Example/DDCameraViewController/DDScannerCameraViewController.m +++ b/Example/DDCameraViewController/DDScannerCameraViewController.m @@ -24,7 +24,19 @@ - (void)viewDidLoad { } - (void)setMetadataObjectTypes:(NSArray *)types { - [super setMetadataObjectTypes:@[AVMetadataObjectTypeQRCode]]; + [super setMetadataObjectTypes:@[AVMetadataObjectTypeUPCECode, + AVMetadataObjectTypeCode39Code, + AVMetadataObjectTypeCode39Mod43Code, + AVMetadataObjectTypeEAN13Code, + AVMetadataObjectTypeEAN8Code, + AVMetadataObjectTypeCode93Code, + AVMetadataObjectTypeCode128Code, + AVMetadataObjectTypePDF417Code, + AVMetadataObjectTypeQRCode, + AVMetadataObjectTypeAztecCode, + AVMetadataObjectTypeInterleaved2of5Code, + AVMetadataObjectTypeITF14Code, + AVMetadataObjectTypeDataMatrixCode]]; } - (IBAction)cancelButtonTapped:(UIButton *)sender { From 24198a27bd0033adfb6c090087131ed420388baf Mon Sep 17 00:00:00 2001 From: George Ulanov Date: Wed, 30 Dec 2020 10:19:49 +0200 Subject: [PATCH 22/26] DDOS-189 - deleted empty folders --- Example/Pods/Pods.xcodeproj/project.pbxproj | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index 8131cae..3d32776 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -488,8 +488,6 @@ 10EE54742463E39D00FD86DF /* DDScannerViewController.m */, 704D6A6FDCBC6FC6A58D48DF6D00A43A /* DDStillImageViewController.h */, FDE09A1CA7841D885426FD79C3118AA9 /* DDStillImageViewController.m */, - FC36DF0F9AC0619419A467E32FEBCD6B /* DDCameraView */, - BB8B0E8F9A2AD0B65F4838CA97FAD320 /* DDCameraViewController */, 8443A3FE3801EE5A2C357BDA7D4AA046 /* Pod */, 1E401D16FA5B32611993A1A6E9CA4B59 /* Support Files */, ); @@ -497,13 +495,6 @@ path = ../..; sourceTree = ""; }; - BB8B0E8F9A2AD0B65F4838CA97FAD320 /* DDCameraViewController */ = { - isa = PBXGroup; - children = ( - ); - name = DDCameraViewController; - sourceTree = ""; - }; CA68BA8487AF892AF43F9C1E6D456346 /* Development Pods */ = { isa = PBXGroup; children = ( @@ -538,13 +529,6 @@ name = Pods; sourceTree = ""; }; - FC36DF0F9AC0619419A467E32FEBCD6B /* DDCameraView */ = { - isa = PBXGroup; - children = ( - ); - name = DDCameraView; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -709,6 +693,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = 7DB346D0F39D3F0E887471402A8071AB; From c0d36f97ea25ff812708d489f93791f1b637ab9a Mon Sep 17 00:00:00 2001 From: George Ulanov Date: Wed, 30 Dec 2020 10:50:39 +0200 Subject: [PATCH 23/26] DDOS-189 - added a description to DDScannerViewController.h --- .../Classes/DDScannerViewController.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/DDCameraViewController/Classes/DDScannerViewController.h b/DDCameraViewController/Classes/DDScannerViewController.h index 692d311..933e36b 100644 --- a/DDCameraViewController/Classes/DDScannerViewController.h +++ b/DDCameraViewController/Classes/DDScannerViewController.h @@ -21,12 +21,23 @@ NS_ASSUME_NONNULL_BEGIN */ @property (weak, nonatomic, nullable) id delegate; +/** + Adds the ability to set possible scan types. + + @param types The value of this property is an NSArray of NSStrings corresponding to AVMetadataObjectType strings defined in AVMetadataObject.h -- one for each metadata object type supported by the receiver. Clients may specify the types of objects they would like to process by calling setMetadataObjectTypes:. + */ - (void)setMetadataObjectTypes:(NSArray * _Nullable)types; @end @protocol DDScannerViewControllerDelegate +/** + Sent to the delegate object after scanning. + + @param controller View controller object that initiated the request. + @param code The scanned information is sent as a string to the delegate object. + */ - (void)scannerViewController:(DDScannerViewController *)controller didScanMachineReadableCode:(NSString * _Nullable)code; @end From 2c8599a2aa3c080f352f3ac44c8dcd82fbba9f57 Mon Sep 17 00:00:00 2001 From: George Ulanov Date: Wed, 30 Dec 2020 11:19:41 +0200 Subject: [PATCH 24/26] DDOS-189 - rename - changed DDScannerCameraViewController.h; - changed DDScannerCameraViewController.m; - changed DDViewController.m --- .../DDCameraViewController/DDScannerCameraViewController.h | 2 +- .../DDCameraViewController/DDScannerCameraViewController.m | 4 ++-- Example/DDCameraViewController/DDViewController.m | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Example/DDCameraViewController/DDScannerCameraViewController.h b/Example/DDCameraViewController/DDScannerCameraViewController.h index 4053905..d6a7275 100644 --- a/Example/DDCameraViewController/DDScannerCameraViewController.h +++ b/Example/DDCameraViewController/DDScannerCameraViewController.h @@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN @interface DDScannerCameraViewController : DDScannerViewController -@property (weak, nonatomic, nullable) id qrDelegate; +@property (weak, nonatomic, nullable) id scannerDelegate; @end diff --git a/Example/DDCameraViewController/DDScannerCameraViewController.m b/Example/DDCameraViewController/DDScannerCameraViewController.m index b2ee18c..352e906 100644 --- a/Example/DDCameraViewController/DDScannerCameraViewController.m +++ b/Example/DDCameraViewController/DDScannerCameraViewController.m @@ -66,9 +66,9 @@ - (void)updateHints { - (void)scannerViewController:(DDScannerViewController *)controller didScanMachineReadableCode:(NSString * _Nullable)code { [self dismissViewControllerAnimated:YES completion:^{ - if ([self.qrDelegate respondsToSelector:@selector(scannerCameraViewController:didScanMachineReadableCode:)]) { + if ([self.scannerDelegate respondsToSelector:@selector(scannerCameraViewController:didScanMachineReadableCode:)]) { [self.captureSession stopRunning]; - [self.qrDelegate scannerCameraViewController:self didScanMachineReadableCode:code]; + [self.scannerDelegate scannerCameraViewController:self didScanMachineReadableCode:code]; } }]; } diff --git a/Example/DDCameraViewController/DDViewController.m b/Example/DDCameraViewController/DDViewController.m index ce9368e..a719ced 100644 --- a/Example/DDCameraViewController/DDViewController.m +++ b/Example/DDCameraViewController/DDViewController.m @@ -16,7 +16,7 @@ @implementation DDViewController - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"showDDScannerCameraViewController"]) { DDScannerCameraViewController *viewController = [segue destinationViewController]; - viewController.qrDelegate = self; + viewController.scannerDelegate = self; } } From 3f2220ba6860711ffaabb5f697c30e3d6c14d722 Mon Sep 17 00:00:00 2001 From: George Ulanov Date: Mon, 4 Jan 2021 14:51:39 +0200 Subject: [PATCH 25/26] DDOS-189 - changed s.source - changed DDCameraViewController.podspec --- DDCameraViewController.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DDCameraViewController.podspec b/DDCameraViewController.podspec index 27fa433..1c4d145 100644 --- a/DDCameraViewController.podspec +++ b/DDCameraViewController.podspec @@ -14,7 +14,7 @@ Pod::Spec.new do |s| s.homepage = 'http://dashdevs.com' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'dashdevs llc' => 'hello@dashdevs.com' } - s.source = { :git => 'https://bitbucket.org/itomych/DDCameraViewController.git', :tag => s.version.to_s } + s.source = { :git => 'https://github.com/dashdevs/DDCameraViewController.git', :tag => s.version.to_s } s.ios.deployment_target = '9.0' From 733a0cf7996ef1310af370c299d621106a6c36a4 Mon Sep 17 00:00:00 2001 From: George Ulanov Date: Tue, 5 Jan 2021 17:21:53 +0200 Subject: [PATCH 26/26] DDOS-189 - changed s.source - changed DDScannerViewController.m --- .../Classes/DDScannerViewController.m | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/DDCameraViewController/Classes/DDScannerViewController.m b/DDCameraViewController/Classes/DDScannerViewController.m index e511d54..794ffe9 100644 --- a/DDCameraViewController/Classes/DDScannerViewController.m +++ b/DDCameraViewController/Classes/DDScannerViewController.m @@ -9,8 +9,8 @@ #import "DDCameraViewController_Private.h" @interface DDScannerViewController () +@property (strong, nonatomic, nullable) NSArray *scannerMetadataObjectTypes; @property (strong, nonatomic, nullable) NSString *machineReadableCode; -@property (strong, nonatomic, nullable) NSArray *metadataObjectTypes; @property (strong, nonatomic, nullable) AVCaptureMetadataOutput *output; @end @@ -19,27 +19,27 @@ @implementation DDScannerViewController - (void)initializeCaptureSession { [super initializeCaptureSession]; _output = [[AVCaptureMetadataOutput alloc] init]; - [self.captureSession addOutput:_output]; - [_output setMetadataObjectsDelegate:self queue:dd_capture_session_queue()]; + [self.captureSession addOutput:self.output]; + [self.output setMetadataObjectsDelegate:self queue:dd_capture_session_queue()]; [self setMetadataObjectTypes:nil]; } - (void)setMetadataObjectTypes:(NSArray * _Nullable)types { - _metadataObjectTypes = types; - NSSet *set = [NSSet setWithArray:_metadataObjectTypes]; - NSMutableSet *available = [NSMutableSet setWithArray:[_output availableMetadataObjectTypes]]; + self.scannerMetadataObjectTypes = types; + NSSet *set = [NSSet setWithArray:self.scannerMetadataObjectTypes]; + NSMutableSet *available = [NSMutableSet setWithArray:[self.output availableMetadataObjectTypes]]; [available intersectSet:set]; - [_output setMetadataObjectTypes:available.allObjects]; + [self.output setMetadataObjectTypes:available.allObjects]; } - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection { for (AVMetadataObject *current in metadataObjects) { if ([current isKindOfClass:[AVMetadataMachineReadableCodeObject class]] - && [_metadataObjectTypes containsObject:current.type]) { + && [self.scannerMetadataObjectTypes containsObject:current.type]) { NSString *code = [(AVMetadataMachineReadableCodeObject *)current stringValue]; if ([self.delegate respondsToSelector:@selector(scannerViewController:didScanMachineReadableCode:)] - && ![code isEqualToString:_machineReadableCode]) { - _machineReadableCode = code; + && ![code isEqualToString:self.machineReadableCode]) { + self.machineReadableCode = code; dispatch_async(dispatch_get_main_queue(), ^(void){ [self.delegate scannerViewController:self didScanMachineReadableCode:code]; });