From dad18b99c4e4a41ca4a4b48fe7f678c0bfca9064 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:10:59 -0500 Subject: [PATCH 01/24] add lens type info to camera plugin [ios-only] --- .../camera_avfoundation/CameraPlugin.m | 24 ++++++++++- .../camera_avfoundation/lib/src/utils.dart | 17 +++++++- .../camera_avfoundation/pigeons/messages.dart | 31 ++++++++++++++ .../lib/src/types/camera_description.dart | 40 +++++++++++++++++-- 4 files changed, 107 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 b9e1ef1850c..57a8f12e73d 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 @@ -150,6 +150,8 @@ - (void)availableCamerasWithCompletion: [[NSMutableArray alloc] initWithCapacity:devices.count]; for (NSObject *device in devices) { FCPPlatformCameraLensDirection lensFacing; + FCPPlatformCameraLensType lensType; + switch (device.position) { case AVCaptureDevicePositionBack: lensFacing = FCPPlatformCameraLensDirectionBack; @@ -161,8 +163,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 3fd7f59a891..266f38a816f 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 272ea288960..58fc5a50fb1 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 0167cf9e17a..1a666ccf093 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 @@ -16,6 +16,35 @@ enum CameraLensDirection { external, } +/// Represents various built-in camera lens types available on a device. +/// +/// Each lens type offers different focal lengths and capabilities for capturing images. +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. + 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, +} + /// Properties of a camera device. @immutable class CameraDescription { @@ -24,6 +53,7 @@ class CameraDescription { required this.name, required this.lensDirection, required this.sensorOrientation, + this.lensType = CameraLensType.unknown, }); /// The name of the camera device. @@ -41,20 +71,24 @@ class CameraDescription { /// is from top to bottom in the sensor's coordinate system. final int sensorOrientation; + /// The type of lens the camera has. + final CameraLensType lensType; + @override bool operator ==(Object other) => identical(this, other) || other is CameraDescription && runtimeType == other.runtimeType && name == other.name && - lensDirection == other.lensDirection; + lensDirection == other.lensDirection && + lensType == other.lensType; @override - int get hashCode => Object.hash(name, lensDirection); + int get hashCode => Object.hash(name, lensDirection, lensType); @override String toString() { return '${objectRuntimeType(this, 'CameraDescription')}(' - '$name, $lensDirection, $sensorOrientation)'; + '$name, $lensDirection, $sensorOrientation, $lensType)'; } } From a53858b06c180b9756a79c97ce5a2d4a5223479f Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:10:59 -0500 Subject: [PATCH 02/24] run pigeon generator --- .../include/camera_avfoundation/messages.g.h | 32 ++++++++++++++++++- .../Sources/camera_avfoundation/messages.g.m | 16 ++++++++-- .../lib/src/messages.g.dart | 30 +++++++++++++++++ 3 files changed, 75 insertions(+), 3 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 2f1d8646afa..ad6be9e751f 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 @@ -28,6 +28,33 @@ 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,11 +151,14 @@ 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; /// 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 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 0164b4d6c6c..e02919a0bc6 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 @@ -4,7 +4,7 @@ // Autogenerated from Pigeon (v22.4.2), 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 @@ -49,6 +49,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,10 +162,12 @@ + (nullable FCPPlatformSize *)nullableFromList:(NSArray *)list; @implementation FCPPlatformCameraDescription + (instancetype)makeWithName:(NSString *)name - lensDirection:(FCPPlatformCameraLensDirection)lensDirection { + 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 { diff --git a/packages/camera/camera_avfoundation/lib/src/messages.g.dart b/packages/camera/camera_avfoundation/lib/src/messages.g.dart index 535f03e34c2..f7185976bee 100644 --- a/packages/camera/camera_avfoundation/lib/src/messages.g.dart +++ b/packages/camera/camera_avfoundation/lib/src/messages.g.dart @@ -40,6 +40,32 @@ enum PlatformCameraLensDirection { 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 +114,7 @@ class PlatformCameraDescription { PlatformCameraDescription({ required this.name, required this.lensDirection, + required this.lensType, }); /// The name of the camera device. @@ -96,6 +123,9 @@ class PlatformCameraDescription { /// The direction the camera is facing. PlatformCameraLensDirection lensDirection; + /// The type of the camera lens. + PlatformCameraLensType lensType; + Object encode() { return [ name, From 6b8fa0799d671f60da4f248359fb35e1dda1c269 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:10:59 -0500 Subject: [PATCH 03/24] Update tests --- packages/camera/camera/test/camera_preview_test.dart | 5 ++++- packages/camera/camera/test/camera_value_test.dart | 2 +- .../test/types/camera_description_test.dart | 5 +++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/camera/camera/test/camera_preview_test.dart b/packages/camera/camera/test/camera_preview_test.dart index 73359e455ad..6929201b3b3 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 dbb1ddcbf78..234b4399e30 100644 --- a/packages/camera/camera/test/camera_value_test.dart +++ b/packages/camera/camera/test/camera_value_test.dart @@ -147,7 +147,7 @@ void main() { ); 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))'); + '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))'); }); }); } diff --git a/packages/camera/camera_platform_interface/test/types/camera_description_test.dart b/packages/camera/camera_platform_interface/test/types/camera_description_test.dart index a86df031ac3..50d13dd321b 100644 --- a/packages/camera/camera_platform_interface/test/types/camera_description_test.dart +++ b/packages/camera/camera_platform_interface/test/types/camera_description_test.dart @@ -103,9 +103,10 @@ void main() { name: 'Test', lensDirection: CameraLensDirection.front, sensorOrientation: 0, + lensType: CameraLensType.ultraWide, ); - final int expectedHashCode = - Object.hash(description.name, description.lensDirection); + final int expectedHashCode = Object.hash( + description.name, description.lensDirection, description.lensType); expect(description.hashCode, expectedHashCode); }); From e0c743a6841f07903e3ea8db468b900270924c8f Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:10:59 -0500 Subject: [PATCH 04/24] updated versions and Changelogs --- .../camera/camera_avfoundation/CHANGELOG.md | 1 + .../camera_platform_interface/CHANGELOG.md | 115 ++++++++++-------- 2 files changed, 68 insertions(+), 48 deletions(-) diff --git a/packages/camera/camera_avfoundation/CHANGELOG.md b/packages/camera/camera_avfoundation/CHANGELOG.md index 0890c7f7314..a2d5f0284b2 100644 --- a/packages/camera/camera_avfoundation/CHANGELOG.md +++ b/packages/camera/camera_avfoundation/CHANGELOG.md @@ -56,6 +56,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 d122ae154d0..e1ad7c281b9 100644 --- a/packages/camera/camera_platform_interface/CHANGELOG.md +++ b/packages/camera/camera_platform_interface/CHANGELOG.md @@ -1,135 +1,149 @@ +## NEXT + +- 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. +- Updates minimum supported SDK version to Flutter 3.22/Dart 3.4. +- Adds API support query for image streaming. ## 2.8.0 -* Deprecates `maxVideoDuration`/`maxDuration`, as it was never implemented on +- Deprecates `maxVideoDuration`/`maxDuration`, as it was never implemented on most platforms, and there is no plan to implement it in the future. -* Updates minimum supported SDK version to Flutter 3.16/Dart 3.2. +- Updates minimum supported SDK version to Flutter 3.16/Dart 3.2. ## 2.7.4 -* Updates minimum supported SDK version to Flutter 3.13/Dart 3.1. -* Documents `getExposureOffsetStepSize` to return -1 if the device does not support - exposure compensation. +- Updates minimum supported SDK version to Flutter 3.13/Dart 3.1. +- Documents `getExposureOffsetStepSize` to return -1 if the device does not + support exposure compensation. ## 2.7.3 -* Adds documentation to clarify that platform implementations of the plugin use +- Adds documentation to clarify that platform implementations of the plugin use resolution presets as target resolutions. ## 2.7.2 -* Updates minimum required plugin_platform_interface version to 2.1.7. +- Updates minimum required plugin_platform_interface version to 2.1.7. ## 2.7.1 -* Fixes new lint warnings. +- Fixes new lint warnings. ## 2.7.0 -* Adds support for setting the image file format. See `CameraPlatform.setImageFileFormat`. -* Updates minimum supported SDK version to Flutter 3.10/Dart 3.0. +- Adds support for setting the image file format. See + `CameraPlatform.setImageFileFormat`. +- Updates minimum supported SDK version to Flutter 3.10/Dart 3.0. ## 2.6.0 -* Adds support to control video fps and bitrate. See `CameraPlatform.createCameraWithSettings`. +- Adds support to control video fps and bitrate. See + `CameraPlatform.createCameraWithSettings`. ## 2.5.2 -* Adds pub topics to package metadata. -* Updates minimum supported SDK version to Flutter 3.7/Dart 2.19. +- Adds pub topics to package metadata. +- Updates minimum supported SDK version to Flutter 3.7/Dart 2.19. ## 2.5.1 -* Removes obsolete null checks on non-nullable values. -* Updates minimum supported SDK version to Flutter 3.3/Dart 2.18. +- Removes obsolete null checks on non-nullable values. +- Updates minimum supported SDK version to Flutter 3.3/Dart 2.18. ## 2.5.0 -* Adds NV21 as an image stream format (suitable for Android). -* Aligns Dart and Flutter SDK constraints. +- Adds NV21 as an image stream format (suitable for Android). +- Aligns Dart and Flutter SDK constraints. ## 2.4.1 -* Updates links for the merge of flutter/plugins into flutter/packages. +- Updates links for the merge of flutter/plugins into flutter/packages. ## 2.4.0 -* Allows camera to be switched while video recording. -* Updates minimum Flutter version to 3.0. +- Allows camera to be switched while video recording. +- Updates minimum Flutter version to 3.0. ## 2.3.4 -* Updates code for stricter lint checks. +- Updates code for stricter lint checks. ## 2.3.3 -* Updates code for stricter lint checks. +- Updates code for stricter lint checks. ## 2.3.2 -* Updates MethodChannelCamera to have startVideoRecording call the newer startVideoCapturing. +- Updates MethodChannelCamera to have startVideoRecording call the newer + startVideoCapturing. ## 2.3.1 -* Exports VideoCaptureOptions to allow dependencies to implement concurrent stream and record. +- Exports VideoCaptureOptions to allow dependencies to implement concurrent + stream and record. ## 2.3.0 -* Adds new capture method for a camera to allow concurrent streaming and recording. +- Adds new capture method for a camera to allow concurrent streaming and + recording. ## 2.2.2 -* Updates code for `no_leading_underscores_for_local_identifiers` lint. +- Updates code for `no_leading_underscores_for_local_identifiers` lint. ## 2.2.1 -* Updates imports for `prefer_relative_imports`. -* Updates minimum Flutter version to 2.10. -* Fixes avoid_redundant_argument_values lint warnings and minor typos. -* Ignores unnecessary import warnings in preparation for [upcoming Flutter changes](https://github.com/flutter/flutter/pull/104231). -* Ignores missing return warnings in preparation for [upcoming analysis changes](https://github.com/flutter/flutter/issues/105750). +- Updates imports for `prefer_relative_imports`. +- Updates minimum Flutter version to 2.10. +- Fixes avoid_redundant_argument_values lint warnings and minor typos. +- Ignores unnecessary import warnings in preparation for + [upcoming Flutter changes](https://github.com/flutter/flutter/pull/104231). +- Ignores missing return warnings in preparation for + [upcoming analysis changes](https://github.com/flutter/flutter/issues/105750). ## 2.2.0 -* Adds image streaming to the platform interface. -* Removes unnecessary imports. +- Adds image streaming to the platform interface. +- Removes unnecessary imports. ## 2.1.6 -* Adopts `Object.hash`. -* Removes obsolete dependency on `pedantic`. +- Adopts `Object.hash`. +- Removes obsolete dependency on `pedantic`. ## 2.1.5 -* Fixes asynchronous exceptions handling of the `initializeCamera` method. +- Fixes asynchronous exceptions handling of the `initializeCamera` method. ## 2.1.4 -* Removes dependency on `meta`. +- Removes dependency on `meta`. ## 2.1.3 -* Update to use the `verify` method introduced in platform_plugin_interface 2.1.0. +- Update to use the `verify` method introduced in platform_plugin_interface + 2.1.0. ## 2.1.2 -* Adopts new analysis options and fixes all violations. +- Adopts new analysis options and fixes all violations. ## 2.1.1 -* Add web-relevant docs to platform interface code. +- Add web-relevant docs to platform interface code. ## 2.1.0 -* Introduces interface methods for pausing and resuming the camera preview. +- Introduces interface methods for pausing and resuming the camera preview. ## 2.0.1 -* Update platform_plugin_interface version requirement. +- Update platform_plugin_interface version requirement. ## 2.0.0 @@ -137,11 +151,13 @@ ## 1.6.0 -- Added VideoRecordedEvent to support ending a video recording in the native implementation. +- Added VideoRecordedEvent to support ending a video recording in the native + implementation. ## 1.5.0 -- Introduces interface methods for locking and unlocking the capture orientation. +- Introduces interface methods for locking and unlocking the capture + orientation. - Introduces interface method for listening to the device orientation. ## 1.4.0 @@ -158,11 +174,14 @@ ## 1.1.0 -- Added an optional `maxVideoDuration` parameter to the `startVideoRecording` method, which allows implementations to limit the duration of a video recording. +- Added an optional `maxVideoDuration` parameter to the `startVideoRecording` + method, which allows implementations to limit the duration of a video + recording. ## 1.0.4 -- Added the torch option to the FlashMode enum, which when implemented indicates the flash light should be turned on continuously. +- Added the torch option to the FlashMode enum, which when implemented indicates + the flash light should be turned on continuously. ## 1.0.3 From 78fbe474397fc52462c53d85d785a4f30e1a316e Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:10:59 -0500 Subject: [PATCH 05/24] adds dependency_overrides for federated plugin PR --- packages/camera/camera/example/pubspec.yaml | 12 ++++++++++++ packages/camera/camera/pubspec.yaml | 5 +++++ packages/camera/camera_android/example/pubspec.yaml | 5 +++++ packages/camera/camera_android/pubspec.yaml | 5 +++++ .../camera_android_camerax/example/pubspec.yaml | 5 +++++ packages/camera/camera_android_camerax/pubspec.yaml | 5 +++++ .../camera/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 +++++ packages/camera/camera_windows/example/pubspec.yaml | 5 +++++ packages/camera/camera_windows/pubspec.yaml | 5 +++++ 12 files changed, 67 insertions(+) diff --git a/packages/camera/camera/example/pubspec.yaml b/packages/camera/camera/example/pubspec.yaml index aff0afef21f..06dadd6a9db 100644 --- a/packages/camera/camera/example/pubspec.yaml +++ b/packages/camera/camera/example/pubspec.yaml @@ -29,5 +29,17 @@ dev_dependencies: 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 09899dfa579..ff8f3b2e774 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 9c8f8476d0b..abff371918d 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 33163076f68..ace6675291a 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 62736015336..51daaacefdb 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 c611b2f69b4..edeed105aaf 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 9f82d7faf62..1e04dcc8818 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 e8d3a9d3fa3..6be207d72f4 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 8305d8434ab..16ba077a600 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 4052a701b86..22a40ab27bd 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 7eabccf3d65..ed1a039b597 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 d66f36f2550..aaefde4fcd5 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 2248a7142131b03bd4ae9ce8ce1a843569a94e90 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:10:59 -0500 Subject: [PATCH 06/24] 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 1e8ad7def5d..0dfba094292 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 0bbfd0714adefa087e28eb0c8286c8bc5fbd6a2c Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:10:59 -0500 Subject: [PATCH 07/24] 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 57a8f12e73d..f7512f631b9 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 @@ -168,16 +168,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 5e347d725dcdd20d8bf9795e0b220357cb2aa5a5 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:10:59 -0500 Subject: [PATCH 08/24] Apply formatting fixes --- .../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 a7e22da716d..e230a53508f 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 989a2707886227663e8f8c80ecd4cd492378ae6c Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:10:59 -0500 Subject: [PATCH 09/24] 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 00000000000..663d37c32c5 --- /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 f7512f631b9..43f71bd2854 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 @@ -151,44 +151,7 @@ - (void)availableCamerasWithCompletion: for (NSObject *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 @@ -198,6 +161,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 ba8263a3313d630a58f3da69a806cd6e3b7ebbb5 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:10:59 -0500 Subject: [PATCH 10/24] Change lens type enum to only use UltraWide, Wide, and Telephoto --- .../camera_avfoundation/CameraPlugin.m | 13 +- .../include/camera_avfoundation/messages.g.h | 125 +++++++----------- .../lib/src/messages.g.dart | 12 -- .../camera_avfoundation/lib/src/utils.dart | 4 - .../camera_avfoundation/pigeons/messages.dart | 14 +- .../lib/src/types/camera_description.dart | 12 -- 6 files changed, 49 insertions(+), 131 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 43f71bd2854..17cd2a3727e 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 @@ -183,18 +183,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; } @@ -203,7 +193,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 ad6be9e751f..4b6fad3ac26 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/lib/src/messages.g.dart b/packages/camera/camera_avfoundation/lib/src/messages.g.dart index f7185976bee..6bca0896053 100644 --- a/packages/camera/camera_avfoundation/lib/src/messages.g.dart +++ b/packages/camera/camera_avfoundation/lib/src/messages.g.dart @@ -50,18 +50,6 @@ 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_avfoundation/lib/src/utils.dart b/packages/camera/camera_avfoundation/lib/src/utils.dart index 266f38a816f..35eb576990b 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 58fc5a50fb1..e72e6d9cdac 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 1a666ccf093..93e8bb329d9 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 ae66e5773defb0a28680aa09d85d1bdee9b1f594 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:10:59 -0500 Subject: [PATCH 11/24] run pigeon gen and applied flutter_plugin_tools.dart formatting --- .../include/camera_avfoundation/messages.g.h | 4 +- .../Sources/camera_avfoundation/messages.g.m | 34 +- .../lib/src/messages.g.dart | 292 +++++++----------- .../camera_avfoundation/pigeons/messages.dart | 2 +- 4 files changed, 136 insertions(+), 196 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 4b6fad3ac26..3eb04b18e7d 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 (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 e02919a0bc6..4112a866798 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 (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 @@ -376,7 +376,7 @@ - (nullable id)readValueOfType:(UInt8)type { return [FCPPlatformMediaSettings fromList:[self readValue]]; case 140: return [FCPPlatformPoint fromList:[self readValue]]; - case 141: + case 142: return [FCPPlatformSize fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -392,48 +392,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]; diff --git a/packages/camera/camera_avfoundation/lib/src/messages.g.dart b/packages/camera/camera_avfoundation/lib/src/messages.g.dart index 6bca0896053..5fcaa5b1636 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 (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 @@ -118,6 +118,7 @@ class PlatformCameraDescription { return [ name, lensDirection, + lensType, ]; } @@ -126,6 +127,7 @@ class PlatformCameraDescription { return PlatformCameraDescription( name: result[0]! as String, lensDirection: result[1]! as PlatformCameraLensDirection, + lensType: result[2]! as PlatformCameraLensType, ); } } @@ -269,6 +271,7 @@ class PlatformSize { } } + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -276,45 +279,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); } @@ -323,39 +329,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: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformDeviceOrientation.values[value]; - case 131: + case 132: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformExposureMode.values[value]; - case 132: + case 133: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformFlashMode.values[value]; - case 133: + case 134: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformFocusMode.values[value]; - case 134: + case 135: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformImageFileFormat.values[value]; - case 135: + case 136: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformImageFormatGroup.values[value]; - case 136: + case 137: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformResolutionPreset.values[value]; - case 137: + case 138: return PlatformCameraDescription.decode(readValue(buffer)!); - case 138: + case 139: return PlatformCameraState.decode(readValue(buffer)!); - case 139: + case 140: return PlatformMediaSettings.decode(readValue(buffer)!); - case 140: + case 141: return PlatformPoint.decode(readValue(buffer)!); - case 141: + case 142: return PlatformSize.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -367,11 +376,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(); @@ -380,10 +387,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, @@ -404,23 +409,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) { @@ -440,18 +442,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) { @@ -467,10 +466,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, @@ -492,10 +489,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, @@ -520,10 +515,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, @@ -546,10 +539,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, @@ -570,12 +561,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, @@ -598,10 +586,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, @@ -624,10 +610,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, @@ -654,10 +638,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, @@ -680,10 +662,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, @@ -705,10 +685,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, @@ -735,10 +713,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, @@ -760,10 +736,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, @@ -785,10 +759,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, @@ -810,10 +782,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, @@ -837,10 +807,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, @@ -862,10 +830,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, @@ -892,10 +858,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, @@ -922,10 +886,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, @@ -947,10 +909,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, @@ -974,10 +934,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, @@ -999,10 +957,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, @@ -1029,10 +985,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, @@ -1059,10 +1013,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, @@ -1084,10 +1036,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, @@ -1109,10 +1059,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, @@ -1136,10 +1084,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, @@ -1161,10 +1107,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,11 +1144,8 @@ abstract class CameraGlobalEventApi { 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); @@ -1213,8 +1154,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] 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 { @@ -1255,11 +1195,8 @@ abstract class CameraEventApi { 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); @@ -1285,11 +1222,8 @@ abstract class CameraEventApi { } } { - 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); diff --git a/packages/camera/camera_avfoundation/pigeons/messages.dart b/packages/camera/camera_avfoundation/pigeons/messages.dart index e72e6d9cdac..b55d1ff1f61 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 ec472d7970900168e9bd8b525ec4603373af5c5b Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:12:18 -0500 Subject: [PATCH 12/24] Update CHANGELOG and Fix CI errors Ran format script Fix Package.resolved --- .../ios/Runner.xcodeproj/project.pbxproj | 22 ++ .../xcshareddata/swiftpm/Package.resolved | 14 + .../xcshareddata/swiftpm/Package.resolved | 2 +- .../include/camera_avfoundation/messages.g.h | 115 ++++--- .../lib/src/messages.g.dart | 284 +++++++++++------- .../camera_platform_interface/CHANGELOG.md | 200 ------------ 6 files changed, 283 insertions(+), 354 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/example/ios/Runner.xcodeproj/project.pbxproj b/packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj index 4fd11717f7d..dbde6d84052 100644 --- a/packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj @@ -489,6 +489,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 00000000000..68d3807f536 --- /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 663d37c32c5..68d3807f536 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 3eb04b18e7d..3f79b5e5f40 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/lib/src/messages.g.dart b/packages/camera/camera_avfoundation/lib/src/messages.g.dart index 5fcaa5b1636..600087e7465 100644 --- a/packages/camera/camera_avfoundation/lib/src/messages.g.dart +++ b/packages/camera/camera_avfoundation/lib/src/messages.g.dart @@ -271,7 +271,6 @@ class PlatformSize { } } - class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -279,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 { @@ -329,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); @@ -376,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(); @@ -387,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, @@ -409,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) { @@ -442,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) { @@ -466,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, @@ -489,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, @@ -515,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, @@ -539,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, @@ -561,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, @@ -586,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, @@ -610,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, @@ -638,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, @@ -662,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, @@ -685,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, @@ -713,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, @@ -736,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, @@ -759,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, @@ -782,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, @@ -807,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, @@ -830,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, @@ -858,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, @@ -886,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, @@ -909,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, @@ -934,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, @@ -957,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, @@ -985,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, @@ -1013,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, @@ -1036,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, @@ -1059,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, @@ -1084,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, @@ -1107,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, @@ -1144,8 +1208,11 @@ abstract class CameraGlobalEventApi { 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); @@ -1154,7 +1221,8 @@ 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] 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 { @@ -1195,8 +1263,11 @@ abstract class CameraEventApi { 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); @@ -1222,8 +1293,11 @@ abstract class CameraEventApi { } } { - 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); diff --git a/packages/camera/camera_platform_interface/CHANGELOG.md b/packages/camera/camera_platform_interface/CHANGELOG.md index e1ad7c281b9..e69de29bb2d 100644 --- a/packages/camera/camera_platform_interface/CHANGELOG.md +++ b/packages/camera/camera_platform_interface/CHANGELOG.md @@ -1,200 +0,0 @@ -## NEXT - -- 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 - -- Deprecates `maxVideoDuration`/`maxDuration`, as it was never implemented on - most platforms, and there is no plan to implement it in the future. -- Updates minimum supported SDK version to Flutter 3.16/Dart 3.2. - -## 2.7.4 - -- Updates minimum supported SDK version to Flutter 3.13/Dart 3.1. -- Documents `getExposureOffsetStepSize` to return -1 if the device does not - support exposure compensation. - -## 2.7.3 - -- Adds documentation to clarify that platform implementations of the plugin use - resolution presets as target resolutions. - -## 2.7.2 - -- Updates minimum required plugin_platform_interface version to 2.1.7. - -## 2.7.1 - -- Fixes new lint warnings. - -## 2.7.0 - -- Adds support for setting the image file format. See - `CameraPlatform.setImageFileFormat`. -- Updates minimum supported SDK version to Flutter 3.10/Dart 3.0. - -## 2.6.0 - -- Adds support to control video fps and bitrate. See - `CameraPlatform.createCameraWithSettings`. - -## 2.5.2 - -- Adds pub topics to package metadata. -- Updates minimum supported SDK version to Flutter 3.7/Dart 2.19. - -## 2.5.1 - -- Removes obsolete null checks on non-nullable values. -- Updates minimum supported SDK version to Flutter 3.3/Dart 2.18. - -## 2.5.0 - -- Adds NV21 as an image stream format (suitable for Android). -- Aligns Dart and Flutter SDK constraints. - -## 2.4.1 - -- Updates links for the merge of flutter/plugins into flutter/packages. - -## 2.4.0 - -- Allows camera to be switched while video recording. -- Updates minimum Flutter version to 3.0. - -## 2.3.4 - -- Updates code for stricter lint checks. - -## 2.3.3 - -- Updates code for stricter lint checks. - -## 2.3.2 - -- Updates MethodChannelCamera to have startVideoRecording call the newer - startVideoCapturing. - -## 2.3.1 - -- Exports VideoCaptureOptions to allow dependencies to implement concurrent - stream and record. - -## 2.3.0 - -- Adds new capture method for a camera to allow concurrent streaming and - recording. - -## 2.2.2 - -- Updates code for `no_leading_underscores_for_local_identifiers` lint. - -## 2.2.1 - -- Updates imports for `prefer_relative_imports`. -- Updates minimum Flutter version to 2.10. -- Fixes avoid_redundant_argument_values lint warnings and minor typos. -- Ignores unnecessary import warnings in preparation for - [upcoming Flutter changes](https://github.com/flutter/flutter/pull/104231). -- Ignores missing return warnings in preparation for - [upcoming analysis changes](https://github.com/flutter/flutter/issues/105750). - -## 2.2.0 - -- Adds image streaming to the platform interface. -- Removes unnecessary imports. - -## 2.1.6 - -- Adopts `Object.hash`. -- Removes obsolete dependency on `pedantic`. - -## 2.1.5 - -- Fixes asynchronous exceptions handling of the `initializeCamera` method. - -## 2.1.4 - -- Removes dependency on `meta`. - -## 2.1.3 - -- Update to use the `verify` method introduced in platform_plugin_interface - 2.1.0. - -## 2.1.2 - -- Adopts new analysis options and fixes all violations. - -## 2.1.1 - -- Add web-relevant docs to platform interface code. - -## 2.1.0 - -- Introduces interface methods for pausing and resuming the camera preview. - -## 2.0.1 - -- Update platform_plugin_interface version requirement. - -## 2.0.0 - -- Stable null safety release. - -## 1.6.0 - -- Added VideoRecordedEvent to support ending a video recording in the native - implementation. - -## 1.5.0 - -- Introduces interface methods for locking and unlocking the capture - orientation. -- Introduces interface method for listening to the device orientation. - -## 1.4.0 - -- Added interface methods to support auto focus. - -## 1.3.0 - -- Introduces an option to set the image format when initializing. - -## 1.2.0 - -- Added interface to support automatic exposure. - -## 1.1.0 - -- Added an optional `maxVideoDuration` parameter to the `startVideoRecording` - method, which allows implementations to limit the duration of a video - recording. - -## 1.0.4 - -- Added the torch option to the FlashMode enum, which when implemented indicates - the flash light should be turned on continuously. - -## 1.0.3 - -- Update Flutter SDK constraint. - -## 1.0.2 - -- Added interface methods to support zoom features. - -## 1.0.1 - -- Added interface methods for setting flash mode. - -## 1.0.0 - -- Initial open-source release From 9540ef7ab7274efc3315cafa2d41b9a14ff22ed4 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:12:18 -0500 Subject: [PATCH 13/24] 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 e230a53508f..a7e22da716d 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 5a3db31f83307b00a3adef47be9caaac1e578821 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:12:18 -0500 Subject: [PATCH 14/24] 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 17cd2a3727e..d2747ca09b4 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; @@ -151,7 +182,7 @@ - (void)availableCamerasWithCompletion: for (NSObject *device in devices) { FCPPlatformCameraLensDirection lensFacing; FCPPlatformCameraLensType lensType; - getLensDirectionAndType(device, &lensFacing, &lensType); + FCPGetLensDirectionAndType(device, &lensFacing, &lensType); [reply addObject:[FCPPlatformCameraDescription makeWithName:device.uniqueID lensDirection:lensFacing @@ -161,38 +192,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 39aac3c44fd5bcb7cfe85ae3028261a7da88f288 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:12:18 -0500 Subject: [PATCH 15/24] Fix documentation for camera lens type descriptions in messages.dart and camera_description.dart --- .../include/camera_avfoundation/messages.g.h | 119 +++--- .../lib/src/messages.g.dart | 338 +++++++----------- .../camera_avfoundation/pigeons/messages.dart | 4 +- .../lib/src/types/camera_description.dart | 4 +- 4 files changed, 176 insertions(+), 289 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 3f79b5e5f40..f2e248fcf37 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/lib/src/messages.g.dart b/packages/camera/camera_avfoundation/lib/src/messages.g.dart index 600087e7465..409b3d30a2f 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())); } }); } @@ -1255,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 { @@ -1285,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, @@ -1314,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())); } }); } diff --git a/packages/camera/camera_avfoundation/pigeons/messages.dart b/packages/camera/camera_avfoundation/pigeons/messages.dart index b55d1ff1f61..7d1d97c77e1 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 93e8bb329d9..4d5b3ec543f 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 ec7f8f2b25b3e98cbb78099ab2beef3cc532d604 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:12:18 -0500 Subject: [PATCH 16/24] 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 +++--- .../lib/src/messages.g.dart | 334 +++++++++++------- 4 files changed, 307 insertions(+), 194 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 d2747ca09b4..ae9fb264817 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 a7e22da716d..e230a53508f 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 f2e248fcf37..f8f102de922 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/lib/src/messages.g.dart b/packages/camera/camera_avfoundation/lib/src/messages.g.dart index 409b3d30a2f..f2bd44d89a6 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 16f9fc4a9d3ad0094fc1e67c38d9dfa6025a5a43 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:12:18 -0500 Subject: [PATCH 17/24] 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 abff371918d..9c8f8476d0b 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 ace6675291a..33163076f68 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 51daaacefdb..62736015336 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 edeed105aaf..c611b2f69b4 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 16ba077a600..8305d8434ab 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 22a40ab27bd..4052a701b86 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 ed1a039b597..7eabccf3d65 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 aaefde4fcd5..d66f36f2550 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 d2404a6da7ee8fdb9bed5725530f7bb5cd19105c Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:12:18 -0500 Subject: [PATCH 18/24] Remove temporary dependency overrides from pubspec.yaml files --- packages/camera/camera/example/pubspec.yaml | 45 ------------------- packages/camera/camera/pubspec.yaml | 5 --- .../camera_avfoundation/example/pubspec.yaml | 5 --- .../camera/camera_avfoundation/pubspec.yaml | 5 --- 4 files changed, 60 deletions(-) diff --git a/packages/camera/camera/example/pubspec.yaml b/packages/camera/camera/example/pubspec.yaml index 06dadd6a9db..e69de29bb2d 100644 --- a/packages/camera/camera/example/pubspec.yaml +++ b/packages/camera/camera/example/pubspec.yaml @@ -1,45 +0,0 @@ -name: camera_example -description: Demonstrates how to use the camera plugin. -publish_to: none - -environment: - sdk: ^3.4.0 - flutter: ">=3.22.0" - -dependencies: - camera: - # When depending on this package from a real application you should use: - # camera: ^x.y.z - # See https://dart.dev/tools/pub/dependencies#version-constraints - # 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: ../ - flutter: - sdk: flutter - path_provider: ^2.0.0 - video_player: ^2.7.0 - -dev_dependencies: - build_runner: ^2.1.10 - flutter_driver: - sdk: flutter - flutter_test: - 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 ff8f3b2e774..09899dfa579 100644 --- a/packages/camera/camera/pubspec.yaml +++ b/packages/camera/camera/pubspec.yaml @@ -38,8 +38,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_avfoundation: {path: ../../camera/camera_avfoundation}, 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 1e04dcc8818..9f82d7faf62 100644 --- a/packages/camera/camera_avfoundation/example/pubspec.yaml +++ b/packages/camera/camera_avfoundation/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_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 6be207d72f4..e8d3a9d3fa3 100644 --- a/packages/camera/camera_avfoundation/pubspec.yaml +++ b/packages/camera/camera_avfoundation/pubspec.yaml @@ -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}} From 697c023ac6ed0ddcc383d789d41f897053fe7946 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:12:18 -0500 Subject: [PATCH 19/24] Remove Runner changes --- .../ios/Runner.xcodeproj/project.pbxproj | 22 ------------------- .../xcshareddata/swiftpm/Package.resolved | 14 ------------ .../xcshareddata/swiftpm/Package.resolved | 14 ------------ 3 files changed, 50 deletions(-) delete mode 100644 packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved 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.xcodeproj/project.pbxproj b/packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj index dbde6d84052..4fd11717f7d 100644 --- a/packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj @@ -489,28 +489,6 @@ 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 deleted file mode 100644 index 68d3807f536..00000000000 --- 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/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 68d3807f536..00000000000 --- 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 8aed9ea980083eec1f941aa64b11f732578aa4e5 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:14:46 -0500 Subject: [PATCH 20/24] Updates versions and CHANGELOGs. Runs pigeon generator --- packages/camera/camera/example/pubspec.yaml | 33 + .../camera/camera_avfoundation/CHANGELOG.md | 4 + .../include/camera_avfoundation/messages.g.h | 115 ++- .../Sources/camera_avfoundation/messages.g.m | 816 +++++++----------- .../lib/src/messages.g.dart | 334 +++---- .../camera/camera_avfoundation/pubspec.yaml | 2 +- .../camera_platform_interface/CHANGELOG.md | 186 ++++ .../camera_platform_interface/pubspec.yaml | 2 +- 8 files changed, 695 insertions(+), 797 deletions(-) diff --git a/packages/camera/camera/example/pubspec.yaml b/packages/camera/camera/example/pubspec.yaml index e69de29bb2d..aff0afef21f 100644 --- a/packages/camera/camera/example/pubspec.yaml +++ b/packages/camera/camera/example/pubspec.yaml @@ -0,0 +1,33 @@ +name: camera_example +description: Demonstrates how to use the camera plugin. +publish_to: none + +environment: + sdk: ^3.4.0 + flutter: ">=3.22.0" + +dependencies: + camera: + # When depending on this package from a real application you should use: + # camera: ^x.y.z + # See https://dart.dev/tools/pub/dependencies#version-constraints + # 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: ../ + flutter: + sdk: flutter + path_provider: ^2.0.0 + video_player: ^2.7.0 + +dev_dependencies: + build_runner: ^2.1.10 + flutter_driver: + sdk: flutter + flutter_test: + sdk: flutter + integration_test: + sdk: flutter + leak_tracker_flutter_testing: any + +flutter: + uses-material-design: true diff --git a/packages/camera/camera_avfoundation/CHANGELOG.md b/packages/camera/camera_avfoundation/CHANGELOG.md index a2d5f0284b2..11f1476d99c 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+9 * Backfills unit tests for `CameraPlugin` class. 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 f8f102de922..f2e248fcf37 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,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 4112a866798..7f63258c48f 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,9 +168,10 @@ + (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; return pigeonResult; } + (nullable FCPPlatformCameraDescription *)nullableFromList:(NSArray *)list { @@ -185,17 +181,18 @@ + (nullable FCPPlatformCameraDescription *)nullableFromList:(NSArray *)list return @[ self.name ?: [NSNull null], [[FCPPlatformCameraLensDirectionBox alloc] initWithValue:self.lensDirection], + [[FCPPlatformCameraLensTypeBox alloc] initWithValue: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; @@ -230,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; @@ -244,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); @@ -268,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; @@ -292,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; @@ -322,61 +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 - : [[FCPPlatformDeviceOrientationBox alloc] - initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformCameraLensTypeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 131: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil - ? nil - : [[FCPPlatformExposureModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformDeviceOrientationBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 132: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil - ? nil - : [[FCPPlatformFlashModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformExposureModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 133: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil - ? nil - : [[FCPPlatformFocusModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformFlashModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 134: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformImageFileFormatBox alloc] - initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformFocusModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 135: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformImageFormatGroupBox alloc] - initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformImageFileFormatBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 136: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil - : [[FCPPlatformResolutionPresetBox alloc] - initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil : [[FCPPlatformImageFormatGroupBox alloc] initWithValue:[enumAsNumber integerValue]]; } - case 137: + case 137: { + NSNumber *enumAsNumber = [self readValue]; + return enumAsNumber == nil ? nil : [[FCPPlatformResolutionPresetBox alloc] initWithValue:[enumAsNumber integerValue]]; + } + case 138: return [FCPPlatformCameraDescription fromList:[self readValue]]; - case 138: + case 139: return [FCPPlatformCameraState fromList:[self readValue]]; - case 139: + case 140: return [FCPPlatformMediaSettings fromList:[self readValue]]; - case 140: + case 141: return [FCPPlatformPoint fromList:[self readValue]]; - case 142: + case 142: return [FCPPlatformSize fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -460,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; @@ -470,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)); }]; }]; @@ -502,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]; @@ -530,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]; @@ -561,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)); @@ -584,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)); @@ -611,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)); @@ -635,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]; @@ -660,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]; @@ -689,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)); @@ -713,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]; @@ -737,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)); @@ -761,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]; @@ -787,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)); }]; }]; @@ -811,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)); @@ -834,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)); @@ -857,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]; @@ -884,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]; @@ -914,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]; @@ -939,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)); @@ -961,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)); @@ -983,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]; @@ -1009,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]; @@ -1038,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]; @@ -1064,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)); @@ -1086,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)); @@ -1108,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]; @@ -1134,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)); @@ -1157,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)); @@ -1182,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]; @@ -1209,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]; @@ -1246,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 @@ -1295,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 f2bd44d89a6..409b3d30a2f 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 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())); } }); } @@ -1255,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 { @@ -1285,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, @@ -1314,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())); } }); } diff --git a/packages/camera/camera_avfoundation/pubspec.yaml b/packages/camera/camera_avfoundation/pubspec.yaml index e8d3a9d3fa3..e325431c3b8 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+9 +version: 0.9.19 environment: sdk: ^3.4.0 diff --git a/packages/camera/camera_platform_interface/CHANGELOG.md b/packages/camera/camera_platform_interface/CHANGELOG.md index e69de29bb2d..a76c9d06a2a 100644 --- a/packages/camera/camera_platform_interface/CHANGELOG.md +++ b/packages/camera/camera_platform_interface/CHANGELOG.md @@ -0,0 +1,186 @@ +## 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. +* Adds API support query for image streaming. + +## 2.8.0 + +* Deprecates `maxVideoDuration`/`maxDuration`, as it was never implemented on + most platforms, and there is no plan to implement it in the future. +* Updates minimum supported SDK version to Flutter 3.16/Dart 3.2. + +## 2.7.4 + +* Updates minimum supported SDK version to Flutter 3.13/Dart 3.1. +* Documents `getExposureOffsetStepSize` to return -1 if the device does not support + exposure compensation. + +## 2.7.3 + +* Adds documentation to clarify that platform implementations of the plugin use + resolution presets as target resolutions. + +## 2.7.2 + +* Updates minimum required plugin_platform_interface version to 2.1.7. + +## 2.7.1 + +* Fixes new lint warnings. + +## 2.7.0 + +* Adds support for setting the image file format. See `CameraPlatform.setImageFileFormat`. +* Updates minimum supported SDK version to Flutter 3.10/Dart 3.0. + +## 2.6.0 + +* Adds support to control video fps and bitrate. See `CameraPlatform.createCameraWithSettings`. + +## 2.5.2 + +* Adds pub topics to package metadata. +* Updates minimum supported SDK version to Flutter 3.7/Dart 2.19. + +## 2.5.1 + +* Removes obsolete null checks on non-nullable values. +* Updates minimum supported SDK version to Flutter 3.3/Dart 2.18. + +## 2.5.0 + +* Adds NV21 as an image stream format (suitable for Android). +* Aligns Dart and Flutter SDK constraints. + +## 2.4.1 + +* Updates links for the merge of flutter/plugins into flutter/packages. + +## 2.4.0 + +* Allows camera to be switched while video recording. +* Updates minimum Flutter version to 3.0. + +## 2.3.4 + +* Updates code for stricter lint checks. + +## 2.3.3 + +* Updates code for stricter lint checks. + +## 2.3.2 + +* Updates MethodChannelCamera to have startVideoRecording call the newer startVideoCapturing. + +## 2.3.1 + +* Exports VideoCaptureOptions to allow dependencies to implement concurrent stream and record. + +## 2.3.0 + +* Adds new capture method for a camera to allow concurrent streaming and recording. + +## 2.2.2 + +* Updates code for `no_leading_underscores_for_local_identifiers` lint. + +## 2.2.1 + +* Updates imports for `prefer_relative_imports`. +* Updates minimum Flutter version to 2.10. +* Fixes avoid_redundant_argument_values lint warnings and minor typos. +* Ignores unnecessary import warnings in preparation for [upcoming Flutter changes](https://github.com/flutter/flutter/pull/104231). +* Ignores missing return warnings in preparation for [upcoming analysis changes](https://github.com/flutter/flutter/issues/105750). + +## 2.2.0 + +* Adds image streaming to the platform interface. +* Removes unnecessary imports. + +## 2.1.6 + +* Adopts `Object.hash`. +* Removes obsolete dependency on `pedantic`. + +## 2.1.5 + +* Fixes asynchronous exceptions handling of the `initializeCamera` method. + +## 2.1.4 + +* Removes dependency on `meta`. + +## 2.1.3 + +* Update to use the `verify` method introduced in platform_plugin_interface 2.1.0. + +## 2.1.2 + +* Adopts new analysis options and fixes all violations. + +## 2.1.1 + +* Add web-relevant docs to platform interface code. + +## 2.1.0 + +* Introduces interface methods for pausing and resuming the camera preview. + +## 2.0.1 + +* Update platform_plugin_interface version requirement. + +## 2.0.0 + +- Stable null safety release. + +## 1.6.0 + +- Added VideoRecordedEvent to support ending a video recording in the native implementation. + +## 1.5.0 + +- Introduces interface methods for locking and unlocking the capture orientation. +- Introduces interface method for listening to the device orientation. + +## 1.4.0 + +- Added interface methods to support auto focus. + +## 1.3.0 + +- Introduces an option to set the image format when initializing. + +## 1.2.0 + +- Added interface to support automatic exposure. + +## 1.1.0 + +- Added an optional `maxVideoDuration` parameter to the `startVideoRecording` method, which allows implementations to limit the duration of a video recording. + +## 1.0.4 + +- Added the torch option to the FlashMode enum, which when implemented indicates the flash light should be turned on continuously. + +## 1.0.3 + +- Update Flutter SDK constraint. + +## 1.0.2 + +- Added interface methods to support zoom features. + +## 1.0.1 + +- Added interface methods for setting flash mode. + +## 1.0.0 + +- Initial open-source release diff --git a/packages/camera/camera_platform_interface/pubspec.yaml b/packages/camera/camera_platform_interface/pubspec.yaml index bea9eef2319..a26c038ed11 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 119beaaa7d58a32740eeb2292cfc56f387b4c38f Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:19:50 -0500 Subject: [PATCH 21/24] Revert implementation changes in camera_avfoundation --- .../camera/camera_avfoundation/CHANGELOG.md | 5 - .../camera_avfoundation/CameraPlugin.m | 48 +- .../include/camera_avfoundation/QueueUtils.h | 2 +- .../include/camera_avfoundation/messages.g.h | 135 ++- .../Sources/camera_avfoundation/messages.g.m | 856 +++++++++++------- .../lib/src/messages.g.dart | 354 +++++--- .../camera_avfoundation/lib/src/utils.dart | 13 +- .../camera_avfoundation/pigeons/messages.dart | 19 - .../camera/camera_avfoundation/pubspec.yaml | 2 +- .../test/avfoundation_camera_test.dart | 14 +- 10 files changed, 821 insertions(+), 627 deletions(-) diff --git a/packages/camera/camera_avfoundation/CHANGELOG.md b/packages/camera/camera_avfoundation/CHANGELOG.md index 11f1476d99c..0890c7f7314 100644 --- a/packages/camera/camera_avfoundation/CHANGELOG.md +++ b/packages/camera/camera_avfoundation/CHANGELOG.md @@ -1,7 +1,3 @@ -## 0.9.19 - -* Adds lensType in the PlatformCameraDescription - ## 0.9.18+9 * Backfills unit tests for `CameraPlugin` class. @@ -60,7 +56,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/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m b/packages/camera/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/CameraPlugin.m index ae9fb264817..b9e1ef1850c 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,37 +21,6 @@ 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; @@ -181,12 +150,19 @@ - (void)availableCamerasWithCompletion: [[NSMutableArray alloc] initWithCapacity:devices.count]; for (NSObject *device in devices) { FCPPlatformCameraLensDirection lensFacing; - FCPPlatformCameraLensType lensType; - FCPGetLensDirectionAndType(device, &lensFacing, &lensType); - + switch (device.position) { + case AVCaptureDevicePositionBack: + lensFacing = FCPPlatformCameraLensDirectionBack; + break; + case AVCaptureDevicePositionFront: + lensFacing = FCPPlatformCameraLensDirectionFront; + break; + case AVCaptureDevicePositionUnspecified: + lensFacing = FCPPlatformCameraLensDirectionExternal; + break; + } [reply addObject:[FCPPlatformCameraDescription makeWithName:device.uniqueID - lensDirection:lensFacing - lensType:lensType]]; + lensDirection:lensFacing]]; } completion(reply, nil); }); 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 e230a53508f..a7e22da716d 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 f2e248fcf37..2f1d8646afa 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.4.2), do not edit directly. // See also: https://pub.dev/packages/pigeon #import @@ -28,23 +28,6 @@ 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 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, -}; - -/// 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, @@ -141,67 +124,62 @@ 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; /// 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. @@ -209,11 +187,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 +210,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 +250,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 +270,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 7f63258c48f..0164b4d6c6c 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.4.2), do not edit directly. // See also: https://pub.dev/packages/pigeon #import "./include/camera_avfoundation/messages.g.h" @@ -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) { @@ -44,16 +49,6 @@ - (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]; @@ -157,21 +152,18 @@ + (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 { + 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); + 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 { @@ -181,18 +173,17 @@ + (nullable FCPPlatformCameraDescription *)nullableFromList:(NSArray *)list return @[ self.name ?: [NSNull null], [[FCPPlatformCameraLensDirectionBox alloc] initWithValue:self.lensDirection], - [[FCPPlatformCameraLensTypeBox alloc] initWithValue: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; @@ -227,11 +218,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 +232,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 +256,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 +280,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 +310,61 @@ - (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 + : [[FCPPlatformDeviceOrientationBox alloc] + initWithValue:[enumAsNumber integerValue]]; } case 131: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformDeviceOrientationBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil + ? nil + : [[FCPPlatformExposureModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 132: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformExposureModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil + ? nil + : [[FCPPlatformFlashModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 133: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformFlashModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil + ? nil + : [[FCPPlatformFocusModeBox alloc] initWithValue:[enumAsNumber integerValue]]; } case 134: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformFocusModeBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil + : [[FCPPlatformImageFileFormatBox alloc] + initWithValue:[enumAsNumber integerValue]]; } case 135: { NSNumber *enumAsNumber = [self readValue]; - return enumAsNumber == nil ? nil : [[FCPPlatformImageFileFormatBox alloc] initWithValue:[enumAsNumber integerValue]]; + return enumAsNumber == nil ? nil + : [[FCPPlatformImageFormatGroupBox 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]]; + return enumAsNumber == nil ? nil + : [[FCPPlatformResolutionPresetBox alloc] + initWithValue:[enumAsNumber integerValue]]; } - case 138: + case 137: return [FCPPlatformCameraDescription fromList:[self readValue]]; - case 139: + case 138: return [FCPPlatformCameraState fromList:[self readValue]]; - case 140: + case 139: return [FCPPlatformMediaSettings fromList:[self readValue]]; - case 141: + case 140: return [FCPPlatformPoint fromList:[self readValue]]; - case 142: + case 141: return [FCPPlatformSize fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -378,52 +380,48 @@ - (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:131]; + [self writeByte:130]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformExposureModeBox class]]) { FCPPlatformExposureModeBox *box = (FCPPlatformExposureModeBox *)value; - [self writeByte:132]; + [self writeByte:131]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformFlashModeBox class]]) { FCPPlatformFlashModeBox *box = (FCPPlatformFlashModeBox *)value; - [self writeByte:133]; + [self writeByte:132]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformFocusModeBox class]]) { FCPPlatformFocusModeBox *box = (FCPPlatformFocusModeBox *)value; - [self writeByte:134]; + [self writeByte:133]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformImageFileFormatBox class]]) { FCPPlatformImageFileFormatBox *box = (FCPPlatformImageFileFormatBox *)value; - [self writeByte:135]; + [self writeByte:134]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformImageFormatGroupBox class]]) { FCPPlatformImageFormatGroupBox *box = (FCPPlatformImageFormatGroupBox *)value; - [self writeByte:136]; + [self writeByte:135]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformResolutionPresetBox class]]) { FCPPlatformResolutionPresetBox *box = (FCPPlatformResolutionPresetBox *)value; - [self writeByte:137]; + [self writeByte:136]; [self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])]; } else if ([value isKindOfClass:[FCPPlatformCameraDescription class]]) { - [self writeByte:138]; + [self writeByte:137]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FCPPlatformCameraState class]]) { - [self writeByte:139]; + [self writeByte:138]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FCPPlatformMediaSettings class]]) { - [self writeByte:140]; + [self writeByte:139]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FCPPlatformPoint class]]) { - [self writeByte:141]; + [self writeByte:140]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FCPPlatformSize class]]) { - [self writeByte:142]; + [self writeByte:141]; [self writeValue:[value toList]]; } else { [super writeValue:value]; @@ -446,7 +444,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 +454,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 +486,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 +514,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 +545,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 +568,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 +595,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 +619,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 +644,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 +673,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 +697,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 +721,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 +745,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 +771,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 +795,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 +818,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 +841,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 +868,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 +898,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 +923,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 +945,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 +967,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 +993,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 +1022,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 +1048,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 +1070,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 +1092,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 +1118,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 +1141,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 +1166,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 +1193,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 +1230,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 +1279,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 409b3d30a2f..535f03e34c2 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.4.2), 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,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,23 +32,14 @@ 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, } -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, -} - enum PlatformDeviceOrientation { portraitUp, landscapeLeft, @@ -96,7 +88,6 @@ class PlatformCameraDescription { PlatformCameraDescription({ required this.name, required this.lensDirection, - required this.lensType, }); /// The name of the camera device. @@ -105,14 +96,10 @@ class PlatformCameraDescription { /// The direction the camera is facing. PlatformCameraLensDirection lensDirection; - /// The type of the camera lens. - PlatformCameraLensType lensType; - Object encode() { return [ name, lensDirection, - lensType, ]; } @@ -121,7 +108,6 @@ class PlatformCameraDescription { return PlatformCameraDescription( name: result[0]! as String, lensDirection: result[1]! as PlatformCameraLensDirection, - lensType: result[2]! as PlatformCameraLensType, ); } } @@ -265,7 +251,6 @@ class PlatformSize { } } - class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -273,48 +258,45 @@ 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 PlatformDeviceOrientation) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is PlatformDeviceOrientation) { + } else if (value is PlatformExposureMode) { buffer.putUint8(131); writeValue(buffer, value.index); - } else if (value is PlatformExposureMode) { + } else if (value is PlatformFlashMode) { buffer.putUint8(132); writeValue(buffer, value.index); - } else if (value is PlatformFlashMode) { + } else if (value is PlatformFocusMode) { buffer.putUint8(133); writeValue(buffer, value.index); - } else if (value is PlatformFocusMode) { + } else if (value is PlatformImageFileFormat) { buffer.putUint8(134); writeValue(buffer, value.index); - } else if (value is PlatformImageFileFormat) { + } else if (value is PlatformImageFormatGroup) { buffer.putUint8(135); writeValue(buffer, value.index); - } else if (value is PlatformImageFormatGroup) { + } else if (value is PlatformResolutionPreset) { buffer.putUint8(136); writeValue(buffer, value.index); - } else if (value is PlatformResolutionPreset) { + } else if (value is PlatformCameraDescription) { buffer.putUint8(137); - writeValue(buffer, value.index); - } else if (value is PlatformCameraDescription) { + writeValue(buffer, value.encode()); + } else if (value is PlatformCameraState) { buffer.putUint8(138); writeValue(buffer, value.encode()); - } else if (value is PlatformCameraState) { + } else if (value is PlatformMediaSettings) { buffer.putUint8(139); writeValue(buffer, value.encode()); - } else if (value is PlatformMediaSettings) { + } else if (value is PlatformPoint) { buffer.putUint8(140); writeValue(buffer, value.encode()); - } else if (value is PlatformPoint) { + } else if (value is PlatformSize) { buffer.putUint8(141); writeValue(buffer, value.encode()); - } else if (value is PlatformSize) { - buffer.putUint8(142); - writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -323,42 +305,39 @@ 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: - final int? value = readValue(buffer) as int?; - return value == null ? null : PlatformCameraLensType.values[value]; - case 131: + case 130: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformDeviceOrientation.values[value]; - case 132: + case 131: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformExposureMode.values[value]; - case 133: + case 132: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformFlashMode.values[value]; - case 134: + case 133: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformFocusMode.values[value]; - case 135: + case 134: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformImageFileFormat.values[value]; - case 136: + case 135: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformImageFormatGroup.values[value]; - case 137: + case 136: final int? value = readValue(buffer) as int?; return value == null ? null : PlatformResolutionPreset.values[value]; - case 138: + case 137: return PlatformCameraDescription.decode(readValue(buffer)!); - case 139: + case 138: return PlatformCameraState.decode(readValue(buffer)!); - case 140: + case 139: return PlatformMediaSettings.decode(readValue(buffer)!); - case 141: + case 140: return PlatformPoint.decode(readValue(buffer)!); - case 142: + case 141: return PlatformSize.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -370,9 +349,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 +362,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 +386,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 +422,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 +449,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 +474,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 +502,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 +528,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 +552,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 +580,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 +606,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 +636,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 +662,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 +687,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 +717,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 +742,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 +767,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 +792,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 +819,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 +844,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 +874,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 +904,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 +929,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 +956,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 +981,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 +1011,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 +1041,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 +1066,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 +1091,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 +1118,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 +1143,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 +1174,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 +1204,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 +1229,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 +1259,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 +1288,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_avfoundation/lib/src/utils.dart b/packages/camera/camera_avfoundation/lib/src/utils.dart index 35eb576990b..3fd7f59a891 100644 --- a/packages/camera/camera_avfoundation/lib/src/utils.dart +++ b/packages/camera/camera_avfoundation/lib/src/utils.dart @@ -13,8 +13,7 @@ CameraDescription cameraDescriptionFromPlatform( return CameraDescription( name: camera.name, lensDirection: cameraLensDirectionFromPlatform(camera.lensDirection), - sensorOrientation: 90, - lensType: cameraLensTypeFromPlatform(camera.lensType)); + sensorOrientation: 90); } /// Converts a Pigeon [PlatformCameraLensDirection] to a [CameraLensDirection]. @@ -27,16 +26,6 @@ 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.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 7d1d97c77e1..272ea288960 100644 --- a/packages/camera/camera_avfoundation/pigeons/messages.dart +++ b/packages/camera/camera_avfoundation/pigeons/messages.dart @@ -29,21 +29,6 @@ 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 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, -} - // Pigeon version of DeviceOrientation. enum PlatformDeviceOrientation { portraitUp, @@ -99,7 +84,6 @@ class PlatformCameraDescription { PlatformCameraDescription({ required this.name, required this.lensDirection, - required this.lensType, }); /// The name of the camera device. @@ -107,9 +91,6 @@ 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_avfoundation/pubspec.yaml b/packages/camera/camera_avfoundation/pubspec.yaml index e325431c3b8..e8d3a9d3fa3 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.19 +version: 0.9.18+9 environment: sdk: ^3.4.0 diff --git a/packages/camera/camera_avfoundation/test/avfoundation_camera_test.dart b/packages/camera/camera_avfoundation/test/avfoundation_camera_test.dart index 0dfba094292..1e8ad7def5d 100644 --- a/packages/camera/camera_avfoundation/test/avfoundation_camera_test.dart +++ b/packages/camera/camera_avfoundation/test/avfoundation_camera_test.dart @@ -372,15 +372,9 @@ void main() { final List returnData = [ PlatformCameraDescription( - name: 'Test 1', - lensDirection: PlatformCameraLensDirection.front, - lensType: PlatformCameraLensType.ultraWide, - ), + name: 'Test 1', lensDirection: PlatformCameraLensDirection.front), PlatformCameraDescription( - name: 'Test 2', - lensDirection: PlatformCameraLensDirection.back, - lensType: PlatformCameraLensType.telephoto, - ), + name: 'Test 2', lensDirection: PlatformCameraLensDirection.back), ]; when(mockApi.getAvailableCameras()).thenAnswer((_) async => returnData); @@ -391,10 +385,6 @@ 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 e338f6f5418ba8696a8046198e89a3c88c5b1893 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Thu, 6 Mar 2025 16:52:56 -0500 Subject: [PATCH 22/24] Revert changes in camera pkg --- packages/camera/camera/test/camera_preview_test.dart | 5 +---- packages/camera/camera/test/camera_value_test.dart | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/camera/camera/test/camera_preview_test.dart b/packages/camera/camera/test/camera_preview_test.dart index 6929201b3b3..73359e455ad 100644 --- a/packages/camera/camera/test/camera_preview_test.dart +++ b/packages/camera/camera/test/camera_preview_test.dart @@ -15,10 +15,7 @@ class FakeController extends ValueNotifier FakeController() : super(const CameraValue.uninitialized(fakeDescription)); static const CameraDescription fakeDescription = CameraDescription( - name: '', - lensDirection: CameraLensDirection.back, - sensorOrientation: 0, - lensType: CameraLensType.ultraWide); + name: '', lensDirection: CameraLensDirection.back, sensorOrientation: 0); @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 234b4399e30..dbb1ddcbf78 100644 --- a/packages/camera/camera/test/camera_value_test.dart +++ b/packages/camera/camera/test/camera_value_test.dart @@ -147,7 +147,7 @@ void main() { ); 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))'); + '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))'); }); }); } From 93e2484da962bd06ce2def2fb240d913f99e1f75 Mon Sep 17 00:00:00 2001 From: Lenz Paul Date: Fri, 7 Mar 2025 10:53:27 -0500 Subject: [PATCH 23/24] Updates CameraDescription tests to add toString and include lensType --- .../test/types/camera_description_test.dart | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/packages/camera/camera_platform_interface/test/types/camera_description_test.dart b/packages/camera/camera_platform_interface/test/types/camera_description_test.dart index 50d13dd321b..effd36951fc 100644 --- a/packages/camera/camera_platform_interface/test/types/camera_description_test.dart +++ b/packages/camera/camera_platform_interface/test/types/camera_description_test.dart @@ -30,11 +30,13 @@ void main() { name: 'Test', lensDirection: CameraLensDirection.front, sensorOrientation: 90, + lensType: CameraLensType.ultraWide, ); expect(description.name, 'Test'); expect(description.lensDirection, CameraLensDirection.front); expect(description.sensorOrientation, 90); + expect(description.lensType, CameraLensType.ultraWide); }); test('equals should return true if objects are the same', () { @@ -42,11 +44,13 @@ void main() { name: 'Test', lensDirection: CameraLensDirection.front, sensorOrientation: 90, + lensType: CameraLensType.ultraWide, ); const CameraDescription secondDescription = CameraDescription( name: 'Test', lensDirection: CameraLensDirection.front, sensorOrientation: 90, + lensType: CameraLensType.ultraWide, ); expect(firstDescription == secondDescription, true); @@ -57,11 +61,13 @@ void main() { name: 'Test', lensDirection: CameraLensDirection.front, sensorOrientation: 90, + lensType: CameraLensType.ultraWide, ); const CameraDescription secondDescription = CameraDescription( name: 'Testing', lensDirection: CameraLensDirection.front, sensorOrientation: 90, + lensType: CameraLensType.ultraWide, ); expect(firstDescription == secondDescription, false); @@ -72,11 +78,13 @@ void main() { name: 'Test', lensDirection: CameraLensDirection.front, sensorOrientation: 90, + lensType: CameraLensType.ultraWide, ); const CameraDescription secondDescription = CameraDescription( name: 'Test', lensDirection: CameraLensDirection.back, sensorOrientation: 90, + lensType: CameraLensType.ultraWide, ); expect(firstDescription == secondDescription, false); @@ -87,11 +95,13 @@ void main() { name: 'Test', lensDirection: CameraLensDirection.front, sensorOrientation: 0, + lensType: CameraLensType.ultraWide, ); const CameraDescription secondDescription = CameraDescription( name: 'Test', lensDirection: CameraLensDirection.front, sensorOrientation: 90, + lensType: CameraLensType.ultraWide, ); expect(firstDescription == secondDescription, true); @@ -110,5 +120,19 @@ void main() { expect(description.hashCode, expectedHashCode); }); + + test('toString should return correct string representation', () { + const CameraDescription description = CameraDescription( + name: 'Test', + lensDirection: CameraLensDirection.front, + sensorOrientation: 90, + lensType: CameraLensType.ultraWide, + ); + + expect( + description.toString(), + 'CameraDescription(Test, CameraLensDirection.front, 90, CameraLensType.ultraWide)', + ); + }); }); } From 77fe9dad44f839b5cc65097dd6bcff56356e0a06 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Fri, 7 Mar 2025 12:59:08 -0500 Subject: [PATCH 24/24] Minor changelog adjustments --- packages/camera/camera_platform_interface/CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/camera/camera_platform_interface/CHANGELOG.md b/packages/camera/camera_platform_interface/CHANGELOG.md index a76c9d06a2a..d00f721a79b 100644 --- a/packages/camera/camera_platform_interface/CHANGELOG.md +++ b/packages/camera/camera_platform_interface/CHANGELOG.md @@ -1,7 +1,7 @@ ## 2.10.0 -- Introduces a new CameraLensType enum to provide lens type information about - the camera (e.g. ultra-wide, telephoto, ...). +* Introduces a new `CameraLensType` enum to provide lens type information about + the camera (e.g., ultra-wide, telephoto, ...). ## 2.9.0