Skip to content

Commit ded5482

Browse files
authored
Update image_picker_ios to the latest pigeon (#3563)
Update image_picker_ios to the latest pigeon
1 parent 08e76c0 commit ded5482

File tree

6 files changed

+108
-114
lines changed

6 files changed

+108
-114
lines changed

packages/image_picker/image_picker_ios/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.8.7+2
2+
3+
* Updates to `pigeon` version 9.
4+
15
## 0.8.7+1
26

37
* Clarifies explanation of endorsement in README.

packages/image_picker/image_picker_ios/ios/Classes/messages.g.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
// Copyright 2013 The Flutter Authors. All rights reserved.
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
4-
// Autogenerated from Pigeon (v3.0.3), do not edit directly.
4+
// Autogenerated from Pigeon (v9.1.1), do not edit directly.
55
// See also: https://pub.dev/packages/pigeon
6+
67
#import <Foundation/Foundation.h>
8+
79
@protocol FlutterBinaryMessenger;
810
@protocol FlutterMessageCodec;
911
@class FlutterError;

packages/image_picker/image_picker_ios/ios/Classes/messages.g.m

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,39 @@
11
// Copyright 2013 The Flutter Authors. All rights reserved.
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
4-
// Autogenerated from Pigeon (v3.0.3), do not edit directly.
4+
// Autogenerated from Pigeon (v9.1.1), do not edit directly.
55
// See also: https://pub.dev/packages/pigeon
6+
67
#import "messages.g.h"
78
#import <Flutter/Flutter.h>
89

910
#if !__has_feature(objc_arc)
1011
#error File requires ARC to be enabled.
1112
#endif
1213

13-
static NSDictionary<NSString *, id> *wrapResult(id result, FlutterError *error) {
14-
NSDictionary *errorDict = (NSDictionary *)[NSNull null];
14+
static NSArray *wrapResult(id result, FlutterError *error) {
1515
if (error) {
16-
errorDict = @{
17-
@"code" : (error.code ? error.code : [NSNull null]),
18-
@"message" : (error.message ? error.message : [NSNull null]),
19-
@"details" : (error.details ? error.details : [NSNull null]),
20-
};
16+
return @[
17+
error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null]
18+
];
2119
}
22-
return @{
23-
@"result" : (result ? result : [NSNull null]),
24-
@"error" : errorDict,
25-
};
26-
}
27-
static id GetNullableObject(NSDictionary *dict, id key) {
28-
id result = dict[key];
29-
return (result == [NSNull null]) ? nil : result;
20+
return @[ result ?: [NSNull null] ];
3021
}
3122
static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) {
3223
id result = array[key];
3324
return (result == [NSNull null]) ? nil : result;
3425
}
3526

3627
@interface FLTMaxSize ()
37-
+ (FLTMaxSize *)fromMap:(NSDictionary *)dict;
38-
- (NSDictionary *)toMap;
28+
+ (FLTMaxSize *)fromList:(NSArray *)list;
29+
+ (nullable FLTMaxSize *)nullableFromList:(NSArray *)list;
30+
- (NSArray *)toList;
3931
@end
32+
4033
@interface FLTSourceSpecification ()
41-
+ (FLTSourceSpecification *)fromMap:(NSDictionary *)dict;
42-
- (NSDictionary *)toMap;
34+
+ (FLTSourceSpecification *)fromList:(NSArray *)list;
35+
+ (nullable FLTSourceSpecification *)nullableFromList:(NSArray *)list;
36+
- (NSArray *)toList;
4337
@end
4438

