Fixes conditional imports for backwards compatibility with Xcode 11
This commit is contained in:
parent
ba19a7eccf
commit
9aa951b4ad
|
@ -1,3 +1,6 @@
|
||||||
|
## 2.0.2+1
|
||||||
|
iOS: Fixes conditional import for backwards compatibility with Xcode 11.
|
||||||
|
|
||||||
## 2.0.2
|
## 2.0.2
|
||||||
Web: Adds mobile Safari support and other minor improvements.
|
Web: Adds mobile Safari support and other minor improvements.
|
||||||
iOS: Adds conditional import for backwards compatibility with Xcode 11.
|
iOS: Adds conditional import for backwards compatibility with Xcode 11.
|
||||||
|
|
|
@ -4,12 +4,13 @@
|
||||||
#import <Photos/Photos.h>
|
#import <Photos/Photos.h>
|
||||||
#import <MobileCoreServices/MobileCoreServices.h>
|
#import <MobileCoreServices/MobileCoreServices.h>
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0
|
#if __has_include(<PhotosUI/PHPicker.h>) || __has_include("PHPicker.h")
|
||||||
|
#define PHPicker
|
||||||
#import <PhotosUI/PHPicker.h>
|
#import <PhotosUI/PHPicker.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@interface FilePickerPlugin : NSObject<FlutterPlugin, FlutterStreamHandler, UIDocumentPickerDelegate, UITabBarDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate
|
@interface FilePickerPlugin : NSObject<FlutterPlugin, FlutterStreamHandler, UIDocumentPickerDelegate, UITabBarDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate, UIImagePickerControllerDelegate, MPMediaPickerControllerDelegate
|
||||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0
|
#ifdef PHPicker
|
||||||
, PHPickerViewControllerDelegate
|
, PHPickerViewControllerDelegate
|
||||||
#endif
|
#endif
|
||||||
>
|
>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
@import DKImagePickerController;
|
@import DKImagePickerController;
|
||||||
|
|
||||||
@interface FilePickerPlugin() <UIImagePickerControllerDelegate, MPMediaPickerControllerDelegate, DKImageAssetExporterObserver, PHPickerViewControllerDelegate>
|
@interface FilePickerPlugin() <DKImageAssetExporterObserver>
|
||||||
@property (nonatomic) FlutterResult result;
|
@property (nonatomic) FlutterResult result;
|
||||||
@property (nonatomic) FlutterEventSink eventSink;
|
@property (nonatomic) FlutterEventSink eventSink;
|
||||||
@property (nonatomic) UIViewController *viewController;
|
@property (nonatomic) UIViewController *viewController;
|
||||||
|
@ -128,6 +128,7 @@
|
||||||
|
|
||||||
- (void) resolvePickMedia:(MediaType)type withMultiPick:(BOOL)multiPick withCompressionAllowed:(BOOL)allowCompression {
|
- (void) resolvePickMedia:(MediaType)type withMultiPick:(BOOL)multiPick withCompressionAllowed:(BOOL)allowCompression {
|
||||||
|
|
||||||
|
#ifdef PHPicker
|
||||||
if (@available(iOS 14, *)) {
|
if (@available(iOS 14, *)) {
|
||||||
PHPickerConfiguration *config = [[PHPickerConfiguration alloc] init];
|
PHPickerConfiguration *config = [[PHPickerConfiguration alloc] init];
|
||||||
config.filter = type == IMAGE ? [PHPickerFilter imagesFilter] : type == VIDEO ? [PHPickerFilter videosFilter] : [PHPickerFilter anyFilterMatchingSubfilters:@[[PHPickerFilter videosFilter], [PHPickerFilter imagesFilter]]];
|
config.filter = type == IMAGE ? [PHPickerFilter imagesFilter] : type == VIDEO ? [PHPickerFilter videosFilter] : [PHPickerFilter anyFilterMatchingSubfilters:@[[PHPickerFilter videosFilter], [PHPickerFilter imagesFilter]]];
|
||||||
|
@ -141,6 +142,7 @@
|
||||||
[self.viewController presentViewController:pickerViewController animated:YES completion:nil];
|
[self.viewController presentViewController:pickerViewController animated:YES completion:nil];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if(multiPick) {
|
if(multiPick) {
|
||||||
[self resolveMultiPickFromGallery:type withCompressionAllowed:allowCompression];
|
[self resolveMultiPickFromGallery:type withCompressionAllowed:allowCompression];
|
||||||
|
@ -346,6 +348,8 @@ didPickDocumentsAtURLs:(NSArray<NSURL *> *)urls{
|
||||||
[self handleResult: pickedVideoUrl != nil ? pickedVideoUrl : pickedImageUrl];
|
[self handleResult: pickedVideoUrl != nil ? pickedVideoUrl : pickedImageUrl];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PHPicker
|
||||||
|
|
||||||
-(void)picker:(PHPickerViewController *)picker didFinishPicking:(NSArray<PHPickerResult *> *)results API_AVAILABLE(ios(14)){
|
-(void)picker:(PHPickerViewController *)picker didFinishPicking:(NSArray<PHPickerResult *> *)results API_AVAILABLE(ios(14)){
|
||||||
|
|
||||||
Log(@"Picker:%@ didFinishPicking:%@", picker, results);
|
Log(@"Picker:%@ didFinishPicking:%@", picker, results);
|
||||||
|
@ -376,6 +380,8 @@ didPickDocumentsAtURLs:(NSArray<NSURL *> *)urls{
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// AudioPicker delegate
|
// AudioPicker delegate
|
||||||
- (void)mediaPicker: (MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection
|
- (void)mediaPicker: (MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
name: file_picker
|
name: file_picker
|
||||||
description: A package that allows you to use a native file explorer to pick single or multiple absolute file paths, with extension filtering support.
|
description: A package that allows you to use a native file explorer to pick single or multiple absolute file paths, with extension filtering support.
|
||||||
homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker
|
homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker
|
||||||
version: 2.0.2
|
version: 2.0.2+1
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
|
|
Loading…
Reference in New Issue