diff --git a/DBCamera/Controllers/DBCameraContainerViewController.h b/DBCamera/Controllers/DBCameraContainerViewController.h old mode 100644 new mode 100755 index 00c7cde..f25bbbd --- a/DBCamera/Controllers/DBCameraContainerViewController.h +++ b/DBCamera/Controllers/DBCameraContainerViewController.h @@ -10,8 +10,7 @@ #import "DBCameraDelegate.h" #import "UIViewController+UIViewController_FullScreen.h" -@class DBCameraView; -@class DBCameraViewController; +@class DBCameraView, DBCameraViewController, DBCameraConfiguration; /** * The camera settings block @@ -35,6 +34,11 @@ typedef void(^CameraSettingsBlock)(DBCameraView *cameraView, id container); */ @property (nonatomic, strong) DBCameraViewController *cameraViewController; +/** + * Contains additional configuration for camera controllers + */ +@property (nonatomic, strong) DBCameraConfiguration *cameraConfiguration; + /** * The init method with a DBCameraViewControllerDelegate * @@ -42,7 +46,7 @@ typedef void(^CameraSettingsBlock)(DBCameraView *cameraView, id container); * * @return A DBCameraContainerViewController */ -- (id) initWithDelegate:(id)delegate; +- (instancetype) initWithDelegate:(id)delegate; /** * The init method with a DBCameraViewControllerDelegate and a CameraSettingsBlock @@ -52,5 +56,30 @@ typedef void(^CameraSettingsBlock)(DBCameraView *cameraView, id container); * * @return DBCameraContainerViewController */ -- (id) initWithDelegate:(id)delegate cameraSettingsBlock:(CameraSettingsBlock)block; +- (instancetype) initWithDelegate:(id)delegate + cameraSettingsBlock:(CameraSettingsBlock)block; + +/** + * The init method with a DBCameraViewControllerDelegate and a CameraConfiguration + * + * @param delegate The DBCameraViewControllerDelegate + * @param cameraConfiguration The CameraConfiguration containing customization for controllers + * + * @return DBCameraContainerViewController + */ +- (instancetype) initWithDelegate:(id)delegate + cameraConfiguration:(DBCameraConfiguration *)cameraConfiguration; + +/** + * The init method with a DBCameraViewControllerDelegate and a CameraConfiguration + * + * @param delegate The DBCameraViewControllerDelegate + * @param cameraConfiguration The CameraConfiguration containing customization for controllers + * @param block The CameraSettingsBlock + * + * @return DBCameraContainerViewController + */ +- (instancetype) initWithDelegate:(id)delegate + cameraConfiguration:(DBCameraConfiguration *)cameraConfiguration + cameraSettingsBlock:(CameraSettingsBlock)block; @end \ No newline at end of file diff --git a/DBCamera/Controllers/DBCameraContainerViewController.m b/DBCamera/Controllers/DBCameraContainerViewController.m old mode 100644 new mode 100755 index 9712bdd..baab473 --- a/DBCamera/Controllers/DBCameraContainerViewController.m +++ b/DBCamera/Controllers/DBCameraContainerViewController.m @@ -23,20 +23,36 @@ @implementation DBCameraContainerViewController @synthesize tintColor = _tintColor; @synthesize selectedTintColor = _selectedTintColor; -- (id) initWithDelegate:(id)delegate +- (instancetype) initWithDelegate:(id)delegate { return [self initWithDelegate:delegate cameraSettingsBlock:nil]; } -- (id) initWithDelegate:(id)delegate cameraSettingsBlock:(CameraSettingsBlock)block +- (instancetype) initWithDelegate:(id)delegate cameraSettingsBlock:(CameraSettingsBlock)block { + return [self initWithDelegate:delegate cameraConfiguration:nil cameraSettingsBlock:block]; +} + +- (instancetype) initWithDelegate:(id)delegate + cameraConfiguration:(DBCameraConfiguration *)cameraConfiguration +{ + return [self initWithDelegate:delegate cameraConfiguration:cameraConfiguration cameraSettingsBlock:nil]; +} + +- (instancetype) initWithDelegate:(id)delegate + cameraConfiguration:(DBCameraConfiguration *)cameraConfiguration + cameraSettingsBlock:(CameraSettingsBlock)block +{ + self = [super init]; if ( self ) { _delegate = delegate; _settingsBlock = block; + _cameraConfiguration = cameraConfiguration; } return self; + } - (void) viewDidLoad @@ -100,6 +116,7 @@ - (DBCameraViewController *) defaultCameraViewController [_defaultCameraViewController setTintColor:self.tintColor]; if ( self.selectedTintColor ) [_defaultCameraViewController setSelectedTintColor:self.selectedTintColor]; + _defaultCameraViewController.cameraConfiguration = self.cameraConfiguration; } if ( !self.cameraViewController ) diff --git a/DBCamera/Controllers/DBCameraLibraryViewController.h b/DBCamera/Controllers/DBCameraLibraryViewController.h old mode 100644 new mode 100755 index b09a47e..75b880c --- a/DBCamera/Controllers/DBCameraLibraryViewController.h +++ b/DBCamera/Controllers/DBCameraLibraryViewController.h @@ -9,7 +9,7 @@ #import #import "DBCameraDelegate.h" -@class DBCameraSegueViewController; +@class DBCameraSegueViewController, DBCameraConfiguration; /** * DBCameraLibraryViewController @@ -30,6 +30,11 @@ */ @property (nonatomic, assign) NSUInteger libraryMaxImageSize; +/** + * Contains additional configuration for camera controllers + */ +@property (nonatomic, strong) DBCameraConfiguration *cameraConfiguration; + /** * The init method with an DBCameraContainerDelegate object * diff --git a/DBCamera/Controllers/DBCameraLibraryViewController.m b/DBCamera/Controllers/DBCameraLibraryViewController.m old mode 100644 new mode 100755 index 1ed9289..74a0597 --- a/DBCamera/Controllers/DBCameraLibraryViewController.m +++ b/DBCamera/Controllers/DBCameraLibraryViewController.m @@ -369,6 +369,7 @@ - (void) collectionView:(UICollectionView *)collectionView itemURL:(NSURL *)URL [segue enableGestures:YES]; [segue setCapturedImageMetadata:metadata]; [segue setDelegate:weakSelf.delegate]; + [segue setCameraConfiguration:weakSelf.cameraConfiguration]; [segue setCameraSegueConfigureBlock:self.cameraSegueConfigureBlock]; [weakSelf.navigationController pushViewController:segue animated:YES]; diff --git a/DBCamera/Controllers/DBCameraSegueViewController.h b/DBCamera/Controllers/DBCameraSegueViewController.h old mode 100644 new mode 100755 index a343ea2..654ea26 --- a/DBCamera/Controllers/DBCameraSegueViewController.h +++ b/DBCamera/Controllers/DBCameraSegueViewController.h @@ -9,13 +9,14 @@ #import "DBCameraBaseCropViewController.h" #import "DBCameraDelegate.h" #import "UIViewController+UIViewController_FullScreen.h" +#import "DBPhotoProcessingControllerProtocol.h" -@class DBCameraFiltersView; +@class DBCameraFiltersView, DBCameraConfiguration; /** * DBCameraSegueViewController */ -@interface DBCameraSegueViewController : DBCameraBaseCropViewController +@interface DBCameraSegueViewController : DBCameraBaseCropViewController /** * An id object compliant with the DBCameraContainerDelegate */ @@ -41,6 +42,11 @@ */ @property (nonatomic, readonly) NSIndexPath *selectedFilterIndex; +/** + * Contains additional configuration for camera controllers + */ +@property (nonatomic, strong) DBCameraConfiguration *cameraConfiguration; + /** * The init method with the captured image and thumb * diff --git a/DBCamera/Controllers/DBCameraSegueViewController.m b/DBCamera/Controllers/DBCameraSegueViewController.m old mode 100644 new mode 100755 index d6e23e0..ef440cd --- a/DBCamera/Controllers/DBCameraSegueViewController.m +++ b/DBCamera/Controllers/DBCameraSegueViewController.m @@ -15,6 +15,7 @@ #import "UIImage+TintColor.h" #import "UIImage+Bundle.h" #import "GrayscaleContrastFilter.h" +#import "DBCameraConfiguration.h" #import @@ -41,7 +42,7 @@ @interface DBCameraSegueViewController () +#import "DBPhotoProcessingControllerProtocol.h" + +@interface DBCameraConfiguration : NSObject + +@property (nonatomic, nullable, copy) void (^configureProcessingController)(UIViewController * _Nonnull controller); + +@end diff --git a/DBCamera/Objects/DBCameraConfiguration.m b/DBCamera/Objects/DBCameraConfiguration.m new file mode 100644 index 0000000..6b696cc --- /dev/null +++ b/DBCamera/Objects/DBCameraConfiguration.m @@ -0,0 +1,15 @@ +// +// DBCameraConfiguration.m +// DBCamera +// +// Created by Nikita Tuk on 09/10/16. +// Copyright © 2016 PSSD - Daniele Bogo. All rights reserved. +// + +#import "DBCameraConfiguration.h" + +@implementation DBCameraConfiguration + + + +@end diff --git a/DBCamera/Objects/DBPhotoProcessingControllerProtocol.h b/DBCamera/Objects/DBPhotoProcessingControllerProtocol.h new file mode 100644 index 0000000..6cc1638 --- /dev/null +++ b/DBCamera/Objects/DBPhotoProcessingControllerProtocol.h @@ -0,0 +1,14 @@ +// +// DBPhotoProcessingControllerProtocol.h +// DBCamera +// +// Created by Nikita Tuk on 09/10/16. +// Copyright © 2016 PSSD - Daniele Bogo. All rights reserved. +// + +@protocol DBPhotoProcessingControllerProtocol + +@property (nonatomic, nonnull, strong, readonly) UIButton *cropButton; +@property (nonatomic, assign) BOOL filtersBarVisible; + +@end \ No newline at end of file diff --git a/Example/DBCamera.xcodeproj/project.pbxproj b/Example/DBCamera.xcodeproj/project.pbxproj old mode 100644 new mode 100755 index cb2eb8c..2ea1482 --- a/Example/DBCamera.xcodeproj/project.pbxproj +++ b/Example/DBCamera.xcodeproj/project.pbxproj @@ -54,6 +54,7 @@ 9ABB69A219587983007E2B9E /* UIImage+Asset.m in Sources */ = {isa = PBXBuildFile; fileRef = 9ABB69A119587983007E2B9E /* UIImage+Asset.m */; }; 9E8E34E51AFFABC600B451B1 /* (null) in Sources */ = {isa = PBXBuildFile; }; A7CB737F1B68107B0017336F /* DBCamera.bundle in Resources */ = {isa = PBXBuildFile; fileRef = A7CB737E1B68107B0017336F /* DBCamera.bundle */; }; + ABB9D8F11DAA7D5700B64899 /* DBCameraConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = ABB9D8EE1DAA718D00B64899 /* DBCameraConfiguration.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -144,6 +145,9 @@ 9ABB69A119587983007E2B9E /* UIImage+Asset.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Asset.m"; sourceTree = ""; }; 9ABDB6E6195391A500A1539D /* tr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = tr; path = tr.lproj/InfoPlist.strings; sourceTree = ""; }; A7CB737E1B68107B0017336F /* DBCamera.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = DBCamera.bundle; path = ../../DBCamera/Localizations/DBCamera.bundle; sourceTree = ""; }; + ABB9D8ED1DAA718D00B64899 /* DBCameraConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBCameraConfiguration.h; sourceTree = ""; }; + ABB9D8EE1DAA718D00B64899 /* DBCameraConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DBCameraConfiguration.m; sourceTree = ""; }; + ABB9D8F01DAA720500B64899 /* DBPhotoProcessingControllerProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DBPhotoProcessingControllerProtocol.h; sourceTree = ""; }; F9DFA4FE58E901A1BE1FE253 /* Pods-DBCamera.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DBCamera.release.xcconfig"; path = "Pods/Target Support Files/Pods-DBCamera/Pods-DBCamera.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -275,6 +279,9 @@ 9A1F4A77191C20CB0084C305 /* DBCollectionViewFlowLayout.m */, 9A2237F519894BAC0084BFD7 /* DBMotionManager.h */, 9A2237F619894BAC0084BFD7 /* DBMotionManager.m */, + ABB9D8ED1DAA718D00B64899 /* DBCameraConfiguration.h */, + ABB9D8EE1DAA718D00B64899 /* DBCameraConfiguration.m */, + ABB9D8F01DAA720500B64899 /* DBPhotoProcessingControllerProtocol.h */, ); name = Objects; path = ../../DBCamera/Objects; @@ -429,7 +436,7 @@ ORGANIZATIONNAME = "PSSD - Daniele Bogo"; TargetAttributes = { 9AB5979F189BAF9A001BCAD3 = { - DevelopmentTeam = Q3SKDBM9PM; + DevelopmentTeam = 5H24V53G7B; }; }; }; @@ -517,6 +524,7 @@ buildActionMask = 2147483647; files = ( 9E8E34E51AFFABC600B451B1 /* (null) in Sources */, + ABB9D8F11DAA7D5700B64899 /* DBCameraConfiguration.m in Sources */, 9A1F4A87191C20CB0084C305 /* DBLibraryManager.m in Sources */, 189DC46C1A4DD02A005F686B /* GrayscaleContrastFilter.m in Sources */, 9A1F4A8B191C20CB0084C305 /* DBCameraGridView.m in Sources */, @@ -653,6 +661,8 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "DBCamera/DBCamera-Prefix.pch"; INFOPLIST_FILE = "$(SRCROOT)/DBCamera/DBCamera-Info.plist"; @@ -670,6 +680,8 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "DBCamera/DBCamera-Prefix.pch"; INFOPLIST_FILE = "$(SRCROOT)/DBCamera/DBCamera-Info.plist"; diff --git a/Example/DBCamera/Classes/Root/RootViewController.m b/Example/DBCamera/Classes/Root/RootViewController.m old mode 100644 new mode 100755 index a158cc6..59e632b --- a/Example/DBCamera/Classes/Root/RootViewController.m +++ b/Example/DBCamera/Classes/Root/RootViewController.m @@ -13,6 +13,7 @@ #import "DBCameraLibraryViewController.h" #import "CustomCamera.h" #import "DBCameraGridView.h" +#import "DBCameraConfiguration.h" @interface DetailViewController : UIViewController { UIImageView *_imageView; @@ -136,8 +137,20 @@ - (void) openCamera [cameraContainer setTintColor:[UIColor redColor]]; [cameraContainer setSelectedTintColor:[UIColor yellowColor]]; */ + + + DBCameraConfiguration *configuration = [[DBCameraConfiguration alloc] init]; + configuration.configureProcessingController = ^(UIViewController * _Nonnull controller) { + + // You can hide cropButton on filter picking controller + // controller.cropButton.hidden = YES; + + // You can disable filter bar + // controller.filtersBarVisible = NO; + + }; - DBCameraContainerViewController *cameraContainer = [[DBCameraContainerViewController alloc] initWithDelegate:self]; + DBCameraContainerViewController *cameraContainer = [[DBCameraContainerViewController alloc] initWithDelegate:self cameraConfiguration:configuration]; [cameraContainer setFullScreenMode]; DemoNavigationController *nav = [[DemoNavigationController alloc] initWithRootViewController:cameraContainer];