4539
@implementation FLTMaxSize
@@ -49,16 +43,20 @@ + (instancetype)makeWithWidth:(nullable NSNumber *)width height:(nullable NSNumb
4943
pigeonResult.height = height;
5044
return pigeonResult;
5145
}
52-
+ (FLTMaxSize *)fromMap:(NSDictionary *)dict {
46+
+ (FLTMaxSize *)fromList:(NSArray *)list {
5347
FLTMaxSize *pigeonResult = [[FLTMaxSize alloc] init];
54-
pigeonResult.width = GetNullableObject(dict, @"width");
55-
pigeonResult.height = GetNullableObject(dict, @"height");
48+
pigeonResult.width = GetNullableObjectAtIndex(list, 0);
49+
pigeonResult.height = GetNullableObjectAtIndex(list, 1);
5650
return pigeonResult;
5751
}
58-
- (NSDictionary *)toMap {
59-
return [NSDictionary
60-
dictionaryWithObjectsAndKeys:(self.width ? self.width : [NSNull null]), @"width",
61-
(self.height ? self.height : [NSNull null]), @"height", nil];
52+
+ (nullable FLTMaxSize *)nullableFromList:(NSArray *)list {
53+
return (list) ? [FLTMaxSize fromList:list] : nil;
54+
}
55+
- (NSArray *)toList {
56+
return @[
57+
(self.width ?: [NSNull null]),
58+
(self.height ?: [NSNull null]),
59+
];
6260
}
6361
@end
6462

@@ -69,15 +67,20 @@ + (instancetype)makeWithType:(FLTSourceType)type camera:(FLTSourceCamera)camera
6967
pigeonResult.camera = camera;
7068
return pigeonResult;
7169
}
72-
+ (FLTSourceSpecification *)fromMap:(NSDictionary *)dict {
70+
+ (FLTSourceSpecification *)fromList:(NSArray *)list {
7371
FLTSourceSpecification *pigeonResult = [[FLTSourceSpecification alloc] init];
74-
pigeonResult.type = [GetNullableObject(dict, @"type") integerValue];
75-
pigeonResult.camera = [GetNullableObject(dict, @"camera") integerValue];
72+
pigeonResult.type = [GetNullableObjectAtIndex(list, 0) integerValue];
73+
pigeonResult.camera = [GetNullableObjectAtIndex(list, 1) integerValue];
7674
return pigeonResult;
7775
}
78-
- (NSDictionary *)toMap {
79-
return [NSDictionary
80-
dictionaryWithObjectsAndKeys:@(self.type), @"type", @(self.camera), @"camera", nil];
76+
+ (nullable FLTSourceSpecification *)nullableFromList:(NSArray *)list {
77+
return (list) ? [FLTSourceSpecification fromList:list] : nil;
78+
}
79+
- (NSArray *)toList {
80+
return @[
81+
@(self.type),
82+
@(self.camera),
83+
];
8184
}
8285
@end
8386

@@ -87,11 +90,9 @@ @implementation FLTImagePickerApiCodecReader
8790
- (nullable id)readValueOfType:(UInt8)type {
8891
switch (type) {
8992
case 128:
90-
return [FLTMaxSize fromMap:[self readValue]];
91-
93+
return [FLTMaxSize fromList:[self readValue]];
9294
case 129:
93-
return [FLTSourceSpecification fromMap:[self readValue]];
94-
95+
return [FLTSourceSpecification fromList:[self readValue]];
9596
default:
9697
return [super readValueOfType:type];
9798
}
@@ -104,10 +105,10 @@ @implementation FLTImagePickerApiCodecWriter
104105
- (void)writeValue:(id)value {
105106
if ([value isKindOfClass:[FLTMaxSize class]]) {
106107
[self writeByte:128];
107-
[self writeValue:[value toMap]];
108+
[self writeValue:[value toList]];
108109
} else if ([value isKindOfClass:[FLTSourceSpecification class]]) {
109110
[self writeByte:129];
110-
[self writeValue:[value toMap]];
111+
[self writeValue:[value toList]];
111112
} else {
112113
[super writeValue:value];
113114
}
@@ -126,8 +127,8 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data {
126127
@end
127128

128129
NSObject<FlutterMessageCodec> *FLTImagePickerApiGetCodec() {
129-
static dispatch_once_t sPred = 0;
130130
static FlutterStandardMessageCodec *sSharedObject = nil;
131+
static dispatch_once_t sPred = 0;
131132
dispatch_once(&sPred, ^{
132133
FLTImagePickerApiCodecReaderWriter *readerWriter =
133134
[[FLTImagePickerApiCodecReaderWriter alloc] init];
Lines changed: 47 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// Copyright 2013 The Flutter Authors. All rights reserved.
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
4-
// Autogenerated from Pigeon (v3.0.3), do not edit directly.
4+
// Autogenerated from Pigeon (v9.1.1), do not edit directly.
55
// See also: https://pub.dev/packages/pigeon
6-
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name
7-
// @dart = 2.12
6+
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
7+
88
import 'dart:async';
9-
import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List;
9+
import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
1010

11-
import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer;
11+
import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
1212
import 'package:flutter/services.dart';
1313

1414
enum SourceCamera {
@@ -28,20 +28,21 @@ class MaxSize {
2828
});
2929

3030
double? width;
31+
3132
double? height;
3233

3334
Object encode() {
34-
final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
35-
pigeonMap['width'] = width;
36-
pigeonMap['height'] = height;
37-
return pigeonMap;
35+
return <Object?>[
36+
width,
37+
height,
38+
];
3839
}
3940

40-
static MaxSize decode(Object message) {
41-
final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
41+
static MaxSize decode(Object result) {
42+
result as List<Object?>;
4243
return MaxSize(
43-
width: pigeonMap['width'] as double?,
44-
height: pigeonMap['height'] as double?,
44+
width: result[0] as double?,
45+
height: result[1] as double?,
4546
);
4647
}
4748
}
@@ -53,22 +54,21 @@ class SourceSpecification {
5354
});
5455

5556
SourceType type;
57+
5658
SourceCamera? camera;
5759

5860
Object encode() {
59-
final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
60-
pigeonMap['type'] = type.index;
61-
pigeonMap['camera'] = camera?.index;
62-
return pigeonMap;
61+
return <Object?>[
62+
type.index,
63+
camera?.index,
64+
];
6365
}
6466

65-
static SourceSpecification decode(Object message) {
66-
final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
67+
static SourceSpecification decode(Object result) {
68+
result as List<Object?>;
6769
return SourceSpecification(
68-
type: SourceType.values[pigeonMap['type']! as int],
69-
camera: pigeonMap['camera'] != null
70-
? SourceCamera.values[pigeonMap['camera']! as int]
71-
: null,
70+
type: SourceType.values[result[0]! as int],
71+
camera: result[1] != null ? SourceCamera.values[result[1]! as int] : null,
7272
);
7373
}
7474
}
@@ -93,10 +93,8 @@ class _ImagePickerApiCodec extends StandardMessageCodec {
9393
switch (type) {
9494
case 128:
9595
return MaxSize.decode(readValue(buffer)!);
96-
9796
case 129:
9897
return SourceSpecification.decode(readValue(buffer)!);
99-
10098
default:
10199
return super.readValueOfType(type, buffer);
102100
}
@@ -109,7 +107,6 @@ class ImagePickerApi {
109107
/// BinaryMessenger will be used which routes to the host platform.
110108
ImagePickerApi({BinaryMessenger? binaryMessenger})
111109
: _binaryMessenger = binaryMessenger;
112-
113110
final BinaryMessenger? _binaryMessenger;
114111

115112
static const MessageCodec<Object?> codec = _ImagePickerApiCodec();
@@ -119,27 +116,25 @@ class ImagePickerApi {
119116
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
120117
'dev.flutter.pigeon.ImagePickerApi.pickImage', codec,
121118
binaryMessenger: _binaryMessenger);
122-
final Map<Object?, Object?>? replyMap = await channel.send(<Object?>[
119+
final List<Object?>? replyList = await channel.send(<Object?>[
123120
arg_source,
124121
arg_maxSize,
125122
arg_imageQuality,
126123
arg_requestFullMetadata
127-
]) as Map<Object?, Object?>?;
128-
if (replyMap == null) {
124+
]) as List<Object?>?;
125+
if (replyList == null) {
129126
throw PlatformException(
130127
code: 'channel-error',
131128
message: 'Unable to establish connection on channel.',
132129
);
133-
} else if (replyMap['error'] != null) {
134-
final Map<Object?, Object?> error =
135-
(replyMap['error'] as Map<Object?, Object?>?)!;
130+
} else if (replyList.length > 1) {
136131
throw PlatformException(
137-
code: (error['code'] as String?)!,
138-
message: error['message'] as String?,
139-
details: error['details'],
132+
code: replyList[0]! as String,
133+
message: replyList[1] as String?,
134+
details: replyList[2],
140135
);
141136
} else {
142-
return (replyMap['result'] as String?);
137+
return (replyList[0] as String?);
143138
}
144139
}
145140

@@ -148,24 +143,22 @@ class ImagePickerApi {
148143
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
149144
'dev.flutter.pigeon.ImagePickerApi.pickMultiImage', codec,
150145
binaryMessenger: _binaryMessenger);
151-
final Map<Object?, Object?>? replyMap = await channel.send(
146+
final List<Object?>? replyList = await channel.send(
152147
<Object?>[arg_maxSize, arg_imageQuality, arg_requestFullMetadata])
153-
as Map<Object?, Object?>?;
154-
if (replyMap == null) {
148+
as List<Object?>?;
149+
if (replyList == null) {
155150
throw PlatformException(
156151
code: 'channel-error',
157152
message: 'Unable to establish connection on channel.',
158153
);
159-
} else if (replyMap['error'] != null) {
160-
final Map<Object?, Object?> error =
161-
(replyMap['error'] as Map<Object?, Object?>?)!;
154+
} else if (replyList.length > 1) {
162155
throw PlatformException(
163-
code: (error['code'] as String?)!,
164-
message: error['message'] as String?,
165-
details: error['details'],
156+
code: replyList[0]! as String,
157+
message: replyList[1] as String?,
158+
details: replyList[2],
166159
);
167160
} else {
168-
return (replyMap['result'] as List<Object?>?)?.cast<String?>();
161+
return (replyList[0] as List<Object?>?)?.cast<String?>();
169162
}
170163
}
171164

@@ -174,24 +167,21 @@ class ImagePickerApi {
174167
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
175168
'dev.flutter.pigeon.ImagePickerApi.pickVideo', codec,
176169
binaryMessenger: _binaryMessenger);
177-
final Map<Object?, Object?>? replyMap =
178-
await channel.send(<Object?>[arg_source, arg_maxDurationSeconds])
179-
as Map<Object?, Object?>?;
180-
if (replyMap == null) {
170+
final List<Object?>? replyList = await channel
171+
.send(<Object?>[arg_source, arg_maxDurationSeconds]) as List<Object?>?;
172+
if (replyList == null) {
181173
throw PlatformException(
182174
code: 'channel-error',
183175
message: 'Unable to establish connection on channel.',
184176
);
185-
} else if (replyMap['error'] != null) {
186-
final Map<Object?, Object?> error =
187-
(replyMap['error'] as Map<Object?, Object?>?)!;
177+
} else if (replyList.length > 1) {
188178
throw PlatformException(
189-
code: (error['code'] as String?)!,
190-
message: error['message'] as String?,
191-
details: error['details'],
179+
code: replyList[0]! as String,
180+
message: replyList[1] as String?,
181+
details: replyList[2],
192182
);
193183
} else {
194-
return (replyMap['result'] as String?);
184+
return (replyList[0] as String?);
195185
}
196186
}
197187
}

packages/image_picker/image_picker_ios/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: image_picker_ios
22
description: iOS implementation of the image_picker plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/image_picker/image_picker_ios
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22
5-
version: 0.8.7+1
5+
version: 0.8.7+2
66

77
environment:
88
sdk: ">=2.18.0 <4.0.0"
@@ -25,4 +25,4 @@ dev_dependencies:
2525
flutter_test:
2626
sdk: flutter
2727
mockito: 5.3.2
28-
pigeon: ^3.0.2
28+
pigeon: ^9.1.0

0 commit comments

Comments
 (0)