From 99c1996067328ffd1ea90437e9f712170293f144 Mon Sep 17 00:00:00 2001 From: Denis Bogatyrev Date: Wed, 31 Aug 2016 09:49:19 +0400 Subject: [PATCH 1/4] Added pt-BR language in example project --- .../project.pbxproj | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Example/DBAttachmentPickerControllerExample.xcodeproj/project.pbxproj b/Example/DBAttachmentPickerControllerExample.xcodeproj/project.pbxproj index 7b2a8ca..eda8d60 100644 --- a/Example/DBAttachmentPickerControllerExample.xcodeproj/project.pbxproj +++ b/Example/DBAttachmentPickerControllerExample.xcodeproj/project.pbxproj @@ -57,6 +57,8 @@ A41C4BD31D557B1A002FEA0B /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = de; path = de.lproj/DBAttachmentPickerController.stringsdict; sourceTree = ""; }; A41C4BD51D557B9A002FEA0B /* NSBundle+DBLibrary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSBundle+DBLibrary.h"; sourceTree = ""; }; A41C4BD61D557B9A002FEA0B /* NSBundle+DBLibrary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSBundle+DBLibrary.m"; sourceTree = ""; }; + A43A510B1D76A68B00065358 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/DBAttachmentPickerController.strings"; sourceTree = ""; }; + A43A510C1D76A68B00065358 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = "pt-BR"; path = "pt-BR.lproj/DBAttachmentPickerController.stringsdict"; sourceTree = ""; }; C3134EAF1C9C30990023B9E6 /* DBAttachmentPickerControllerExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DBAttachmentPickerControllerExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; C3134EB31C9C30990023B9E6 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; C3134EB51C9C30990023B9E6 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; @@ -326,6 +328,7 @@ ja, uk, fr, + "pt-BR", ); mainGroup = C3134EA61C9C30990023B9E6; productRefGroup = C3134EB01C9C30990023B9E6 /* Products */; @@ -395,6 +398,7 @@ A401D50B1D555228006B2909 /* ja */, A401D50D1D5553CA006B2909 /* uk */, A401D50F1D55560A006B2909 /* fr */, + A43A510B1D76A68B00065358 /* pt-BR */, ); name = DBAttachmentPickerController.strings; sourceTree = ""; @@ -411,6 +415,7 @@ A401D50E1D5553ED006B2909 /* uk */, A401D5101D55560A006B2909 /* fr */, A41C4BD31D557B1A002FEA0B /* de */, + A43A510C1D76A68B00065358 /* pt-BR */, ); name = DBAttachmentPickerController.stringsdict; sourceTree = ""; From 8c239acc13464e76d832e5fea9b8e00aea16307f Mon Sep 17 00:00:00 2001 From: Denis Bogatyrev Date: Wed, 31 Aug 2016 09:50:39 +0400 Subject: [PATCH 2/4] Updated version --- DBAttachmentPickerController.podspec | 2 +- Example/DBAttachmentPickerControllerExample/Info.plist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DBAttachmentPickerController.podspec b/DBAttachmentPickerController.podspec index 5831f9b..5179791 100644 --- a/DBAttachmentPickerController.podspec +++ b/DBAttachmentPickerController.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'DBAttachmentPickerController' - s.version = '1.1.3' + s.version = '1.1.4' s.authors = { 'Denis Bogatyrev' => 'denis.bogatyrev@gmail.com' } s.summary = 'This powerful component allows to select different types of files from different sources on your device' s.homepage = 'https://github.com/d0ping/DBAttachmentPickerController' diff --git a/Example/DBAttachmentPickerControllerExample/Info.plist b/Example/DBAttachmentPickerControllerExample/Info.plist index 813e78e..7434562 100644 --- a/Example/DBAttachmentPickerControllerExample/Info.plist +++ b/Example/DBAttachmentPickerControllerExample/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.1.3 + 1.1.4 CFBundleSignature ???? CFBundleVersion From 494cb6c64d4773879b1c38bae9f1d55965387bd4 Mon Sep 17 00:00:00 2001 From: Denis Bogatyrev Date: Tue, 18 Oct 2016 10:18:33 +0400 Subject: [PATCH 3/4] Review --- .../project.pbxproj | 60 ------------------- .../Info.plist | 4 ++ .../AppIcon.appiconset/Contents.json | 20 +++++++ .../DBAttachmentAlertController.h | 2 +- .../DBAttachmentAlertController.m | 27 ++++----- Source/DBAttachmentPickerController.h | 4 +- Source/DBAttachmentPickerController.m | 26 ++++---- 7 files changed, 55 insertions(+), 88 deletions(-) diff --git a/Example/DBAttachmentPickerControllerExample.xcodeproj/project.pbxproj b/Example/DBAttachmentPickerControllerExample.xcodeproj/project.pbxproj index eda8d60..35d485f 100644 --- a/Example/DBAttachmentPickerControllerExample.xcodeproj/project.pbxproj +++ b/Example/DBAttachmentPickerControllerExample.xcodeproj/project.pbxproj @@ -7,8 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - A401D4F51D537AEC006B2909 /* DBAttachmentPickerController.strings in Resources */ = {isa = PBXBuildFile; fileRef = A401D4F71D537AEC006B2909 /* DBAttachmentPickerController.strings */; }; - A401D4FE1D5545F5006B2909 /* DBAttachmentPickerController.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = A401D5001D5545F5006B2909 /* DBAttachmentPickerController.stringsdict */; }; A41C4BD71D557B9A002FEA0B /* NSBundle+DBLibrary.m in Sources */ = {isa = PBXBuildFile; fileRef = A41C4BD61D557B9A002FEA0B /* NSBundle+DBLibrary.m */; }; C3134EB41C9C30990023B9E6 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C3134EB31C9C30990023B9E6 /* main.m */; }; C3134EB71C9C30990023B9E6 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C3134EB61C9C30990023B9E6 /* AppDelegate.m */; }; @@ -37,28 +35,8 @@ /* Begin PBXFileReference section */ A401D4F41D537A13006B2909 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/LaunchScreen.strings; sourceTree = ""; }; - A401D4F81D537AEF006B2909 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/DBAttachmentPickerController.strings; sourceTree = ""; }; - A401D4F91D537AF0006B2909 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/DBAttachmentPickerController.strings; sourceTree = ""; }; - A401D4FF1D5545F5006B2909 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/DBAttachmentPickerController.stringsdict; sourceTree = ""; }; - A401D5011D5545F7006B2909 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = ru; path = ru.lproj/DBAttachmentPickerController.stringsdict; sourceTree = ""; }; - A401D5021D554922006B2909 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/DBAttachmentPickerController.strings"; sourceTree = ""; }; - A401D5041D554AD3006B2909 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = "zh-Hans"; path = "zh-Hans.lproj/DBAttachmentPickerController.stringsdict"; sourceTree = ""; }; - A401D5051D554BD0006B2909 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/DBAttachmentPickerController.strings"; sourceTree = ""; }; - A401D5061D554BD0006B2909 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = "zh-Hant"; path = "zh-Hant.lproj/DBAttachmentPickerController.stringsdict"; sourceTree = ""; }; - A401D5071D554D71006B2909 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/DBAttachmentPickerController.strings; sourceTree = ""; }; - A401D5081D554D71006B2909 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = es; path = es.lproj/DBAttachmentPickerController.stringsdict; sourceTree = ""; }; - A401D5091D554FCD006B2909 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/DBAttachmentPickerController.strings; sourceTree = ""; }; - A401D50B1D555228006B2909 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/DBAttachmentPickerController.strings; sourceTree = ""; }; - A401D50C1D555228006B2909 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = ja; path = ja.lproj/DBAttachmentPickerController.stringsdict; sourceTree = ""; }; - A401D50D1D5553CA006B2909 /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/DBAttachmentPickerController.strings; sourceTree = ""; }; - A401D50E1D5553ED006B2909 /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = uk; path = uk.lproj/DBAttachmentPickerController.stringsdict; sourceTree = ""; }; - A401D50F1D55560A006B2909 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/DBAttachmentPickerController.strings; sourceTree = ""; }; - A401D5101D55560A006B2909 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = fr; path = fr.lproj/DBAttachmentPickerController.stringsdict; sourceTree = ""; }; - A41C4BD31D557B1A002FEA0B /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = de; path = de.lproj/DBAttachmentPickerController.stringsdict; sourceTree = ""; }; A41C4BD51D557B9A002FEA0B /* NSBundle+DBLibrary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSBundle+DBLibrary.h"; sourceTree = ""; }; A41C4BD61D557B9A002FEA0B /* NSBundle+DBLibrary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSBundle+DBLibrary.m"; sourceTree = ""; }; - A43A510B1D76A68B00065358 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/DBAttachmentPickerController.strings"; sourceTree = ""; }; - A43A510C1D76A68B00065358 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = "pt-BR"; path = "pt-BR.lproj/DBAttachmentPickerController.stringsdict"; sourceTree = ""; }; C3134EAF1C9C30990023B9E6 /* DBAttachmentPickerControllerExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DBAttachmentPickerControllerExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; C3134EB31C9C30990023B9E6 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; C3134EB51C9C30990023B9E6 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; @@ -116,8 +94,6 @@ A401D4F11D5378F2006B2909 /* Localization */ = { isa = PBXGroup; children = ( - A401D4F71D537AEC006B2909 /* DBAttachmentPickerController.strings */, - A401D5001D5545F5006B2909 /* DBAttachmentPickerController.stringsdict */, ); name = Localization; path = ../../Source/Localization; @@ -349,9 +325,7 @@ C3134EC21C9C30990023B9E6 /* LaunchScreen.storyboard in Resources */, C3849AB61C9C3D8C00D12EEF /* DBAssetGroupsViewController.xib in Resources */, C3134EEB1C9C323C0023B9E6 /* DBAssetGroupCell.xib in Resources */, - A401D4FE1D5545F5006B2909 /* DBAttachmentPickerController.stringsdict in Resources */, C3134EED1C9C323C0023B9E6 /* DBThumbnailPhotoCell.xib in Resources */, - A401D4F51D537AEC006B2909 /* DBAttachmentPickerController.strings in Resources */, C3134EFC1C9C34340023B9E6 /* Assets.xcassets in Resources */, C3134EBD1C9C30990023B9E6 /* Main.storyboard in Resources */, ); @@ -386,40 +360,6 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ - A401D4F71D537AEC006B2909 /* DBAttachmentPickerController.strings */ = { - isa = PBXVariantGroup; - children = ( - A401D4F81D537AEF006B2909 /* en */, - A401D4F91D537AF0006B2909 /* ru */, - A401D5021D554922006B2909 /* zh-Hans */, - A401D5051D554BD0006B2909 /* zh-Hant */, - A401D5071D554D71006B2909 /* es */, - A401D5091D554FCD006B2909 /* de */, - A401D50B1D555228006B2909 /* ja */, - A401D50D1D5553CA006B2909 /* uk */, - A401D50F1D55560A006B2909 /* fr */, - A43A510B1D76A68B00065358 /* pt-BR */, - ); - name = DBAttachmentPickerController.strings; - sourceTree = ""; - }; - A401D5001D5545F5006B2909 /* DBAttachmentPickerController.stringsdict */ = { - isa = PBXVariantGroup; - children = ( - A401D4FF1D5545F5006B2909 /* en */, - A401D5011D5545F7006B2909 /* ru */, - A401D5041D554AD3006B2909 /* zh-Hans */, - A401D5061D554BD0006B2909 /* zh-Hant */, - A401D5081D554D71006B2909 /* es */, - A401D50C1D555228006B2909 /* ja */, - A401D50E1D5553ED006B2909 /* uk */, - A401D5101D55560A006B2909 /* fr */, - A41C4BD31D557B1A002FEA0B /* de */, - A43A510C1D76A68B00065358 /* pt-BR */, - ); - name = DBAttachmentPickerController.stringsdict; - sourceTree = ""; - }; C3134EBB1C9C30990023B9E6 /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( diff --git a/Example/DBAttachmentPickerControllerExample/Info.plist b/Example/DBAttachmentPickerControllerExample/Info.plist index 7434562..81b97b8 100644 --- a/Example/DBAttachmentPickerControllerExample/Info.plist +++ b/Example/DBAttachmentPickerControllerExample/Info.plist @@ -43,5 +43,9 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + NSCameraUsageDescription + + NSPhotoLibraryUsageDescription + diff --git a/Example/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json index eeea76c..1d060ed 100644 --- a/Example/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/Example/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "29x29", @@ -30,6 +40,16 @@ "size" : "60x60", "scale" : "3x" }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, { "idiom" : "ipad", "size" : "29x29", diff --git a/Source/DBAttachmentAlertController/DBAttachmentAlertController.h b/Source/DBAttachmentAlertController/DBAttachmentAlertController.h index a5121c3..a34d0e4 100644 --- a/Source/DBAttachmentAlertController/DBAttachmentAlertController.h +++ b/Source/DBAttachmentAlertController/DBAttachmentAlertController.h @@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN allowsMultipleSelection:(BOOL)allowsMultipleSelection allowsMediaLibrary:(BOOL)allowsPhotoOrVideo allowsOtherApps:(BOOL)allowsOtherApps - customActions:(NSArray *) customActions + customActions:(nullable NSArray *) customActions attachHandler:(nullable AlertAttachAssetsHandler)attachHandler allAlbumsHandler:(nullable AlertActionHandler)allAlbumsHandler takePictureHandler:(nullable AlertActionHandler)takePictureHandler diff --git a/Source/DBAttachmentAlertController/DBAttachmentAlertController.m b/Source/DBAttachmentAlertController/DBAttachmentAlertController.m index 0683d93..a09ff8c 100644 --- a/Source/DBAttachmentAlertController/DBAttachmentAlertController.m +++ b/Source/DBAttachmentAlertController/DBAttachmentAlertController.m @@ -35,7 +35,7 @@ @interface DBAttachmentAlertController () 0) { - controller.customActions = customActions; + controller.customActions = [NSMutableArray arrayWithArray:customActions]; } if (showPhotoOrVideo && controller.assetsFetchResult.count ) { diff --git a/Source/DBAttachmentPickerController.h b/Source/DBAttachmentPickerController.h index e0bffac..0478da2 100644 --- a/Source/DBAttachmentPickerController.h +++ b/Source/DBAttachmentPickerController.h @@ -68,7 +68,7 @@ typedef void (^CancelBlock)(); /*! @brief Used to determine maximum video recording duration */ -@property (assign, nonatomic) NSTimeInterval capturedMaximumDuration; // default is 0 +@property (assign, nonatomic) NSTimeInterval capturedMaximumDuration; // default is 0 /*! @brief Used to add Other Apps button @@ -82,7 +82,7 @@ typedef void (^CancelBlock)(); */ @property (assign, nonatomic) BOOL allowsMultipleSelection; // default is NO -+ (instancetype)attachmentPickerControllerWithCustomActions:(NSArray *)customActions ++ (instancetype)attachmentPickerControllerWithCustomActions:(nullable NSArray *)customActions FinishPickingBlock:(FinishPickingBlock)finishPickingBlock cancelBlock:(_Nullable CancelBlock)cancelBlock; diff --git a/Source/DBAttachmentPickerController.m b/Source/DBAttachmentPickerController.m index 071e7ec..c02b8ce 100644 --- a/Source/DBAttachmentPickerController.m +++ b/Source/DBAttachmentPickerController.m @@ -43,16 +43,19 @@ @interface DBAttachmentPickerController () *attachmentArray = [weakSelf attachmentArrayFromPHAssetArray:assetArray]; [weakSelf finishPickingWithAttachmentArray:attachmentArray]; } allAlbumsHandler:^(UIAlertAction *action) { - weakSelf.selectedItems = self.selectedItems; - weakSelf.maxItems = self.maxItems; + weakSelf.selectedItems = weakSelf.selectedItems; + weakSelf.maxItems = weakSelf.maxItems; - if (self.customPredicate) { - weakSelf.customPredicate = self.customPredicate; + if (weakSelf.customPredicate) { + weakSelf.customPredicate = weakSelf.customPredicate; } [weakSelf allAlbumsDidSelect]; } takePictureHandler:^(UIAlertAction *action) { @@ -180,6 +183,7 @@ - (void)presentOnViewController:(UIViewController *)initialViewController { self.alertController.selectedItems = self.selectedItems; self.alertController.maxItems = self.maxItems; self.alertController.customPredicate = self.customPredicate; + self.alertController.popoverPresentationController.sourceView = [self popoverPresentationView]; self.alertController.popoverPresentationController.sourceRect = [self popoverPresentationRect]; self.alertController.popoverPresentationController.permittedArrowDirections = [self popoverPresentationArrowDirection]; From f93ec8b63cd561688d64931d9f15ad1c281a4e33 Mon Sep 17 00:00:00 2001 From: Denis Bogatyrev Date: Tue, 18 Oct 2016 12:15:40 +0400 Subject: [PATCH 4/4] Review continued --- Source/Categories/NSBundle+DBLibrary.m | 4 ++- .../DBAssetPickerController.h | 9 +++-- .../DBAssetPickerController.m | 1 - .../DBAttachmentAlertController.h | 9 +++-- .../DBAttachmentAlertController.m | 33 ++++++++----------- Source/DBAttachmentPickerController.h | 7 ++-- Source/Models/DBAttachment.h | 4 ++- Source/Models/DBAttachment.m | 1 + 8 files changed, 37 insertions(+), 31 deletions(-) diff --git a/Source/Categories/NSBundle+DBLibrary.m b/Source/Categories/NSBundle+DBLibrary.m index beaa159..cc388e1 100644 --- a/Source/Categories/NSBundle+DBLibrary.m +++ b/Source/Categories/NSBundle+DBLibrary.m @@ -38,7 +38,9 @@ + (instancetype)dbAttachmentPickerResourceBundle { // but in framework bundle bundlePath = [[NSBundle bundleForClass:[DBAttachmentPickerController class]] pathForResource:@"DBAttachmentPickerController" ofType:@"bundle"]; } - bundle = [NSBundle bundleWithPath:bundlePath]; + if (bundlePath) { + bundle = [NSBundle bundleWithPath:bundlePath]; + } return bundle; } diff --git a/Source/DBAssetPickerController/DBAssetPickerController.h b/Source/DBAssetPickerController/DBAssetPickerController.h index 35e7cda..1f7ddd4 100755 --- a/Source/DBAssetPickerController/DBAssetPickerController.h +++ b/Source/DBAssetPickerController/DBAssetPickerController.h @@ -25,6 +25,7 @@ @protocol DBAssetPickerControllerDelegate NS_ASSUME_NONNULL_BEGIN + @optional - (void)DBAssetPickerController:(DBAssetPickerController *)controller didFinishPickingAssetArray:(NSArray *)assetArray; - (void)DBAssetPickerControllerDidCancel:(DBAssetPickerController *)controller; @@ -36,9 +37,11 @@ NS_ASSUME_NONNULL_BEGIN @property (weak, nonatomic, nullable) id assetPickerDelegate; @property (assign, nonatomic) PHAssetMediaType assetMediaType; -@property (nonatomic, assign, nonnull) NSArray *selectedItems; -@property (nonatomic, assign, nullable) NSPredicate *customPredicate; -@property (nonatomic, retain, nonnull) NSNumber *maxItems; + +@property (strong, nonatomic) NSArray *selectedItems; +@property (strong, nonatomic, nullable) NSPredicate *customPredicate; +@property (strong, nonatomic) NSNumber *maxItems; + NS_ASSUME_NONNULL_END @end diff --git a/Source/DBAssetPickerController/DBAssetPickerController.m b/Source/DBAssetPickerController/DBAssetPickerController.m index c87ad3b..1791e07 100755 --- a/Source/DBAssetPickerController/DBAssetPickerController.m +++ b/Source/DBAssetPickerController/DBAssetPickerController.m @@ -41,7 +41,6 @@ - (void)viewDidLoad { } groupController.assetGroupsDelegate = self; [self setViewControllers:@[groupController]]; - } #pragma mark - DBAssetGroupsViewControllerDelegate diff --git a/Source/DBAttachmentAlertController/DBAttachmentAlertController.h b/Source/DBAttachmentAlertController/DBAttachmentAlertController.h index a34d0e4..61af7ee 100644 --- a/Source/DBAttachmentAlertController/DBAttachmentAlertController.h +++ b/Source/DBAttachmentAlertController/DBAttachmentAlertController.h @@ -25,13 +25,15 @@ typedef void (^AlertAttachAssetsHandler)(NSArray * _Nonnull assetArray); typedef void (^AlertActionHandler)(UIAlertAction * _Nonnull action); @interface DBAttachmentAlertController : UIAlertController -@property (assign, nonatomic) NSNumber * _Nonnull maxItems; NS_ASSUME_NONNULL_BEGIN + @property (assign, nonatomic, readonly) PHAssetMediaType assetMediaType; @property (assign, nonatomic, readonly) BOOL allowsMultipleSelection; -@property (assign, nonatomic) NSArray *selectedItems; -@property (assign, nonatomic) NSPredicate *customPredicate; + +@property (strong, nonatomic) NSNumber *maxItems; +@property (strong, nonatomic) NSArray *selectedItems; +@property (strong, nonatomic) NSPredicate *customPredicate; + (_Nonnull instancetype)attachmentAlertControllerWithMediaType:(PHAssetMediaType)assetMediaType allowsMultipleSelection:(BOOL)allowsMultipleSelection @@ -54,6 +56,7 @@ NS_ASSUME_NONNULL_BEGIN takePictureHandler:(nullable AlertActionHandler)takePictureHandler otherAppsHandler:(nullable AlertActionHandler)otherAppsHandler cancelHandler:(nullable AlertActionHandler)cancelHandler; + NS_ASSUME_NONNULL_END @end diff --git a/Source/DBAttachmentAlertController/DBAttachmentAlertController.m b/Source/DBAttachmentAlertController/DBAttachmentAlertController.m index a09ff8c..12d1028 100644 --- a/Source/DBAttachmentAlertController/DBAttachmentAlertController.m +++ b/Source/DBAttachmentAlertController/DBAttachmentAlertController.m @@ -125,14 +125,14 @@ + (_Nonnull instancetype)attachmentAlertControllerWithMediaType:(PHAssetMediaTyp NSString *buttonTitle; switch (controller.assetMediaType) { case PHAssetMediaTypeVideo: - buttonTitle = NSLocalizedString(@"Take a video", @"Button on main menu"); - break; + buttonTitle = NSLocalizedString(@"Take a video", @"Button on main menu"); + break; case PHAssetMediaTypeImage: - buttonTitle = NSLocalizedString(@"Take a picture", @"Button on main menu"); - break; + buttonTitle = NSLocalizedString(@"Take a picture", @"Button on main menu"); + break; default: - buttonTitle = NSLocalizedString(@"Take a picture or a video", @"Button on main menu"); - break; + buttonTitle = NSLocalizedString(@"Take a picture or a video", @"Button on main menu"); + break; } UIAlertAction *cameraAction = [UIAlertAction actionWithTitle:buttonTitle style:UIAlertActionStyleDefault handler:takePictureHandler]; [controller addAction:cameraAction]; @@ -143,7 +143,6 @@ + (_Nonnull instancetype)attachmentAlertControllerWithMediaType:(PHAssetMediaTyp [controller addAction:otherAppsAction]; } - __weak DBAttachmentAlertController *weakController = controller; NSArray *actions = weakController.customActions; if (actions.count > 0) { @@ -162,10 +161,10 @@ + (_Nonnull instancetype)attachmentAlertControllerWithMediaType:(PHAssetMediaTyp - (void)viewDidLoad { [super viewDidLoad]; + self.selectedIndexPathArray = [NSMutableArray arrayWithCapacity:100]; self.oldSelectedIndexPathArray = [NSMutableArray new]; - if (self.showCollectionView) { UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init]; [flowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal]; @@ -211,23 +210,12 @@ - (void)viewDidLoad { [[PHPhotoLibrary sharedPhotoLibrary] registerChangeObserver:self]; } } -- (void) orderByIndexPath: (NSMutableArray * )array { - [self.selectedIndexPathArray sortUsingComparator:^NSComparisonResult(id obj1, id obj2) { - NSIndexPath *indexPath1 = obj1; - NSIndexPath *indexPath2 = obj2; - return [@(indexPath1.row) compare:@(indexPath2.row)]; - }]; - -} - (void) viewWillLayoutSubviews { [super viewWillLayoutSubviews]; [self recalculateVisibleCellsSelectorOffsetWithScrollViewOffsetX:self.collectionView.contentOffset.x]; [self updateAttachPhotoCountIfNedded]; } -- (void)viewDidAppear:(BOOL)animated { - [super viewDidAppear:animated]; -} - (void)dealloc { if (self.showCollectionView) { @@ -270,6 +258,12 @@ - (NSArray *)getSelectedAssetArray { return [assetArray copy]; } +//- (void)orderByIndexPath:(NSMutableArray *) array { +// [self.selectedIndexPathArray sortUsingComparator:^NSComparisonResult(NSIndexPath *indexPath1, NSIndexPath *indexPath2) { +// return [@(indexPath1.row) compare:@(indexPath2.row)]; +// }]; +//} + #pragma mark - Accessors - (void)setNeedsDisplayEmptySelectedIndicator:(BOOL)needsDisplayEmptySelectedIndicator { @@ -419,7 +413,6 @@ - (void) selectItemAtIndex: (NSIndexPath *) indexPath { } else { self.extensionAttachHandler([self getSelectedAssetArray]); } - } - (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath { diff --git a/Source/DBAttachmentPickerController.h b/Source/DBAttachmentPickerController.h index 0478da2..b432a46 100644 --- a/Source/DBAttachmentPickerController.h +++ b/Source/DBAttachmentPickerController.h @@ -40,9 +40,12 @@ typedef void (^FinishVideoPickingBlock)(NSArray* resourceArray); typedef void (^CancelBlock)(); @interface DBAttachmentPickerController : NSObject + +// TODO: Needs add descriptions for new properties @property (nonatomic, retain, nullable) NSPredicate *customPredicate; @property (nonatomic, retain, nullable) NSNumber *maxItems; @property (nonatomic, retain, nullable) NSArray *selectedItems; + /*! @brief Used to provide opportunity to correctly calculate position popover view when app works on iPad. You can specify UIButton, UITableViewCell, etc. instance to which the user touched. @attention The parameter must contain only UIView subclass instance or nil @@ -63,8 +66,8 @@ typedef void (^CancelBlock)(); @brief Used to determine the quality of the captured video from camera */ @property (assign, nonatomic) UIImagePickerControllerQualityType capturedVideoQulity; // default is UIImagePickerControllerQualityTypeMedium - - + +// TODO: Needs add to README /*! @brief Used to determine maximum video recording duration */ diff --git a/Source/Models/DBAttachment.h b/Source/Models/DBAttachment.h index 7a1f4a9..e67da83 100644 --- a/Source/Models/DBAttachment.h +++ b/Source/Models/DBAttachment.h @@ -31,7 +31,9 @@ typedef NS_ENUM(NSInteger, DBAttachmentSourceType) { @class PHAsset; @interface DBAttachment : NSObject -@property (strong, nonatomic, nullable) PHAsset *photoAsset; + +// TODO: Needs add description +@property (strong, nonatomic, readonly, nullable) PHAsset *photoAsset; /*! @brief The name of the file. Can be empty. diff --git a/Source/Models/DBAttachment.m b/Source/Models/DBAttachment.m index a686bfc..dac69fd 100644 --- a/Source/Models/DBAttachment.m +++ b/Source/Models/DBAttachment.m @@ -33,6 +33,7 @@ @interface DBAttachment () @property (assign, nonatomic) DBAttachmentSourceType sourceType; @property (assign, nonatomic) DBAttachmentMediaType mediaType; +@property (strong, nonatomic) PHAsset *photoAsset; @property (strong, nonatomic) UIImage *image; @property (strong, nonatomic) UIImage *thumbmailImage; @property (strong, nonatomic) NSString *originalFilePath;