diff --git a/.bundle/config b/.bundle/config new file mode 100644 index 00000000..23692288 --- /dev/null +++ b/.bundle/config @@ -0,0 +1,2 @@ +--- +BUNDLE_PATH: "vendor/bundle" diff --git a/.circleci/config.yml b/.circleci/config.yml index 9f80a117..548b2320 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,22 +9,22 @@ workflows: jobs: - ios/test: name: Test - xcode-version: "11.0" + xcode-version: "11.2.1" cocoapods-working-directory: Example workspace: Example/WPMediaPicker.xcworkspace scheme: WPMediaPicker-Example device: iPhone 11 - ios-version: "13.0" + ios-version: "13.2.2" bundle-install: true pod-install: true - ios/validate-podspec: name: Validate Podspec - xcode-version: "11.0" + xcode-version: "11.2.1" podspec-path: WPMediaPicker.podspec bundle-install: true - ios/publish-podspec: name: Publish to Trunk - xcode-version: "11.0" + xcode-version: "11.2.1" podspec-path: WPMediaPicker.podspec bundle-install: true post-to-slack: true diff --git a/.gitignore b/.gitignore index a7bf3a13..6996b13f 100644 --- a/.gitignore +++ b/.gitignore @@ -19,9 +19,6 @@ DerivedData *.hmap *.ipa -# Bundler -.bundle - # We recommend against adding the Pods directory to your .gitignore. However # you should judge for yourself, the pros and cons are mentioned at: # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 00000000..e46a05b1 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.6.4 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ab3e1e4b..01ce71e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,9 +3,9 @@ All notable changes to this project will be documented in this file. `WPMediaPicker` adheres to [Semantic Versioning](http://semver.org/). #### Releases -- `1.6.0` Release - [1.5](#1.6.0) +- `1.6.0` Release - [1.6](#1.6.0) - `1.5.0` Release - [1.5](#1.5.0) -- `1.4.2` Release - [1.4](#1.4.2) +- `1.4.2` Release - [1.4.2](#1.4.2) - `1.4` Release - [1.4](#1.4) - `1.3.4` Release - [1.3.4](#1.3.4) - `1.3` Release - [1.3](#1.3) diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 46a3efd8..466928b3 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - WPMediaPicker (1.6.0) + - WPMediaPicker (1.6.1-beta.1) DEPENDENCIES: - WPMediaPicker (from `../`) @@ -9,7 +9,7 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - WPMediaPicker: e5d28197da6b467d4e5975d64a49255977e39455 + WPMediaPicker: 370b1c1597afc0dd3664c361748fdfd13530d4c6 PODFILE CHECKSUM: 6b0e391139d3864c72fde997a1418dbfe9bf5126 diff --git a/Example/WPMediaPicker.xcodeproj/project.pbxproj b/Example/WPMediaPicker.xcodeproj/project.pbxproj index f18210f6..8559bd3b 100644 --- a/Example/WPMediaPicker.xcodeproj/project.pbxproj +++ b/Example/WPMediaPicker.xcodeproj/project.pbxproj @@ -24,8 +24,8 @@ 702AD5F17F8916AABC105A1B /* libPods-WPMediaPicker.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8C1CDA09FDF3F25E866D8A4D /* libPods-WPMediaPicker.a */; }; AE22BBE03B862A6657E6B66E /* libPods-Tests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6E1E578A5967DE531E1AC701 /* libPods-Tests.a */; }; B5FF3BEA1CAD8AB100C1D597 /* PostProcessingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B5FF3BE91CAD8AB100C1D597 /* PostProcessingViewController.m */; }; + CEDE0D8F2419808A00CB3345 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CEDE0D8E2419808A00CB3345 /* Launch Screen.storyboard */; }; FF355D9E1FB5EB4A00244E6D /* WPPHAssetDataSource+Search.m in Sources */ = {isa = PBXBuildFile; fileRef = FF355D9D1FB5EB4A00244E6D /* WPPHAssetDataSource+Search.m */; }; - FFC3F6F31B0D9BB100EFC359 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = FFC3F6F21B0D9BB100EFC359 /* Launch Screen.xib */; }; FFE69A1D1B14AB840073C2EB /* OptionsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FFE69A1C1B14AB840073C2EB /* OptionsViewController.m */; }; FFFFD8811A447E67000FC184 /* DemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FFFFD8801A447E67000FC184 /* DemoViewController.m */; }; /* End PBXBuildFile section */ @@ -71,13 +71,13 @@ ABF10F16DB0AA9A8008C72C7 /* Pods-WPMediaPicker.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WPMediaPicker.debug.xcconfig"; path = "Pods/Target Support Files/Pods-WPMediaPicker/Pods-WPMediaPicker.debug.xcconfig"; sourceTree = ""; }; B5FF3BE81CAD8AB100C1D597 /* PostProcessingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PostProcessingViewController.h; sourceTree = ""; }; B5FF3BE91CAD8AB100C1D597 /* PostProcessingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PostProcessingViewController.m; sourceTree = ""; }; + CEDE0D8E2419808A00CB3345 /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = ""; }; CEF4FB57530C0C9D7C09607C /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; F0D09511821A352B062D5699 /* WPMediaPicker.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = WPMediaPicker.podspec; path = ../WPMediaPicker.podspec; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; FF355D9C1FB5EB4A00244E6D /* WPPHAssetDataSource+Search.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "WPPHAssetDataSource+Search.h"; sourceTree = ""; }; FF355D9D1FB5EB4A00244E6D /* WPPHAssetDataSource+Search.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "WPPHAssetDataSource+Search.m"; sourceTree = ""; }; FF41CBE31E8B0F5B001B8235 /* CHANGELOG.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = CHANGELOG.md; path = ../CHANGELOG.md; sourceTree = ""; }; FF7DCB451E7C494D00AB77CB /* CONTRIBUTING.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = CONTRIBUTING.md; path = ../CONTRIBUTING.md; sourceTree = ""; }; - FFC3F6F21B0D9BB100EFC359 /* Launch Screen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "Launch Screen.xib"; sourceTree = ""; }; FFE69A1B1B14AB840073C2EB /* OptionsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OptionsViewController.h; sourceTree = ""; }; FFE69A1C1B14AB840073C2EB /* OptionsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OptionsViewController.m; sourceTree = ""; }; FFFFD87F1A447E67000FC184 /* DemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoViewController.h; sourceTree = ""; }; @@ -158,8 +158,8 @@ 6003F59C195388D20070C39A /* AppDelegate.h */, 6003F59D195388D20070C39A /* AppDelegate.m */, 6003F5A8195388D20070C39A /* Images.xcassets */, + CEDE0D8E2419808A00CB3345 /* Launch Screen.storyboard */, 6003F594195388D20070C39A /* Supporting Files */, - FFC3F6F21B0D9BB100EFC359 /* Launch Screen.xib */, FFE69A1B1B14AB840073C2EB /* OptionsViewController.h */, FFE69A1C1B14AB840073C2EB /* OptionsViewController.m */, FF355D9C1FB5EB4A00244E6D /* WPPHAssetDataSource+Search.h */, @@ -307,7 +307,7 @@ files = ( 6003F5A9195388D20070C39A /* Images.xcassets in Resources */, 6003F598195388D20070C39A /* InfoPlist.strings in Resources */, - FFC3F6F31B0D9BB100EFC359 /* Launch Screen.xib in Resources */, + CEDE0D8F2419808A00CB3345 /* Launch Screen.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -538,7 +538,6 @@ baseConfigurationReference = ABF10F16DB0AA9A8008C72C7 /* Pods-WPMediaPicker.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES; CLANG_WARN_UNREACHABLE_CODE = YES; @@ -563,7 +562,6 @@ baseConfigurationReference = 1120051BDDDC8A558883872E /* Pods-WPMediaPicker.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES; CLANG_WARN_UNREACHABLE_CODE = YES; diff --git a/Example/WPMediaPicker.xcodeproj/xcshareddata/xcschemes/WPMediaPicker-Example.xcscheme b/Example/WPMediaPicker.xcodeproj/xcshareddata/xcschemes/WPMediaPicker-Example.xcscheme index 07901510..4d56bfa7 100644 --- a/Example/WPMediaPicker.xcodeproj/xcshareddata/xcschemes/WPMediaPicker-Example.xcscheme +++ b/Example/WPMediaPicker.xcodeproj/xcshareddata/xcschemes/WPMediaPicker-Example.xcscheme @@ -1,6 +1,6 @@ + + + + @@ -39,17 +48,6 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/WPMediaPicker/Launch Screen.xib b/Example/WPMediaPicker/Launch Screen.xib deleted file mode 100644 index 11d1d499..00000000 --- a/Example/WPMediaPicker/Launch Screen.xib +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Example/WPMediaPicker/WPMediaPicker-Info.plist b/Example/WPMediaPicker/WPMediaPicker-Info.plist index a4698d70..e2c7208d 100644 --- a/Example/WPMediaPicker/WPMediaPicker-Info.plist +++ b/Example/WPMediaPicker/WPMediaPicker-Info.plist @@ -24,6 +24,12 @@ 1.0 LSRequiresIPhoneOS + NSCameraUsageDescription + To take photos or videos to use in your posts. + NSMicrophoneUsageDescription + For your videos to have sound on them. + NSPhotoLibraryUsageDescription + In order to use photos from your library on posts. UILaunchStoryboardName Launch Screen UIRequiredDeviceCapabilities @@ -49,11 +55,5 @@ UIViewControllerBasedStatusBarAppearance - NSPhotoLibraryUsageDescription - In order to use photos from your library on posts. - NSMicrophoneUsageDescription - For your videos to have sound on them. - NSCameraUsageDescription - To take photos or videos to use in your posts. diff --git a/Pod/Classes/WPActionBar.h b/Pod/Classes/WPActionBar.h index 718dabe8..20a7b14e 100644 --- a/Pod/Classes/WPActionBar.h +++ b/Pod/Classes/WPActionBar.h @@ -7,6 +7,11 @@ */ @property (nonatomic, strong) UIColor *lineColor UI_APPEARANCE_SELECTOR; +/** +The color for the action bar background. +*/ +@property (nonatomic, strong) UIColor *barBackgroundColor UI_APPEARANCE_SELECTOR; + /** Adds the given button to the left side of the bar diff --git a/Pod/Classes/WPActionBar.m b/Pod/Classes/WPActionBar.m index f64e777b..afc3dd83 100644 --- a/Pod/Classes/WPActionBar.m +++ b/Pod/Classes/WPActionBar.m @@ -83,6 +83,16 @@ - (UIStackView *)stackView #pragma mark - public methods +- (UIColor *)barBackgroundColor +{ + return self.backgroundColor; +} + +- (void)setBarBackgroundColor:(UIColor *)barBackgroundColor +{ + self.backgroundColor = barBackgroundColor; +} + - (UIColor *)lineColor { return self.lineView.backgroundColor; diff --git a/Pod/Classes/WPMediaGroupPickerViewController.h b/Pod/Classes/WPMediaGroupPickerViewController.h index f8b32639..85024b07 100644 --- a/Pod/Classes/WPMediaGroupPickerViewController.h +++ b/Pod/Classes/WPMediaGroupPickerViewController.h @@ -42,4 +42,13 @@ */ - (void)mediaGroupPickerViewControllerDidCancel:(WPMediaGroupPickerViewController *)picker; +/** Asks the delegate to handle an error found by the picker + * If the method is not implemented or it returns NO the media picker will default to showing an alert with the an generic error message + * + * @param picker The controller object managing the assets picker interface. + * @param error The error to show + * @return YES if the error was handled by the delegate + */ +- (BOOL)mediaGroupPickerViewController:(WPMediaGroupPickerViewController *)picker handleError:(NSError *)error; + @end diff --git a/Pod/Classes/WPMediaGroupPickerViewController.m b/Pod/Classes/WPMediaGroupPickerViewController.m index 503359b0..5f7da388 100644 --- a/Pod/Classes/WPMediaGroupPickerViewController.m +++ b/Pod/Classes/WPMediaGroupPickerViewController.m @@ -84,6 +84,11 @@ - (void)loadData - (void)showError:(NSError *)error { [self.refreshControl endRefreshing]; [self.tableView reloadData]; + if ([self.delegate respondsToSelector:@selector(mediaGroupPickerViewController:handleError:)]) { + if ([self.delegate mediaGroupPickerViewController:self handleError:error]) { + return; + } + } [self wpm_showAlertWithError:error okActionHandler:^(UIAlertAction * _Nonnull action) { if ([self.delegate respondsToSelector:@selector(mediaGroupPickerViewControllerDidCancel:)]) { [self.delegate mediaGroupPickerViewControllerDidCancel:self]; diff --git a/Pod/Classes/WPMediaPickerViewController.h b/Pod/Classes/WPMediaPickerViewController.h index 2898b237..a391e6c7 100644 --- a/Pod/Classes/WPMediaPickerViewController.h +++ b/Pod/Classes/WPMediaPickerViewController.h @@ -199,7 +199,7 @@ - (nullable UIView *)emptyViewForMediaPickerController:(nonnull WPMediaPickerViewController *)picker; /** - * Asks the delegate for an empty view to show when there are no assets + * Asks the delegate for an empty view controller to show when there are no assets * to be displayed. If no empty view is required, you have to implement this * method and return `nil`. * @@ -211,6 +211,15 @@ */ - (nullable UIViewController *)emptyViewControllerForMediaPickerController:(nonnull WPMediaPickerViewController *)picker; +/** Asks the delegate to handle an error found by the picker + * If the method is not implemented or it returns NO the media picker will default to showing an alert with the an generic error message + * + * @param picker The controller object managing the assets picker interface. + * @param error The error to show + * @return YES if the error was handled by the delegate + */ +- (BOOL)mediaPickerController:(nonnull WPMediaPickerViewController *)picker handleError:(nonnull NSError *)error; + @end diff --git a/Pod/Classes/WPMediaPickerViewController.m b/Pod/Classes/WPMediaPickerViewController.m index 1734144e..8fbfe4b3 100644 --- a/Pod/Classes/WPMediaPickerViewController.m +++ b/Pod/Classes/WPMediaPickerViewController.m @@ -768,6 +768,11 @@ - (void)showError:(NSError *)error { self.collectionView.allowsSelection = YES; self.collectionView.scrollEnabled = YES; [self.collectionView reloadData]; + if ([self.mediaPickerDelegate respondsToSelector:@selector(mediaPickerController:handleError:)]) { + if ([self.mediaPickerDelegate mediaPickerController:self handleError:error]) { + return; + } + } [self wpm_showAlertWithError:error okActionHandler:^(UIAlertAction * _Nonnull action) { if ([self.mediaPickerDelegate respondsToSelector:@selector(mediaPickerControllerDidCancel:)]) { [self.mediaPickerDelegate mediaPickerControllerDidCancel:self]; diff --git a/Pod/Classes/WPNavigationMediaPickerViewController.m b/Pod/Classes/WPNavigationMediaPickerViewController.m index e92b1eb0..16978f5c 100644 --- a/Pod/Classes/WPNavigationMediaPickerViewController.m +++ b/Pod/Classes/WPNavigationMediaPickerViewController.m @@ -215,6 +215,14 @@ - (void)mediaGroupPickerViewControllerDidCancel:(WPMediaGroupPickerViewControlle } } +- (BOOL)mediaGroupPickerViewController:(WPMediaGroupPickerViewController *)picker handleError:(NSError *)error { + if ([self.delegate respondsToSelector:@selector(mediaPickerController:handleError:)]) { + return [self.delegate mediaPickerController:self.mediaPicker handleError:error]; + } else { + return NO; + } +} + #pragma mark - WPMediaPickerViewControllerDelegate - (void)mediaPickerController:(WPMediaPickerViewController *)picker didUpdateSearchWithAssetCount:(NSInteger)assetCount { @@ -342,6 +350,14 @@ - (void)mediaPickerController:(nonnull WPMediaPickerViewController *)picker sele [self updateSelectionAction]; } +- (BOOL)mediaPickerController:(nonnull WPMediaPickerViewController *)picker handleError:(nonnull NSError *)error { + if ([self.delegate respondsToSelector:@selector(mediaPickerController:handleError:)]) { + return [self.delegate mediaPickerController:picker handleError:error]; + } else { + return NO; + } +} + - (void)updateSelectionAction { if (self.mediaPicker.options.showActionBar || self.mediaPicker.selectedAssets.count == 0 || !self.mediaPicker.options.allowMultipleSelection) { self.internalNavigationController.topViewController.navigationItem.rightBarButtonItem = nil; diff --git a/WPMediaPicker.podspec b/WPMediaPicker.podspec index fc5804b3..198d7cb8 100644 --- a/WPMediaPicker.podspec +++ b/WPMediaPicker.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "WPMediaPicker" - s.version = "1.6.0" + s.version = "1.6.1" s.summary = "WPMediaPicker is an iOS controller that allows capture and picking of media assets." s.description = <<-DESC WPMediaPicker is an iOS controller that allows capture and picking of media assets. @@ -16,7 +16,7 @@ Pod::Spec.new do |s| s.source = { :git => "https://github.com/wordpress-mobile/MediaPicker-iOS.git", :tag => s.version.to_s } s.platform = :ios, '11.0' - s.requires_arc = true + s.swift_version = '5.0' s.source_files = 'Pod/Classes' s.resource_bundles = {