Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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

* Update to `pigeon` version 9.

## 0.8.7+1

* Clarifies explanation of endorsement in README.
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <Foundation/Foundation.h>

@protocol FlutterBinaryMessenger;
@protocol FlutterMessageCodec;
@class FlutterError;
Expand Down
81 changes: 41 additions & 40 deletions packages/image_picker/image_picker_ios/ios/Classes/messages.g.m
Original file line number Diff line number Diff line change
@@ -1,45 +1,39 @@
// 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 <Flutter/Flutter.h>

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

static NSDictionary<NSString *, id> *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];
return (result == [NSNull null]) ? nil : result;
}

@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
Expand All @@ -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

Expand All @@ -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

Expand All @@ -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];
}
Expand All @@ -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];
}
Expand All @@ -126,8 +127,8 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data {
@end

NSObject<FlutterMessageCodec> *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];
Expand Down
104 changes: 47 additions & 57 deletions packages/image_picker/image_picker_ios/lib/src/messages.g.dart
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -28,20 +28,21 @@ class MaxSize {
});

double? width;

double? height;

Object encode() {
final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
pigeonMap['width'] = width;
pigeonMap['height'] = height;
return pigeonMap;
return <Object?>[
width,
height,
];
}

static MaxSize decode(Object message) {
final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
static MaxSize decode(Object result) {
result as List<Object?>;
return MaxSize(
width: pigeonMap['width'] as double?,
height: pigeonMap['height'] as double?,
width: result[0] as double?,
height: result[1] as double?,
);
}
}
Expand All @@ -53,22 +54,21 @@ class SourceSpecification {
});

SourceType type;

SourceCamera? camera;

Object encode() {
final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
pigeonMap['type'] = type.index;
pigeonMap['camera'] = camera?.index;
return pigeonMap;
return <Object?>[
type.index,
camera?.index,
];
}

static SourceSpecification decode(Object message) {
final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
static SourceSpecification decode(Object result) {
result as List<Object?>;
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,
);
}
}
Expand All @@ -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);
}
Expand All @@ -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<Object?> codec = _ImagePickerApiCodec();
Expand All @@ -119,27 +116,25 @@ class ImagePickerApi {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.ImagePickerApi.pickImage', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = await channel.send(<Object?>[
final List<Object?>? replyList = await channel.send(<Object?>[
arg_source,
arg_maxSize,
arg_imageQuality,
arg_requestFullMetadata
]) as Map<Object?, Object?>?;
if (replyMap == null) {
]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
(replyMap['error'] as Map<Object?, Object?>?)!;
} 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?);
}
}

Expand All @@ -148,24 +143,22 @@ class ImagePickerApi {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.ImagePickerApi.pickMultiImage', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = await channel.send(
final List<Object?>? replyList = await channel.send(
<Object?>[arg_maxSize, arg_imageQuality, arg_requestFullMetadata])
as Map<Object?, Object?>?;
if (replyMap == null) {
as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
(replyMap['error'] as Map<Object?, Object?>?)!;
} 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<Object?>?)?.cast<String?>();
return (replyList[0] as List<Object?>?)?.cast<String?>();
}
}

Expand All @@ -174,24 +167,21 @@ class ImagePickerApi {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.ImagePickerApi.pickVideo', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
await channel.send(<Object?>[arg_source, arg_maxDurationSeconds])
as Map<Object?, Object?>?;
if (replyMap == null) {
final List<Object?>? replyList = await channel
.send(<Object?>[arg_source, arg_maxDurationSeconds]) as List<Object?>?;
if (replyList == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
(replyMap['error'] as Map<Object?, Object?>?)!;
} 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?);
}
}
}
4 changes: 2 additions & 2 deletions packages/image_picker/image_picker_ios/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.8

environment:
sdk: ">=2.18.0 <4.0.0"
Expand All @@ -25,4 +25,4 @@ dev_dependencies:
flutter_test:
sdk: flutter
mockito: 5.3.2
pigeon: ^3.0.2
pigeon: ^9.1.0
Loading