Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/image_picker/image_picker_ios/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.8.8+4

* Updates to Pigeon 13.

## 0.8.8+3

* Fixes a possible crash when calling a picker method while another is waiting on permissions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ - (void)testPluginPickImageDeviceBack {
camera:FLTSourceCameraRear]
maxSize:[[FLTMaxSize alloc] init]
quality:nil
fullMetadata:@YES
fullMetadata:YES
completion:^(NSString *_Nullable result, FlutterError *_Nullable error){
}];

Expand Down Expand Up @@ -89,7 +89,7 @@ - (void)testPluginPickImageDeviceFront {
camera:FLTSourceCameraFront]
maxSize:[[FLTMaxSize alloc] init]
quality:nil
fullMetadata:@YES
fullMetadata:YES
completion:^(NSString *_Nullable result, FlutterError *_Nullable error){
}];

Expand Down Expand Up @@ -174,7 +174,7 @@ - (void)testPickMultiImageShouldUseUIImagePickerControllerOnPreiOS14 {

[plugin pickMultiImageWithMaxSize:[FLTMaxSize makeWithWidth:@(100) height:@(200)]
quality:@(50)
fullMetadata:@YES
fullMetadata:YES
completion:^(NSArray<NSString *> *_Nullable result,
FlutterError *_Nullable error){
}];
Expand All @@ -197,8 +197,8 @@ - (void)testPickMediaShouldUseUIImagePickerControllerOnPreiOS14 {
FLTMediaSelectionOptions *mediaSelectionOptions =
[FLTMediaSelectionOptions makeWithMaxSize:[FLTMaxSize makeWithWidth:@(100) height:@(200)]
imageQuality:@(50)
requestFullMetadata:@YES
allowMultiple:@YES];
requestFullMetadata:YES
allowMultiple:YES];

[plugin pickMediaWithMediaSelectionOptions:mediaSelectionOptions
completion:^(NSArray<NSString *> *_Nullable result,
Expand All @@ -219,7 +219,7 @@ - (void)testPickImageWithoutFullMetadata {
camera:FLTSourceCameraFront]
maxSize:[[FLTMaxSize alloc] init]
quality:nil
fullMetadata:@NO
fullMetadata:NO
completion:^(NSString *_Nullable result, FlutterError *_Nullable error){
}];

Expand All @@ -235,7 +235,7 @@ - (void)testPickMultiImageWithoutFullMetadata {

[plugin pickMultiImageWithMaxSize:[[FLTMaxSize alloc] init]
quality:nil
fullMetadata:@NO
fullMetadata:NO
completion:^(NSArray<NSString *> *_Nullable result,
FlutterError *_Nullable error){
}];
Expand All @@ -253,8 +253,8 @@ - (void)testPickMediaWithoutFullMetadata {
FLTMediaSelectionOptions *mediaSelectionOptions =
[FLTMediaSelectionOptions makeWithMaxSize:[FLTMaxSize makeWithWidth:@(100) height:@(200)]
imageQuality:@(50)
requestFullMetadata:@YES
allowMultiple:@YES];
requestFullMetadata:YES
allowMultiple:YES];

[plugin pickMediaWithMediaSelectionOptions:mediaSelectionOptions

Expand All @@ -279,7 +279,7 @@ - (void)testPluginPickImageDeviceCancelClickMultipleTimes {
camera:FLTSourceCameraRear]
maxSize:[[FLTMaxSize alloc] init]
quality:nil
fullMetadata:@YES
fullMetadata:YES
completion:^(NSString *_Nullable result, FlutterError *_Nullable error){
}];

Expand Down Expand Up @@ -502,7 +502,7 @@ - (void)testPickImageRequestAuthorization API_AVAILABLE(ios(14)) {
camera:FLTSourceCameraFront]
maxSize:[[FLTMaxSize alloc] init]
quality:nil
fullMetadata:@YES
fullMetadata:YES
completion:^(NSString *result, FlutterError *error){
}];
OCMVerifyAll(mockPhotoLibrary);
Expand All @@ -521,7 +521,7 @@ - (void)testPickImageAuthorizationDenied API_AVAILABLE(ios(14)) {
camera:FLTSourceCameraFront]
maxSize:[[FLTMaxSize alloc] init]
quality:nil
fullMetadata:@YES
fullMetadata:YES
completion:^(NSString *result, FlutterError *error) {
XCTAssertNil(result);
XCTAssertEqualObjects(error.code, @"photo_access_denied");
Expand All @@ -543,15 +543,15 @@ - (void)testPickMultiImageDuplicateCallCancels API_AVAILABLE(ios(14)) {
XCTestExpectation *firstCallExpectation = [self expectationWithDescription:@"first call"];
[plugin pickMultiImageWithMaxSize:[FLTMaxSize makeWithWidth:@100 height:@100]
quality:nil
fullMetadata:@YES
fullMetadata:YES
completion:^(NSArray<NSString *> *result, FlutterError *error) {
XCTAssertNotNil(error);
XCTAssertEqualObjects(error.code, @"multiple_request");
[firstCallExpectation fulfill];
}];
[plugin pickMultiImageWithMaxSize:[FLTMaxSize makeWithWidth:@100 height:@100]
quality:nil
fullMetadata:@YES
fullMetadata:YES
completion:^(NSArray<NSString *> *result, FlutterError *error){
}];
[self waitForExpectationsWithTimeout:30 handler:nil];
Expand All @@ -569,8 +569,8 @@ - (void)testPickMediaDuplicateCallCancels API_AVAILABLE(ios(14)) {
FLTMediaSelectionOptions *options =
[FLTMediaSelectionOptions makeWithMaxSize:[FLTMaxSize makeWithWidth:@(100) height:@(200)]
imageQuality:@(50)
requestFullMetadata:@YES
allowMultiple:@YES];
requestFullMetadata:YES
allowMultiple:YES];
XCTestExpectation *firstCallExpectation = [self expectationWithDescription:@"first call"];
[plugin pickMediaWithMediaSelectionOptions:options
completion:^(NSArray<NSString *> *result, FlutterError *error) {
Expand All @@ -585,11 +585,9 @@ - (void)testPickMediaDuplicateCallCancels API_AVAILABLE(ios(14)) {
}

- (void)testPickVideoDuplicateCallCancels API_AVAILABLE(ios(14)) {
id mockPhotoLibrary = OCMClassMock([PHPhotoLibrary class]);
OCMStub([mockPhotoLibrary authorizationStatusForAccessLevel:PHAccessLevelReadWrite])
.andReturn(PHAuthorizationStatusNotDetermined);
OCMExpect([mockPhotoLibrary requestAuthorizationForAccessLevel:PHAccessLevelReadWrite
handler:OCMOCK_ANY]);
id mockPhotoLibrary = OCMClassMock([AVCaptureDevice class]);
OCMStub([mockPhotoLibrary authorizationStatusForMediaType:AVMediaTypeVideo])
.andReturn(AVAuthorizationStatusNotDetermined);

FLTImagePickerPlugin *plugin = [[FLTImagePickerPlugin alloc] init];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ @implementation FLTImagePickerPlugin

+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
FLTImagePickerPlugin *instance = [[FLTImagePickerPlugin alloc] init];
FLTImagePickerApiSetup(registrar.messenger, instance);
SetUpFLTImagePickerApi(registrar.messenger, instance);
}

- (UIImagePickerController *)createImagePickerController {
Expand Down Expand Up @@ -162,7 +162,7 @@ - (void)launchUIImagePickerWithSource:(nonnull FLTSourceSpecification *)source
- (void)pickImageWithSource:(nonnull FLTSourceSpecification *)source
maxSize:(nonnull FLTMaxSize *)maxSize
quality:(nullable NSNumber *)imageQuality
fullMetadata:(NSNumber *)fullMetadata
fullMetadata:(BOOL)fullMetadata
completion:
(nonnull void (^)(NSString *_Nullable, FlutterError *_Nullable))completion {
[self cancelInProgressCall];
Expand All @@ -178,7 +178,7 @@ - (void)pickImageWithSource:(nonnull FLTSourceSpecification *)source
context.maxSize = maxSize;
context.imageQuality = imageQuality;
context.maxImageCount = 1;
context.requestFullMetadata = [fullMetadata boolValue];
context.requestFullMetadata = fullMetadata;

if (source.type == FLTSourceTypeGallery) { // Capture is not possible with PHPicker
if (@available(iOS 14, *)) {
Expand All @@ -193,15 +193,15 @@ - (void)pickImageWithSource:(nonnull FLTSourceSpecification *)source

- (void)pickMultiImageWithMaxSize:(nonnull FLTMaxSize *)maxSize
quality:(nullable NSNumber *)imageQuality
fullMetadata:(NSNumber *)fullMetadata
fullMetadata:(BOOL)fullMetadata
completion:(nonnull void (^)(NSArray<NSString *> *_Nullable,
FlutterError *_Nullable))completion {
[self cancelInProgressCall];
FLTImagePickerMethodCallContext *context =
[[FLTImagePickerMethodCallContext alloc] initWithResult:completion];
context.maxSize = maxSize;
context.imageQuality = imageQuality;
context.requestFullMetadata = [fullMetadata boolValue];
context.requestFullMetadata = fullMetadata;

if (@available(iOS 14, *)) {
[self launchPHPickerWithContext:context];
Expand All @@ -223,7 +223,7 @@ - (void)pickMediaWithMediaSelectionOptions:(nonnull FLTMediaSelectionOptions *)m
context.imageQuality = [mediaSelectionOptions imageQuality];
context.requestFullMetadata = [mediaSelectionOptions requestFullMetadata];
context.includeVideo = YES;
if (![[mediaSelectionOptions allowMultiple] boolValue]) {
if (!mediaSelectionOptions.allowMultiple) {
context.maxImageCount = 1;
}

Expand Down
28 changes: 20 additions & 8 deletions packages/image_picker/image_picker_ios/ios/Classes/messages.g.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Autogenerated from Pigeon (v9.2.5), do not edit directly.
// Autogenerated from Pigeon (v13.0.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon

#import <Foundation/Foundation.h>
Expand All @@ -18,11 +18,23 @@ typedef NS_ENUM(NSUInteger, FLTSourceCamera) {
FLTSourceCameraFront = 1,
};

/// Wrapper for FLTSourceCamera to allow for nullability.
@interface FLTSourceCameraBox : NSObject
@property(nonatomic, assign) FLTSourceCamera value;
- (instancetype)initWithValue:(FLTSourceCamera)value;
@end

typedef NS_ENUM(NSUInteger, FLTSourceType) {
FLTSourceTypeCamera = 0,
FLTSourceTypeGallery = 1,
};

/// Wrapper for FLTSourceType to allow for nullability.
@interface FLTSourceTypeBox : NSObject
@property(nonatomic, assign) FLTSourceType value;
- (instancetype)initWithValue:(FLTSourceType)value;
@end

@class FLTMaxSize;
@class FLTMediaSelectionOptions;
@class FLTSourceSpecification;
Expand All @@ -38,12 +50,12 @@ typedef NS_ENUM(NSUInteger, FLTSourceType) {
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)makeWithMaxSize:(FLTMaxSize *)maxSize
imageQuality:(nullable NSNumber *)imageQuality
requestFullMetadata:(NSNumber *)requestFullMetadata
allowMultiple:(NSNumber *)allowMultiple;
requestFullMetadata:(BOOL)requestFullMetadata
allowMultiple:(BOOL)allowMultiple;
@property(nonatomic, strong) FLTMaxSize *maxSize;
@property(nonatomic, strong, nullable) NSNumber *imageQuality;
@property(nonatomic, strong) NSNumber *requestFullMetadata;
@property(nonatomic, strong) NSNumber *allowMultiple;
@property(nonatomic, assign) BOOL requestFullMetadata;
@property(nonatomic, assign) BOOL allowMultiple;
@end

@interface FLTSourceSpecification : NSObject
Expand All @@ -61,11 +73,11 @@ NSObject<FlutterMessageCodec> *FLTImagePickerApiGetCodec(void);
- (void)pickImageWithSource:(FLTSourceSpecification *)source
maxSize:(FLTMaxSize *)maxSize
quality:(nullable NSNumber *)imageQuality
fullMetadata:(NSNumber *)requestFullMetadata
fullMetadata:(BOOL)requestFullMetadata
completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion;
- (void)pickMultiImageWithMaxSize:(FLTMaxSize *)maxSize
quality:(nullable NSNumber *)imageQuality
fullMetadata:(NSNumber *)requestFullMetadata
fullMetadata:(BOOL)requestFullMetadata
completion:(void (^)(NSArray<NSString *> *_Nullable,
FlutterError *_Nullable))completion;
- (void)pickVideoWithSource:(FLTSourceSpecification *)source
Expand All @@ -77,7 +89,7 @@ NSObject<FlutterMessageCodec> *FLTImagePickerApiGetCodec(void);
FlutterError *_Nullable))completion;
@end

extern void FLTImagePickerApiSetup(id<FlutterBinaryMessenger> binaryMessenger,
extern void SetUpFLTImagePickerApi(id<FlutterBinaryMessenger> binaryMessenger,
NSObject<FLTImagePickerApi> *_Nullable api);

NS_ASSUME_NONNULL_END
Loading