forked from flutter/plugins
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFLTImagePickerPlugin_Test.h
98 lines (77 loc) · 3.09 KB
/
FLTImagePickerPlugin_Test.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// 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.
// This header is available in the Test module. Import via "@import image_picker_ios_ios.Test;"
#import <image_picker_ios/FLTImagePickerPlugin.h>
#import "messages.g.h"
NS_ASSUME_NONNULL_BEGIN
/**
* The return hander used for all method calls, which internally adapts the provided result list
* to return either a list or a single element depending on the original call.
*/
typedef void (^FlutterResultAdapter)(NSArray<NSString *> *_Nullable, FlutterError *_Nullable);
/**
* A container class for context to use when handling a method call from the Dart side.
*/
@interface FLTImagePickerMethodCallContext : NSObject
/**
* Initializes a new context that calls |result| on completion of the operation.
*/
- (instancetype)initWithResult:(nonnull FlutterResultAdapter)result;
/** The callback to provide results to the Dart caller. */
@property(nonatomic, copy, nonnull) FlutterResultAdapter result;
/**
* The maximum size to enforce on the results.
*
* If nil, no resizing is done.
*/
@property(nonatomic, strong, nullable) FLTMaxSize *maxSize;
/**
* The image quality to resample the results to.
*
* If nil, no resampling is done.
*/
@property(nonatomic, strong, nullable) NSNumber *imageQuality;
/** Maximum number of images to select. 0 indicates no maximum. */
@property(nonatomic, assign) int maxImageCount;
/** Whether the image should be picked with full metadata (requires gallery permissions) */
@property(nonatomic, assign) BOOL requestFullMetadata;
@end
#pragma mark -
/** Methods exposed for unit testing. */
@interface FLTImagePickerPlugin () <FLTImagePickerApi>
/**
* The context of the Flutter method call that is currently being handled, if any.
*/
@property(strong, nonatomic, nullable) FLTImagePickerMethodCallContext *callContext;
/**
* Validates the provided paths list, then sends it via `callContext.result` as the result of the
* original platform channel method call, clearing the in-progress call state.
*
* @param pathList The paths to return. nil indicates a cancelled operation.
*/
- (void)sendCallResultWithSavedPathList:(nullable NSArray *)pathList;
/**
* Tells the delegate that the user cancelled the pick operation.
*
* Your delegate’s implementation of this method should dismiss the picker view
* by calling the dismissModalViewControllerAnimated: method of the parent
* view controller.
*
* Implementation of this method is optional, but expected.
*
* @param picker The controller object managing the image picker interface.
*/
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker;
/**
* Sets UIImagePickerController instances that will be used when a new
* controller would normally be created. Each call to
* createImagePickerController will remove the current first element from
* the array.
*
* Should be used for testing purposes only.
*/
- (void)setImagePickerControllerOverrides:
(NSArray<UIImagePickerController *> *)imagePickerControllers;
@end
NS_ASSUME_NONNULL_END