From 4b0ce035ca01f5a2b5b91dc2f2b083e8072c92cc Mon Sep 17 00:00:00 2001 From: Jesse Armand Date: Wed, 16 Feb 2022 12:18:56 +0800 Subject: [PATCH 1/4] Add Swift Package Manifest Fix UIKit import and package name --- .../Library/Extensions/UIView+Dimmer.swift | 2 ++ .../Classes/Photo/View/PanoramaIconView.swift | 1 + .../Device+AssetsPickerViewController.swift | 2 ++ Package.swift | 31 +++++++++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 Package.swift diff --git a/AssetsPickerViewController/Classes/Library/Extensions/UIView+Dimmer.swift b/AssetsPickerViewController/Classes/Library/Extensions/UIView+Dimmer.swift index 9295b19..e95f962 100644 --- a/AssetsPickerViewController/Classes/Library/Extensions/UIView+Dimmer.swift +++ b/AssetsPickerViewController/Classes/Library/Extensions/UIView+Dimmer.swift @@ -6,6 +6,8 @@ // // +import UIKit + fileprivate let kDimmerViewKey = "kDimmerViewKey" fileprivate let kDimmerView = "kDimmerView" fileprivate let kDimmerViewRatio = "kDimmerViewRatio" diff --git a/AssetsPickerViewController/Classes/Photo/View/PanoramaIconView.swift b/AssetsPickerViewController/Classes/Photo/View/PanoramaIconView.swift index 9182127..5ad7a4d 100644 --- a/AssetsPickerViewController/Classes/Photo/View/PanoramaIconView.swift +++ b/AssetsPickerViewController/Classes/Photo/View/PanoramaIconView.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit open class PanoramaIconView: UIView { diff --git a/AssetsPickerViewController/Classes/Utility/Device+AssetsPickerViewController.swift b/AssetsPickerViewController/Classes/Utility/Device+AssetsPickerViewController.swift index c872937..15657a3 100644 --- a/AssetsPickerViewController/Classes/Utility/Device+AssetsPickerViewController.swift +++ b/AssetsPickerViewController/Classes/Utility/Device+AssetsPickerViewController.swift @@ -5,6 +5,8 @@ // Created by DragonCherry on 19/12/2017. // +import UIKit + extension Device { static func safeAreaInsets(isPortrait: Bool) -> UIEdgeInsets { let size = Device.size() diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..e314713 --- /dev/null +++ b/Package.swift @@ -0,0 +1,31 @@ +// swift-tools-version:5.5 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "AssetsPicker", + defaultLocalization: "en", + platforms: [.iOS(.v13)], + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "AssetsPicker", + targets: ["AssetsPicker"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "AssetsPicker", + dependencies: [], + path: "AssetsPickerViewController", + exclude: ["Info.plist"], + resources: [.process("Assets")] + ), + ] +) From 53c7c795990edf60f27dafe1badbbdf5d03d01be Mon Sep 17 00:00:00 2001 From: Junfeng Hu Date: Sat, 30 Oct 2021 21:30:14 +0800 Subject: [PATCH 2/4] chore: Set deployment target to iOS 13.0 --- AssetsPicker.xcodeproj/project.pbxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AssetsPicker.xcodeproj/project.pbxproj b/AssetsPicker.xcodeproj/project.pbxproj index 4d180fe..27236ef 100644 --- a/AssetsPicker.xcodeproj/project.pbxproj +++ b/AssetsPicker.xcodeproj/project.pbxproj @@ -528,7 +528,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.4; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -588,7 +588,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.4; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; @@ -611,7 +611,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/AssetsPickerViewController/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -636,7 +636,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "$(SRCROOT)/AssetsPickerViewController/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", From 5efe5b33cf30ceb506bb98abdcac24504e9d8706 Mon Sep 17 00:00:00 2001 From: Junfeng Hu Date: Mon, 14 Feb 2022 14:24:21 +0800 Subject: [PATCH 3/4] refactor: Remove use of PHAssetCollectionType.moment as it's deprecated in iOS 13 --- .../Classes/Assets/AssetsManager.swift | 8 -------- .../Classes/Picker/AssetsPickerConfig.swift | 6 +----- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/AssetsPickerViewController/Classes/Assets/AssetsManager.swift b/AssetsPickerViewController/Classes/Assets/AssetsManager.swift index cfec606..0e0a9d0 100644 --- a/AssetsPickerViewController/Classes/Assets/AssetsManager.swift +++ b/AssetsPickerViewController/Classes/Assets/AssetsManager.swift @@ -274,8 +274,6 @@ extension AssetsManager { return .smartAlbum case 1: return .album - case 2: - return .moment default: loge("Section number error: \(section)") return .album @@ -461,12 +459,6 @@ extension AssetsManager { sortedAlbumsArray.append(albumEntry.sortedAlbums) albumsFetchArray.append(albumEntry.fetchResult) - if pickerConfig.albumIsShowMomentAlbums { - let momentEntry = fetchAlbums(forAlbumType: .moment) - fetchedAlbumsArray.append(momentEntry.fetchedAlbums) - sortedAlbumsArray.append(momentEntry.sortedAlbums) - albumsFetchArray.append(momentEntry.fetchResult) - } isFetchedAlbums = true } // notify diff --git a/AssetsPickerViewController/Classes/Picker/AssetsPickerConfig.swift b/AssetsPickerViewController/Classes/Picker/AssetsPickerConfig.swift index c1dcdc6..6d16ca9 100644 --- a/AssetsPickerViewController/Classes/Picker/AssetsPickerConfig.swift +++ b/AssetsPickerViewController/Classes/Picker/AssetsPickerConfig.swift @@ -32,9 +32,6 @@ open class AssetsPickerConfig { PHAssetCollectionType: ((PHAssetCollection, PHFetchResult) -> Bool) ]? - /// Not yet fully implemeted, do not set this true until it's completed. - open var albumIsShowMomentAlbums: Bool = false - // MARK: Fetch open var albumFetchOptions: [PHAssetCollectionType: PHFetchOptions]? @@ -175,8 +172,7 @@ open class AssetsPickerConfig { options.predicate = NSPredicate(format: "mediaType = %d OR mediaType = %d", PHAssetMediaType.image.rawValue, PHAssetMediaType.video.rawValue) assetFetchOptions = [ .smartAlbum: options, - .album: options, - .moment: options + .album: options ] } From e8b4d6510665d2c9da02db934b06b0825e930c57 Mon Sep 17 00:00:00 2001 From: Junfeng Hu Date: Wed, 29 Jun 2022 17:41:46 +0800 Subject: [PATCH 4/4] fix: Warning about .gray style being deprecated in iOS 13 --- .../Classes/Library/Extensions/UIView+Dimmer.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AssetsPickerViewController/Classes/Library/Extensions/UIView+Dimmer.swift b/AssetsPickerViewController/Classes/Library/Extensions/UIView+Dimmer.swift index e95f962..14ca839 100644 --- a/AssetsPickerViewController/Classes/Library/Extensions/UIView+Dimmer.swift +++ b/AssetsPickerViewController/Classes/Library/Extensions/UIView+Dimmer.swift @@ -90,7 +90,7 @@ extension UIView { return view } - fileprivate func createDimmerActivityView(style: UIActivityIndicatorView.Style = .gray) -> UIActivityIndicatorView { + fileprivate func createDimmerActivityView(style: UIActivityIndicatorView.Style = .medium) -> UIActivityIndicatorView { let activityIndicator = UIActivityIndicatorView(style: style) return activityIndicator }