diff --git a/packages/image_picker/image_picker_ios/CHANGELOG.md b/packages/image_picker/image_picker_ios/CHANGELOG.md index d9b5aedea6b..8d9147a9f06 100644 --- a/packages/image_picker/image_picker_ios/CHANGELOG.md +++ b/packages/image_picker/image_picker_ios/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.8.7+2 + +* Updates to `pigeon` version 9. + ## 0.8.7+1 * Clarifies explanation of endorsement in README. diff --git a/packages/image_picker/image_picker_ios/ios/Classes/messages.g.h b/packages/image_picker/image_picker_ios/ios/Classes/messages.g.h index c87bda59d8f..677b4918135 100644 --- a/packages/image_picker/image_picker_ios/ios/Classes/messages.g.h +++ b/packages/image_picker/image_picker_ios/ios/Classes/messages.g.h @@ -1,9 +1,11 @@ // 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 (v3.0.3), do not edit directly. +// Autogenerated from Pigeon (v9.1.1), do not edit directly. // See also: https://pub.dev/packages/pigeon + #import + @protocol FlutterBinaryMessenger; @protocol FlutterMessageCodec; @class FlutterError; diff --git a/packages/image_picker/image_picker_ios/ios/Classes/messages.g.m b/packages/image_picker/image_picker_ios/ios/Classes/messages.g.m index 71a5b514041..549e6478b3d 100644 --- a/packages/image_picker/image_picker_ios/ios/Classes/messages.g.m +++ b/packages/image_picker/image_picker_ios/ios/Classes/messages.g.m @@ -1,8 +1,9 @@ // 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 (v3.0.3), do not edit directly. +// Autogenerated from Pigeon (v9.1.1), do not edit directly. // See also: https://pub.dev/packages/pigeon + #import "messages.g.h" #import @@ -10,23 +11,13 @@ #error File requires ARC to be enabled. #endif -static NSDictionary *wrapResult(id result, FlutterError *error) { - NSDictionary *errorDict = (NSDictionary *)[NSNull null]; +static NSArray *wrapResult(id result, FlutterError *error) { if (error) { - errorDict = @{ - @"code" : (error.code ? error.code : [NSNull null]), - @"message" : (error.message ? error.message : [NSNull null]), - @"details" : (error.details ? error.details : [NSNull null]), - }; + return @[ + error.code ?: [NSNull null], error.message ?: [NSNull null], error.details ?: [NSNull null] + ]; } - return @{ - @"result" : (result ? result : [NSNull null]), - @"error" : errorDict, - }; -} -static id GetNullableObject(NSDictionary *dict, id key) { - id result = dict[key]; - return (result == [NSNull null]) ? nil : result; + return @[ result ?: [NSNull null] ]; } static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { id result = array[key]; @@ -34,12 +25,15 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { } @interface FLTMaxSize () -+ (FLTMaxSize *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (FLTMaxSize *)fromList:(NSArray *)list; ++ (nullable FLTMaxSize *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end + @interface FLTSourceSpecification () -+ (FLTSourceSpecification *)fromMap:(NSDictionary *)dict; -- (NSDictionary *)toMap; ++ (FLTSourceSpecification *)fromList:(NSArray *)list; ++ (nullable FLTSourceSpecification *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; @end @implementation FLTMaxSize @@ -49,16 +43,20 @@ + (instancetype)makeWithWidth:(nullable NSNumber *)width height:(nullable NSNumb pigeonResult.height = height; return pigeonResult; } -+ (FLTMaxSize *)fromMap:(NSDictionary *)dict { ++ (FLTMaxSize *)fromList:(NSArray *)list { FLTMaxSize *pigeonResult = [[FLTMaxSize alloc] init]; - pigeonResult.width = GetNullableObject(dict, @"width"); - pigeonResult.height = GetNullableObject(dict, @"height"); + pigeonResult.width = GetNullableObjectAtIndex(list, 0); + pigeonResult.height = GetNullableObjectAtIndex(list, 1); return pigeonResult; } -- (NSDictionary *)toMap { - return [NSDictionary - dictionaryWithObjectsAndKeys:(self.width ? self.width : [NSNull null]), @"width", - (self.height ? self.height : [NSNull null]), @"height", nil]; ++ (nullable FLTMaxSize *)nullableFromList:(NSArray *)list { + return (list) ? [FLTMaxSize fromList:list] : nil; +} +- (NSArray *)toList { + return @[ + (self.width ?: [NSNull null]), + (self.height ?: [NSNull null]), + ]; } @end @@ -69,15 +67,20 @@ + (instancetype)makeWithType:(FLTSourceType)type camera:(FLTSourceCamera)camera pigeonResult.camera = camera; return pigeonResult; } -+ (FLTSourceSpecification *)fromMap:(NSDictionary *)dict { ++ (FLTSourceSpecification *)fromList:(NSArray *)list { FLTSourceSpecification *pigeonResult = [[FLTSourceSpecification alloc] init]; - pigeonResult.type = [GetNullableObject(dict, @"type") integerValue]; - pigeonResult.camera = [GetNullableObject(dict, @"camera") integerValue]; + pigeonResult.type = [GetNullableObjectAtIndex(list, 0) integerValue]; + pigeonResult.camera = [GetNullableObjectAtIndex(list, 1) integerValue]; return pigeonResult; } -- (NSDictionary *)toMap { - return [NSDictionary - dictionaryWithObjectsAndKeys:@(self.type), @"type", @(self.camera), @"camera", nil]; ++ (nullable FLTSourceSpecification *)nullableFromList:(NSArray *)list { + return (list) ? [FLTSourceSpecification fromList:list] : nil; +} +- (NSArray *)toList { + return @[ + @(self.type), + @(self.camera), + ]; } @end @@ -87,11 +90,9 @@ @implementation FLTImagePickerApiCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { case 128: - return [FLTMaxSize fromMap:[self readValue]]; - + return [FLTMaxSize fromList:[self readValue]]; case 129: - return [FLTSourceSpecification fromMap:[self readValue]]; - + return [FLTSourceSpecification fromList:[self readValue]]; default: return [super readValueOfType:type]; } @@ -104,10 +105,10 @@ @implementation FLTImagePickerApiCodecWriter - (void)writeValue:(id)value { if ([value isKindOfClass:[FLTMaxSize class]]) { [self writeByte:128]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FLTSourceSpecification class]]) { [self writeByte:129]; - [self writeValue:[value toMap]]; + [self writeValue:[value toList]]; } else { [super writeValue:value]; } @@ -126,8 +127,8 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { @end NSObject *FLTImagePickerApiGetCodec() { - static dispatch_once_t sPred = 0; static FlutterStandardMessageCodec *sSharedObject = nil; + static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ FLTImagePickerApiCodecReaderWriter *readerWriter = [[FLTImagePickerApiCodecReaderWriter alloc] init]; diff --git a/packages/image_picker/image_picker_ios/lib/src/messages.g.dart b/packages/image_picker/image_picker_ios/lib/src/messages.g.dart index 5f8768ba8cc..f999ddf20b4 100644 --- a/packages/image_picker/image_picker_ios/lib/src/messages.g.dart +++ b/packages/image_picker/image_picker_ios/lib/src/messages.g.dart @@ -1,14 +1,14 @@ // 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 (v3.0.3), do not edit directly. +// Autogenerated from Pigeon (v9.1.1), do not edit directly. // See also: https://pub.dev/packages/pigeon -// 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 -// @dart = 2.12 +// 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 + import 'dart:async'; -import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List; +import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; -import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer; +import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; enum SourceCamera { @@ -28,20 +28,21 @@ class MaxSize { }); double? width; + double? height; Object encode() { - final Map pigeonMap = {}; - pigeonMap['width'] = width; - pigeonMap['height'] = height; - return pigeonMap; + return [ + width, + height, + ]; } - static MaxSize decode(Object message) { - final Map pigeonMap = message as Map; + static MaxSize decode(Object result) { + result as List; return MaxSize( - width: pigeonMap['width'] as double?, - height: pigeonMap['height'] as double?, + width: result[0] as double?, + height: result[1] as double?, ); } } @@ -53,22 +54,21 @@ class SourceSpecification { }); SourceType type; + SourceCamera? camera; Object encode() { - final Map pigeonMap = {}; - pigeonMap['type'] = type.index; - pigeonMap['camera'] = camera?.index; - return pigeonMap; + return [ + type.index, + camera?.index, + ]; } - static SourceSpecification decode(Object message) { - final Map pigeonMap = message as Map; + static SourceSpecification decode(Object result) { + result as List; return SourceSpecification( - type: SourceType.values[pigeonMap['type']! as int], - camera: pigeonMap['camera'] != null - ? SourceCamera.values[pigeonMap['camera']! as int] - : null, + type: SourceType.values[result[0]! as int], + camera: result[1] != null ? SourceCamera.values[result[1]! as int] : null, ); } } @@ -93,10 +93,8 @@ class _ImagePickerApiCodec extends StandardMessageCodec { switch (type) { case 128: return MaxSize.decode(readValue(buffer)!); - case 129: return SourceSpecification.decode(readValue(buffer)!); - default: return super.readValueOfType(type, buffer); } @@ -109,7 +107,6 @@ class ImagePickerApi { /// BinaryMessenger will be used which routes to the host platform. ImagePickerApi({BinaryMessenger? binaryMessenger}) : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; static const MessageCodec codec = _ImagePickerApiCodec(); @@ -119,27 +116,25 @@ class ImagePickerApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImagePickerApi.pickImage', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel.send([ + final List? replyList = await channel.send([ arg_source, arg_maxSize, arg_imageQuality, arg_requestFullMetadata - ]) as Map?; - if (replyMap == null) { + ]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { - return (replyMap['result'] as String?); + return (replyList[0] as String?); } } @@ -148,24 +143,22 @@ class ImagePickerApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImagePickerApi.pickMultiImage', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = await channel.send( + final List? replyList = await channel.send( [arg_maxSize, arg_imageQuality, arg_requestFullMetadata]) - as Map?; - if (replyMap == null) { + as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { - return (replyMap['result'] as List?)?.cast(); + return (replyList[0] as List?)?.cast(); } } @@ -174,24 +167,21 @@ class ImagePickerApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImagePickerApi.pickVideo', codec, binaryMessenger: _binaryMessenger); - final Map? replyMap = - await channel.send([arg_source, arg_maxDurationSeconds]) - as Map?; - if (replyMap == null) { + final List? replyList = await channel + .send([arg_source, arg_maxDurationSeconds]) as List?; + if (replyList == null) { throw PlatformException( code: 'channel-error', message: 'Unable to establish connection on channel.', ); - } else if (replyMap['error'] != null) { - final Map error = - (replyMap['error'] as Map?)!; + } else if (replyList.length > 1) { throw PlatformException( - code: (error['code'] as String?)!, - message: error['message'] as String?, - details: error['details'], + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], ); } else { - return (replyMap['result'] as String?); + return (replyList[0] as String?); } } } diff --git a/packages/image_picker/image_picker_ios/pubspec.yaml b/packages/image_picker/image_picker_ios/pubspec.yaml index 4a865dec458..6433da812d6 100755 --- a/packages/image_picker/image_picker_ios/pubspec.yaml +++ b/packages/image_picker/image_picker_ios/pubspec.yaml @@ -2,7 +2,7 @@ name: image_picker_ios description: iOS implementation of the image_picker plugin. repository: https://github.com/flutter/packages/tree/main/packages/image_picker/image_picker_ios issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22 -version: 0.8.7+1 +version: 0.8.7+2 environment: sdk: ">=2.18.0 <4.0.0" @@ -25,4 +25,4 @@ dev_dependencies: flutter_test: sdk: flutter mockito: 5.3.2 - pigeon: ^3.0.2 + pigeon: ^9.1.0 diff --git a/packages/image_picker/image_picker_ios/test/test_api.g.dart b/packages/image_picker/image_picker_ios/test/test_api.g.dart index 1e44f600f57..b14b5816d32 100644 --- a/packages/image_picker/image_picker_ios/test/test_api.g.dart +++ b/packages/image_picker/image_picker_ios/test/test_api.g.dart @@ -1,20 +1,16 @@ // 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 (v3.0.3), do not edit directly. +// Autogenerated from Pigeon (v9.1.1), do not edit directly. // See also: https://pub.dev/packages/pigeon -// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis +// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import // ignore_for_file: avoid_relative_lib_imports -// @dart = 2.12 -import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List; - -// TODO(a14n): remove this import once Flutter 3.1 or later reaches stable (including flutter/flutter#106316) -// ignore: unnecessary_import -import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer; +import 'dart:async'; +import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; +import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; -// Manually changed due to https://github.com/flutter/flutter/issues/97744 import 'package:image_picker_ios/src/messages.g.dart'; class _TestHostImagePickerApiCodec extends StandardMessageCodec { @@ -37,10 +33,8 @@ class _TestHostImagePickerApiCodec extends StandardMessageCodec { switch (type) { case 128: return MaxSize.decode(readValue(buffer)!); - case 129: return SourceSpecification.decode(readValue(buffer)!); - default: return super.readValueOfType(type, buffer); } @@ -52,10 +46,13 @@ abstract class TestHostImagePickerApi { Future pickImage(SourceSpecification source, MaxSize maxSize, int? imageQuality, bool requestFullMetadata); + Future?> pickMultiImage( MaxSize maxSize, int? imageQuality, bool requestFullMetadata); + Future pickVideo( SourceSpecification source, int? maxDurationSeconds); + static void setup(TestHostImagePickerApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -82,7 +79,7 @@ abstract class TestHostImagePickerApi { 'Argument for dev.flutter.pigeon.ImagePickerApi.pickImage was null, expected non-null bool.'); final String? output = await api.pickImage(arg_source!, arg_maxSize!, arg_imageQuality, arg_requestFullMetadata!); - return {'result': output}; + return [output]; }); } } @@ -106,7 +103,7 @@ abstract class TestHostImagePickerApi { 'Argument for dev.flutter.pigeon.ImagePickerApi.pickMultiImage was null, expected non-null bool.'); final List? output = await api.pickMultiImage( arg_maxSize!, arg_imageQuality, arg_requestFullMetadata!); - return {'result': output}; + return [output]; }); } } @@ -128,7 +125,7 @@ abstract class TestHostImagePickerApi { final int? arg_maxDurationSeconds = (args[1] as int?); final String? output = await api.pickVideo(arg_source!, arg_maxDurationSeconds); - return {'result': output}; + return [output]; }); } }