messages.g.m
11.4 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
// 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.
// See also: https://pub.dev/packages/pigeon
#import "messages.g.h"
#import <Flutter/Flutter.h>
#if !__has_feature(objc_arc)
#error File requires ARC to be enabled.
#endif
static NSArray *wrapResult(id result, FlutterError *error) {
if (error) {
return @[
error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null]
];
}
return @[ result ?: [NSNull null] ];
}
static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) {
id result = array[key];
return (result == [NSNull null]) ? nil : result;
}
@interface FLTMaxSize ()
+ (FLTMaxSize *)fromList:(NSArray *)list;
+ (nullable FLTMaxSize *)nullableFromList:(NSArray *)list;
- (NSArray *)toList;
@end
@interface FLTMediaSelectionOptions ()
+ (FLTMediaSelectionOptions *)fromList:(NSArray *)list;
+ (nullable FLTMediaSelectionOptions *)nullableFromList:(NSArray *)list;
- (NSArray *)toList;
@end
@interface FLTSourceSpecification ()
+ (FLTSourceSpecification *)fromList:(NSArray *)list;
+ (nullable FLTSourceSpecification *)nullableFromList:(NSArray *)list;
- (NSArray *)toList;
@end
@implementation FLTMaxSize
+ (instancetype)makeWithWidth:(nullable NSNumber *)width height:(nullable NSNumber *)height {
FLTMaxSize *pigeonResult = [[FLTMaxSize alloc] init];
pigeonResult.width = width;
pigeonResult.height = height;
return pigeonResult;
}
+ (FLTMaxSize *)fromList:(NSArray *)list {
FLTMaxSize *pigeonResult = [[FLTMaxSize alloc] init];
pigeonResult.width = GetNullableObjectAtIndex(list, 0);
pigeonResult.height = GetNullableObjectAtIndex(list, 1);
return pigeonResult;
}
+ (nullable FLTMaxSize *)nullableFromList:(NSArray *)list {
return (list) ? [FLTMaxSize fromList:list] : nil;
}
- (NSArray *)toList {
return @[
(self.width ?: [NSNull null]),
(self.height ?: [NSNull null]),
];
}
@end
@implementation FLTMediaSelectionOptions
+ (instancetype)makeWithMaxSize:(FLTMaxSize *)maxSize
imageQuality:(nullable NSNumber *)imageQuality
requestFullMetadata:(NSNumber *)requestFullMetadata
allowMultiple:(NSNumber *)allowMultiple {
FLTMediaSelectionOptions *pigeonResult = [[FLTMediaSelectionOptions alloc] init];
pigeonResult.maxSize = maxSize;
pigeonResult.imageQuality = imageQuality;
pigeonResult.requestFullMetadata = requestFullMetadata;
pigeonResult.allowMultiple = allowMultiple;
return pigeonResult;
}
+ (FLTMediaSelectionOptions *)fromList:(NSArray *)list {
FLTMediaSelectionOptions *pigeonResult = [[FLTMediaSelectionOptions alloc] init];
pigeonResult.maxSize = [FLTMaxSize nullableFromList:(GetNullableObjectAtIndex(list, 0))];
NSAssert(pigeonResult.maxSize != nil, @"");
pigeonResult.imageQuality = GetNullableObjectAtIndex(list, 1);
pigeonResult.requestFullMetadata = GetNullableObjectAtIndex(list, 2);
NSAssert(pigeonResult.requestFullMetadata != nil, @"");
pigeonResult.allowMultiple = GetNullableObjectAtIndex(list, 3);
NSAssert(pigeonResult.allowMultiple != nil, @"");
return pigeonResult;
}
+ (nullable FLTMediaSelectionOptions *)nullableFromList:(NSArray *)list {
return (list) ? [FLTMediaSelectionOptions fromList:list] : nil;
}
- (NSArray *)toList {
return @[
(self.maxSize ? [self.maxSize toList] : [NSNull null]),
(self.imageQuality ?: [NSNull null]),
(self.requestFullMetadata ?: [NSNull null]),
(self.allowMultiple ?: [NSNull null]),
];
}
@end
@implementation FLTSourceSpecification
+ (instancetype)makeWithType:(FLTSourceType)type camera:(FLTSourceCamera)camera {
FLTSourceSpecification *pigeonResult = [[FLTSourceSpecification alloc] init];
pigeonResult.type = type;
pigeonResult.camera = camera;
return pigeonResult;
}
+ (FLTSourceSpecification *)fromList:(NSArray *)list {
FLTSourceSpecification *pigeonResult = [[FLTSourceSpecification alloc] init];
pigeonResult.type = [GetNullableObjectAtIndex(list, 0) integerValue];
pigeonResult.camera = [GetNullableObjectAtIndex(list, 1) integerValue];
return pigeonResult;
}
+ (nullable FLTSourceSpecification *)nullableFromList:(NSArray *)list {
return (list) ? [FLTSourceSpecification fromList:list] : nil;
}
- (NSArray *)toList {
return @[
@(self.type),
@(self.camera),
];
}
@end
@interface FLTImagePickerApiCodecReader : FlutterStandardReader
@end
@implementation FLTImagePickerApiCodecReader
- (nullable id)readValueOfType:(UInt8)type {
switch (type) {
case 128:
return [FLTMaxSize fromList:[self readValue]];
case 129:
return [FLTMediaSelectionOptions fromList:[self readValue]];
case 130:
return [FLTSourceSpecification fromList:[self readValue]];
default:
return [super readValueOfType:type];
}
}
@end
@interface FLTImagePickerApiCodecWriter : FlutterStandardWriter
@end
@implementation FLTImagePickerApiCodecWriter
- (void)writeValue:(id)value {
if ([value isKindOfClass:[FLTMaxSize class]]) {
[self writeByte:128];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FLTMediaSelectionOptions class]]) {
[self writeByte:129];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FLTSourceSpecification class]]) {
[self writeByte:130];
[self writeValue:[value toList]];
} else {
[super writeValue:value];
}
}
@end
@interface FLTImagePickerApiCodecReaderWriter : FlutterStandardReaderWriter
@end
@implementation FLTImagePickerApiCodecReaderWriter
- (FlutterStandardWriter *)writerWithData:(NSMutableData *)data {
return [[FLTImagePickerApiCodecWriter alloc] initWithData:data];
}
- (FlutterStandardReader *)readerWithData:(NSData *)data {
return [[FLTImagePickerApiCodecReader alloc] initWithData:data];
}
@end
NSObject<FlutterMessageCodec> *FLTImagePickerApiGetCodec(void) {
static FlutterStandardMessageCodec *sSharedObject = nil;
static dispatch_once_t sPred = 0;
dispatch_once(&sPred, ^{
FLTImagePickerApiCodecReaderWriter *readerWriter =
[[FLTImagePickerApiCodecReaderWriter alloc] init];
sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter];
});
return sSharedObject;
}
void FLTImagePickerApiSetup(id<FlutterBinaryMessenger> binaryMessenger,
NSObject<FLTImagePickerApi> *api) {
{
FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
initWithName:@"dev.flutter.pigeon.ImagePickerApi.pickImage"
binaryMessenger:binaryMessenger
codec:FLTImagePickerApiGetCodec()];
if (api) {
NSCAssert([api respondsToSelector:@selector
(pickImageWithSource:maxSize:quality:fullMetadata:completion:)],
@"FLTImagePickerApi api (%@) doesn't respond to "
@"@selector(pickImageWithSource:maxSize:quality:fullMetadata:completion:)",
api);
[channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
NSArray *args = message;
FLTSourceSpecification *arg_source = GetNullableObjectAtIndex(args, 0);
FLTMaxSize *arg_maxSize = GetNullableObjectAtIndex(args, 1);
NSNumber *arg_imageQuality = GetNullableObjectAtIndex(args, 2);
NSNumber *arg_requestFullMetadata = GetNullableObjectAtIndex(args, 3);
[api pickImageWithSource:arg_source
maxSize:arg_maxSize
quality:arg_imageQuality
fullMetadata:arg_requestFullMetadata
completion:^(NSString *_Nullable output, FlutterError *_Nullable error) {
callback(wrapResult(output, error));
}];
}];
} else {
[channel setMessageHandler:nil];
}
}
{
FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
initWithName:@"dev.flutter.pigeon.ImagePickerApi.pickMultiImage"
binaryMessenger:binaryMessenger
codec:FLTImagePickerApiGetCodec()];
if (api) {
NSCAssert([api respondsToSelector:@selector
(pickMultiImageWithMaxSize:quality:fullMetadata:completion:)],
@"FLTImagePickerApi api (%@) doesn't respond to "
@"@selector(pickMultiImageWithMaxSize:quality:fullMetadata:completion:)",
api);
[channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
NSArray *args = message;
FLTMaxSize *arg_maxSize = GetNullableObjectAtIndex(args, 0);
NSNumber *arg_imageQuality = GetNullableObjectAtIndex(args, 1);
NSNumber *arg_requestFullMetadata = GetNullableObjectAtIndex(args, 2);
[api pickMultiImageWithMaxSize:arg_maxSize
quality:arg_imageQuality
fullMetadata:arg_requestFullMetadata
completion:^(NSArray<NSString *> *_Nullable output,
FlutterError *_Nullable error) {
callback(wrapResult(output, error));
}];
}];
} else {
[channel setMessageHandler:nil];
}
}
{
FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
initWithName:@"dev.flutter.pigeon.ImagePickerApi.pickVideo"
binaryMessenger:binaryMessenger
codec:FLTImagePickerApiGetCodec()];
if (api) {
NSCAssert([api respondsToSelector:@selector(pickVideoWithSource:maxDuration:completion:)],
@"FLTImagePickerApi api (%@) doesn't respond to "
@"@selector(pickVideoWithSource:maxDuration:completion:)",
api);
[channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
NSArray *args = message;
FLTSourceSpecification *arg_source = GetNullableObjectAtIndex(args, 0);
NSNumber *arg_maxDurationSeconds = GetNullableObjectAtIndex(args, 1);
[api pickVideoWithSource:arg_source
maxDuration:arg_maxDurationSeconds
completion:^(NSString *_Nullable output, FlutterError *_Nullable error) {
callback(wrapResult(output, error));
}];
}];
} else {
[channel setMessageHandler:nil];
}
}
/// Selects images and videos and returns their paths.
{
FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
initWithName:@"dev.flutter.pigeon.ImagePickerApi.pickMedia"
binaryMessenger:binaryMessenger
codec:FLTImagePickerApiGetCodec()];
if (api) {
NSCAssert([api respondsToSelector:@selector(pickMediaWithMediaSelectionOptions:completion:)],
@"FLTImagePickerApi api (%@) doesn't respond to "
@"@selector(pickMediaWithMediaSelectionOptions:completion:)",
api);
[channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
NSArray *args = message;
FLTMediaSelectionOptions *arg_mediaSelectionOptions = GetNullableObjectAtIndex(args, 0);
[api pickMediaWithMediaSelectionOptions:arg_mediaSelectionOptions
completion:^(NSArray<NSString *> *_Nullable output,
FlutterError *_Nullable error) {
callback(wrapResult(output, error));
}];
}];
} else {
[channel setMessageHandler:nil];
}
}
}