From ef3a2fdbb9f18f63db7315d05b4e2234e0ea7e04 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Tue, 1 Apr 2025 15:29:31 -0400 Subject: [PATCH 01/25] add lens type info to camera plugin [ios-only] --- .../camera_avfoundation/CameraPlugin.m | 27 ++++++++++++++-- .../camera_avfoundation/lib/src/utils.dart | 17 +++++++++- .../camera_avfoundation/pigeons/messages.dart | 31 +++++++++++++++++++ .../lib/src/types/camera_description.dart | 16 ++++++++-- 4 files changed, 86 insertions(+), 5 deletions(-) diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m index b9e1ef1850c3..517001d190cc 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m @@ -148,8 +148,11 @@ - (void)availableCamerasWithCompletion: position:AVCaptureDevicePositionUnspecified]; NSMutableArray *reply = [[NSMutableArray alloc] initWithCapacity:devices.count]; - for (NSObject *device in devices) { + + for (AVCaptureDevice *device in devices) { FCPPlatformCameraLensDirection lensFacing; + FCPPlatformCameraLensType lensType; + switch (device.position) { case AVCaptureDevicePositionBack: lensFacing = FCPPlatformCameraLensDirectionBack; @@ -161,8 +164,28 @@ - (void)availableCamerasWithCompletion: lensFacing = FCPPlatformCameraLensDirectionExternal; break; } + + if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInWideAngleCamera]) { + lensType = FCPPlatformCameraLensTypeWide; + } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInTelephotoCamera]) { + lensType = FCPPlatformCameraLensTypeTelephoto; + } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInUltraWideCamera]) { + lensType = FCPPlatformCameraLensTypeUltraWide; + } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInDualCamera]) { + lensType = FCPPlatformCameraLensTypeDual; + } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInDualWideCamera]) { + lensType = FCPPlatformCameraLensTypeDualWide; + } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInTripleCamera]) { + lensType = FCPPlatformCameraLensTypeTriple; + } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeContinuityCamera]) { + lensType = FCPPlatformCameraLensTypeContinuity; + } else { + lensType = FCPPlatformCameraLensTypeUnknown; + } + [reply addObject:[FCPPlatformCameraDescription makeWithName:device.uniqueID - lensDirection:lensFacing]]; + lensDirection:lensFacing + lensType:lensType]]; } completion(reply, nil); }); diff --git a/packages/camera/camera_avfoundation/lib/src/utils.dart b/packages/camera/camera_avfoundation/lib/src/utils.dart index 3fd7f59a891b..266f38a816f1 100644 --- a/packages/camera/camera_avfoundation/lib/src/utils.dart +++ b/packages/camera/camera_avfoundation/lib/src/utils.dart @@ -13,7 +13,8 @@ CameraDescription cameraDescriptionFromPlatform( return CameraDescription( name: camera.name, lensDirection: cameraLensDirectionFromPlatform(camera.lensDirection), - sensorOrientation: 90); + sensorOrientation: 90, + lensType: cameraLensTypeFromPlatform(camera.lensType)); } /// Converts a Pigeon [PlatformCameraLensDirection] to a [CameraLensDirection]. @@ -26,6 +27,20 @@ CameraLensDirection cameraLensDirectionFromPlatform( }; } +/// Converts a Pigeon [PlatformCameraLensType] to a [CameraLensType]. +CameraLensType cameraLensTypeFromPlatform(PlatformCameraLensType type) { + return switch (type) { + PlatformCameraLensType.wide => CameraLensType.wide, + PlatformCameraLensType.telephoto => CameraLensType.telephoto, + PlatformCameraLensType.ultraWide => CameraLensType.ultraWide, + PlatformCameraLensType.dual => CameraLensType.dual, + PlatformCameraLensType.dualWide => CameraLensType.dualWide, + PlatformCameraLensType.triple => CameraLensType.triple, + PlatformCameraLensType.continuity => CameraLensType.continuity, + PlatformCameraLensType.unknown => CameraLensType.unknown, + }; +} + /// Convents the given device orientation to Pigeon. PlatformDeviceOrientation serializeDeviceOrientation( DeviceOrientation orientation) { diff --git a/packages/camera/camera_avfoundation/pigeons/messages.dart b/packages/camera/camera_avfoundation/pigeons/messages.dart index 272ea288960d..58fc5a50fb16 100644 --- a/packages/camera/camera_avfoundation/pigeons/messages.dart +++ b/packages/camera/camera_avfoundation/pigeons/messages.dart @@ -29,6 +29,33 @@ enum PlatformCameraLensDirection { external, } +// Pigeon version of CameraLensDirection. +enum PlatformCameraLensType { + /// A built-in wide-angle camera device type. + wide, + + /// A built-in camera device type with a shorter focal length than a wide-angle camera. + telephoto, + + /// A built-in camera device type with a longer focal length than a wide-angle camera. + ultraWide, + + /// A built-in camera device type that consists of a wide-angle and telephoto camera. + dual, + + /// A built-in camera device type that consists of two cameras of fixed focal length, one ultrawide angle and one wide angle. + dualWide, + + /// A built-in camera device type that consists of three cameras of fixed focal length, one ultrawide angle, one wide angle, and one telephoto. + triple, + + /// A Continuity Camera device type. + continuity, + + /// Unknown camera device type. + unknown, +} + // Pigeon version of DeviceOrientation. enum PlatformDeviceOrientation { portraitUp, @@ -84,6 +111,7 @@ class PlatformCameraDescription { PlatformCameraDescription({ required this.name, required this.lensDirection, + required this.lensType, }); /// The name of the camera device. @@ -91,6 +119,9 @@ class PlatformCameraDescription { /// The direction the camera is facing. final PlatformCameraLensDirection lensDirection; + + /// The type of the camera lens. + final PlatformCameraLensType lensType; } // Pigeon version of the data needed for a CameraInitializedEvent. diff --git a/packages/camera/camera_platform_interface/lib/src/types/camera_description.dart b/packages/camera/camera_platform_interface/lib/src/types/camera_description.dart index 4d5b3ec543f3..1a666ccf0937 100644 --- a/packages/camera/camera_platform_interface/lib/src/types/camera_description.dart +++ b/packages/camera/camera_platform_interface/lib/src/types/camera_description.dart @@ -23,12 +23,24 @@ enum CameraLensType { /// A built-in wide-angle camera device type. wide, - /// A built-in camera device type with a longer focal length than a wide-angle camera. + /// A built-in camera device type with a shorter focal length than a wide-angle camera. telephoto, - /// A built-in camera device type with a shorter focal length than a wide-angle camera. + /// A built-in camera device type with a longer focal length than a wide-angle camera. ultraWide, + /// A built-in camera device type that consists of a wide-angle and telephoto camera. + dual, + + /// A built-in camera device type that consists of two cameras of fixed focal length, one ultrawide angle and one wide angle. + dualWide, + + /// A built-in camera device type that consists of three cameras of fixed focal length, one ultrawide angle, one wide angle, and one telephoto. + triple, + + /// A Continuity Camera device type. + continuity, + /// Unknown camera device type. unknown, } From 3cfb74c5b481e42564e0df7f06e359a2be1fd6d5 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Tue, 1 Apr 2025 15:29:31 -0400 Subject: [PATCH 02/25] run pigeon generator --- .../include/camera_avfoundation/messages.g.h | 141 +-- .../Sources/camera_avfoundation/messages.g.m | 918 +++++++----------- .../lib/src/messages.g.dart | 465 ++++----- 3 files changed, 636 insertions(+), 888 deletions(-) diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h index 2f1d8646afac..55a77d0a4d18 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h @@ -1,7 +1,7 @@ // 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 (v22.4.2), do not edit directly. +// Autogenerated from Pigeon (v18.0.1), do not edit directly. // See also: https://pub.dev/packages/pigeon #import @@ -28,6 +28,31 @@ typedef NS_ENUM(NSUInteger, FCPPlatformCameraLensDirection) { - (instancetype)initWithValue:(FCPPlatformCameraLensDirection)value; @end +typedef NS_ENUM(NSUInteger, FCPPlatformCameraLensType) { + /// A built-in wide-angle camera device type. + FCPPlatformCameraLensTypeWide = 0, + /// A built-in camera device type with a shorter focal length than a wide-angle camera. + FCPPlatformCameraLensTypeTelephoto = 1, + /// A built-in camera device type with a longer focal length than a wide-angle camera. + FCPPlatformCameraLensTypeUltraWide = 2, + /// A built-in camera device type that consists of a wide-angle and telephoto camera. + FCPPlatformCameraLensTypeDual = 3, + /// A built-in camera device type that consists of two cameras of fixed focal length, one ultrawide angle and one wide angle. + FCPPlatformCameraLensTypeDualWide = 4, + /// A built-in camera device type that consists of three cameras of fixed focal length, one ultrawide angle, one wide angle, and one telephoto. + FCPPlatformCameraLensTypeTriple = 5, + /// A Continuity Camera device type. + FCPPlatformCameraLensTypeContinuity = 6, + /// Unknown camera device type. + FCPPlatformCameraLensTypeUnknown = 7, +}; + +/// Wrapper for FCPPlatformCameraLensType to allow for nullability. +@interface FCPPlatformCameraLensTypeBox : NSObject +@property(nonatomic, assign) FCPPlatformCameraLensType value; +- (instancetype)initWithValue:(FCPPlatformCameraLensType)value; +@end + typedef NS_ENUM(NSUInteger, FCPPlatformDeviceOrientation) { FCPPlatformDeviceOrientationPortraitUp = 0, FCPPlatformDeviceOrientationLandscapeLeft = 1, @@ -124,62 +149,67 @@ typedef NS_ENUM(NSUInteger, FCPPlatformResolutionPreset) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithName:(NSString *)name - lensDirection:(FCPPlatformCameraLensDirection)lensDirection; + lensDirection:(FCPPlatformCameraLensDirection)lensDirection + lensType:(FCPPlatformCameraLensType)lensType; /// The name of the camera device. -@property(nonatomic, copy) NSString *name; +@property(nonatomic, copy) NSString * name; /// The direction the camera is facing. @property(nonatomic, assign) FCPPlatformCameraLensDirection lensDirection; +/// The type of the camera lens. +@property(nonatomic, assign) FCPPlatformCameraLensType lensType; @end @interface FCPPlatformCameraState : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithPreviewSize:(FCPPlatformSize *)previewSize - exposureMode:(FCPPlatformExposureMode)exposureMode - focusMode:(FCPPlatformFocusMode)focusMode - exposurePointSupported:(BOOL)exposurePointSupported - focusPointSupported:(BOOL)focusPointSupported; + exposureMode:(FCPPlatformExposureMode)exposureMode + focusMode:(FCPPlatformFocusMode)focusMode + exposurePointSupported:(BOOL )exposurePointSupported + focusPointSupported:(BOOL )focusPointSupported; /// The size of the preview, in pixels. -@property(nonatomic, strong) FCPPlatformSize *previewSize; +@property(nonatomic, strong) FCPPlatformSize * previewSize; /// The default exposure mode @property(nonatomic, assign) FCPPlatformExposureMode exposureMode; /// The default focus mode @property(nonatomic, assign) FCPPlatformFocusMode focusMode; /// Whether setting exposure points is supported. -@property(nonatomic, assign) BOOL exposurePointSupported; +@property(nonatomic, assign) BOOL exposurePointSupported; /// Whether setting focus points is supported. -@property(nonatomic, assign) BOOL focusPointSupported; +@property(nonatomic, assign) BOOL focusPointSupported; @end @interface FCPPlatformMediaSettings : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolutionPreset - framesPerSecond:(nullable NSNumber *)framesPerSecond - videoBitrate:(nullable NSNumber *)videoBitrate - audioBitrate:(nullable NSNumber *)audioBitrate - enableAudio:(BOOL)enableAudio; + framesPerSecond:(nullable NSNumber *)framesPerSecond + videoBitrate:(nullable NSNumber *)videoBitrate + audioBitrate:(nullable NSNumber *)audioBitrate + enableAudio:(BOOL )enableAudio; @property(nonatomic, assign) FCPPlatformResolutionPreset resolutionPreset; -@property(nonatomic, strong, nullable) NSNumber *framesPerSecond; -@property(nonatomic, strong, nullable) NSNumber *videoBitrate; -@property(nonatomic, strong, nullable) NSNumber *audioBitrate; -@property(nonatomic, assign) BOOL enableAudio; +@property(nonatomic, strong, nullable) NSNumber * framesPerSecond; +@property(nonatomic, strong, nullable) NSNumber * videoBitrate; +@property(nonatomic, strong, nullable) NSNumber * audioBitrate; +@property(nonatomic, assign) BOOL enableAudio; @end @interface FCPPlatformPoint : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithX:(double)x y:(double)y; -@property(nonatomic, assign) double x; -@property(nonatomic, assign) double y; ++ (instancetype)makeWithX:(double )x + y:(double )y; +@property(nonatomic, assign) double x; +@property(nonatomic, assign) double y; @end @interface FCPPlatformSize : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithWidth:(double)width height:(double)height; -@property(nonatomic, assign) double width; -@property(nonatomic, assign) double height; ++ (instancetype)makeWithWidth:(double )width + height:(double )height; +@property(nonatomic, assign) double width; +@property(nonatomic, assign) double height; @end /// The codec used by all APIs. @@ -187,16 +217,11 @@ NSObject *FCPGetMessagesCodec(void); @protocol FCPCameraApi /// Returns the list of available cameras. -- (void)availableCamerasWithCompletion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; +- (void)availableCamerasWithCompletion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion; /// Create a new camera with the given settings, and returns its ID. -- (void)createCameraWithName:(NSString *)cameraName - settings:(FCPPlatformMediaSettings *)settings - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; +- (void)createCameraWithName:(NSString *)cameraName settings:(FCPPlatformMediaSettings *)settings completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Initializes the camera with the given ID. -- (void)initializeCamera:(NSInteger)cameraId - withImageFormat:(FCPPlatformImageFormatGroup)imageFormat - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)initializeCamera:(NSInteger)cameraId withImageFormat:(FCPPlatformImageFormatGroup)imageFormat completion:(void (^)(FlutterError *_Nullable))completion; /// Begins streaming frames from the camera. - (void)startImageStreamWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Stops streaming frames from the camera. @@ -210,39 +235,32 @@ NSObject *FCPGetMessagesCodec(void); /// and any associated resources can be cleaned up. - (void)disposeCamera:(NSInteger)cameraId completion:(void (^)(FlutterError *_Nullable))completion; /// Locks the camera capture to the current device orientation. -- (void)lockCaptureOrientation:(FCPPlatformDeviceOrientation)orientation - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)lockCaptureOrientation:(FCPPlatformDeviceOrientation)orientation completion:(void (^)(FlutterError *_Nullable))completion; /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. - (void)unlockCaptureOrientationWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Takes a picture with the current settings, and returns the path to the /// resulting file. -- (void)takePictureWithCompletion:(void (^)(NSString *_Nullable, - FlutterError *_Nullable))completion; +- (void)takePictureWithCompletion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; /// Does any preprocessing necessary before beginning to record video. - (void)prepareForVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Begins recording video, optionally enabling streaming to Dart at the same /// time. -- (void)startVideoRecordingWithStreaming:(BOOL)enableStream - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)startVideoRecordingWithStreaming:(BOOL)enableStream completion:(void (^)(FlutterError *_Nullable))completion; /// Stops recording video, and results the path to the resulting file. -- (void)stopVideoRecordingWithCompletion:(void (^)(NSString *_Nullable, - FlutterError *_Nullable))completion; +- (void)stopVideoRecordingWithCompletion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; /// Pauses video recording. - (void)pauseVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Resumes a previously paused video recording. - (void)resumeVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given flash mode. -- (void)setFlashMode:(FCPPlatformFlashMode)mode - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFlashMode:(FCPPlatformFlashMode)mode completion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given exposure mode. -- (void)setExposureMode:(FCPPlatformExposureMode)mode - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setExposureMode:(FCPPlatformExposureMode)mode completion:(void (^)(FlutterError *_Nullable))completion; /// Anchors auto-exposure to the given point in (0,1) coordinate space. /// /// A null value resets to the default exposure point. -- (void)setExposurePoint:(nullable FCPPlatformPoint *)point - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setExposurePoint:(nullable FCPPlatformPoint *)point completion:(void (^)(FlutterError *_Nullable))completion; /// Returns the minimum exposure offset supported by the camera. - (void)getMinimumExposureOffset:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Returns the maximum exposure offset supported by the camera. @@ -250,13 +268,11 @@ NSObject *FCPGetMessagesCodec(void); /// Sets the exposure offset manually to the given value. - (void)setExposureOffset:(double)offset completion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given focus mode. -- (void)setFocusMode:(FCPPlatformFocusMode)mode - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFocusMode:(FCPPlatformFocusMode)mode completion:(void (^)(FlutterError *_Nullable))completion; /// Anchors auto-focus to the given point in (0,1) coordinate space. /// /// A null value resets to the default focus point. -- (void)setFocusPoint:(nullable FCPPlatformPoint *)point - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFocusPoint:(nullable FCPPlatformPoint *)point completion:(void (^)(FlutterError *_Nullable))completion; /// Returns the minimum zoom level supported by the camera. - (void)getMinimumZoomLevel:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Returns the maximum zoom level supported by the camera. @@ -270,28 +286,21 @@ NSObject *FCPGetMessagesCodec(void); /// Changes the camera used while recording video. /// /// This should only be called while video recording is active. -- (void)updateDescriptionWhileRecordingCameraName:(NSString *)cameraName - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)updateDescriptionWhileRecordingCameraName:(NSString *)cameraName completion:(void (^)(FlutterError *_Nullable))completion; /// Sets the file format used for taking pictures. -- (void)setImageFileFormat:(FCPPlatformImageFileFormat)format - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setImageFileFormat:(FCPPlatformImageFileFormat)format completion:(void (^)(FlutterError *_Nullable))completion; @end -extern void SetUpFCPCameraApi(id binaryMessenger, - NSObject *_Nullable api); +extern void SetUpFCPCameraApi(id binaryMessenger, NSObject *_Nullable api); -extern void SetUpFCPCameraApiWithSuffix(id binaryMessenger, - NSObject *_Nullable api, - NSString *messageChannelSuffix); +extern void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSObject *_Nullable api, NSString *messageChannelSuffix); /// Handler for native callbacks that are not tied to a specific camera ID. @interface FCPCameraGlobalEventApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger messageChannelSuffix:(nullable NSString *)messageChannelSuffix; /// Called when the device's physical orientation changes. -- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)orientation - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)orientation completion:(void (^)(FlutterError *_Nullable))completion; @end /// Handler for native callbacks that are tied to a specific camera ID. @@ -299,11 +308,9 @@ extern void SetUpFCPCameraApiWithSuffix(id binaryMesseng /// This is intended to be initialized with the camera ID as a suffix. @interface FCPCameraEventApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger messageChannelSuffix:(nullable NSString *)messageChannelSuffix; /// Called when the camera is inialitized for use. -- (void)initializedWithState:(FCPPlatformCameraState *)initialState - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)initializedWithState:(FCPPlatformCameraState *)initialState completion:(void (^)(FlutterError *_Nullable))completion; /// Called when an error occurs in the camera. /// /// This should be used for errors that occur outside of the context of diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m index 0164b4d6c6cc..93073016a9b8 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m @@ -1,10 +1,10 @@ // 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 (v22.4.2), do not edit directly. +// Autogenerated from Pigeon (v18.0.1), do not edit directly. // See also: https://pub.dev/packages/pigeon -#import "./include/camera_avfoundation/messages.g.h" +#import "messages.g.h" #if TARGET_OS_OSX #import @@ -26,12 +26,7 @@ } static FlutterError *createConnectionError(NSString *channelName) { - return [FlutterError - errorWithCode:@"channel-error" - message:[NSString stringWithFormat:@"%@/%@/%@", - @"Unable to establish connection on channel: '", - channelName, @"'."] - details:@""]; + return [FlutterError errorWithCode:@"channel-error" message:[NSString stringWithFormat:@"%@/%@/%@", @"Unable to establish connection on channel: '", channelName, @"'."] details:@""]; } static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { @@ -49,6 +44,16 @@ - (instancetype)initWithValue:(FCPPlatformCameraLensDirection)value { } @end +@implementation FCPPlatformCameraLensTypeBox +- (instancetype)initWithValue:(FCPPlatformCameraLensType)value { + self = [super init]; + if (self) { + _value = value; + } + return self; +} +@end + @implementation FCPPlatformDeviceOrientationBox - (instancetype)initWithValue:(FCPPlatformDeviceOrientation)value { self = [super init]; @@ -152,18 +157,19 @@ + (nullable FCPPlatformSize *)nullableFromList:(NSArray *)list; @implementation FCPPlatformCameraDescription + (instancetype)makeWithName:(NSString *)name - lensDirection:(FCPPlatformCameraLensDirection)lensDirection { - FCPPlatformCameraDescription *pigeonResult = [[FCPPlatformCameraDescription alloc] init]; + lensDirection:(FCPPlatformCameraLensDirection)lensDirection + lensType:(FCPPlatformCameraLensType)lensType { + FCPPlatformCameraDescription* pigeonResult = [[FCPPlatformCameraDescription alloc] init]; pigeonResult.name = name; pigeonResult.lensDirection = lensDirection; + pigeonResult.lensType = lensType; return pigeonResult; } + (FCPPlatformCameraDescription *)fromList:(NSArray *)list { FCPPlatformCameraDescription *pigeonResult = [[FCPPlatformCameraDescription alloc] init]; pigeonResult.name = GetNullableObjectAtIndex(list, 0); - FCPPlatformCameraLensDirectionBox *boxedFCPPlatformCameraLensDirection = - GetNullableObjectAtIndex(list, 1); - pigeonResult.lensDirection = boxedFCPPlatformCameraLensDirection.value; + pigeonResult.lensDirection = [GetNullableObjectAtIndex(list, 1) integerValue]; + pigeonResult.lensType = [GetNullableObjectAtIndex(list, 2) integerValue]; return pigeonResult; } + (nullable FCPPlatformCameraDescription *)nullableFromList:(NSArray *)list { @@ -172,18 +178,19 @@ + (nullable FCPPlatformCameraDescription *)nullableFromList:(NSArray *)list - (NSArray *)toList { return @[ self.name ?: [NSNull null], - [[FCPPlatformCameraLensDirectionBox alloc] initWithValue:self.lensDirection], + @(self.lensDirection), + @(self.lensType), ]; } @end @implementation FCPPlatformCameraState + (instancetype)makeWithPreviewSize:(FCPPlatformSize *)previewSize - exposureMode:(FCPPlatformExposureMode)exposureMode - focusMode:(FCPPlatformFocusMode)focusMode - exposurePointSupported:(BOOL)exposurePointSupported - focusPointSupported:(BOOL)focusPointSupported { - FCPPlatformCameraState *pigeonResult = [[FCPPlatformCameraState alloc] init]; + exposureMode:(FCPPlatformExposureMode)exposureMode + focusMode:(FCPPlatformFocusMode)focusMode + exposurePointSupported:(BOOL )exposurePointSupported + focusPointSupported:(BOOL )focusPointSupported { + FCPPlatformCameraState* pigeonResult = [[FCPPlatformCameraState alloc] init]; pigeonResult.previewSize = previewSize; pigeonResult.exposureMode = exposureMode; pigeonResult.focusMode = focusMode; @@ -194,10 +201,8 @@ + (instancetype)makeWithPreviewSize:(FCPPlatformSize *)previewSize + (FCPPlatformCameraState *)fromList:(NSArray *)list { FCPPlatformCameraState *pigeonResult = [[FCPPlatformCameraState alloc] init]; pigeonResult.previewSize = GetNullableObjectAtIndex(list, 0); - FCPPlatformExposureModeBox *boxedFCPPlatformExposureMode = GetNullableObjectAtIndex(list, 1); - pigeonResult.exposureMode = boxedFCPPlatformExposureMode.value; - FCPPlatformFocusModeBox *boxedFCPPlatformFocusMode = GetNullableObjectAtIndex(list, 2); - pigeonResult.focusMode = boxedFCPPlatformFocusMode.value; + pigeonResult.exposureMode = [GetNullableObjectAtIndex(list, 1) integerValue]; + pigeonResult.focusMode = [GetNullableObjectAtIndex(list, 2) integerValue]; pigeonResult.exposurePointSupported = [GetNullableObjectAtIndex(list, 3) boolValue]; pigeonResult.focusPointSupported = [GetNullableObjectAtIndex(list, 4) boolValue]; return pigeonResult; @@ -208,8 +213,8 @@ + (nullable FCPPlatformCameraState *)nullableFromList:(NSArray *)list { - (NSArray *)toList { return @[ self.previewSize ?: [NSNull null], - [[FCPPlatformExposureModeBox alloc] initWithValue:self.exposureMode], - [[FCPPlatformFocusModeBox alloc] initWithValue:self.focusMode], + @(self.exposureMode), + @(self.focusMode), @(self.exposurePointSupported), @(self.focusPointSupported), ]; @@ -218,11 +223,11 @@ + (nullable FCPPlatformCameraState *)nullableFromList:(NSArray *)list { @implementation FCPPlatformMediaSettings + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolutionPreset - framesPerSecond:(nullable NSNumber *)framesPerSecond - videoBitrate:(nullable NSNumber *)videoBitrate - audioBitrate:(nullable NSNumber *)audioBitrate - enableAudio:(BOOL)enableAudio { - FCPPlatformMediaSettings *pigeonResult = [[FCPPlatformMediaSettings alloc] init]; + framesPerSecond:(nullable NSNumber *)framesPerSecond + videoBitrate:(nullable NSNumber *)videoBitrate + audioBitrate:(nullable NSNumber *)audioBitrate + enableAudio:(BOOL )enableAudio { + FCPPlatformMediaSettings* pigeonResult = [[FCPPlatformMediaSettings alloc] init]; pigeonResult.resolutionPreset = resolutionPreset; pigeonResult.framesPerSecond = framesPerSecond; pigeonResult.videoBitrate = videoBitrate; @@ -256,8 +261,9 @@ + (nullable FCPPlatformMediaSettings *)nullableFromList:(NSArray *)list { @end @implementation FCPPlatformPoint -+ (instancetype)makeWithX:(double)x y:(double)y { - FCPPlatformPoint *pigeonResult = [[FCPPlatformPoint alloc] init]; ++ (instancetype)makeWithX:(double )x + y:(double )y { + FCPPlatformPoint* pigeonResult = [[FCPPlatformPoint alloc] init]; pigeonResult.x = x; pigeonResult.y = y; return pigeonResult; @@ -280,8 +286,9 @@ + (nullable FCPPlatformPoint *)nullableFromList:(NSArray *)list { @end @implementation FCPPlatformSize -+ (instancetype)makeWithWidth:(double)width height:(double)height { - FCPPlatformSize *pigeonResult = [[FCPPlatformSize alloc] init]; ++ (instancetype)makeWithWidth:(double )width + height:(double )height { + FCPPlatformSize* pigeonResult = [[FCPPlatformSize alloc] init]; pigeonResult.width = width; pigeonResult.height = height; return pigeonResult; @@ -308,61 +315,11 @@ @interface FCPMessagesPigeonCodecReader : FlutterStandardReader @implementation FCPMessagesPigeonCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 129: { - NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformCameraLensDirectionBox alloc] - initWithValue:[enumAsNumber integerValue]]; - } - case 130: { - NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformDeviceOrientationBox alloc] - initWithValue:[enumAsNumber integerValue]]; - } - case 131: { - NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil - ? nil - : [[FCPPlatformExposureModeBox alloc] initWithValue:[enumAsNumber integerValue]]; - } - case 132: { - NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil - ? nil - : [[FCPPlatformFlashModeBox alloc] initWithValue:[enumAsNumber integerValue]]; - } - case 133: { - NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil - ? nil - : [[FCPPlatformFocusModeBox alloc] initWithValue:[enumAsNumber integerValue]]; - } - case 134: { - NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformImageFileFormatBox alloc] - initWithValue:[enumAsNumber integerValue]]; - } - case 135: { - NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformImageFormatGroupBox alloc] - initWithValue:[enumAsNumber integerValue]]; - } - case 136: { - NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformResolutionPresetBox alloc] - initWithValue:[enumAsNumber integerValue]]; - } - case 137: + case 128: return [FCPPlatformCameraDescription fromList:[self readValue]]; - case 138: - return [FCPPlatformCameraState fromList:[self readValue]]; - case 139: + case 129: return [FCPPlatformMediaSettings fromList:[self readValue]]; - case 140: + case 130: return [FCPPlatformPoint fromList:[self readValue]]; case 141: return [FCPPlatformSize fromList:[self readValue]]; @@ -454,29 +411,19 @@ void SetUpFCPCameraApi(id binaryMessenger, NSObject binaryMessenger, - NSObject *api, NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 - ? [NSString stringWithFormat:@".%@", messageChannelSuffix] - : @""; +void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSObject *api, NSString *messageChannelSuffix) { + messageChannelSuffix = messageChannelSuffix.length > 0 ? [NSString stringWithFormat: @".%@", messageChannelSuffix] : @""; /// Returns the list of available cameras. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.getAvailableCameras", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(availableCamerasWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(availableCamerasWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(availableCamerasWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(availableCamerasWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api availableCamerasWithCompletion:^( - NSArray *_Nullable output, - FlutterError *_Nullable error) { + [api availableCamerasWithCompletion:^(NSArray *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -486,27 +433,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Create a new camera with the given settings, and returns its ID. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.create", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.create", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createCameraWithName:settings:completion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(createCameraWithName:settings:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(createCameraWithName:settings:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(createCameraWithName:settings:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_cameraName = GetNullableObjectAtIndex(args, 0); FCPPlatformMediaSettings *arg_settings = GetNullableObjectAtIndex(args, 1); - [api createCameraWithName:arg_cameraName - settings:arg_settings - completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api createCameraWithName:arg_cameraName settings:arg_settings completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -514,30 +454,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Initializes the camera with the given ID. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(initializeCamera:withImageFormat:completion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(initializeCamera:withImageFormat:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(initializeCamera:withImageFormat:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(initializeCamera:withImageFormat:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSInteger arg_cameraId = [GetNullableObjectAtIndex(args, 0) integerValue]; - FCPPlatformImageFormatGroupBox *boxedFCPPlatformImageFormatGroup = - GetNullableObjectAtIndex(args, 1); - FCPPlatformImageFormatGroup arg_imageFormat = boxedFCPPlatformImageFormatGroup.value; - [api initializeCamera:arg_cameraId - withImageFormat:arg_imageFormat - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + FCPPlatformImageFormatGroup arg_imageFormat = [GetNullableObjectAtIndex(args, 1) integerValue]; + [api initializeCamera:arg_cameraId withImageFormat:arg_imageFormat completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -545,18 +475,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Begins streaming frames from the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.startImageStream", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(startImageStreamWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(startImageStreamWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(startImageStreamWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(startImageStreamWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api startImageStreamWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -568,19 +493,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Stops streaming frames from the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(stopImageStreamWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(stopImageStreamWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(stopImageStreamWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(stopImageStreamWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api stopImageStreamWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -595,18 +514,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// /// This is used to throttle sending frames across the channel. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.receivedImageStreamData", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(receivedImageStreamDataWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(receivedImageStreamDataWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(receivedImageStreamDataWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(receivedImageStreamDataWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api receivedImageStreamDataWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -619,24 +533,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// Indicates that the given camera is no longer being used on the Dart side, /// and any associated resources can be cleaned up. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(disposeCamera:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(disposeCamera:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(disposeCamera:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(disposeCamera:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSInteger arg_cameraId = [GetNullableObjectAtIndex(args, 0) integerValue]; - [api disposeCamera:arg_cameraId - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api disposeCamera:arg_cameraId completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -644,27 +553,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Locks the camera capture to the current device orientation. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.lockCaptureOrientation", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(lockCaptureOrientation:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(lockCaptureOrientation:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(lockCaptureOrientation:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(lockCaptureOrientation:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FCPPlatformDeviceOrientationBox *boxedFCPPlatformDeviceOrientation = - GetNullableObjectAtIndex(args, 0); - FCPPlatformDeviceOrientation arg_orientation = boxedFCPPlatformDeviceOrientation.value; - [api lockCaptureOrientation:arg_orientation - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + NSArray *args = message; + FCPPlatformDeviceOrientation arg_orientation = [GetNullableObjectAtIndex(args, 0) integerValue]; + [api lockCaptureOrientation:arg_orientation completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -673,18 +574,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.unlockCaptureOrientation", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(unlockCaptureOrientationWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(unlockCaptureOrientationWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(unlockCaptureOrientationWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(unlockCaptureOrientationWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api unlockCaptureOrientationWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -697,23 +593,17 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// Takes a picture with the current settings, and returns the path to the /// resulting file. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(takePictureWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(takePictureWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(takePictureWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(takePictureWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api - takePictureWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api takePictureWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -721,18 +611,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Does any preprocessing necessary before beginning to record video. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.prepareForVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(prepareForVideoRecordingWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(prepareForVideoRecordingWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(prepareForVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(prepareForVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api prepareForVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -745,25 +630,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// Begins recording video, optionally enabling streaming to Dart at the same /// time. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.startVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(startVideoRecordingWithStreaming:completion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(startVideoRecordingWithStreaming:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(startVideoRecordingWithStreaming:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(startVideoRecordingWithStreaming:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; BOOL arg_enableStream = [GetNullableObjectAtIndex(args, 0) boolValue]; - [api startVideoRecordingWithStreaming:arg_enableStream - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api startVideoRecordingWithStreaming:arg_enableStream completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -771,21 +650,15 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Stops recording video, and results the path to the resulting file. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.stopVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(stopVideoRecordingWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(stopVideoRecordingWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(stopVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(stopVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api stopVideoRecordingWithCompletion:^(NSString *_Nullable output, - FlutterError *_Nullable error) { + [api stopVideoRecordingWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -795,18 +668,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Pauses video recording. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.pauseVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(pauseVideoRecordingWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(pauseVideoRecordingWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(pauseVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(pauseVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api pauseVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -818,18 +686,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Resumes a previously paused video recording. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.resumeVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(resumeVideoRecordingWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(resumeVideoRecordingWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(resumeVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(resumeVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api resumeVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -841,26 +704,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Switches the camera to the given flash mode. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFlashMode:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setFlashMode:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setFlashMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFlashMode:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FCPPlatformFlashModeBox *boxedFCPPlatformFlashMode = GetNullableObjectAtIndex(args, 0); - FCPPlatformFlashMode arg_mode = boxedFCPPlatformFlashMode.value; - [api setFlashMode:arg_mode - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + NSArray *args = message; + FCPPlatformFlashMode arg_mode = [GetNullableObjectAtIndex(args, 0) integerValue]; + [api setFlashMode:arg_mode completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -868,27 +724,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Switches the camera to the given exposure mode. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposureMode:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureMode:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setExposureMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureMode:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FCPPlatformExposureModeBox *boxedFCPPlatformExposureMode = - GetNullableObjectAtIndex(args, 0); - FCPPlatformExposureMode arg_mode = boxedFCPPlatformExposureMode.value; - [api setExposureMode:arg_mode - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + NSArray *args = message; + FCPPlatformExposureMode arg_mode = [GetNullableObjectAtIndex(args, 0) integerValue]; + [api setExposureMode:arg_mode completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -898,24 +746,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// /// A null value resets to the default exposure point. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.setExposurePoint", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposurePoint:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setExposurePoint:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setExposurePoint:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposurePoint:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformPoint *arg_point = GetNullableObjectAtIndex(args, 0); - [api setExposurePoint:arg_point - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposurePoint:arg_point completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -923,17 +766,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Returns the minimum exposure offset supported by the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.getMinExposureOffset", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMinimumExposureOffset:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumExposureOffset:)", - api); + NSCAssert([api respondsToSelector:@selector(getMinimumExposureOffset:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumExposureOffset:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMinimumExposureOffset:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -945,17 +784,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Returns the maximum exposure offset supported by the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.getMaxExposureOffset", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMaximumExposureOffset:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumExposureOffset:)", - api); + NSCAssert([api respondsToSelector:@selector(getMaximumExposureOffset:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumExposureOffset:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMaximumExposureOffset:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -967,25 +802,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Sets the exposure offset manually to the given value. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.setExposureOffset", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(setExposureOffset:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureOffset:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setExposureOffset:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureOffset:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; double arg_offset = [GetNullableObjectAtIndex(args, 0) doubleValue]; - [api setExposureOffset:arg_offset - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposureOffset:arg_offset completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -993,26 +822,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Switches the camera to the given focus mode. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFocusMode:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusMode:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setFocusMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusMode:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FCPPlatformFocusModeBox *boxedFCPPlatformFocusMode = GetNullableObjectAtIndex(args, 0); - FCPPlatformFocusMode arg_mode = boxedFCPPlatformFocusMode.value; - [api setFocusMode:arg_mode - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + NSArray *args = message; + FCPPlatformFocusMode arg_mode = [GetNullableObjectAtIndex(args, 0) integerValue]; + [api setFocusMode:arg_mode completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1022,25 +844,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// /// A null value resets to the default focus point. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFocusPoint:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusPoint:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setFocusPoint:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusPoint:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformPoint *arg_point = GetNullableObjectAtIndex(args, 0); - [api setFocusPoint:arg_point - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFocusPoint:arg_point completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1048,17 +864,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Returns the minimum zoom level supported by the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMinimumZoomLevel:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumZoomLevel:)", api); + NSCAssert([api respondsToSelector:@selector(getMinimumZoomLevel:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumZoomLevel:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMinimumZoomLevel:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -1070,17 +882,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Returns the maximum zoom level supported by the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMaximumZoomLevel:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumZoomLevel:)", api); + NSCAssert([api respondsToSelector:@selector(getMaximumZoomLevel:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumZoomLevel:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMaximumZoomLevel:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -1092,25 +900,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Sets the zoom factor. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setZoomLevel:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setZoomLevel:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setZoomLevel:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setZoomLevel:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; double arg_zoom = [GetNullableObjectAtIndex(args, 0) doubleValue]; - [api setZoomLevel:arg_zoom - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setZoomLevel:arg_zoom completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1118,18 +920,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Pauses streaming of preview frames. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(pausePreviewWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(pausePreviewWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(pausePreviewWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(pausePreviewWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api pausePreviewWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -1141,18 +938,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Resumes a previously paused preview stream. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(resumePreviewWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(resumePreviewWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(resumePreviewWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(resumePreviewWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api resumePreviewWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -1166,26 +958,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// /// This should only be called while video recording is active. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.updateDescriptionWhileRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(updateDescriptionWhileRecordingCameraName: - completion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(updateDescriptionWhileRecordingCameraName:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(updateDescriptionWhileRecordingCameraName:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(updateDescriptionWhileRecordingCameraName:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_cameraName = GetNullableObjectAtIndex(args, 0); - [api updateDescriptionWhileRecordingCameraName:arg_cameraName - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api updateDescriptionWhileRecordingCameraName:arg_cameraName completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1193,27 +978,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Sets the file format used for taking pictures. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.setImageFileFormat", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(setImageFileFormat:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setImageFileFormat:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setImageFileFormat:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setImageFileFormat:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FCPPlatformImageFileFormatBox *boxedFCPPlatformImageFileFormat = - GetNullableObjectAtIndex(args, 0); - FCPPlatformImageFileFormat arg_format = boxedFCPPlatformImageFileFormat.value; - [api setImageFileFormat:arg_format - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + NSArray *args = message; + FCPPlatformImageFileFormat arg_format = [GetNullableObjectAtIndex(args, 0) integerValue]; + [api setImageFileFormat:arg_format completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1230,45 +1007,87 @@ @implementation FCPCameraGlobalEventApi - (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""]; } -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix { +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger messageChannelSuffix:(nullable NSString*)messageChannelSuffix{ self = [self init]; if (self) { _binaryMessenger = binaryMessenger; - _messageChannelSuffix = [messageChannelSuffix length] == 0 - ? @"" - : [NSString stringWithFormat:@".%@", messageChannelSuffix]; + _messageChannelSuffix = [messageChannelSuffix length] == 0 ? @"" : [NSString stringWithFormat: @".%@", messageChannelSuffix]; } return self; } -- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)arg_orientation - completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged", - _messageChannelSuffix]; +- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)arg_orientation completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged", _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPGetMessagesCodec()]; - [channel sendMessage:@[ [[FCPPlatformDeviceOrientationBox alloc] initWithValue:arg_orientation] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel + messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPCameraGlobalEventApiGetCodec()]; + [channel sendMessage:@[[NSNumber numberWithInteger:arg_orientation]] reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } @end +@interface FCPCameraEventApiCodecReader : FlutterStandardReader +@end +@implementation FCPCameraEventApiCodecReader +- (nullable id)readValueOfType:(UInt8)type { + switch (type) { + case 128: + return [FCPPlatformCameraState fromList:[self readValue]]; + case 129: + return [FCPPlatformSize fromList:[self readValue]]; + default: + return [super readValueOfType:type]; + } +} +@end + +@interface FCPCameraEventApiCodecWriter : FlutterStandardWriter +@end +@implementation FCPCameraEventApiCodecWriter +- (void)writeValue:(id)value { + if ([value isKindOfClass:[FCPPlatformCameraState class]]) { + [self writeByte:128]; + [self writeValue:[value toList]]; + } else if ([value isKindOfClass:[FCPPlatformSize class]]) { + [self writeByte:129]; + [self writeValue:[value toList]]; + } else { + [super writeValue:value]; + } +} +@end + +@interface FCPCameraEventApiCodecReaderWriter : FlutterStandardReaderWriter +@end +@implementation FCPCameraEventApiCodecReaderWriter +- (FlutterStandardWriter *)writerWithData:(NSMutableData *)data { + return [[FCPCameraEventApiCodecWriter alloc] initWithData:data]; +} +- (FlutterStandardReader *)readerWithData:(NSData *)data { + return [[FCPCameraEventApiCodecReader alloc] initWithData:data]; +} +@end + +NSObject *FCPCameraEventApiGetCodec(void) { + static FlutterStandardMessageCodec *sSharedObject = nil; + static dispatch_once_t sPred = 0; + dispatch_once(&sPred, ^{ + FCPCameraEventApiCodecReaderWriter *readerWriter = [[FCPCameraEventApiCodecReaderWriter alloc] init]; + sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; + }); + return sSharedObject; +} + @interface FCPCameraEventApi () @property(nonatomic, strong) NSObject *binaryMessenger; @property(nonatomic, strong) NSString *messageChannelSuffix; @@ -1279,64 +1098,51 @@ @implementation FCPCameraEventApi - (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""]; } -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix { +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger messageChannelSuffix:(nullable NSString*)messageChannelSuffix{ self = [self init]; if (self) { _binaryMessenger = binaryMessenger; - _messageChannelSuffix = [messageChannelSuffix length] == 0 - ? @"" - : [NSString stringWithFormat:@".%@", messageChannelSuffix]; + _messageChannelSuffix = [messageChannelSuffix length] == 0 ? @"" : [NSString stringWithFormat: @".%@", messageChannelSuffix]; } return self; } -- (void)initializedWithState:(FCPPlatformCameraState *)arg_initialState - completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized", - _messageChannelSuffix]; +- (void)initializedWithState:(FCPPlatformCameraState *)arg_initialState completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized", _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPGetMessagesCodec()]; - [channel sendMessage:@[ arg_initialState ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel + messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPCameraEventApiGetCodec()]; + [channel sendMessage:@[arg_initialState ?: [NSNull null]] reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } -- (void)reportError:(NSString *)arg_message - completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error", - _messageChannelSuffix]; +- (void)reportError:(NSString *)arg_message completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error", _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPGetMessagesCodec()]; - [channel sendMessage:@[ arg_message ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel + messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPCameraEventApiGetCodec()]; + [channel sendMessage:@[arg_message ?: [NSNull null]] reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } @end + diff --git a/packages/camera/camera_avfoundation/lib/src/messages.g.dart b/packages/camera/camera_avfoundation/lib/src/messages.g.dart index 535f03e34c2e..629ad6f8e432 100644 --- a/packages/camera/camera_avfoundation/lib/src/messages.g.dart +++ b/packages/camera/camera_avfoundation/lib/src/messages.g.dart @@ -1,7 +1,7 @@ // 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 (v22.4.2), do not edit directly. +// Autogenerated from Pigeon (v18.0.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, unnecessary_import, no_leading_underscores_for_local_identifiers @@ -18,8 +18,7 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse( - {Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -32,14 +31,31 @@ List wrapResponse( enum PlatformCameraLensDirection { /// Front facing camera (a user looking at the screen is seen by the camera). front, - /// Back facing camera (a user looking at the screen is not seen by the camera). back, - /// External camera which may not be mounted to the device. external, } +enum PlatformCameraLensType { + /// A built-in wide-angle camera device type. + wide, + /// A built-in camera device type with a shorter focal length than a wide-angle camera. + telephoto, + /// A built-in camera device type with a longer focal length than a wide-angle camera. + ultraWide, + /// A built-in camera device type that consists of a wide-angle and telephoto camera. + dual, + /// A built-in camera device type that consists of two cameras of fixed focal length, one ultrawide angle and one wide angle. + dualWide, + /// A built-in camera device type that consists of three cameras of fixed focal length, one ultrawide angle, one wide angle, and one telephoto. + triple, + /// A Continuity Camera device type. + continuity, + /// Unknown camera device type. + unknown, +} + enum PlatformDeviceOrientation { portraitUp, landscapeLeft, @@ -88,6 +104,7 @@ class PlatformCameraDescription { PlatformCameraDescription({ required this.name, required this.lensDirection, + required this.lensType, }); /// The name of the camera device. @@ -96,10 +113,14 @@ class PlatformCameraDescription { /// The direction the camera is facing. PlatformCameraLensDirection lensDirection; + /// The type of the camera lens. + PlatformCameraLensType lensType; + Object encode() { return [ name, - lensDirection, + lensDirection.index, + lensType.index, ]; } @@ -107,7 +128,8 @@ class PlatformCameraDescription { result as List; return PlatformCameraDescription( name: result[0]! as String, - lensDirection: result[1]! as PlatformCameraLensDirection, + lensDirection: PlatformCameraLensDirection.values[result[1]! as int], + lensType: PlatformCameraLensType.values[result[2]! as int], ); } } @@ -139,8 +161,8 @@ class PlatformCameraState { Object encode() { return [ previewSize, - exposureMode, - focusMode, + exposureMode.index, + focusMode.index, exposurePointSupported, focusPointSupported, ]; @@ -150,8 +172,8 @@ class PlatformCameraState { result as List; return PlatformCameraState( previewSize: result[0]! as PlatformSize, - exposureMode: result[1]! as PlatformExposureMode, - focusMode: result[2]! as PlatformFocusMode, + exposureMode: PlatformExposureMode.values[result[1]! as int], + focusMode: PlatformFocusMode.values[result[2]! as int], exposurePointSupported: result[3]! as bool, focusPointSupported: result[4]! as bool, ); @@ -305,37 +327,11 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: - final int? value = readValue(buffer) as int?; - return value == null ? null : PlatformCameraLensDirection.values[value]; - case 130: - final int? value = readValue(buffer) as int?; - return value == null ? null : PlatformDeviceOrientation.values[value]; - case 131: - final int? value = readValue(buffer) as int?; - return value == null ? null : PlatformExposureMode.values[value]; - case 132: - final int? value = readValue(buffer) as int?; - return value == null ? null : PlatformFlashMode.values[value]; - case 133: - final int? value = readValue(buffer) as int?; - return value == null ? null : PlatformFocusMode.values[value]; - case 134: - final int? value = readValue(buffer) as int?; - return value == null ? null : PlatformImageFileFormat.values[value]; - case 135: - final int? value = readValue(buffer) as int?; - return value == null ? null : PlatformImageFormatGroup.values[value]; - case 136: - final int? value = readValue(buffer) as int?; - return value == null ? null : PlatformResolutionPreset.values[value]; - case 137: + case 128: return PlatformCameraDescription.decode(readValue(buffer)!); - case 138: - return PlatformCameraState.decode(readValue(buffer)!); - case 139: + case 129: return PlatformMediaSettings.decode(readValue(buffer)!); - case 140: + case 130: return PlatformPoint.decode(readValue(buffer)!); case 141: return PlatformSize.decode(readValue(buffer)!); @@ -349,24 +345,20 @@ class CameraApi { /// Constructor for [CameraApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - CameraApi( - {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? pigeonVar_binaryMessenger; + CameraApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : __pigeon_binaryMessenger = binaryMessenger, + __pigeon_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + final BinaryMessenger? __pigeon_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); final String pigeonVar_messageChannelSuffix; /// Returns the list of available cameras. - Future> getAvailableCameras() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + Future> getAvailableCameras() async { + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -386,26 +378,23 @@ class CameraApi { message: 'Host platform returned null value for non-null return value.', ); } else { - return (pigeonVar_replyList[0] as List?)! - .cast(); + return (__pigeon_replyList[0] as List?)!.cast(); } } /// Create a new camera with the given settings, and returns its ID. Future create(String cameraName, PlatformMediaSettings settings) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.create$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.create$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([cameraName, settings]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { + final List? __pigeon_replyList = + await __pigeon_channel.send([cameraName, settings]) as List?; + if (__pigeon_replyList == null) { + throw _createConnectionError(__pigeon_channelName); + } else if (__pigeon_replyList.length > 1) { throw PlatformException( code: pigeonVar_replyList[0]! as String, message: pigeonVar_replyList[1] as String?, @@ -422,21 +411,18 @@ class CameraApi { } /// Initializes the camera with the given ID. - Future initialize( - int cameraId, PlatformImageFormatGroup imageFormat) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + Future initialize(int cameraId, PlatformImageFormatGroup imageFormat) async { + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([cameraId, imageFormat]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { + final List? __pigeon_replyList = + await __pigeon_channel.send([cameraId, imageFormat.index]) as List?; + if (__pigeon_replyList == null) { + throw _createConnectionError(__pigeon_channelName); + } else if (__pigeon_replyList.length > 1) { throw PlatformException( code: pigeonVar_replyList[0]! as String, message: pigeonVar_replyList[1] as String?, @@ -449,11 +435,9 @@ class CameraApi { /// Begins streaming frames from the camera. Future startImageStream() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -474,11 +458,9 @@ class CameraApi { /// Stops streaming frames from the camera. Future stopImageStream() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -502,11 +484,9 @@ class CameraApi { /// /// This is used to throttle sending frames across the channel. Future receivedImageStreamData() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -528,11 +508,9 @@ class CameraApi { /// Indicates that the given camera is no longer being used on the Dart side, /// and any associated resources can be cleaned up. Future dispose(int cameraId) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -552,21 +530,18 @@ class CameraApi { } /// Locks the camera capture to the current device orientation. - Future lockCaptureOrientation( - PlatformDeviceOrientation orientation) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + Future lockCaptureOrientation(PlatformDeviceOrientation orientation) async { + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([orientation]) as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { + final List? __pigeon_replyList = + await __pigeon_channel.send([orientation.index]) as List?; + if (__pigeon_replyList == null) { + throw _createConnectionError(__pigeon_channelName); + } else if (__pigeon_replyList.length > 1) { throw PlatformException( code: pigeonVar_replyList[0]! as String, message: pigeonVar_replyList[1] as String?, @@ -580,11 +555,9 @@ class CameraApi { /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. Future unlockCaptureOrientation() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -606,11 +579,9 @@ class CameraApi { /// Takes a picture with the current settings, and returns the path to the /// resulting file. Future takePicture() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -636,11 +607,9 @@ class CameraApi { /// Does any preprocessing necessary before beginning to record video. Future prepareForVideoRecording() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -662,11 +631,9 @@ class CameraApi { /// Begins recording video, optionally enabling streaming to Dart at the same /// time. Future startVideoRecording(bool enableStream) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -687,11 +654,9 @@ class CameraApi { /// Stops recording video, and results the path to the resulting file. Future stopVideoRecording() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -717,11 +682,9 @@ class CameraApi { /// Pauses video recording. Future pauseVideoRecording() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -742,11 +705,9 @@ class CameraApi { /// Resumes a previously paused video recording. Future resumeVideoRecording() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -767,11 +728,9 @@ class CameraApi { /// Switches the camera to the given flash mode. Future setFlashMode(PlatformFlashMode mode) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -792,11 +751,9 @@ class CameraApi { /// Switches the camera to the given exposure mode. Future setExposureMode(PlatformExposureMode mode) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -819,11 +776,9 @@ class CameraApi { /// /// A null value resets to the default exposure point. Future setExposurePoint(PlatformPoint? point) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -844,11 +799,9 @@ class CameraApi { /// Returns the minimum exposure offset supported by the camera. Future getMinExposureOffset() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -874,11 +827,9 @@ class CameraApi { /// Returns the maximum exposure offset supported by the camera. Future getMaxExposureOffset() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -904,11 +855,9 @@ class CameraApi { /// Sets the exposure offset manually to the given value. Future setExposureOffset(double offset) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -929,11 +878,9 @@ class CameraApi { /// Switches the camera to the given focus mode. Future setFocusMode(PlatformFocusMode mode) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -956,11 +903,9 @@ class CameraApi { /// /// A null value resets to the default focus point. Future setFocusPoint(PlatformPoint? point) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -981,11 +926,9 @@ class CameraApi { /// Returns the minimum zoom level supported by the camera. Future getMinZoomLevel() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -1011,11 +954,9 @@ class CameraApi { /// Returns the maximum zoom level supported by the camera. Future getMaxZoomLevel() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -1041,11 +982,9 @@ class CameraApi { /// Sets the zoom factor. Future setZoomLevel(double zoom) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -1066,11 +1005,9 @@ class CameraApi { /// Pauses streaming of preview frames. Future pausePreview() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -1091,11 +1028,9 @@ class CameraApi { /// Resumes a previously paused preview stream. Future resumePreview() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -1118,11 +1053,9 @@ class CameraApi { /// /// This should only be called while video recording is active. Future updateDescriptionWhileRecording(String cameraName) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -1143,11 +1076,9 @@ class CameraApi { /// Sets the file format used for taking pictures. Future setImageFileFormat(PlatformImageFileFormat format) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -1169,34 +1100,25 @@ class CameraApi { /// Handler for native callbacks that are not tied to a specific camera ID. abstract class CameraGlobalEventApi { - static const MessageCodec pigeonChannelCodec = _PigeonCodec(); + static const MessageCodec pigeonChannelCodec = StandardMessageCodec(); /// Called when the device's physical orientation changes. void deviceOrientationChanged(PlatformDeviceOrientation orientation); - static void setUp( - CameraGlobalEventApi? api, { - BinaryMessenger? binaryMessenger, - String messageChannelSuffix = '', - }) { - messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp(CameraGlobalEventApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { + messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged$messageChannelSuffix', - pigeonChannelCodec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + 'dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null.'); final List args = (message as List?)!; - final PlatformDeviceOrientation? arg_orientation = - (args[0] as PlatformDeviceOrientation?); + final PlatformDeviceOrientation? arg_orientation = args[0] == null ? null : PlatformDeviceOrientation.values[args[0]! as int]; assert(arg_orientation != null, 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null, expected non-null PlatformDeviceOrientation.'); try { @@ -1204,9 +1126,8 @@ abstract class CameraGlobalEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } @@ -1214,11 +1135,39 @@ abstract class CameraGlobalEventApi { } } +class _CameraEventApiCodec extends StandardMessageCodec { + const _CameraEventApiCodec(); + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is PlatformCameraState) { + buffer.putUint8(128); + writeValue(buffer, value.encode()); + } else if (value is PlatformSize) { + buffer.putUint8(129); + writeValue(buffer, value.encode()); + } else { + super.writeValue(buffer, value); + } + } + + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 128: + return PlatformCameraState.decode(readValue(buffer)!); + case 129: + return PlatformSize.decode(readValue(buffer)!); + default: + return super.readValueOfType(type, buffer); + } + } +} + /// Handler for native callbacks that are tied to a specific camera ID. /// /// This is intended to be initialized with the camera ID as a suffix. abstract class CameraEventApi { - static const MessageCodec pigeonChannelCodec = _PigeonCodec(); + static const MessageCodec pigeonChannelCodec = _CameraEventApiCodec(); /// Called when the camera is inialitized for use. void initialized(PlatformCameraState initialState); @@ -1229,29 +1178,20 @@ abstract class CameraEventApi { /// handling a specific HostApi call, such as during streaming. void error(String message); - static void setUp( - CameraEventApi? api, { - BinaryMessenger? binaryMessenger, - String messageChannelSuffix = '', - }) { - messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp(CameraEventApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { + messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized$messageChannelSuffix', - pigeonChannelCodec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null.'); final List args = (message as List?)!; - final PlatformCameraState? arg_initialState = - (args[0] as PlatformCameraState?); + final PlatformCameraState? arg_initialState = (args[0] as PlatformCameraState?); assert(arg_initialState != null, 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null, expected non-null PlatformCameraState.'); try { @@ -1259,26 +1199,22 @@ abstract class CameraEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } } { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error$messageChannelSuffix', - pigeonChannelCodec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error was null.'); final List args = (message as List?)!; final String? arg_message = (args[0] as String?); assert(arg_message != null, @@ -1288,9 +1224,8 @@ abstract class CameraEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } From 944eb0431dd110ee24e61b5ee1f9215ad7f0a3ae Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Tue, 1 Apr 2025 15:29:31 -0400 Subject: [PATCH 03/25] Update tests --- .../camera/test/camera_preview_test.dart | 5 ++++- .../camera/camera/test/camera_value_test.dart | 18 ++---------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/packages/camera/camera/test/camera_preview_test.dart b/packages/camera/camera/test/camera_preview_test.dart index 73359e455ad6..6929201b3b3f 100644 --- a/packages/camera/camera/test/camera_preview_test.dart +++ b/packages/camera/camera/test/camera_preview_test.dart @@ -15,7 +15,10 @@ class FakeController extends ValueNotifier FakeController() : super(const CameraValue.uninitialized(fakeDescription)); static const CameraDescription fakeDescription = CameraDescription( - name: '', lensDirection: CameraLensDirection.back, sensorOrientation: 0); + name: '', + lensDirection: CameraLensDirection.back, + sensorOrientation: 0, + lensType: CameraLensType.ultraWide); @override Future dispose() async { diff --git a/packages/camera/camera/test/camera_value_test.dart b/packages/camera/camera/test/camera_value_test.dart index 2c5ff71dcee6..234b4399e307 100644 --- a/packages/camera/camera/test/camera_value_test.dart +++ b/packages/camera/camera/test/camera_value_test.dart @@ -146,22 +146,8 @@ void main() { description: FakeController.fakeDescription, ); - expect( - cameraValue.toString(), - 'CameraValue(isRecordingVideo: false, isInitialized: false, ' - 'errorDescription: null, previewSize: Size(10.0, 10.0), ' - 'isStreamingImages: false, flashMode: FlashMode.auto, ' - 'exposureMode: ExposureMode.auto, focusMode: FocusMode.auto, ' - 'exposurePointSupported: true, focusPointSupported: true, ' - 'deviceOrientation: DeviceOrientation.portraitUp, ' - 'lockedCaptureOrientation: DeviceOrientation.portraitUp, ' - 'recordingOrientation: DeviceOrientation.portraitUp, ' - 'isPreviewPaused: true, ' - 'previewPausedOrientation: DeviceOrientation.portraitUp, ' - // CameraDescription.toString is defined in the platform interface - // package, so don't assert a specific value for it, only that - // whatever it returns is inserted as expected. - 'description: ${FakeController.fakeDescription})'); + expect(cameraValue.toString(), + 'CameraValue(isRecordingVideo: false, isInitialized: false, errorDescription: null, previewSize: Size(10.0, 10.0), isStreamingImages: false, flashMode: FlashMode.auto, exposureMode: ExposureMode.auto, focusMode: FocusMode.auto, exposurePointSupported: true, focusPointSupported: true, deviceOrientation: DeviceOrientation.portraitUp, lockedCaptureOrientation: DeviceOrientation.portraitUp, recordingOrientation: DeviceOrientation.portraitUp, isPreviewPaused: true, previewPausedOrientation: DeviceOrientation.portraitUp, description: CameraDescription(, CameraLensDirection.back, 0, CameraLensType.ultraWide))'); }); }); } From 62323ed7be7e4f50e5fa4eb5b8f1241a83bb8abc Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Tue, 1 Apr 2025 15:30:21 -0400 Subject: [PATCH 04/25] updated versions and Changelogs --- packages/camera/camera_avfoundation/CHANGELOG.md | 1 + packages/camera/camera_platform_interface/CHANGELOG.md | 8 +++----- packages/camera/camera_platform_interface/pubspec.yaml | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/camera/camera_avfoundation/CHANGELOG.md b/packages/camera/camera_avfoundation/CHANGELOG.md index c0dad2343bc0..6e8ae50b4d33 100644 --- a/packages/camera/camera_avfoundation/CHANGELOG.md +++ b/packages/camera/camera_avfoundation/CHANGELOG.md @@ -76,6 +76,7 @@ * Updates Pigeon for non-nullable collection type support. * Updates minimum supported SDK version to Flutter 3.19/Dart 3.3. +* Adds lensType in the PlatformCameraDescription ## 0.9.17+3 diff --git a/packages/camera/camera_platform_interface/CHANGELOG.md b/packages/camera/camera_platform_interface/CHANGELOG.md index d00f721a79b6..4ed93c1c1052 100644 --- a/packages/camera/camera_platform_interface/CHANGELOG.md +++ b/packages/camera/camera_platform_interface/CHANGELOG.md @@ -1,12 +1,10 @@ ## 2.10.0 -* Introduces a new `CameraLensType` enum to provide lens type information about - the camera (e.g., ultra-wide, telephoto, ...). +* Updates minimum supported SDK version to Flutter 3.19/Dart 3.3. +* Introduces a new CameraLensType enum to provide lens type information about the camera (e.g.: ultra-wide, telephoto, ...) + -## 2.9.0 -* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. -* Adds API support query for image streaming. ## 2.8.0 diff --git a/packages/camera/camera_platform_interface/pubspec.yaml b/packages/camera/camera_platform_interface/pubspec.yaml index a26c038ed11c..0374bacaa205 100644 --- a/packages/camera/camera_platform_interface/pubspec.yaml +++ b/packages/camera/camera_platform_interface/pubspec.yaml @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/camera/camera issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 2.10.0 +version: 2.8.1 environment: sdk: ^3.4.0 From e79e957b5ee1320b22f7492ae8f1ef35b43cc6ad Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Tue, 1 Apr 2025 15:30:21 -0400 Subject: [PATCH 05/25] adds dependency_overrides for federated plugin PR --- packages/camera/camera/example/pubspec.yaml | 15 ++++++++++++++- packages/camera/camera/pubspec.yaml | 5 +++++ .../camera/camera_android/example/pubspec.yaml | 5 +++++ packages/camera/camera_android/pubspec.yaml | 5 +++++ .../camera_android_camerax/example/pubspec.yaml | 5 +++++ .../camera/camera_android_camerax/pubspec.yaml | 5 +++++ .../camera_avfoundation/example/pubspec.yaml | 5 +++++ packages/camera/camera_avfoundation/pubspec.yaml | 5 +++++ packages/camera/camera_web/example/pubspec.yaml | 5 +++++ packages/camera/camera_web/pubspec.yaml | 5 +++++ .../camera/camera_windows/example/pubspec.yaml | 5 +++++ packages/camera/camera_windows/pubspec.yaml | 5 +++++ 12 files changed, 69 insertions(+), 1 deletion(-) diff --git a/packages/camera/camera/example/pubspec.yaml b/packages/camera/camera/example/pubspec.yaml index aff0afef21fe..81feff65e3d9 100644 --- a/packages/camera/camera/example/pubspec.yaml +++ b/packages/camera/camera/example/pubspec.yaml @@ -27,7 +27,20 @@ dev_dependencies: sdk: flutter integration_test: sdk: flutter - leak_tracker_flutter_testing: any + + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + + camera: + path: ../../../camera/camera + camera_avfoundation: + path: ../../../camera/camera_avfoundation + camera_platform_interface: + path: ../../../camera/camera_platform_interface + camera_web: + path: ../../camera_web flutter: uses-material-design: true diff --git a/packages/camera/camera/pubspec.yaml b/packages/camera/camera/pubspec.yaml index 09899dfa5796..ff8f3b2e774d 100644 --- a/packages/camera/camera/pubspec.yaml +++ b/packages/camera/camera/pubspec.yaml @@ -38,3 +38,8 @@ dev_dependencies: topics: - camera + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + {camera_avfoundation: {path: ../../camera/camera_avfoundation}, camera_platform_interface: {path: ../../camera/camera_platform_interface}} diff --git a/packages/camera/camera_android/example/pubspec.yaml b/packages/camera/camera_android/example/pubspec.yaml index 9c8f8476d0b5..abff371918d0 100644 --- a/packages/camera/camera_android/example/pubspec.yaml +++ b/packages/camera/camera_android/example/pubspec.yaml @@ -31,3 +31,8 @@ dev_dependencies: flutter: uses-material-design: true + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + {camera_platform_interface: {path: ../../../camera/camera_platform_interface}} diff --git a/packages/camera/camera_android/pubspec.yaml b/packages/camera/camera_android/pubspec.yaml index f813858fd620..e78da63d88b9 100644 --- a/packages/camera/camera_android/pubspec.yaml +++ b/packages/camera/camera_android/pubspec.yaml @@ -36,3 +36,8 @@ dev_dependencies: topics: - camera + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + {camera_platform_interface: {path: ../../camera/camera_platform_interface}} diff --git a/packages/camera/camera_android_camerax/example/pubspec.yaml b/packages/camera/camera_android_camerax/example/pubspec.yaml index 627360153368..51daaacefdbd 100644 --- a/packages/camera/camera_android_camerax/example/pubspec.yaml +++ b/packages/camera/camera_android_camerax/example/pubspec.yaml @@ -29,3 +29,8 @@ dev_dependencies: flutter: uses-material-design: true +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + {camera_platform_interface: {path: ../../../camera/camera_platform_interface}} + diff --git a/packages/camera/camera_android_camerax/pubspec.yaml b/packages/camera/camera_android_camerax/pubspec.yaml index c611b2f69b49..edeed105aaf7 100644 --- a/packages/camera/camera_android_camerax/pubspec.yaml +++ b/packages/camera/camera_android_camerax/pubspec.yaml @@ -35,3 +35,8 @@ dev_dependencies: topics: - camera + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + {camera_platform_interface: {path: ../../camera/camera_platform_interface}} diff --git a/packages/camera/camera_avfoundation/example/pubspec.yaml b/packages/camera/camera_avfoundation/example/pubspec.yaml index 9f82d7faf625..1e04dcc8818b 100644 --- a/packages/camera/camera_avfoundation/example/pubspec.yaml +++ b/packages/camera/camera_avfoundation/example/pubspec.yaml @@ -29,3 +29,8 @@ dev_dependencies: flutter: uses-material-design: true + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + {camera_avfoundation: {path: ../../../camera/camera_avfoundation}, camera_platform_interface: {path: ../../../camera/camera_platform_interface}} diff --git a/packages/camera/camera_avfoundation/pubspec.yaml b/packages/camera/camera_avfoundation/pubspec.yaml index 66dffba0df09..3d160d89a198 100644 --- a/packages/camera/camera_avfoundation/pubspec.yaml +++ b/packages/camera/camera_avfoundation/pubspec.yaml @@ -33,3 +33,8 @@ dev_dependencies: topics: - camera + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + {camera_platform_interface: {path: ../../camera/camera_platform_interface}} diff --git a/packages/camera/camera_web/example/pubspec.yaml b/packages/camera/camera_web/example/pubspec.yaml index 8305d8434abf..16ba077a600d 100644 --- a/packages/camera/camera_web/example/pubspec.yaml +++ b/packages/camera/camera_web/example/pubspec.yaml @@ -26,3 +26,8 @@ dev_dependencies: integration_test: sdk: flutter mocktail: 0.3.0 + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + {camera_platform_interface: {path: ../../../camera/camera_platform_interface}} diff --git a/packages/camera/camera_web/pubspec.yaml b/packages/camera/camera_web/pubspec.yaml index 4052a701b86b..22a40ab27bd2 100644 --- a/packages/camera/camera_web/pubspec.yaml +++ b/packages/camera/camera_web/pubspec.yaml @@ -31,3 +31,8 @@ dev_dependencies: topics: - camera + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + {camera_platform_interface: {path: ../../camera/camera_platform_interface}} diff --git a/packages/camera/camera_windows/example/pubspec.yaml b/packages/camera/camera_windows/example/pubspec.yaml index 7eabccf3d652..ed1a039b5977 100644 --- a/packages/camera/camera_windows/example/pubspec.yaml +++ b/packages/camera/camera_windows/example/pubspec.yaml @@ -27,3 +27,8 @@ dev_dependencies: flutter: uses-material-design: true + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + {camera_platform_interface: {path: ../../../camera/camera_platform_interface}} diff --git a/packages/camera/camera_windows/pubspec.yaml b/packages/camera/camera_windows/pubspec.yaml index d66f36f2550c..aaefde4fcd51 100644 --- a/packages/camera/camera_windows/pubspec.yaml +++ b/packages/camera/camera_windows/pubspec.yaml @@ -34,3 +34,8 @@ dev_dependencies: topics: - camera + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + {camera_platform_interface: {path: ../../camera/camera_platform_interface}} From 6ae7c00344a1ef5279e740f0b0028f2faf57a021 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Tue, 1 Apr 2025 15:30:21 -0400 Subject: [PATCH 06/25] Add lens type information to camera plugin tests --- .../test/avfoundation_camera_test.dart | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/camera/camera_avfoundation/test/avfoundation_camera_test.dart b/packages/camera/camera_avfoundation/test/avfoundation_camera_test.dart index 1e8ad7def5d7..0dfba094292f 100644 --- a/packages/camera/camera_avfoundation/test/avfoundation_camera_test.dart +++ b/packages/camera/camera_avfoundation/test/avfoundation_camera_test.dart @@ -372,9 +372,15 @@ void main() { final List returnData = [ PlatformCameraDescription( - name: 'Test 1', lensDirection: PlatformCameraLensDirection.front), + name: 'Test 1', + lensDirection: PlatformCameraLensDirection.front, + lensType: PlatformCameraLensType.ultraWide, + ), PlatformCameraDescription( - name: 'Test 2', lensDirection: PlatformCameraLensDirection.back), + name: 'Test 2', + lensDirection: PlatformCameraLensDirection.back, + lensType: PlatformCameraLensType.telephoto, + ), ]; when(mockApi.getAvailableCameras()).thenAnswer((_) async => returnData); @@ -385,6 +391,10 @@ void main() { expect(cameras[i].name, returnData[i].name); expect(cameras[i].lensDirection, cameraLensDirectionFromPlatform(returnData[i].lensDirection)); + expect( + cameras[i].lensType, + cameraLensTypeFromPlatform(returnData[i].lensType), + ); // This value isn't provided by the platform, so is hard-coded to 90. expect(cameras[i].sensorOrientation, 90); } From ca604967b2a0820d39edfedc8c5cad3f37949e2e Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Tue, 1 Apr 2025 15:30:21 -0400 Subject: [PATCH 07/25] Add iOS version checks ensuring API availability for camera device types --- .../camera_avfoundation/CameraPlugin.m | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m index 517001d190cc..1d9019848666 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m @@ -169,16 +169,24 @@ - (void)availableCamerasWithCompletion: lensType = FCPPlatformCameraLensTypeWide; } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInTelephotoCamera]) { lensType = FCPPlatformCameraLensTypeTelephoto; - } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInUltraWideCamera]) { - lensType = FCPPlatformCameraLensTypeUltraWide; - } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInDualCamera]) { - lensType = FCPPlatformCameraLensTypeDual; - } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInDualWideCamera]) { - lensType = FCPPlatformCameraLensTypeDualWide; - } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInTripleCamera]) { - lensType = FCPPlatformCameraLensTypeTriple; - } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeContinuityCamera]) { - lensType = FCPPlatformCameraLensTypeContinuity; + } else if (@available(iOS 13.0, *)) { + if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInUltraWideCamera]) { + lensType = FCPPlatformCameraLensTypeUltraWide; + } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInDualCamera]) { + lensType = FCPPlatformCameraLensTypeDual; + } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInDualWideCamera]) { + lensType = FCPPlatformCameraLensTypeDualWide; + } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInTripleCamera]) { + lensType = FCPPlatformCameraLensTypeTriple; + } else { + lensType = FCPPlatformCameraLensTypeUnknown; + } + } else if (@available(iOS 17.0, *)) { + if ([device.deviceType isEqualToString:AVCaptureDeviceTypeContinuityCamera]) { + lensType = FCPPlatformCameraLensTypeContinuity; + } else { + lensType = FCPPlatformCameraLensTypeUnknown; + } } else { lensType = FCPPlatformCameraLensTypeUnknown; } From e3bbf1590042951a432faf2209a48c9280e33ba7 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Tue, 1 Apr 2025 15:30:21 -0400 Subject: [PATCH 08/25] Apply formatting fixes --- .../include/camera_avfoundation/QueueUtils.h | 2 +- .../include/camera_avfoundation/messages.g.h | 119 +-- .../Sources/camera_avfoundation/messages.g.m | 765 +++++++++++------- .../lib/src/messages.g.dart | 299 ++++--- 4 files changed, 753 insertions(+), 432 deletions(-) diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h index a7e22da716d0..e230a53508fa 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h @@ -7,7 +7,7 @@ NS_ASSUME_NONNULL_BEGIN /// Queue-specific context data to be associated with the capture session queue. -extern const char* FLTCaptureSessionQueueSpecific; +extern const char *FLTCaptureSessionQueueSpecific; /// Ensures the given block to be run on the main queue. /// If caller site is already on the main queue, the block will be run diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h index 55a77d0a4d18..00233971afaa 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h @@ -37,9 +37,11 @@ typedef NS_ENUM(NSUInteger, FCPPlatformCameraLensType) { FCPPlatformCameraLensTypeUltraWide = 2, /// A built-in camera device type that consists of a wide-angle and telephoto camera. FCPPlatformCameraLensTypeDual = 3, - /// A built-in camera device type that consists of two cameras of fixed focal length, one ultrawide angle and one wide angle. + /// A built-in camera device type that consists of two cameras of fixed focal length, one + /// ultrawide angle and one wide angle. FCPPlatformCameraLensTypeDualWide = 4, - /// A built-in camera device type that consists of three cameras of fixed focal length, one ultrawide angle, one wide angle, and one telephoto. + /// A built-in camera device type that consists of three cameras of fixed focal length, one + /// ultrawide angle, one wide angle, and one telephoto. FCPPlatformCameraLensTypeTriple = 5, /// A Continuity Camera device type. FCPPlatformCameraLensTypeContinuity = 6, @@ -149,10 +151,10 @@ typedef NS_ENUM(NSUInteger, FCPPlatformResolutionPreset) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithName:(NSString *)name - lensDirection:(FCPPlatformCameraLensDirection)lensDirection - lensType:(FCPPlatformCameraLensType)lensType; + lensDirection:(FCPPlatformCameraLensDirection)lensDirection + lensType:(FCPPlatformCameraLensType)lensType; /// The name of the camera device. -@property(nonatomic, copy) NSString * name; +@property(nonatomic, copy) NSString *name; /// The direction the camera is facing. @property(nonatomic, assign) FCPPlatformCameraLensDirection lensDirection; /// The type of the camera lens. @@ -163,53 +165,51 @@ typedef NS_ENUM(NSUInteger, FCPPlatformResolutionPreset) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithPreviewSize:(FCPPlatformSize *)previewSize - exposureMode:(FCPPlatformExposureMode)exposureMode - focusMode:(FCPPlatformFocusMode)focusMode - exposurePointSupported:(BOOL )exposurePointSupported - focusPointSupported:(BOOL )focusPointSupported; + exposureMode:(FCPPlatformExposureMode)exposureMode + focusMode:(FCPPlatformFocusMode)focusMode + exposurePointSupported:(BOOL)exposurePointSupported + focusPointSupported:(BOOL)focusPointSupported; /// The size of the preview, in pixels. -@property(nonatomic, strong) FCPPlatformSize * previewSize; +@property(nonatomic, strong) FCPPlatformSize *previewSize; /// The default exposure mode @property(nonatomic, assign) FCPPlatformExposureMode exposureMode; /// The default focus mode @property(nonatomic, assign) FCPPlatformFocusMode focusMode; /// Whether setting exposure points is supported. -@property(nonatomic, assign) BOOL exposurePointSupported; +@property(nonatomic, assign) BOOL exposurePointSupported; /// Whether setting focus points is supported. -@property(nonatomic, assign) BOOL focusPointSupported; +@property(nonatomic, assign) BOOL focusPointSupported; @end @interface FCPPlatformMediaSettings : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolutionPreset - framesPerSecond:(nullable NSNumber *)framesPerSecond - videoBitrate:(nullable NSNumber *)videoBitrate - audioBitrate:(nullable NSNumber *)audioBitrate - enableAudio:(BOOL )enableAudio; + framesPerSecond:(nullable NSNumber *)framesPerSecond + videoBitrate:(nullable NSNumber *)videoBitrate + audioBitrate:(nullable NSNumber *)audioBitrate + enableAudio:(BOOL)enableAudio; @property(nonatomic, assign) FCPPlatformResolutionPreset resolutionPreset; -@property(nonatomic, strong, nullable) NSNumber * framesPerSecond; -@property(nonatomic, strong, nullable) NSNumber * videoBitrate; -@property(nonatomic, strong, nullable) NSNumber * audioBitrate; -@property(nonatomic, assign) BOOL enableAudio; +@property(nonatomic, strong, nullable) NSNumber *framesPerSecond; +@property(nonatomic, strong, nullable) NSNumber *videoBitrate; +@property(nonatomic, strong, nullable) NSNumber *audioBitrate; +@property(nonatomic, assign) BOOL enableAudio; @end @interface FCPPlatformPoint : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithX:(double )x - y:(double )y; -@property(nonatomic, assign) double x; -@property(nonatomic, assign) double y; ++ (instancetype)makeWithX:(double)x y:(double)y; +@property(nonatomic, assign) double x; +@property(nonatomic, assign) double y; @end @interface FCPPlatformSize : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithWidth:(double )width - height:(double )height; -@property(nonatomic, assign) double width; -@property(nonatomic, assign) double height; ++ (instancetype)makeWithWidth:(double)width height:(double)height; +@property(nonatomic, assign) double width; +@property(nonatomic, assign) double height; @end /// The codec used by all APIs. @@ -217,11 +217,16 @@ NSObject *FCPGetMessagesCodec(void); @protocol FCPCameraApi /// Returns the list of available cameras. -- (void)availableCamerasWithCompletion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion; +- (void)availableCamerasWithCompletion:(void (^)(NSArray *_Nullable, + FlutterError *_Nullable))completion; /// Create a new camera with the given settings, and returns its ID. -- (void)createCameraWithName:(NSString *)cameraName settings:(FCPPlatformMediaSettings *)settings completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; +- (void)createCameraWithName:(NSString *)cameraName + settings:(FCPPlatformMediaSettings *)settings + completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Initializes the camera with the given ID. -- (void)initializeCamera:(NSInteger)cameraId withImageFormat:(FCPPlatformImageFormatGroup)imageFormat completion:(void (^)(FlutterError *_Nullable))completion; +- (void)initializeCamera:(NSInteger)cameraId + withImageFormat:(FCPPlatformImageFormatGroup)imageFormat + completion:(void (^)(FlutterError *_Nullable))completion; /// Begins streaming frames from the camera. - (void)startImageStreamWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Stops streaming frames from the camera. @@ -235,32 +240,39 @@ NSObject *FCPGetMessagesCodec(void); /// and any associated resources can be cleaned up. - (void)disposeCamera:(NSInteger)cameraId completion:(void (^)(FlutterError *_Nullable))completion; /// Locks the camera capture to the current device orientation. -- (void)lockCaptureOrientation:(FCPPlatformDeviceOrientation)orientation completion:(void (^)(FlutterError *_Nullable))completion; +- (void)lockCaptureOrientation:(FCPPlatformDeviceOrientation)orientation + completion:(void (^)(FlutterError *_Nullable))completion; /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. - (void)unlockCaptureOrientationWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Takes a picture with the current settings, and returns the path to the /// resulting file. -- (void)takePictureWithCompletion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; +- (void)takePictureWithCompletion:(void (^)(NSString *_Nullable, + FlutterError *_Nullable))completion; /// Does any preprocessing necessary before beginning to record video. - (void)prepareForVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Begins recording video, optionally enabling streaming to Dart at the same /// time. -- (void)startVideoRecordingWithStreaming:(BOOL)enableStream completion:(void (^)(FlutterError *_Nullable))completion; +- (void)startVideoRecordingWithStreaming:(BOOL)enableStream + completion:(void (^)(FlutterError *_Nullable))completion; /// Stops recording video, and results the path to the resulting file. -- (void)stopVideoRecordingWithCompletion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; +- (void)stopVideoRecordingWithCompletion:(void (^)(NSString *_Nullable, + FlutterError *_Nullable))completion; /// Pauses video recording. - (void)pauseVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Resumes a previously paused video recording. - (void)resumeVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given flash mode. -- (void)setFlashMode:(FCPPlatformFlashMode)mode completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFlashMode:(FCPPlatformFlashMode)mode + completion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given exposure mode. -- (void)setExposureMode:(FCPPlatformExposureMode)mode completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setExposureMode:(FCPPlatformExposureMode)mode + completion:(void (^)(FlutterError *_Nullable))completion; /// Anchors auto-exposure to the given point in (0,1) coordinate space. /// /// A null value resets to the default exposure point. -- (void)setExposurePoint:(nullable FCPPlatformPoint *)point completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setExposurePoint:(nullable FCPPlatformPoint *)point + completion:(void (^)(FlutterError *_Nullable))completion; /// Returns the minimum exposure offset supported by the camera. - (void)getMinimumExposureOffset:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Returns the maximum exposure offset supported by the camera. @@ -268,11 +280,13 @@ NSObject *FCPGetMessagesCodec(void); /// Sets the exposure offset manually to the given value. - (void)setExposureOffset:(double)offset completion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given focus mode. -- (void)setFocusMode:(FCPPlatformFocusMode)mode completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFocusMode:(FCPPlatformFocusMode)mode + completion:(void (^)(FlutterError *_Nullable))completion; /// Anchors auto-focus to the given point in (0,1) coordinate space. /// /// A null value resets to the default focus point. -- (void)setFocusPoint:(nullable FCPPlatformPoint *)point completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFocusPoint:(nullable FCPPlatformPoint *)point + completion:(void (^)(FlutterError *_Nullable))completion; /// Returns the minimum zoom level supported by the camera. - (void)getMinimumZoomLevel:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Returns the maximum zoom level supported by the camera. @@ -286,21 +300,28 @@ NSObject *FCPGetMessagesCodec(void); /// Changes the camera used while recording video. /// /// This should only be called while video recording is active. -- (void)updateDescriptionWhileRecordingCameraName:(NSString *)cameraName completion:(void (^)(FlutterError *_Nullable))completion; +- (void)updateDescriptionWhileRecordingCameraName:(NSString *)cameraName + completion:(void (^)(FlutterError *_Nullable))completion; /// Sets the file format used for taking pictures. -- (void)setImageFileFormat:(FCPPlatformImageFileFormat)format completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setImageFileFormat:(FCPPlatformImageFileFormat)format + completion:(void (^)(FlutterError *_Nullable))completion; @end -extern void SetUpFCPCameraApi(id binaryMessenger, NSObject *_Nullable api); +extern void SetUpFCPCameraApi(id binaryMessenger, + NSObject *_Nullable api); -extern void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSObject *_Nullable api, NSString *messageChannelSuffix); +extern void SetUpFCPCameraApiWithSuffix(id binaryMessenger, + NSObject *_Nullable api, + NSString *messageChannelSuffix); /// Handler for native callbacks that are not tied to a specific camera ID. @interface FCPCameraGlobalEventApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger messageChannelSuffix:(nullable NSString *)messageChannelSuffix; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + messageChannelSuffix:(nullable NSString *)messageChannelSuffix; /// Called when the device's physical orientation changes. -- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)orientation completion:(void (^)(FlutterError *_Nullable))completion; +- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)orientation + completion:(void (^)(FlutterError *_Nullable))completion; @end /// Handler for native callbacks that are tied to a specific camera ID. @@ -308,9 +329,11 @@ extern void SetUpFCPCameraApiWithSuffix(id binaryMesseng /// This is intended to be initialized with the camera ID as a suffix. @interface FCPCameraEventApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger messageChannelSuffix:(nullable NSString *)messageChannelSuffix; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + messageChannelSuffix:(nullable NSString *)messageChannelSuffix; /// Called when the camera is inialitized for use. -- (void)initializedWithState:(FCPPlatformCameraState *)initialState completion:(void (^)(FlutterError *_Nullable))completion; +- (void)initializedWithState:(FCPPlatformCameraState *)initialState + completion:(void (^)(FlutterError *_Nullable))completion; /// Called when an error occurs in the camera. /// /// This should be used for errors that occur outside of the context of diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m index 93073016a9b8..9dbfae38b168 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m @@ -26,7 +26,12 @@ } static FlutterError *createConnectionError(NSString *channelName) { - return [FlutterError errorWithCode:@"channel-error" message:[NSString stringWithFormat:@"%@/%@/%@", @"Unable to establish connection on channel: '", channelName, @"'."] details:@""]; + return [FlutterError + errorWithCode:@"channel-error" + message:[NSString stringWithFormat:@"%@/%@/%@", + @"Unable to establish connection on channel: '", + channelName, @"'."] + details:@""]; } static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { @@ -157,9 +162,9 @@ + (nullable FCPPlatformSize *)nullableFromList:(NSArray *)list; @implementation FCPPlatformCameraDescription + (instancetype)makeWithName:(NSString *)name - lensDirection:(FCPPlatformCameraLensDirection)lensDirection - lensType:(FCPPlatformCameraLensType)lensType { - FCPPlatformCameraDescription* pigeonResult = [[FCPPlatformCameraDescription alloc] init]; + lensDirection:(FCPPlatformCameraLensDirection)lensDirection + lensType:(FCPPlatformCameraLensType)lensType { + FCPPlatformCameraDescription *pigeonResult = [[FCPPlatformCameraDescription alloc] init]; pigeonResult.name = name; pigeonResult.lensDirection = lensDirection; pigeonResult.lensType = lensType; @@ -186,11 +191,11 @@ + (nullable FCPPlatformCameraDescription *)nullableFromList:(NSArray *)list @implementation FCPPlatformCameraState + (instancetype)makeWithPreviewSize:(FCPPlatformSize *)previewSize - exposureMode:(FCPPlatformExposureMode)exposureMode - focusMode:(FCPPlatformFocusMode)focusMode - exposurePointSupported:(BOOL )exposurePointSupported - focusPointSupported:(BOOL )focusPointSupported { - FCPPlatformCameraState* pigeonResult = [[FCPPlatformCameraState alloc] init]; + exposureMode:(FCPPlatformExposureMode)exposureMode + focusMode:(FCPPlatformFocusMode)focusMode + exposurePointSupported:(BOOL)exposurePointSupported + focusPointSupported:(BOOL)focusPointSupported { + FCPPlatformCameraState *pigeonResult = [[FCPPlatformCameraState alloc] init]; pigeonResult.previewSize = previewSize; pigeonResult.exposureMode = exposureMode; pigeonResult.focusMode = focusMode; @@ -223,11 +228,11 @@ + (nullable FCPPlatformCameraState *)nullableFromList:(NSArray *)list { @implementation FCPPlatformMediaSettings + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolutionPreset - framesPerSecond:(nullable NSNumber *)framesPerSecond - videoBitrate:(nullable NSNumber *)videoBitrate - audioBitrate:(nullable NSNumber *)audioBitrate - enableAudio:(BOOL )enableAudio { - FCPPlatformMediaSettings* pigeonResult = [[FCPPlatformMediaSettings alloc] init]; + framesPerSecond:(nullable NSNumber *)framesPerSecond + videoBitrate:(nullable NSNumber *)videoBitrate + audioBitrate:(nullable NSNumber *)audioBitrate + enableAudio:(BOOL)enableAudio { + FCPPlatformMediaSettings *pigeonResult = [[FCPPlatformMediaSettings alloc] init]; pigeonResult.resolutionPreset = resolutionPreset; pigeonResult.framesPerSecond = framesPerSecond; pigeonResult.videoBitrate = videoBitrate; @@ -261,9 +266,8 @@ + (nullable FCPPlatformMediaSettings *)nullableFromList:(NSArray *)list { @end @implementation FCPPlatformPoint -+ (instancetype)makeWithX:(double )x - y:(double )y { - FCPPlatformPoint* pigeonResult = [[FCPPlatformPoint alloc] init]; ++ (instancetype)makeWithX:(double)x y:(double)y { + FCPPlatformPoint *pigeonResult = [[FCPPlatformPoint alloc] init]; pigeonResult.x = x; pigeonResult.y = y; return pigeonResult; @@ -286,9 +290,8 @@ + (nullable FCPPlatformPoint *)nullableFromList:(NSArray *)list { @end @implementation FCPPlatformSize -+ (instancetype)makeWithWidth:(double )width - height:(double )height { - FCPPlatformSize* pigeonResult = [[FCPPlatformSize alloc] init]; ++ (instancetype)makeWithWidth:(double)width height:(double)height { + FCPPlatformSize *pigeonResult = [[FCPPlatformSize alloc] init]; pigeonResult.width = width; pigeonResult.height = height; return pigeonResult; @@ -315,11 +318,11 @@ @interface FCPMessagesPigeonCodecReader : FlutterStandardReader @implementation FCPMessagesPigeonCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FCPPlatformCameraDescription fromList:[self readValue]]; - case 129: + case 129: return [FCPPlatformMediaSettings fromList:[self readValue]]; - case 130: + case 130: return [FCPPlatformPoint fromList:[self readValue]]; case 141: return [FCPPlatformSize fromList:[self readValue]]; @@ -411,19 +414,29 @@ void SetUpFCPCameraApi(id binaryMessenger, NSObject binaryMessenger, NSObject *api, NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 ? [NSString stringWithFormat: @".%@", messageChannelSuffix] : @""; +void SetUpFCPCameraApiWithSuffix(id binaryMessenger, + NSObject *api, NSString *messageChannelSuffix) { + messageChannelSuffix = messageChannelSuffix.length > 0 + ? [NSString stringWithFormat:@".%@", messageChannelSuffix] + : @""; /// Returns the list of available cameras. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.getAvailableCameras", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(availableCamerasWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(availableCamerasWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(availableCamerasWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(availableCamerasWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api availableCamerasWithCompletion:^(NSArray *_Nullable output, FlutterError *_Nullable error) { + [api availableCamerasWithCompletion:^( + NSArray *_Nullable output, + FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -433,20 +446,27 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Create a new camera with the given settings, and returns its ID. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.create", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.create", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createCameraWithName:settings:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(createCameraWithName:settings:completion:)", api); + NSCAssert([api respondsToSelector:@selector(createCameraWithName:settings:completion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(createCameraWithName:settings:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_cameraName = GetNullableObjectAtIndex(args, 0); FCPPlatformMediaSettings *arg_settings = GetNullableObjectAtIndex(args, 1); - [api createCameraWithName:arg_cameraName settings:arg_settings completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api createCameraWithName:arg_cameraName + settings:arg_settings + completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -454,20 +474,29 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Initializes the camera with the given ID. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + [NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(initializeCamera:withImageFormat:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(initializeCamera:withImageFormat:completion:)", api); + NSCAssert([api respondsToSelector:@selector(initializeCamera:withImageFormat:completion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(initializeCamera:withImageFormat:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSInteger arg_cameraId = [GetNullableObjectAtIndex(args, 0) integerValue]; - FCPPlatformImageFormatGroup arg_imageFormat = [GetNullableObjectAtIndex(args, 1) integerValue]; - [api initializeCamera:arg_cameraId withImageFormat:arg_imageFormat completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + FCPPlatformImageFormatGroup arg_imageFormat = + [GetNullableObjectAtIndex(args, 1) integerValue]; + [api initializeCamera:arg_cameraId + withImageFormat:arg_imageFormat + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -475,13 +504,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Begins streaming frames from the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.startImageStream", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(startImageStreamWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(startImageStreamWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(startImageStreamWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(startImageStreamWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api startImageStreamWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -493,13 +527,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Stops streaming frames from the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(stopImageStreamWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(stopImageStreamWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(stopImageStreamWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(stopImageStreamWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api stopImageStreamWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -514,13 +554,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// /// This is used to throttle sending frames across the channel. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.receivedImageStreamData", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(receivedImageStreamDataWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(receivedImageStreamDataWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(receivedImageStreamDataWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(receivedImageStreamDataWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api receivedImageStreamDataWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -533,19 +578,24 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// Indicates that the given camera is no longer being used on the Dart side, /// and any associated resources can be cleaned up. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(disposeCamera:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(disposeCamera:completion:)", api); + NSCAssert([api respondsToSelector:@selector(disposeCamera:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(disposeCamera:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSInteger arg_cameraId = [GetNullableObjectAtIndex(args, 0) integerValue]; - [api disposeCamera:arg_cameraId completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api disposeCamera:arg_cameraId + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -553,19 +603,26 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Locks the camera capture to the current device orientation. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.lockCaptureOrientation", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(lockCaptureOrientation:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(lockCaptureOrientation:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector(lockCaptureOrientation:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(lockCaptureOrientation:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FCPPlatformDeviceOrientation arg_orientation = [GetNullableObjectAtIndex(args, 0) integerValue]; - [api lockCaptureOrientation:arg_orientation completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + FCPPlatformDeviceOrientation arg_orientation = + [GetNullableObjectAtIndex(args, 0) integerValue]; + [api lockCaptureOrientation:arg_orientation + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -574,13 +631,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.unlockCaptureOrientation", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(unlockCaptureOrientationWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(unlockCaptureOrientationWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(unlockCaptureOrientationWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(unlockCaptureOrientationWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api unlockCaptureOrientationWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -593,17 +655,23 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// Takes a picture with the current settings, and returns the path to the /// resulting file. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + [NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(takePictureWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(takePictureWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(takePictureWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(takePictureWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api takePictureWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api + takePictureWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -611,13 +679,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Does any preprocessing necessary before beginning to record video. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.prepareForVideoRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(prepareForVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(prepareForVideoRecordingWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(prepareForVideoRecordingWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(prepareForVideoRecordingWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api prepareForVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -630,19 +703,25 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// Begins recording video, optionally enabling streaming to Dart at the same /// time. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.startVideoRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(startVideoRecordingWithStreaming:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(startVideoRecordingWithStreaming:completion:)", api); + NSCAssert([api respondsToSelector:@selector(startVideoRecordingWithStreaming:completion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(startVideoRecordingWithStreaming:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; BOOL arg_enableStream = [GetNullableObjectAtIndex(args, 0) boolValue]; - [api startVideoRecordingWithStreaming:arg_enableStream completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api startVideoRecordingWithStreaming:arg_enableStream + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -650,15 +729,21 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Stops recording video, and results the path to the resulting file. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.stopVideoRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(stopVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(stopVideoRecordingWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(stopVideoRecordingWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(stopVideoRecordingWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api stopVideoRecordingWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { + [api stopVideoRecordingWithCompletion:^(NSString *_Nullable output, + FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -668,13 +753,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Pauses video recording. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.pauseVideoRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(pauseVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(pauseVideoRecordingWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(pauseVideoRecordingWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(pauseVideoRecordingWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api pauseVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -686,13 +776,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Resumes a previously paused video recording. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.resumeVideoRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(resumeVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(resumeVideoRecordingWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(resumeVideoRecordingWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(resumeVideoRecordingWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api resumeVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -704,19 +799,25 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Switches the camera to the given flash mode. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFlashMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFlashMode:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setFlashMode:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setFlashMode:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformFlashMode arg_mode = [GetNullableObjectAtIndex(args, 0) integerValue]; - [api setFlashMode:arg_mode completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFlashMode:arg_mode + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -724,19 +825,25 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Switches the camera to the given exposure mode. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposureMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureMode:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setExposureMode:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureMode:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformExposureMode arg_mode = [GetNullableObjectAtIndex(args, 0) integerValue]; - [api setExposureMode:arg_mode completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposureMode:arg_mode + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -746,19 +853,24 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// /// A null value resets to the default exposure point. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.setExposurePoint", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposurePoint:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposurePoint:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setExposurePoint:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setExposurePoint:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformPoint *arg_point = GetNullableObjectAtIndex(args, 0); - [api setExposurePoint:arg_point completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposurePoint:arg_point + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -766,13 +878,17 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Returns the minimum exposure offset supported by the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.getMinExposureOffset", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMinimumExposureOffset:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumExposureOffset:)", api); + NSCAssert([api respondsToSelector:@selector(getMinimumExposureOffset:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumExposureOffset:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMinimumExposureOffset:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -784,13 +900,17 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Returns the maximum exposure offset supported by the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.getMaxExposureOffset", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMaximumExposureOffset:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumExposureOffset:)", api); + NSCAssert([api respondsToSelector:@selector(getMaximumExposureOffset:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumExposureOffset:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMaximumExposureOffset:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -802,19 +922,25 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Sets the exposure offset manually to the given value. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.setExposureOffset", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposureOffset:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureOffset:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector(setExposureOffset:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureOffset:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; double arg_offset = [GetNullableObjectAtIndex(args, 0) doubleValue]; - [api setExposureOffset:arg_offset completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposureOffset:arg_offset + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -822,19 +948,25 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Switches the camera to the given focus mode. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFocusMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusMode:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setFocusMode:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusMode:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformFocusMode arg_mode = [GetNullableObjectAtIndex(args, 0) integerValue]; - [api setFocusMode:arg_mode completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFocusMode:arg_mode + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -844,19 +976,25 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// /// A null value resets to the default focus point. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFocusPoint:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusPoint:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setFocusPoint:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusPoint:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformPoint *arg_point = GetNullableObjectAtIndex(args, 0); - [api setFocusPoint:arg_point completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFocusPoint:arg_point + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -864,13 +1002,17 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Returns the minimum zoom level supported by the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMinimumZoomLevel:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumZoomLevel:)", api); + NSCAssert([api respondsToSelector:@selector(getMinimumZoomLevel:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumZoomLevel:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMinimumZoomLevel:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -882,13 +1024,17 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Returns the maximum zoom level supported by the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMaximumZoomLevel:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumZoomLevel:)", api); + NSCAssert([api respondsToSelector:@selector(getMaximumZoomLevel:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumZoomLevel:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMaximumZoomLevel:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -900,19 +1046,25 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Sets the zoom factor. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setZoomLevel:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setZoomLevel:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setZoomLevel:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setZoomLevel:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; double arg_zoom = [GetNullableObjectAtIndex(args, 0) doubleValue]; - [api setZoomLevel:arg_zoom completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setZoomLevel:arg_zoom + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -920,13 +1072,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Pauses streaming of preview frames. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(pausePreviewWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(pausePreviewWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(pausePreviewWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(pausePreviewWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api pausePreviewWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -938,13 +1095,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Resumes a previously paused preview stream. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(resumePreviewWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(resumePreviewWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(resumePreviewWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(resumePreviewWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api resumePreviewWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -958,19 +1120,26 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// /// This should only be called while video recording is active. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.updateDescriptionWhileRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(updateDescriptionWhileRecordingCameraName:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(updateDescriptionWhileRecordingCameraName:completion:)", api); + NSCAssert([api respondsToSelector:@selector(updateDescriptionWhileRecordingCameraName: + completion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(updateDescriptionWhileRecordingCameraName:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_cameraName = GetNullableObjectAtIndex(args, 0); - [api updateDescriptionWhileRecordingCameraName:arg_cameraName completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api updateDescriptionWhileRecordingCameraName:arg_cameraName + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -978,19 +1147,25 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Sets the file format used for taking pictures. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.setImageFileFormat", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setImageFileFormat:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setImageFileFormat:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector(setImageFileFormat:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setImageFileFormat:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformImageFileFormat arg_format = [GetNullableObjectAtIndex(args, 0) integerValue]; - [api setImageFileFormat:arg_format completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setImageFileFormat:arg_format + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1007,32 +1182,42 @@ @implementation FCPCameraGlobalEventApi - (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""]; } -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger messageChannelSuffix:(nullable NSString*)messageChannelSuffix{ +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger + messageChannelSuffix:(nullable NSString *)messageChannelSuffix { self = [self init]; if (self) { _binaryMessenger = binaryMessenger; - _messageChannelSuffix = [messageChannelSuffix length] == 0 ? @"" : [NSString stringWithFormat: @".%@", messageChannelSuffix]; + _messageChannelSuffix = [messageChannelSuffix length] == 0 + ? @"" + : [NSString stringWithFormat:@".%@", messageChannelSuffix]; } return self; } -- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)arg_orientation completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged", _messageChannelSuffix]; +- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)arg_orientation + completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged", + _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPCameraGlobalEventApiGetCodec()]; - [channel sendMessage:@[[NSNumber numberWithInteger:arg_orientation]] reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPCameraGlobalEventApiGetCodec()]; + [channel sendMessage:@[ [NSNumber numberWithInteger:arg_orientation] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } @end @@ -1041,9 +1226,9 @@ @interface FCPCameraEventApiCodecReader : FlutterStandardReader @implementation FCPCameraEventApiCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FCPPlatformCameraState fromList:[self readValue]]; - case 129: + case 129: return [FCPPlatformSize fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -1082,7 +1267,8 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FCPCameraEventApiCodecReaderWriter *readerWriter = [[FCPCameraEventApiCodecReaderWriter alloc] init]; + FCPCameraEventApiCodecReaderWriter *readerWriter = + [[FCPCameraEventApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; @@ -1098,51 +1284,64 @@ @implementation FCPCameraEventApi - (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""]; } -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger messageChannelSuffix:(nullable NSString*)messageChannelSuffix{ +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger + messageChannelSuffix:(nullable NSString *)messageChannelSuffix { self = [self init]; if (self) { _binaryMessenger = binaryMessenger; - _messageChannelSuffix = [messageChannelSuffix length] == 0 ? @"" : [NSString stringWithFormat: @".%@", messageChannelSuffix]; + _messageChannelSuffix = [messageChannelSuffix length] == 0 + ? @"" + : [NSString stringWithFormat:@".%@", messageChannelSuffix]; } return self; } -- (void)initializedWithState:(FCPPlatformCameraState *)arg_initialState completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized", _messageChannelSuffix]; +- (void)initializedWithState:(FCPPlatformCameraState *)arg_initialState + completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized", + _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPCameraEventApiGetCodec()]; - [channel sendMessage:@[arg_initialState ?: [NSNull null]] reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPCameraEventApiGetCodec()]; + [channel sendMessage:@[ arg_initialState ?: [NSNull null] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } -- (void)reportError:(NSString *)arg_message completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error", _messageChannelSuffix]; +- (void)reportError:(NSString *)arg_message + completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString + stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error", + _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPCameraEventApiGetCodec()]; - [channel sendMessage:@[arg_message ?: [NSNull null]] reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPCameraEventApiGetCodec()]; + [channel sendMessage:@[ arg_message ?: [NSNull null] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } @end - diff --git a/packages/camera/camera_avfoundation/lib/src/messages.g.dart b/packages/camera/camera_avfoundation/lib/src/messages.g.dart index 629ad6f8e432..e9609ae4984d 100644 --- a/packages/camera/camera_avfoundation/lib/src/messages.g.dart +++ b/packages/camera/camera_avfoundation/lib/src/messages.g.dart @@ -18,7 +18,8 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse( + {Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -31,8 +32,10 @@ List wrapResponse({Object? result, PlatformException? error, bool empty enum PlatformCameraLensDirection { /// Front facing camera (a user looking at the screen is seen by the camera). front, + /// Back facing camera (a user looking at the screen is not seen by the camera). back, + /// External camera which may not be mounted to the device. external, } @@ -40,18 +43,25 @@ enum PlatformCameraLensDirection { enum PlatformCameraLensType { /// A built-in wide-angle camera device type. wide, + /// A built-in camera device type with a shorter focal length than a wide-angle camera. telephoto, + /// A built-in camera device type with a longer focal length than a wide-angle camera. ultraWide, + /// A built-in camera device type that consists of a wide-angle and telephoto camera. dual, + /// A built-in camera device type that consists of two cameras of fixed focal length, one ultrawide angle and one wide angle. dualWide, + /// A built-in camera device type that consists of three cameras of fixed focal length, one ultrawide angle, one wide angle, and one telephoto. triple, + /// A Continuity Camera device type. continuity, + /// Unknown camera device type. unknown, } @@ -327,11 +337,11 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return PlatformCameraDescription.decode(readValue(buffer)!); - case 129: + case 129: return PlatformMediaSettings.decode(readValue(buffer)!); - case 130: + case 130: return PlatformPoint.decode(readValue(buffer)!); case 141: return PlatformSize.decode(readValue(buffer)!); @@ -345,9 +355,11 @@ class CameraApi { /// Constructor for [CameraApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - CameraApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + CameraApi( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + __pigeon_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? __pigeon_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -356,8 +368,10 @@ class CameraApi { /// Returns the list of available cameras. Future> getAvailableCameras() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -378,20 +392,23 @@ class CameraApi { message: 'Host platform returned null value for non-null return value.', ); } else { - return (__pigeon_replyList[0] as List?)!.cast(); + return (__pigeon_replyList[0] as List?)! + .cast(); } } /// Create a new camera with the given settings, and returns its ID. Future create(String cameraName, PlatformMediaSettings settings) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.create$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.create$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([cameraName, settings]) as List?; + final List? __pigeon_replyList = await __pigeon_channel + .send([cameraName, settings]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -411,15 +428,18 @@ class CameraApi { } /// Initializes the camera with the given ID. - Future initialize(int cameraId, PlatformImageFormatGroup imageFormat) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + Future initialize( + int cameraId, PlatformImageFormatGroup imageFormat) async { + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([cameraId, imageFormat.index]) as List?; + final List? __pigeon_replyList = await __pigeon_channel + .send([cameraId, imageFormat.index]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -435,8 +455,10 @@ class CameraApi { /// Begins streaming frames from the camera. Future startImageStream() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -458,8 +480,10 @@ class CameraApi { /// Stops streaming frames from the camera. Future stopImageStream() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -484,8 +508,10 @@ class CameraApi { /// /// This is used to throttle sending frames across the channel. Future receivedImageStreamData() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -508,8 +534,10 @@ class CameraApi { /// Indicates that the given camera is no longer being used on the Dart side, /// and any associated resources can be cleaned up. Future dispose(int cameraId) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -530,15 +558,18 @@ class CameraApi { } /// Locks the camera capture to the current device orientation. - Future lockCaptureOrientation(PlatformDeviceOrientation orientation) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + Future lockCaptureOrientation( + PlatformDeviceOrientation orientation) async { + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([orientation.index]) as List?; + final List? __pigeon_replyList = await __pigeon_channel + .send([orientation.index]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -555,8 +586,10 @@ class CameraApi { /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. Future unlockCaptureOrientation() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -579,8 +612,10 @@ class CameraApi { /// Takes a picture with the current settings, and returns the path to the /// resulting file. Future takePicture() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -607,8 +642,10 @@ class CameraApi { /// Does any preprocessing necessary before beginning to record video. Future prepareForVideoRecording() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -631,8 +668,10 @@ class CameraApi { /// Begins recording video, optionally enabling streaming to Dart at the same /// time. Future startVideoRecording(bool enableStream) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -654,8 +693,10 @@ class CameraApi { /// Stops recording video, and results the path to the resulting file. Future stopVideoRecording() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -682,8 +723,10 @@ class CameraApi { /// Pauses video recording. Future pauseVideoRecording() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -705,8 +748,10 @@ class CameraApi { /// Resumes a previously paused video recording. Future resumeVideoRecording() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -728,8 +773,10 @@ class CameraApi { /// Switches the camera to the given flash mode. Future setFlashMode(PlatformFlashMode mode) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -751,8 +798,10 @@ class CameraApi { /// Switches the camera to the given exposure mode. Future setExposureMode(PlatformExposureMode mode) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -776,8 +825,10 @@ class CameraApi { /// /// A null value resets to the default exposure point. Future setExposurePoint(PlatformPoint? point) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -799,8 +850,10 @@ class CameraApi { /// Returns the minimum exposure offset supported by the camera. Future getMinExposureOffset() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -827,8 +880,10 @@ class CameraApi { /// Returns the maximum exposure offset supported by the camera. Future getMaxExposureOffset() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -855,8 +910,10 @@ class CameraApi { /// Sets the exposure offset manually to the given value. Future setExposureOffset(double offset) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -878,8 +935,10 @@ class CameraApi { /// Switches the camera to the given focus mode. Future setFocusMode(PlatformFocusMode mode) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -903,8 +962,10 @@ class CameraApi { /// /// A null value resets to the default focus point. Future setFocusPoint(PlatformPoint? point) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -926,8 +987,10 @@ class CameraApi { /// Returns the minimum zoom level supported by the camera. Future getMinZoomLevel() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -954,8 +1017,10 @@ class CameraApi { /// Returns the maximum zoom level supported by the camera. Future getMaxZoomLevel() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -982,8 +1047,10 @@ class CameraApi { /// Sets the zoom factor. Future setZoomLevel(double zoom) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1005,8 +1072,10 @@ class CameraApi { /// Pauses streaming of preview frames. Future pausePreview() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1028,8 +1097,10 @@ class CameraApi { /// Resumes a previously paused preview stream. Future resumePreview() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1053,8 +1124,10 @@ class CameraApi { /// /// This should only be called while video recording is active. Future updateDescriptionWhileRecording(String cameraName) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1076,8 +1149,10 @@ class CameraApi { /// Sets the file format used for taking pictures. Future setImageFileFormat(PlatformImageFileFormat format) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final String __pigeon_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1100,25 +1175,35 @@ class CameraApi { /// Handler for native callbacks that are not tied to a specific camera ID. abstract class CameraGlobalEventApi { - static const MessageCodec pigeonChannelCodec = StandardMessageCodec(); + static const MessageCodec pigeonChannelCodec = + StandardMessageCodec(); /// Called when the device's physical orientation changes. void deviceOrientationChanged(PlatformDeviceOrientation orientation); - static void setUp(CameraGlobalEventApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { - messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp( + CameraGlobalEventApi? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - 'dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged$messageChannelSuffix', pigeonChannelCodec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null.'); final List args = (message as List?)!; - final PlatformDeviceOrientation? arg_orientation = args[0] == null ? null : PlatformDeviceOrientation.values[args[0]! as int]; + final PlatformDeviceOrientation? arg_orientation = args[0] == null + ? null + : PlatformDeviceOrientation.values[args[0]! as int]; assert(arg_orientation != null, 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null, expected non-null PlatformDeviceOrientation.'); try { @@ -1126,8 +1211,9 @@ abstract class CameraGlobalEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); } }); } @@ -1153,9 +1239,9 @@ class _CameraEventApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return PlatformCameraState.decode(readValue(buffer)!); - case 129: + case 129: return PlatformSize.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1167,7 +1253,8 @@ class _CameraEventApiCodec extends StandardMessageCodec { /// /// This is intended to be initialized with the camera ID as a suffix. abstract class CameraEventApi { - static const MessageCodec pigeonChannelCodec = _CameraEventApiCodec(); + static const MessageCodec pigeonChannelCodec = + _CameraEventApiCodec(); /// Called when the camera is inialitized for use. void initialized(PlatformCameraState initialState); @@ -1178,20 +1265,28 @@ abstract class CameraEventApi { /// handling a specific HostApi call, such as during streaming. void error(String message); - static void setUp(CameraEventApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { - messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp( + CameraEventApi? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized$messageChannelSuffix', pigeonChannelCodec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null.'); final List args = (message as List?)!; - final PlatformCameraState? arg_initialState = (args[0] as PlatformCameraState?); + final PlatformCameraState? arg_initialState = + (args[0] as PlatformCameraState?); assert(arg_initialState != null, 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null, expected non-null PlatformCameraState.'); try { @@ -1199,22 +1294,25 @@ abstract class CameraEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); } }); } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error$messageChannelSuffix', pigeonChannelCodec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error was null.'); final List args = (message as List?)!; final String? arg_message = (args[0] as String?); assert(arg_message != null, @@ -1224,8 +1322,9 @@ abstract class CameraEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); } }); } From 1fc8b22f19a692f904b2ec7eace7cca8e0c97167 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Tue, 1 Apr 2025 15:30:21 -0400 Subject: [PATCH 09/25] created helper function for lens direction and type --- .../xcshareddata/swiftpm/Package.resolved | 14 ++++ .../camera_avfoundation/CameraPlugin.m | 82 ++++++++++--------- 2 files changed, 58 insertions(+), 38 deletions(-) create mode 100644 packages/camera/camera_avfoundation/example/ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/packages/camera/camera_avfoundation/example/ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved b/packages/camera/camera_avfoundation/example/ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 000000000000..663d37c32c59 --- /dev/null +++ b/packages/camera/camera_avfoundation/example/ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,14 @@ +{ + "originHash" : "78c7627871bfd9e691f83c7deb792b533905321b817a3314495d5a35c9268003", + "pins" : [ + { + "identity" : "ocmock", + "kind" : "remoteSourceControl", + "location" : "https://github.com/erikdoe/ocmock", + "state" : { + "revision" : "fe1661a3efed11831a6452f4b1a0c5e6ddc08c3d" + } + } + ], + "version" : 3 +} diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m index 1d9019848666..55d21cb6dd96 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m @@ -152,44 +152,7 @@ - (void)availableCamerasWithCompletion: for (AVCaptureDevice *device in devices) { FCPPlatformCameraLensDirection lensFacing; FCPPlatformCameraLensType lensType; - - switch (device.position) { - case AVCaptureDevicePositionBack: - lensFacing = FCPPlatformCameraLensDirectionBack; - break; - case AVCaptureDevicePositionFront: - lensFacing = FCPPlatformCameraLensDirectionFront; - break; - case AVCaptureDevicePositionUnspecified: - lensFacing = FCPPlatformCameraLensDirectionExternal; - break; - } - - if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInWideAngleCamera]) { - lensType = FCPPlatformCameraLensTypeWide; - } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInTelephotoCamera]) { - lensType = FCPPlatformCameraLensTypeTelephoto; - } else if (@available(iOS 13.0, *)) { - if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInUltraWideCamera]) { - lensType = FCPPlatformCameraLensTypeUltraWide; - } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInDualCamera]) { - lensType = FCPPlatformCameraLensTypeDual; - } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInDualWideCamera]) { - lensType = FCPPlatformCameraLensTypeDualWide; - } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInTripleCamera]) { - lensType = FCPPlatformCameraLensTypeTriple; - } else { - lensType = FCPPlatformCameraLensTypeUnknown; - } - } else if (@available(iOS 17.0, *)) { - if ([device.deviceType isEqualToString:AVCaptureDeviceTypeContinuityCamera]) { - lensType = FCPPlatformCameraLensTypeContinuity; - } else { - lensType = FCPPlatformCameraLensTypeUnknown; - } - } else { - lensType = FCPPlatformCameraLensTypeUnknown; - } + getLensDirectionAndType(device, &lensFacing, &lensType); [reply addObject:[FCPPlatformCameraDescription makeWithName:device.uniqueID lensDirection:lensFacing @@ -199,6 +162,49 @@ - (void)availableCamerasWithCompletion: }); } +static void getLensDirectionAndType(AVCaptureDevice *device, + FCPPlatformCameraLensDirection *lensDirection, + FCPPlatformCameraLensType *lensType) { + switch (device.position) { + case AVCaptureDevicePositionBack: + *lensDirection = FCPPlatformCameraLensDirectionBack; + break; + case AVCaptureDevicePositionFront: + *lensDirection = FCPPlatformCameraLensDirectionFront; + break; + case AVCaptureDevicePositionUnspecified: + *lensDirection = FCPPlatformCameraLensDirectionExternal; + break; + } + + if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInWideAngleCamera]) { + *lensType = FCPPlatformCameraLensTypeWide; + } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInTelephotoCamera]) { + *lensType = FCPPlatformCameraLensTypeTelephoto; + } else if (@available(iOS 13.0, *)) { + if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInUltraWideCamera]) { + *lensType = FCPPlatformCameraLensTypeUltraWide; + } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInDualCamera]) { + *lensType = FCPPlatformCameraLensTypeDual; + } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInDualWideCamera]) { + *lensType = FCPPlatformCameraLensTypeDualWide; + } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInTripleCamera]) { + *lensType = FCPPlatformCameraLensTypeTriple; + } else { + *lensType = FCPPlatformCameraLensTypeUnknown; + } + } else if (@available(iOS 17.0, *)) { + if ([device.deviceType isEqualToString:AVCaptureDeviceTypeContinuityCamera]) { + *lensType = FCPPlatformCameraLensTypeContinuity; + } else { + *lensType = FCPPlatformCameraLensTypeUnknown; + } + } else { + *lensType = FCPPlatformCameraLensTypeUnknown; + } +} + + - (void)createCameraWithName:(nonnull NSString *)cameraName settings:(nonnull FCPPlatformMediaSettings *)settings completion: From a6960170328b42fbdbc4617ad1e2a27f7fe8537c Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Tue, 1 Apr 2025 15:30:21 -0400 Subject: [PATCH 10/25] Change lens type enum to only use UltraWide, Wide, and Telephoto --- .../camera_avfoundation/CameraPlugin.m | 13 +- .../include/camera_avfoundation/messages.g.h | 125 ++- .../Sources/camera_avfoundation/messages.g.m | 765 +++++++----------- .../lib/src/messages.g.dart | 307 +++---- .../camera_avfoundation/lib/src/utils.dart | 4 - .../camera_avfoundation/pigeons/messages.dart | 14 +- .../lib/src/types/camera_description.dart | 12 - 7 files changed, 432 insertions(+), 808 deletions(-) diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m index 55d21cb6dd96..9e539d4880ec 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m @@ -184,18 +184,8 @@ static void getLensDirectionAndType(AVCaptureDevice *device, } else if (@available(iOS 13.0, *)) { if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInUltraWideCamera]) { *lensType = FCPPlatformCameraLensTypeUltraWide; - } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInDualCamera]) { - *lensType = FCPPlatformCameraLensTypeDual; } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInDualWideCamera]) { - *lensType = FCPPlatformCameraLensTypeDualWide; - } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInTripleCamera]) { - *lensType = FCPPlatformCameraLensTypeTriple; - } else { - *lensType = FCPPlatformCameraLensTypeUnknown; - } - } else if (@available(iOS 17.0, *)) { - if ([device.deviceType isEqualToString:AVCaptureDeviceTypeContinuityCamera]) { - *lensType = FCPPlatformCameraLensTypeContinuity; + *lensType = FCPPlatformCameraLensTypeWide; } else { *lensType = FCPPlatformCameraLensTypeUnknown; } @@ -204,7 +194,6 @@ static void getLensDirectionAndType(AVCaptureDevice *device, } } - - (void)createCameraWithName:(nonnull NSString *)cameraName settings:(nonnull FCPPlatformMediaSettings *)settings completion: diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h index 00233971afaa..143fab620284 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h @@ -35,18 +35,8 @@ typedef NS_ENUM(NSUInteger, FCPPlatformCameraLensType) { FCPPlatformCameraLensTypeTelephoto = 1, /// A built-in camera device type with a longer focal length than a wide-angle camera. FCPPlatformCameraLensTypeUltraWide = 2, - /// A built-in camera device type that consists of a wide-angle and telephoto camera. - FCPPlatformCameraLensTypeDual = 3, - /// A built-in camera device type that consists of two cameras of fixed focal length, one - /// ultrawide angle and one wide angle. - FCPPlatformCameraLensTypeDualWide = 4, - /// A built-in camera device type that consists of three cameras of fixed focal length, one - /// ultrawide angle, one wide angle, and one telephoto. - FCPPlatformCameraLensTypeTriple = 5, - /// A Continuity Camera device type. - FCPPlatformCameraLensTypeContinuity = 6, /// Unknown camera device type. - FCPPlatformCameraLensTypeUnknown = 7, + FCPPlatformCameraLensTypeUnknown = 3, }; /// Wrapper for FCPPlatformCameraLensType to allow for nullability. @@ -151,10 +141,10 @@ typedef NS_ENUM(NSUInteger, FCPPlatformResolutionPreset) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithName:(NSString *)name - lensDirection:(FCPPlatformCameraLensDirection)lensDirection - lensType:(FCPPlatformCameraLensType)lensType; + lensDirection:(FCPPlatformCameraLensDirection)lensDirection + lensType:(FCPPlatformCameraLensType)lensType; /// The name of the camera device. -@property(nonatomic, copy) NSString *name; +@property(nonatomic, copy) NSString * name; /// The direction the camera is facing. @property(nonatomic, assign) FCPPlatformCameraLensDirection lensDirection; /// The type of the camera lens. @@ -165,51 +155,53 @@ typedef NS_ENUM(NSUInteger, FCPPlatformResolutionPreset) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithPreviewSize:(FCPPlatformSize *)previewSize - exposureMode:(FCPPlatformExposureMode)exposureMode - focusMode:(FCPPlatformFocusMode)focusMode - exposurePointSupported:(BOOL)exposurePointSupported - focusPointSupported:(BOOL)focusPointSupported; + exposureMode:(FCPPlatformExposureMode)exposureMode + focusMode:(FCPPlatformFocusMode)focusMode + exposurePointSupported:(BOOL )exposurePointSupported + focusPointSupported:(BOOL )focusPointSupported; /// The size of the preview, in pixels. -@property(nonatomic, strong) FCPPlatformSize *previewSize; +@property(nonatomic, strong) FCPPlatformSize * previewSize; /// The default exposure mode @property(nonatomic, assign) FCPPlatformExposureMode exposureMode; /// The default focus mode @property(nonatomic, assign) FCPPlatformFocusMode focusMode; /// Whether setting exposure points is supported. -@property(nonatomic, assign) BOOL exposurePointSupported; +@property(nonatomic, assign) BOOL exposurePointSupported; /// Whether setting focus points is supported. -@property(nonatomic, assign) BOOL focusPointSupported; +@property(nonatomic, assign) BOOL focusPointSupported; @end @interface FCPPlatformMediaSettings : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolutionPreset - framesPerSecond:(nullable NSNumber *)framesPerSecond - videoBitrate:(nullable NSNumber *)videoBitrate - audioBitrate:(nullable NSNumber *)audioBitrate - enableAudio:(BOOL)enableAudio; + framesPerSecond:(nullable NSNumber *)framesPerSecond + videoBitrate:(nullable NSNumber *)videoBitrate + audioBitrate:(nullable NSNumber *)audioBitrate + enableAudio:(BOOL )enableAudio; @property(nonatomic, assign) FCPPlatformResolutionPreset resolutionPreset; -@property(nonatomic, strong, nullable) NSNumber *framesPerSecond; -@property(nonatomic, strong, nullable) NSNumber *videoBitrate; -@property(nonatomic, strong, nullable) NSNumber *audioBitrate; -@property(nonatomic, assign) BOOL enableAudio; +@property(nonatomic, strong, nullable) NSNumber * framesPerSecond; +@property(nonatomic, strong, nullable) NSNumber * videoBitrate; +@property(nonatomic, strong, nullable) NSNumber * audioBitrate; +@property(nonatomic, assign) BOOL enableAudio; @end @interface FCPPlatformPoint : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithX:(double)x y:(double)y; -@property(nonatomic, assign) double x; -@property(nonatomic, assign) double y; ++ (instancetype)makeWithX:(double )x + y:(double )y; +@property(nonatomic, assign) double x; +@property(nonatomic, assign) double y; @end @interface FCPPlatformSize : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithWidth:(double)width height:(double)height; -@property(nonatomic, assign) double width; -@property(nonatomic, assign) double height; ++ (instancetype)makeWithWidth:(double )width + height:(double )height; +@property(nonatomic, assign) double width; +@property(nonatomic, assign) double height; @end /// The codec used by all APIs. @@ -217,16 +209,11 @@ NSObject *FCPGetMessagesCodec(void); @protocol FCPCameraApi /// Returns the list of available cameras. -- (void)availableCamerasWithCompletion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; +- (void)availableCamerasWithCompletion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion; /// Create a new camera with the given settings, and returns its ID. -- (void)createCameraWithName:(NSString *)cameraName - settings:(FCPPlatformMediaSettings *)settings - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; +- (void)createCameraWithName:(NSString *)cameraName settings:(FCPPlatformMediaSettings *)settings completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Initializes the camera with the given ID. -- (void)initializeCamera:(NSInteger)cameraId - withImageFormat:(FCPPlatformImageFormatGroup)imageFormat - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)initializeCamera:(NSInteger)cameraId withImageFormat:(FCPPlatformImageFormatGroup)imageFormat completion:(void (^)(FlutterError *_Nullable))completion; /// Begins streaming frames from the camera. - (void)startImageStreamWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Stops streaming frames from the camera. @@ -240,39 +227,32 @@ NSObject *FCPGetMessagesCodec(void); /// and any associated resources can be cleaned up. - (void)disposeCamera:(NSInteger)cameraId completion:(void (^)(FlutterError *_Nullable))completion; /// Locks the camera capture to the current device orientation. -- (void)lockCaptureOrientation:(FCPPlatformDeviceOrientation)orientation - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)lockCaptureOrientation:(FCPPlatformDeviceOrientation)orientation completion:(void (^)(FlutterError *_Nullable))completion; /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. - (void)unlockCaptureOrientationWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Takes a picture with the current settings, and returns the path to the /// resulting file. -- (void)takePictureWithCompletion:(void (^)(NSString *_Nullable, - FlutterError *_Nullable))completion; +- (void)takePictureWithCompletion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; /// Does any preprocessing necessary before beginning to record video. - (void)prepareForVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Begins recording video, optionally enabling streaming to Dart at the same /// time. -- (void)startVideoRecordingWithStreaming:(BOOL)enableStream - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)startVideoRecordingWithStreaming:(BOOL)enableStream completion:(void (^)(FlutterError *_Nullable))completion; /// Stops recording video, and results the path to the resulting file. -- (void)stopVideoRecordingWithCompletion:(void (^)(NSString *_Nullable, - FlutterError *_Nullable))completion; +- (void)stopVideoRecordingWithCompletion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; /// Pauses video recording. - (void)pauseVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Resumes a previously paused video recording. - (void)resumeVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given flash mode. -- (void)setFlashMode:(FCPPlatformFlashMode)mode - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFlashMode:(FCPPlatformFlashMode)mode completion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given exposure mode. -- (void)setExposureMode:(FCPPlatformExposureMode)mode - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setExposureMode:(FCPPlatformExposureMode)mode completion:(void (^)(FlutterError *_Nullable))completion; /// Anchors auto-exposure to the given point in (0,1) coordinate space. /// /// A null value resets to the default exposure point. -- (void)setExposurePoint:(nullable FCPPlatformPoint *)point - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setExposurePoint:(nullable FCPPlatformPoint *)point completion:(void (^)(FlutterError *_Nullable))completion; /// Returns the minimum exposure offset supported by the camera. - (void)getMinimumExposureOffset:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Returns the maximum exposure offset supported by the camera. @@ -280,13 +260,11 @@ NSObject *FCPGetMessagesCodec(void); /// Sets the exposure offset manually to the given value. - (void)setExposureOffset:(double)offset completion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given focus mode. -- (void)setFocusMode:(FCPPlatformFocusMode)mode - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFocusMode:(FCPPlatformFocusMode)mode completion:(void (^)(FlutterError *_Nullable))completion; /// Anchors auto-focus to the given point in (0,1) coordinate space. /// /// A null value resets to the default focus point. -- (void)setFocusPoint:(nullable FCPPlatformPoint *)point - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFocusPoint:(nullable FCPPlatformPoint *)point completion:(void (^)(FlutterError *_Nullable))completion; /// Returns the minimum zoom level supported by the camera. - (void)getMinimumZoomLevel:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Returns the maximum zoom level supported by the camera. @@ -300,28 +278,21 @@ NSObject *FCPGetMessagesCodec(void); /// Changes the camera used while recording video. /// /// This should only be called while video recording is active. -- (void)updateDescriptionWhileRecordingCameraName:(NSString *)cameraName - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)updateDescriptionWhileRecordingCameraName:(NSString *)cameraName completion:(void (^)(FlutterError *_Nullable))completion; /// Sets the file format used for taking pictures. -- (void)setImageFileFormat:(FCPPlatformImageFileFormat)format - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setImageFileFormat:(FCPPlatformImageFileFormat)format completion:(void (^)(FlutterError *_Nullable))completion; @end -extern void SetUpFCPCameraApi(id binaryMessenger, - NSObject *_Nullable api); +extern void SetUpFCPCameraApi(id binaryMessenger, NSObject *_Nullable api); -extern void SetUpFCPCameraApiWithSuffix(id binaryMessenger, - NSObject *_Nullable api, - NSString *messageChannelSuffix); +extern void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSObject *_Nullable api, NSString *messageChannelSuffix); /// Handler for native callbacks that are not tied to a specific camera ID. @interface FCPCameraGlobalEventApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger messageChannelSuffix:(nullable NSString *)messageChannelSuffix; /// Called when the device's physical orientation changes. -- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)orientation - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)orientation completion:(void (^)(FlutterError *_Nullable))completion; @end /// Handler for native callbacks that are tied to a specific camera ID. @@ -329,11 +300,9 @@ extern void SetUpFCPCameraApiWithSuffix(id binaryMesseng /// This is intended to be initialized with the camera ID as a suffix. @interface FCPCameraEventApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger messageChannelSuffix:(nullable NSString *)messageChannelSuffix; /// Called when the camera is inialitized for use. -- (void)initializedWithState:(FCPPlatformCameraState *)initialState - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)initializedWithState:(FCPPlatformCameraState *)initialState completion:(void (^)(FlutterError *_Nullable))completion; /// Called when an error occurs in the camera. /// /// This should be used for errors that occur outside of the context of diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m index 9dbfae38b168..93073016a9b8 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m @@ -26,12 +26,7 @@ } static FlutterError *createConnectionError(NSString *channelName) { - return [FlutterError - errorWithCode:@"channel-error" - message:[NSString stringWithFormat:@"%@/%@/%@", - @"Unable to establish connection on channel: '", - channelName, @"'."] - details:@""]; + return [FlutterError errorWithCode:@"channel-error" message:[NSString stringWithFormat:@"%@/%@/%@", @"Unable to establish connection on channel: '", channelName, @"'."] details:@""]; } static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { @@ -162,9 +157,9 @@ + (nullable FCPPlatformSize *)nullableFromList:(NSArray *)list; @implementation FCPPlatformCameraDescription + (instancetype)makeWithName:(NSString *)name - lensDirection:(FCPPlatformCameraLensDirection)lensDirection - lensType:(FCPPlatformCameraLensType)lensType { - FCPPlatformCameraDescription *pigeonResult = [[FCPPlatformCameraDescription alloc] init]; + lensDirection:(FCPPlatformCameraLensDirection)lensDirection + lensType:(FCPPlatformCameraLensType)lensType { + FCPPlatformCameraDescription* pigeonResult = [[FCPPlatformCameraDescription alloc] init]; pigeonResult.name = name; pigeonResult.lensDirection = lensDirection; pigeonResult.lensType = lensType; @@ -191,11 +186,11 @@ + (nullable FCPPlatformCameraDescription *)nullableFromList:(NSArray *)list @implementation FCPPlatformCameraState + (instancetype)makeWithPreviewSize:(FCPPlatformSize *)previewSize - exposureMode:(FCPPlatformExposureMode)exposureMode - focusMode:(FCPPlatformFocusMode)focusMode - exposurePointSupported:(BOOL)exposurePointSupported - focusPointSupported:(BOOL)focusPointSupported { - FCPPlatformCameraState *pigeonResult = [[FCPPlatformCameraState alloc] init]; + exposureMode:(FCPPlatformExposureMode)exposureMode + focusMode:(FCPPlatformFocusMode)focusMode + exposurePointSupported:(BOOL )exposurePointSupported + focusPointSupported:(BOOL )focusPointSupported { + FCPPlatformCameraState* pigeonResult = [[FCPPlatformCameraState alloc] init]; pigeonResult.previewSize = previewSize; pigeonResult.exposureMode = exposureMode; pigeonResult.focusMode = focusMode; @@ -228,11 +223,11 @@ + (nullable FCPPlatformCameraState *)nullableFromList:(NSArray *)list { @implementation FCPPlatformMediaSettings + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolutionPreset - framesPerSecond:(nullable NSNumber *)framesPerSecond - videoBitrate:(nullable NSNumber *)videoBitrate - audioBitrate:(nullable NSNumber *)audioBitrate - enableAudio:(BOOL)enableAudio { - FCPPlatformMediaSettings *pigeonResult = [[FCPPlatformMediaSettings alloc] init]; + framesPerSecond:(nullable NSNumber *)framesPerSecond + videoBitrate:(nullable NSNumber *)videoBitrate + audioBitrate:(nullable NSNumber *)audioBitrate + enableAudio:(BOOL )enableAudio { + FCPPlatformMediaSettings* pigeonResult = [[FCPPlatformMediaSettings alloc] init]; pigeonResult.resolutionPreset = resolutionPreset; pigeonResult.framesPerSecond = framesPerSecond; pigeonResult.videoBitrate = videoBitrate; @@ -266,8 +261,9 @@ + (nullable FCPPlatformMediaSettings *)nullableFromList:(NSArray *)list { @end @implementation FCPPlatformPoint -+ (instancetype)makeWithX:(double)x y:(double)y { - FCPPlatformPoint *pigeonResult = [[FCPPlatformPoint alloc] init]; ++ (instancetype)makeWithX:(double )x + y:(double )y { + FCPPlatformPoint* pigeonResult = [[FCPPlatformPoint alloc] init]; pigeonResult.x = x; pigeonResult.y = y; return pigeonResult; @@ -290,8 +286,9 @@ + (nullable FCPPlatformPoint *)nullableFromList:(NSArray *)list { @end @implementation FCPPlatformSize -+ (instancetype)makeWithWidth:(double)width height:(double)height { - FCPPlatformSize *pigeonResult = [[FCPPlatformSize alloc] init]; ++ (instancetype)makeWithWidth:(double )width + height:(double )height { + FCPPlatformSize* pigeonResult = [[FCPPlatformSize alloc] init]; pigeonResult.width = width; pigeonResult.height = height; return pigeonResult; @@ -318,11 +315,11 @@ @interface FCPMessagesPigeonCodecReader : FlutterStandardReader @implementation FCPMessagesPigeonCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FCPPlatformCameraDescription fromList:[self readValue]]; - case 129: + case 129: return [FCPPlatformMediaSettings fromList:[self readValue]]; - case 130: + case 130: return [FCPPlatformPoint fromList:[self readValue]]; case 141: return [FCPPlatformSize fromList:[self readValue]]; @@ -414,29 +411,19 @@ void SetUpFCPCameraApi(id binaryMessenger, NSObject binaryMessenger, - NSObject *api, NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 - ? [NSString stringWithFormat:@".%@", messageChannelSuffix] - : @""; +void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSObject *api, NSString *messageChannelSuffix) { + messageChannelSuffix = messageChannelSuffix.length > 0 ? [NSString stringWithFormat: @".%@", messageChannelSuffix] : @""; /// Returns the list of available cameras. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.getAvailableCameras", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(availableCamerasWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(availableCamerasWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(availableCamerasWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(availableCamerasWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api availableCamerasWithCompletion:^( - NSArray *_Nullable output, - FlutterError *_Nullable error) { + [api availableCamerasWithCompletion:^(NSArray *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -446,27 +433,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Create a new camera with the given settings, and returns its ID. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.create", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.create", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createCameraWithName:settings:completion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(createCameraWithName:settings:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(createCameraWithName:settings:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(createCameraWithName:settings:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_cameraName = GetNullableObjectAtIndex(args, 0); FCPPlatformMediaSettings *arg_settings = GetNullableObjectAtIndex(args, 1); - [api createCameraWithName:arg_cameraName - settings:arg_settings - completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api createCameraWithName:arg_cameraName settings:arg_settings completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -474,29 +454,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Initializes the camera with the given ID. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(initializeCamera:withImageFormat:completion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(initializeCamera:withImageFormat:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(initializeCamera:withImageFormat:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(initializeCamera:withImageFormat:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSInteger arg_cameraId = [GetNullableObjectAtIndex(args, 0) integerValue]; - FCPPlatformImageFormatGroup arg_imageFormat = - [GetNullableObjectAtIndex(args, 1) integerValue]; - [api initializeCamera:arg_cameraId - withImageFormat:arg_imageFormat - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + FCPPlatformImageFormatGroup arg_imageFormat = [GetNullableObjectAtIndex(args, 1) integerValue]; + [api initializeCamera:arg_cameraId withImageFormat:arg_imageFormat completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -504,18 +475,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Begins streaming frames from the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.startImageStream", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(startImageStreamWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(startImageStreamWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(startImageStreamWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(startImageStreamWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api startImageStreamWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -527,19 +493,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Stops streaming frames from the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(stopImageStreamWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(stopImageStreamWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(stopImageStreamWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(stopImageStreamWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api stopImageStreamWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -554,18 +514,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// /// This is used to throttle sending frames across the channel. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.receivedImageStreamData", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(receivedImageStreamDataWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(receivedImageStreamDataWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(receivedImageStreamDataWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(receivedImageStreamDataWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api receivedImageStreamDataWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -578,24 +533,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// Indicates that the given camera is no longer being used on the Dart side, /// and any associated resources can be cleaned up. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(disposeCamera:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(disposeCamera:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(disposeCamera:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(disposeCamera:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSInteger arg_cameraId = [GetNullableObjectAtIndex(args, 0) integerValue]; - [api disposeCamera:arg_cameraId - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api disposeCamera:arg_cameraId completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -603,26 +553,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Locks the camera capture to the current device orientation. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.lockCaptureOrientation", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(lockCaptureOrientation:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(lockCaptureOrientation:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(lockCaptureOrientation:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(lockCaptureOrientation:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FCPPlatformDeviceOrientation arg_orientation = - [GetNullableObjectAtIndex(args, 0) integerValue]; - [api lockCaptureOrientation:arg_orientation - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + FCPPlatformDeviceOrientation arg_orientation = [GetNullableObjectAtIndex(args, 0) integerValue]; + [api lockCaptureOrientation:arg_orientation completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -631,18 +574,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.unlockCaptureOrientation", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(unlockCaptureOrientationWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(unlockCaptureOrientationWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(unlockCaptureOrientationWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(unlockCaptureOrientationWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api unlockCaptureOrientationWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -655,23 +593,17 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// Takes a picture with the current settings, and returns the path to the /// resulting file. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(takePictureWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(takePictureWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(takePictureWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(takePictureWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api - takePictureWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api takePictureWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -679,18 +611,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Does any preprocessing necessary before beginning to record video. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.prepareForVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(prepareForVideoRecordingWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(prepareForVideoRecordingWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(prepareForVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(prepareForVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api prepareForVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -703,25 +630,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// Begins recording video, optionally enabling streaming to Dart at the same /// time. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.startVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(startVideoRecordingWithStreaming:completion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(startVideoRecordingWithStreaming:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(startVideoRecordingWithStreaming:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(startVideoRecordingWithStreaming:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; BOOL arg_enableStream = [GetNullableObjectAtIndex(args, 0) boolValue]; - [api startVideoRecordingWithStreaming:arg_enableStream - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api startVideoRecordingWithStreaming:arg_enableStream completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -729,21 +650,15 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Stops recording video, and results the path to the resulting file. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.stopVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(stopVideoRecordingWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(stopVideoRecordingWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(stopVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(stopVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api stopVideoRecordingWithCompletion:^(NSString *_Nullable output, - FlutterError *_Nullable error) { + [api stopVideoRecordingWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -753,18 +668,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Pauses video recording. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.pauseVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(pauseVideoRecordingWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(pauseVideoRecordingWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(pauseVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(pauseVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api pauseVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -776,18 +686,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Resumes a previously paused video recording. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.resumeVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(resumeVideoRecordingWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(resumeVideoRecordingWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(resumeVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(resumeVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api resumeVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -799,25 +704,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Switches the camera to the given flash mode. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFlashMode:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setFlashMode:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setFlashMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFlashMode:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformFlashMode arg_mode = [GetNullableObjectAtIndex(args, 0) integerValue]; - [api setFlashMode:arg_mode - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFlashMode:arg_mode completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -825,25 +724,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Switches the camera to the given exposure mode. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposureMode:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureMode:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setExposureMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureMode:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformExposureMode arg_mode = [GetNullableObjectAtIndex(args, 0) integerValue]; - [api setExposureMode:arg_mode - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposureMode:arg_mode completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -853,24 +746,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// /// A null value resets to the default exposure point. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.setExposurePoint", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposurePoint:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setExposurePoint:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setExposurePoint:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposurePoint:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformPoint *arg_point = GetNullableObjectAtIndex(args, 0); - [api setExposurePoint:arg_point - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposurePoint:arg_point completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -878,17 +766,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Returns the minimum exposure offset supported by the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.getMinExposureOffset", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMinimumExposureOffset:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumExposureOffset:)", - api); + NSCAssert([api respondsToSelector:@selector(getMinimumExposureOffset:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumExposureOffset:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMinimumExposureOffset:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -900,17 +784,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Returns the maximum exposure offset supported by the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.getMaxExposureOffset", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMaximumExposureOffset:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumExposureOffset:)", - api); + NSCAssert([api respondsToSelector:@selector(getMaximumExposureOffset:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumExposureOffset:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMaximumExposureOffset:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -922,25 +802,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Sets the exposure offset manually to the given value. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.setExposureOffset", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(setExposureOffset:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureOffset:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setExposureOffset:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureOffset:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; double arg_offset = [GetNullableObjectAtIndex(args, 0) doubleValue]; - [api setExposureOffset:arg_offset - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposureOffset:arg_offset completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -948,25 +822,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Switches the camera to the given focus mode. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFocusMode:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusMode:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setFocusMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusMode:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformFocusMode arg_mode = [GetNullableObjectAtIndex(args, 0) integerValue]; - [api setFocusMode:arg_mode - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFocusMode:arg_mode completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -976,25 +844,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// /// A null value resets to the default focus point. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFocusPoint:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusPoint:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setFocusPoint:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusPoint:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformPoint *arg_point = GetNullableObjectAtIndex(args, 0); - [api setFocusPoint:arg_point - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFocusPoint:arg_point completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1002,17 +864,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Returns the minimum zoom level supported by the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMinimumZoomLevel:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumZoomLevel:)", api); + NSCAssert([api respondsToSelector:@selector(getMinimumZoomLevel:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumZoomLevel:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMinimumZoomLevel:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -1024,17 +882,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Returns the maximum zoom level supported by the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMaximumZoomLevel:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumZoomLevel:)", api); + NSCAssert([api respondsToSelector:@selector(getMaximumZoomLevel:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumZoomLevel:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMaximumZoomLevel:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -1046,25 +900,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Sets the zoom factor. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setZoomLevel:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setZoomLevel:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setZoomLevel:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setZoomLevel:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; double arg_zoom = [GetNullableObjectAtIndex(args, 0) doubleValue]; - [api setZoomLevel:arg_zoom - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setZoomLevel:arg_zoom completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1072,18 +920,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Pauses streaming of preview frames. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(pausePreviewWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(pausePreviewWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(pausePreviewWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(pausePreviewWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api pausePreviewWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -1095,18 +938,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Resumes a previously paused preview stream. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(resumePreviewWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(resumePreviewWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(resumePreviewWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(resumePreviewWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api resumePreviewWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -1120,26 +958,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// /// This should only be called while video recording is active. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.updateDescriptionWhileRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(updateDescriptionWhileRecordingCameraName: - completion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(updateDescriptionWhileRecordingCameraName:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(updateDescriptionWhileRecordingCameraName:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(updateDescriptionWhileRecordingCameraName:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_cameraName = GetNullableObjectAtIndex(args, 0); - [api updateDescriptionWhileRecordingCameraName:arg_cameraName - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api updateDescriptionWhileRecordingCameraName:arg_cameraName completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1147,25 +978,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Sets the file format used for taking pictures. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.setImageFileFormat", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPCameraApiGetCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(setImageFileFormat:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setImageFileFormat:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setImageFileFormat:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setImageFileFormat:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformImageFileFormat arg_format = [GetNullableObjectAtIndex(args, 0) integerValue]; - [api setImageFileFormat:arg_format - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setImageFileFormat:arg_format completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1182,42 +1007,32 @@ @implementation FCPCameraGlobalEventApi - (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""]; } -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix { +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger messageChannelSuffix:(nullable NSString*)messageChannelSuffix{ self = [self init]; if (self) { _binaryMessenger = binaryMessenger; - _messageChannelSuffix = [messageChannelSuffix length] == 0 - ? @"" - : [NSString stringWithFormat:@".%@", messageChannelSuffix]; + _messageChannelSuffix = [messageChannelSuffix length] == 0 ? @"" : [NSString stringWithFormat: @".%@", messageChannelSuffix]; } return self; } -- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)arg_orientation - completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged", - _messageChannelSuffix]; +- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)arg_orientation completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged", _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPCameraGlobalEventApiGetCodec()]; - [channel sendMessage:@[ [NSNumber numberWithInteger:arg_orientation] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel + messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPCameraGlobalEventApiGetCodec()]; + [channel sendMessage:@[[NSNumber numberWithInteger:arg_orientation]] reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } @end @@ -1226,9 +1041,9 @@ @interface FCPCameraEventApiCodecReader : FlutterStandardReader @implementation FCPCameraEventApiCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FCPPlatformCameraState fromList:[self readValue]]; - case 129: + case 129: return [FCPPlatformSize fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -1267,8 +1082,7 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FCPCameraEventApiCodecReaderWriter *readerWriter = - [[FCPCameraEventApiCodecReaderWriter alloc] init]; + FCPCameraEventApiCodecReaderWriter *readerWriter = [[FCPCameraEventApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; @@ -1284,64 +1098,51 @@ @implementation FCPCameraEventApi - (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""]; } -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix { +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger messageChannelSuffix:(nullable NSString*)messageChannelSuffix{ self = [self init]; if (self) { _binaryMessenger = binaryMessenger; - _messageChannelSuffix = [messageChannelSuffix length] == 0 - ? @"" - : [NSString stringWithFormat:@".%@", messageChannelSuffix]; + _messageChannelSuffix = [messageChannelSuffix length] == 0 ? @"" : [NSString stringWithFormat: @".%@", messageChannelSuffix]; } return self; } -- (void)initializedWithState:(FCPPlatformCameraState *)arg_initialState - completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized", - _messageChannelSuffix]; +- (void)initializedWithState:(FCPPlatformCameraState *)arg_initialState completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized", _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPCameraEventApiGetCodec()]; - [channel sendMessage:@[ arg_initialState ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel + messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPCameraEventApiGetCodec()]; + [channel sendMessage:@[arg_initialState ?: [NSNull null]] reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } -- (void)reportError:(NSString *)arg_message - completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error", - _messageChannelSuffix]; +- (void)reportError:(NSString *)arg_message completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error", _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPCameraEventApiGetCodec()]; - [channel sendMessage:@[ arg_message ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel + messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPCameraEventApiGetCodec()]; + [channel sendMessage:@[arg_message ?: [NSNull null]] reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } @end + diff --git a/packages/camera/camera_avfoundation/lib/src/messages.g.dart b/packages/camera/camera_avfoundation/lib/src/messages.g.dart index e9609ae4984d..2ed0951d7de9 100644 --- a/packages/camera/camera_avfoundation/lib/src/messages.g.dart +++ b/packages/camera/camera_avfoundation/lib/src/messages.g.dart @@ -18,8 +18,7 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse( - {Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -32,10 +31,8 @@ List wrapResponse( enum PlatformCameraLensDirection { /// Front facing camera (a user looking at the screen is seen by the camera). front, - /// Back facing camera (a user looking at the screen is not seen by the camera). back, - /// External camera which may not be mounted to the device. external, } @@ -43,25 +40,10 @@ enum PlatformCameraLensDirection { enum PlatformCameraLensType { /// A built-in wide-angle camera device type. wide, - /// A built-in camera device type with a shorter focal length than a wide-angle camera. telephoto, - /// A built-in camera device type with a longer focal length than a wide-angle camera. ultraWide, - - /// A built-in camera device type that consists of a wide-angle and telephoto camera. - dual, - - /// A built-in camera device type that consists of two cameras of fixed focal length, one ultrawide angle and one wide angle. - dualWide, - - /// A built-in camera device type that consists of three cameras of fixed focal length, one ultrawide angle, one wide angle, and one telephoto. - triple, - - /// A Continuity Camera device type. - continuity, - /// Unknown camera device type. unknown, } @@ -337,11 +319,11 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return PlatformCameraDescription.decode(readValue(buffer)!); - case 129: + case 129: return PlatformMediaSettings.decode(readValue(buffer)!); - case 130: + case 130: return PlatformPoint.decode(readValue(buffer)!); case 141: return PlatformSize.decode(readValue(buffer)!); @@ -355,11 +337,9 @@ class CameraApi { /// Constructor for [CameraApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - CameraApi( - {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + CameraApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + __pigeon_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? __pigeon_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -368,10 +348,8 @@ class CameraApi { /// Returns the list of available cameras. Future> getAvailableCameras() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -392,23 +370,20 @@ class CameraApi { message: 'Host platform returned null value for non-null return value.', ); } else { - return (__pigeon_replyList[0] as List?)! - .cast(); + return (__pigeon_replyList[0] as List?)!.cast(); } } /// Create a new camera with the given settings, and returns its ID. Future create(String cameraName, PlatformMediaSettings settings) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.create$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.create$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([cameraName, settings]) as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([cameraName, settings]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -428,18 +403,15 @@ class CameraApi { } /// Initializes the camera with the given ID. - Future initialize( - int cameraId, PlatformImageFormatGroup imageFormat) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + Future initialize(int cameraId, PlatformImageFormatGroup imageFormat) async { + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([cameraId, imageFormat.index]) as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([cameraId, imageFormat.index]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -455,10 +427,8 @@ class CameraApi { /// Begins streaming frames from the camera. Future startImageStream() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -480,10 +450,8 @@ class CameraApi { /// Stops streaming frames from the camera. Future stopImageStream() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -508,10 +476,8 @@ class CameraApi { /// /// This is used to throttle sending frames across the channel. Future receivedImageStreamData() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -534,10 +500,8 @@ class CameraApi { /// Indicates that the given camera is no longer being used on the Dart side, /// and any associated resources can be cleaned up. Future dispose(int cameraId) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -558,18 +522,15 @@ class CameraApi { } /// Locks the camera capture to the current device orientation. - Future lockCaptureOrientation( - PlatformDeviceOrientation orientation) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + Future lockCaptureOrientation(PlatformDeviceOrientation orientation) async { + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = await __pigeon_channel - .send([orientation.index]) as List?; + final List? __pigeon_replyList = + await __pigeon_channel.send([orientation.index]) as List?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -586,10 +547,8 @@ class CameraApi { /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. Future unlockCaptureOrientation() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -612,10 +571,8 @@ class CameraApi { /// Takes a picture with the current settings, and returns the path to the /// resulting file. Future takePicture() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -642,10 +599,8 @@ class CameraApi { /// Does any preprocessing necessary before beginning to record video. Future prepareForVideoRecording() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -668,10 +623,8 @@ class CameraApi { /// Begins recording video, optionally enabling streaming to Dart at the same /// time. Future startVideoRecording(bool enableStream) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -693,10 +646,8 @@ class CameraApi { /// Stops recording video, and results the path to the resulting file. Future stopVideoRecording() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -723,10 +674,8 @@ class CameraApi { /// Pauses video recording. Future pauseVideoRecording() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -748,10 +697,8 @@ class CameraApi { /// Resumes a previously paused video recording. Future resumeVideoRecording() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -773,10 +720,8 @@ class CameraApi { /// Switches the camera to the given flash mode. Future setFlashMode(PlatformFlashMode mode) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -798,10 +743,8 @@ class CameraApi { /// Switches the camera to the given exposure mode. Future setExposureMode(PlatformExposureMode mode) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -825,10 +768,8 @@ class CameraApi { /// /// A null value resets to the default exposure point. Future setExposurePoint(PlatformPoint? point) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -850,10 +791,8 @@ class CameraApi { /// Returns the minimum exposure offset supported by the camera. Future getMinExposureOffset() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -880,10 +819,8 @@ class CameraApi { /// Returns the maximum exposure offset supported by the camera. Future getMaxExposureOffset() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -910,10 +847,8 @@ class CameraApi { /// Sets the exposure offset manually to the given value. Future setExposureOffset(double offset) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -935,10 +870,8 @@ class CameraApi { /// Switches the camera to the given focus mode. Future setFocusMode(PlatformFocusMode mode) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -962,10 +895,8 @@ class CameraApi { /// /// A null value resets to the default focus point. Future setFocusPoint(PlatformPoint? point) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -987,10 +918,8 @@ class CameraApi { /// Returns the minimum zoom level supported by the camera. Future getMinZoomLevel() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1017,10 +946,8 @@ class CameraApi { /// Returns the maximum zoom level supported by the camera. Future getMaxZoomLevel() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1047,10 +974,8 @@ class CameraApi { /// Sets the zoom factor. Future setZoomLevel(double zoom) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1072,10 +997,8 @@ class CameraApi { /// Pauses streaming of preview frames. Future pausePreview() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1097,10 +1020,8 @@ class CameraApi { /// Resumes a previously paused preview stream. Future resumePreview() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1124,10 +1045,8 @@ class CameraApi { /// /// This should only be called while video recording is active. Future updateDescriptionWhileRecording(String cameraName) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1149,10 +1068,8 @@ class CameraApi { /// Sets the file format used for taking pictures. Future setImageFileFormat(PlatformImageFileFormat format) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = - BasicMessageChannel( + final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1175,35 +1092,25 @@ class CameraApi { /// Handler for native callbacks that are not tied to a specific camera ID. abstract class CameraGlobalEventApi { - static const MessageCodec pigeonChannelCodec = - StandardMessageCodec(); + static const MessageCodec pigeonChannelCodec = StandardMessageCodec(); /// Called when the device's physical orientation changes. void deviceOrientationChanged(PlatformDeviceOrientation orientation); - static void setUp( - CameraGlobalEventApi? api, { - BinaryMessenger? binaryMessenger, - String messageChannelSuffix = '', - }) { - messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp(CameraGlobalEventApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { + messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged$messageChannelSuffix', - pigeonChannelCodec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + 'dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null.'); final List args = (message as List?)!; - final PlatformDeviceOrientation? arg_orientation = args[0] == null - ? null - : PlatformDeviceOrientation.values[args[0]! as int]; + final PlatformDeviceOrientation? arg_orientation = args[0] == null ? null : PlatformDeviceOrientation.values[args[0]! as int]; assert(arg_orientation != null, 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null, expected non-null PlatformDeviceOrientation.'); try { @@ -1211,9 +1118,8 @@ abstract class CameraGlobalEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } @@ -1239,9 +1145,9 @@ class _CameraEventApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return PlatformCameraState.decode(readValue(buffer)!); - case 129: + case 129: return PlatformSize.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1253,8 +1159,7 @@ class _CameraEventApiCodec extends StandardMessageCodec { /// /// This is intended to be initialized with the camera ID as a suffix. abstract class CameraEventApi { - static const MessageCodec pigeonChannelCodec = - _CameraEventApiCodec(); + static const MessageCodec pigeonChannelCodec = _CameraEventApiCodec(); /// Called when the camera is inialitized for use. void initialized(PlatformCameraState initialState); @@ -1265,28 +1170,20 @@ abstract class CameraEventApi { /// handling a specific HostApi call, such as during streaming. void error(String message); - static void setUp( - CameraEventApi? api, { - BinaryMessenger? binaryMessenger, - String messageChannelSuffix = '', - }) { - messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp(CameraEventApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { + messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized$messageChannelSuffix', - pigeonChannelCodec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null.'); final List args = (message as List?)!; - final PlatformCameraState? arg_initialState = - (args[0] as PlatformCameraState?); + final PlatformCameraState? arg_initialState = (args[0] as PlatformCameraState?); assert(arg_initialState != null, 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null, expected non-null PlatformCameraState.'); try { @@ -1294,25 +1191,22 @@ abstract class CameraEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error$messageChannelSuffix', - pigeonChannelCodec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error was null.'); final List args = (message as List?)!; final String? arg_message = (args[0] as String?); assert(arg_message != null, @@ -1322,9 +1216,8 @@ abstract class CameraEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } diff --git a/packages/camera/camera_avfoundation/lib/src/utils.dart b/packages/camera/camera_avfoundation/lib/src/utils.dart index 266f38a816f1..35eb576990be 100644 --- a/packages/camera/camera_avfoundation/lib/src/utils.dart +++ b/packages/camera/camera_avfoundation/lib/src/utils.dart @@ -33,10 +33,6 @@ CameraLensType cameraLensTypeFromPlatform(PlatformCameraLensType type) { PlatformCameraLensType.wide => CameraLensType.wide, PlatformCameraLensType.telephoto => CameraLensType.telephoto, PlatformCameraLensType.ultraWide => CameraLensType.ultraWide, - PlatformCameraLensType.dual => CameraLensType.dual, - PlatformCameraLensType.dualWide => CameraLensType.dualWide, - PlatformCameraLensType.triple => CameraLensType.triple, - PlatformCameraLensType.continuity => CameraLensType.continuity, PlatformCameraLensType.unknown => CameraLensType.unknown, }; } diff --git a/packages/camera/camera_avfoundation/pigeons/messages.dart b/packages/camera/camera_avfoundation/pigeons/messages.dart index 58fc5a50fb16..e72e6d9cdace 100644 --- a/packages/camera/camera_avfoundation/pigeons/messages.dart +++ b/packages/camera/camera_avfoundation/pigeons/messages.dart @@ -39,19 +39,7 @@ enum PlatformCameraLensType { /// A built-in camera device type with a longer focal length than a wide-angle camera. ultraWide, - - /// A built-in camera device type that consists of a wide-angle and telephoto camera. - dual, - - /// A built-in camera device type that consists of two cameras of fixed focal length, one ultrawide angle and one wide angle. - dualWide, - - /// A built-in camera device type that consists of three cameras of fixed focal length, one ultrawide angle, one wide angle, and one telephoto. - triple, - - /// A Continuity Camera device type. - continuity, - + /// Unknown camera device type. unknown, } diff --git a/packages/camera/camera_platform_interface/lib/src/types/camera_description.dart b/packages/camera/camera_platform_interface/lib/src/types/camera_description.dart index 1a666ccf0937..93e8bb329d97 100644 --- a/packages/camera/camera_platform_interface/lib/src/types/camera_description.dart +++ b/packages/camera/camera_platform_interface/lib/src/types/camera_description.dart @@ -29,18 +29,6 @@ enum CameraLensType { /// A built-in camera device type with a longer focal length than a wide-angle camera. ultraWide, - /// A built-in camera device type that consists of a wide-angle and telephoto camera. - dual, - - /// A built-in camera device type that consists of two cameras of fixed focal length, one ultrawide angle and one wide angle. - dualWide, - - /// A built-in camera device type that consists of three cameras of fixed focal length, one ultrawide angle, one wide angle, and one telephoto. - triple, - - /// A Continuity Camera device type. - continuity, - /// Unknown camera device type. unknown, } From c1383738aea6792ad57c60ba6e671c089d22da46 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Tue, 1 Apr 2025 15:30:21 -0400 Subject: [PATCH 11/25] run pigeon gen and applied flutter_plugin_tools.dart formatting --- .../include/camera_avfoundation/messages.g.h | 4 +- .../Sources/camera_avfoundation/messages.g.m | 252 ++++++++------- .../lib/src/messages.g.dart | 297 ++++++++++-------- .../camera_avfoundation/pigeons/messages.dart | 2 +- 4 files changed, 294 insertions(+), 261 deletions(-) diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h index 143fab620284..3eb04b18e7d8 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h @@ -1,7 +1,7 @@ // 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 (v18.0.1), do not edit directly. +// Autogenerated from Pigeon (v22.7.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #import @@ -287,6 +287,7 @@ extern void SetUpFCPCameraApi(id binaryMessenger, NSObje extern void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSObject *_Nullable api, NSString *messageChannelSuffix); + /// Handler for native callbacks that are not tied to a specific camera ID. @interface FCPCameraGlobalEventApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; @@ -295,6 +296,7 @@ extern void SetUpFCPCameraApiWithSuffix(id binaryMesseng - (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)orientation completion:(void (^)(FlutterError *_Nullable))completion; @end + /// Handler for native callbacks that are tied to a specific camera ID. /// /// This is intended to be initialized with the camera ID as a suffix. diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m index 93073016a9b8..7f63258c48f0 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m @@ -1,10 +1,10 @@ // 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 (v18.0.1), do not edit directly. +// Autogenerated from Pigeon (v22.7.0), do not edit directly. // See also: https://pub.dev/packages/pigeon -#import "messages.g.h" +#import "./include/camera_avfoundation/messages.g.h" #if TARGET_OS_OSX #import @@ -168,8 +168,10 @@ + (instancetype)makeWithName:(NSString *)name + (FCPPlatformCameraDescription *)fromList:(NSArray *)list { FCPPlatformCameraDescription *pigeonResult = [[FCPPlatformCameraDescription alloc] init]; pigeonResult.name = GetNullableObjectAtIndex(list, 0); - pigeonResult.lensDirection = [GetNullableObjectAtIndex(list, 1) integerValue]; - pigeonResult.lensType = [GetNullableObjectAtIndex(list, 2) integerValue]; + FCPPlatformCameraLensDirectionBox *boxedFCPPlatformCameraLensDirection = GetNullableObjectAtIndex(list, 1); + pigeonResult.lensDirection = boxedFCPPlatformCameraLensDirection.value; + FCPPlatformCameraLensTypeBox *boxedFCPPlatformCameraLensType = GetNullableObjectAtIndex(list, 2); + pigeonResult.lensType = boxedFCPPlatformCameraLensType.value; return pigeonResult; } + (nullable FCPPlatformCameraDescription *)nullableFromList:(NSArray *)list { @@ -178,8 +180,8 @@ + (nullable FCPPlatformCameraDescription *)nullableFromList:(NSArray *)list - (NSArray *)toList { return @[ self.name ?: [NSNull null], - @(self.lensDirection), - @(self.lensType), + [[FCPPlatformCameraLensDirectionBox alloc] initWithValue:self.lensDirection], + [[FCPPlatformCameraLensTypeBox alloc] initWithValue:self.lensType], ]; } @end @@ -201,8 +203,10 @@ + (instancetype)makeWithPreviewSize:(FCPPlatformSize *)previewSize + (FCPPlatformCameraState *)fromList:(NSArray *)list { FCPPlatformCameraState *pigeonResult = [[FCPPlatformCameraState alloc] init]; pigeonResult.previewSize = GetNullableObjectAtIndex(list, 0); - pigeonResult.exposureMode = [GetNullableObjectAtIndex(list, 1) integerValue]; - pigeonResult.focusMode = [GetNullableObjectAtIndex(list, 2) integerValue]; + FCPPlatformExposureModeBox *boxedFCPPlatformExposureMode = GetNullableObjectAtIndex(list, 1); + pigeonResult.exposureMode = boxedFCPPlatformExposureMode.value; + FCPPlatformFocusModeBox *boxedFCPPlatformFocusMode = GetNullableObjectAtIndex(list, 2); + pigeonResult.focusMode = boxedFCPPlatformFocusMode.value; pigeonResult.exposurePointSupported = [GetNullableObjectAtIndex(list, 3) boolValue]; pigeonResult.focusPointSupported = [GetNullableObjectAtIndex(list, 4) boolValue]; return pigeonResult; @@ -213,8 +217,8 @@ + (nullable FCPPlatformCameraState *)nullableFromList:(NSArray *)list { - (NSArray *)toList { return @[ self.previewSize ?: [NSNull null], - @(self.exposureMode), - @(self.focusMode), + [[FCPPlatformExposureModeBox alloc] initWithValue:self.exposureMode], + [[FCPPlatformFocusModeBox alloc] initWithValue:self.focusMode], @(self.exposurePointSupported), @(self.focusPointSupported), ]; @@ -237,8 +241,7 @@ + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolution } + (FCPPlatformMediaSettings *)fromList:(NSArray *)list { FCPPlatformMediaSettings *pigeonResult = [[FCPPlatformMediaSettings alloc] init]; - FCPPlatformResolutionPresetBox *boxedFCPPlatformResolutionPreset = - GetNullableObjectAtIndex(list, 0); + FCPPlatformResolutionPresetBox *boxedFCPPlatformResolutionPreset = GetNullableObjectAtIndex(list, 0); pigeonResult.resolutionPreset = boxedFCPPlatformResolutionPreset.value; pigeonResult.framesPerSecond = GetNullableObjectAtIndex(list, 1); pigeonResult.videoBitrate = GetNullableObjectAtIndex(list, 2); @@ -315,13 +318,51 @@ @interface FCPMessagesPigeonCodecReader : FlutterStandardReader @implementation FCPMessagesPigeonCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 129: { + NSNumber *enumAsNumber = [self readValue]; + return enumAsNumber == nil ? nil : [[FCPPlatformCameraLensDirectionBox alloc] initWithValue:[enumAsNumber integerValue]]; + } + case 130: { + NSNumber *enumAsNumber = [self readValue]; + return enumAsNumber == nil ? nil : [[FCPPlatformCameraLensTypeBox alloc] initWithValue:[enumAsNumber integerValue]]; + } + case 131: { + NSNumber *enumAsNumber = [self readValue]; + return enumAsNumber == nil ? nil : [[FCPPlatformDeviceOrientationBox alloc] initWithValue:[enumAsNumber integerValue]]; + } + case 132: { + NSNumber *enumAsNumber = [self readValue]; + return enumAsNumber == nil ? nil : [[FCPPlatformExposureModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + } + case 133: { + NSNumber *enumAsNumber = [self readValue]; + return enumAsNumber == nil ? nil : [[FCPPlatformFlashModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + } + case 134: { + NSNumber *enumAsNumber = [self readValue]; + return enumAsNumber == nil ? nil : [[FCPPlatformFocusModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + } + case 135: { + NSNumber *enumAsNumber = [self readValue]; + return enumAsNumber == nil ? nil : [[FCPPlatformImageFileFormatBox alloc] initWithValue:[enumAsNumber integerValue]]; + } + case 136: { + NSNumber *enumAsNumber = [self readValue]; + return enumAsNumber == nil ? nil : [[FCPPlatformImageFormatGroupBox alloc] initWithValue:[enumAsNumber integerValue]]; + } + case 137: { + NSNumber *enumAsNumber = [self readValue]; + return enumAsNumber == nil ? nil : [[FCPPlatformResolutionPresetBox alloc] initWithValue:[enumAsNumber integerValue]]; + } + case 138: return [FCPPlatformCameraDescription fromList:[self readValue]]; - case 129: + case 139: + return [FCPPlatformCameraState fromList:[self readValue]]; + case 140: return [FCPPlatformMediaSettings fromList:[self readValue]]; - case 130: + case 141: return [FCPPlatformPoint fromList:[self readValue]]; - case 141: + case 142: return [FCPPlatformSize fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -337,48 +378,52 @@ - (void)writeValue:(id)value { FCPPlatformCameraLensDirectionBox *box = (FCPPlatformCameraLensDirectionBox *)value; [self writeByte:129]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; + } else if ([value isKindOfClass:[FCPPlatformCameraLensTypeBox class]]) { + FCPPlatformCameraLensTypeBox *box = (FCPPlatformCameraLensTypeBox *)value; + [self writeByte:130]; + [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformDeviceOrientationBox class]]) { FCPPlatformDeviceOrientationBox *box = (FCPPlatformDeviceOrientationBox *)value; - [self writeByte:130]; + [self writeByte:131]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformExposureModeBox class]]) { FCPPlatformExposureModeBox *box = (FCPPlatformExposureModeBox *)value; - [self writeByte:131]; + [self writeByte:132]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformFlashModeBox class]]) { FCPPlatformFlashModeBox *box = (FCPPlatformFlashModeBox *)value; - [self writeByte:132]; + [self writeByte:133]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformFocusModeBox class]]) { FCPPlatformFocusModeBox *box = (FCPPlatformFocusModeBox *)value; - [self writeByte:133]; + [self writeByte:134]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformImageFileFormatBox class]]) { FCPPlatformImageFileFormatBox *box = (FCPPlatformImageFileFormatBox *)value; - [self writeByte:134]; + [self writeByte:135]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformImageFormatGroupBox class]]) { FCPPlatformImageFormatGroupBox *box = (FCPPlatformImageFormatGroupBox *)value; - [self writeByte:135]; + [self writeByte:136]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformResolutionPresetBox class]]) { FCPPlatformResolutionPresetBox *box = (FCPPlatformResolutionPresetBox *)value; - [self writeByte:136]; + [self writeByte:137]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformCameraDescription class]]) { - [self writeByte:137]; + [self writeByte:138]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FCPPlatformCameraState class]]) { - [self writeByte:138]; + [self writeByte:139]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FCPPlatformMediaSettings class]]) { - [self writeByte:139]; + [self writeByte:140]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FCPPlatformPoint class]]) { - [self writeByte:140]; + [self writeByte:141]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FCPPlatformSize class]]) { - [self writeByte:141]; + [self writeByte:142]; [self writeValue:[value toList]]; } else { [super writeValue:value]; @@ -401,8 +446,7 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FCPMessagesPigeonCodecReaderWriter *readerWriter = - [[FCPMessagesPigeonCodecReaderWriter alloc] init]; + FCPMessagesPigeonCodecReaderWriter *readerWriter = [[FCPMessagesPigeonCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; @@ -419,7 +463,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(availableCamerasWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(availableCamerasWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -437,7 +481,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.create", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(createCameraWithName:settings:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(createCameraWithName:settings:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -458,13 +502,14 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(initializeCamera:withImageFormat:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(initializeCamera:withImageFormat:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSInteger arg_cameraId = [GetNullableObjectAtIndex(args, 0) integerValue]; - FCPPlatformImageFormatGroup arg_imageFormat = [GetNullableObjectAtIndex(args, 1) integerValue]; + FCPPlatformImageFormatGroupBox *boxedFCPPlatformImageFormatGroup = GetNullableObjectAtIndex(args, 1); + FCPPlatformImageFormatGroup arg_imageFormat = boxedFCPPlatformImageFormatGroup.value; [api initializeCamera:arg_cameraId withImageFormat:arg_imageFormat completion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); }]; @@ -479,7 +524,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(startImageStreamWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(startImageStreamWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -497,7 +542,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(stopImageStreamWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(stopImageStreamWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -518,7 +563,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(receivedImageStreamDataWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(receivedImageStreamDataWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -537,7 +582,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(disposeCamera:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(disposeCamera:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -557,12 +602,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(lockCaptureOrientation:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(lockCaptureOrientation:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FCPPlatformDeviceOrientation arg_orientation = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSArray *args = message; + FCPPlatformDeviceOrientationBox *boxedFCPPlatformDeviceOrientation = GetNullableObjectAtIndex(args, 0); + FCPPlatformDeviceOrientation arg_orientation = boxedFCPPlatformDeviceOrientation.value; [api lockCaptureOrientation:arg_orientation completion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); }]; @@ -578,7 +624,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(unlockCaptureOrientationWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(unlockCaptureOrientationWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -597,7 +643,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(takePictureWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(takePictureWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -615,7 +661,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(prepareForVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(prepareForVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -634,7 +680,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(startVideoRecordingWithStreaming:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(startVideoRecordingWithStreaming:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -654,7 +700,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(stopVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(stopVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -672,7 +718,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(pauseVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(pauseVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -690,7 +736,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(resumeVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(resumeVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -708,12 +754,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(setFlashMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFlashMode:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FCPPlatformFlashMode arg_mode = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSArray *args = message; + FCPPlatformFlashModeBox *boxedFCPPlatformFlashMode = GetNullableObjectAtIndex(args, 0); + FCPPlatformFlashMode arg_mode = boxedFCPPlatformFlashMode.value; [api setFlashMode:arg_mode completion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); }]; @@ -728,12 +775,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(setExposureMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureMode:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FCPPlatformExposureMode arg_mode = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSArray *args = message; + FCPPlatformExposureModeBox *boxedFCPPlatformExposureMode = GetNullableObjectAtIndex(args, 0); + FCPPlatformExposureMode arg_mode = boxedFCPPlatformExposureMode.value; [api setExposureMode:arg_mode completion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); }]; @@ -750,7 +798,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(setExposurePoint:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposurePoint:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -770,7 +818,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(getMinimumExposureOffset:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumExposureOffset:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -788,7 +836,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(getMaximumExposureOffset:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumExposureOffset:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -806,7 +854,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(setExposureOffset:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureOffset:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -826,12 +874,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(setFocusMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusMode:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FCPPlatformFocusMode arg_mode = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSArray *args = message; + FCPPlatformFocusModeBox *boxedFCPPlatformFocusMode = GetNullableObjectAtIndex(args, 0); + FCPPlatformFocusMode arg_mode = boxedFCPPlatformFocusMode.value; [api setFocusMode:arg_mode completion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); }]; @@ -848,7 +897,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(setFocusPoint:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusPoint:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -868,7 +917,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(getMinimumZoomLevel:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumZoomLevel:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -886,7 +935,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(getMaximumZoomLevel:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumZoomLevel:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -904,7 +953,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(setZoomLevel:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setZoomLevel:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -924,7 +973,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(pausePreviewWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(pausePreviewWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -942,7 +991,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(resumePreviewWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(resumePreviewWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -962,7 +1011,7 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(updateDescriptionWhileRecordingCameraName:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(updateDescriptionWhileRecordingCameraName:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { @@ -982,12 +1031,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO [[FlutterBasicMessageChannel alloc] initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPCameraApiGetCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { NSCAssert([api respondsToSelector:@selector(setImageFileFormat:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setImageFileFormat:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - NSArray *args = message; - FCPPlatformImageFileFormat arg_format = [GetNullableObjectAtIndex(args, 0) integerValue]; + NSArray *args = message; + FCPPlatformImageFileFormatBox *boxedFCPPlatformImageFileFormat = GetNullableObjectAtIndex(args, 0); + FCPPlatformImageFileFormat arg_format = boxedFCPPlatformImageFileFormat.value; [api setImageFileFormat:arg_format completion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); }]; @@ -1021,8 +1071,8 @@ - (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)arg_or [FlutterBasicMessageChannel messageChannelWithName:channelName binaryMessenger:self.binaryMessenger - codec:FCPCameraGlobalEventApiGetCodec()]; - [channel sendMessage:@[[NSNumber numberWithInteger:arg_orientation]] reply:^(NSArray *reply) { + codec:FCPGetMessagesCodec()]; + [channel sendMessage:@[[[FCPPlatformDeviceOrientationBox alloc] initWithValue:arg_orientation]] reply:^(NSArray *reply) { if (reply != nil) { if (reply.count > 1) { completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); @@ -1036,58 +1086,6 @@ - (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)arg_or } @end -@interface FCPCameraEventApiCodecReader : FlutterStandardReader -@end -@implementation FCPCameraEventApiCodecReader -- (nullable id)readValueOfType:(UInt8)type { - switch (type) { - case 128: - return [FCPPlatformCameraState fromList:[self readValue]]; - case 129: - return [FCPPlatformSize fromList:[self readValue]]; - default: - return [super readValueOfType:type]; - } -} -@end - -@interface FCPCameraEventApiCodecWriter : FlutterStandardWriter -@end -@implementation FCPCameraEventApiCodecWriter -- (void)writeValue:(id)value { - if ([value isKindOfClass:[FCPPlatformCameraState class]]) { - [self writeByte:128]; - [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FCPPlatformSize class]]) { - [self writeByte:129]; - [self writeValue:[value toList]]; - } else { - [super writeValue:value]; - } -} -@end - -@interface FCPCameraEventApiCodecReaderWriter : FlutterStandardReaderWriter -@end -@implementation FCPCameraEventApiCodecReaderWriter -- (FlutterStandardWriter *)writerWithData:(NSMutableData *)data { - return [[FCPCameraEventApiCodecWriter alloc] initWithData:data]; -} -- (FlutterStandardReader *)readerWithData:(NSData *)data { - return [[FCPCameraEventApiCodecReader alloc] initWithData:data]; -} -@end - -NSObject *FCPCameraEventApiGetCodec(void) { - static FlutterStandardMessageCodec *sSharedObject = nil; - static dispatch_once_t sPred = 0; - dispatch_once(&sPred, ^{ - FCPCameraEventApiCodecReaderWriter *readerWriter = [[FCPCameraEventApiCodecReaderWriter alloc] init]; - sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; - }); - return sSharedObject; -} - @interface FCPCameraEventApi () @property(nonatomic, strong) NSObject *binaryMessenger; @property(nonatomic, strong) NSString *messageChannelSuffix; @@ -1112,7 +1110,7 @@ - (void)initializedWithState:(FCPPlatformCameraState *)arg_initialState completi [FlutterBasicMessageChannel messageChannelWithName:channelName binaryMessenger:self.binaryMessenger - codec:FCPCameraEventApiGetCodec()]; + codec:FCPGetMessagesCodec()]; [channel sendMessage:@[arg_initialState ?: [NSNull null]] reply:^(NSArray *reply) { if (reply != nil) { if (reply.count > 1) { @@ -1131,7 +1129,7 @@ - (void)reportError:(NSString *)arg_message completion:(void (^)(FlutterError *_ [FlutterBasicMessageChannel messageChannelWithName:channelName binaryMessenger:self.binaryMessenger - codec:FCPCameraEventApiGetCodec()]; + codec:FCPGetMessagesCodec()]; [channel sendMessage:@[arg_message ?: [NSNull null]] reply:^(NSArray *reply) { if (reply != nil) { if (reply.count > 1) { diff --git a/packages/camera/camera_avfoundation/lib/src/messages.g.dart b/packages/camera/camera_avfoundation/lib/src/messages.g.dart index 2ed0951d7de9..8a883a2adda9 100644 --- a/packages/camera/camera_avfoundation/lib/src/messages.g.dart +++ b/packages/camera/camera_avfoundation/lib/src/messages.g.dart @@ -1,7 +1,7 @@ // 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 (v18.0.1), do not edit directly. +// Autogenerated from Pigeon (v22.7.0), 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, unnecessary_import, no_leading_underscores_for_local_identifiers @@ -111,8 +111,8 @@ class PlatformCameraDescription { Object encode() { return [ name, - lensDirection.index, - lensType.index, + lensDirection, + lensType, ]; } @@ -120,8 +120,8 @@ class PlatformCameraDescription { result as List; return PlatformCameraDescription( name: result[0]! as String, - lensDirection: PlatformCameraLensDirection.values[result[1]! as int], - lensType: PlatformCameraLensType.values[result[2]! as int], + lensDirection: result[1]! as PlatformCameraLensDirection, + lensType: result[2]! as PlatformCameraLensType, ); } } @@ -265,6 +265,7 @@ class PlatformSize { } } + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -272,45 +273,48 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is PlatformCameraLensDirection) { + } else if (value is PlatformCameraLensDirection) { buffer.putUint8(129); writeValue(buffer, value.index); - } else if (value is PlatformDeviceOrientation) { + } else if (value is PlatformCameraLensType) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is PlatformExposureMode) { + } else if (value is PlatformDeviceOrientation) { buffer.putUint8(131); writeValue(buffer, value.index); - } else if (value is PlatformFlashMode) { + } else if (value is PlatformExposureMode) { buffer.putUint8(132); writeValue(buffer, value.index); - } else if (value is PlatformFocusMode) { + } else if (value is PlatformFlashMode) { buffer.putUint8(133); writeValue(buffer, value.index); - } else if (value is PlatformImageFileFormat) { + } else if (value is PlatformFocusMode) { buffer.putUint8(134); writeValue(buffer, value.index); - } else if (value is PlatformImageFormatGroup) { + } else if (value is PlatformImageFileFormat) { buffer.putUint8(135); writeValue(buffer, value.index); - } else if (value is PlatformResolutionPreset) { + } else if (value is PlatformImageFormatGroup) { buffer.putUint8(136); writeValue(buffer, value.index); - } else if (value is PlatformCameraDescription) { + } else if (value is PlatformResolutionPreset) { buffer.putUint8(137); - writeValue(buffer, value.encode()); - } else if (value is PlatformCameraState) { + writeValue(buffer, value.index); + } else if (value is PlatformCameraDescription) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value is PlatformMediaSettings) { + } else if (value is PlatformCameraState) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is PlatformPoint) { + } else if (value is PlatformMediaSettings) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is PlatformSize) { + } else if (value is PlatformPoint) { buffer.putUint8(141); writeValue(buffer, value.encode()); + } else if (value is PlatformSize) { + buffer.putUint8(142); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -319,13 +323,42 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: - return PlatformCameraDescription.decode(readValue(buffer)!); case 129: - return PlatformMediaSettings.decode(readValue(buffer)!); + final int? value = readValue(buffer) as int?; + return value == null ? null : PlatformCameraLensDirection.values[value]; case 130: + final int? value = readValue(buffer) as int?; + return value == null ? null : PlatformCameraLensType.values[value]; + case 131: + final int? value = readValue(buffer) as int?; + return value == null ? null : PlatformDeviceOrientation.values[value]; + case 132: + final int? value = readValue(buffer) as int?; + return value == null ? null : PlatformExposureMode.values[value]; + case 133: + final int? value = readValue(buffer) as int?; + return value == null ? null : PlatformFlashMode.values[value]; + case 134: + final int? value = readValue(buffer) as int?; + return value == null ? null : PlatformFocusMode.values[value]; + case 135: + final int? value = readValue(buffer) as int?; + return value == null ? null : PlatformImageFileFormat.values[value]; + case 136: + final int? value = readValue(buffer) as int?; + return value == null ? null : PlatformImageFormatGroup.values[value]; + case 137: + final int? value = readValue(buffer) as int?; + return value == null ? null : PlatformResolutionPreset.values[value]; + case 138: + return PlatformCameraDescription.decode(readValue(buffer)!); + case 139: + return PlatformCameraState.decode(readValue(buffer)!); + case 140: + return PlatformMediaSettings.decode(readValue(buffer)!); + case 141: return PlatformPoint.decode(readValue(buffer)!); - case 141: + case 142: return PlatformSize.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -338,19 +371,19 @@ class CameraApi { /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. CameraApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? __pigeon_binaryMessenger; + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); final String pigeonVar_messageChannelSuffix; /// Returns the list of available cameras. - Future> getAvailableCameras() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + Future> getAvailableCameras() async { + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -370,23 +403,23 @@ class CameraApi { message: 'Host platform returned null value for non-null return value.', ); } else { - return (__pigeon_replyList[0] as List?)!.cast(); + return (pigeonVar_replyList[0] as List?)!.cast(); } } /// Create a new camera with the given settings, and returns its ID. Future create(String cameraName, PlatformMediaSettings settings) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.create$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.create$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([cameraName, settings]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([cameraName, settings]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( code: pigeonVar_replyList[0]! as String, message: pigeonVar_replyList[1] as String?, @@ -404,17 +437,17 @@ class CameraApi { /// Initializes the camera with the given ID. Future initialize(int cameraId, PlatformImageFormatGroup imageFormat) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([cameraId, imageFormat.index]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([cameraId, imageFormat]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( code: pigeonVar_replyList[0]! as String, message: pigeonVar_replyList[1] as String?, @@ -427,9 +460,9 @@ class CameraApi { /// Begins streaming frames from the camera. Future startImageStream() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -450,9 +483,9 @@ class CameraApi { /// Stops streaming frames from the camera. Future stopImageStream() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -476,9 +509,9 @@ class CameraApi { /// /// This is used to throttle sending frames across the channel. Future receivedImageStreamData() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -500,9 +533,9 @@ class CameraApi { /// Indicates that the given camera is no longer being used on the Dart side, /// and any associated resources can be cleaned up. Future dispose(int cameraId) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -523,9 +556,9 @@ class CameraApi { /// Locks the camera capture to the current device orientation. Future lockCaptureOrientation(PlatformDeviceOrientation orientation) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -547,9 +580,9 @@ class CameraApi { /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. Future unlockCaptureOrientation() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -571,9 +604,9 @@ class CameraApi { /// Takes a picture with the current settings, and returns the path to the /// resulting file. Future takePicture() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -599,9 +632,9 @@ class CameraApi { /// Does any preprocessing necessary before beginning to record video. Future prepareForVideoRecording() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -623,9 +656,9 @@ class CameraApi { /// Begins recording video, optionally enabling streaming to Dart at the same /// time. Future startVideoRecording(bool enableStream) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -646,9 +679,9 @@ class CameraApi { /// Stops recording video, and results the path to the resulting file. Future stopVideoRecording() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -674,9 +707,9 @@ class CameraApi { /// Pauses video recording. Future pauseVideoRecording() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -697,9 +730,9 @@ class CameraApi { /// Resumes a previously paused video recording. Future resumeVideoRecording() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -720,9 +753,9 @@ class CameraApi { /// Switches the camera to the given flash mode. Future setFlashMode(PlatformFlashMode mode) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -743,9 +776,9 @@ class CameraApi { /// Switches the camera to the given exposure mode. Future setExposureMode(PlatformExposureMode mode) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -768,9 +801,9 @@ class CameraApi { /// /// A null value resets to the default exposure point. Future setExposurePoint(PlatformPoint? point) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -791,9 +824,9 @@ class CameraApi { /// Returns the minimum exposure offset supported by the camera. Future getMinExposureOffset() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -819,9 +852,9 @@ class CameraApi { /// Returns the maximum exposure offset supported by the camera. Future getMaxExposureOffset() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -847,9 +880,9 @@ class CameraApi { /// Sets the exposure offset manually to the given value. Future setExposureOffset(double offset) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -870,9 +903,9 @@ class CameraApi { /// Switches the camera to the given focus mode. Future setFocusMode(PlatformFocusMode mode) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -895,9 +928,9 @@ class CameraApi { /// /// A null value resets to the default focus point. Future setFocusPoint(PlatformPoint? point) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -918,9 +951,9 @@ class CameraApi { /// Returns the minimum zoom level supported by the camera. Future getMinZoomLevel() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -946,9 +979,9 @@ class CameraApi { /// Returns the maximum zoom level supported by the camera. Future getMaxZoomLevel() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -974,9 +1007,9 @@ class CameraApi { /// Sets the zoom factor. Future setZoomLevel(double zoom) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -997,9 +1030,9 @@ class CameraApi { /// Pauses streaming of preview frames. Future pausePreview() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -1020,9 +1053,9 @@ class CameraApi { /// Resumes a previously paused preview stream. Future resumePreview() async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -1045,9 +1078,9 @@ class CameraApi { /// /// This should only be called while video recording is active. Future updateDescriptionWhileRecording(String cameraName) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -1068,9 +1101,9 @@ class CameraApi { /// Sets the file format used for taking pictures. Future setImageFileFormat(PlatformImageFileFormat format) async { - final String __pigeon_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( - __pigeon_channelName, + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); @@ -1100,7 +1133,7 @@ abstract class CameraGlobalEventApi { static void setUp(CameraGlobalEventApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1110,7 +1143,7 @@ abstract class CameraGlobalEventApi { assert(message != null, 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null.'); final List args = (message as List?)!; - final PlatformDeviceOrientation? arg_orientation = args[0] == null ? null : PlatformDeviceOrientation.values[args[0]! as int]; + final PlatformDeviceOrientation? arg_orientation = (args[0] as PlatformDeviceOrientation?); assert(arg_orientation != null, 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null, expected non-null PlatformDeviceOrientation.'); try { @@ -1173,7 +1206,7 @@ abstract class CameraEventApi { static void setUp(CameraEventApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { @@ -1198,7 +1231,7 @@ abstract class CameraEventApi { } } { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel( + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { diff --git a/packages/camera/camera_avfoundation/pigeons/messages.dart b/packages/camera/camera_avfoundation/pigeons/messages.dart index e72e6d9cdace..b55d1ff1f612 100644 --- a/packages/camera/camera_avfoundation/pigeons/messages.dart +++ b/packages/camera/camera_avfoundation/pigeons/messages.dart @@ -39,7 +39,7 @@ enum PlatformCameraLensType { /// A built-in camera device type with a longer focal length than a wide-angle camera. ultraWide, - + /// Unknown camera device type. unknown, } From 83f62da161f97074bfa07ca4b18982bcd8fa3dfa Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Tue, 1 Apr 2025 15:30:21 -0400 Subject: [PATCH 12/25] Update CHANGELOG and Fix CI errors Ran format script Fix Package.resolved --- .../camera/camera_avfoundation/CHANGELOG.md | 2 +- .../ios/Runner.xcodeproj/project.pbxproj | 24 +- .../xcshareddata/swiftpm/Package.resolved | 14 + .../xcshareddata/swiftpm/Package.resolved | 2 +- .../include/camera_avfoundation/messages.g.h | 115 +-- .../Sources/camera_avfoundation/messages.g.m | 813 +++++++++++------- .../lib/src/messages.g.dart | 334 ++++--- .../camera_platform_interface/CHANGELOG.md | 3 - 8 files changed, 837 insertions(+), 470 deletions(-) create mode 100644 packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/packages/camera/camera_avfoundation/CHANGELOG.md b/packages/camera/camera_avfoundation/CHANGELOG.md index 6e8ae50b4d33..1ea8ae2e92a1 100644 --- a/packages/camera/camera_avfoundation/CHANGELOG.md +++ b/packages/camera/camera_avfoundation/CHANGELOG.md @@ -66,7 +66,7 @@ ## 0.9.17+6 * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. -* Removes OCMock usage from permission tests +* Adds lensType in the PlatformCameraDescription ## 0.9.17+5 diff --git a/packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj b/packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj index f58349a9d99b..927aaed76246 100644 --- a/packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj @@ -362,7 +362,7 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - 2B62C73988DE02487EF557D4 /* [CP] Copy Pods Resources */, + 9398D213E0DC7FA444659627 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -500,6 +500,28 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + 9398D213E0DC7FA444659627 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/camera_avfoundation/camera_avfoundation_privacy.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/path_provider_foundation/path_provider_foundation_privacy.bundle", + "${PODS_CONFIGURATION_BUILD_DIR}/video_player_avfoundation/video_player_avfoundation_privacy.bundle", + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/camera_avfoundation_privacy.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/path_provider_foundation_privacy.bundle", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/video_player_avfoundation_privacy.bundle", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; diff --git a/packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 000000000000..68d3807f536e --- /dev/null +++ b/packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,14 @@ +{ + "originHash" : "7c8819d255ed200955091f7d8622f8ab2b9d2ffd207ca5223aa8dcd8b33c77a0", + "pins" : [ + { + "identity" : "ocmock", + "kind" : "remoteSourceControl", + "location" : "https://github.com/erikdoe/ocmock", + "state" : { + "revision" : "fe1661a3efed11831a6452f4b1a0c5e6ddc08c3d" + } + } + ], + "version" : 3 +} diff --git a/packages/camera/camera_avfoundation/example/ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved b/packages/camera/camera_avfoundation/example/ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved index 663d37c32c59..68d3807f536e 100644 --- a/packages/camera/camera_avfoundation/example/ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/packages/camera/camera_avfoundation/example/ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "78c7627871bfd9e691f83c7deb792b533905321b817a3314495d5a35c9268003", + "originHash" : "7c8819d255ed200955091f7d8622f8ab2b9d2ffd207ca5223aa8dcd8b33c77a0", "pins" : [ { "identity" : "ocmock", diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h index 3eb04b18e7d8..3f79b5e5f405 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h @@ -141,10 +141,10 @@ typedef NS_ENUM(NSUInteger, FCPPlatformResolutionPreset) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithName:(NSString *)name - lensDirection:(FCPPlatformCameraLensDirection)lensDirection - lensType:(FCPPlatformCameraLensType)lensType; + lensDirection:(FCPPlatformCameraLensDirection)lensDirection + lensType:(FCPPlatformCameraLensType)lensType; /// The name of the camera device. -@property(nonatomic, copy) NSString * name; +@property(nonatomic, copy) NSString *name; /// The direction the camera is facing. @property(nonatomic, assign) FCPPlatformCameraLensDirection lensDirection; /// The type of the camera lens. @@ -155,53 +155,51 @@ typedef NS_ENUM(NSUInteger, FCPPlatformResolutionPreset) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithPreviewSize:(FCPPlatformSize *)previewSize - exposureMode:(FCPPlatformExposureMode)exposureMode - focusMode:(FCPPlatformFocusMode)focusMode - exposurePointSupported:(BOOL )exposurePointSupported - focusPointSupported:(BOOL )focusPointSupported; + exposureMode:(FCPPlatformExposureMode)exposureMode + focusMode:(FCPPlatformFocusMode)focusMode + exposurePointSupported:(BOOL)exposurePointSupported + focusPointSupported:(BOOL)focusPointSupported; /// The size of the preview, in pixels. -@property(nonatomic, strong) FCPPlatformSize * previewSize; +@property(nonatomic, strong) FCPPlatformSize *previewSize; /// The default exposure mode @property(nonatomic, assign) FCPPlatformExposureMode exposureMode; /// The default focus mode @property(nonatomic, assign) FCPPlatformFocusMode focusMode; /// Whether setting exposure points is supported. -@property(nonatomic, assign) BOOL exposurePointSupported; +@property(nonatomic, assign) BOOL exposurePointSupported; /// Whether setting focus points is supported. -@property(nonatomic, assign) BOOL focusPointSupported; +@property(nonatomic, assign) BOOL focusPointSupported; @end @interface FCPPlatformMediaSettings : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolutionPreset - framesPerSecond:(nullable NSNumber *)framesPerSecond - videoBitrate:(nullable NSNumber *)videoBitrate - audioBitrate:(nullable NSNumber *)audioBitrate - enableAudio:(BOOL )enableAudio; + framesPerSecond:(nullable NSNumber *)framesPerSecond + videoBitrate:(nullable NSNumber *)videoBitrate + audioBitrate:(nullable NSNumber *)audioBitrate + enableAudio:(BOOL)enableAudio; @property(nonatomic, assign) FCPPlatformResolutionPreset resolutionPreset; -@property(nonatomic, strong, nullable) NSNumber * framesPerSecond; -@property(nonatomic, strong, nullable) NSNumber * videoBitrate; -@property(nonatomic, strong, nullable) NSNumber * audioBitrate; -@property(nonatomic, assign) BOOL enableAudio; +@property(nonatomic, strong, nullable) NSNumber *framesPerSecond; +@property(nonatomic, strong, nullable) NSNumber *videoBitrate; +@property(nonatomic, strong, nullable) NSNumber *audioBitrate; +@property(nonatomic, assign) BOOL enableAudio; @end @interface FCPPlatformPoint : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithX:(double )x - y:(double )y; -@property(nonatomic, assign) double x; -@property(nonatomic, assign) double y; ++ (instancetype)makeWithX:(double)x y:(double)y; +@property(nonatomic, assign) double x; +@property(nonatomic, assign) double y; @end @interface FCPPlatformSize : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithWidth:(double )width - height:(double )height; -@property(nonatomic, assign) double width; -@property(nonatomic, assign) double height; ++ (instancetype)makeWithWidth:(double)width height:(double)height; +@property(nonatomic, assign) double width; +@property(nonatomic, assign) double height; @end /// The codec used by all APIs. @@ -209,11 +207,16 @@ NSObject *FCPGetMessagesCodec(void); @protocol FCPCameraApi /// Returns the list of available cameras. -- (void)availableCamerasWithCompletion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion; +- (void)availableCamerasWithCompletion:(void (^)(NSArray *_Nullable, + FlutterError *_Nullable))completion; /// Create a new camera with the given settings, and returns its ID. -- (void)createCameraWithName:(NSString *)cameraName settings:(FCPPlatformMediaSettings *)settings completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; +- (void)createCameraWithName:(NSString *)cameraName + settings:(FCPPlatformMediaSettings *)settings + completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Initializes the camera with the given ID. -- (void)initializeCamera:(NSInteger)cameraId withImageFormat:(FCPPlatformImageFormatGroup)imageFormat completion:(void (^)(FlutterError *_Nullable))completion; +- (void)initializeCamera:(NSInteger)cameraId + withImageFormat:(FCPPlatformImageFormatGroup)imageFormat + completion:(void (^)(FlutterError *_Nullable))completion; /// Begins streaming frames from the camera. - (void)startImageStreamWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Stops streaming frames from the camera. @@ -227,32 +230,39 @@ NSObject *FCPGetMessagesCodec(void); /// and any associated resources can be cleaned up. - (void)disposeCamera:(NSInteger)cameraId completion:(void (^)(FlutterError *_Nullable))completion; /// Locks the camera capture to the current device orientation. -- (void)lockCaptureOrientation:(FCPPlatformDeviceOrientation)orientation completion:(void (^)(FlutterError *_Nullable))completion; +- (void)lockCaptureOrientation:(FCPPlatformDeviceOrientation)orientation + completion:(void (^)(FlutterError *_Nullable))completion; /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. - (void)unlockCaptureOrientationWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Takes a picture with the current settings, and returns the path to the /// resulting file. -- (void)takePictureWithCompletion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; +- (void)takePictureWithCompletion:(void (^)(NSString *_Nullable, + FlutterError *_Nullable))completion; /// Does any preprocessing necessary before beginning to record video. - (void)prepareForVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Begins recording video, optionally enabling streaming to Dart at the same /// time. -- (void)startVideoRecordingWithStreaming:(BOOL)enableStream completion:(void (^)(FlutterError *_Nullable))completion; +- (void)startVideoRecordingWithStreaming:(BOOL)enableStream + completion:(void (^)(FlutterError *_Nullable))completion; /// Stops recording video, and results the path to the resulting file. -- (void)stopVideoRecordingWithCompletion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; +- (void)stopVideoRecordingWithCompletion:(void (^)(NSString *_Nullable, + FlutterError *_Nullable))completion; /// Pauses video recording. - (void)pauseVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Resumes a previously paused video recording. - (void)resumeVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given flash mode. -- (void)setFlashMode:(FCPPlatformFlashMode)mode completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFlashMode:(FCPPlatformFlashMode)mode + completion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given exposure mode. -- (void)setExposureMode:(FCPPlatformExposureMode)mode completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setExposureMode:(FCPPlatformExposureMode)mode + completion:(void (^)(FlutterError *_Nullable))completion; /// Anchors auto-exposure to the given point in (0,1) coordinate space. /// /// A null value resets to the default exposure point. -- (void)setExposurePoint:(nullable FCPPlatformPoint *)point completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setExposurePoint:(nullable FCPPlatformPoint *)point + completion:(void (^)(FlutterError *_Nullable))completion; /// Returns the minimum exposure offset supported by the camera. - (void)getMinimumExposureOffset:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Returns the maximum exposure offset supported by the camera. @@ -260,11 +270,13 @@ NSObject *FCPGetMessagesCodec(void); /// Sets the exposure offset manually to the given value. - (void)setExposureOffset:(double)offset completion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given focus mode. -- (void)setFocusMode:(FCPPlatformFocusMode)mode completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFocusMode:(FCPPlatformFocusMode)mode + completion:(void (^)(FlutterError *_Nullable))completion; /// Anchors auto-focus to the given point in (0,1) coordinate space. /// /// A null value resets to the default focus point. -- (void)setFocusPoint:(nullable FCPPlatformPoint *)point completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFocusPoint:(nullable FCPPlatformPoint *)point + completion:(void (^)(FlutterError *_Nullable))completion; /// Returns the minimum zoom level supported by the camera. - (void)getMinimumZoomLevel:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Returns the maximum zoom level supported by the camera. @@ -278,33 +290,40 @@ NSObject *FCPGetMessagesCodec(void); /// Changes the camera used while recording video. /// /// This should only be called while video recording is active. -- (void)updateDescriptionWhileRecordingCameraName:(NSString *)cameraName completion:(void (^)(FlutterError *_Nullable))completion; +- (void)updateDescriptionWhileRecordingCameraName:(NSString *)cameraName + completion:(void (^)(FlutterError *_Nullable))completion; /// Sets the file format used for taking pictures. -- (void)setImageFileFormat:(FCPPlatformImageFileFormat)format completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setImageFileFormat:(FCPPlatformImageFileFormat)format + completion:(void (^)(FlutterError *_Nullable))completion; @end -extern void SetUpFCPCameraApi(id binaryMessenger, NSObject *_Nullable api); - -extern void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSObject *_Nullable api, NSString *messageChannelSuffix); +extern void SetUpFCPCameraApi(id binaryMessenger, + NSObject *_Nullable api); +extern void SetUpFCPCameraApiWithSuffix(id binaryMessenger, + NSObject *_Nullable api, + NSString *messageChannelSuffix); /// Handler for native callbacks that are not tied to a specific camera ID. @interface FCPCameraGlobalEventApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger messageChannelSuffix:(nullable NSString *)messageChannelSuffix; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + messageChannelSuffix:(nullable NSString *)messageChannelSuffix; /// Called when the device's physical orientation changes. -- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)orientation completion:(void (^)(FlutterError *_Nullable))completion; +- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)orientation + completion:(void (^)(FlutterError *_Nullable))completion; @end - /// Handler for native callbacks that are tied to a specific camera ID. /// /// This is intended to be initialized with the camera ID as a suffix. @interface FCPCameraEventApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger messageChannelSuffix:(nullable NSString *)messageChannelSuffix; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + messageChannelSuffix:(nullable NSString *)messageChannelSuffix; /// Called when the camera is inialitized for use. -- (void)initializedWithState:(FCPPlatformCameraState *)initialState completion:(void (^)(FlutterError *_Nullable))completion; +- (void)initializedWithState:(FCPPlatformCameraState *)initialState + completion:(void (^)(FlutterError *_Nullable))completion; /// Called when an error occurs in the camera. /// /// This should be used for errors that occur outside of the context of diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m index 7f63258c48f0..6fd130e922c0 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m @@ -26,7 +26,12 @@ } static FlutterError *createConnectionError(NSString *channelName) { - return [FlutterError errorWithCode:@"channel-error" message:[NSString stringWithFormat:@"%@/%@/%@", @"Unable to establish connection on channel: '", channelName, @"'."] details:@""]; + return [FlutterError + errorWithCode:@"channel-error" + message:[NSString stringWithFormat:@"%@/%@/%@", + @"Unable to establish connection on channel: '", + channelName, @"'."] + details:@""]; } static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { @@ -157,9 +162,9 @@ + (nullable FCPPlatformSize *)nullableFromList:(NSArray *)list; @implementation FCPPlatformCameraDescription + (instancetype)makeWithName:(NSString *)name - lensDirection:(FCPPlatformCameraLensDirection)lensDirection - lensType:(FCPPlatformCameraLensType)lensType { - FCPPlatformCameraDescription* pigeonResult = [[FCPPlatformCameraDescription alloc] init]; + lensDirection:(FCPPlatformCameraLensDirection)lensDirection + lensType:(FCPPlatformCameraLensType)lensType { + FCPPlatformCameraDescription *pigeonResult = [[FCPPlatformCameraDescription alloc] init]; pigeonResult.name = name; pigeonResult.lensDirection = lensDirection; pigeonResult.lensType = lensType; @@ -168,7 +173,8 @@ + (instancetype)makeWithName:(NSString *)name + (FCPPlatformCameraDescription *)fromList:(NSArray *)list { FCPPlatformCameraDescription *pigeonResult = [[FCPPlatformCameraDescription alloc] init]; pigeonResult.name = GetNullableObjectAtIndex(list, 0); - FCPPlatformCameraLensDirectionBox *boxedFCPPlatformCameraLensDirection = GetNullableObjectAtIndex(list, 1); + FCPPlatformCameraLensDirectionBox *boxedFCPPlatformCameraLensDirection = + GetNullableObjectAtIndex(list, 1); pigeonResult.lensDirection = boxedFCPPlatformCameraLensDirection.value; FCPPlatformCameraLensTypeBox *boxedFCPPlatformCameraLensType = GetNullableObjectAtIndex(list, 2); pigeonResult.lensType = boxedFCPPlatformCameraLensType.value; @@ -188,11 +194,11 @@ + (nullable FCPPlatformCameraDescription *)nullableFromList:(NSArray *)list @implementation FCPPlatformCameraState + (instancetype)makeWithPreviewSize:(FCPPlatformSize *)previewSize - exposureMode:(FCPPlatformExposureMode)exposureMode - focusMode:(FCPPlatformFocusMode)focusMode - exposurePointSupported:(BOOL )exposurePointSupported - focusPointSupported:(BOOL )focusPointSupported { - FCPPlatformCameraState* pigeonResult = [[FCPPlatformCameraState alloc] init]; + exposureMode:(FCPPlatformExposureMode)exposureMode + focusMode:(FCPPlatformFocusMode)focusMode + exposurePointSupported:(BOOL)exposurePointSupported + focusPointSupported:(BOOL)focusPointSupported { + FCPPlatformCameraState *pigeonResult = [[FCPPlatformCameraState alloc] init]; pigeonResult.previewSize = previewSize; pigeonResult.exposureMode = exposureMode; pigeonResult.focusMode = focusMode; @@ -227,11 +233,11 @@ + (nullable FCPPlatformCameraState *)nullableFromList:(NSArray *)list { @implementation FCPPlatformMediaSettings + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolutionPreset - framesPerSecond:(nullable NSNumber *)framesPerSecond - videoBitrate:(nullable NSNumber *)videoBitrate - audioBitrate:(nullable NSNumber *)audioBitrate - enableAudio:(BOOL )enableAudio { - FCPPlatformMediaSettings* pigeonResult = [[FCPPlatformMediaSettings alloc] init]; + framesPerSecond:(nullable NSNumber *)framesPerSecond + videoBitrate:(nullable NSNumber *)videoBitrate + audioBitrate:(nullable NSNumber *)audioBitrate + enableAudio:(BOOL)enableAudio { + FCPPlatformMediaSettings *pigeonResult = [[FCPPlatformMediaSettings alloc] init]; pigeonResult.resolutionPreset = resolutionPreset; pigeonResult.framesPerSecond = framesPerSecond; pigeonResult.videoBitrate = videoBitrate; @@ -241,7 +247,8 @@ + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolution } + (FCPPlatformMediaSettings *)fromList:(NSArray *)list { FCPPlatformMediaSettings *pigeonResult = [[FCPPlatformMediaSettings alloc] init]; - FCPPlatformResolutionPresetBox *boxedFCPPlatformResolutionPreset = GetNullableObjectAtIndex(list, 0); + FCPPlatformResolutionPresetBox *boxedFCPPlatformResolutionPreset = + GetNullableObjectAtIndex(list, 0); pigeonResult.resolutionPreset = boxedFCPPlatformResolutionPreset.value; pigeonResult.framesPerSecond = GetNullableObjectAtIndex(list, 1); pigeonResult.videoBitrate = GetNullableObjectAtIndex(list, 2); @@ -264,9 +271,8 @@ + (nullable FCPPlatformMediaSettings *)nullableFromList:(NSArray *)list { @end @implementation FCPPlatformPoint -+ (instancetype)makeWithX:(double )x - y:(double )y { - FCPPlatformPoint* pigeonResult = [[FCPPlatformPoint alloc] init]; ++ (instancetype)makeWithX:(double)x y:(double)y { + FCPPlatformPoint *pigeonResult = [[FCPPlatformPoint alloc] init]; pigeonResult.x = x; pigeonResult.y = y; return pigeonResult; @@ -289,9 +295,8 @@ + (nullable FCPPlatformPoint *)nullableFromList:(NSArray *)list { @end @implementation FCPPlatformSize -+ (instancetype)makeWithWidth:(double )width - height:(double )height { - FCPPlatformSize* pigeonResult = [[FCPPlatformSize alloc] init]; ++ (instancetype)makeWithWidth:(double)width height:(double)height { + FCPPlatformSize *pigeonResult = [[FCPPlatformSize alloc] init]; pigeonResult.width = width; pigeonResult.height = height; return pigeonResult; @@ -320,49 +325,67 @@ - (nullable id)readValueOfType:(UInt8)type { switch (type) { case 129: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformCameraLensDirectionBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil + : [[FCPPlatformCameraLensDirectionBox alloc] + initWithValue:[enumAsNumber integerValue]]; } case 130: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformCameraLensTypeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil + ? nil + : [[FCPPlatformCameraLensTypeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 131: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformDeviceOrientationBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil + : [[FCPPlatformDeviceOrientationBox alloc] + initWithValue:[enumAsNumber integerValue]]; } case 132: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformExposureModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil + ? nil + : [[FCPPlatformExposureModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 133: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformFlashModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil + ? nil + : [[FCPPlatformFlashModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 134: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformFocusModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil + ? nil + : [[FCPPlatformFocusModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 135: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformImageFileFormatBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil + : [[FCPPlatformImageFileFormatBox alloc] + initWithValue:[enumAsNumber integerValue]]; } case 136: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformImageFormatGroupBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil + : [[FCPPlatformImageFormatGroupBox alloc] + initWithValue:[enumAsNumber integerValue]]; } case 137: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformResolutionPresetBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil + : [[FCPPlatformResolutionPresetBox alloc] + initWithValue:[enumAsNumber integerValue]]; } - case 138: + case 138: return [FCPPlatformCameraDescription fromList:[self readValue]]; - case 139: + case 139: return [FCPPlatformCameraState fromList:[self readValue]]; - case 140: + case 140: return [FCPPlatformMediaSettings fromList:[self readValue]]; - case 141: + case 141: return [FCPPlatformPoint fromList:[self readValue]]; - case 142: + case 142: return [FCPPlatformSize fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -446,7 +469,8 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FCPMessagesPigeonCodecReaderWriter *readerWriter = [[FCPMessagesPigeonCodecReaderWriter alloc] init]; + FCPMessagesPigeonCodecReaderWriter *readerWriter = + [[FCPMessagesPigeonCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; @@ -455,19 +479,29 @@ void SetUpFCPCameraApi(id binaryMessenger, NSObject binaryMessenger, NSObject *api, NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 ? [NSString stringWithFormat: @".%@", messageChannelSuffix] : @""; +void SetUpFCPCameraApiWithSuffix(id binaryMessenger, + NSObject *api, NSString *messageChannelSuffix) { + messageChannelSuffix = messageChannelSuffix.length > 0 + ? [NSString stringWithFormat:@".%@", messageChannelSuffix] + : @""; /// Returns the list of available cameras. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.getAvailableCameras", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(availableCamerasWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(availableCamerasWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(availableCamerasWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(availableCamerasWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api availableCamerasWithCompletion:^(NSArray *_Nullable output, FlutterError *_Nullable error) { + [api availableCamerasWithCompletion:^( + NSArray *_Nullable output, + FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -477,20 +511,27 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Create a new camera with the given settings, and returns its ID. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.create", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.create", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createCameraWithName:settings:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(createCameraWithName:settings:completion:)", api); + NSCAssert([api respondsToSelector:@selector(createCameraWithName:settings:completion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(createCameraWithName:settings:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_cameraName = GetNullableObjectAtIndex(args, 0); FCPPlatformMediaSettings *arg_settings = GetNullableObjectAtIndex(args, 1); - [api createCameraWithName:arg_cameraName settings:arg_settings completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api createCameraWithName:arg_cameraName + settings:arg_settings + completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -498,21 +539,30 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Initializes the camera with the given ID. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + [NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(initializeCamera:withImageFormat:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(initializeCamera:withImageFormat:completion:)", api); + NSCAssert([api respondsToSelector:@selector(initializeCamera:withImageFormat:completion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(initializeCamera:withImageFormat:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSInteger arg_cameraId = [GetNullableObjectAtIndex(args, 0) integerValue]; - FCPPlatformImageFormatGroupBox *boxedFCPPlatformImageFormatGroup = GetNullableObjectAtIndex(args, 1); + FCPPlatformImageFormatGroupBox *boxedFCPPlatformImageFormatGroup = + GetNullableObjectAtIndex(args, 1); FCPPlatformImageFormatGroup arg_imageFormat = boxedFCPPlatformImageFormatGroup.value; - [api initializeCamera:arg_cameraId withImageFormat:arg_imageFormat completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api initializeCamera:arg_cameraId + withImageFormat:arg_imageFormat + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -520,13 +570,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Begins streaming frames from the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.startImageStream", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(startImageStreamWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(startImageStreamWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(startImageStreamWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(startImageStreamWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api startImageStreamWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -538,13 +593,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Stops streaming frames from the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(stopImageStreamWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(stopImageStreamWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(stopImageStreamWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(stopImageStreamWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api stopImageStreamWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -559,13 +620,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// /// This is used to throttle sending frames across the channel. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.receivedImageStreamData", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(receivedImageStreamDataWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(receivedImageStreamDataWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(receivedImageStreamDataWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(receivedImageStreamDataWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api receivedImageStreamDataWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -578,19 +644,24 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// Indicates that the given camera is no longer being used on the Dart side, /// and any associated resources can be cleaned up. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(disposeCamera:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(disposeCamera:completion:)", api); + NSCAssert([api respondsToSelector:@selector(disposeCamera:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(disposeCamera:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSInteger arg_cameraId = [GetNullableObjectAtIndex(args, 0) integerValue]; - [api disposeCamera:arg_cameraId completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api disposeCamera:arg_cameraId + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -598,20 +669,27 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Locks the camera capture to the current device orientation. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.lockCaptureOrientation", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(lockCaptureOrientation:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(lockCaptureOrientation:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector(lockCaptureOrientation:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(lockCaptureOrientation:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FCPPlatformDeviceOrientationBox *boxedFCPPlatformDeviceOrientation = GetNullableObjectAtIndex(args, 0); + FCPPlatformDeviceOrientationBox *boxedFCPPlatformDeviceOrientation = + GetNullableObjectAtIndex(args, 0); FCPPlatformDeviceOrientation arg_orientation = boxedFCPPlatformDeviceOrientation.value; - [api lockCaptureOrientation:arg_orientation completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api lockCaptureOrientation:arg_orientation + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -620,13 +698,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.unlockCaptureOrientation", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(unlockCaptureOrientationWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(unlockCaptureOrientationWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(unlockCaptureOrientationWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(unlockCaptureOrientationWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api unlockCaptureOrientationWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -639,17 +722,23 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// Takes a picture with the current settings, and returns the path to the /// resulting file. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + [NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(takePictureWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(takePictureWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(takePictureWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(takePictureWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api takePictureWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api + takePictureWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -657,13 +746,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Does any preprocessing necessary before beginning to record video. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.prepareForVideoRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(prepareForVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(prepareForVideoRecordingWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(prepareForVideoRecordingWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(prepareForVideoRecordingWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api prepareForVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -676,19 +770,25 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// Begins recording video, optionally enabling streaming to Dart at the same /// time. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.startVideoRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(startVideoRecordingWithStreaming:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(startVideoRecordingWithStreaming:completion:)", api); + NSCAssert([api respondsToSelector:@selector(startVideoRecordingWithStreaming:completion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(startVideoRecordingWithStreaming:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; BOOL arg_enableStream = [GetNullableObjectAtIndex(args, 0) boolValue]; - [api startVideoRecordingWithStreaming:arg_enableStream completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api startVideoRecordingWithStreaming:arg_enableStream + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -696,15 +796,21 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Stops recording video, and results the path to the resulting file. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.stopVideoRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(stopVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(stopVideoRecordingWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(stopVideoRecordingWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(stopVideoRecordingWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api stopVideoRecordingWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { + [api stopVideoRecordingWithCompletion:^(NSString *_Nullable output, + FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -714,13 +820,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Pauses video recording. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.pauseVideoRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(pauseVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(pauseVideoRecordingWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(pauseVideoRecordingWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(pauseVideoRecordingWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api pauseVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -732,13 +843,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Resumes a previously paused video recording. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.resumeVideoRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(resumeVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(resumeVideoRecordingWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(resumeVideoRecordingWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(resumeVideoRecordingWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api resumeVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -750,20 +866,26 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Switches the camera to the given flash mode. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFlashMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFlashMode:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setFlashMode:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setFlashMode:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformFlashModeBox *boxedFCPPlatformFlashMode = GetNullableObjectAtIndex(args, 0); FCPPlatformFlashMode arg_mode = boxedFCPPlatformFlashMode.value; - [api setFlashMode:arg_mode completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFlashMode:arg_mode + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -771,20 +893,27 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Switches the camera to the given exposure mode. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposureMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureMode:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setExposureMode:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureMode:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FCPPlatformExposureModeBox *boxedFCPPlatformExposureMode = GetNullableObjectAtIndex(args, 0); + FCPPlatformExposureModeBox *boxedFCPPlatformExposureMode = + GetNullableObjectAtIndex(args, 0); FCPPlatformExposureMode arg_mode = boxedFCPPlatformExposureMode.value; - [api setExposureMode:arg_mode completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposureMode:arg_mode + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -794,19 +923,24 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// /// A null value resets to the default exposure point. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.setExposurePoint", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposurePoint:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposurePoint:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setExposurePoint:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setExposurePoint:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformPoint *arg_point = GetNullableObjectAtIndex(args, 0); - [api setExposurePoint:arg_point completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposurePoint:arg_point + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -814,13 +948,17 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Returns the minimum exposure offset supported by the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.getMinExposureOffset", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMinimumExposureOffset:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumExposureOffset:)", api); + NSCAssert([api respondsToSelector:@selector(getMinimumExposureOffset:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumExposureOffset:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMinimumExposureOffset:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -832,13 +970,17 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Returns the maximum exposure offset supported by the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.getMaxExposureOffset", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMaximumExposureOffset:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumExposureOffset:)", api); + NSCAssert([api respondsToSelector:@selector(getMaximumExposureOffset:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumExposureOffset:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMaximumExposureOffset:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -850,19 +992,25 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Sets the exposure offset manually to the given value. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.setExposureOffset", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposureOffset:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureOffset:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector(setExposureOffset:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureOffset:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; double arg_offset = [GetNullableObjectAtIndex(args, 0) doubleValue]; - [api setExposureOffset:arg_offset completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposureOffset:arg_offset + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -870,20 +1018,26 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Switches the camera to the given focus mode. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFocusMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusMode:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setFocusMode:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusMode:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformFocusModeBox *boxedFCPPlatformFocusMode = GetNullableObjectAtIndex(args, 0); FCPPlatformFocusMode arg_mode = boxedFCPPlatformFocusMode.value; - [api setFocusMode:arg_mode completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFocusMode:arg_mode + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -893,19 +1047,25 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// /// A null value resets to the default focus point. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFocusPoint:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusPoint:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setFocusPoint:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusPoint:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformPoint *arg_point = GetNullableObjectAtIndex(args, 0); - [api setFocusPoint:arg_point completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFocusPoint:arg_point + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -913,13 +1073,17 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Returns the minimum zoom level supported by the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMinimumZoomLevel:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumZoomLevel:)", api); + NSCAssert([api respondsToSelector:@selector(getMinimumZoomLevel:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumZoomLevel:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMinimumZoomLevel:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -931,13 +1095,17 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Returns the maximum zoom level supported by the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMaximumZoomLevel:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumZoomLevel:)", api); + NSCAssert([api respondsToSelector:@selector(getMaximumZoomLevel:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumZoomLevel:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMaximumZoomLevel:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -949,19 +1117,25 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Sets the zoom factor. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setZoomLevel:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setZoomLevel:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setZoomLevel:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setZoomLevel:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; double arg_zoom = [GetNullableObjectAtIndex(args, 0) doubleValue]; - [api setZoomLevel:arg_zoom completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setZoomLevel:arg_zoom + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -969,13 +1143,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Pauses streaming of preview frames. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(pausePreviewWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(pausePreviewWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(pausePreviewWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(pausePreviewWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api pausePreviewWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -987,13 +1166,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Resumes a previously paused preview stream. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(resumePreviewWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(resumePreviewWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(resumePreviewWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(resumePreviewWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api resumePreviewWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -1007,19 +1191,26 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// /// This should only be called while video recording is active. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.updateDescriptionWhileRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(updateDescriptionWhileRecordingCameraName:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(updateDescriptionWhileRecordingCameraName:completion:)", api); + NSCAssert([api respondsToSelector:@selector(updateDescriptionWhileRecordingCameraName: + completion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(updateDescriptionWhileRecordingCameraName:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_cameraName = GetNullableObjectAtIndex(args, 0); - [api updateDescriptionWhileRecordingCameraName:arg_cameraName completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api updateDescriptionWhileRecordingCameraName:arg_cameraName + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1027,20 +1218,27 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Sets the file format used for taking pictures. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.setImageFileFormat", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setImageFileFormat:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setImageFileFormat:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector(setImageFileFormat:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setImageFileFormat:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FCPPlatformImageFileFormatBox *boxedFCPPlatformImageFileFormat = GetNullableObjectAtIndex(args, 0); + FCPPlatformImageFileFormatBox *boxedFCPPlatformImageFileFormat = + GetNullableObjectAtIndex(args, 0); FCPPlatformImageFileFormat arg_format = boxedFCPPlatformImageFileFormat.value; - [api setImageFileFormat:arg_format completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setImageFileFormat:arg_format + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1057,32 +1255,42 @@ @implementation FCPCameraGlobalEventApi - (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""]; } -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger messageChannelSuffix:(nullable NSString*)messageChannelSuffix{ +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger + messageChannelSuffix:(nullable NSString *)messageChannelSuffix { self = [self init]; if (self) { _binaryMessenger = binaryMessenger; - _messageChannelSuffix = [messageChannelSuffix length] == 0 ? @"" : [NSString stringWithFormat: @".%@", messageChannelSuffix]; + _messageChannelSuffix = [messageChannelSuffix length] == 0 + ? @"" + : [NSString stringWithFormat:@".%@", messageChannelSuffix]; } return self; } -- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)arg_orientation completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged", _messageChannelSuffix]; +- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)arg_orientation + completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged", + _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPGetMessagesCodec()]; - [channel sendMessage:@[[[FCPPlatformDeviceOrientationBox alloc] initWithValue:arg_orientation]] reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPGetMessagesCodec()]; + [channel sendMessage:@[ [[FCPPlatformDeviceOrientationBox alloc] initWithValue:arg_orientation] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } @end @@ -1096,51 +1304,64 @@ @implementation FCPCameraEventApi - (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""]; } -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger messageChannelSuffix:(nullable NSString*)messageChannelSuffix{ +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger + messageChannelSuffix:(nullable NSString *)messageChannelSuffix { self = [self init]; if (self) { _binaryMessenger = binaryMessenger; - _messageChannelSuffix = [messageChannelSuffix length] == 0 ? @"" : [NSString stringWithFormat: @".%@", messageChannelSuffix]; + _messageChannelSuffix = [messageChannelSuffix length] == 0 + ? @"" + : [NSString stringWithFormat:@".%@", messageChannelSuffix]; } return self; } -- (void)initializedWithState:(FCPPlatformCameraState *)arg_initialState completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized", _messageChannelSuffix]; +- (void)initializedWithState:(FCPPlatformCameraState *)arg_initialState + completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized", + _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPGetMessagesCodec()]; - [channel sendMessage:@[arg_initialState ?: [NSNull null]] reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPGetMessagesCodec()]; + [channel sendMessage:@[ arg_initialState ?: [NSNull null] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } -- (void)reportError:(NSString *)arg_message completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error", _messageChannelSuffix]; +- (void)reportError:(NSString *)arg_message + completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString + stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error", + _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPGetMessagesCodec()]; - [channel sendMessage:@[arg_message ?: [NSNull null]] reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPGetMessagesCodec()]; + [channel sendMessage:@[ arg_message ?: [NSNull null] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } @end - diff --git a/packages/camera/camera_avfoundation/lib/src/messages.g.dart b/packages/camera/camera_avfoundation/lib/src/messages.g.dart index 8a883a2adda9..d36428c17ef5 100644 --- a/packages/camera/camera_avfoundation/lib/src/messages.g.dart +++ b/packages/camera/camera_avfoundation/lib/src/messages.g.dart @@ -18,7 +18,8 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse( + {Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -31,8 +32,10 @@ List wrapResponse({Object? result, PlatformException? error, bool empty enum PlatformCameraLensDirection { /// Front facing camera (a user looking at the screen is seen by the camera). front, + /// Back facing camera (a user looking at the screen is not seen by the camera). back, + /// External camera which may not be mounted to the device. external, } @@ -40,10 +43,13 @@ enum PlatformCameraLensDirection { enum PlatformCameraLensType { /// A built-in wide-angle camera device type. wide, + /// A built-in camera device type with a shorter focal length than a wide-angle camera. telephoto, + /// A built-in camera device type with a longer focal length than a wide-angle camera. ultraWide, + /// Unknown camera device type. unknown, } @@ -265,7 +271,6 @@ class PlatformSize { } } - class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -273,46 +278,46 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is PlatformCameraLensDirection) { + } else if (value is PlatformCameraLensDirection) { buffer.putUint8(129); writeValue(buffer, value.index); - } else if (value is PlatformCameraLensType) { + } else if (value is PlatformCameraLensType) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is PlatformDeviceOrientation) { + } else if (value is PlatformDeviceOrientation) { buffer.putUint8(131); writeValue(buffer, value.index); - } else if (value is PlatformExposureMode) { + } else if (value is PlatformExposureMode) { buffer.putUint8(132); writeValue(buffer, value.index); - } else if (value is PlatformFlashMode) { + } else if (value is PlatformFlashMode) { buffer.putUint8(133); writeValue(buffer, value.index); - } else if (value is PlatformFocusMode) { + } else if (value is PlatformFocusMode) { buffer.putUint8(134); writeValue(buffer, value.index); - } else if (value is PlatformImageFileFormat) { + } else if (value is PlatformImageFileFormat) { buffer.putUint8(135); writeValue(buffer, value.index); - } else if (value is PlatformImageFormatGroup) { + } else if (value is PlatformImageFormatGroup) { buffer.putUint8(136); writeValue(buffer, value.index); - } else if (value is PlatformResolutionPreset) { + } else if (value is PlatformResolutionPreset) { buffer.putUint8(137); writeValue(buffer, value.index); - } else if (value is PlatformCameraDescription) { + } else if (value is PlatformCameraDescription) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value is PlatformCameraState) { + } else if (value is PlatformCameraState) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is PlatformMediaSettings) { + } else if (value is PlatformMediaSettings) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is PlatformPoint) { + } else if (value is PlatformPoint) { buffer.putUint8(141); writeValue(buffer, value.encode()); - } else if (value is PlatformSize) { + } else if (value is PlatformSize) { buffer.putUint8(142); writeValue(buffer, value.encode()); } else { @@ -323,42 +328,42 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: + case 129: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformCameraLensDirection.values[value]; - case 130: + case 130: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformCameraLensType.values[value]; - case 131: + case 131: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformDeviceOrientation.values[value]; - case 132: + case 132: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformExposureMode.values[value]; - case 133: + case 133: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformFlashMode.values[value]; - case 134: + case 134: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformFocusMode.values[value]; - case 135: + case 135: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformImageFileFormat.values[value]; - case 136: + case 136: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformImageFormatGroup.values[value]; - case 137: + case 137: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformResolutionPreset.values[value]; - case 138: + case 138: return PlatformCameraDescription.decode(readValue(buffer)!); - case 139: + case 139: return PlatformCameraState.decode(readValue(buffer)!); - case 140: + case 140: return PlatformMediaSettings.decode(readValue(buffer)!); - case 141: + case 141: return PlatformPoint.decode(readValue(buffer)!); - case 142: + case 142: return PlatformSize.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -370,9 +375,11 @@ class CameraApi { /// Constructor for [CameraApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - CameraApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + CameraApi( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -381,8 +388,10 @@ class CameraApi { /// Returns the list of available cameras. Future> getAvailableCameras() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -403,20 +412,23 @@ class CameraApi { message: 'Host platform returned null value for non-null return value.', ); } else { - return (pigeonVar_replyList[0] as List?)!.cast(); + return (pigeonVar_replyList[0] as List?)! + .cast(); } } /// Create a new camera with the given settings, and returns its ID. Future create(String cameraName, PlatformMediaSettings settings) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.create$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.create$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([cameraName, settings]) as List?; + final List? pigeonVar_replyList = await pigeonVar_channel + .send([cameraName, settings]) as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -436,15 +448,18 @@ class CameraApi { } /// Initializes the camera with the given ID. - Future initialize(int cameraId, PlatformImageFormatGroup imageFormat) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + Future initialize( + int cameraId, PlatformImageFormatGroup imageFormat) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([cameraId, imageFormat]) as List?; + final List? pigeonVar_replyList = await pigeonVar_channel + .send([cameraId, imageFormat]) as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -460,8 +475,10 @@ class CameraApi { /// Begins streaming frames from the camera. Future startImageStream() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -483,8 +500,10 @@ class CameraApi { /// Stops streaming frames from the camera. Future stopImageStream() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -509,8 +528,10 @@ class CameraApi { /// /// This is used to throttle sending frames across the channel. Future receivedImageStreamData() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -533,8 +554,10 @@ class CameraApi { /// Indicates that the given camera is no longer being used on the Dart side, /// and any associated resources can be cleaned up. Future dispose(int cameraId) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -555,9 +578,12 @@ class CameraApi { } /// Locks the camera capture to the current device orientation. - Future lockCaptureOrientation(PlatformDeviceOrientation orientation) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + Future lockCaptureOrientation( + PlatformDeviceOrientation orientation) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -580,8 +606,10 @@ class CameraApi { /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. Future unlockCaptureOrientation() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -604,8 +632,10 @@ class CameraApi { /// Takes a picture with the current settings, and returns the path to the /// resulting file. Future takePicture() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -632,8 +662,10 @@ class CameraApi { /// Does any preprocessing necessary before beginning to record video. Future prepareForVideoRecording() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -656,8 +688,10 @@ class CameraApi { /// Begins recording video, optionally enabling streaming to Dart at the same /// time. Future startVideoRecording(bool enableStream) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -679,8 +713,10 @@ class CameraApi { /// Stops recording video, and results the path to the resulting file. Future stopVideoRecording() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -707,8 +743,10 @@ class CameraApi { /// Pauses video recording. Future pauseVideoRecording() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -730,8 +768,10 @@ class CameraApi { /// Resumes a previously paused video recording. Future resumeVideoRecording() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -753,8 +793,10 @@ class CameraApi { /// Switches the camera to the given flash mode. Future setFlashMode(PlatformFlashMode mode) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -776,8 +818,10 @@ class CameraApi { /// Switches the camera to the given exposure mode. Future setExposureMode(PlatformExposureMode mode) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -801,8 +845,10 @@ class CameraApi { /// /// A null value resets to the default exposure point. Future setExposurePoint(PlatformPoint? point) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -824,8 +870,10 @@ class CameraApi { /// Returns the minimum exposure offset supported by the camera. Future getMinExposureOffset() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -852,8 +900,10 @@ class CameraApi { /// Returns the maximum exposure offset supported by the camera. Future getMaxExposureOffset() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -880,8 +930,10 @@ class CameraApi { /// Sets the exposure offset manually to the given value. Future setExposureOffset(double offset) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -903,8 +955,10 @@ class CameraApi { /// Switches the camera to the given focus mode. Future setFocusMode(PlatformFocusMode mode) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -928,8 +982,10 @@ class CameraApi { /// /// A null value resets to the default focus point. Future setFocusPoint(PlatformPoint? point) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -951,8 +1007,10 @@ class CameraApi { /// Returns the minimum zoom level supported by the camera. Future getMinZoomLevel() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -979,8 +1037,10 @@ class CameraApi { /// Returns the maximum zoom level supported by the camera. Future getMaxZoomLevel() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1007,8 +1067,10 @@ class CameraApi { /// Sets the zoom factor. Future setZoomLevel(double zoom) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1030,8 +1092,10 @@ class CameraApi { /// Pauses streaming of preview frames. Future pausePreview() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1053,8 +1117,10 @@ class CameraApi { /// Resumes a previously paused preview stream. Future resumePreview() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1078,8 +1144,10 @@ class CameraApi { /// /// This should only be called while video recording is active. Future updateDescriptionWhileRecording(String cameraName) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1101,8 +1169,10 @@ class CameraApi { /// Sets the file format used for taking pictures. Future setImageFileFormat(PlatformImageFileFormat format) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1130,20 +1200,29 @@ abstract class CameraGlobalEventApi { /// Called when the device's physical orientation changes. void deviceOrientationChanged(PlatformDeviceOrientation orientation); - static void setUp(CameraGlobalEventApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { - messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp( + CameraGlobalEventApi? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged$messageChannelSuffix', pigeonChannelCodec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null.'); final List args = (message as List?)!; - final PlatformDeviceOrientation? arg_orientation = (args[0] as PlatformDeviceOrientation?); + final PlatformDeviceOrientation? arg_orientation = + (args[0] as PlatformDeviceOrientation?); assert(arg_orientation != null, 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null, expected non-null PlatformDeviceOrientation.'); try { @@ -1151,8 +1230,9 @@ abstract class CameraGlobalEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); } }); } @@ -1203,20 +1283,29 @@ abstract class CameraEventApi { /// handling a specific HostApi call, such as during streaming. void error(String message); - static void setUp(CameraEventApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { - messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp( + CameraEventApi? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized$messageChannelSuffix', pigeonChannelCodec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null.'); final List args = (message as List?)!; - final PlatformCameraState? arg_initialState = (args[0] as PlatformCameraState?); + final PlatformCameraState? arg_initialState = + (args[0] as PlatformCameraState?); assert(arg_initialState != null, 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null, expected non-null PlatformCameraState.'); try { @@ -1224,22 +1313,26 @@ abstract class CameraEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); } }); } } { - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error$messageChannelSuffix', pigeonChannelCodec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error was null.'); final List args = (message as List?)!; final String? arg_message = (args[0] as String?); assert(arg_message != null, @@ -1249,8 +1342,9 @@ abstract class CameraEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); } }); } diff --git a/packages/camera/camera_platform_interface/CHANGELOG.md b/packages/camera/camera_platform_interface/CHANGELOG.md index 4ed93c1c1052..9dbb99892988 100644 --- a/packages/camera/camera_platform_interface/CHANGELOG.md +++ b/packages/camera/camera_platform_interface/CHANGELOG.md @@ -3,9 +3,6 @@ * Updates minimum supported SDK version to Flutter 3.19/Dart 3.3. * Introduces a new CameraLensType enum to provide lens type information about the camera (e.g.: ultra-wide, telephoto, ...) - - - ## 2.8.0 * Deprecates `maxVideoDuration`/`maxDuration`, as it was never implemented on From d90b0cfafc98204180d06aa5b003fc2a2596637b Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Tue, 1 Apr 2025 15:30:21 -0400 Subject: [PATCH 13/25] Fix formatting for CI --- .../include/camera_avfoundation/QueueUtils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h index e230a53508fa..a7e22da716d0 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h @@ -7,7 +7,7 @@ NS_ASSUME_NONNULL_BEGIN /// Queue-specific context data to be associated with the capture session queue. -extern const char *FLTCaptureSessionQueueSpecific; +extern const char* FLTCaptureSessionQueueSpecific; /// Ensures the given block to be run on the main queue. /// If caller site is already on the main queue, the block will be run From 85c0dc2075bb59679dec4197daf1d559e8c1b1bb Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Tue, 1 Apr 2025 15:30:21 -0400 Subject: [PATCH 14/25] Refactor camera lens direction and type handling in CameraPlugin --- .../camera_avfoundation/CameraPlugin.m | 65 +++++++++---------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m index 9e539d4880ec..5f4a16e7a857 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m @@ -21,6 +21,37 @@ message:error.localizedDescription details:error.domain]; } +static void FCPGetLensDirectionAndType(AVCaptureDevice *device, + FCPPlatformCameraLensDirection *lensDirection, + FCPPlatformCameraLensType *lensType) { + switch (device.position) { + case AVCaptureDevicePositionBack: + *lensDirection = FCPPlatformCameraLensDirectionBack; + break; + case AVCaptureDevicePositionFront: + *lensDirection = FCPPlatformCameraLensDirectionFront; + break; + case AVCaptureDevicePositionUnspecified: + *lensDirection = FCPPlatformCameraLensDirectionExternal; + break; + } + + if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInWideAngleCamera]) { + *lensType = FCPPlatformCameraLensTypeWide; + } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInTelephotoCamera]) { + *lensType = FCPPlatformCameraLensTypeTelephoto; + } else if (@available(iOS 13.0, *)) { + if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInUltraWideCamera]) { + *lensType = FCPPlatformCameraLensTypeUltraWide; + } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInDualWideCamera]) { + *lensType = FCPPlatformCameraLensTypeWide; + } else { + *lensType = FCPPlatformCameraLensTypeUnknown; + } + } else { + *lensType = FCPPlatformCameraLensTypeUnknown; + } +} @interface CameraPlugin () @property(readonly, nonatomic) NSObject *registry; @@ -152,7 +183,7 @@ - (void)availableCamerasWithCompletion: for (AVCaptureDevice *device in devices) { FCPPlatformCameraLensDirection lensFacing; FCPPlatformCameraLensType lensType; - getLensDirectionAndType(device, &lensFacing, &lensType); + FCPGetLensDirectionAndType(device, &lensFacing, &lensType); [reply addObject:[FCPPlatformCameraDescription makeWithName:device.uniqueID lensDirection:lensFacing @@ -162,38 +193,6 @@ - (void)availableCamerasWithCompletion: }); } -static void getLensDirectionAndType(AVCaptureDevice *device, - FCPPlatformCameraLensDirection *lensDirection, - FCPPlatformCameraLensType *lensType) { - switch (device.position) { - case AVCaptureDevicePositionBack: - *lensDirection = FCPPlatformCameraLensDirectionBack; - break; - case AVCaptureDevicePositionFront: - *lensDirection = FCPPlatformCameraLensDirectionFront; - break; - case AVCaptureDevicePositionUnspecified: - *lensDirection = FCPPlatformCameraLensDirectionExternal; - break; - } - - if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInWideAngleCamera]) { - *lensType = FCPPlatformCameraLensTypeWide; - } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInTelephotoCamera]) { - *lensType = FCPPlatformCameraLensTypeTelephoto; - } else if (@available(iOS 13.0, *)) { - if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInUltraWideCamera]) { - *lensType = FCPPlatformCameraLensTypeUltraWide; - } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInDualWideCamera]) { - *lensType = FCPPlatformCameraLensTypeWide; - } else { - *lensType = FCPPlatformCameraLensTypeUnknown; - } - } else { - *lensType = FCPPlatformCameraLensTypeUnknown; - } -} - - (void)createCameraWithName:(nonnull NSString *)cameraName settings:(nonnull FCPPlatformMediaSettings *)settings completion: From a6c9bb6e2b32d5279c63de738f893d2cacacf5c7 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Tue, 1 Apr 2025 15:30:21 -0400 Subject: [PATCH 15/25] Fix documentation for camera lens type descriptions in messages.dart and camera_description.dart --- .../include/camera_avfoundation/messages.g.h | 119 ++- .../Sources/camera_avfoundation/messages.g.m | 813 +++++++----------- .../lib/src/messages.g.dart | 338 +++----- .../camera_avfoundation/pigeons/messages.dart | 4 +- .../lib/src/types/camera_description.dart | 4 +- 5 files changed, 472 insertions(+), 806 deletions(-) diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h index 3f79b5e5f405..f2e248fcf371 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h @@ -31,9 +31,9 @@ typedef NS_ENUM(NSUInteger, FCPPlatformCameraLensDirection) { typedef NS_ENUM(NSUInteger, FCPPlatformCameraLensType) { /// A built-in wide-angle camera device type. FCPPlatformCameraLensTypeWide = 0, - /// A built-in camera device type with a shorter focal length than a wide-angle camera. - FCPPlatformCameraLensTypeTelephoto = 1, /// A built-in camera device type with a longer focal length than a wide-angle camera. + FCPPlatformCameraLensTypeTelephoto = 1, + /// A built-in camera device type with a shorter focal length than a wide-angle camera. FCPPlatformCameraLensTypeUltraWide = 2, /// Unknown camera device type. FCPPlatformCameraLensTypeUnknown = 3, @@ -141,10 +141,10 @@ typedef NS_ENUM(NSUInteger, FCPPlatformResolutionPreset) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithName:(NSString *)name - lensDirection:(FCPPlatformCameraLensDirection)lensDirection - lensType:(FCPPlatformCameraLensType)lensType; + lensDirection:(FCPPlatformCameraLensDirection)lensDirection + lensType:(FCPPlatformCameraLensType)lensType; /// The name of the camera device. -@property(nonatomic, copy) NSString *name; +@property(nonatomic, copy) NSString * name; /// The direction the camera is facing. @property(nonatomic, assign) FCPPlatformCameraLensDirection lensDirection; /// The type of the camera lens. @@ -155,51 +155,53 @@ typedef NS_ENUM(NSUInteger, FCPPlatformResolutionPreset) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithPreviewSize:(FCPPlatformSize *)previewSize - exposureMode:(FCPPlatformExposureMode)exposureMode - focusMode:(FCPPlatformFocusMode)focusMode - exposurePointSupported:(BOOL)exposurePointSupported - focusPointSupported:(BOOL)focusPointSupported; + exposureMode:(FCPPlatformExposureMode)exposureMode + focusMode:(FCPPlatformFocusMode)focusMode + exposurePointSupported:(BOOL )exposurePointSupported + focusPointSupported:(BOOL )focusPointSupported; /// The size of the preview, in pixels. -@property(nonatomic, strong) FCPPlatformSize *previewSize; +@property(nonatomic, strong) FCPPlatformSize * previewSize; /// The default exposure mode @property(nonatomic, assign) FCPPlatformExposureMode exposureMode; /// The default focus mode @property(nonatomic, assign) FCPPlatformFocusMode focusMode; /// Whether setting exposure points is supported. -@property(nonatomic, assign) BOOL exposurePointSupported; +@property(nonatomic, assign) BOOL exposurePointSupported; /// Whether setting focus points is supported. -@property(nonatomic, assign) BOOL focusPointSupported; +@property(nonatomic, assign) BOOL focusPointSupported; @end @interface FCPPlatformMediaSettings : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolutionPreset - framesPerSecond:(nullable NSNumber *)framesPerSecond - videoBitrate:(nullable NSNumber *)videoBitrate - audioBitrate:(nullable NSNumber *)audioBitrate - enableAudio:(BOOL)enableAudio; + framesPerSecond:(nullable NSNumber *)framesPerSecond + videoBitrate:(nullable NSNumber *)videoBitrate + audioBitrate:(nullable NSNumber *)audioBitrate + enableAudio:(BOOL )enableAudio; @property(nonatomic, assign) FCPPlatformResolutionPreset resolutionPreset; -@property(nonatomic, strong, nullable) NSNumber *framesPerSecond; -@property(nonatomic, strong, nullable) NSNumber *videoBitrate; -@property(nonatomic, strong, nullable) NSNumber *audioBitrate; -@property(nonatomic, assign) BOOL enableAudio; +@property(nonatomic, strong, nullable) NSNumber * framesPerSecond; +@property(nonatomic, strong, nullable) NSNumber * videoBitrate; +@property(nonatomic, strong, nullable) NSNumber * audioBitrate; +@property(nonatomic, assign) BOOL enableAudio; @end @interface FCPPlatformPoint : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithX:(double)x y:(double)y; -@property(nonatomic, assign) double x; -@property(nonatomic, assign) double y; ++ (instancetype)makeWithX:(double )x + y:(double )y; +@property(nonatomic, assign) double x; +@property(nonatomic, assign) double y; @end @interface FCPPlatformSize : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithWidth:(double)width height:(double)height; -@property(nonatomic, assign) double width; -@property(nonatomic, assign) double height; ++ (instancetype)makeWithWidth:(double )width + height:(double )height; +@property(nonatomic, assign) double width; +@property(nonatomic, assign) double height; @end /// The codec used by all APIs. @@ -207,16 +209,11 @@ NSObject *FCPGetMessagesCodec(void); @protocol FCPCameraApi /// Returns the list of available cameras. -- (void)availableCamerasWithCompletion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; +- (void)availableCamerasWithCompletion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion; /// Create a new camera with the given settings, and returns its ID. -- (void)createCameraWithName:(NSString *)cameraName - settings:(FCPPlatformMediaSettings *)settings - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; +- (void)createCameraWithName:(NSString *)cameraName settings:(FCPPlatformMediaSettings *)settings completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Initializes the camera with the given ID. -- (void)initializeCamera:(NSInteger)cameraId - withImageFormat:(FCPPlatformImageFormatGroup)imageFormat - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)initializeCamera:(NSInteger)cameraId withImageFormat:(FCPPlatformImageFormatGroup)imageFormat completion:(void (^)(FlutterError *_Nullable))completion; /// Begins streaming frames from the camera. - (void)startImageStreamWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Stops streaming frames from the camera. @@ -230,39 +227,32 @@ NSObject *FCPGetMessagesCodec(void); /// and any associated resources can be cleaned up. - (void)disposeCamera:(NSInteger)cameraId completion:(void (^)(FlutterError *_Nullable))completion; /// Locks the camera capture to the current device orientation. -- (void)lockCaptureOrientation:(FCPPlatformDeviceOrientation)orientation - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)lockCaptureOrientation:(FCPPlatformDeviceOrientation)orientation completion:(void (^)(FlutterError *_Nullable))completion; /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. - (void)unlockCaptureOrientationWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Takes a picture with the current settings, and returns the path to the /// resulting file. -- (void)takePictureWithCompletion:(void (^)(NSString *_Nullable, - FlutterError *_Nullable))completion; +- (void)takePictureWithCompletion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; /// Does any preprocessing necessary before beginning to record video. - (void)prepareForVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Begins recording video, optionally enabling streaming to Dart at the same /// time. -- (void)startVideoRecordingWithStreaming:(BOOL)enableStream - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)startVideoRecordingWithStreaming:(BOOL)enableStream completion:(void (^)(FlutterError *_Nullable))completion; /// Stops recording video, and results the path to the resulting file. -- (void)stopVideoRecordingWithCompletion:(void (^)(NSString *_Nullable, - FlutterError *_Nullable))completion; +- (void)stopVideoRecordingWithCompletion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; /// Pauses video recording. - (void)pauseVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Resumes a previously paused video recording. - (void)resumeVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given flash mode. -- (void)setFlashMode:(FCPPlatformFlashMode)mode - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFlashMode:(FCPPlatformFlashMode)mode completion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given exposure mode. -- (void)setExposureMode:(FCPPlatformExposureMode)mode - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setExposureMode:(FCPPlatformExposureMode)mode completion:(void (^)(FlutterError *_Nullable))completion; /// Anchors auto-exposure to the given point in (0,1) coordinate space. /// /// A null value resets to the default exposure point. -- (void)setExposurePoint:(nullable FCPPlatformPoint *)point - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setExposurePoint:(nullable FCPPlatformPoint *)point completion:(void (^)(FlutterError *_Nullable))completion; /// Returns the minimum exposure offset supported by the camera. - (void)getMinimumExposureOffset:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Returns the maximum exposure offset supported by the camera. @@ -270,13 +260,11 @@ NSObject *FCPGetMessagesCodec(void); /// Sets the exposure offset manually to the given value. - (void)setExposureOffset:(double)offset completion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given focus mode. -- (void)setFocusMode:(FCPPlatformFocusMode)mode - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFocusMode:(FCPPlatformFocusMode)mode completion:(void (^)(FlutterError *_Nullable))completion; /// Anchors auto-focus to the given point in (0,1) coordinate space. /// /// A null value resets to the default focus point. -- (void)setFocusPoint:(nullable FCPPlatformPoint *)point - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFocusPoint:(nullable FCPPlatformPoint *)point completion:(void (^)(FlutterError *_Nullable))completion; /// Returns the minimum zoom level supported by the camera. - (void)getMinimumZoomLevel:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Returns the maximum zoom level supported by the camera. @@ -290,40 +278,33 @@ NSObject *FCPGetMessagesCodec(void); /// Changes the camera used while recording video. /// /// This should only be called while video recording is active. -- (void)updateDescriptionWhileRecordingCameraName:(NSString *)cameraName - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)updateDescriptionWhileRecordingCameraName:(NSString *)cameraName completion:(void (^)(FlutterError *_Nullable))completion; /// Sets the file format used for taking pictures. -- (void)setImageFileFormat:(FCPPlatformImageFileFormat)format - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setImageFileFormat:(FCPPlatformImageFileFormat)format completion:(void (^)(FlutterError *_Nullable))completion; @end -extern void SetUpFCPCameraApi(id binaryMessenger, - NSObject *_Nullable api); +extern void SetUpFCPCameraApi(id binaryMessenger, NSObject *_Nullable api); + +extern void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSObject *_Nullable api, NSString *messageChannelSuffix); -extern void SetUpFCPCameraApiWithSuffix(id binaryMessenger, - NSObject *_Nullable api, - NSString *messageChannelSuffix); /// Handler for native callbacks that are not tied to a specific camera ID. @interface FCPCameraGlobalEventApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger messageChannelSuffix:(nullable NSString *)messageChannelSuffix; /// Called when the device's physical orientation changes. -- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)orientation - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)orientation completion:(void (^)(FlutterError *_Nullable))completion; @end + /// Handler for native callbacks that are tied to a specific camera ID. /// /// This is intended to be initialized with the camera ID as a suffix. @interface FCPCameraEventApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger messageChannelSuffix:(nullable NSString *)messageChannelSuffix; /// Called when the camera is inialitized for use. -- (void)initializedWithState:(FCPPlatformCameraState *)initialState - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)initializedWithState:(FCPPlatformCameraState *)initialState completion:(void (^)(FlutterError *_Nullable))completion; /// Called when an error occurs in the camera. /// /// This should be used for errors that occur outside of the context of diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m index 6fd130e922c0..7f63258c48f0 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m @@ -26,12 +26,7 @@ } static FlutterError *createConnectionError(NSString *channelName) { - return [FlutterError - errorWithCode:@"channel-error" - message:[NSString stringWithFormat:@"%@/%@/%@", - @"Unable to establish connection on channel: '", - channelName, @"'."] - details:@""]; + return [FlutterError errorWithCode:@"channel-error" message:[NSString stringWithFormat:@"%@/%@/%@", @"Unable to establish connection on channel: '", channelName, @"'."] details:@""]; } static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { @@ -162,9 +157,9 @@ + (nullable FCPPlatformSize *)nullableFromList:(NSArray *)list; @implementation FCPPlatformCameraDescription + (instancetype)makeWithName:(NSString *)name - lensDirection:(FCPPlatformCameraLensDirection)lensDirection - lensType:(FCPPlatformCameraLensType)lensType { - FCPPlatformCameraDescription *pigeonResult = [[FCPPlatformCameraDescription alloc] init]; + lensDirection:(FCPPlatformCameraLensDirection)lensDirection + lensType:(FCPPlatformCameraLensType)lensType { + FCPPlatformCameraDescription* pigeonResult = [[FCPPlatformCameraDescription alloc] init]; pigeonResult.name = name; pigeonResult.lensDirection = lensDirection; pigeonResult.lensType = lensType; @@ -173,8 +168,7 @@ + (instancetype)makeWithName:(NSString *)name + (FCPPlatformCameraDescription *)fromList:(NSArray *)list { FCPPlatformCameraDescription *pigeonResult = [[FCPPlatformCameraDescription alloc] init]; pigeonResult.name = GetNullableObjectAtIndex(list, 0); - FCPPlatformCameraLensDirectionBox *boxedFCPPlatformCameraLensDirection = - GetNullableObjectAtIndex(list, 1); + FCPPlatformCameraLensDirectionBox *boxedFCPPlatformCameraLensDirection = GetNullableObjectAtIndex(list, 1); pigeonResult.lensDirection = boxedFCPPlatformCameraLensDirection.value; FCPPlatformCameraLensTypeBox *boxedFCPPlatformCameraLensType = GetNullableObjectAtIndex(list, 2); pigeonResult.lensType = boxedFCPPlatformCameraLensType.value; @@ -194,11 +188,11 @@ + (nullable FCPPlatformCameraDescription *)nullableFromList:(NSArray *)list @implementation FCPPlatformCameraState + (instancetype)makeWithPreviewSize:(FCPPlatformSize *)previewSize - exposureMode:(FCPPlatformExposureMode)exposureMode - focusMode:(FCPPlatformFocusMode)focusMode - exposurePointSupported:(BOOL)exposurePointSupported - focusPointSupported:(BOOL)focusPointSupported { - FCPPlatformCameraState *pigeonResult = [[FCPPlatformCameraState alloc] init]; + exposureMode:(FCPPlatformExposureMode)exposureMode + focusMode:(FCPPlatformFocusMode)focusMode + exposurePointSupported:(BOOL )exposurePointSupported + focusPointSupported:(BOOL )focusPointSupported { + FCPPlatformCameraState* pigeonResult = [[FCPPlatformCameraState alloc] init]; pigeonResult.previewSize = previewSize; pigeonResult.exposureMode = exposureMode; pigeonResult.focusMode = focusMode; @@ -233,11 +227,11 @@ + (nullable FCPPlatformCameraState *)nullableFromList:(NSArray *)list { @implementation FCPPlatformMediaSettings + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolutionPreset - framesPerSecond:(nullable NSNumber *)framesPerSecond - videoBitrate:(nullable NSNumber *)videoBitrate - audioBitrate:(nullable NSNumber *)audioBitrate - enableAudio:(BOOL)enableAudio { - FCPPlatformMediaSettings *pigeonResult = [[FCPPlatformMediaSettings alloc] init]; + framesPerSecond:(nullable NSNumber *)framesPerSecond + videoBitrate:(nullable NSNumber *)videoBitrate + audioBitrate:(nullable NSNumber *)audioBitrate + enableAudio:(BOOL )enableAudio { + FCPPlatformMediaSettings* pigeonResult = [[FCPPlatformMediaSettings alloc] init]; pigeonResult.resolutionPreset = resolutionPreset; pigeonResult.framesPerSecond = framesPerSecond; pigeonResult.videoBitrate = videoBitrate; @@ -247,8 +241,7 @@ + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolution } + (FCPPlatformMediaSettings *)fromList:(NSArray *)list { FCPPlatformMediaSettings *pigeonResult = [[FCPPlatformMediaSettings alloc] init]; - FCPPlatformResolutionPresetBox *boxedFCPPlatformResolutionPreset = - GetNullableObjectAtIndex(list, 0); + FCPPlatformResolutionPresetBox *boxedFCPPlatformResolutionPreset = GetNullableObjectAtIndex(list, 0); pigeonResult.resolutionPreset = boxedFCPPlatformResolutionPreset.value; pigeonResult.framesPerSecond = GetNullableObjectAtIndex(list, 1); pigeonResult.videoBitrate = GetNullableObjectAtIndex(list, 2); @@ -271,8 +264,9 @@ + (nullable FCPPlatformMediaSettings *)nullableFromList:(NSArray *)list { @end @implementation FCPPlatformPoint -+ (instancetype)makeWithX:(double)x y:(double)y { - FCPPlatformPoint *pigeonResult = [[FCPPlatformPoint alloc] init]; ++ (instancetype)makeWithX:(double )x + y:(double )y { + FCPPlatformPoint* pigeonResult = [[FCPPlatformPoint alloc] init]; pigeonResult.x = x; pigeonResult.y = y; return pigeonResult; @@ -295,8 +289,9 @@ + (nullable FCPPlatformPoint *)nullableFromList:(NSArray *)list { @end @implementation FCPPlatformSize -+ (instancetype)makeWithWidth:(double)width height:(double)height { - FCPPlatformSize *pigeonResult = [[FCPPlatformSize alloc] init]; ++ (instancetype)makeWithWidth:(double )width + height:(double )height { + FCPPlatformSize* pigeonResult = [[FCPPlatformSize alloc] init]; pigeonResult.width = width; pigeonResult.height = height; return pigeonResult; @@ -325,67 +320,49 @@ - (nullable id)readValueOfType:(UInt8)type { switch (type) { case 129: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformCameraLensDirectionBox alloc] - initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformCameraLensDirectionBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 130: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil - ? nil - : [[FCPPlatformCameraLensTypeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformCameraLensTypeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 131: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformDeviceOrientationBox alloc] - initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformDeviceOrientationBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 132: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil - ? nil - : [[FCPPlatformExposureModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformExposureModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 133: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil - ? nil - : [[FCPPlatformFlashModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformFlashModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 134: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil - ? nil - : [[FCPPlatformFocusModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformFocusModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 135: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformImageFileFormatBox alloc] - initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformImageFileFormatBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 136: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformImageFormatGroupBox alloc] - initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformImageFormatGroupBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 137: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformResolutionPresetBox alloc] - initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformResolutionPresetBox alloc] initWithValue:[enumAsNumber integerValue]]; } - case 138: + case 138: return [FCPPlatformCameraDescription fromList:[self readValue]]; - case 139: + case 139: return [FCPPlatformCameraState fromList:[self readValue]]; - case 140: + case 140: return [FCPPlatformMediaSettings fromList:[self readValue]]; - case 141: + case 141: return [FCPPlatformPoint fromList:[self readValue]]; - case 142: + case 142: return [FCPPlatformSize fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -469,8 +446,7 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FCPMessagesPigeonCodecReaderWriter *readerWriter = - [[FCPMessagesPigeonCodecReaderWriter alloc] init]; + FCPMessagesPigeonCodecReaderWriter *readerWriter = [[FCPMessagesPigeonCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; @@ -479,29 +455,19 @@ void SetUpFCPCameraApi(id binaryMessenger, NSObject binaryMessenger, - NSObject *api, NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 - ? [NSString stringWithFormat:@".%@", messageChannelSuffix] - : @""; +void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSObject *api, NSString *messageChannelSuffix) { + messageChannelSuffix = messageChannelSuffix.length > 0 ? [NSString stringWithFormat: @".%@", messageChannelSuffix] : @""; /// Returns the list of available cameras. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.getAvailableCameras", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(availableCamerasWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(availableCamerasWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(availableCamerasWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(availableCamerasWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api availableCamerasWithCompletion:^( - NSArray *_Nullable output, - FlutterError *_Nullable error) { + [api availableCamerasWithCompletion:^(NSArray *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -511,27 +477,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Create a new camera with the given settings, and returns its ID. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.create", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.create", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createCameraWithName:settings:completion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(createCameraWithName:settings:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(createCameraWithName:settings:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(createCameraWithName:settings:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_cameraName = GetNullableObjectAtIndex(args, 0); FCPPlatformMediaSettings *arg_settings = GetNullableObjectAtIndex(args, 1); - [api createCameraWithName:arg_cameraName - settings:arg_settings - completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api createCameraWithName:arg_cameraName settings:arg_settings completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -539,30 +498,21 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Initializes the camera with the given ID. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(initializeCamera:withImageFormat:completion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(initializeCamera:withImageFormat:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(initializeCamera:withImageFormat:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(initializeCamera:withImageFormat:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSInteger arg_cameraId = [GetNullableObjectAtIndex(args, 0) integerValue]; - FCPPlatformImageFormatGroupBox *boxedFCPPlatformImageFormatGroup = - GetNullableObjectAtIndex(args, 1); + FCPPlatformImageFormatGroupBox *boxedFCPPlatformImageFormatGroup = GetNullableObjectAtIndex(args, 1); FCPPlatformImageFormatGroup arg_imageFormat = boxedFCPPlatformImageFormatGroup.value; - [api initializeCamera:arg_cameraId - withImageFormat:arg_imageFormat - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api initializeCamera:arg_cameraId withImageFormat:arg_imageFormat completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -570,18 +520,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Begins streaming frames from the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.startImageStream", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(startImageStreamWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(startImageStreamWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(startImageStreamWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(startImageStreamWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api startImageStreamWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -593,19 +538,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Stops streaming frames from the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(stopImageStreamWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(stopImageStreamWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(stopImageStreamWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(stopImageStreamWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api stopImageStreamWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -620,18 +559,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// /// This is used to throttle sending frames across the channel. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.receivedImageStreamData", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(receivedImageStreamDataWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(receivedImageStreamDataWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(receivedImageStreamDataWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(receivedImageStreamDataWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api receivedImageStreamDataWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -644,24 +578,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// Indicates that the given camera is no longer being used on the Dart side, /// and any associated resources can be cleaned up. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(disposeCamera:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(disposeCamera:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(disposeCamera:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(disposeCamera:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSInteger arg_cameraId = [GetNullableObjectAtIndex(args, 0) integerValue]; - [api disposeCamera:arg_cameraId - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api disposeCamera:arg_cameraId completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -669,27 +598,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Locks the camera capture to the current device orientation. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.lockCaptureOrientation", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(lockCaptureOrientation:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(lockCaptureOrientation:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(lockCaptureOrientation:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(lockCaptureOrientation:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FCPPlatformDeviceOrientationBox *boxedFCPPlatformDeviceOrientation = - GetNullableObjectAtIndex(args, 0); + FCPPlatformDeviceOrientationBox *boxedFCPPlatformDeviceOrientation = GetNullableObjectAtIndex(args, 0); FCPPlatformDeviceOrientation arg_orientation = boxedFCPPlatformDeviceOrientation.value; - [api lockCaptureOrientation:arg_orientation - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api lockCaptureOrientation:arg_orientation completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -698,18 +620,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.unlockCaptureOrientation", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(unlockCaptureOrientationWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(unlockCaptureOrientationWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(unlockCaptureOrientationWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(unlockCaptureOrientationWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api unlockCaptureOrientationWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -722,23 +639,17 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// Takes a picture with the current settings, and returns the path to the /// resulting file. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(takePictureWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(takePictureWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(takePictureWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(takePictureWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api - takePictureWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api takePictureWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -746,18 +657,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Does any preprocessing necessary before beginning to record video. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.prepareForVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(prepareForVideoRecordingWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(prepareForVideoRecordingWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(prepareForVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(prepareForVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api prepareForVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -770,25 +676,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// Begins recording video, optionally enabling streaming to Dart at the same /// time. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.startVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(startVideoRecordingWithStreaming:completion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(startVideoRecordingWithStreaming:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(startVideoRecordingWithStreaming:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(startVideoRecordingWithStreaming:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; BOOL arg_enableStream = [GetNullableObjectAtIndex(args, 0) boolValue]; - [api startVideoRecordingWithStreaming:arg_enableStream - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api startVideoRecordingWithStreaming:arg_enableStream completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -796,21 +696,15 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Stops recording video, and results the path to the resulting file. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.stopVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(stopVideoRecordingWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(stopVideoRecordingWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(stopVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(stopVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api stopVideoRecordingWithCompletion:^(NSString *_Nullable output, - FlutterError *_Nullable error) { + [api stopVideoRecordingWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -820,18 +714,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Pauses video recording. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.pauseVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(pauseVideoRecordingWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(pauseVideoRecordingWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(pauseVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(pauseVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api pauseVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -843,18 +732,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Resumes a previously paused video recording. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.resumeVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(resumeVideoRecordingWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(resumeVideoRecordingWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(resumeVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(resumeVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api resumeVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -866,26 +750,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Switches the camera to the given flash mode. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFlashMode:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setFlashMode:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setFlashMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFlashMode:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformFlashModeBox *boxedFCPPlatformFlashMode = GetNullableObjectAtIndex(args, 0); FCPPlatformFlashMode arg_mode = boxedFCPPlatformFlashMode.value; - [api setFlashMode:arg_mode - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFlashMode:arg_mode completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -893,27 +771,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Switches the camera to the given exposure mode. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposureMode:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureMode:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setExposureMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureMode:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FCPPlatformExposureModeBox *boxedFCPPlatformExposureMode = - GetNullableObjectAtIndex(args, 0); + FCPPlatformExposureModeBox *boxedFCPPlatformExposureMode = GetNullableObjectAtIndex(args, 0); FCPPlatformExposureMode arg_mode = boxedFCPPlatformExposureMode.value; - [api setExposureMode:arg_mode - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposureMode:arg_mode completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -923,24 +794,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// /// A null value resets to the default exposure point. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.setExposurePoint", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposurePoint:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setExposurePoint:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setExposurePoint:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposurePoint:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformPoint *arg_point = GetNullableObjectAtIndex(args, 0); - [api setExposurePoint:arg_point - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposurePoint:arg_point completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -948,17 +814,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Returns the minimum exposure offset supported by the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.getMinExposureOffset", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMinimumExposureOffset:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumExposureOffset:)", - api); + NSCAssert([api respondsToSelector:@selector(getMinimumExposureOffset:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumExposureOffset:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMinimumExposureOffset:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -970,17 +832,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Returns the maximum exposure offset supported by the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.getMaxExposureOffset", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMaximumExposureOffset:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumExposureOffset:)", - api); + NSCAssert([api respondsToSelector:@selector(getMaximumExposureOffset:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumExposureOffset:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMaximumExposureOffset:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -992,25 +850,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Sets the exposure offset manually to the given value. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.setExposureOffset", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(setExposureOffset:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureOffset:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setExposureOffset:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureOffset:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; double arg_offset = [GetNullableObjectAtIndex(args, 0) doubleValue]; - [api setExposureOffset:arg_offset - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposureOffset:arg_offset completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1018,26 +870,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Switches the camera to the given focus mode. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFocusMode:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusMode:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setFocusMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusMode:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformFocusModeBox *boxedFCPPlatformFocusMode = GetNullableObjectAtIndex(args, 0); FCPPlatformFocusMode arg_mode = boxedFCPPlatformFocusMode.value; - [api setFocusMode:arg_mode - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFocusMode:arg_mode completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1047,25 +893,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// /// A null value resets to the default focus point. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFocusPoint:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusPoint:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setFocusPoint:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusPoint:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformPoint *arg_point = GetNullableObjectAtIndex(args, 0); - [api setFocusPoint:arg_point - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFocusPoint:arg_point completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1073,17 +913,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Returns the minimum zoom level supported by the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMinimumZoomLevel:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumZoomLevel:)", api); + NSCAssert([api respondsToSelector:@selector(getMinimumZoomLevel:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumZoomLevel:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMinimumZoomLevel:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -1095,17 +931,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Returns the maximum zoom level supported by the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMaximumZoomLevel:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumZoomLevel:)", api); + NSCAssert([api respondsToSelector:@selector(getMaximumZoomLevel:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumZoomLevel:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMaximumZoomLevel:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -1117,25 +949,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Sets the zoom factor. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setZoomLevel:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setZoomLevel:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setZoomLevel:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setZoomLevel:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; double arg_zoom = [GetNullableObjectAtIndex(args, 0) doubleValue]; - [api setZoomLevel:arg_zoom - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setZoomLevel:arg_zoom completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1143,18 +969,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Pauses streaming of preview frames. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(pausePreviewWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(pausePreviewWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(pausePreviewWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(pausePreviewWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api pausePreviewWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -1166,18 +987,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Resumes a previously paused preview stream. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(resumePreviewWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(resumePreviewWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(resumePreviewWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(resumePreviewWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api resumePreviewWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -1191,26 +1007,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// /// This should only be called while video recording is active. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.updateDescriptionWhileRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(updateDescriptionWhileRecordingCameraName: - completion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(updateDescriptionWhileRecordingCameraName:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(updateDescriptionWhileRecordingCameraName:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(updateDescriptionWhileRecordingCameraName:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_cameraName = GetNullableObjectAtIndex(args, 0); - [api updateDescriptionWhileRecordingCameraName:arg_cameraName - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api updateDescriptionWhileRecordingCameraName:arg_cameraName completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1218,27 +1027,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Sets the file format used for taking pictures. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.setImageFileFormat", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(setImageFileFormat:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setImageFileFormat:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setImageFileFormat:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setImageFileFormat:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FCPPlatformImageFileFormatBox *boxedFCPPlatformImageFileFormat = - GetNullableObjectAtIndex(args, 0); + FCPPlatformImageFileFormatBox *boxedFCPPlatformImageFileFormat = GetNullableObjectAtIndex(args, 0); FCPPlatformImageFileFormat arg_format = boxedFCPPlatformImageFileFormat.value; - [api setImageFileFormat:arg_format - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setImageFileFormat:arg_format completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1255,42 +1057,32 @@ @implementation FCPCameraGlobalEventApi - (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""]; } -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix { +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger messageChannelSuffix:(nullable NSString*)messageChannelSuffix{ self = [self init]; if (self) { _binaryMessenger = binaryMessenger; - _messageChannelSuffix = [messageChannelSuffix length] == 0 - ? @"" - : [NSString stringWithFormat:@".%@", messageChannelSuffix]; + _messageChannelSuffix = [messageChannelSuffix length] == 0 ? @"" : [NSString stringWithFormat: @".%@", messageChannelSuffix]; } return self; } -- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)arg_orientation - completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged", - _messageChannelSuffix]; +- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)arg_orientation completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged", _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPGetMessagesCodec()]; - [channel sendMessage:@[ [[FCPPlatformDeviceOrientationBox alloc] initWithValue:arg_orientation] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel + messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPGetMessagesCodec()]; + [channel sendMessage:@[[[FCPPlatformDeviceOrientationBox alloc] initWithValue:arg_orientation]] reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } @end @@ -1304,64 +1096,51 @@ @implementation FCPCameraEventApi - (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""]; } -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix { +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger messageChannelSuffix:(nullable NSString*)messageChannelSuffix{ self = [self init]; if (self) { _binaryMessenger = binaryMessenger; - _messageChannelSuffix = [messageChannelSuffix length] == 0 - ? @"" - : [NSString stringWithFormat:@".%@", messageChannelSuffix]; + _messageChannelSuffix = [messageChannelSuffix length] == 0 ? @"" : [NSString stringWithFormat: @".%@", messageChannelSuffix]; } return self; } -- (void)initializedWithState:(FCPPlatformCameraState *)arg_initialState - completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized", - _messageChannelSuffix]; +- (void)initializedWithState:(FCPPlatformCameraState *)arg_initialState completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized", _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPGetMessagesCodec()]; - [channel sendMessage:@[ arg_initialState ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel + messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPGetMessagesCodec()]; + [channel sendMessage:@[arg_initialState ?: [NSNull null]] reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } -- (void)reportError:(NSString *)arg_message - completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error", - _messageChannelSuffix]; +- (void)reportError:(NSString *)arg_message completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error", _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPGetMessagesCodec()]; - [channel sendMessage:@[ arg_message ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel + messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPGetMessagesCodec()]; + [channel sendMessage:@[arg_message ?: [NSNull null]] reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } @end + diff --git a/packages/camera/camera_avfoundation/lib/src/messages.g.dart b/packages/camera/camera_avfoundation/lib/src/messages.g.dart index d36428c17ef5..a49a854a12c2 100644 --- a/packages/camera/camera_avfoundation/lib/src/messages.g.dart +++ b/packages/camera/camera_avfoundation/lib/src/messages.g.dart @@ -18,8 +18,7 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse( - {Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -32,10 +31,8 @@ List wrapResponse( enum PlatformCameraLensDirection { /// Front facing camera (a user looking at the screen is seen by the camera). front, - /// Back facing camera (a user looking at the screen is not seen by the camera). back, - /// External camera which may not be mounted to the device. external, } @@ -43,13 +40,10 @@ enum PlatformCameraLensDirection { enum PlatformCameraLensType { /// A built-in wide-angle camera device type. wide, - - /// A built-in camera device type with a shorter focal length than a wide-angle camera. - telephoto, - /// A built-in camera device type with a longer focal length than a wide-angle camera. + telephoto, + /// A built-in camera device type with a shorter focal length than a wide-angle camera. ultraWide, - /// Unknown camera device type. unknown, } @@ -271,6 +265,7 @@ class PlatformSize { } } + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -278,46 +273,46 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is PlatformCameraLensDirection) { + } else if (value is PlatformCameraLensDirection) { buffer.putUint8(129); writeValue(buffer, value.index); - } else if (value is PlatformCameraLensType) { + } else if (value is PlatformCameraLensType) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is PlatformDeviceOrientation) { + } else if (value is PlatformDeviceOrientation) { buffer.putUint8(131); writeValue(buffer, value.index); - } else if (value is PlatformExposureMode) { + } else if (value is PlatformExposureMode) { buffer.putUint8(132); writeValue(buffer, value.index); - } else if (value is PlatformFlashMode) { + } else if (value is PlatformFlashMode) { buffer.putUint8(133); writeValue(buffer, value.index); - } else if (value is PlatformFocusMode) { + } else if (value is PlatformFocusMode) { buffer.putUint8(134); writeValue(buffer, value.index); - } else if (value is PlatformImageFileFormat) { + } else if (value is PlatformImageFileFormat) { buffer.putUint8(135); writeValue(buffer, value.index); - } else if (value is PlatformImageFormatGroup) { + } else if (value is PlatformImageFormatGroup) { buffer.putUint8(136); writeValue(buffer, value.index); - } else if (value is PlatformResolutionPreset) { + } else if (value is PlatformResolutionPreset) { buffer.putUint8(137); writeValue(buffer, value.index); - } else if (value is PlatformCameraDescription) { + } else if (value is PlatformCameraDescription) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value is PlatformCameraState) { + } else if (value is PlatformCameraState) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is PlatformMediaSettings) { + } else if (value is PlatformMediaSettings) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is PlatformPoint) { + } else if (value is PlatformPoint) { buffer.putUint8(141); writeValue(buffer, value.encode()); - } else if (value is PlatformSize) { + } else if (value is PlatformSize) { buffer.putUint8(142); writeValue(buffer, value.encode()); } else { @@ -328,42 +323,42 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: + case 129: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformCameraLensDirection.values[value]; - case 130: + case 130: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformCameraLensType.values[value]; - case 131: + case 131: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformDeviceOrientation.values[value]; - case 132: + case 132: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformExposureMode.values[value]; - case 133: + case 133: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformFlashMode.values[value]; - case 134: + case 134: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformFocusMode.values[value]; - case 135: + case 135: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformImageFileFormat.values[value]; - case 136: + case 136: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformImageFormatGroup.values[value]; - case 137: + case 137: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformResolutionPreset.values[value]; - case 138: + case 138: return PlatformCameraDescription.decode(readValue(buffer)!); - case 139: + case 139: return PlatformCameraState.decode(readValue(buffer)!); - case 140: + case 140: return PlatformMediaSettings.decode(readValue(buffer)!); - case 141: + case 141: return PlatformPoint.decode(readValue(buffer)!); - case 142: + case 142: return PlatformSize.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -375,11 +370,9 @@ class CameraApi { /// Constructor for [CameraApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - CameraApi( - {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + CameraApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -388,10 +381,8 @@ class CameraApi { /// Returns the list of available cameras. Future> getAvailableCameras() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -412,23 +403,20 @@ class CameraApi { message: 'Host platform returned null value for non-null return value.', ); } else { - return (pigeonVar_replyList[0] as List?)! - .cast(); + return (pigeonVar_replyList[0] as List?)!.cast(); } } /// Create a new camera with the given settings, and returns its ID. Future create(String cameraName, PlatformMediaSettings settings) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.create$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.create$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([cameraName, settings]) as List?; + final List? pigeonVar_replyList = + await pigeonVar_channel.send([cameraName, settings]) as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -448,18 +436,15 @@ class CameraApi { } /// Initializes the camera with the given ID. - Future initialize( - int cameraId, PlatformImageFormatGroup imageFormat) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + Future initialize(int cameraId, PlatformImageFormatGroup imageFormat) async { + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([cameraId, imageFormat]) as List?; + final List? pigeonVar_replyList = + await pigeonVar_channel.send([cameraId, imageFormat]) as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -475,10 +460,8 @@ class CameraApi { /// Begins streaming frames from the camera. Future startImageStream() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -500,10 +483,8 @@ class CameraApi { /// Stops streaming frames from the camera. Future stopImageStream() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -528,10 +509,8 @@ class CameraApi { /// /// This is used to throttle sending frames across the channel. Future receivedImageStreamData() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -554,10 +533,8 @@ class CameraApi { /// Indicates that the given camera is no longer being used on the Dart side, /// and any associated resources can be cleaned up. Future dispose(int cameraId) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -578,12 +555,9 @@ class CameraApi { } /// Locks the camera capture to the current device orientation. - Future lockCaptureOrientation( - PlatformDeviceOrientation orientation) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + Future lockCaptureOrientation(PlatformDeviceOrientation orientation) async { + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -606,10 +580,8 @@ class CameraApi { /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. Future unlockCaptureOrientation() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -632,10 +604,8 @@ class CameraApi { /// Takes a picture with the current settings, and returns the path to the /// resulting file. Future takePicture() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -662,10 +632,8 @@ class CameraApi { /// Does any preprocessing necessary before beginning to record video. Future prepareForVideoRecording() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -688,10 +656,8 @@ class CameraApi { /// Begins recording video, optionally enabling streaming to Dart at the same /// time. Future startVideoRecording(bool enableStream) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -713,10 +679,8 @@ class CameraApi { /// Stops recording video, and results the path to the resulting file. Future stopVideoRecording() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -743,10 +707,8 @@ class CameraApi { /// Pauses video recording. Future pauseVideoRecording() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -768,10 +730,8 @@ class CameraApi { /// Resumes a previously paused video recording. Future resumeVideoRecording() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -793,10 +753,8 @@ class CameraApi { /// Switches the camera to the given flash mode. Future setFlashMode(PlatformFlashMode mode) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -818,10 +776,8 @@ class CameraApi { /// Switches the camera to the given exposure mode. Future setExposureMode(PlatformExposureMode mode) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -845,10 +801,8 @@ class CameraApi { /// /// A null value resets to the default exposure point. Future setExposurePoint(PlatformPoint? point) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -870,10 +824,8 @@ class CameraApi { /// Returns the minimum exposure offset supported by the camera. Future getMinExposureOffset() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -900,10 +852,8 @@ class CameraApi { /// Returns the maximum exposure offset supported by the camera. Future getMaxExposureOffset() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -930,10 +880,8 @@ class CameraApi { /// Sets the exposure offset manually to the given value. Future setExposureOffset(double offset) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -955,10 +903,8 @@ class CameraApi { /// Switches the camera to the given focus mode. Future setFocusMode(PlatformFocusMode mode) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -982,10 +928,8 @@ class CameraApi { /// /// A null value resets to the default focus point. Future setFocusPoint(PlatformPoint? point) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1007,10 +951,8 @@ class CameraApi { /// Returns the minimum zoom level supported by the camera. Future getMinZoomLevel() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1037,10 +979,8 @@ class CameraApi { /// Returns the maximum zoom level supported by the camera. Future getMaxZoomLevel() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1067,10 +1007,8 @@ class CameraApi { /// Sets the zoom factor. Future setZoomLevel(double zoom) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1092,10 +1030,8 @@ class CameraApi { /// Pauses streaming of preview frames. Future pausePreview() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1117,10 +1053,8 @@ class CameraApi { /// Resumes a previously paused preview stream. Future resumePreview() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1144,10 +1078,8 @@ class CameraApi { /// /// This should only be called while video recording is active. Future updateDescriptionWhileRecording(String cameraName) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1169,10 +1101,8 @@ class CameraApi { /// Sets the file format used for taking pictures. Future setImageFileFormat(PlatformImageFileFormat format) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1200,29 +1130,20 @@ abstract class CameraGlobalEventApi { /// Called when the device's physical orientation changes. void deviceOrientationChanged(PlatformDeviceOrientation orientation); - static void setUp( - CameraGlobalEventApi? api, { - BinaryMessenger? binaryMessenger, - String messageChannelSuffix = '', - }) { - messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp(CameraGlobalEventApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { + messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged$messageChannelSuffix', - pigeonChannelCodec, + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + 'dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null.'); final List args = (message as List?)!; - final PlatformDeviceOrientation? arg_orientation = - (args[0] as PlatformDeviceOrientation?); + final PlatformDeviceOrientation? arg_orientation = (args[0] as PlatformDeviceOrientation?); assert(arg_orientation != null, 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null, expected non-null PlatformDeviceOrientation.'); try { @@ -1230,9 +1151,8 @@ abstract class CameraGlobalEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } @@ -1283,29 +1203,20 @@ abstract class CameraEventApi { /// handling a specific HostApi call, such as during streaming. void error(String message); - static void setUp( - CameraEventApi? api, { - BinaryMessenger? binaryMessenger, - String messageChannelSuffix = '', - }) { - messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp(CameraEventApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { + messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized$messageChannelSuffix', - pigeonChannelCodec, + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null.'); final List args = (message as List?)!; - final PlatformCameraState? arg_initialState = - (args[0] as PlatformCameraState?); + final PlatformCameraState? arg_initialState = (args[0] as PlatformCameraState?); assert(arg_initialState != null, 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null, expected non-null PlatformCameraState.'); try { @@ -1313,26 +1224,22 @@ abstract class CameraEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } } { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error$messageChannelSuffix', - pigeonChannelCodec, + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error was null.'); final List args = (message as List?)!; final String? arg_message = (args[0] as String?); assert(arg_message != null, @@ -1342,9 +1249,8 @@ abstract class CameraEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } diff --git a/packages/camera/camera_avfoundation/pigeons/messages.dart b/packages/camera/camera_avfoundation/pigeons/messages.dart index b55d1ff1f612..7d1d97c77e1a 100644 --- a/packages/camera/camera_avfoundation/pigeons/messages.dart +++ b/packages/camera/camera_avfoundation/pigeons/messages.dart @@ -34,10 +34,10 @@ enum PlatformCameraLensType { /// A built-in wide-angle camera device type. wide, - /// A built-in camera device type with a shorter focal length than a wide-angle camera. + /// A built-in camera device type with a longer focal length than a wide-angle camera. telephoto, - /// A built-in camera device type with a longer focal length than a wide-angle camera. + /// A built-in camera device type with a shorter focal length than a wide-angle camera. ultraWide, /// Unknown camera device type. diff --git a/packages/camera/camera_platform_interface/lib/src/types/camera_description.dart b/packages/camera/camera_platform_interface/lib/src/types/camera_description.dart index 93e8bb329d97..4d5b3ec543f3 100644 --- a/packages/camera/camera_platform_interface/lib/src/types/camera_description.dart +++ b/packages/camera/camera_platform_interface/lib/src/types/camera_description.dart @@ -23,10 +23,10 @@ enum CameraLensType { /// A built-in wide-angle camera device type. wide, - /// A built-in camera device type with a shorter focal length than a wide-angle camera. + /// A built-in camera device type with a longer focal length than a wide-angle camera. telephoto, - /// A built-in camera device type with a longer focal length than a wide-angle camera. + /// A built-in camera device type with a shorter focal length than a wide-angle camera. ultraWide, /// Unknown camera device type. From 8348554a4143db2e8f0c47b21908f963e038882a Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Tue, 1 Apr 2025 15:30:21 -0400 Subject: [PATCH 16/25] run format script from `/packages/packages/camera` ran `dart run ../../script/tool/bin/flutter_plugin_tools.dart format --current-package` --- .../camera_avfoundation/CameraPlugin.m | 50 +- .../include/camera_avfoundation/QueueUtils.h | 2 +- .../include/camera_avfoundation/messages.g.h | 115 +-- .../Sources/camera_avfoundation/messages.g.m | 813 +++++++++++------- .../lib/src/messages.g.dart | 334 ++++--- 5 files changed, 824 insertions(+), 490 deletions(-) diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m index 5f4a16e7a857..59c33dbe8e40 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m @@ -24,33 +24,33 @@ static void FCPGetLensDirectionAndType(AVCaptureDevice *device, FCPPlatformCameraLensDirection *lensDirection, FCPPlatformCameraLensType *lensType) { - switch (device.position) { - case AVCaptureDevicePositionBack: - *lensDirection = FCPPlatformCameraLensDirectionBack; - break; - case AVCaptureDevicePositionFront: - *lensDirection = FCPPlatformCameraLensDirectionFront; - break; - case AVCaptureDevicePositionUnspecified: - *lensDirection = FCPPlatformCameraLensDirectionExternal; - break; - } - - if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInWideAngleCamera]) { - *lensType = FCPPlatformCameraLensTypeWide; - } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInTelephotoCamera]) { - *lensType = FCPPlatformCameraLensTypeTelephoto; - } else if (@available(iOS 13.0, *)) { - if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInUltraWideCamera]) { - *lensType = FCPPlatformCameraLensTypeUltraWide; - } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInDualWideCamera]) { - *lensType = FCPPlatformCameraLensTypeWide; - } else { - *lensType = FCPPlatformCameraLensTypeUnknown; - } + switch (device.position) { + case AVCaptureDevicePositionBack: + *lensDirection = FCPPlatformCameraLensDirectionBack; + break; + case AVCaptureDevicePositionFront: + *lensDirection = FCPPlatformCameraLensDirectionFront; + break; + case AVCaptureDevicePositionUnspecified: + *lensDirection = FCPPlatformCameraLensDirectionExternal; + break; + } + + if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInWideAngleCamera]) { + *lensType = FCPPlatformCameraLensTypeWide; + } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInTelephotoCamera]) { + *lensType = FCPPlatformCameraLensTypeTelephoto; + } else if (@available(iOS 13.0, *)) { + if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInUltraWideCamera]) { + *lensType = FCPPlatformCameraLensTypeUltraWide; + } else if ([device.deviceType isEqualToString:AVCaptureDeviceTypeBuiltInDualWideCamera]) { + *lensType = FCPPlatformCameraLensTypeWide; } else { - *lensType = FCPPlatformCameraLensTypeUnknown; + *lensType = FCPPlatformCameraLensTypeUnknown; } + } else { + *lensType = FCPPlatformCameraLensTypeUnknown; + } } @interface CameraPlugin () diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h index a7e22da716d0..e230a53508fa 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h @@ -7,7 +7,7 @@ NS_ASSUME_NONNULL_BEGIN /// Queue-specific context data to be associated with the capture session queue. -extern const char* FLTCaptureSessionQueueSpecific; +extern const char *FLTCaptureSessionQueueSpecific; /// Ensures the given block to be run on the main queue. /// If caller site is already on the main queue, the block will be run diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h index f2e248fcf371..f8f102de922c 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h @@ -141,10 +141,10 @@ typedef NS_ENUM(NSUInteger, FCPPlatformResolutionPreset) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithName:(NSString *)name - lensDirection:(FCPPlatformCameraLensDirection)lensDirection - lensType:(FCPPlatformCameraLensType)lensType; + lensDirection:(FCPPlatformCameraLensDirection)lensDirection + lensType:(FCPPlatformCameraLensType)lensType; /// The name of the camera device. -@property(nonatomic, copy) NSString * name; +@property(nonatomic, copy) NSString *name; /// The direction the camera is facing. @property(nonatomic, assign) FCPPlatformCameraLensDirection lensDirection; /// The type of the camera lens. @@ -155,53 +155,51 @@ typedef NS_ENUM(NSUInteger, FCPPlatformResolutionPreset) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithPreviewSize:(FCPPlatformSize *)previewSize - exposureMode:(FCPPlatformExposureMode)exposureMode - focusMode:(FCPPlatformFocusMode)focusMode - exposurePointSupported:(BOOL )exposurePointSupported - focusPointSupported:(BOOL )focusPointSupported; + exposureMode:(FCPPlatformExposureMode)exposureMode + focusMode:(FCPPlatformFocusMode)focusMode + exposurePointSupported:(BOOL)exposurePointSupported + focusPointSupported:(BOOL)focusPointSupported; /// The size of the preview, in pixels. -@property(nonatomic, strong) FCPPlatformSize * previewSize; +@property(nonatomic, strong) FCPPlatformSize *previewSize; /// The default exposure mode @property(nonatomic, assign) FCPPlatformExposureMode exposureMode; /// The default focus mode @property(nonatomic, assign) FCPPlatformFocusMode focusMode; /// Whether setting exposure points is supported. -@property(nonatomic, assign) BOOL exposurePointSupported; +@property(nonatomic, assign) BOOL exposurePointSupported; /// Whether setting focus points is supported. -@property(nonatomic, assign) BOOL focusPointSupported; +@property(nonatomic, assign) BOOL focusPointSupported; @end @interface FCPPlatformMediaSettings : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolutionPreset - framesPerSecond:(nullable NSNumber *)framesPerSecond - videoBitrate:(nullable NSNumber *)videoBitrate - audioBitrate:(nullable NSNumber *)audioBitrate - enableAudio:(BOOL )enableAudio; + framesPerSecond:(nullable NSNumber *)framesPerSecond + videoBitrate:(nullable NSNumber *)videoBitrate + audioBitrate:(nullable NSNumber *)audioBitrate + enableAudio:(BOOL)enableAudio; @property(nonatomic, assign) FCPPlatformResolutionPreset resolutionPreset; -@property(nonatomic, strong, nullable) NSNumber * framesPerSecond; -@property(nonatomic, strong, nullable) NSNumber * videoBitrate; -@property(nonatomic, strong, nullable) NSNumber * audioBitrate; -@property(nonatomic, assign) BOOL enableAudio; +@property(nonatomic, strong, nullable) NSNumber *framesPerSecond; +@property(nonatomic, strong, nullable) NSNumber *videoBitrate; +@property(nonatomic, strong, nullable) NSNumber *audioBitrate; +@property(nonatomic, assign) BOOL enableAudio; @end @interface FCPPlatformPoint : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithX:(double )x - y:(double )y; -@property(nonatomic, assign) double x; -@property(nonatomic, assign) double y; ++ (instancetype)makeWithX:(double)x y:(double)y; +@property(nonatomic, assign) double x; +@property(nonatomic, assign) double y; @end @interface FCPPlatformSize : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithWidth:(double )width - height:(double )height; -@property(nonatomic, assign) double width; -@property(nonatomic, assign) double height; ++ (instancetype)makeWithWidth:(double)width height:(double)height; +@property(nonatomic, assign) double width; +@property(nonatomic, assign) double height; @end /// The codec used by all APIs. @@ -209,11 +207,16 @@ NSObject *FCPGetMessagesCodec(void); @protocol FCPCameraApi /// Returns the list of available cameras. -- (void)availableCamerasWithCompletion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion; +- (void)availableCamerasWithCompletion:(void (^)(NSArray *_Nullable, + FlutterError *_Nullable))completion; /// Create a new camera with the given settings, and returns its ID. -- (void)createCameraWithName:(NSString *)cameraName settings:(FCPPlatformMediaSettings *)settings completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; +- (void)createCameraWithName:(NSString *)cameraName + settings:(FCPPlatformMediaSettings *)settings + completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Initializes the camera with the given ID. -- (void)initializeCamera:(NSInteger)cameraId withImageFormat:(FCPPlatformImageFormatGroup)imageFormat completion:(void (^)(FlutterError *_Nullable))completion; +- (void)initializeCamera:(NSInteger)cameraId + withImageFormat:(FCPPlatformImageFormatGroup)imageFormat + completion:(void (^)(FlutterError *_Nullable))completion; /// Begins streaming frames from the camera. - (void)startImageStreamWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Stops streaming frames from the camera. @@ -227,32 +230,39 @@ NSObject *FCPGetMessagesCodec(void); /// and any associated resources can be cleaned up. - (void)disposeCamera:(NSInteger)cameraId completion:(void (^)(FlutterError *_Nullable))completion; /// Locks the camera capture to the current device orientation. -- (void)lockCaptureOrientation:(FCPPlatformDeviceOrientation)orientation completion:(void (^)(FlutterError *_Nullable))completion; +- (void)lockCaptureOrientation:(FCPPlatformDeviceOrientation)orientation + completion:(void (^)(FlutterError *_Nullable))completion; /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. - (void)unlockCaptureOrientationWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Takes a picture with the current settings, and returns the path to the /// resulting file. -- (void)takePictureWithCompletion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; +- (void)takePictureWithCompletion:(void (^)(NSString *_Nullable, + FlutterError *_Nullable))completion; /// Does any preprocessing necessary before beginning to record video. - (void)prepareForVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Begins recording video, optionally enabling streaming to Dart at the same /// time. -- (void)startVideoRecordingWithStreaming:(BOOL)enableStream completion:(void (^)(FlutterError *_Nullable))completion; +- (void)startVideoRecordingWithStreaming:(BOOL)enableStream + completion:(void (^)(FlutterError *_Nullable))completion; /// Stops recording video, and results the path to the resulting file. -- (void)stopVideoRecordingWithCompletion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; +- (void)stopVideoRecordingWithCompletion:(void (^)(NSString *_Nullable, + FlutterError *_Nullable))completion; /// Pauses video recording. - (void)pauseVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Resumes a previously paused video recording. - (void)resumeVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given flash mode. -- (void)setFlashMode:(FCPPlatformFlashMode)mode completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFlashMode:(FCPPlatformFlashMode)mode + completion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given exposure mode. -- (void)setExposureMode:(FCPPlatformExposureMode)mode completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setExposureMode:(FCPPlatformExposureMode)mode + completion:(void (^)(FlutterError *_Nullable))completion; /// Anchors auto-exposure to the given point in (0,1) coordinate space. /// /// A null value resets to the default exposure point. -- (void)setExposurePoint:(nullable FCPPlatformPoint *)point completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setExposurePoint:(nullable FCPPlatformPoint *)point + completion:(void (^)(FlutterError *_Nullable))completion; /// Returns the minimum exposure offset supported by the camera. - (void)getMinimumExposureOffset:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Returns the maximum exposure offset supported by the camera. @@ -260,11 +270,13 @@ NSObject *FCPGetMessagesCodec(void); /// Sets the exposure offset manually to the given value. - (void)setExposureOffset:(double)offset completion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given focus mode. -- (void)setFocusMode:(FCPPlatformFocusMode)mode completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFocusMode:(FCPPlatformFocusMode)mode + completion:(void (^)(FlutterError *_Nullable))completion; /// Anchors auto-focus to the given point in (0,1) coordinate space. /// /// A null value resets to the default focus point. -- (void)setFocusPoint:(nullable FCPPlatformPoint *)point completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFocusPoint:(nullable FCPPlatformPoint *)point + completion:(void (^)(FlutterError *_Nullable))completion; /// Returns the minimum zoom level supported by the camera. - (void)getMinimumZoomLevel:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Returns the maximum zoom level supported by the camera. @@ -278,33 +290,40 @@ NSObject *FCPGetMessagesCodec(void); /// Changes the camera used while recording video. /// /// This should only be called while video recording is active. -- (void)updateDescriptionWhileRecordingCameraName:(NSString *)cameraName completion:(void (^)(FlutterError *_Nullable))completion; +- (void)updateDescriptionWhileRecordingCameraName:(NSString *)cameraName + completion:(void (^)(FlutterError *_Nullable))completion; /// Sets the file format used for taking pictures. -- (void)setImageFileFormat:(FCPPlatformImageFileFormat)format completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setImageFileFormat:(FCPPlatformImageFileFormat)format + completion:(void (^)(FlutterError *_Nullable))completion; @end -extern void SetUpFCPCameraApi(id binaryMessenger, NSObject *_Nullable api); - -extern void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSObject *_Nullable api, NSString *messageChannelSuffix); +extern void SetUpFCPCameraApi(id binaryMessenger, + NSObject *_Nullable api); +extern void SetUpFCPCameraApiWithSuffix(id binaryMessenger, + NSObject *_Nullable api, + NSString *messageChannelSuffix); /// Handler for native callbacks that are not tied to a specific camera ID. @interface FCPCameraGlobalEventApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger messageChannelSuffix:(nullable NSString *)messageChannelSuffix; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + messageChannelSuffix:(nullable NSString *)messageChannelSuffix; /// Called when the device's physical orientation changes. -- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)orientation completion:(void (^)(FlutterError *_Nullable))completion; +- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)orientation + completion:(void (^)(FlutterError *_Nullable))completion; @end - /// Handler for native callbacks that are tied to a specific camera ID. /// /// This is intended to be initialized with the camera ID as a suffix. @interface FCPCameraEventApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger messageChannelSuffix:(nullable NSString *)messageChannelSuffix; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + messageChannelSuffix:(nullable NSString *)messageChannelSuffix; /// Called when the camera is inialitized for use. -- (void)initializedWithState:(FCPPlatformCameraState *)initialState completion:(void (^)(FlutterError *_Nullable))completion; +- (void)initializedWithState:(FCPPlatformCameraState *)initialState + completion:(void (^)(FlutterError *_Nullable))completion; /// Called when an error occurs in the camera. /// /// This should be used for errors that occur outside of the context of diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m index 7f63258c48f0..6fd130e922c0 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m @@ -26,7 +26,12 @@ } static FlutterError *createConnectionError(NSString *channelName) { - return [FlutterError errorWithCode:@"channel-error" message:[NSString stringWithFormat:@"%@/%@/%@", @"Unable to establish connection on channel: '", channelName, @"'."] details:@""]; + return [FlutterError + errorWithCode:@"channel-error" + message:[NSString stringWithFormat:@"%@/%@/%@", + @"Unable to establish connection on channel: '", + channelName, @"'."] + details:@""]; } static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { @@ -157,9 +162,9 @@ + (nullable FCPPlatformSize *)nullableFromList:(NSArray *)list; @implementation FCPPlatformCameraDescription + (instancetype)makeWithName:(NSString *)name - lensDirection:(FCPPlatformCameraLensDirection)lensDirection - lensType:(FCPPlatformCameraLensType)lensType { - FCPPlatformCameraDescription* pigeonResult = [[FCPPlatformCameraDescription alloc] init]; + lensDirection:(FCPPlatformCameraLensDirection)lensDirection + lensType:(FCPPlatformCameraLensType)lensType { + FCPPlatformCameraDescription *pigeonResult = [[FCPPlatformCameraDescription alloc] init]; pigeonResult.name = name; pigeonResult.lensDirection = lensDirection; pigeonResult.lensType = lensType; @@ -168,7 +173,8 @@ + (instancetype)makeWithName:(NSString *)name + (FCPPlatformCameraDescription *)fromList:(NSArray *)list { FCPPlatformCameraDescription *pigeonResult = [[FCPPlatformCameraDescription alloc] init]; pigeonResult.name = GetNullableObjectAtIndex(list, 0); - FCPPlatformCameraLensDirectionBox *boxedFCPPlatformCameraLensDirection = GetNullableObjectAtIndex(list, 1); + FCPPlatformCameraLensDirectionBox *boxedFCPPlatformCameraLensDirection = + GetNullableObjectAtIndex(list, 1); pigeonResult.lensDirection = boxedFCPPlatformCameraLensDirection.value; FCPPlatformCameraLensTypeBox *boxedFCPPlatformCameraLensType = GetNullableObjectAtIndex(list, 2); pigeonResult.lensType = boxedFCPPlatformCameraLensType.value; @@ -188,11 +194,11 @@ + (nullable FCPPlatformCameraDescription *)nullableFromList:(NSArray *)list @implementation FCPPlatformCameraState + (instancetype)makeWithPreviewSize:(FCPPlatformSize *)previewSize - exposureMode:(FCPPlatformExposureMode)exposureMode - focusMode:(FCPPlatformFocusMode)focusMode - exposurePointSupported:(BOOL )exposurePointSupported - focusPointSupported:(BOOL )focusPointSupported { - FCPPlatformCameraState* pigeonResult = [[FCPPlatformCameraState alloc] init]; + exposureMode:(FCPPlatformExposureMode)exposureMode + focusMode:(FCPPlatformFocusMode)focusMode + exposurePointSupported:(BOOL)exposurePointSupported + focusPointSupported:(BOOL)focusPointSupported { + FCPPlatformCameraState *pigeonResult = [[FCPPlatformCameraState alloc] init]; pigeonResult.previewSize = previewSize; pigeonResult.exposureMode = exposureMode; pigeonResult.focusMode = focusMode; @@ -227,11 +233,11 @@ + (nullable FCPPlatformCameraState *)nullableFromList:(NSArray *)list { @implementation FCPPlatformMediaSettings + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolutionPreset - framesPerSecond:(nullable NSNumber *)framesPerSecond - videoBitrate:(nullable NSNumber *)videoBitrate - audioBitrate:(nullable NSNumber *)audioBitrate - enableAudio:(BOOL )enableAudio { - FCPPlatformMediaSettings* pigeonResult = [[FCPPlatformMediaSettings alloc] init]; + framesPerSecond:(nullable NSNumber *)framesPerSecond + videoBitrate:(nullable NSNumber *)videoBitrate + audioBitrate:(nullable NSNumber *)audioBitrate + enableAudio:(BOOL)enableAudio { + FCPPlatformMediaSettings *pigeonResult = [[FCPPlatformMediaSettings alloc] init]; pigeonResult.resolutionPreset = resolutionPreset; pigeonResult.framesPerSecond = framesPerSecond; pigeonResult.videoBitrate = videoBitrate; @@ -241,7 +247,8 @@ + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolution } + (FCPPlatformMediaSettings *)fromList:(NSArray *)list { FCPPlatformMediaSettings *pigeonResult = [[FCPPlatformMediaSettings alloc] init]; - FCPPlatformResolutionPresetBox *boxedFCPPlatformResolutionPreset = GetNullableObjectAtIndex(list, 0); + FCPPlatformResolutionPresetBox *boxedFCPPlatformResolutionPreset = + GetNullableObjectAtIndex(list, 0); pigeonResult.resolutionPreset = boxedFCPPlatformResolutionPreset.value; pigeonResult.framesPerSecond = GetNullableObjectAtIndex(list, 1); pigeonResult.videoBitrate = GetNullableObjectAtIndex(list, 2); @@ -264,9 +271,8 @@ + (nullable FCPPlatformMediaSettings *)nullableFromList:(NSArray *)list { @end @implementation FCPPlatformPoint -+ (instancetype)makeWithX:(double )x - y:(double )y { - FCPPlatformPoint* pigeonResult = [[FCPPlatformPoint alloc] init]; ++ (instancetype)makeWithX:(double)x y:(double)y { + FCPPlatformPoint *pigeonResult = [[FCPPlatformPoint alloc] init]; pigeonResult.x = x; pigeonResult.y = y; return pigeonResult; @@ -289,9 +295,8 @@ + (nullable FCPPlatformPoint *)nullableFromList:(NSArray *)list { @end @implementation FCPPlatformSize -+ (instancetype)makeWithWidth:(double )width - height:(double )height { - FCPPlatformSize* pigeonResult = [[FCPPlatformSize alloc] init]; ++ (instancetype)makeWithWidth:(double)width height:(double)height { + FCPPlatformSize *pigeonResult = [[FCPPlatformSize alloc] init]; pigeonResult.width = width; pigeonResult.height = height; return pigeonResult; @@ -320,49 +325,67 @@ - (nullable id)readValueOfType:(UInt8)type { switch (type) { case 129: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformCameraLensDirectionBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil + : [[FCPPlatformCameraLensDirectionBox alloc] + initWithValue:[enumAsNumber integerValue]]; } case 130: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformCameraLensTypeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil + ? nil + : [[FCPPlatformCameraLensTypeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 131: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformDeviceOrientationBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil + : [[FCPPlatformDeviceOrientationBox alloc] + initWithValue:[enumAsNumber integerValue]]; } case 132: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformExposureModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil + ? nil + : [[FCPPlatformExposureModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 133: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformFlashModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil + ? nil + : [[FCPPlatformFlashModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 134: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformFocusModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil + ? nil + : [[FCPPlatformFocusModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 135: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformImageFileFormatBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil + : [[FCPPlatformImageFileFormatBox alloc] + initWithValue:[enumAsNumber integerValue]]; } case 136: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformImageFormatGroupBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil + : [[FCPPlatformImageFormatGroupBox alloc] + initWithValue:[enumAsNumber integerValue]]; } case 137: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformResolutionPresetBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil + : [[FCPPlatformResolutionPresetBox alloc] + initWithValue:[enumAsNumber integerValue]]; } - case 138: + case 138: return [FCPPlatformCameraDescription fromList:[self readValue]]; - case 139: + case 139: return [FCPPlatformCameraState fromList:[self readValue]]; - case 140: + case 140: return [FCPPlatformMediaSettings fromList:[self readValue]]; - case 141: + case 141: return [FCPPlatformPoint fromList:[self readValue]]; - case 142: + case 142: return [FCPPlatformSize fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -446,7 +469,8 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FCPMessagesPigeonCodecReaderWriter *readerWriter = [[FCPMessagesPigeonCodecReaderWriter alloc] init]; + FCPMessagesPigeonCodecReaderWriter *readerWriter = + [[FCPMessagesPigeonCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; @@ -455,19 +479,29 @@ void SetUpFCPCameraApi(id binaryMessenger, NSObject binaryMessenger, NSObject *api, NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 ? [NSString stringWithFormat: @".%@", messageChannelSuffix] : @""; +void SetUpFCPCameraApiWithSuffix(id binaryMessenger, + NSObject *api, NSString *messageChannelSuffix) { + messageChannelSuffix = messageChannelSuffix.length > 0 + ? [NSString stringWithFormat:@".%@", messageChannelSuffix] + : @""; /// Returns the list of available cameras. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.getAvailableCameras", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(availableCamerasWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(availableCamerasWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(availableCamerasWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(availableCamerasWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api availableCamerasWithCompletion:^(NSArray *_Nullable output, FlutterError *_Nullable error) { + [api availableCamerasWithCompletion:^( + NSArray *_Nullable output, + FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -477,20 +511,27 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Create a new camera with the given settings, and returns its ID. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.create", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.create", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createCameraWithName:settings:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(createCameraWithName:settings:completion:)", api); + NSCAssert([api respondsToSelector:@selector(createCameraWithName:settings:completion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(createCameraWithName:settings:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_cameraName = GetNullableObjectAtIndex(args, 0); FCPPlatformMediaSettings *arg_settings = GetNullableObjectAtIndex(args, 1); - [api createCameraWithName:arg_cameraName settings:arg_settings completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api createCameraWithName:arg_cameraName + settings:arg_settings + completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -498,21 +539,30 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Initializes the camera with the given ID. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + [NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(initializeCamera:withImageFormat:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(initializeCamera:withImageFormat:completion:)", api); + NSCAssert([api respondsToSelector:@selector(initializeCamera:withImageFormat:completion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(initializeCamera:withImageFormat:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSInteger arg_cameraId = [GetNullableObjectAtIndex(args, 0) integerValue]; - FCPPlatformImageFormatGroupBox *boxedFCPPlatformImageFormatGroup = GetNullableObjectAtIndex(args, 1); + FCPPlatformImageFormatGroupBox *boxedFCPPlatformImageFormatGroup = + GetNullableObjectAtIndex(args, 1); FCPPlatformImageFormatGroup arg_imageFormat = boxedFCPPlatformImageFormatGroup.value; - [api initializeCamera:arg_cameraId withImageFormat:arg_imageFormat completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api initializeCamera:arg_cameraId + withImageFormat:arg_imageFormat + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -520,13 +570,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Begins streaming frames from the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.startImageStream", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(startImageStreamWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(startImageStreamWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(startImageStreamWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(startImageStreamWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api startImageStreamWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -538,13 +593,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Stops streaming frames from the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(stopImageStreamWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(stopImageStreamWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(stopImageStreamWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(stopImageStreamWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api stopImageStreamWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -559,13 +620,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// /// This is used to throttle sending frames across the channel. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.receivedImageStreamData", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(receivedImageStreamDataWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(receivedImageStreamDataWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(receivedImageStreamDataWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(receivedImageStreamDataWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api receivedImageStreamDataWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -578,19 +644,24 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// Indicates that the given camera is no longer being used on the Dart side, /// and any associated resources can be cleaned up. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(disposeCamera:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(disposeCamera:completion:)", api); + NSCAssert([api respondsToSelector:@selector(disposeCamera:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(disposeCamera:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSInteger arg_cameraId = [GetNullableObjectAtIndex(args, 0) integerValue]; - [api disposeCamera:arg_cameraId completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api disposeCamera:arg_cameraId + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -598,20 +669,27 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Locks the camera capture to the current device orientation. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.lockCaptureOrientation", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(lockCaptureOrientation:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(lockCaptureOrientation:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector(lockCaptureOrientation:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(lockCaptureOrientation:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FCPPlatformDeviceOrientationBox *boxedFCPPlatformDeviceOrientation = GetNullableObjectAtIndex(args, 0); + FCPPlatformDeviceOrientationBox *boxedFCPPlatformDeviceOrientation = + GetNullableObjectAtIndex(args, 0); FCPPlatformDeviceOrientation arg_orientation = boxedFCPPlatformDeviceOrientation.value; - [api lockCaptureOrientation:arg_orientation completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api lockCaptureOrientation:arg_orientation + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -620,13 +698,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.unlockCaptureOrientation", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(unlockCaptureOrientationWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(unlockCaptureOrientationWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(unlockCaptureOrientationWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(unlockCaptureOrientationWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api unlockCaptureOrientationWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -639,17 +722,23 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// Takes a picture with the current settings, and returns the path to the /// resulting file. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + [NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(takePictureWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(takePictureWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(takePictureWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(takePictureWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api takePictureWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api + takePictureWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -657,13 +746,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Does any preprocessing necessary before beginning to record video. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.prepareForVideoRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(prepareForVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(prepareForVideoRecordingWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(prepareForVideoRecordingWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(prepareForVideoRecordingWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api prepareForVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -676,19 +770,25 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// Begins recording video, optionally enabling streaming to Dart at the same /// time. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.startVideoRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(startVideoRecordingWithStreaming:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(startVideoRecordingWithStreaming:completion:)", api); + NSCAssert([api respondsToSelector:@selector(startVideoRecordingWithStreaming:completion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(startVideoRecordingWithStreaming:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; BOOL arg_enableStream = [GetNullableObjectAtIndex(args, 0) boolValue]; - [api startVideoRecordingWithStreaming:arg_enableStream completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api startVideoRecordingWithStreaming:arg_enableStream + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -696,15 +796,21 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Stops recording video, and results the path to the resulting file. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.stopVideoRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(stopVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(stopVideoRecordingWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(stopVideoRecordingWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(stopVideoRecordingWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api stopVideoRecordingWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { + [api stopVideoRecordingWithCompletion:^(NSString *_Nullable output, + FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -714,13 +820,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Pauses video recording. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.pauseVideoRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(pauseVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(pauseVideoRecordingWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(pauseVideoRecordingWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(pauseVideoRecordingWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api pauseVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -732,13 +843,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Resumes a previously paused video recording. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.resumeVideoRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(resumeVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(resumeVideoRecordingWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(resumeVideoRecordingWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(resumeVideoRecordingWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api resumeVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -750,20 +866,26 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Switches the camera to the given flash mode. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFlashMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFlashMode:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setFlashMode:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setFlashMode:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformFlashModeBox *boxedFCPPlatformFlashMode = GetNullableObjectAtIndex(args, 0); FCPPlatformFlashMode arg_mode = boxedFCPPlatformFlashMode.value; - [api setFlashMode:arg_mode completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFlashMode:arg_mode + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -771,20 +893,27 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Switches the camera to the given exposure mode. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposureMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureMode:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setExposureMode:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureMode:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FCPPlatformExposureModeBox *boxedFCPPlatformExposureMode = GetNullableObjectAtIndex(args, 0); + FCPPlatformExposureModeBox *boxedFCPPlatformExposureMode = + GetNullableObjectAtIndex(args, 0); FCPPlatformExposureMode arg_mode = boxedFCPPlatformExposureMode.value; - [api setExposureMode:arg_mode completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposureMode:arg_mode + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -794,19 +923,24 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// /// A null value resets to the default exposure point. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.setExposurePoint", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposurePoint:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposurePoint:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setExposurePoint:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setExposurePoint:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformPoint *arg_point = GetNullableObjectAtIndex(args, 0); - [api setExposurePoint:arg_point completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposurePoint:arg_point + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -814,13 +948,17 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Returns the minimum exposure offset supported by the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.getMinExposureOffset", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMinimumExposureOffset:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumExposureOffset:)", api); + NSCAssert([api respondsToSelector:@selector(getMinimumExposureOffset:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumExposureOffset:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMinimumExposureOffset:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -832,13 +970,17 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Returns the maximum exposure offset supported by the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.getMaxExposureOffset", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMaximumExposureOffset:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumExposureOffset:)", api); + NSCAssert([api respondsToSelector:@selector(getMaximumExposureOffset:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumExposureOffset:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMaximumExposureOffset:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -850,19 +992,25 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Sets the exposure offset manually to the given value. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.setExposureOffset", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposureOffset:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureOffset:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector(setExposureOffset:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureOffset:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; double arg_offset = [GetNullableObjectAtIndex(args, 0) doubleValue]; - [api setExposureOffset:arg_offset completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposureOffset:arg_offset + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -870,20 +1018,26 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Switches the camera to the given focus mode. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFocusMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusMode:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setFocusMode:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusMode:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformFocusModeBox *boxedFCPPlatformFocusMode = GetNullableObjectAtIndex(args, 0); FCPPlatformFocusMode arg_mode = boxedFCPPlatformFocusMode.value; - [api setFocusMode:arg_mode completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFocusMode:arg_mode + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -893,19 +1047,25 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// /// A null value resets to the default focus point. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFocusPoint:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusPoint:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setFocusPoint:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusPoint:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformPoint *arg_point = GetNullableObjectAtIndex(args, 0); - [api setFocusPoint:arg_point completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFocusPoint:arg_point + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -913,13 +1073,17 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Returns the minimum zoom level supported by the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMinimumZoomLevel:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumZoomLevel:)", api); + NSCAssert([api respondsToSelector:@selector(getMinimumZoomLevel:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumZoomLevel:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMinimumZoomLevel:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -931,13 +1095,17 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Returns the maximum zoom level supported by the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMaximumZoomLevel:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumZoomLevel:)", api); + NSCAssert([api respondsToSelector:@selector(getMaximumZoomLevel:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumZoomLevel:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMaximumZoomLevel:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -949,19 +1117,25 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Sets the zoom factor. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setZoomLevel:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setZoomLevel:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setZoomLevel:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setZoomLevel:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; double arg_zoom = [GetNullableObjectAtIndex(args, 0) doubleValue]; - [api setZoomLevel:arg_zoom completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setZoomLevel:arg_zoom + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -969,13 +1143,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Pauses streaming of preview frames. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(pausePreviewWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(pausePreviewWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(pausePreviewWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(pausePreviewWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api pausePreviewWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -987,13 +1166,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Resumes a previously paused preview stream. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(resumePreviewWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(resumePreviewWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(resumePreviewWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(resumePreviewWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api resumePreviewWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -1007,19 +1191,26 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// /// This should only be called while video recording is active. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.updateDescriptionWhileRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(updateDescriptionWhileRecordingCameraName:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(updateDescriptionWhileRecordingCameraName:completion:)", api); + NSCAssert([api respondsToSelector:@selector(updateDescriptionWhileRecordingCameraName: + completion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(updateDescriptionWhileRecordingCameraName:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_cameraName = GetNullableObjectAtIndex(args, 0); - [api updateDescriptionWhileRecordingCameraName:arg_cameraName completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api updateDescriptionWhileRecordingCameraName:arg_cameraName + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1027,20 +1218,27 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Sets the file format used for taking pictures. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.setImageFileFormat", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setImageFileFormat:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setImageFileFormat:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector(setImageFileFormat:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setImageFileFormat:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FCPPlatformImageFileFormatBox *boxedFCPPlatformImageFileFormat = GetNullableObjectAtIndex(args, 0); + FCPPlatformImageFileFormatBox *boxedFCPPlatformImageFileFormat = + GetNullableObjectAtIndex(args, 0); FCPPlatformImageFileFormat arg_format = boxedFCPPlatformImageFileFormat.value; - [api setImageFileFormat:arg_format completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setImageFileFormat:arg_format + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1057,32 +1255,42 @@ @implementation FCPCameraGlobalEventApi - (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""]; } -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger messageChannelSuffix:(nullable NSString*)messageChannelSuffix{ +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger + messageChannelSuffix:(nullable NSString *)messageChannelSuffix { self = [self init]; if (self) { _binaryMessenger = binaryMessenger; - _messageChannelSuffix = [messageChannelSuffix length] == 0 ? @"" : [NSString stringWithFormat: @".%@", messageChannelSuffix]; + _messageChannelSuffix = [messageChannelSuffix length] == 0 + ? @"" + : [NSString stringWithFormat:@".%@", messageChannelSuffix]; } return self; } -- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)arg_orientation completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged", _messageChannelSuffix]; +- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)arg_orientation + completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged", + _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPGetMessagesCodec()]; - [channel sendMessage:@[[[FCPPlatformDeviceOrientationBox alloc] initWithValue:arg_orientation]] reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPGetMessagesCodec()]; + [channel sendMessage:@[ [[FCPPlatformDeviceOrientationBox alloc] initWithValue:arg_orientation] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } @end @@ -1096,51 +1304,64 @@ @implementation FCPCameraEventApi - (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""]; } -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger messageChannelSuffix:(nullable NSString*)messageChannelSuffix{ +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger + messageChannelSuffix:(nullable NSString *)messageChannelSuffix { self = [self init]; if (self) { _binaryMessenger = binaryMessenger; - _messageChannelSuffix = [messageChannelSuffix length] == 0 ? @"" : [NSString stringWithFormat: @".%@", messageChannelSuffix]; + _messageChannelSuffix = [messageChannelSuffix length] == 0 + ? @"" + : [NSString stringWithFormat:@".%@", messageChannelSuffix]; } return self; } -- (void)initializedWithState:(FCPPlatformCameraState *)arg_initialState completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized", _messageChannelSuffix]; +- (void)initializedWithState:(FCPPlatformCameraState *)arg_initialState + completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized", + _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPGetMessagesCodec()]; - [channel sendMessage:@[arg_initialState ?: [NSNull null]] reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPGetMessagesCodec()]; + [channel sendMessage:@[ arg_initialState ?: [NSNull null] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } -- (void)reportError:(NSString *)arg_message completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error", _messageChannelSuffix]; +- (void)reportError:(NSString *)arg_message + completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString + stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error", + _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPGetMessagesCodec()]; - [channel sendMessage:@[arg_message ?: [NSNull null]] reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPGetMessagesCodec()]; + [channel sendMessage:@[ arg_message ?: [NSNull null] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } @end - diff --git a/packages/camera/camera_avfoundation/lib/src/messages.g.dart b/packages/camera/camera_avfoundation/lib/src/messages.g.dart index a49a854a12c2..371f5899bba2 100644 --- a/packages/camera/camera_avfoundation/lib/src/messages.g.dart +++ b/packages/camera/camera_avfoundation/lib/src/messages.g.dart @@ -18,7 +18,8 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse( + {Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -31,8 +32,10 @@ List wrapResponse({Object? result, PlatformException? error, bool empty enum PlatformCameraLensDirection { /// Front facing camera (a user looking at the screen is seen by the camera). front, + /// Back facing camera (a user looking at the screen is not seen by the camera). back, + /// External camera which may not be mounted to the device. external, } @@ -40,10 +43,13 @@ enum PlatformCameraLensDirection { enum PlatformCameraLensType { /// A built-in wide-angle camera device type. wide, + /// A built-in camera device type with a longer focal length than a wide-angle camera. telephoto, + /// A built-in camera device type with a shorter focal length than a wide-angle camera. ultraWide, + /// Unknown camera device type. unknown, } @@ -265,7 +271,6 @@ class PlatformSize { } } - class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -273,46 +278,46 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is PlatformCameraLensDirection) { + } else if (value is PlatformCameraLensDirection) { buffer.putUint8(129); writeValue(buffer, value.index); - } else if (value is PlatformCameraLensType) { + } else if (value is PlatformCameraLensType) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is PlatformDeviceOrientation) { + } else if (value is PlatformDeviceOrientation) { buffer.putUint8(131); writeValue(buffer, value.index); - } else if (value is PlatformExposureMode) { + } else if (value is PlatformExposureMode) { buffer.putUint8(132); writeValue(buffer, value.index); - } else if (value is PlatformFlashMode) { + } else if (value is PlatformFlashMode) { buffer.putUint8(133); writeValue(buffer, value.index); - } else if (value is PlatformFocusMode) { + } else if (value is PlatformFocusMode) { buffer.putUint8(134); writeValue(buffer, value.index); - } else if (value is PlatformImageFileFormat) { + } else if (value is PlatformImageFileFormat) { buffer.putUint8(135); writeValue(buffer, value.index); - } else if (value is PlatformImageFormatGroup) { + } else if (value is PlatformImageFormatGroup) { buffer.putUint8(136); writeValue(buffer, value.index); - } else if (value is PlatformResolutionPreset) { + } else if (value is PlatformResolutionPreset) { buffer.putUint8(137); writeValue(buffer, value.index); - } else if (value is PlatformCameraDescription) { + } else if (value is PlatformCameraDescription) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value is PlatformCameraState) { + } else if (value is PlatformCameraState) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is PlatformMediaSettings) { + } else if (value is PlatformMediaSettings) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is PlatformPoint) { + } else if (value is PlatformPoint) { buffer.putUint8(141); writeValue(buffer, value.encode()); - } else if (value is PlatformSize) { + } else if (value is PlatformSize) { buffer.putUint8(142); writeValue(buffer, value.encode()); } else { @@ -323,42 +328,42 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: + case 129: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformCameraLensDirection.values[value]; - case 130: + case 130: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformCameraLensType.values[value]; - case 131: + case 131: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformDeviceOrientation.values[value]; - case 132: + case 132: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformExposureMode.values[value]; - case 133: + case 133: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformFlashMode.values[value]; - case 134: + case 134: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformFocusMode.values[value]; - case 135: + case 135: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformImageFileFormat.values[value]; - case 136: + case 136: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformImageFormatGroup.values[value]; - case 137: + case 137: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformResolutionPreset.values[value]; - case 138: + case 138: return PlatformCameraDescription.decode(readValue(buffer)!); - case 139: + case 139: return PlatformCameraState.decode(readValue(buffer)!); - case 140: + case 140: return PlatformMediaSettings.decode(readValue(buffer)!); - case 141: + case 141: return PlatformPoint.decode(readValue(buffer)!); - case 142: + case 142: return PlatformSize.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -370,9 +375,11 @@ class CameraApi { /// Constructor for [CameraApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - CameraApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + CameraApi( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -381,8 +388,10 @@ class CameraApi { /// Returns the list of available cameras. Future> getAvailableCameras() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -403,20 +412,23 @@ class CameraApi { message: 'Host platform returned null value for non-null return value.', ); } else { - return (pigeonVar_replyList[0] as List?)!.cast(); + return (pigeonVar_replyList[0] as List?)! + .cast(); } } /// Create a new camera with the given settings, and returns its ID. Future create(String cameraName, PlatformMediaSettings settings) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.create$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.create$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([cameraName, settings]) as List?; + final List? pigeonVar_replyList = await pigeonVar_channel + .send([cameraName, settings]) as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -436,15 +448,18 @@ class CameraApi { } /// Initializes the camera with the given ID. - Future initialize(int cameraId, PlatformImageFormatGroup imageFormat) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + Future initialize( + int cameraId, PlatformImageFormatGroup imageFormat) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([cameraId, imageFormat]) as List?; + final List? pigeonVar_replyList = await pigeonVar_channel + .send([cameraId, imageFormat]) as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -460,8 +475,10 @@ class CameraApi { /// Begins streaming frames from the camera. Future startImageStream() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -483,8 +500,10 @@ class CameraApi { /// Stops streaming frames from the camera. Future stopImageStream() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -509,8 +528,10 @@ class CameraApi { /// /// This is used to throttle sending frames across the channel. Future receivedImageStreamData() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -533,8 +554,10 @@ class CameraApi { /// Indicates that the given camera is no longer being used on the Dart side, /// and any associated resources can be cleaned up. Future dispose(int cameraId) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -555,9 +578,12 @@ class CameraApi { } /// Locks the camera capture to the current device orientation. - Future lockCaptureOrientation(PlatformDeviceOrientation orientation) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + Future lockCaptureOrientation( + PlatformDeviceOrientation orientation) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -580,8 +606,10 @@ class CameraApi { /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. Future unlockCaptureOrientation() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -604,8 +632,10 @@ class CameraApi { /// Takes a picture with the current settings, and returns the path to the /// resulting file. Future takePicture() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -632,8 +662,10 @@ class CameraApi { /// Does any preprocessing necessary before beginning to record video. Future prepareForVideoRecording() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -656,8 +688,10 @@ class CameraApi { /// Begins recording video, optionally enabling streaming to Dart at the same /// time. Future startVideoRecording(bool enableStream) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -679,8 +713,10 @@ class CameraApi { /// Stops recording video, and results the path to the resulting file. Future stopVideoRecording() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -707,8 +743,10 @@ class CameraApi { /// Pauses video recording. Future pauseVideoRecording() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -730,8 +768,10 @@ class CameraApi { /// Resumes a previously paused video recording. Future resumeVideoRecording() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -753,8 +793,10 @@ class CameraApi { /// Switches the camera to the given flash mode. Future setFlashMode(PlatformFlashMode mode) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -776,8 +818,10 @@ class CameraApi { /// Switches the camera to the given exposure mode. Future setExposureMode(PlatformExposureMode mode) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -801,8 +845,10 @@ class CameraApi { /// /// A null value resets to the default exposure point. Future setExposurePoint(PlatformPoint? point) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -824,8 +870,10 @@ class CameraApi { /// Returns the minimum exposure offset supported by the camera. Future getMinExposureOffset() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -852,8 +900,10 @@ class CameraApi { /// Returns the maximum exposure offset supported by the camera. Future getMaxExposureOffset() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -880,8 +930,10 @@ class CameraApi { /// Sets the exposure offset manually to the given value. Future setExposureOffset(double offset) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -903,8 +955,10 @@ class CameraApi { /// Switches the camera to the given focus mode. Future setFocusMode(PlatformFocusMode mode) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -928,8 +982,10 @@ class CameraApi { /// /// A null value resets to the default focus point. Future setFocusPoint(PlatformPoint? point) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -951,8 +1007,10 @@ class CameraApi { /// Returns the minimum zoom level supported by the camera. Future getMinZoomLevel() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -979,8 +1037,10 @@ class CameraApi { /// Returns the maximum zoom level supported by the camera. Future getMaxZoomLevel() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1007,8 +1067,10 @@ class CameraApi { /// Sets the zoom factor. Future setZoomLevel(double zoom) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1030,8 +1092,10 @@ class CameraApi { /// Pauses streaming of preview frames. Future pausePreview() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1053,8 +1117,10 @@ class CameraApi { /// Resumes a previously paused preview stream. Future resumePreview() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1078,8 +1144,10 @@ class CameraApi { /// /// This should only be called while video recording is active. Future updateDescriptionWhileRecording(String cameraName) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1101,8 +1169,10 @@ class CameraApi { /// Sets the file format used for taking pictures. Future setImageFileFormat(PlatformImageFileFormat format) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1130,20 +1200,29 @@ abstract class CameraGlobalEventApi { /// Called when the device's physical orientation changes. void deviceOrientationChanged(PlatformDeviceOrientation orientation); - static void setUp(CameraGlobalEventApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { - messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp( + CameraGlobalEventApi? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged$messageChannelSuffix', pigeonChannelCodec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null.'); final List args = (message as List?)!; - final PlatformDeviceOrientation? arg_orientation = (args[0] as PlatformDeviceOrientation?); + final PlatformDeviceOrientation? arg_orientation = + (args[0] as PlatformDeviceOrientation?); assert(arg_orientation != null, 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null, expected non-null PlatformDeviceOrientation.'); try { @@ -1151,8 +1230,9 @@ abstract class CameraGlobalEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); } }); } @@ -1203,20 +1283,29 @@ abstract class CameraEventApi { /// handling a specific HostApi call, such as during streaming. void error(String message); - static void setUp(CameraEventApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { - messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp( + CameraEventApi? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized$messageChannelSuffix', pigeonChannelCodec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null.'); final List args = (message as List?)!; - final PlatformCameraState? arg_initialState = (args[0] as PlatformCameraState?); + final PlatformCameraState? arg_initialState = + (args[0] as PlatformCameraState?); assert(arg_initialState != null, 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null, expected non-null PlatformCameraState.'); try { @@ -1224,22 +1313,26 @@ abstract class CameraEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); } }); } } { - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error$messageChannelSuffix', pigeonChannelCodec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error was null.'); final List args = (message as List?)!; final String? arg_message = (args[0] as String?); assert(arg_message != null, @@ -1249,8 +1342,9 @@ abstract class CameraEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); } }); } From 5a69630e73d0094abb2417319a8a313c25a72662 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Tue, 1 Apr 2025 15:30:21 -0400 Subject: [PATCH 17/25] Remove unnecessary pubspec changes Removed the changes to the pubspecs in the packages that have no other changes (the Android, web, and Windows) --- packages/camera/camera_android/example/pubspec.yaml | 5 ----- packages/camera/camera_android/pubspec.yaml | 5 ----- packages/camera/camera_android_camerax/example/pubspec.yaml | 5 ----- packages/camera/camera_android_camerax/pubspec.yaml | 5 ----- packages/camera/camera_web/example/pubspec.yaml | 5 ----- packages/camera/camera_web/pubspec.yaml | 5 ----- packages/camera/camera_windows/example/pubspec.yaml | 5 ----- packages/camera/camera_windows/pubspec.yaml | 5 ----- 8 files changed, 40 deletions(-) diff --git a/packages/camera/camera_android/example/pubspec.yaml b/packages/camera/camera_android/example/pubspec.yaml index abff371918d0..9c8f8476d0b5 100644 --- a/packages/camera/camera_android/example/pubspec.yaml +++ b/packages/camera/camera_android/example/pubspec.yaml @@ -31,8 +31,3 @@ dev_dependencies: flutter: uses-material-design: true - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - {camera_platform_interface: {path: ../../../camera/camera_platform_interface}} diff --git a/packages/camera/camera_android/pubspec.yaml b/packages/camera/camera_android/pubspec.yaml index e78da63d88b9..f813858fd620 100644 --- a/packages/camera/camera_android/pubspec.yaml +++ b/packages/camera/camera_android/pubspec.yaml @@ -36,8 +36,3 @@ dev_dependencies: topics: - camera - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - {camera_platform_interface: {path: ../../camera/camera_platform_interface}} diff --git a/packages/camera/camera_android_camerax/example/pubspec.yaml b/packages/camera/camera_android_camerax/example/pubspec.yaml index 51daaacefdbd..627360153368 100644 --- a/packages/camera/camera_android_camerax/example/pubspec.yaml +++ b/packages/camera/camera_android_camerax/example/pubspec.yaml @@ -29,8 +29,3 @@ dev_dependencies: flutter: uses-material-design: true -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - {camera_platform_interface: {path: ../../../camera/camera_platform_interface}} - diff --git a/packages/camera/camera_android_camerax/pubspec.yaml b/packages/camera/camera_android_camerax/pubspec.yaml index edeed105aaf7..c611b2f69b49 100644 --- a/packages/camera/camera_android_camerax/pubspec.yaml +++ b/packages/camera/camera_android_camerax/pubspec.yaml @@ -35,8 +35,3 @@ dev_dependencies: topics: - camera - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - {camera_platform_interface: {path: ../../camera/camera_platform_interface}} diff --git a/packages/camera/camera_web/example/pubspec.yaml b/packages/camera/camera_web/example/pubspec.yaml index 16ba077a600d..8305d8434abf 100644 --- a/packages/camera/camera_web/example/pubspec.yaml +++ b/packages/camera/camera_web/example/pubspec.yaml @@ -26,8 +26,3 @@ dev_dependencies: integration_test: sdk: flutter mocktail: 0.3.0 - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - {camera_platform_interface: {path: ../../../camera/camera_platform_interface}} diff --git a/packages/camera/camera_web/pubspec.yaml b/packages/camera/camera_web/pubspec.yaml index 22a40ab27bd2..4052a701b86b 100644 --- a/packages/camera/camera_web/pubspec.yaml +++ b/packages/camera/camera_web/pubspec.yaml @@ -31,8 +31,3 @@ dev_dependencies: topics: - camera - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - {camera_platform_interface: {path: ../../camera/camera_platform_interface}} diff --git a/packages/camera/camera_windows/example/pubspec.yaml b/packages/camera/camera_windows/example/pubspec.yaml index ed1a039b5977..7eabccf3d652 100644 --- a/packages/camera/camera_windows/example/pubspec.yaml +++ b/packages/camera/camera_windows/example/pubspec.yaml @@ -27,8 +27,3 @@ dev_dependencies: flutter: uses-material-design: true - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - {camera_platform_interface: {path: ../../../camera/camera_platform_interface}} diff --git a/packages/camera/camera_windows/pubspec.yaml b/packages/camera/camera_windows/pubspec.yaml index aaefde4fcd51..d66f36f2550c 100644 --- a/packages/camera/camera_windows/pubspec.yaml +++ b/packages/camera/camera_windows/pubspec.yaml @@ -34,8 +34,3 @@ dev_dependencies: topics: - camera - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - {camera_platform_interface: {path: ../../camera/camera_platform_interface}} From 2b797f6cf574d68793881cee882f16b13386f946 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Tue, 1 Apr 2025 15:30:21 -0400 Subject: [PATCH 18/25] Update camera_platform_interface to 2.9.0 and other minor changes --- packages/camera/camera_avfoundation/CHANGELOG.md | 2 +- packages/camera/camera_platform_interface/CHANGELOG.md | 6 +++--- packages/camera/camera_platform_interface/pubspec.yaml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/camera/camera_avfoundation/CHANGELOG.md b/packages/camera/camera_avfoundation/CHANGELOG.md index 1ea8ae2e92a1..ce0595f9993a 100644 --- a/packages/camera/camera_avfoundation/CHANGELOG.md +++ b/packages/camera/camera_avfoundation/CHANGELOG.md @@ -65,8 +65,8 @@ ## 0.9.17+6 -* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. * Adds lensType in the PlatformCameraDescription +* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. ## 0.9.17+5 diff --git a/packages/camera/camera_platform_interface/CHANGELOG.md b/packages/camera/camera_platform_interface/CHANGELOG.md index 9dbb99892988..2d5db83290a2 100644 --- a/packages/camera/camera_platform_interface/CHANGELOG.md +++ b/packages/camera/camera_platform_interface/CHANGELOG.md @@ -1,7 +1,7 @@ -## 2.10.0 +## 2.9.0 -* Updates minimum supported SDK version to Flutter 3.19/Dart 3.3. -* Introduces a new CameraLensType enum to provide lens type information about the camera (e.g.: ultra-wide, telephoto, ...) +* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. +* Introduces a new CameraLensType enum to provide lens type information about the camera (e.g. ultra-wide, telephoto, ...). ## 2.8.0 diff --git a/packages/camera/camera_platform_interface/pubspec.yaml b/packages/camera/camera_platform_interface/pubspec.yaml index 0374bacaa205..bea9eef23194 100644 --- a/packages/camera/camera_platform_interface/pubspec.yaml +++ b/packages/camera/camera_platform_interface/pubspec.yaml @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/camera/camera issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 2.8.1 +version: 2.9.0 environment: sdk: ^3.4.0 From 4b9335cdf5becad3ed8ded95032642e1bbcc6765 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Tue, 1 Apr 2025 15:31:25 -0400 Subject: [PATCH 19/25] Bump camera_platform_interface to 2.10.0 and remove its dependency overrides --- packages/camera/camera/example/pubspec.yaml | 15 +-------------- packages/camera/camera/pubspec.yaml | 8 ++------ .../camera/camera/test/camera_value_test.dart | 18 ++++++++++++++++-- .../camera/camera_avfoundation/CHANGELOG.md | 6 ++++-- .../camera_avfoundation/example/pubspec.yaml | 7 +------ .../include/camera_avfoundation/QueueUtils.h | 2 +- .../camera/camera_avfoundation/pubspec.yaml | 9 ++------- .../camera_platform_interface/CHANGELOG.md | 7 ++++++- .../camera_platform_interface/pubspec.yaml | 2 +- 9 files changed, 34 insertions(+), 40 deletions(-) diff --git a/packages/camera/camera/example/pubspec.yaml b/packages/camera/camera/example/pubspec.yaml index 81feff65e3d9..aff0afef21fe 100644 --- a/packages/camera/camera/example/pubspec.yaml +++ b/packages/camera/camera/example/pubspec.yaml @@ -27,20 +27,7 @@ dev_dependencies: sdk: flutter integration_test: sdk: flutter - - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - - camera: - path: ../../../camera/camera - camera_avfoundation: - path: ../../../camera/camera_avfoundation - camera_platform_interface: - path: ../../../camera/camera_platform_interface - camera_web: - path: ../../camera_web + leak_tracker_flutter_testing: any flutter: uses-material-design: true diff --git a/packages/camera/camera/pubspec.yaml b/packages/camera/camera/pubspec.yaml index ff8f3b2e774d..ce14ee2ed45e 100644 --- a/packages/camera/camera/pubspec.yaml +++ b/packages/camera/camera/pubspec.yaml @@ -23,7 +23,7 @@ flutter: dependencies: camera_android_camerax: ^0.6.13 camera_avfoundation: ^0.9.18 - camera_platform_interface: ^2.9.0 + camera_platform_interface: ^2.10.0 camera_web: ^0.3.3 flutter: sdk: flutter @@ -38,8 +38,4 @@ dev_dependencies: topics: - camera - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - {camera_avfoundation: {path: ../../camera/camera_avfoundation}, camera_platform_interface: {path: ../../camera/camera_platform_interface}} + \ No newline at end of file diff --git a/packages/camera/camera/test/camera_value_test.dart b/packages/camera/camera/test/camera_value_test.dart index 234b4399e307..2c5ff71dcee6 100644 --- a/packages/camera/camera/test/camera_value_test.dart +++ b/packages/camera/camera/test/camera_value_test.dart @@ -146,8 +146,22 @@ void main() { description: FakeController.fakeDescription, ); - expect(cameraValue.toString(), - 'CameraValue(isRecordingVideo: false, isInitialized: false, errorDescription: null, previewSize: Size(10.0, 10.0), isStreamingImages: false, flashMode: FlashMode.auto, exposureMode: ExposureMode.auto, focusMode: FocusMode.auto, exposurePointSupported: true, focusPointSupported: true, deviceOrientation: DeviceOrientation.portraitUp, lockedCaptureOrientation: DeviceOrientation.portraitUp, recordingOrientation: DeviceOrientation.portraitUp, isPreviewPaused: true, previewPausedOrientation: DeviceOrientation.portraitUp, description: CameraDescription(, CameraLensDirection.back, 0, CameraLensType.ultraWide))'); + expect( + cameraValue.toString(), + 'CameraValue(isRecordingVideo: false, isInitialized: false, ' + 'errorDescription: null, previewSize: Size(10.0, 10.0), ' + 'isStreamingImages: false, flashMode: FlashMode.auto, ' + 'exposureMode: ExposureMode.auto, focusMode: FocusMode.auto, ' + 'exposurePointSupported: true, focusPointSupported: true, ' + 'deviceOrientation: DeviceOrientation.portraitUp, ' + 'lockedCaptureOrientation: DeviceOrientation.portraitUp, ' + 'recordingOrientation: DeviceOrientation.portraitUp, ' + 'isPreviewPaused: true, ' + 'previewPausedOrientation: DeviceOrientation.portraitUp, ' + // CameraDescription.toString is defined in the platform interface + // package, so don't assert a specific value for it, only that + // whatever it returns is inserted as expected. + 'description: ${FakeController.fakeDescription})'); }); }); } diff --git a/packages/camera/camera_avfoundation/CHANGELOG.md b/packages/camera/camera_avfoundation/CHANGELOG.md index ce0595f9993a..7a4734dc2b2b 100644 --- a/packages/camera/camera_avfoundation/CHANGELOG.md +++ b/packages/camera/camera_avfoundation/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.9.19 + +* Adds lensType in the PlatformCameraDescription + ## 0.9.18+13 * Migrates test utils and mocks to Swift. @@ -65,7 +69,6 @@ ## 0.9.17+6 -* Adds lensType in the PlatformCameraDescription * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. ## 0.9.17+5 @@ -76,7 +79,6 @@ * Updates Pigeon for non-nullable collection type support. * Updates minimum supported SDK version to Flutter 3.19/Dart 3.3. -* Adds lensType in the PlatformCameraDescription ## 0.9.17+3 diff --git a/packages/camera/camera_avfoundation/example/pubspec.yaml b/packages/camera/camera_avfoundation/example/pubspec.yaml index 1e04dcc8818b..49653bdeec42 100644 --- a/packages/camera/camera_avfoundation/example/pubspec.yaml +++ b/packages/camera/camera_avfoundation/example/pubspec.yaml @@ -14,7 +14,7 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../ - camera_platform_interface: ^2.7.0 + camera_platform_interface: ^2.10.0 flutter: sdk: flutter path_provider: ^2.0.0 @@ -29,8 +29,3 @@ dev_dependencies: flutter: uses-material-design: true - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - {camera_avfoundation: {path: ../../../camera/camera_avfoundation}, camera_platform_interface: {path: ../../../camera/camera_platform_interface}} diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h index e230a53508fa..a7e22da716d0 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h @@ -7,7 +7,7 @@ NS_ASSUME_NONNULL_BEGIN /// Queue-specific context data to be associated with the capture session queue. -extern const char *FLTCaptureSessionQueueSpecific; +extern const char* FLTCaptureSessionQueueSpecific; /// Ensures the given block to be run on the main queue. /// If caller site is already on the main queue, the block will be run diff --git a/packages/camera/camera_avfoundation/pubspec.yaml b/packages/camera/camera_avfoundation/pubspec.yaml index 3d160d89a198..f536d1e1045e 100644 --- a/packages/camera/camera_avfoundation/pubspec.yaml +++ b/packages/camera/camera_avfoundation/pubspec.yaml @@ -2,7 +2,7 @@ name: camera_avfoundation description: iOS implementation of the camera plugin. repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_avfoundation issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 -version: 0.9.18+13 +version: 0.9.19 environment: sdk: ^3.4.0 @@ -17,7 +17,7 @@ flutter: dartPluginClass: AVFoundationCamera dependencies: - camera_platform_interface: ^2.9.0 + camera_platform_interface: ^2.10.0 flutter: sdk: flutter stream_transform: ^2.0.0 @@ -33,8 +33,3 @@ dev_dependencies: topics: - camera - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins -dependency_overrides: - {camera_platform_interface: {path: ../../camera/camera_platform_interface}} diff --git a/packages/camera/camera_platform_interface/CHANGELOG.md b/packages/camera/camera_platform_interface/CHANGELOG.md index 2d5db83290a2..d00f721a79b6 100644 --- a/packages/camera/camera_platform_interface/CHANGELOG.md +++ b/packages/camera/camera_platform_interface/CHANGELOG.md @@ -1,7 +1,12 @@ +## 2.10.0 + +* Introduces a new `CameraLensType` enum to provide lens type information about + the camera (e.g., ultra-wide, telephoto, ...). + ## 2.9.0 * Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. -* Introduces a new CameraLensType enum to provide lens type information about the camera (e.g. ultra-wide, telephoto, ...). +* Adds API support query for image streaming. ## 2.8.0 diff --git a/packages/camera/camera_platform_interface/pubspec.yaml b/packages/camera/camera_platform_interface/pubspec.yaml index bea9eef23194..a26c038ed11c 100644 --- a/packages/camera/camera_platform_interface/pubspec.yaml +++ b/packages/camera/camera_platform_interface/pubspec.yaml @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/camera/camera issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 2.9.0 +version: 2.10.0 environment: sdk: ^3.4.0 From cdf2014da6a0b9e284bca179694caeb86fae4527 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Tue, 1 Apr 2025 16:30:09 -0400 Subject: [PATCH 20/25] run pigeon generator --- .../include/camera_avfoundation/messages.g.h | 117 ++- .../Sources/camera_avfoundation/messages.g.m | 815 +++++++----------- .../lib/src/messages.g.dart | 386 +++------ 3 files changed, 478 insertions(+), 840 deletions(-) diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h index f8f102de922c..846fcd02cde8 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h @@ -1,7 +1,7 @@ // 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 (v22.7.0), do not edit directly. +// Autogenerated from Pigeon (v22.7.4), do not edit directly. // See also: https://pub.dev/packages/pigeon #import @@ -141,10 +141,10 @@ typedef NS_ENUM(NSUInteger, FCPPlatformResolutionPreset) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithName:(NSString *)name - lensDirection:(FCPPlatformCameraLensDirection)lensDirection - lensType:(FCPPlatformCameraLensType)lensType; + lensDirection:(FCPPlatformCameraLensDirection)lensDirection + lensType:(FCPPlatformCameraLensType)lensType; /// The name of the camera device. -@property(nonatomic, copy) NSString *name; +@property(nonatomic, copy) NSString * name; /// The direction the camera is facing. @property(nonatomic, assign) FCPPlatformCameraLensDirection lensDirection; /// The type of the camera lens. @@ -155,51 +155,53 @@ typedef NS_ENUM(NSUInteger, FCPPlatformResolutionPreset) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithPreviewSize:(FCPPlatformSize *)previewSize - exposureMode:(FCPPlatformExposureMode)exposureMode - focusMode:(FCPPlatformFocusMode)focusMode - exposurePointSupported:(BOOL)exposurePointSupported - focusPointSupported:(BOOL)focusPointSupported; + exposureMode:(FCPPlatformExposureMode)exposureMode + focusMode:(FCPPlatformFocusMode)focusMode + exposurePointSupported:(BOOL )exposurePointSupported + focusPointSupported:(BOOL )focusPointSupported; /// The size of the preview, in pixels. -@property(nonatomic, strong) FCPPlatformSize *previewSize; +@property(nonatomic, strong) FCPPlatformSize * previewSize; /// The default exposure mode @property(nonatomic, assign) FCPPlatformExposureMode exposureMode; /// The default focus mode @property(nonatomic, assign) FCPPlatformFocusMode focusMode; /// Whether setting exposure points is supported. -@property(nonatomic, assign) BOOL exposurePointSupported; +@property(nonatomic, assign) BOOL exposurePointSupported; /// Whether setting focus points is supported. -@property(nonatomic, assign) BOOL focusPointSupported; +@property(nonatomic, assign) BOOL focusPointSupported; @end @interface FCPPlatformMediaSettings : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolutionPreset - framesPerSecond:(nullable NSNumber *)framesPerSecond - videoBitrate:(nullable NSNumber *)videoBitrate - audioBitrate:(nullable NSNumber *)audioBitrate - enableAudio:(BOOL)enableAudio; + framesPerSecond:(nullable NSNumber *)framesPerSecond + videoBitrate:(nullable NSNumber *)videoBitrate + audioBitrate:(nullable NSNumber *)audioBitrate + enableAudio:(BOOL )enableAudio; @property(nonatomic, assign) FCPPlatformResolutionPreset resolutionPreset; -@property(nonatomic, strong, nullable) NSNumber *framesPerSecond; -@property(nonatomic, strong, nullable) NSNumber *videoBitrate; -@property(nonatomic, strong, nullable) NSNumber *audioBitrate; -@property(nonatomic, assign) BOOL enableAudio; +@property(nonatomic, strong, nullable) NSNumber * framesPerSecond; +@property(nonatomic, strong, nullable) NSNumber * videoBitrate; +@property(nonatomic, strong, nullable) NSNumber * audioBitrate; +@property(nonatomic, assign) BOOL enableAudio; @end @interface FCPPlatformPoint : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithX:(double)x y:(double)y; -@property(nonatomic, assign) double x; -@property(nonatomic, assign) double y; ++ (instancetype)makeWithX:(double )x + y:(double )y; +@property(nonatomic, assign) double x; +@property(nonatomic, assign) double y; @end @interface FCPPlatformSize : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithWidth:(double)width height:(double)height; -@property(nonatomic, assign) double width; -@property(nonatomic, assign) double height; ++ (instancetype)makeWithWidth:(double )width + height:(double )height; +@property(nonatomic, assign) double width; +@property(nonatomic, assign) double height; @end /// The codec used by all APIs. @@ -207,16 +209,11 @@ NSObject *FCPGetMessagesCodec(void); @protocol FCPCameraApi /// Returns the list of available cameras. -- (void)availableCamerasWithCompletion:(void (^)(NSArray *_Nullable, - FlutterError *_Nullable))completion; +- (void)availableCamerasWithCompletion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion; /// Create a new camera with the given settings, and returns its ID. -- (void)createCameraWithName:(NSString *)cameraName - settings:(FCPPlatformMediaSettings *)settings - completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; +- (void)createCameraWithName:(NSString *)cameraName settings:(FCPPlatformMediaSettings *)settings completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Initializes the camera with the given ID. -- (void)initializeCamera:(NSInteger)cameraId - withImageFormat:(FCPPlatformImageFormatGroup)imageFormat - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)initializeCamera:(NSInteger)cameraId withImageFormat:(FCPPlatformImageFormatGroup)imageFormat completion:(void (^)(FlutterError *_Nullable))completion; /// Begins streaming frames from the camera. - (void)startImageStreamWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Stops streaming frames from the camera. @@ -230,39 +227,32 @@ NSObject *FCPGetMessagesCodec(void); /// and any associated resources can be cleaned up. - (void)disposeCamera:(NSInteger)cameraId completion:(void (^)(FlutterError *_Nullable))completion; /// Locks the camera capture to the current device orientation. -- (void)lockCaptureOrientation:(FCPPlatformDeviceOrientation)orientation - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)lockCaptureOrientation:(FCPPlatformDeviceOrientation)orientation completion:(void (^)(FlutterError *_Nullable))completion; /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. - (void)unlockCaptureOrientationWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Takes a picture with the current settings, and returns the path to the /// resulting file. -- (void)takePictureWithCompletion:(void (^)(NSString *_Nullable, - FlutterError *_Nullable))completion; +- (void)takePictureWithCompletion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; /// Does any preprocessing necessary before beginning to record video. - (void)prepareForVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Begins recording video, optionally enabling streaming to Dart at the same /// time. -- (void)startVideoRecordingWithStreaming:(BOOL)enableStream - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)startVideoRecordingWithStreaming:(BOOL)enableStream completion:(void (^)(FlutterError *_Nullable))completion; /// Stops recording video, and results the path to the resulting file. -- (void)stopVideoRecordingWithCompletion:(void (^)(NSString *_Nullable, - FlutterError *_Nullable))completion; +- (void)stopVideoRecordingWithCompletion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; /// Pauses video recording. - (void)pauseVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Resumes a previously paused video recording. - (void)resumeVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given flash mode. -- (void)setFlashMode:(FCPPlatformFlashMode)mode - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFlashMode:(FCPPlatformFlashMode)mode completion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given exposure mode. -- (void)setExposureMode:(FCPPlatformExposureMode)mode - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setExposureMode:(FCPPlatformExposureMode)mode completion:(void (^)(FlutterError *_Nullable))completion; /// Anchors auto-exposure to the given point in (0,1) coordinate space. /// /// A null value resets to the default exposure point. -- (void)setExposurePoint:(nullable FCPPlatformPoint *)point - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setExposurePoint:(nullable FCPPlatformPoint *)point completion:(void (^)(FlutterError *_Nullable))completion; /// Returns the minimum exposure offset supported by the camera. - (void)getMinimumExposureOffset:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Returns the maximum exposure offset supported by the camera. @@ -270,13 +260,11 @@ NSObject *FCPGetMessagesCodec(void); /// Sets the exposure offset manually to the given value. - (void)setExposureOffset:(double)offset completion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given focus mode. -- (void)setFocusMode:(FCPPlatformFocusMode)mode - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFocusMode:(FCPPlatformFocusMode)mode completion:(void (^)(FlutterError *_Nullable))completion; /// Anchors auto-focus to the given point in (0,1) coordinate space. /// /// A null value resets to the default focus point. -- (void)setFocusPoint:(nullable FCPPlatformPoint *)point - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFocusPoint:(nullable FCPPlatformPoint *)point completion:(void (^)(FlutterError *_Nullable))completion; /// Returns the minimum zoom level supported by the camera. - (void)getMinimumZoomLevel:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Returns the maximum zoom level supported by the camera. @@ -290,40 +278,33 @@ NSObject *FCPGetMessagesCodec(void); /// Changes the camera used while recording video. /// /// This should only be called while video recording is active. -- (void)updateDescriptionWhileRecordingCameraName:(NSString *)cameraName - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)updateDescriptionWhileRecordingCameraName:(NSString *)cameraName completion:(void (^)(FlutterError *_Nullable))completion; /// Sets the file format used for taking pictures. -- (void)setImageFileFormat:(FCPPlatformImageFileFormat)format - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setImageFileFormat:(FCPPlatformImageFileFormat)format completion:(void (^)(FlutterError *_Nullable))completion; @end -extern void SetUpFCPCameraApi(id binaryMessenger, - NSObject *_Nullable api); +extern void SetUpFCPCameraApi(id binaryMessenger, NSObject *_Nullable api); + +extern void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSObject *_Nullable api, NSString *messageChannelSuffix); -extern void SetUpFCPCameraApiWithSuffix(id binaryMessenger, - NSObject *_Nullable api, - NSString *messageChannelSuffix); /// Handler for native callbacks that are not tied to a specific camera ID. @interface FCPCameraGlobalEventApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger messageChannelSuffix:(nullable NSString *)messageChannelSuffix; /// Called when the device's physical orientation changes. -- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)orientation - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)orientation completion:(void (^)(FlutterError *_Nullable))completion; @end + /// Handler for native callbacks that are tied to a specific camera ID. /// /// This is intended to be initialized with the camera ID as a suffix. @interface FCPCameraEventApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger messageChannelSuffix:(nullable NSString *)messageChannelSuffix; /// Called when the camera is inialitized for use. -- (void)initializedWithState:(FCPPlatformCameraState *)initialState - completion:(void (^)(FlutterError *_Nullable))completion; +- (void)initializedWithState:(FCPPlatformCameraState *)initialState completion:(void (^)(FlutterError *_Nullable))completion; /// Called when an error occurs in the camera. /// /// This should be used for errors that occur outside of the context of diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m index 6fd130e922c0..1494bbe9e64e 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m @@ -1,7 +1,7 @@ // 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 (v22.7.0), do not edit directly. +// Autogenerated from Pigeon (v22.7.4), do not edit directly. // See also: https://pub.dev/packages/pigeon #import "./include/camera_avfoundation/messages.g.h" @@ -26,12 +26,7 @@ } static FlutterError *createConnectionError(NSString *channelName) { - return [FlutterError - errorWithCode:@"channel-error" - message:[NSString stringWithFormat:@"%@/%@/%@", - @"Unable to establish connection on channel: '", - channelName, @"'."] - details:@""]; + return [FlutterError errorWithCode:@"channel-error" message:[NSString stringWithFormat:@"%@/%@/%@", @"Unable to establish connection on channel: '", channelName, @"'."] details:@""]; } static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { @@ -162,9 +157,9 @@ + (nullable FCPPlatformSize *)nullableFromList:(NSArray *)list; @implementation FCPPlatformCameraDescription + (instancetype)makeWithName:(NSString *)name - lensDirection:(FCPPlatformCameraLensDirection)lensDirection - lensType:(FCPPlatformCameraLensType)lensType { - FCPPlatformCameraDescription *pigeonResult = [[FCPPlatformCameraDescription alloc] init]; + lensDirection:(FCPPlatformCameraLensDirection)lensDirection + lensType:(FCPPlatformCameraLensType)lensType { + FCPPlatformCameraDescription* pigeonResult = [[FCPPlatformCameraDescription alloc] init]; pigeonResult.name = name; pigeonResult.lensDirection = lensDirection; pigeonResult.lensType = lensType; @@ -173,8 +168,7 @@ + (instancetype)makeWithName:(NSString *)name + (FCPPlatformCameraDescription *)fromList:(NSArray *)list { FCPPlatformCameraDescription *pigeonResult = [[FCPPlatformCameraDescription alloc] init]; pigeonResult.name = GetNullableObjectAtIndex(list, 0); - FCPPlatformCameraLensDirectionBox *boxedFCPPlatformCameraLensDirection = - GetNullableObjectAtIndex(list, 1); + FCPPlatformCameraLensDirectionBox *boxedFCPPlatformCameraLensDirection = GetNullableObjectAtIndex(list, 1); pigeonResult.lensDirection = boxedFCPPlatformCameraLensDirection.value; FCPPlatformCameraLensTypeBox *boxedFCPPlatformCameraLensType = GetNullableObjectAtIndex(list, 2); pigeonResult.lensType = boxedFCPPlatformCameraLensType.value; @@ -194,11 +188,11 @@ + (nullable FCPPlatformCameraDescription *)nullableFromList:(NSArray *)list @implementation FCPPlatformCameraState + (instancetype)makeWithPreviewSize:(FCPPlatformSize *)previewSize - exposureMode:(FCPPlatformExposureMode)exposureMode - focusMode:(FCPPlatformFocusMode)focusMode - exposurePointSupported:(BOOL)exposurePointSupported - focusPointSupported:(BOOL)focusPointSupported { - FCPPlatformCameraState *pigeonResult = [[FCPPlatformCameraState alloc] init]; + exposureMode:(FCPPlatformExposureMode)exposureMode + focusMode:(FCPPlatformFocusMode)focusMode + exposurePointSupported:(BOOL )exposurePointSupported + focusPointSupported:(BOOL )focusPointSupported { + FCPPlatformCameraState* pigeonResult = [[FCPPlatformCameraState alloc] init]; pigeonResult.previewSize = previewSize; pigeonResult.exposureMode = exposureMode; pigeonResult.focusMode = focusMode; @@ -233,11 +227,11 @@ + (nullable FCPPlatformCameraState *)nullableFromList:(NSArray *)list { @implementation FCPPlatformMediaSettings + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolutionPreset - framesPerSecond:(nullable NSNumber *)framesPerSecond - videoBitrate:(nullable NSNumber *)videoBitrate - audioBitrate:(nullable NSNumber *)audioBitrate - enableAudio:(BOOL)enableAudio { - FCPPlatformMediaSettings *pigeonResult = [[FCPPlatformMediaSettings alloc] init]; + framesPerSecond:(nullable NSNumber *)framesPerSecond + videoBitrate:(nullable NSNumber *)videoBitrate + audioBitrate:(nullable NSNumber *)audioBitrate + enableAudio:(BOOL )enableAudio { + FCPPlatformMediaSettings* pigeonResult = [[FCPPlatformMediaSettings alloc] init]; pigeonResult.resolutionPreset = resolutionPreset; pigeonResult.framesPerSecond = framesPerSecond; pigeonResult.videoBitrate = videoBitrate; @@ -247,8 +241,7 @@ + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolution } + (FCPPlatformMediaSettings *)fromList:(NSArray *)list { FCPPlatformMediaSettings *pigeonResult = [[FCPPlatformMediaSettings alloc] init]; - FCPPlatformResolutionPresetBox *boxedFCPPlatformResolutionPreset = - GetNullableObjectAtIndex(list, 0); + FCPPlatformResolutionPresetBox *boxedFCPPlatformResolutionPreset = GetNullableObjectAtIndex(list, 0); pigeonResult.resolutionPreset = boxedFCPPlatformResolutionPreset.value; pigeonResult.framesPerSecond = GetNullableObjectAtIndex(list, 1); pigeonResult.videoBitrate = GetNullableObjectAtIndex(list, 2); @@ -271,8 +264,9 @@ + (nullable FCPPlatformMediaSettings *)nullableFromList:(NSArray *)list { @end @implementation FCPPlatformPoint -+ (instancetype)makeWithX:(double)x y:(double)y { - FCPPlatformPoint *pigeonResult = [[FCPPlatformPoint alloc] init]; ++ (instancetype)makeWithX:(double )x + y:(double )y { + FCPPlatformPoint* pigeonResult = [[FCPPlatformPoint alloc] init]; pigeonResult.x = x; pigeonResult.y = y; return pigeonResult; @@ -295,8 +289,9 @@ + (nullable FCPPlatformPoint *)nullableFromList:(NSArray *)list { @end @implementation FCPPlatformSize -+ (instancetype)makeWithWidth:(double)width height:(double)height { - FCPPlatformSize *pigeonResult = [[FCPPlatformSize alloc] init]; ++ (instancetype)makeWithWidth:(double )width + height:(double )height { + FCPPlatformSize* pigeonResult = [[FCPPlatformSize alloc] init]; pigeonResult.width = width; pigeonResult.height = height; return pigeonResult; @@ -325,67 +320,49 @@ - (nullable id)readValueOfType:(UInt8)type { switch (type) { case 129: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformCameraLensDirectionBox alloc] - initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformCameraLensDirectionBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 130: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil - ? nil - : [[FCPPlatformCameraLensTypeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformCameraLensTypeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 131: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformDeviceOrientationBox alloc] - initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformDeviceOrientationBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 132: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil - ? nil - : [[FCPPlatformExposureModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformExposureModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 133: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil - ? nil - : [[FCPPlatformFlashModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformFlashModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 134: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil - ? nil - : [[FCPPlatformFocusModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformFocusModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 135: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformImageFileFormatBox alloc] - initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformImageFileFormatBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 136: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformImageFormatGroupBox alloc] - initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformImageFormatGroupBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 137: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformResolutionPresetBox alloc] - initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformResolutionPresetBox alloc] initWithValue:[enumAsNumber integerValue]]; } - case 138: + case 138: return [FCPPlatformCameraDescription fromList:[self readValue]]; - case 139: + case 139: return [FCPPlatformCameraState fromList:[self readValue]]; - case 140: + case 140: return [FCPPlatformMediaSettings fromList:[self readValue]]; - case 141: + case 141: return [FCPPlatformPoint fromList:[self readValue]]; - case 142: + case 142: return [FCPPlatformSize fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -469,8 +446,7 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FCPMessagesPigeonCodecReaderWriter *readerWriter = - [[FCPMessagesPigeonCodecReaderWriter alloc] init]; + FCPMessagesPigeonCodecReaderWriter *readerWriter = [[FCPMessagesPigeonCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; @@ -479,29 +455,19 @@ void SetUpFCPCameraApi(id binaryMessenger, NSObject binaryMessenger, - NSObject *api, NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 - ? [NSString stringWithFormat:@".%@", messageChannelSuffix] - : @""; +void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSObject *api, NSString *messageChannelSuffix) { + messageChannelSuffix = messageChannelSuffix.length > 0 ? [NSString stringWithFormat: @".%@", messageChannelSuffix] : @""; /// Returns the list of available cameras. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.getAvailableCameras", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(availableCamerasWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(availableCamerasWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(availableCamerasWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(availableCamerasWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api availableCamerasWithCompletion:^( - NSArray *_Nullable output, - FlutterError *_Nullable error) { + [api availableCamerasWithCompletion:^(NSArray *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -511,27 +477,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Create a new camera with the given settings, and returns its ID. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.create", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.create", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createCameraWithName:settings:completion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(createCameraWithName:settings:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(createCameraWithName:settings:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(createCameraWithName:settings:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_cameraName = GetNullableObjectAtIndex(args, 0); FCPPlatformMediaSettings *arg_settings = GetNullableObjectAtIndex(args, 1); - [api createCameraWithName:arg_cameraName - settings:arg_settings - completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api createCameraWithName:arg_cameraName settings:arg_settings completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -539,30 +498,21 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Initializes the camera with the given ID. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(initializeCamera:withImageFormat:completion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(initializeCamera:withImageFormat:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(initializeCamera:withImageFormat:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(initializeCamera:withImageFormat:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSInteger arg_cameraId = [GetNullableObjectAtIndex(args, 0) integerValue]; - FCPPlatformImageFormatGroupBox *boxedFCPPlatformImageFormatGroup = - GetNullableObjectAtIndex(args, 1); + FCPPlatformImageFormatGroupBox *boxedFCPPlatformImageFormatGroup = GetNullableObjectAtIndex(args, 1); FCPPlatformImageFormatGroup arg_imageFormat = boxedFCPPlatformImageFormatGroup.value; - [api initializeCamera:arg_cameraId - withImageFormat:arg_imageFormat - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api initializeCamera:arg_cameraId withImageFormat:arg_imageFormat completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -570,18 +520,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Begins streaming frames from the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.startImageStream", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(startImageStreamWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(startImageStreamWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(startImageStreamWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(startImageStreamWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api startImageStreamWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -593,19 +538,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Stops streaming frames from the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(stopImageStreamWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(stopImageStreamWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(stopImageStreamWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(stopImageStreamWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api stopImageStreamWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -620,18 +559,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// /// This is used to throttle sending frames across the channel. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.receivedImageStreamData", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(receivedImageStreamDataWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(receivedImageStreamDataWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(receivedImageStreamDataWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(receivedImageStreamDataWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api receivedImageStreamDataWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -644,24 +578,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// Indicates that the given camera is no longer being used on the Dart side, /// and any associated resources can be cleaned up. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(disposeCamera:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(disposeCamera:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(disposeCamera:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(disposeCamera:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSInteger arg_cameraId = [GetNullableObjectAtIndex(args, 0) integerValue]; - [api disposeCamera:arg_cameraId - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api disposeCamera:arg_cameraId completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -669,27 +598,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Locks the camera capture to the current device orientation. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.lockCaptureOrientation", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(lockCaptureOrientation:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(lockCaptureOrientation:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(lockCaptureOrientation:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(lockCaptureOrientation:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FCPPlatformDeviceOrientationBox *boxedFCPPlatformDeviceOrientation = - GetNullableObjectAtIndex(args, 0); + FCPPlatformDeviceOrientationBox *boxedFCPPlatformDeviceOrientation = GetNullableObjectAtIndex(args, 0); FCPPlatformDeviceOrientation arg_orientation = boxedFCPPlatformDeviceOrientation.value; - [api lockCaptureOrientation:arg_orientation - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api lockCaptureOrientation:arg_orientation completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -698,18 +620,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.unlockCaptureOrientation", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(unlockCaptureOrientationWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(unlockCaptureOrientationWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(unlockCaptureOrientationWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(unlockCaptureOrientationWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api unlockCaptureOrientationWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -722,23 +639,17 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// Takes a picture with the current settings, and returns the path to the /// resulting file. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName: - [NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(takePictureWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(takePictureWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(takePictureWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(takePictureWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api - takePictureWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api takePictureWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -746,18 +657,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Does any preprocessing necessary before beginning to record video. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.prepareForVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(prepareForVideoRecordingWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(prepareForVideoRecordingWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(prepareForVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(prepareForVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api prepareForVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -770,25 +676,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// Begins recording video, optionally enabling streaming to Dart at the same /// time. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.startVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(startVideoRecordingWithStreaming:completion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(startVideoRecordingWithStreaming:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(startVideoRecordingWithStreaming:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(startVideoRecordingWithStreaming:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; BOOL arg_enableStream = [GetNullableObjectAtIndex(args, 0) boolValue]; - [api startVideoRecordingWithStreaming:arg_enableStream - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api startVideoRecordingWithStreaming:arg_enableStream completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -796,21 +696,15 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Stops recording video, and results the path to the resulting file. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.stopVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(stopVideoRecordingWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(stopVideoRecordingWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(stopVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(stopVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api stopVideoRecordingWithCompletion:^(NSString *_Nullable output, - FlutterError *_Nullable error) { + [api stopVideoRecordingWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -820,18 +714,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Pauses video recording. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.pauseVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(pauseVideoRecordingWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(pauseVideoRecordingWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(pauseVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(pauseVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api pauseVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -843,18 +732,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Resumes a previously paused video recording. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.resumeVideoRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(resumeVideoRecordingWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(resumeVideoRecordingWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(resumeVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(resumeVideoRecordingWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api resumeVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -866,26 +750,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Switches the camera to the given flash mode. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFlashMode:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setFlashMode:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setFlashMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFlashMode:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformFlashModeBox *boxedFCPPlatformFlashMode = GetNullableObjectAtIndex(args, 0); FCPPlatformFlashMode arg_mode = boxedFCPPlatformFlashMode.value; - [api setFlashMode:arg_mode - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFlashMode:arg_mode completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -893,27 +771,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Switches the camera to the given exposure mode. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposureMode:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureMode:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setExposureMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureMode:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FCPPlatformExposureModeBox *boxedFCPPlatformExposureMode = - GetNullableObjectAtIndex(args, 0); + FCPPlatformExposureModeBox *boxedFCPPlatformExposureMode = GetNullableObjectAtIndex(args, 0); FCPPlatformExposureMode arg_mode = boxedFCPPlatformExposureMode.value; - [api setExposureMode:arg_mode - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposureMode:arg_mode completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -923,24 +794,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// /// A null value resets to the default exposure point. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.setExposurePoint", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposurePoint:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setExposurePoint:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setExposurePoint:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposurePoint:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformPoint *arg_point = GetNullableObjectAtIndex(args, 0); - [api setExposurePoint:arg_point - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposurePoint:arg_point completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -948,17 +814,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Returns the minimum exposure offset supported by the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.getMinExposureOffset", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMinimumExposureOffset:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumExposureOffset:)", - api); + NSCAssert([api respondsToSelector:@selector(getMinimumExposureOffset:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumExposureOffset:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMinimumExposureOffset:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -970,17 +832,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Returns the maximum exposure offset supported by the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.getMaxExposureOffset", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMaximumExposureOffset:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumExposureOffset:)", - api); + NSCAssert([api respondsToSelector:@selector(getMaximumExposureOffset:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumExposureOffset:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMaximumExposureOffset:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -992,25 +850,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Sets the exposure offset manually to the given value. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.setExposureOffset", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(setExposureOffset:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureOffset:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setExposureOffset:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureOffset:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; double arg_offset = [GetNullableObjectAtIndex(args, 0) doubleValue]; - [api setExposureOffset:arg_offset - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposureOffset:arg_offset completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1018,26 +870,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Switches the camera to the given focus mode. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFocusMode:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusMode:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setFocusMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusMode:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformFocusModeBox *boxedFCPPlatformFocusMode = GetNullableObjectAtIndex(args, 0); FCPPlatformFocusMode arg_mode = boxedFCPPlatformFocusMode.value; - [api setFocusMode:arg_mode - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFocusMode:arg_mode completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1047,25 +893,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// /// A null value resets to the default focus point. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFocusPoint:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusPoint:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setFocusPoint:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusPoint:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformPoint *arg_point = GetNullableObjectAtIndex(args, 0); - [api setFocusPoint:arg_point - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFocusPoint:arg_point completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1073,17 +913,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Returns the minimum zoom level supported by the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMinimumZoomLevel:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumZoomLevel:)", api); + NSCAssert([api respondsToSelector:@selector(getMinimumZoomLevel:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumZoomLevel:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMinimumZoomLevel:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -1095,17 +931,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Returns the maximum zoom level supported by the camera. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMaximumZoomLevel:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumZoomLevel:)", api); + NSCAssert([api respondsToSelector:@selector(getMaximumZoomLevel:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumZoomLevel:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMaximumZoomLevel:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -1117,25 +949,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Sets the zoom factor. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setZoomLevel:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setZoomLevel:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setZoomLevel:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setZoomLevel:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; double arg_zoom = [GetNullableObjectAtIndex(args, 0) doubleValue]; - [api setZoomLevel:arg_zoom - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setZoomLevel:arg_zoom completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1143,18 +969,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Pauses streaming of preview frames. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(pausePreviewWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(pausePreviewWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(pausePreviewWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(pausePreviewWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api pausePreviewWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -1166,18 +987,13 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Resumes a previously paused preview stream. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(resumePreviewWithCompletion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(resumePreviewWithCompletion:)", - api); + NSCAssert([api respondsToSelector:@selector(resumePreviewWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(resumePreviewWithCompletion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api resumePreviewWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -1191,26 +1007,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, /// /// This should only be called while video recording is active. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.updateDescriptionWhileRecording", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(updateDescriptionWhileRecordingCameraName: - completion:)], - @"FCPCameraApi api (%@) doesn't respond to " - @"@selector(updateDescriptionWhileRecordingCameraName:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(updateDescriptionWhileRecordingCameraName:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(updateDescriptionWhileRecordingCameraName:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_cameraName = GetNullableObjectAtIndex(args, 0); - [api updateDescriptionWhileRecordingCameraName:arg_cameraName - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api updateDescriptionWhileRecordingCameraName:arg_cameraName completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1218,27 +1027,20 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, } /// Sets the file format used for taking pictures. { - FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation." - @"CameraApi.setImageFileFormat", - messageChannelSuffix] + FlutterBasicMessageChannel *channel = + [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat", messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert( - [api respondsToSelector:@selector(setImageFileFormat:completion:)], - @"FCPCameraApi api (%@) doesn't respond to @selector(setImageFileFormat:completion:)", - api); + NSCAssert([api respondsToSelector:@selector(setImageFileFormat:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setImageFileFormat:completion:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FCPPlatformImageFileFormatBox *boxedFCPPlatformImageFileFormat = - GetNullableObjectAtIndex(args, 0); + FCPPlatformImageFileFormatBox *boxedFCPPlatformImageFileFormat = GetNullableObjectAtIndex(args, 0); FCPPlatformImageFileFormat arg_format = boxedFCPPlatformImageFileFormat.value; - [api setImageFileFormat:arg_format - completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setImageFileFormat:arg_format completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1255,42 +1057,32 @@ @implementation FCPCameraGlobalEventApi - (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""]; } -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix { +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger messageChannelSuffix:(nullable NSString*)messageChannelSuffix{ self = [self init]; if (self) { _binaryMessenger = binaryMessenger; - _messageChannelSuffix = [messageChannelSuffix length] == 0 - ? @"" - : [NSString stringWithFormat:@".%@", messageChannelSuffix]; + _messageChannelSuffix = [messageChannelSuffix length] == 0 ? @"" : [NSString stringWithFormat: @".%@", messageChannelSuffix]; } return self; } -- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)arg_orientation - completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat: - @"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged", - _messageChannelSuffix]; +- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)arg_orientation completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged", _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPGetMessagesCodec()]; - [channel sendMessage:@[ [[FCPPlatformDeviceOrientationBox alloc] initWithValue:arg_orientation] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel + messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPGetMessagesCodec()]; + [channel sendMessage:@[[[FCPPlatformDeviceOrientationBox alloc] initWithValue:arg_orientation]] reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } @end @@ -1304,64 +1096,51 @@ @implementation FCPCameraEventApi - (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""]; } -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger - messageChannelSuffix:(nullable NSString *)messageChannelSuffix { +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger messageChannelSuffix:(nullable NSString*)messageChannelSuffix{ self = [self init]; if (self) { _binaryMessenger = binaryMessenger; - _messageChannelSuffix = [messageChannelSuffix length] == 0 - ? @"" - : [NSString stringWithFormat:@".%@", messageChannelSuffix]; + _messageChannelSuffix = [messageChannelSuffix length] == 0 ? @"" : [NSString stringWithFormat: @".%@", messageChannelSuffix]; } return self; } -- (void)initializedWithState:(FCPPlatformCameraState *)arg_initialState - completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat:@"%@%@", - @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized", - _messageChannelSuffix]; +- (void)initializedWithState:(FCPPlatformCameraState *)arg_initialState completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized", _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPGetMessagesCodec()]; - [channel sendMessage:@[ arg_initialState ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel + messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPGetMessagesCodec()]; + [channel sendMessage:@[arg_initialState ?: [NSNull null]] reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } -- (void)reportError:(NSString *)arg_message - completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString - stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error", - _messageChannelSuffix]; +- (void)reportError:(NSString *)arg_message completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error", _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPGetMessagesCodec()]; - [channel sendMessage:@[ arg_message ?: [NSNull null] ] - reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] - message:reply[1] - details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel + messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPGetMessagesCodec()]; + [channel sendMessage:@[arg_message ?: [NSNull null]] reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } @end + diff --git a/packages/camera/camera_avfoundation/lib/src/messages.g.dart b/packages/camera/camera_avfoundation/lib/src/messages.g.dart index 371f5899bba2..fdeabc8a53e0 100644 --- a/packages/camera/camera_avfoundation/lib/src/messages.g.dart +++ b/packages/camera/camera_avfoundation/lib/src/messages.g.dart @@ -1,7 +1,7 @@ // 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 (v22.7.0), do not edit directly. +// Autogenerated from Pigeon (v22.7.4), 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, unnecessary_import, no_leading_underscores_for_local_identifiers @@ -18,8 +18,7 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse( - {Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -32,10 +31,8 @@ List wrapResponse( enum PlatformCameraLensDirection { /// Front facing camera (a user looking at the screen is seen by the camera). front, - /// Back facing camera (a user looking at the screen is not seen by the camera). back, - /// External camera which may not be mounted to the device. external, } @@ -43,13 +40,10 @@ enum PlatformCameraLensDirection { enum PlatformCameraLensType { /// A built-in wide-angle camera device type. wide, - /// A built-in camera device type with a longer focal length than a wide-angle camera. telephoto, - /// A built-in camera device type with a shorter focal length than a wide-angle camera. ultraWide, - /// Unknown camera device type. unknown, } @@ -159,8 +153,8 @@ class PlatformCameraState { Object encode() { return [ previewSize, - exposureMode.index, - focusMode.index, + exposureMode, + focusMode, exposurePointSupported, focusPointSupported, ]; @@ -170,8 +164,8 @@ class PlatformCameraState { result as List; return PlatformCameraState( previewSize: result[0]! as PlatformSize, - exposureMode: PlatformExposureMode.values[result[1]! as int], - focusMode: PlatformFocusMode.values[result[2]! as int], + exposureMode: result[1]! as PlatformExposureMode, + focusMode: result[2]! as PlatformFocusMode, exposurePointSupported: result[3]! as bool, focusPointSupported: result[4]! as bool, ); @@ -271,6 +265,7 @@ class PlatformSize { } } + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -278,46 +273,46 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is PlatformCameraLensDirection) { + } else if (value is PlatformCameraLensDirection) { buffer.putUint8(129); writeValue(buffer, value.index); - } else if (value is PlatformCameraLensType) { + } else if (value is PlatformCameraLensType) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is PlatformDeviceOrientation) { + } else if (value is PlatformDeviceOrientation) { buffer.putUint8(131); writeValue(buffer, value.index); - } else if (value is PlatformExposureMode) { + } else if (value is PlatformExposureMode) { buffer.putUint8(132); writeValue(buffer, value.index); - } else if (value is PlatformFlashMode) { + } else if (value is PlatformFlashMode) { buffer.putUint8(133); writeValue(buffer, value.index); - } else if (value is PlatformFocusMode) { + } else if (value is PlatformFocusMode) { buffer.putUint8(134); writeValue(buffer, value.index); - } else if (value is PlatformImageFileFormat) { + } else if (value is PlatformImageFileFormat) { buffer.putUint8(135); writeValue(buffer, value.index); - } else if (value is PlatformImageFormatGroup) { + } else if (value is PlatformImageFormatGroup) { buffer.putUint8(136); writeValue(buffer, value.index); - } else if (value is PlatformResolutionPreset) { + } else if (value is PlatformResolutionPreset) { buffer.putUint8(137); writeValue(buffer, value.index); - } else if (value is PlatformCameraDescription) { + } else if (value is PlatformCameraDescription) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value is PlatformCameraState) { + } else if (value is PlatformCameraState) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is PlatformMediaSettings) { + } else if (value is PlatformMediaSettings) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is PlatformPoint) { + } else if (value is PlatformPoint) { buffer.putUint8(141); writeValue(buffer, value.encode()); - } else if (value is PlatformSize) { + } else if (value is PlatformSize) { buffer.putUint8(142); writeValue(buffer, value.encode()); } else { @@ -328,42 +323,42 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: + case 129: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformCameraLensDirection.values[value]; - case 130: + case 130: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformCameraLensType.values[value]; - case 131: + case 131: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformDeviceOrientation.values[value]; - case 132: + case 132: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformExposureMode.values[value]; - case 133: + case 133: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformFlashMode.values[value]; - case 134: + case 134: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformFocusMode.values[value]; - case 135: + case 135: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformImageFileFormat.values[value]; - case 136: + case 136: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformImageFormatGroup.values[value]; - case 137: + case 137: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformResolutionPreset.values[value]; - case 138: + case 138: return PlatformCameraDescription.decode(readValue(buffer)!); - case 139: + case 139: return PlatformCameraState.decode(readValue(buffer)!); - case 140: + case 140: return PlatformMediaSettings.decode(readValue(buffer)!); - case 141: + case 141: return PlatformPoint.decode(readValue(buffer)!); - case 142: + case 142: return PlatformSize.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -375,11 +370,9 @@ class CameraApi { /// Constructor for [CameraApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - CameraApi( - {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + CameraApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -388,10 +381,8 @@ class CameraApi { /// Returns the list of available cameras. Future> getAvailableCameras() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -412,23 +403,20 @@ class CameraApi { message: 'Host platform returned null value for non-null return value.', ); } else { - return (pigeonVar_replyList[0] as List?)! - .cast(); + return (pigeonVar_replyList[0] as List?)!.cast(); } } /// Create a new camera with the given settings, and returns its ID. Future create(String cameraName, PlatformMediaSettings settings) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.create$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.create$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([cameraName, settings]) as List?; + final List? pigeonVar_replyList = + await pigeonVar_channel.send([cameraName, settings]) as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -448,18 +436,15 @@ class CameraApi { } /// Initializes the camera with the given ID. - Future initialize( - int cameraId, PlatformImageFormatGroup imageFormat) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + Future initialize(int cameraId, PlatformImageFormatGroup imageFormat) async { + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([cameraId, imageFormat]) as List?; + final List? pigeonVar_replyList = + await pigeonVar_channel.send([cameraId, imageFormat]) as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -475,10 +460,8 @@ class CameraApi { /// Begins streaming frames from the camera. Future startImageStream() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -500,10 +483,8 @@ class CameraApi { /// Stops streaming frames from the camera. Future stopImageStream() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -528,10 +509,8 @@ class CameraApi { /// /// This is used to throttle sending frames across the channel. Future receivedImageStreamData() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -554,10 +533,8 @@ class CameraApi { /// Indicates that the given camera is no longer being used on the Dart side, /// and any associated resources can be cleaned up. Future dispose(int cameraId) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -578,21 +555,18 @@ class CameraApi { } /// Locks the camera capture to the current device orientation. - Future lockCaptureOrientation( - PlatformDeviceOrientation orientation) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + Future lockCaptureOrientation(PlatformDeviceOrientation orientation) async { + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([orientation.index]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final List? pigeonVar_replyList = + await pigeonVar_channel.send([orientation]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( code: pigeonVar_replyList[0]! as String, message: pigeonVar_replyList[1] as String?, @@ -606,10 +580,8 @@ class CameraApi { /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. Future unlockCaptureOrientation() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -632,10 +604,8 @@ class CameraApi { /// Takes a picture with the current settings, and returns the path to the /// resulting file. Future takePicture() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -662,10 +632,8 @@ class CameraApi { /// Does any preprocessing necessary before beginning to record video. Future prepareForVideoRecording() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -688,10 +656,8 @@ class CameraApi { /// Begins recording video, optionally enabling streaming to Dart at the same /// time. Future startVideoRecording(bool enableStream) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -713,10 +679,8 @@ class CameraApi { /// Stops recording video, and results the path to the resulting file. Future stopVideoRecording() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -743,10 +707,8 @@ class CameraApi { /// Pauses video recording. Future pauseVideoRecording() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -768,10 +730,8 @@ class CameraApi { /// Resumes a previously paused video recording. Future resumeVideoRecording() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -793,10 +753,8 @@ class CameraApi { /// Switches the camera to the given flash mode. Future setFlashMode(PlatformFlashMode mode) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -818,10 +776,8 @@ class CameraApi { /// Switches the camera to the given exposure mode. Future setExposureMode(PlatformExposureMode mode) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -845,10 +801,8 @@ class CameraApi { /// /// A null value resets to the default exposure point. Future setExposurePoint(PlatformPoint? point) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -870,10 +824,8 @@ class CameraApi { /// Returns the minimum exposure offset supported by the camera. Future getMinExposureOffset() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -900,10 +852,8 @@ class CameraApi { /// Returns the maximum exposure offset supported by the camera. Future getMaxExposureOffset() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -930,10 +880,8 @@ class CameraApi { /// Sets the exposure offset manually to the given value. Future setExposureOffset(double offset) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -955,10 +903,8 @@ class CameraApi { /// Switches the camera to the given focus mode. Future setFocusMode(PlatformFocusMode mode) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -982,10 +928,8 @@ class CameraApi { /// /// A null value resets to the default focus point. Future setFocusPoint(PlatformPoint? point) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1007,10 +951,8 @@ class CameraApi { /// Returns the minimum zoom level supported by the camera. Future getMinZoomLevel() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1037,10 +979,8 @@ class CameraApi { /// Returns the maximum zoom level supported by the camera. Future getMaxZoomLevel() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1067,10 +1007,8 @@ class CameraApi { /// Sets the zoom factor. Future setZoomLevel(double zoom) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1092,10 +1030,8 @@ class CameraApi { /// Pauses streaming of preview frames. Future pausePreview() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1117,10 +1053,8 @@ class CameraApi { /// Resumes a previously paused preview stream. Future resumePreview() async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1144,10 +1078,8 @@ class CameraApi { /// /// This should only be called while video recording is active. Future updateDescriptionWhileRecording(String cameraName) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1169,10 +1101,8 @@ class CameraApi { /// Sets the file format used for taking pictures. Future setImageFileFormat(PlatformImageFileFormat format) async { - final String pigeonVar_channelName = - 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( + final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1195,34 +1125,25 @@ class CameraApi { /// Handler for native callbacks that are not tied to a specific camera ID. abstract class CameraGlobalEventApi { - static const MessageCodec pigeonChannelCodec = StandardMessageCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); /// Called when the device's physical orientation changes. void deviceOrientationChanged(PlatformDeviceOrientation orientation); - static void setUp( - CameraGlobalEventApi? api, { - BinaryMessenger? binaryMessenger, - String messageChannelSuffix = '', - }) { - messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp(CameraGlobalEventApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { + messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged$messageChannelSuffix', - pigeonChannelCodec, + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + 'dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null.'); final List args = (message as List?)!; - final PlatformDeviceOrientation? arg_orientation = - (args[0] as PlatformDeviceOrientation?); + final PlatformDeviceOrientation? arg_orientation = (args[0] as PlatformDeviceOrientation?); assert(arg_orientation != null, 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null, expected non-null PlatformDeviceOrientation.'); try { @@ -1230,9 +1151,8 @@ abstract class CameraGlobalEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } @@ -1240,39 +1160,11 @@ abstract class CameraGlobalEventApi { } } -class _CameraEventApiCodec extends StandardMessageCodec { - const _CameraEventApiCodec(); - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is PlatformCameraState) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else if (value is PlatformSize) { - buffer.putUint8(129); - writeValue(buffer, value.encode()); - } else { - super.writeValue(buffer, value); - } - } - - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return PlatformCameraState.decode(readValue(buffer)!); - case 129: - return PlatformSize.decode(readValue(buffer)!); - default: - return super.readValueOfType(type, buffer); - } - } -} - /// Handler for native callbacks that are tied to a specific camera ID. /// /// This is intended to be initialized with the camera ID as a suffix. abstract class CameraEventApi { - static const MessageCodec pigeonChannelCodec = _CameraEventApiCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); /// Called when the camera is inialitized for use. void initialized(PlatformCameraState initialState); @@ -1283,29 +1175,20 @@ abstract class CameraEventApi { /// handling a specific HostApi call, such as during streaming. void error(String message); - static void setUp( - CameraEventApi? api, { - BinaryMessenger? binaryMessenger, - String messageChannelSuffix = '', - }) { - messageChannelSuffix = - messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp(CameraEventApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { + messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized$messageChannelSuffix', - pigeonChannelCodec, + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null.'); final List args = (message as List?)!; - final PlatformCameraState? arg_initialState = - (args[0] as PlatformCameraState?); + final PlatformCameraState? arg_initialState = (args[0] as PlatformCameraState?); assert(arg_initialState != null, 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null, expected non-null PlatformCameraState.'); try { @@ -1313,26 +1196,22 @@ abstract class CameraEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } } { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error$messageChannelSuffix', - pigeonChannelCodec, + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error was null.'); final List args = (message as List?)!; final String? arg_message = (args[0] as String?); assert(arg_message != null, @@ -1342,9 +1221,8 @@ abstract class CameraEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); } }); } From 48959c5f92bcc1fd23277714539a81fa1823833f Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Tue, 1 Apr 2025 16:43:48 -0400 Subject: [PATCH 21/25] Ran formatting script --- .../include/camera_avfoundation/QueueUtils.h | 2 +- .../include/camera_avfoundation/messages.g.h | 115 +-- .../Sources/camera_avfoundation/messages.g.m | 813 +++++++++++------- .../lib/src/messages.g.dart | 334 ++++--- 4 files changed, 799 insertions(+), 465 deletions(-) diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h index a7e22da716d0..e230a53508fa 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h @@ -7,7 +7,7 @@ NS_ASSUME_NONNULL_BEGIN /// Queue-specific context data to be associated with the capture session queue. -extern const char* FLTCaptureSessionQueueSpecific; +extern const char *FLTCaptureSessionQueueSpecific; /// Ensures the given block to be run on the main queue. /// If caller site is already on the main queue, the block will be run diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h index 846fcd02cde8..deeea1be90ff 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/messages.g.h @@ -141,10 +141,10 @@ typedef NS_ENUM(NSUInteger, FCPPlatformResolutionPreset) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithName:(NSString *)name - lensDirection:(FCPPlatformCameraLensDirection)lensDirection - lensType:(FCPPlatformCameraLensType)lensType; + lensDirection:(FCPPlatformCameraLensDirection)lensDirection + lensType:(FCPPlatformCameraLensType)lensType; /// The name of the camera device. -@property(nonatomic, copy) NSString * name; +@property(nonatomic, copy) NSString *name; /// The direction the camera is facing. @property(nonatomic, assign) FCPPlatformCameraLensDirection lensDirection; /// The type of the camera lens. @@ -155,53 +155,51 @@ typedef NS_ENUM(NSUInteger, FCPPlatformResolutionPreset) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithPreviewSize:(FCPPlatformSize *)previewSize - exposureMode:(FCPPlatformExposureMode)exposureMode - focusMode:(FCPPlatformFocusMode)focusMode - exposurePointSupported:(BOOL )exposurePointSupported - focusPointSupported:(BOOL )focusPointSupported; + exposureMode:(FCPPlatformExposureMode)exposureMode + focusMode:(FCPPlatformFocusMode)focusMode + exposurePointSupported:(BOOL)exposurePointSupported + focusPointSupported:(BOOL)focusPointSupported; /// The size of the preview, in pixels. -@property(nonatomic, strong) FCPPlatformSize * previewSize; +@property(nonatomic, strong) FCPPlatformSize *previewSize; /// The default exposure mode @property(nonatomic, assign) FCPPlatformExposureMode exposureMode; /// The default focus mode @property(nonatomic, assign) FCPPlatformFocusMode focusMode; /// Whether setting exposure points is supported. -@property(nonatomic, assign) BOOL exposurePointSupported; +@property(nonatomic, assign) BOOL exposurePointSupported; /// Whether setting focus points is supported. -@property(nonatomic, assign) BOOL focusPointSupported; +@property(nonatomic, assign) BOOL focusPointSupported; @end @interface FCPPlatformMediaSettings : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolutionPreset - framesPerSecond:(nullable NSNumber *)framesPerSecond - videoBitrate:(nullable NSNumber *)videoBitrate - audioBitrate:(nullable NSNumber *)audioBitrate - enableAudio:(BOOL )enableAudio; + framesPerSecond:(nullable NSNumber *)framesPerSecond + videoBitrate:(nullable NSNumber *)videoBitrate + audioBitrate:(nullable NSNumber *)audioBitrate + enableAudio:(BOOL)enableAudio; @property(nonatomic, assign) FCPPlatformResolutionPreset resolutionPreset; -@property(nonatomic, strong, nullable) NSNumber * framesPerSecond; -@property(nonatomic, strong, nullable) NSNumber * videoBitrate; -@property(nonatomic, strong, nullable) NSNumber * audioBitrate; -@property(nonatomic, assign) BOOL enableAudio; +@property(nonatomic, strong, nullable) NSNumber *framesPerSecond; +@property(nonatomic, strong, nullable) NSNumber *videoBitrate; +@property(nonatomic, strong, nullable) NSNumber *audioBitrate; +@property(nonatomic, assign) BOOL enableAudio; @end @interface FCPPlatformPoint : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithX:(double )x - y:(double )y; -@property(nonatomic, assign) double x; -@property(nonatomic, assign) double y; ++ (instancetype)makeWithX:(double)x y:(double)y; +@property(nonatomic, assign) double x; +@property(nonatomic, assign) double y; @end @interface FCPPlatformSize : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithWidth:(double )width - height:(double )height; -@property(nonatomic, assign) double width; -@property(nonatomic, assign) double height; ++ (instancetype)makeWithWidth:(double)width height:(double)height; +@property(nonatomic, assign) double width; +@property(nonatomic, assign) double height; @end /// The codec used by all APIs. @@ -209,11 +207,16 @@ NSObject *FCPGetMessagesCodec(void); @protocol FCPCameraApi /// Returns the list of available cameras. -- (void)availableCamerasWithCompletion:(void (^)(NSArray *_Nullable, FlutterError *_Nullable))completion; +- (void)availableCamerasWithCompletion:(void (^)(NSArray *_Nullable, + FlutterError *_Nullable))completion; /// Create a new camera with the given settings, and returns its ID. -- (void)createCameraWithName:(NSString *)cameraName settings:(FCPPlatformMediaSettings *)settings completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; +- (void)createCameraWithName:(NSString *)cameraName + settings:(FCPPlatformMediaSettings *)settings + completion:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Initializes the camera with the given ID. -- (void)initializeCamera:(NSInteger)cameraId withImageFormat:(FCPPlatformImageFormatGroup)imageFormat completion:(void (^)(FlutterError *_Nullable))completion; +- (void)initializeCamera:(NSInteger)cameraId + withImageFormat:(FCPPlatformImageFormatGroup)imageFormat + completion:(void (^)(FlutterError *_Nullable))completion; /// Begins streaming frames from the camera. - (void)startImageStreamWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Stops streaming frames from the camera. @@ -227,32 +230,39 @@ NSObject *FCPGetMessagesCodec(void); /// and any associated resources can be cleaned up. - (void)disposeCamera:(NSInteger)cameraId completion:(void (^)(FlutterError *_Nullable))completion; /// Locks the camera capture to the current device orientation. -- (void)lockCaptureOrientation:(FCPPlatformDeviceOrientation)orientation completion:(void (^)(FlutterError *_Nullable))completion; +- (void)lockCaptureOrientation:(FCPPlatformDeviceOrientation)orientation + completion:(void (^)(FlutterError *_Nullable))completion; /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. - (void)unlockCaptureOrientationWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Takes a picture with the current settings, and returns the path to the /// resulting file. -- (void)takePictureWithCompletion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; +- (void)takePictureWithCompletion:(void (^)(NSString *_Nullable, + FlutterError *_Nullable))completion; /// Does any preprocessing necessary before beginning to record video. - (void)prepareForVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Begins recording video, optionally enabling streaming to Dart at the same /// time. -- (void)startVideoRecordingWithStreaming:(BOOL)enableStream completion:(void (^)(FlutterError *_Nullable))completion; +- (void)startVideoRecordingWithStreaming:(BOOL)enableStream + completion:(void (^)(FlutterError *_Nullable))completion; /// Stops recording video, and results the path to the resulting file. -- (void)stopVideoRecordingWithCompletion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; +- (void)stopVideoRecordingWithCompletion:(void (^)(NSString *_Nullable, + FlutterError *_Nullable))completion; /// Pauses video recording. - (void)pauseVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Resumes a previously paused video recording. - (void)resumeVideoRecordingWithCompletion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given flash mode. -- (void)setFlashMode:(FCPPlatformFlashMode)mode completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFlashMode:(FCPPlatformFlashMode)mode + completion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given exposure mode. -- (void)setExposureMode:(FCPPlatformExposureMode)mode completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setExposureMode:(FCPPlatformExposureMode)mode + completion:(void (^)(FlutterError *_Nullable))completion; /// Anchors auto-exposure to the given point in (0,1) coordinate space. /// /// A null value resets to the default exposure point. -- (void)setExposurePoint:(nullable FCPPlatformPoint *)point completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setExposurePoint:(nullable FCPPlatformPoint *)point + completion:(void (^)(FlutterError *_Nullable))completion; /// Returns the minimum exposure offset supported by the camera. - (void)getMinimumExposureOffset:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Returns the maximum exposure offset supported by the camera. @@ -260,11 +270,13 @@ NSObject *FCPGetMessagesCodec(void); /// Sets the exposure offset manually to the given value. - (void)setExposureOffset:(double)offset completion:(void (^)(FlutterError *_Nullable))completion; /// Switches the camera to the given focus mode. -- (void)setFocusMode:(FCPPlatformFocusMode)mode completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFocusMode:(FCPPlatformFocusMode)mode + completion:(void (^)(FlutterError *_Nullable))completion; /// Anchors auto-focus to the given point in (0,1) coordinate space. /// /// A null value resets to the default focus point. -- (void)setFocusPoint:(nullable FCPPlatformPoint *)point completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setFocusPoint:(nullable FCPPlatformPoint *)point + completion:(void (^)(FlutterError *_Nullable))completion; /// Returns the minimum zoom level supported by the camera. - (void)getMinimumZoomLevel:(void (^)(NSNumber *_Nullable, FlutterError *_Nullable))completion; /// Returns the maximum zoom level supported by the camera. @@ -278,33 +290,40 @@ NSObject *FCPGetMessagesCodec(void); /// Changes the camera used while recording video. /// /// This should only be called while video recording is active. -- (void)updateDescriptionWhileRecordingCameraName:(NSString *)cameraName completion:(void (^)(FlutterError *_Nullable))completion; +- (void)updateDescriptionWhileRecordingCameraName:(NSString *)cameraName + completion:(void (^)(FlutterError *_Nullable))completion; /// Sets the file format used for taking pictures. -- (void)setImageFileFormat:(FCPPlatformImageFileFormat)format completion:(void (^)(FlutterError *_Nullable))completion; +- (void)setImageFileFormat:(FCPPlatformImageFileFormat)format + completion:(void (^)(FlutterError *_Nullable))completion; @end -extern void SetUpFCPCameraApi(id binaryMessenger, NSObject *_Nullable api); - -extern void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSObject *_Nullable api, NSString *messageChannelSuffix); +extern void SetUpFCPCameraApi(id binaryMessenger, + NSObject *_Nullable api); +extern void SetUpFCPCameraApiWithSuffix(id binaryMessenger, + NSObject *_Nullable api, + NSString *messageChannelSuffix); /// Handler for native callbacks that are not tied to a specific camera ID. @interface FCPCameraGlobalEventApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger messageChannelSuffix:(nullable NSString *)messageChannelSuffix; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + messageChannelSuffix:(nullable NSString *)messageChannelSuffix; /// Called when the device's physical orientation changes. -- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)orientation completion:(void (^)(FlutterError *_Nullable))completion; +- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)orientation + completion:(void (^)(FlutterError *_Nullable))completion; @end - /// Handler for native callbacks that are tied to a specific camera ID. /// /// This is intended to be initialized with the camera ID as a suffix. @interface FCPCameraEventApi : NSObject - (instancetype)initWithBinaryMessenger:(id)binaryMessenger; -- (instancetype)initWithBinaryMessenger:(id)binaryMessenger messageChannelSuffix:(nullable NSString *)messageChannelSuffix; +- (instancetype)initWithBinaryMessenger:(id)binaryMessenger + messageChannelSuffix:(nullable NSString *)messageChannelSuffix; /// Called when the camera is inialitized for use. -- (void)initializedWithState:(FCPPlatformCameraState *)initialState completion:(void (^)(FlutterError *_Nullable))completion; +- (void)initializedWithState:(FCPPlatformCameraState *)initialState + completion:(void (^)(FlutterError *_Nullable))completion; /// Called when an error occurs in the camera. /// /// This should be used for errors that occur outside of the context of diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m index 1494bbe9e64e..7d8442f1634c 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/messages.g.m @@ -26,7 +26,12 @@ } static FlutterError *createConnectionError(NSString *channelName) { - return [FlutterError errorWithCode:@"channel-error" message:[NSString stringWithFormat:@"%@/%@/%@", @"Unable to establish connection on channel: '", channelName, @"'."] details:@""]; + return [FlutterError + errorWithCode:@"channel-error" + message:[NSString stringWithFormat:@"%@/%@/%@", + @"Unable to establish connection on channel: '", + channelName, @"'."] + details:@""]; } static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { @@ -157,9 +162,9 @@ + (nullable FCPPlatformSize *)nullableFromList:(NSArray *)list; @implementation FCPPlatformCameraDescription + (instancetype)makeWithName:(NSString *)name - lensDirection:(FCPPlatformCameraLensDirection)lensDirection - lensType:(FCPPlatformCameraLensType)lensType { - FCPPlatformCameraDescription* pigeonResult = [[FCPPlatformCameraDescription alloc] init]; + lensDirection:(FCPPlatformCameraLensDirection)lensDirection + lensType:(FCPPlatformCameraLensType)lensType { + FCPPlatformCameraDescription *pigeonResult = [[FCPPlatformCameraDescription alloc] init]; pigeonResult.name = name; pigeonResult.lensDirection = lensDirection; pigeonResult.lensType = lensType; @@ -168,7 +173,8 @@ + (instancetype)makeWithName:(NSString *)name + (FCPPlatformCameraDescription *)fromList:(NSArray *)list { FCPPlatformCameraDescription *pigeonResult = [[FCPPlatformCameraDescription alloc] init]; pigeonResult.name = GetNullableObjectAtIndex(list, 0); - FCPPlatformCameraLensDirectionBox *boxedFCPPlatformCameraLensDirection = GetNullableObjectAtIndex(list, 1); + FCPPlatformCameraLensDirectionBox *boxedFCPPlatformCameraLensDirection = + GetNullableObjectAtIndex(list, 1); pigeonResult.lensDirection = boxedFCPPlatformCameraLensDirection.value; FCPPlatformCameraLensTypeBox *boxedFCPPlatformCameraLensType = GetNullableObjectAtIndex(list, 2); pigeonResult.lensType = boxedFCPPlatformCameraLensType.value; @@ -188,11 +194,11 @@ + (nullable FCPPlatformCameraDescription *)nullableFromList:(NSArray *)list @implementation FCPPlatformCameraState + (instancetype)makeWithPreviewSize:(FCPPlatformSize *)previewSize - exposureMode:(FCPPlatformExposureMode)exposureMode - focusMode:(FCPPlatformFocusMode)focusMode - exposurePointSupported:(BOOL )exposurePointSupported - focusPointSupported:(BOOL )focusPointSupported { - FCPPlatformCameraState* pigeonResult = [[FCPPlatformCameraState alloc] init]; + exposureMode:(FCPPlatformExposureMode)exposureMode + focusMode:(FCPPlatformFocusMode)focusMode + exposurePointSupported:(BOOL)exposurePointSupported + focusPointSupported:(BOOL)focusPointSupported { + FCPPlatformCameraState *pigeonResult = [[FCPPlatformCameraState alloc] init]; pigeonResult.previewSize = previewSize; pigeonResult.exposureMode = exposureMode; pigeonResult.focusMode = focusMode; @@ -227,11 +233,11 @@ + (nullable FCPPlatformCameraState *)nullableFromList:(NSArray *)list { @implementation FCPPlatformMediaSettings + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolutionPreset - framesPerSecond:(nullable NSNumber *)framesPerSecond - videoBitrate:(nullable NSNumber *)videoBitrate - audioBitrate:(nullable NSNumber *)audioBitrate - enableAudio:(BOOL )enableAudio { - FCPPlatformMediaSettings* pigeonResult = [[FCPPlatformMediaSettings alloc] init]; + framesPerSecond:(nullable NSNumber *)framesPerSecond + videoBitrate:(nullable NSNumber *)videoBitrate + audioBitrate:(nullable NSNumber *)audioBitrate + enableAudio:(BOOL)enableAudio { + FCPPlatformMediaSettings *pigeonResult = [[FCPPlatformMediaSettings alloc] init]; pigeonResult.resolutionPreset = resolutionPreset; pigeonResult.framesPerSecond = framesPerSecond; pigeonResult.videoBitrate = videoBitrate; @@ -241,7 +247,8 @@ + (instancetype)makeWithResolutionPreset:(FCPPlatformResolutionPreset)resolution } + (FCPPlatformMediaSettings *)fromList:(NSArray *)list { FCPPlatformMediaSettings *pigeonResult = [[FCPPlatformMediaSettings alloc] init]; - FCPPlatformResolutionPresetBox *boxedFCPPlatformResolutionPreset = GetNullableObjectAtIndex(list, 0); + FCPPlatformResolutionPresetBox *boxedFCPPlatformResolutionPreset = + GetNullableObjectAtIndex(list, 0); pigeonResult.resolutionPreset = boxedFCPPlatformResolutionPreset.value; pigeonResult.framesPerSecond = GetNullableObjectAtIndex(list, 1); pigeonResult.videoBitrate = GetNullableObjectAtIndex(list, 2); @@ -264,9 +271,8 @@ + (nullable FCPPlatformMediaSettings *)nullableFromList:(NSArray *)list { @end @implementation FCPPlatformPoint -+ (instancetype)makeWithX:(double )x - y:(double )y { - FCPPlatformPoint* pigeonResult = [[FCPPlatformPoint alloc] init]; ++ (instancetype)makeWithX:(double)x y:(double)y { + FCPPlatformPoint *pigeonResult = [[FCPPlatformPoint alloc] init]; pigeonResult.x = x; pigeonResult.y = y; return pigeonResult; @@ -289,9 +295,8 @@ + (nullable FCPPlatformPoint *)nullableFromList:(NSArray *)list { @end @implementation FCPPlatformSize -+ (instancetype)makeWithWidth:(double )width - height:(double )height { - FCPPlatformSize* pigeonResult = [[FCPPlatformSize alloc] init]; ++ (instancetype)makeWithWidth:(double)width height:(double)height { + FCPPlatformSize *pigeonResult = [[FCPPlatformSize alloc] init]; pigeonResult.width = width; pigeonResult.height = height; return pigeonResult; @@ -320,49 +325,67 @@ - (nullable id)readValueOfType:(UInt8)type { switch (type) { case 129: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformCameraLensDirectionBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil + : [[FCPPlatformCameraLensDirectionBox alloc] + initWithValue:[enumAsNumber integerValue]]; } case 130: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformCameraLensTypeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil + ? nil + : [[FCPPlatformCameraLensTypeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 131: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformDeviceOrientationBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil + : [[FCPPlatformDeviceOrientationBox alloc] + initWithValue:[enumAsNumber integerValue]]; } case 132: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformExposureModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil + ? nil + : [[FCPPlatformExposureModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 133: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformFlashModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil + ? nil + : [[FCPPlatformFlashModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 134: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformFocusModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil + ? nil + : [[FCPPlatformFocusModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 135: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformImageFileFormatBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil + : [[FCPPlatformImageFileFormatBox alloc] + initWithValue:[enumAsNumber integerValue]]; } case 136: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformImageFormatGroupBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil + : [[FCPPlatformImageFormatGroupBox alloc] + initWithValue:[enumAsNumber integerValue]]; } case 137: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformResolutionPresetBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil + : [[FCPPlatformResolutionPresetBox alloc] + initWithValue:[enumAsNumber integerValue]]; } - case 138: + case 138: return [FCPPlatformCameraDescription fromList:[self readValue]]; - case 139: + case 139: return [FCPPlatformCameraState fromList:[self readValue]]; - case 140: + case 140: return [FCPPlatformMediaSettings fromList:[self readValue]]; - case 141: + case 141: return [FCPPlatformPoint fromList:[self readValue]]; - case 142: + case 142: return [FCPPlatformSize fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -446,7 +469,8 @@ - (FlutterStandardReader *)readerWithData:(NSData *)data { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FCPMessagesPigeonCodecReaderWriter *readerWriter = [[FCPMessagesPigeonCodecReaderWriter alloc] init]; + FCPMessagesPigeonCodecReaderWriter *readerWriter = + [[FCPMessagesPigeonCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; @@ -455,19 +479,29 @@ void SetUpFCPCameraApi(id binaryMessenger, NSObject binaryMessenger, NSObject *api, NSString *messageChannelSuffix) { - messageChannelSuffix = messageChannelSuffix.length > 0 ? [NSString stringWithFormat: @".%@", messageChannelSuffix] : @""; +void SetUpFCPCameraApiWithSuffix(id binaryMessenger, + NSObject *api, NSString *messageChannelSuffix) { + messageChannelSuffix = messageChannelSuffix.length > 0 + ? [NSString stringWithFormat:@".%@", messageChannelSuffix] + : @""; /// Returns the list of available cameras. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.getAvailableCameras", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(availableCamerasWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(availableCamerasWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(availableCamerasWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(availableCamerasWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api availableCamerasWithCompletion:^(NSArray *_Nullable output, FlutterError *_Nullable error) { + [api availableCamerasWithCompletion:^( + NSArray *_Nullable output, + FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -477,20 +511,27 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Create a new camera with the given settings, and returns its ID. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.create", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.create", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(createCameraWithName:settings:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(createCameraWithName:settings:completion:)", api); + NSCAssert([api respondsToSelector:@selector(createCameraWithName:settings:completion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(createCameraWithName:settings:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_cameraName = GetNullableObjectAtIndex(args, 0); FCPPlatformMediaSettings *arg_settings = GetNullableObjectAtIndex(args, 1); - [api createCameraWithName:arg_cameraName settings:arg_settings completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api createCameraWithName:arg_cameraName + settings:arg_settings + completion:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -498,21 +539,30 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Initializes the camera with the given ID. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + [NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(initializeCamera:withImageFormat:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(initializeCamera:withImageFormat:completion:)", api); + NSCAssert([api respondsToSelector:@selector(initializeCamera:withImageFormat:completion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(initializeCamera:withImageFormat:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSInteger arg_cameraId = [GetNullableObjectAtIndex(args, 0) integerValue]; - FCPPlatformImageFormatGroupBox *boxedFCPPlatformImageFormatGroup = GetNullableObjectAtIndex(args, 1); + FCPPlatformImageFormatGroupBox *boxedFCPPlatformImageFormatGroup = + GetNullableObjectAtIndex(args, 1); FCPPlatformImageFormatGroup arg_imageFormat = boxedFCPPlatformImageFormatGroup.value; - [api initializeCamera:arg_cameraId withImageFormat:arg_imageFormat completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api initializeCamera:arg_cameraId + withImageFormat:arg_imageFormat + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -520,13 +570,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Begins streaming frames from the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.startImageStream", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(startImageStreamWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(startImageStreamWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(startImageStreamWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(startImageStreamWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api startImageStreamWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -538,13 +593,19 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Stops streaming frames from the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(stopImageStreamWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(stopImageStreamWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(stopImageStreamWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(stopImageStreamWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api stopImageStreamWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -559,13 +620,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// /// This is used to throttle sending frames across the channel. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.receivedImageStreamData", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(receivedImageStreamDataWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(receivedImageStreamDataWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(receivedImageStreamDataWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(receivedImageStreamDataWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api receivedImageStreamDataWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -578,19 +644,24 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// Indicates that the given camera is no longer being used on the Dart side, /// and any associated resources can be cleaned up. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(disposeCamera:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(disposeCamera:completion:)", api); + NSCAssert([api respondsToSelector:@selector(disposeCamera:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(disposeCamera:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSInteger arg_cameraId = [GetNullableObjectAtIndex(args, 0) integerValue]; - [api disposeCamera:arg_cameraId completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api disposeCamera:arg_cameraId + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -598,20 +669,27 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Locks the camera capture to the current device orientation. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.lockCaptureOrientation", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(lockCaptureOrientation:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(lockCaptureOrientation:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector(lockCaptureOrientation:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(lockCaptureOrientation:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FCPPlatformDeviceOrientationBox *boxedFCPPlatformDeviceOrientation = GetNullableObjectAtIndex(args, 0); + FCPPlatformDeviceOrientationBox *boxedFCPPlatformDeviceOrientation = + GetNullableObjectAtIndex(args, 0); FCPPlatformDeviceOrientation arg_orientation = boxedFCPPlatformDeviceOrientation.value; - [api lockCaptureOrientation:arg_orientation completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api lockCaptureOrientation:arg_orientation + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -620,13 +698,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.unlockCaptureOrientation", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(unlockCaptureOrientationWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(unlockCaptureOrientationWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(unlockCaptureOrientationWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(unlockCaptureOrientationWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api unlockCaptureOrientationWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -639,17 +722,23 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// Takes a picture with the current settings, and returns the path to the /// resulting file. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName: + [NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(takePictureWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(takePictureWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(takePictureWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(takePictureWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api takePictureWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api + takePictureWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -657,13 +746,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Does any preprocessing necessary before beginning to record video. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.prepareForVideoRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(prepareForVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(prepareForVideoRecordingWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(prepareForVideoRecordingWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(prepareForVideoRecordingWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api prepareForVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -676,19 +770,25 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// Begins recording video, optionally enabling streaming to Dart at the same /// time. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.startVideoRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(startVideoRecordingWithStreaming:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(startVideoRecordingWithStreaming:completion:)", api); + NSCAssert([api respondsToSelector:@selector(startVideoRecordingWithStreaming:completion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(startVideoRecordingWithStreaming:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; BOOL arg_enableStream = [GetNullableObjectAtIndex(args, 0) boolValue]; - [api startVideoRecordingWithStreaming:arg_enableStream completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api startVideoRecordingWithStreaming:arg_enableStream + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -696,15 +796,21 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Stops recording video, and results the path to the resulting file. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.stopVideoRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(stopVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(stopVideoRecordingWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(stopVideoRecordingWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(stopVideoRecordingWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { - [api stopVideoRecordingWithCompletion:^(NSString *_Nullable output, FlutterError *_Nullable error) { + [api stopVideoRecordingWithCompletion:^(NSString *_Nullable output, + FlutterError *_Nullable error) { callback(wrapResult(output, error)); }]; }]; @@ -714,13 +820,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Pauses video recording. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.pauseVideoRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(pauseVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(pauseVideoRecordingWithCompletion:)", api); + NSCAssert( + [api respondsToSelector:@selector(pauseVideoRecordingWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(pauseVideoRecordingWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api pauseVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -732,13 +843,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Resumes a previously paused video recording. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.resumeVideoRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(resumeVideoRecordingWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(resumeVideoRecordingWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(resumeVideoRecordingWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(resumeVideoRecordingWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api resumeVideoRecordingWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -750,20 +866,26 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Switches the camera to the given flash mode. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFlashMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFlashMode:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setFlashMode:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setFlashMode:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformFlashModeBox *boxedFCPPlatformFlashMode = GetNullableObjectAtIndex(args, 0); FCPPlatformFlashMode arg_mode = boxedFCPPlatformFlashMode.value; - [api setFlashMode:arg_mode completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFlashMode:arg_mode + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -771,20 +893,27 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Switches the camera to the given exposure mode. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposureMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureMode:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setExposureMode:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureMode:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FCPPlatformExposureModeBox *boxedFCPPlatformExposureMode = GetNullableObjectAtIndex(args, 0); + FCPPlatformExposureModeBox *boxedFCPPlatformExposureMode = + GetNullableObjectAtIndex(args, 0); FCPPlatformExposureMode arg_mode = boxedFCPPlatformExposureMode.value; - [api setExposureMode:arg_mode completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposureMode:arg_mode + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -794,19 +923,24 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// /// A null value resets to the default exposure point. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.setExposurePoint", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposurePoint:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposurePoint:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setExposurePoint:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setExposurePoint:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformPoint *arg_point = GetNullableObjectAtIndex(args, 0); - [api setExposurePoint:arg_point completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposurePoint:arg_point + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -814,13 +948,17 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Returns the minimum exposure offset supported by the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.getMinExposureOffset", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMinimumExposureOffset:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumExposureOffset:)", api); + NSCAssert([api respondsToSelector:@selector(getMinimumExposureOffset:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumExposureOffset:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMinimumExposureOffset:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -832,13 +970,17 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Returns the maximum exposure offset supported by the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.getMaxExposureOffset", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMaximumExposureOffset:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumExposureOffset:)", api); + NSCAssert([api respondsToSelector:@selector(getMaximumExposureOffset:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumExposureOffset:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMaximumExposureOffset:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -850,19 +992,25 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Sets the exposure offset manually to the given value. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.setExposureOffset", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setExposureOffset:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureOffset:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector(setExposureOffset:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setExposureOffset:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; double arg_offset = [GetNullableObjectAtIndex(args, 0) doubleValue]; - [api setExposureOffset:arg_offset completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setExposureOffset:arg_offset + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -870,20 +1018,26 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Switches the camera to the given focus mode. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFocusMode:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusMode:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setFocusMode:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusMode:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformFocusModeBox *boxedFCPPlatformFocusMode = GetNullableObjectAtIndex(args, 0); FCPPlatformFocusMode arg_mode = boxedFCPPlatformFocusMode.value; - [api setFocusMode:arg_mode completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFocusMode:arg_mode + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -893,19 +1047,25 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// /// A null value resets to the default focus point. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setFocusPoint:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusPoint:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setFocusPoint:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setFocusPoint:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FCPPlatformPoint *arg_point = GetNullableObjectAtIndex(args, 0); - [api setFocusPoint:arg_point completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setFocusPoint:arg_point + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -913,13 +1073,17 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Returns the minimum zoom level supported by the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMinimumZoomLevel:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumZoomLevel:)", api); + NSCAssert([api respondsToSelector:@selector(getMinimumZoomLevel:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(getMinimumZoomLevel:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMinimumZoomLevel:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -931,13 +1095,17 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Returns the maximum zoom level supported by the camera. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(getMaximumZoomLevel:)], @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumZoomLevel:)", api); + NSCAssert([api respondsToSelector:@selector(getMaximumZoomLevel:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(getMaximumZoomLevel:)", api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api getMaximumZoomLevel:^(NSNumber *_Nullable output, FlutterError *_Nullable error) { callback(wrapResult(output, error)); @@ -949,19 +1117,25 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Sets the zoom factor. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setZoomLevel:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setZoomLevel:completion:)", api); + NSCAssert([api respondsToSelector:@selector(setZoomLevel:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setZoomLevel:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; double arg_zoom = [GetNullableObjectAtIndex(args, 0) doubleValue]; - [api setZoomLevel:arg_zoom completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setZoomLevel:arg_zoom + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -969,13 +1143,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Pauses streaming of preview frames. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(pausePreviewWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(pausePreviewWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(pausePreviewWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(pausePreviewWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api pausePreviewWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -987,13 +1166,18 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Resumes a previously paused preview stream. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(resumePreviewWithCompletion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(resumePreviewWithCompletion:)", api); + NSCAssert([api respondsToSelector:@selector(resumePreviewWithCompletion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(resumePreviewWithCompletion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { [api resumePreviewWithCompletion:^(FlutterError *_Nullable error) { callback(wrapResult(nil, error)); @@ -1007,19 +1191,26 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO /// /// This should only be called while video recording is active. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.updateDescriptionWhileRecording", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(updateDescriptionWhileRecordingCameraName:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(updateDescriptionWhileRecordingCameraName:completion:)", api); + NSCAssert([api respondsToSelector:@selector(updateDescriptionWhileRecordingCameraName: + completion:)], + @"FCPCameraApi api (%@) doesn't respond to " + @"@selector(updateDescriptionWhileRecordingCameraName:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; NSString *arg_cameraName = GetNullableObjectAtIndex(args, 0); - [api updateDescriptionWhileRecordingCameraName:arg_cameraName completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api updateDescriptionWhileRecordingCameraName:arg_cameraName + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1027,20 +1218,27 @@ void SetUpFCPCameraApiWithSuffix(id binaryMessenger, NSO } /// Sets the file format used for taking pictures. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:[NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat", messageChannelSuffix] + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:[NSString stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation." + @"CameraApi.setImageFileFormat", + messageChannelSuffix] binaryMessenger:binaryMessenger - codec:FCPGetMessagesCodec()]; + codec:FCPGetMessagesCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(setImageFileFormat:completion:)], @"FCPCameraApi api (%@) doesn't respond to @selector(setImageFileFormat:completion:)", api); + NSCAssert( + [api respondsToSelector:@selector(setImageFileFormat:completion:)], + @"FCPCameraApi api (%@) doesn't respond to @selector(setImageFileFormat:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; - FCPPlatformImageFileFormatBox *boxedFCPPlatformImageFileFormat = GetNullableObjectAtIndex(args, 0); + FCPPlatformImageFileFormatBox *boxedFCPPlatformImageFileFormat = + GetNullableObjectAtIndex(args, 0); FCPPlatformImageFileFormat arg_format = boxedFCPPlatformImageFileFormat.value; - [api setImageFileFormat:arg_format completion:^(FlutterError *_Nullable error) { - callback(wrapResult(nil, error)); - }]; + [api setImageFileFormat:arg_format + completion:^(FlutterError *_Nullable error) { + callback(wrapResult(nil, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -1057,32 +1255,42 @@ @implementation FCPCameraGlobalEventApi - (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""]; } -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger messageChannelSuffix:(nullable NSString*)messageChannelSuffix{ +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger + messageChannelSuffix:(nullable NSString *)messageChannelSuffix { self = [self init]; if (self) { _binaryMessenger = binaryMessenger; - _messageChannelSuffix = [messageChannelSuffix length] == 0 ? @"" : [NSString stringWithFormat: @".%@", messageChannelSuffix]; + _messageChannelSuffix = [messageChannelSuffix length] == 0 + ? @"" + : [NSString stringWithFormat:@".%@", messageChannelSuffix]; } return self; } -- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)arg_orientation completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged", _messageChannelSuffix]; +- (void)deviceOrientationChangedOrientation:(FCPPlatformDeviceOrientation)arg_orientation + completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString + stringWithFormat: + @"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged", + _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPGetMessagesCodec()]; - [channel sendMessage:@[[[FCPPlatformDeviceOrientationBox alloc] initWithValue:arg_orientation]] reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPGetMessagesCodec()]; + [channel sendMessage:@[ [[FCPPlatformDeviceOrientationBox alloc] initWithValue:arg_orientation] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } @end @@ -1096,51 +1304,64 @@ @implementation FCPCameraEventApi - (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger { return [self initWithBinaryMessenger:binaryMessenger messageChannelSuffix:@""]; } -- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger messageChannelSuffix:(nullable NSString*)messageChannelSuffix{ +- (instancetype)initWithBinaryMessenger:(NSObject *)binaryMessenger + messageChannelSuffix:(nullable NSString *)messageChannelSuffix { self = [self init]; if (self) { _binaryMessenger = binaryMessenger; - _messageChannelSuffix = [messageChannelSuffix length] == 0 ? @"" : [NSString stringWithFormat: @".%@", messageChannelSuffix]; + _messageChannelSuffix = [messageChannelSuffix length] == 0 + ? @"" + : [NSString stringWithFormat:@".%@", messageChannelSuffix]; } return self; } -- (void)initializedWithState:(FCPPlatformCameraState *)arg_initialState completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized", _messageChannelSuffix]; +- (void)initializedWithState:(FCPPlatformCameraState *)arg_initialState + completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString + stringWithFormat:@"%@%@", + @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized", + _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPGetMessagesCodec()]; - [channel sendMessage:@[arg_initialState ?: [NSNull null]] reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPGetMessagesCodec()]; + [channel sendMessage:@[ arg_initialState ?: [NSNull null] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } -- (void)reportError:(NSString *)arg_message completion:(void (^)(FlutterError *_Nullable))completion { - NSString *channelName = [NSString stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error", _messageChannelSuffix]; +- (void)reportError:(NSString *)arg_message + completion:(void (^)(FlutterError *_Nullable))completion { + NSString *channelName = [NSString + stringWithFormat:@"%@%@", @"dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error", + _messageChannelSuffix]; FlutterBasicMessageChannel *channel = - [FlutterBasicMessageChannel - messageChannelWithName:channelName - binaryMessenger:self.binaryMessenger - codec:FCPGetMessagesCodec()]; - [channel sendMessage:@[arg_message ?: [NSNull null]] reply:^(NSArray *reply) { - if (reply != nil) { - if (reply.count > 1) { - completion([FlutterError errorWithCode:reply[0] message:reply[1] details:reply[2]]); - } else { - completion(nil); - } - } else { - completion(createConnectionError(channelName)); - } - }]; + [FlutterBasicMessageChannel messageChannelWithName:channelName + binaryMessenger:self.binaryMessenger + codec:FCPGetMessagesCodec()]; + [channel sendMessage:@[ arg_message ?: [NSNull null] ] + reply:^(NSArray *reply) { + if (reply != nil) { + if (reply.count > 1) { + completion([FlutterError errorWithCode:reply[0] + message:reply[1] + details:reply[2]]); + } else { + completion(nil); + } + } else { + completion(createConnectionError(channelName)); + } + }]; } @end - diff --git a/packages/camera/camera_avfoundation/lib/src/messages.g.dart b/packages/camera/camera_avfoundation/lib/src/messages.g.dart index fdeabc8a53e0..72d4dddd448b 100644 --- a/packages/camera/camera_avfoundation/lib/src/messages.g.dart +++ b/packages/camera/camera_avfoundation/lib/src/messages.g.dart @@ -18,7 +18,8 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse( + {Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -31,8 +32,10 @@ List wrapResponse({Object? result, PlatformException? error, bool empty enum PlatformCameraLensDirection { /// Front facing camera (a user looking at the screen is seen by the camera). front, + /// Back facing camera (a user looking at the screen is not seen by the camera). back, + /// External camera which may not be mounted to the device. external, } @@ -40,10 +43,13 @@ enum PlatformCameraLensDirection { enum PlatformCameraLensType { /// A built-in wide-angle camera device type. wide, + /// A built-in camera device type with a longer focal length than a wide-angle camera. telephoto, + /// A built-in camera device type with a shorter focal length than a wide-angle camera. ultraWide, + /// Unknown camera device type. unknown, } @@ -265,7 +271,6 @@ class PlatformSize { } } - class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -273,46 +278,46 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is PlatformCameraLensDirection) { + } else if (value is PlatformCameraLensDirection) { buffer.putUint8(129); writeValue(buffer, value.index); - } else if (value is PlatformCameraLensType) { + } else if (value is PlatformCameraLensType) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is PlatformDeviceOrientation) { + } else if (value is PlatformDeviceOrientation) { buffer.putUint8(131); writeValue(buffer, value.index); - } else if (value is PlatformExposureMode) { + } else if (value is PlatformExposureMode) { buffer.putUint8(132); writeValue(buffer, value.index); - } else if (value is PlatformFlashMode) { + } else if (value is PlatformFlashMode) { buffer.putUint8(133); writeValue(buffer, value.index); - } else if (value is PlatformFocusMode) { + } else if (value is PlatformFocusMode) { buffer.putUint8(134); writeValue(buffer, value.index); - } else if (value is PlatformImageFileFormat) { + } else if (value is PlatformImageFileFormat) { buffer.putUint8(135); writeValue(buffer, value.index); - } else if (value is PlatformImageFormatGroup) { + } else if (value is PlatformImageFormatGroup) { buffer.putUint8(136); writeValue(buffer, value.index); - } else if (value is PlatformResolutionPreset) { + } else if (value is PlatformResolutionPreset) { buffer.putUint8(137); writeValue(buffer, value.index); - } else if (value is PlatformCameraDescription) { + } else if (value is PlatformCameraDescription) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value is PlatformCameraState) { + } else if (value is PlatformCameraState) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is PlatformMediaSettings) { + } else if (value is PlatformMediaSettings) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is PlatformPoint) { + } else if (value is PlatformPoint) { buffer.putUint8(141); writeValue(buffer, value.encode()); - } else if (value is PlatformSize) { + } else if (value is PlatformSize) { buffer.putUint8(142); writeValue(buffer, value.encode()); } else { @@ -323,42 +328,42 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: + case 129: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformCameraLensDirection.values[value]; - case 130: + case 130: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformCameraLensType.values[value]; - case 131: + case 131: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformDeviceOrientation.values[value]; - case 132: + case 132: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformExposureMode.values[value]; - case 133: + case 133: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformFlashMode.values[value]; - case 134: + case 134: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformFocusMode.values[value]; - case 135: + case 135: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformImageFileFormat.values[value]; - case 136: + case 136: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformImageFormatGroup.values[value]; - case 137: + case 137: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformResolutionPreset.values[value]; - case 138: + case 138: return PlatformCameraDescription.decode(readValue(buffer)!); - case 139: + case 139: return PlatformCameraState.decode(readValue(buffer)!); - case 140: + case 140: return PlatformMediaSettings.decode(readValue(buffer)!); - case 141: + case 141: return PlatformPoint.decode(readValue(buffer)!); - case 142: + case 142: return PlatformSize.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -370,9 +375,11 @@ class CameraApi { /// Constructor for [CameraApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - CameraApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + CameraApi( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) : pigeonVar_binaryMessenger = binaryMessenger, - pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + pigeonVar_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); @@ -381,8 +388,10 @@ class CameraApi { /// Returns the list of available cameras. Future> getAvailableCameras() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getAvailableCameras$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -403,20 +412,23 @@ class CameraApi { message: 'Host platform returned null value for non-null return value.', ); } else { - return (pigeonVar_replyList[0] as List?)!.cast(); + return (pigeonVar_replyList[0] as List?)! + .cast(); } } /// Create a new camera with the given settings, and returns its ID. Future create(String cameraName, PlatformMediaSettings settings) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.create$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.create$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([cameraName, settings]) as List?; + final List? pigeonVar_replyList = await pigeonVar_channel + .send([cameraName, settings]) as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -436,15 +448,18 @@ class CameraApi { } /// Initializes the camera with the given ID. - Future initialize(int cameraId, PlatformImageFormatGroup imageFormat) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + Future initialize( + int cameraId, PlatformImageFormatGroup imageFormat) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.initialize$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = - await pigeonVar_channel.send([cameraId, imageFormat]) as List?; + final List? pigeonVar_replyList = await pigeonVar_channel + .send([cameraId, imageFormat]) as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -460,8 +475,10 @@ class CameraApi { /// Begins streaming frames from the camera. Future startImageStream() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startImageStream$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -483,8 +500,10 @@ class CameraApi { /// Stops streaming frames from the camera. Future stopImageStream() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopImageStream$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -509,8 +528,10 @@ class CameraApi { /// /// This is used to throttle sending frames across the channel. Future receivedImageStreamData() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.receivedImageStreamData$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -533,8 +554,10 @@ class CameraApi { /// Indicates that the given camera is no longer being used on the Dart side, /// and any associated resources can be cleaned up. Future dispose(int cameraId) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.dispose$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -555,9 +578,12 @@ class CameraApi { } /// Locks the camera capture to the current device orientation. - Future lockCaptureOrientation(PlatformDeviceOrientation orientation) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + Future lockCaptureOrientation( + PlatformDeviceOrientation orientation) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.lockCaptureOrientation$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -580,8 +606,10 @@ class CameraApi { /// Unlocks camera capture orientation, allowing it to automatically adapt to /// device orientation. Future unlockCaptureOrientation() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.unlockCaptureOrientation$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -604,8 +632,10 @@ class CameraApi { /// Takes a picture with the current settings, and returns the path to the /// resulting file. Future takePicture() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.takePicture$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -632,8 +662,10 @@ class CameraApi { /// Does any preprocessing necessary before beginning to record video. Future prepareForVideoRecording() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.prepareForVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -656,8 +688,10 @@ class CameraApi { /// Begins recording video, optionally enabling streaming to Dart at the same /// time. Future startVideoRecording(bool enableStream) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.startVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -679,8 +713,10 @@ class CameraApi { /// Stops recording video, and results the path to the resulting file. Future stopVideoRecording() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.stopVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -707,8 +743,10 @@ class CameraApi { /// Pauses video recording. Future pauseVideoRecording() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pauseVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -730,8 +768,10 @@ class CameraApi { /// Resumes a previously paused video recording. Future resumeVideoRecording() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumeVideoRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -753,8 +793,10 @@ class CameraApi { /// Switches the camera to the given flash mode. Future setFlashMode(PlatformFlashMode mode) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFlashMode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -776,8 +818,10 @@ class CameraApi { /// Switches the camera to the given exposure mode. Future setExposureMode(PlatformExposureMode mode) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureMode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -801,8 +845,10 @@ class CameraApi { /// /// A null value resets to the default exposure point. Future setExposurePoint(PlatformPoint? point) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposurePoint$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -824,8 +870,10 @@ class CameraApi { /// Returns the minimum exposure offset supported by the camera. Future getMinExposureOffset() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinExposureOffset$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -852,8 +900,10 @@ class CameraApi { /// Returns the maximum exposure offset supported by the camera. Future getMaxExposureOffset() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxExposureOffset$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -880,8 +930,10 @@ class CameraApi { /// Sets the exposure offset manually to the given value. Future setExposureOffset(double offset) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setExposureOffset$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -903,8 +955,10 @@ class CameraApi { /// Switches the camera to the given focus mode. Future setFocusMode(PlatformFocusMode mode) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusMode$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -928,8 +982,10 @@ class CameraApi { /// /// A null value resets to the default focus point. Future setFocusPoint(PlatformPoint? point) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setFocusPoint$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -951,8 +1007,10 @@ class CameraApi { /// Returns the minimum zoom level supported by the camera. Future getMinZoomLevel() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMinZoomLevel$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -979,8 +1037,10 @@ class CameraApi { /// Returns the maximum zoom level supported by the camera. Future getMaxZoomLevel() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.getMaxZoomLevel$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1007,8 +1067,10 @@ class CameraApi { /// Sets the zoom factor. Future setZoomLevel(double zoom) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setZoomLevel$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1030,8 +1092,10 @@ class CameraApi { /// Pauses streaming of preview frames. Future pausePreview() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.pausePreview$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1053,8 +1117,10 @@ class CameraApi { /// Resumes a previously paused preview stream. Future resumePreview() async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.resumePreview$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1078,8 +1144,10 @@ class CameraApi { /// /// This should only be called while video recording is active. Future updateDescriptionWhileRecording(String cameraName) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.updateDescriptionWhileRecording$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1101,8 +1169,10 @@ class CameraApi { /// Sets the file format used for taking pictures. Future setImageFileFormat(PlatformImageFileFormat format) async { - final String pigeonVar_channelName = 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( + final String pigeonVar_channelName = + 'dev.flutter.pigeon.camera_avfoundation.CameraApi.setImageFileFormat$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( pigeonVar_channelName, pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, @@ -1130,20 +1200,29 @@ abstract class CameraGlobalEventApi { /// Called when the device's physical orientation changes. void deviceOrientationChanged(PlatformDeviceOrientation orientation); - static void setUp(CameraGlobalEventApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { - messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp( + CameraGlobalEventApi? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged$messageChannelSuffix', pigeonChannelCodec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null.'); final List args = (message as List?)!; - final PlatformDeviceOrientation? arg_orientation = (args[0] as PlatformDeviceOrientation?); + final PlatformDeviceOrientation? arg_orientation = + (args[0] as PlatformDeviceOrientation?); assert(arg_orientation != null, 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraGlobalEventApi.deviceOrientationChanged was null, expected non-null PlatformDeviceOrientation.'); try { @@ -1151,8 +1230,9 @@ abstract class CameraGlobalEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); } }); } @@ -1175,20 +1255,29 @@ abstract class CameraEventApi { /// handling a specific HostApi call, such as during streaming. void error(String message); - static void setUp(CameraEventApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { - messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + static void setUp( + CameraEventApi? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized$messageChannelSuffix', pigeonChannelCodec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null.'); final List args = (message as List?)!; - final PlatformCameraState? arg_initialState = (args[0] as PlatformCameraState?); + final PlatformCameraState? arg_initialState = + (args[0] as PlatformCameraState?); assert(arg_initialState != null, 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.initialized was null, expected non-null PlatformCameraState.'); try { @@ -1196,22 +1285,26 @@ abstract class CameraEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); } }); } } { - final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error$messageChannelSuffix', pigeonChannelCodec, + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { pigeonVar_channel.setMessageHandler(null); } else { pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error was null.'); + 'Argument for dev.flutter.pigeon.camera_avfoundation.CameraEventApi.error was null.'); final List args = (message as List?)!; final String? arg_message = (args[0] as String?); assert(arg_message != null, @@ -1221,8 +1314,9 @@ abstract class CameraEventApi { return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); - } catch (e) { - return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); } }); } From a2ed93a394d5a3a3febeb4d8878680259553dec5 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 3 Apr 2025 09:42:13 -0400 Subject: [PATCH 22/25] Fix CI issues Remove Package.resolved file and update QueueUtils.h for consistent formatting --- .../xcshareddata/swiftpm/Package.resolved | 14 -------------- .../include/camera_avfoundation/QueueUtils.h | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) delete mode 100644 packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved deleted file mode 100644 index 68d3807f536e..000000000000 --- a/packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ /dev/null @@ -1,14 +0,0 @@ -{ - "originHash" : "7c8819d255ed200955091f7d8622f8ab2b9d2ffd207ca5223aa8dcd8b33c77a0", - "pins" : [ - { - "identity" : "ocmock", - "kind" : "remoteSourceControl", - "location" : "https://github.com/erikdoe/ocmock", - "state" : { - "revision" : "fe1661a3efed11831a6452f4b1a0c5e6ddc08c3d" - } - } - ], - "version" : 3 -} diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h index e230a53508fa..a7e22da716d0 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/include/camera_avfoundation/QueueUtils.h @@ -7,7 +7,7 @@ NS_ASSUME_NONNULL_BEGIN /// Queue-specific context data to be associated with the capture session queue. -extern const char *FLTCaptureSessionQueueSpecific; +extern const char* FLTCaptureSessionQueueSpecific; /// Ensures the given block to be run on the main queue. /// If caller site is already on the main queue, the block will be run From 770657a91aa6376f437cbaf2497fa7c0f593aac6 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 3 Apr 2025 14:43:45 -0400 Subject: [PATCH 23/25] Fix CI issue: Remove Package.resolved file from iOS example project --- .../xcshareddata/swiftpm/Package.resolved | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 packages/camera/camera_avfoundation/example/ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/packages/camera/camera_avfoundation/example/ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved b/packages/camera/camera_avfoundation/example/ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved deleted file mode 100644 index 68d3807f536e..000000000000 --- a/packages/camera/camera_avfoundation/example/ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ /dev/null @@ -1,14 +0,0 @@ -{ - "originHash" : "7c8819d255ed200955091f7d8622f8ab2b9d2ffd207ca5223aa8dcd8b33c77a0", - "pins" : [ - { - "identity" : "ocmock", - "kind" : "remoteSourceControl", - "location" : "https://github.com/erikdoe/ocmock", - "state" : { - "revision" : "fe1661a3efed11831a6452f4b1a0c5e6ddc08c3d" - } - } - ], - "version" : 3 -} From 17240e4801ffe8e9ad90d7abccd79ee773f0730b Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 3 Apr 2025 15:42:09 -0400 Subject: [PATCH 24/25] Bump version to 0.11.2 and update camera_avfoundation dependency to ^0.9.19 for lens type querying support on iOS --- packages/camera/camera/CHANGELOG.md | 4 ++++ packages/camera/camera/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/camera/camera/CHANGELOG.md b/packages/camera/camera/CHANGELOG.md index d0d58be6ca92..6125af33385d 100644 --- a/packages/camera/camera/CHANGELOG.md +++ b/packages/camera/camera/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.11.2 + +* Updates `camera_avfoundation` dependency to ^0.9.19 to include support for querying available lens types on iOS. + ## 0.11.1 * Adds API support query for image streaming. diff --git a/packages/camera/camera/pubspec.yaml b/packages/camera/camera/pubspec.yaml index ce14ee2ed45e..f13a7843b5ad 100644 --- a/packages/camera/camera/pubspec.yaml +++ b/packages/camera/camera/pubspec.yaml @@ -4,7 +4,7 @@ description: A Flutter plugin for controlling the camera. Supports previewing Dart. repository: https://github.com/flutter/packages/tree/main/packages/camera/camera issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 -version: 0.11.1 +version: 0.11.2 environment: sdk: ^3.6.0 From 9b6abc4d7b5e87eead951d7efd44fece9a9e505b Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Thu, 2 Oct 2025 11:15:45 -0400 Subject: [PATCH 25/25] Infer enum types --- .../camera_avfoundation/CameraPlugin.swift | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift index 543ad708c58c..9f9fc7b3f3d7 100644 --- a/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift +++ b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.swift @@ -163,28 +163,28 @@ extension CameraPlugin: FCPCameraApi { { switch device.position { case .back: - return FCPPlatformCameraLensDirection.back + return .back case .front: - return FCPPlatformCameraLensDirection.front + return .front case .unspecified: - return FCPPlatformCameraLensDirection.external + return .external @unknown default: - return FCPPlatformCameraLensDirection.external + return .external } } private func platformLensType(for device: FLTCaptureDevice) -> FCPPlatformCameraLensType { switch device.deviceType { - case AVCaptureDevice.DeviceType.builtInWideAngleCamera: - return FCPPlatformCameraLensType.wide - case AVCaptureDevice.DeviceType.builtInTelephotoCamera: - return FCPPlatformCameraLensType.telephoto - case AVCaptureDevice.DeviceType.builtInUltraWideCamera: - return FCPPlatformCameraLensType.ultraWide - case AVCaptureDevice.DeviceType.builtInDualWideCamera: - return FCPPlatformCameraLensType.wide + case .builtInWideAngleCamera: + return .wide + case .builtInTelephotoCamera: + return .telephoto + case .builtInUltraWideCamera: + return .ultraWide + case .builtInDualWideCamera: + return .wide default: - return FCPPlatformCameraLensType.unknown + return .unknown } }