Back to build
Raw log | Switch to full mode | Login

Downloading Google Java Format... Downloading ktfmt... --packages-for-branch: running on branch "HEAD". Running for all packages that have diffs relative to "91d11d696196880fe3cd4817c08362e59d7b5c56" Changed packages: image_picker/image_picker,image_picker_android,image_picker_ios,image_picker_platform_interface Formatting .dart files... Running command: "dart format image_picker/image_picker/example/integration_test/image_picker_test.dart image_picker/image_picker/example/lib/main.dart image_picker/image_picker/example/lib/readme_excerpts.dart image_picker/image_picker/example/test/readme_excerpts_test.dart image_picker/image_picker/example/test_driver/integration_test.dart image_picker/image_picker/lib/image_picker.dart image_picker/image_picker/test/image_picker_test.dart image_picker/image_picker/test/image_picker_test.mocks.dart image_picker/image_picker_android/example/integration_test/image_picker_test.dart image_picker/image_picker_android/example/lib/main.dart image_picker/image_picker_android/example/test_driver/integration_test.dart image_picker/image_picker_android/lib/image_picker_android.dart image_picker/image_picker_android/lib/src/messages.g.dart image_picker/image_picker_android/pigeons/messages.dart image_picker/image_picker_android/test/image_picker_android_test.dart image_picker/image_picker_android/test/test_api.g.dart image_picker/image_picker_ios/example/integration_test/image_picker_test.dart image_picker/image_picker_ios/example/lib/main.dart image_picker/image_picker_ios/example/test_driver/integration_test.dart image_picker/image_picker_ios/lib/image_picker_ios.dart image_picker/image_picker_ios/lib/src/messages.g.dart image_picker/image_picker_ios/pigeons/messages.dart image_picker/image_picker_ios/test/image_picker_ios_test.dart image_picker/image_picker_ios/test/test_api.g.dart image_picker/image_picker_platform_interface/lib/image_picker_platform_interface.dart image_picker/image_picker_platform_interface/lib/src/method_channel/method_channel_image_picker.dart image_picker/image_picker_platform_interface/lib/src/platform_interface/image_picker_platform.dart image_picker/image_picker_platform_interface/lib/src/types/camera_delegate.dart image_picker/image_picker_platform_interface/lib/src/types/camera_device.dart image_picker/image_picker_platform_interface/lib/src/types/image_options.dart image_picker/image_picker_platform_interface/lib/src/types/image_source.dart image_picker/image_picker_platform_interface/lib/src/types/lost_data_response.dart image_picker/image_picker_platform_interface/lib/src/types/media_options.dart image_picker/image_picker_platform_interface/lib/src/types/media_selection_type.dart image_picker/image_picker_platform_interface/lib/src/types/multi_image_picker_options.dart image_picker/image_picker_platform_interface/lib/src/types/picked_file/base.dart image_picker/image_picker_platform_interface/lib/src/types/picked_file/html.dart image_picker/image_picker_platform_interface/lib/src/types/picked_file/io.dart image_picker/image_picker_platform_interface/lib/src/types/picked_file/lost_data.dart image_picker/image_picker_platform_interface/lib/src/types/picked_file/picked_file.dart image_picker/image_picker_platform_interface/lib/src/types/picked_file/unsupported.dart image_picker/image_picker_platform_interface/lib/src/types/retrieve_type.dart image_picker/image_picker_platform_interface/lib/src/types/types.dart image_picker/image_picker_platform_interface/test/image_picker_platform_test.dart image_picker/image_picker_platform_interface/test/method_channel_image_picker_test.dart image_picker/image_picker_platform_interface/test/picked_file_html_test.dart image_picker/image_picker_platform_interface/test/picked_file_io_test.dart" in /b/s/w/ir/x/w/packages/packages Formatted image_picker/image_picker_ios/lib/src/messages.g.dart Formatted image_picker/image_picker_ios/test/test_api.g.dart Formatted 47 files (2 changed) in 1.01 seconds. Formatting .java files... Running command: "java -jar /b/s/w/ir/x/w/packages/script/tool/bin/google-java-format-1.3-all-deps.jar --replace image_picker/image_picker/example/android/app/src/androidTest/java/io/flutter/plugins/DartIntegrationTest.java image_picker/image_picker/example/android/app/src/androidTest/java/io/flutter/plugins/imagepickerexample/FlutterActivityTest.java image_picker/image_picker/example/android/app/src/main/java/io/flutter/plugins/imagepickerexample/ImagePickerTestActivity.java image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ExifDataCopier.java image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/FileUtils.java image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerCache.java image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerFileProvider.java image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerPlugin.java image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerUtils.java image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImageResizer.java image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/Messages.java image_picker/image_picker_android/android/src/test/java/io/flutter/plugins/imagepicker/ExifDataCopierTest.java image_picker/image_picker_android/android/src/test/java/io/flutter/plugins/imagepicker/FileUtilTest.java image_picker/image_picker_android/android/src/test/java/io/flutter/plugins/imagepicker/ImagePickerCacheTest.java image_picker/image_picker_android/android/src/test/java/io/flutter/plugins/imagepicker/ImagePickerDelegateTest.java image_picker/image_picker_android/android/src/test/java/io/flutter/plugins/imagepicker/ImagePickerPluginTest.java image_picker/image_picker_android/android/src/test/java/io/flutter/plugins/imagepicker/ImageResizerTest.java image_picker/image_picker_android/example/android/app/src/androidTest/java/io/flutter/plugins/DartIntegrationTest.java image_picker/image_picker_android/example/android/app/src/androidTest/java/io/flutter/plugins/imagepickerexample/FlutterActivityTest.java image_picker/image_picker_android/example/android/app/src/androidTest/java/io/flutter/plugins/imagepickerexample/ImagePickerPickTest.java image_picker/image_picker_android/example/android/app/src/androidTest/java/io/flutter/plugins/imagepickerexample/ImagePickerTest.java image_picker/image_picker_android/example/android/app/src/main/java/io/flutter/plugins/imagepickerexample/DriverExtensionActivity.java image_picker/image_picker_android/example/android/app/src/main/java/io/flutter/plugins/imagepickerexample/DummyContentProvider.java image_picker/image_picker_android/example/android/app/src/main/java/io/flutter/plugins/imagepickerexample/ImagePickerTestActivity.java" in /b/s/w/ir/x/w/packages/packages Formatting .cc, .cpp, .h, .m, and .mm files... Running command: "clang-format -i --style=file image_picker/image_picker/example/ios/Runner/AppDelegate.h image_picker/image_picker/example/ios/Runner/AppDelegate.m image_picker/image_picker/example/ios/Runner/main.m image_picker/image_picker/example/linux/main.cc image_picker/image_picker/example/linux/my_application.cc image_picker/image_picker/example/linux/my_application.h image_picker/image_picker/example/windows/runner/flutter_window.cpp image_picker/image_picker/example/windows/runner/flutter_window.h image_picker/image_picker/example/windows/runner/main.cpp image_picker/image_picker/example/windows/runner/resource.h image_picker/image_picker/example/windows/runner/utils.cpp image_picker/image_picker/example/windows/runner/utils.h image_picker/image_picker/example/windows/runner/win32_window.cpp image_picker/image_picker/example/windows/runner/win32_window.h image_picker/image_picker_ios/example/ios/Runner/AppDelegate.h image_picker/image_picker_ios/example/ios/Runner/AppDelegate.m image_picker/image_picker_ios/example/ios/Runner/main.m image_picker/image_picker_ios/example/ios/RunnerTests/ImagePickerPluginTests.m image_picker/image_picker_ios/example/ios/RunnerTests/ImagePickerTestImages.h image_picker/image_picker_ios/example/ios/RunnerTests/ImagePickerTestImages.m image_picker/image_picker_ios/example/ios/RunnerTests/ImageUtilTests.m image_picker/image_picker_ios/example/ios/RunnerTests/MetaDataUtilTests.m image_picker/image_picker_ios/example/ios/RunnerTests/PhotoAssetUtilTests.m image_picker/image_picker_ios/example/ios/RunnerTests/PickerSaveImageToPathOperationTests.m image_picker/image_picker_ios/example/ios/RunnerUITests/ImagePickerFromGalleryUITests.m image_picker/image_picker_ios/example/ios/RunnerUITests/ImagePickerFromLimitedGalleryUITests.m image_picker/image_picker_ios/ios/Classes/FLTImagePickerImageUtil.h image_picker/image_picker_ios/ios/Classes/FLTImagePickerImageUtil.m image_picker/image_picker_ios/ios/Classes/FLTImagePickerMetaDataUtil.h image_picker/image_picker_ios/ios/Classes/FLTImagePickerMetaDataUtil.m image_picker/image_picker_ios/ios/Classes/FLTImagePickerPhotoAssetUtil.h image_picker/image_picker_ios/ios/Classes/FLTImagePickerPhotoAssetUtil.m image_picker/image_picker_ios/ios/Classes/FLTImagePickerPlugin.h image_picker/image_picker_ios/ios/Classes/FLTImagePickerPlugin.m image_picker/image_picker_ios/ios/Classes/FLTImagePickerPlugin_Test.h image_picker/image_picker_ios/ios/Classes/FLTPHPickerSaveImageToPathOperation.h image_picker/image_picker_ios/ios/Classes/FLTPHPickerSaveImageToPathOperation.m image_picker/image_picker_ios/ios/Classes/image_picker_ios-umbrella.h image_picker/image_picker_ios/ios/Classes/messages.g.h image_picker/image_picker_ios/ios/Classes/messages.g.m" in /b/s/w/ir/x/w/packages/packages These files are not formatted correctly (see diff below): image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerPlugin.java image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/Messages.java image_picker/image_picker_ios/ios/Classes/messages.g.h image_picker/image_picker_ios/ios/Classes/messages.g.m image_picker/image_picker_ios/lib/src/messages.g.dart image_picker/image_picker_ios/test/test_api.g.dart To fix run the repository tooling `format` command: https://github.com/flutter/packages/blob/main/script/tool/README.md#format-code or copy-paste this command into your terminal: patch -p1 <<DONE diff --git a/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java b/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java index bd50100f6..b2263e794 100644 --- a/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java +++ b/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java @@ -6,8 +6,6 @@ package io.flutter.plugins.imagepicker; import android.Manifest; import android.app.Activity; -import android.os.Bundle; -import android.os.ext.SdkExtensions; import android.content.ActivityNotFoundException; import android.content.ClipData; import android.content.Intent; @@ -17,6 +15,7 @@ import android.hardware.camera2.CameraCharacteristics; import android.media.MediaScannerConnection; import android.net.Uri; import android.os.Build; +import android.os.ext.SdkExtensions; import android.provider.MediaStore; import androidx.activity.result.PickVisualMediaRequest; import androidx.activity.result.contract.ActivityResultContracts; @@ -303,11 +302,12 @@ public class ImagePickerDelegate int effectiveLimit; if (limit != null) { - effectiveLimit = Math.toIntExact(limit); - } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && SdkExtensions.getExtensionVersion(Build.VERSION_CODES.R) >= 2) { - effectiveLimit = MediaStore.getPickImagesMaxLimit(); + effectiveLimit = Math.toIntExact(limit); + } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R + && SdkExtensions.getExtensionVersion(Build.VERSION_CODES.R) >= 2) { + effectiveLimit = MediaStore.getPickImagesMaxLimit(); } else { - effectiveLimit = Integer.MAX_VALUE; + effectiveLimit = Integer.MAX_VALUE; } pickMediaIntent = diff --git a/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerPlugin.java b/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerPlugin.java index 6e51ecf11..fe8cfd9ed 100644 --- a/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerPlugin.java +++ b/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerPlugin.java @@ -324,14 +324,16 @@ public class ImagePickerPlugin implements FlutterPlugin, ActivityAware, ImagePic int effectiveLimit; if (limit != null) { - effectiveLimit = Math.toIntExact(limit); - } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && SdkExtensions.getExtensionVersion(Build.VERSION_CODES.R) >= 2) { - effectiveLimit = MediaStore.getPickImagesMaxLimit(); + effectiveLimit = Math.toIntExact(limit); + } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R + && SdkExtensions.getExtensionVersion(Build.VERSION_CODES.R) >= 2) { + effectiveLimit = MediaStore.getPickImagesMaxLimit(); } else { - effectiveLimit = Integer.MAX_VALUE; + effectiveLimit = Integer.MAX_VALUE; } - delegate.chooseMultiImageFromGallery(options, generalOptions.getUsePhotoPicker(), effectiveLimit, result); + delegate.chooseMultiImageFromGallery( + options, generalOptions.getUsePhotoPicker(), effectiveLimit, result); } else { switch (source.getType()) { case GALLERY: diff --git a/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/Messages.java b/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/Messages.java index 9ef8f20ce..b987a2284 100644 --- a/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/Messages.java +++ b/packages/image_picker/image_picker_android/android/src/main/java/io/flutter/plugins/imagepicker/Messages.java @@ -21,11 +21,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; import java.nio.ByteBuffer; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; /** Generated class from Pigeon. */ @SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression", "serial"}) @@ -40,8 +36,7 @@ public class Messages { /** The error details. Must be a datatype supported by the api codec. */ public final Object details; - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) - { + public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { super(message); this.code = code; this.details = details; @@ -60,7 +55,7 @@ public class Messages { errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); } return errorList; } @@ -194,7 +189,8 @@ public class Messages { Object usePhotoPicker = list.get(1); pigeonResult.setUsePhotoPicker((Boolean) usePhotoPicker); Object limit = list.get(2); - pigeonResult.setLimit((limit == null) ? null : ((limit instanceof Integer) ? (Integer) limit : (Long) limit)); + pigeonResult.setLimit( + (limit == null) ? null : ((limit instanceof Integer) ? (Integer) limit : (Long) limit)); return pigeonResult; } } @@ -202,7 +198,7 @@ public class Messages { /** * Options for image selection and output. * - * Generated class from Pigeon that represents data sent in messages. + * <p>Generated class from Pigeon that represents data sent in messages. */ public static final class ImageSelectionOptions { /** If set, the max width that the image should be resized to fit in. */ @@ -230,7 +226,7 @@ public class Messages { /** * The quality of the output image, from 0-100. * - * 100 indicates original quality. + * <p>100 indicates original quality. */ private @NonNull Long quality; @@ -299,7 +295,10 @@ public class Messages { Object maxHeight = list.get(1); pigeonResult.setMaxHeight((Double) maxHeight); Object quality = list.get(2); - pigeonResult.setQuality((quality == null) ? null : ((quality instanceof Integer) ? (Integer) quality : (Long) quality)); + pigeonResult.setQuality( + (quality == null) + ? null + : ((quality instanceof Integer) ? (Integer) quality : (Long) quality)); return pigeonResult; } } @@ -349,7 +348,10 @@ public class Messages { static @NonNull MediaSelectionOptions fromList(@NonNull ArrayList<Object> list) { MediaSelectionOptions pigeonResult = new MediaSelectionOptions(); Object imageSelectionOptions = list.get(0); - pigeonResult.setImageSelectionOptions((imageSelectionOptions == null) ? null : ImageSelectionOptions.fromList((ArrayList<Object>) imageSelectionOptions)); + pigeonResult.setImageSelectionOptions( + (imageSelectionOptions == null) + ? null + : ImageSelectionOptions.fromList((ArrayList<Object>) imageSelectionOptions)); return pigeonResult; } } @@ -357,7 +359,7 @@ public class Messages { /** * Options for image selection and output. * - * Generated class from Pigeon that represents data sent in messages. + * <p>Generated class from Pigeon that represents data sent in messages. */ public static final class VideoSelectionOptions { /** The maximum desired length for the video, in seconds. */ @@ -398,7 +400,12 @@ public class Messages { static @NonNull VideoSelectionOptions fromList(@NonNull ArrayList<Object> list) { VideoSelectionOptions pigeonResult = new VideoSelectionOptions(); Object maxDurationSeconds = list.get(0); - pigeonResult.setMaxDurationSeconds((maxDurationSeconds == null) ? null : ((maxDurationSeconds instanceof Integer) ? (Integer) maxDurationSeconds : (Long) maxDurationSeconds)); + pigeonResult.setMaxDurationSeconds( + (maxDurationSeconds == null) + ? null + : ((maxDurationSeconds instanceof Integer) + ? (Integer) maxDurationSeconds + : (Long) maxDurationSeconds)); return pigeonResult; } } @@ -406,7 +413,7 @@ public class Messages { /** * Specification for the source of an image or video selection. * - * Generated class from Pigeon that represents data sent in messages. + * <p>Generated class from Pigeon that represents data sent in messages. */ public static final class SourceSpecification { private @NonNull SourceType type; @@ -482,9 +489,9 @@ public class Messages { /** * An error that occurred during lost result retrieval. * - * The data here maps to the `PlatformException` that will be created from it. + * <p>The data here maps to the `PlatformException` that will be created from it. * - * Generated class from Pigeon that represents data sent in messages. + * <p>Generated class from Pigeon that represents data sent in messages. */ public static final class CacheRetrievalError { private @NonNull String code; @@ -560,7 +567,7 @@ public class Messages { /** * The result of retrieving cached results from a previous run. * - * Generated class from Pigeon that represents data sent in messages. + * <p>Generated class from Pigeon that represents data sent in messages. */ public static final class CacheRetrievalResult { /** The type of the retrieved data. */ @@ -591,7 +598,7 @@ public class Messages { /** * The results from the last selection, if any. * - * Elements must not be null, by convention. See + * <p>Elements must not be null, by convention. See * https://github.com/flutter/flutter/issues/97848 */ private @NonNull List<String> paths; @@ -659,7 +666,8 @@ public class Messages { Object type = list.get(0); pigeonResult.setType(CacheRetrievalType.values()[(int) type]); Object error = list.get(1); - pigeonResult.setError((error == null) ? null : CacheRetrievalError.fromList((ArrayList<Object>) error)); + pigeonResult.setError( + (error == null) ? null : CacheRetrievalError.fromList((ArrayList<Object>) error)); Object paths = list.get(2); pigeonResult.setPaths((List<String>) paths); return pigeonResult; @@ -752,39 +760,53 @@ public class Messages { /** * Selects images and returns their paths. * - * Elements must not be null, by convention. See + * <p>Elements must not be null, by convention. See * https://github.com/flutter/flutter/issues/97848 */ - void pickImages(@NonNull SourceSpecification source, @NonNull ImageSelectionOptions options, @NonNull GeneralOptions generalOptions, @NonNull Result<List<String>> result); + void pickImages( + @NonNull SourceSpecification source, + @NonNull ImageSelectionOptions options, + @NonNull GeneralOptions generalOptions, + @NonNull Result<List<String>> result); /** * Selects video and returns their paths. * - * Elements must not be null, by convention. See + * <p>Elements must not be null, by convention. See * https://github.com/flutter/flutter/issues/97848 */ - void pickVideos(@NonNull SourceSpecification source, @NonNull VideoSelectionOptions options, @NonNull GeneralOptions generalOptions, @NonNull Result<List<String>> result); + void pickVideos( + @NonNull SourceSpecification source, + @NonNull VideoSelectionOptions options, + @NonNull GeneralOptions generalOptions, + @NonNull Result<List<String>> result); /** * Selects images and videos and returns their paths. * - * Elements must not be null, by convention. See + * <p>Elements must not be null, by convention. See * https://github.com/flutter/flutter/issues/97848 */ - void pickMedia(@NonNull MediaSelectionOptions mediaSelectionOptions, @NonNull GeneralOptions generalOptions, @NonNull Result<List<String>> result); + void pickMedia( + @NonNull MediaSelectionOptions mediaSelectionOptions, + @NonNull GeneralOptions generalOptions, + @NonNull Result<List<String>> result); /** Returns results from a previous app session, if any. */ - @Nullable + @Nullable CacheRetrievalResult retrieveLostResults(); /** The codec used by ImagePickerApi. */ static @NonNull MessageCodec<Object> getCodec() { return ImagePickerApiCodec.INSTANCE; } - /**Sets up an instance of `ImagePickerApi` to handle messages through the `binaryMessenger`. */ + /** Sets up an instance of `ImagePickerApi` to handle messages through the `binaryMessenger`. */ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable ImagePickerApi api) { { BinaryMessenger.TaskQueue taskQueue = binaryMessenger.makeBackgroundTaskQueue(); BasicMessageChannel<Object> channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickImages", getCodec(), taskQueue); + binaryMessenger, + "dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickImages", + getCodec(), + taskQueue); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -816,7 +838,10 @@ public class Messages { BinaryMessenger.TaskQueue taskQueue = binaryMessenger.makeBackgroundTaskQueue(); BasicMessageChannel<Object> channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickVideos", getCodec(), taskQueue); + binaryMessenger, + "dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickVideos", + getCodec(), + taskQueue); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -847,13 +872,16 @@ public class Messages { { BasicMessageChannel<Object> channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickMedia", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.image_picker_android.ImagePickerApi.pickMedia", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { ArrayList<Object> wrapped = new ArrayList<Object>(); ArrayList<Object> args = (ArrayList<Object>) message; - MediaSelectionOptions mediaSelectionOptionsArg = (MediaSelectionOptions) args.get(0); + MediaSelectionOptions mediaSelectionOptionsArg = + (MediaSelectionOptions) args.get(0); GeneralOptions generalOptionsArg = (GeneralOptions) args.get(1); Result<List<String>> resultCallback = new Result<List<String>>() { @@ -878,7 +906,10 @@ public class Messages { BinaryMessenger.TaskQueue taskQueue = binaryMessenger.makeBackgroundTaskQueue(); BasicMessageChannel<Object> channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.image_picker_android.ImagePickerApi.retrieveLostResults", getCodec(), taskQueue); + binaryMessenger, + "dev.flutter.pigeon.image_picker_android.ImagePickerApi.retrieveLostResults", + getCodec(), + taskQueue); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -886,8 +917,7 @@ public class Messages { try { CacheRetrievalResult output = api.retrieveLostResults(); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList<Object> wrappedError = wrapError(exception); wrapped = wrappedError; } diff --git a/packages/image_picker/image_picker_ios/ios/Classes/messages.g.h b/packages/image_picker/image_picker_ios/ios/Classes/messages.g.h index edf27cdbe..de9a8200b 100644 --- a/packages/image_picker/image_picker_ios/ios/Classes/messages.g.h +++ b/packages/image_picker/image_picker_ios/ios/Classes/messages.g.h @@ -40,32 +40,30 @@ typedef NS_ENUM(NSUInteger, FLTSourceType) { @class FLTSourceSpecification; @interface FLTMaxSize : NSObject -+ (instancetype)makeWithWidth:(nullable NSNumber *)width - height:(nullable NSNumber *)height; -@property(nonatomic, strong, nullable) NSNumber * width; -@property(nonatomic, strong, nullable) NSNumber * height; ++ (instancetype)makeWithWidth:(nullable NSNumber *)width height:(nullable NSNumber *)height; +@property(nonatomic, strong, nullable) NSNumber *width; +@property(nonatomic, strong, nullable) NSNumber *height; @end @interface FLTMediaSelectionOptions : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithMaxSize:(FLTMaxSize *)maxSize - imageQuality:(nullable NSNumber *)imageQuality - requestFullMetadata:(BOOL )requestFullMetadata - allowMultiple:(BOOL )allowMultiple - limit:(nullable NSNumber *)limit; -@property(nonatomic, strong) FLTMaxSize * maxSize; -@property(nonatomic, strong, nullable) NSNumber * imageQuality; -@property(nonatomic, assign) BOOL requestFullMetadata; -@property(nonatomic, assign) BOOL allowMultiple; -@property(nonatomic, strong, nullable) NSNumber * limit; + imageQuality:(nullable NSNumber *)imageQuality + requestFullMetadata:(BOOL)requestFullMetadata + allowMultiple:(BOOL)allowMultiple + limit:(nullable NSNumber *)limit; +@property(nonatomic, strong) FLTMaxSize *maxSize; +@property(nonatomic, strong, nullable) NSNumber *imageQuality; +@property(nonatomic, assign) BOOL requestFullMetadata; +@property(nonatomic, assign) BOOL allowMultiple; +@property(nonatomic, strong, nullable) NSNumber *limit; @end @interface FLTSourceSpecification : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithType:(FLTSourceType)type - camera:(FLTSourceCamera)camera; ++ (instancetype)makeWithType:(FLTSourceType)type camera:(FLTSourceCamera)camera; @property(nonatomic, assign) FLTSourceType type; @property(nonatomic, assign) FLTSourceCamera camera; @end @@ -74,13 +72,27 @@ typedef NS_ENUM(NSUInteger, FLTSourceType) { NSObject<FlutterMessageCodec> *FLTImagePickerApiGetCodec(void); @protocol FLTImagePickerApi -- (void)pickImageWithSource:(FLTSourceSpecification *)source maxSize:(FLTMaxSize *)maxSize quality:(nullable NSNumber *)imageQuality fullMetadata:(BOOL)requestFullMetadata completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; -- (void)pickMultiImageWithMaxSize:(FLTMaxSize *)maxSize quality:(nullable NSNumber *)imageQuality fullMetadata:(BOOL)requestFullMetadata limit:(nullable NSNumber *)limit completion:(void (^)(NSArray<NSString *> *_Nullable, FlutterError *_Nullable))completion; -- (void)pickVideoWithSource:(FLTSourceSpecification *)source maxDuration:(nullable NSNumber *)maxDurationSeconds completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; +- (void)pickImageWithSource:(FLTSourceSpecification *)source + maxSize:(FLTMaxSize *)maxSize + quality:(nullable NSNumber *)imageQuality + fullMetadata:(BOOL)requestFullMetadata + completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; +- (void)pickMultiImageWithMaxSize:(FLTMaxSize *)maxSize + quality:(nullable NSNumber *)imageQuality + fullMetadata:(BOOL)requestFullMetadata + limit:(nullable NSNumber *)limit + completion:(void (^)(NSArray<NSString *> *_Nullable, + FlutterError *_Nullable))completion; +- (void)pickVideoWithSource:(FLTSourceSpecification *)source + maxDuration:(nullable NSNumber *)maxDurationSeconds + completion:(void (^)(NSString *_Nullable, FlutterError *_Nullable))completion; /// Selects images and videos and returns their paths. -- (void)pickMediaWithMediaSelectionOptions:(FLTMediaSelectionOptions *)mediaSelectionOptions completion:(void (^)(NSArray<NSString *> *_Nullable, FlutterError *_Nullable))completion; +- (void)pickMediaWithMediaSelectionOptions:(FLTMediaSelectionOptions *)mediaSelectionOptions + completion:(void (^)(NSArray<NSString *> *_Nullable, + FlutterError *_Nullable))completion; @end -extern void SetUpFLTImagePickerApi(id<FlutterBinaryMessenger> binaryMessenger, NSObject<FLTImagePickerApi> *_Nullable api); +extern void SetUpFLTImagePickerApi(id<FlutterBinaryMessenger> binaryMessenger, + NSObject<FLTImagePickerApi> *_Nullable api); NS_ASSUME_NONNULL_END diff --git a/packages/image_picker/image_picker_ios/ios/Classes/messages.g.m b/packages/image_picker/image_picker_ios/ios/Classes/messages.g.m index 50ba16fa6..a1f5794dd 100644 --- a/packages/image_picker/image_picker_ios/ios/Classes/messages.g.m +++ b/packages/image_picker/image_picker_ios/ios/Classes/messages.g.m @@ -69,9 +69,8 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { @end @implementation FLTMaxSize -+ (instancetype)makeWithWidth:(nullable NSNumber *)width - height:(nullable NSNumber *)height { - FLTMaxSize* pigeonResult = [[FLTMaxSize alloc] init]; ++ (instancetype)makeWithWidth:(nullable NSNumber *)width height:(nullable NSNumber *)height { + FLTMaxSize *pigeonResult = [[FLTMaxSize alloc] init]; pigeonResult.width = width; pigeonResult.height = height; return pigeonResult; @@ -95,11 +94,11 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { @implementation FLTMediaSelectionOptions + (instancetype)makeWithMaxSize:(FLTMaxSize *)maxSize - imageQuality:(nullable NSNumber *)imageQuality - requestFullMetadata:(BOOL )requestFullMetadata - allowMultiple:(BOOL )allowMultiple - limit:(nullable NSNumber *)limit { - FLTMediaSelectionOptions* pigeonResult = [[FLTMediaSelectionOptions alloc] init]; + imageQuality:(nullable NSNumber *)imageQuality + requestFullMetadata:(BOOL)requestFullMetadata + allowMultiple:(BOOL)allowMultiple + limit:(nullable NSNumber *)limit { + FLTMediaSelectionOptions *pigeonResult = [[FLTMediaSelectionOptions alloc] init]; pigeonResult.maxSize = maxSize; pigeonResult.imageQuality = imageQuality; pigeonResult.requestFullMetadata = requestFullMetadata; @@ -131,9 +130,8 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { @end @implementation FLTSourceSpecification -+ (instancetype)makeWithType:(FLTSourceType)type - camera:(FLTSourceCamera)camera { - FLTSourceSpecification* pigeonResult = [[FLTSourceSpecification alloc] init]; ++ (instancetype)makeWithType:(FLTSourceType)type camera:(FLTSourceCamera)camera { + FLTSourceSpecification *pigeonResult = [[FLTSourceSpecification alloc] init]; pigeonResult.type = type; pigeonResult.camera = camera; return pigeonResult; @@ -160,11 +158,11 @@ static id GetNullableObjectAtIndex(NSArray *array, NSInteger key) { @implementation FLTImagePickerApiCodecReader - (nullable id)readValueOfType:(UInt8)type { switch (type) { - case 128: + case 128: return [FLTMaxSize fromList:[self readValue]]; - case 129: + case 129: return [FLTMediaSelectionOptions fromList:[self readValue]]; - case 130: + case 130: return [FLTSourceSpecification fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -206,72 +204,93 @@ NSObject<FlutterMessageCodec> *FLTImagePickerApiGetCodec(void) { static FlutterStandardMessageCodec *sSharedObject = nil; static dispatch_once_t sPred = 0; dispatch_once(&sPred, ^{ - FLTImagePickerApiCodecReaderWriter *readerWriter = [[FLTImagePickerApiCodecReaderWriter alloc] init]; + FLTImagePickerApiCodecReaderWriter *readerWriter = + [[FLTImagePickerApiCodecReaderWriter alloc] init]; sSharedObject = [FlutterStandardMessageCodec codecWithReaderWriter:readerWriter]; }); return sSharedObject; } -void SetUpFLTImagePickerApi(id<FlutterBinaryMessenger> binaryMessenger, NSObject<FLTImagePickerApi> *api) { +void SetUpFLTImagePickerApi(id<FlutterBinaryMessenger> binaryMessenger, + NSObject<FLTImagePickerApi> *api) { { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickImage" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickImage" binaryMessenger:binaryMessenger - codec:FLTImagePickerApiGetCodec()]; + codec:FLTImagePickerApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(pickImageWithSource:maxSize:quality:fullMetadata:completion:)], @"FLTImagePickerApi api (%@) doesn't respond to @selector(pickImageWithSource:maxSize:quality:fullMetadata:completion:)", api); + NSCAssert([api respondsToSelector:@selector + (pickImageWithSource:maxSize:quality:fullMetadata:completion:)], + @"FLTImagePickerApi api (%@) doesn't respond to " + @"@selector(pickImageWithSource:maxSize:quality:fullMetadata:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FLTSourceSpecification *arg_source = GetNullableObjectAtIndex(args, 0); FLTMaxSize *arg_maxSize = GetNullableObjectAtIndex(args, 1); NSNumber *arg_imageQuality = GetNullableObjectAtIndex(args, 2); BOOL arg_requestFullMetadata = [GetNullableObjectAtIndex(args, 3) boolValue]; - [api pickImageWithSource:arg_source maxSize:arg_maxSize quality:arg_imageQuality fullMetadata:arg_requestFullMetadata completion:^(NSString *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api pickImageWithSource:arg_source + maxSize:arg_maxSize + quality:arg_imageQuality + fullMetadata:arg_requestFullMetadata + completion:^(NSString *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMultiImage" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMultiImage" binaryMessenger:binaryMessenger - codec:FLTImagePickerApiGetCodec()]; + codec:FLTImagePickerApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(pickMultiImageWithMaxSize:quality:fullMetadata:limit:completion:)], @"FLTImagePickerApi api (%@) doesn't respond to @selector(pickMultiImageWithMaxSize:quality:fullMetadata:limit:completion:)", api); + NSCAssert([api respondsToSelector:@selector + (pickMultiImageWithMaxSize:quality:fullMetadata:limit:completion:)], + @"FLTImagePickerApi api (%@) doesn't respond to " + @"@selector(pickMultiImageWithMaxSize:quality:fullMetadata:limit:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FLTMaxSize *arg_maxSize = GetNullableObjectAtIndex(args, 0); NSNumber *arg_imageQuality = GetNullableObjectAtIndex(args, 1); BOOL arg_requestFullMetadata = [GetNullableObjectAtIndex(args, 2) boolValue]; NSNumber *arg_limit = GetNullableObjectAtIndex(args, 3); - [api pickMultiImageWithMaxSize:arg_maxSize quality:arg_imageQuality fullMetadata:arg_requestFullMetadata limit:arg_limit completion:^(NSArray<NSString *> *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api pickMultiImageWithMaxSize:arg_maxSize + quality:arg_imageQuality + fullMetadata:arg_requestFullMetadata + limit:arg_limit + completion:^(NSArray<NSString *> *_Nullable output, + FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; } } { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickVideo" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickVideo" binaryMessenger:binaryMessenger - codec:FLTImagePickerApiGetCodec()]; + codec:FLTImagePickerApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(pickVideoWithSource:maxDuration:completion:)], @"FLTImagePickerApi api (%@) doesn't respond to @selector(pickVideoWithSource:maxDuration:completion:)", api); + NSCAssert([api respondsToSelector:@selector(pickVideoWithSource:maxDuration:completion:)], + @"FLTImagePickerApi api (%@) doesn't respond to " + @"@selector(pickVideoWithSource:maxDuration:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FLTSourceSpecification *arg_source = GetNullableObjectAtIndex(args, 0); NSNumber *arg_maxDurationSeconds = GetNullableObjectAtIndex(args, 1); - [api pickVideoWithSource:arg_source maxDuration:arg_maxDurationSeconds completion:^(NSString *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api pickVideoWithSource:arg_source + maxDuration:arg_maxDurationSeconds + completion:^(NSString *_Nullable output, FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; @@ -279,19 +298,23 @@ void SetUpFLTImagePickerApi(id<FlutterBinaryMessenger> binaryMessenger, NSObject } /// Selects images and videos and returns their paths. { - FlutterBasicMessageChannel *channel = - [[FlutterBasicMessageChannel alloc] - initWithName:@"dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMedia" + FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc] + initWithName:@"dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMedia" binaryMessenger:binaryMessenger - codec:FLTImagePickerApiGetCodec()]; + codec:FLTImagePickerApiGetCodec()]; if (api) { - NSCAssert([api respondsToSelector:@selector(pickMediaWithMediaSelectionOptions:completion:)], @"FLTImagePickerApi api (%@) doesn't respond to @selector(pickMediaWithMediaSelectionOptions:completion:)", api); + NSCAssert([api respondsToSelector:@selector(pickMediaWithMediaSelectionOptions:completion:)], + @"FLTImagePickerApi api (%@) doesn't respond to " + @"@selector(pickMediaWithMediaSelectionOptions:completion:)", + api); [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { NSArray *args = message; FLTMediaSelectionOptions *arg_mediaSelectionOptions = GetNullableObjectAtIndex(args, 0); - [api pickMediaWithMediaSelectionOptions:arg_mediaSelectionOptions completion:^(NSArray<NSString *> *_Nullable output, FlutterError *_Nullable error) { - callback(wrapResult(output, error)); - }]; + [api pickMediaWithMediaSelectionOptions:arg_mediaSelectionOptions + completion:^(NSArray<NSString *> *_Nullable output, + FlutterError *_Nullable error) { + callback(wrapResult(output, error)); + }]; }]; } else { [channel setMessageHandler:nil]; diff --git a/packages/image_picker/image_picker_ios/lib/src/messages.g.dart b/packages/image_picker/image_picker_ios/lib/src/messages.g.dart index 07f8face4..b3e785a09 100644 --- a/packages/image_picker/image_picker_ios/lib/src/messages.g.dart +++ b/packages/image_picker/image_picker_ios/lib/src/messages.g.dart @@ -18,7 +18,8 @@ PlatformException _createConnectionError(String channelName) { ); } -List<Object?> wrapResponse({Object? result, PlatformException? error, bool empty = false}) { +List<Object?> wrapResponse( + {Object? result, PlatformException? error, bool empty = false}) { if (empty) { return <Object?>[]; } @@ -152,11 +153,11 @@ class _ImagePickerApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return MaxSize.decode(readValue(buffer)!); - case 129: + case 129: return MediaSelectionOptions.decode(readValue(buffer)!); - case 130: + case 130: return SourceSpecification.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -172,17 +173,22 @@ class ImagePickerApi { : __pigeon_binaryMessenger = binaryMessenger; final BinaryMessenger? __pigeon_binaryMessenger; - static const MessageCodec<Object?> pigeonChannelCodec = _ImagePickerApiCodec(); + static const MessageCodec<Object?> pigeonChannelCodec = + _ImagePickerApiCodec(); - Future<String?> pickImage(SourceSpecification source, MaxSize maxSize, int? imageQuality, bool requestFullMetadata) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickImage'; - final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<Object?>( + Future<String?> pickImage(SourceSpecification source, MaxSize maxSize, + int? imageQuality, bool requestFullMetadata) async { + const String __pigeon_channelName = + 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickImage'; + final BasicMessageChannel<Object?> __pigeon_channel = + BasicMessageChannel<Object?>( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List<Object?>? __pigeon_replyList = - await __pigeon_channel.send(<Object?>[source, maxSize, imageQuality, requestFullMetadata]) as List<Object?>?; + final List<Object?>? __pigeon_replyList = await __pigeon_channel + .send(<Object?>[source, maxSize, imageQuality, requestFullMetadata]) + as List<Object?>?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -196,15 +202,19 @@ class ImagePickerApi { } } - Future<List<String?>> pickMultiImage(MaxSize maxSize, int? imageQuality, bool requestFullMetadata, int? limit) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMultiImage'; - final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<Object?>( + Future<List<String?>> pickMultiImage(MaxSize maxSize, int? imageQuality, + bool requestFullMetadata, int? limit) async { + const String __pigeon_channelName = + 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMultiImage'; + final BasicMessageChannel<Object?> __pigeon_channel = + BasicMessageChannel<Object?>( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List<Object?>? __pigeon_replyList = - await __pigeon_channel.send(<Object?>[maxSize, imageQuality, requestFullMetadata, limit]) as List<Object?>?; + final List<Object?>? __pigeon_replyList = await __pigeon_channel + .send(<Object?>[maxSize, imageQuality, requestFullMetadata, limit]) + as List<Object?>?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -223,15 +233,18 @@ class ImagePickerApi { } } - Future<String?> pickVideo(SourceSpecification source, int? maxDurationSeconds) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickVideo'; - final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<Object?>( + Future<String?> pickVideo( + SourceSpecification source, int? maxDurationSeconds) async { + const String __pigeon_channelName = + 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickVideo'; + final BasicMessageChannel<Object?> __pigeon_channel = + BasicMessageChannel<Object?>( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List<Object?>? __pigeon_replyList = - await __pigeon_channel.send(<Object?>[source, maxDurationSeconds]) as List<Object?>?; + final List<Object?>? __pigeon_replyList = await __pigeon_channel + .send(<Object?>[source, maxDurationSeconds]) as List<Object?>?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { @@ -246,15 +259,18 @@ class ImagePickerApi { } /// Selects images and videos and returns their paths. - Future<List<String?>> pickMedia(MediaSelectionOptions mediaSelectionOptions) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMedia'; - final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<Object?>( + Future<List<String?>> pickMedia( + MediaSelectionOptions mediaSelectionOptions) async { + const String __pigeon_channelName = + 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMedia'; + final BasicMessageChannel<Object?> __pigeon_channel = + BasicMessageChannel<Object?>( __pigeon_channelName, pigeonChannelCodec, binaryMessenger: __pigeon_binaryMessenger, ); - final List<Object?>? __pigeon_replyList = - await __pigeon_channel.send(<Object?>[mediaSelectionOptions]) as List<Object?>?; + final List<Object?>? __pigeon_replyList = await __pigeon_channel + .send(<Object?>[mediaSelectionOptions]) as List<Object?>?; if (__pigeon_replyList == null) { throw _createConnectionError(__pigeon_channelName); } else if (__pigeon_replyList.length > 1) { diff --git a/packages/image_picker/image_picker_ios/test/test_api.g.dart b/packages/image_picker/image_picker_ios/test/test_api.g.dart index aecc90f10..4208c68e3 100644 --- a/packages/image_picker/image_picker_ios/test/test_api.g.dart +++ b/packages/image_picker/image_picker_ios/test/test_api.g.dart @@ -34,11 +34,11 @@ class _TestHostImagePickerApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return MaxSize.decode(readValue(buffer)!); - case 129: + case 129: return MediaSelectionOptions.decode(readValue(buffer)!); - case 130: + case 130: return SourceSpecification.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -47,31 +47,43 @@ class _TestHostImagePickerApiCodec extends StandardMessageCodec { } abstract class TestHostImagePickerApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; - static const MessageCodec<Object?> pigeonChannelCodec = _TestHostImagePickerApiCodec(); + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; + static const MessageCodec<Object?> pigeonChannelCodec = + _TestHostImagePickerApiCodec(); - Future<String?> pickImage(SourceSpecification source, MaxSize maxSize, int? imageQuality, bool requestFullMetadata); + Future<String?> pickImage(SourceSpecification source, MaxSize maxSize, + int? imageQuality, bool requestFullMetadata); - Future<List<String?>> pickMultiImage(MaxSize maxSize, int? imageQuality, bool requestFullMetadata, int? limit); + Future<List<String?>> pickMultiImage( + MaxSize maxSize, int? imageQuality, bool requestFullMetadata, int? limit); - Future<String?> pickVideo(SourceSpecification source, int? maxDurationSeconds); + Future<String?> pickVideo( + SourceSpecification source, int? maxDurationSeconds); /// Selects images and videos and returns their paths. Future<List<String?>> pickMedia(MediaSelectionOptions mediaSelectionOptions); - static void setup(TestHostImagePickerApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestHostImagePickerApi? api, + {BinaryMessenger? binaryMessenger}) { { - final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<Object?>( - 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickImage', pigeonChannelCodec, - binaryMessenger: binaryMessenger); + final BasicMessageChannel<Object?> __pigeon_channel = + BasicMessageChannel<Object?>( + 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickImage', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler<Object?>(__pigeon_channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler<Object?>(__pigeon_channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler<Object?>(__pigeon_channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler<Object?>(__pigeon_channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickImage was null.'); + 'Argument for dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickImage was null.'); final List<Object?> args = (message as List<Object?>?)!; - final SourceSpecification? arg_source = (args[0] as SourceSpecification?); + final SourceSpecification? arg_source = + (args[0] as SourceSpecification?); assert(arg_source != null, 'Argument for dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickImage was null, expected non-null SourceSpecification.'); final MaxSize? arg_maxSize = (args[1] as MaxSize?); @@ -82,26 +94,33 @@ abstract class TestHostImagePickerApi { assert(arg_requestFullMetadata != null, 'Argument for dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickImage was null, expected non-null bool.'); try { - final String? output = await api.pickImage(arg_source!, arg_maxSize!, arg_imageQuality, arg_requestFullMetadata!); + final String? output = await api.pickImage(arg_source!, + arg_maxSize!, arg_imageQuality, arg_requestFullMetadata!); return <Object?>[output]; } 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?> __pigeon_channel = BasicMessageChannel<Object?>( - 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMultiImage', pigeonChannelCodec, + final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMultiImage', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler<Object?>(__pigeon_channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler<Object?>(__pigeon_channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler<Object?>(__pigeon_channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler<Object?>(__pigeon_channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMultiImage was null.'); + 'Argument for dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMultiImage was null.'); final List<Object?> args = (message as List<Object?>?)!; final MaxSize? arg_maxSize = (args[0] as MaxSize?); assert(arg_maxSize != null, @@ -112,63 +131,81 @@ abstract class TestHostImagePickerApi { 'Argument for dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMultiImage was null, expected non-null bool.'); final int? arg_limit = (args[3] as int?); try { - final List<String?> output = await api.pickMultiImage(arg_maxSize!, arg_imageQuality, arg_requestFullMetadata!, arg_limit); + final List<String?> output = await api.pickMultiImage(arg_maxSize!, + arg_imageQuality, arg_requestFullMetadata!, arg_limit); return <Object?>[output]; } 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?> __pigeon_channel = BasicMessageChannel<Object?>( - 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickVideo', pigeonChannelCodec, - binaryMessenger: binaryMessenger); + final BasicMessageChannel<Object?> __pigeon_channel = + BasicMessageChannel<Object?>( + 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickVideo', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler<Object?>(__pigeon_channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler<Object?>(__pigeon_channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler<Object?>(__pigeon_channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler<Object?>(__pigeon_channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickVideo was null.'); + 'Argument for dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickVideo was null.'); final List<Object?> args = (message as List<Object?>?)!; - final SourceSpecification? arg_source = (args[0] as SourceSpecification?); + final SourceSpecification? arg_source = + (args[0] as SourceSpecification?); assert(arg_source != null, 'Argument for dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickVideo was null, expected non-null SourceSpecification.'); final int? arg_maxDurationSeconds = (args[1] as int?); try { - final String? output = await api.pickVideo(arg_source!, arg_maxDurationSeconds); + final String? output = + await api.pickVideo(arg_source!, arg_maxDurationSeconds); return <Object?>[output]; } 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?> __pigeon_channel = BasicMessageChannel<Object?>( - 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMedia', pigeonChannelCodec, - binaryMessenger: binaryMessenger); + final BasicMessageChannel<Object?> __pigeon_channel = + BasicMessageChannel<Object?>( + 'dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMedia', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler<Object?>(__pigeon_channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler<Object?>(__pigeon_channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler<Object?>(__pigeon_channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler<Object?>(__pigeon_channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMedia was null.'); + 'Argument for dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMedia was null.'); final List<Object?> args = (message as List<Object?>?)!; - final MediaSelectionOptions? arg_mediaSelectionOptions = (args[0] as MediaSelectionOptions?); + final MediaSelectionOptions? arg_mediaSelectionOptions = + (args[0] as MediaSelectionOptions?); assert(arg_mediaSelectionOptions != null, 'Argument for dev.flutter.pigeon.image_picker_ios.ImagePickerApi.pickMedia was null, expected non-null MediaSelectionOptions.'); try { - final List<String?> output = await api.pickMedia(arg_mediaSelectionOptions!); + final List<String?> output = + await api.pickMedia(arg_mediaSelectionOptions!); return <Object?>[output]; } 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())); } }); } DONE