From e978e06eb9207e4bd7a56b2139b2906d3150edb5 Mon Sep 17 00:00:00 2001 From: stuartmorgan Date: Mon, 22 Jul 2024 10:00:20 -0400 Subject: [PATCH] [various] Update Windows packages to Pigeon 21 (#7180) Updates all Windows platform implementation packages to use the latest version of Pigeon. The main motivation was picking up the enum naming fix, but I figured I'd do all of them at once, even if they didn't use enums. --- packages/camera/camera_windows/CHANGELOG.md | 4 + .../camera_windows/lib/src/messages.g.dart | 2 +- packages/camera/camera_windows/pubspec.yaml | 4 +- .../windows/capture_controller.cpp | 14 +- .../camera_windows/windows/messages.g.cpp | 2 +- .../camera_windows/windows/messages.g.h | 14 +- .../windows/test/camera_plugin_test.cpp | 8 +- .../windows/test/camera_test.cpp | 4 +- .../windows/test/capture_controller_test.cpp | 10 +- .../file_selector_windows/CHANGELOG.md | 3 +- .../lib/file_selector_windows.dart | 6 - .../lib/src/messages.g.dart | 154 +++++++++++------- .../file_selector_windows/pubspec.yaml | 4 +- .../test/file_selector_windows_test.dart | 2 +- .../test/test_api.g.dart | 91 +++++++---- .../windows/messages.g.cpp | 85 ++++++---- .../windows/messages.g.h | 19 ++- .../local_auth_windows/CHANGELOG.md | 3 +- .../lib/src/messages.g.dart | 97 ++++++----- .../local_auth_windows/pubspec.yaml | 4 +- .../local_auth_windows/windows/messages.g.cpp | 53 ++++-- .../local_auth_windows/windows/messages.g.h | 21 ++- .../url_launcher_windows/CHANGELOG.md | 3 +- .../lib/src/messages.g.dart | 109 +++++++------ .../url_launcher_windows/pubspec.yaml | 4 +- .../windows/messages.g.cpp | 51 ++++-- .../url_launcher_windows/windows/messages.g.h | 21 ++- 27 files changed, 499 insertions(+), 293 deletions(-) diff --git a/packages/camera/camera_windows/CHANGELOG.md b/packages/camera/camera_windows/CHANGELOG.md index 4b164343ecd6..47b54208fa80 100644 --- a/packages/camera/camera_windows/CHANGELOG.md +++ b/packages/camera/camera_windows/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.4+1 + +* Updates to pigeon 21. + ## 0.2.4 * Removes `maxVideoDuration`/`maxDuration`, as the feature was never exposed at diff --git a/packages/camera/camera_windows/lib/src/messages.g.dart b/packages/camera/camera_windows/lib/src/messages.g.dart index a522461b584e..deb0bcb3e5bd 100644 --- a/packages/camera/camera_windows/lib/src/messages.g.dart +++ b/packages/camera/camera_windows/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 (v20.0.2), do not edit directly. +// Autogenerated from Pigeon (v21.0.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 diff --git a/packages/camera/camera_windows/pubspec.yaml b/packages/camera/camera_windows/pubspec.yaml index 7e3f7381b4b0..703c46bcb7db 100644 --- a/packages/camera/camera_windows/pubspec.yaml +++ b/packages/camera/camera_windows/pubspec.yaml @@ -2,7 +2,7 @@ name: camera_windows description: A Flutter plugin for getting information about and controlling the camera on Windows. repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_windows issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 -version: 0.2.4 +version: 0.2.4+1 environment: sdk: ^3.2.0 @@ -29,7 +29,7 @@ dev_dependencies: flutter_test: sdk: flutter mockito: 5.4.4 - pigeon: ^20.0.0 + pigeon: ^21.0.0 topics: - camera diff --git a/packages/camera/camera_windows/windows/capture_controller.cpp b/packages/camera/camera_windows/windows/capture_controller.cpp index de1aa55f4a1e..25ff7239150c 100644 --- a/packages/camera/camera_windows/windows/capture_controller.cpp +++ b/packages/camera/camera_windows/windows/capture_controller.cpp @@ -35,7 +35,7 @@ CaptureControllerImpl::CaptureControllerImpl( CaptureControllerListener* listener) : capture_controller_listener_(listener), media_settings_( - PlatformMediaSettings(PlatformResolutionPreset::max, true)), + PlatformMediaSettings(PlatformResolutionPreset::kMax, true)), CaptureController(){}; CaptureControllerImpl::~CaptureControllerImpl() { @@ -381,17 +381,17 @@ void CaptureControllerImpl::TakePicture(const std::string& file_path) { uint32_t CaptureControllerImpl::GetMaxPreviewHeight() const { switch (media_settings_.resolution_preset()) { - case PlatformResolutionPreset::low: + case PlatformResolutionPreset::kLow: return 240; - case PlatformResolutionPreset::medium: + case PlatformResolutionPreset::kMedium: return 480; - case PlatformResolutionPreset::high: + case PlatformResolutionPreset::kHigh: return 720; - case PlatformResolutionPreset::veryHigh: + case PlatformResolutionPreset::kVeryHigh: return 1080; - case PlatformResolutionPreset::ultraHigh: + case PlatformResolutionPreset::kUltraHigh: return 2160; - case PlatformResolutionPreset::max: + case PlatformResolutionPreset::kMax: default: // no limit. return 0xffffffff; diff --git a/packages/camera/camera_windows/windows/messages.g.cpp b/packages/camera/camera_windows/windows/messages.g.cpp index bf8020b8386a..c810587a710e 100644 --- a/packages/camera/camera_windows/windows/messages.g.cpp +++ b/packages/camera/camera_windows/windows/messages.g.cpp @@ -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 (v20.0.2), do not edit directly. +// Autogenerated from Pigeon (v21.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #undef _HAS_EXCEPTIONS diff --git a/packages/camera/camera_windows/windows/messages.g.h b/packages/camera/camera_windows/windows/messages.g.h index c20b1bd91afd..0397cd80298a 100644 --- a/packages/camera/camera_windows/windows/messages.g.h +++ b/packages/camera/camera_windows/windows/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 (v20.0.2), do not edit directly. +// Autogenerated from Pigeon (v21.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #ifndef PIGEON_MESSAGES_G_H_ @@ -60,12 +60,12 @@ class ErrorOr { // Pigeon version of platform interface's ResolutionPreset. enum class PlatformResolutionPreset { - low = 0, - medium = 1, - high = 2, - veryHigh = 3, - ultraHigh = 4, - max = 5 + kLow = 0, + kMedium = 1, + kHigh = 2, + kVeryHigh = 3, + kUltraHigh = 4, + kMax = 5 }; // Pigeon version of MediaSettings. diff --git a/packages/camera/camera_windows/windows/test/camera_plugin_test.cpp b/packages/camera/camera_windows/windows/test/camera_plugin_test.cpp index 412c46bf8c2a..2680ae26c0e3 100644 --- a/packages/camera/camera_windows/windows/test/camera_plugin_test.cpp +++ b/packages/camera/camera_windows/windows/test/camera_plugin_test.cpp @@ -142,7 +142,7 @@ TEST(CameraPlugin, CreateHandlerCallsInitCamera) { }; plugin.Create(MOCK_CAMERA_NAME, - PlatformMediaSettings(PlatformResolutionPreset::max, true), + PlatformMediaSettings(PlatformResolutionPreset::kMax, true), std::move(create_result)); EXPECT_TRUE(result_called); @@ -168,7 +168,7 @@ TEST(CameraPlugin, CreateHandlerErrorOnInvalidDeviceId) { }; plugin.Create(MOCK_INVALID_CAMERA_NAME, - PlatformMediaSettings(PlatformResolutionPreset::max, true), + PlatformMediaSettings(PlatformResolutionPreset::kMax, true), std::move(create_result)); EXPECT_TRUE(result_called); @@ -204,7 +204,7 @@ TEST(CameraPlugin, CreateHandlerErrorOnExistingDeviceId) { EXPECT_EQ(reply.value(), 1); }; - PlatformMediaSettings media_settings(PlatformResolutionPreset::max, true); + PlatformMediaSettings media_settings(PlatformResolutionPreset::kMax, true); plugin.Create(MOCK_CAMERA_NAME, media_settings, std::move(first_create_result)); @@ -263,7 +263,7 @@ TEST(CameraPlugin, CreateHandlerAllowsRetry) { EXPECT_TRUE(reply.has_error()); }; - PlatformMediaSettings media_settings(PlatformResolutionPreset::max, true); + PlatformMediaSettings media_settings(PlatformResolutionPreset::kMax, true); plugin.Create(MOCK_CAMERA_NAME, media_settings, std::move(first_create_result)); diff --git a/packages/camera/camera_windows/windows/test/camera_test.cpp b/packages/camera/camera_windows/windows/test/camera_test.cpp index c5b5a5c97fd5..3aa199345c21 100644 --- a/packages/camera/camera_windows/windows/test/camera_test.cpp +++ b/packages/camera/camera_windows/windows/test/camera_test.cpp @@ -49,7 +49,7 @@ TEST(Camera, InitCameraCreatesCaptureController) { EXPECT_TRUE(camera->GetCaptureController() == nullptr); - PlatformMediaSettings media_settings(PlatformResolutionPreset::max, false); + PlatformMediaSettings media_settings(PlatformResolutionPreset::kMax, false); // Init camera with mock capture controller factory bool result = camera->InitCamera( @@ -81,7 +81,7 @@ TEST(Camera, InitCameraReportsFailure) { EXPECT_TRUE(camera->GetCaptureController() == nullptr); - PlatformMediaSettings media_settings(PlatformResolutionPreset::max, false); + PlatformMediaSettings media_settings(PlatformResolutionPreset::kMax, false); // Init camera with mock capture controller factory bool result = camera->InitCamera( diff --git a/packages/camera/camera_windows/windows/test/capture_controller_test.cpp b/packages/camera/camera_windows/windows/test/capture_controller_test.cpp index 3d0087b0403a..aa0b5469b851 100644 --- a/packages/camera/camera_windows/windows/test/capture_controller_test.cpp +++ b/packages/camera/camera_windows/windows/test/capture_controller_test.cpp @@ -34,7 +34,7 @@ void MockInitCaptureController( MockTextureRegistrar* texture_registrar, MockCaptureEngine* engine, MockCamera* camera, int64_t mock_texture_id, const PlatformMediaSettings media_settings = - PlatformMediaSettings(PlatformResolutionPreset::max, true)) { + PlatformMediaSettings(PlatformResolutionPreset::kMax, true)) { ComPtr video_source = new MockMediaSource(); ComPtr audio_source = new MockMediaSource(); @@ -261,7 +261,7 @@ TEST(CaptureController, InitCaptureEngineCanOnlyBeCalledOnce) { bool result = capture_controller->InitCaptureDevice( texture_registrar.get(), MOCK_DEVICE_ID, - PlatformMediaSettings(PlatformResolutionPreset::max, true)); + PlatformMediaSettings(PlatformResolutionPreset::kMax, true)); EXPECT_FALSE(result); @@ -303,7 +303,7 @@ TEST(CaptureController, InitCaptureEngineReportsFailure) { bool result = capture_controller->InitCaptureDevice( texture_registrar.get(), MOCK_DEVICE_ID, - PlatformMediaSettings(PlatformResolutionPreset::max, true)); + PlatformMediaSettings(PlatformResolutionPreset::kMax, true)); EXPECT_FALSE(result); EXPECT_FALSE(engine->initialized_); @@ -348,7 +348,7 @@ TEST(CaptureController, InitCaptureEngineReportsAccessDenied) { bool result = capture_controller->InitCaptureDevice( texture_registrar.get(), MOCK_DEVICE_ID, - PlatformMediaSettings(PlatformResolutionPreset::max, true)); + PlatformMediaSettings(PlatformResolutionPreset::kMax, true)); EXPECT_FALSE(result); EXPECT_FALSE(engine->initialized_); @@ -734,7 +734,7 @@ TEST(CaptureController, StartRecordWithSettingsSuccess) { const auto kVideoBitrate = 200000; const auto kAudioBitrate = 32000; - PlatformMediaSettings media_settings(PlatformResolutionPreset::max, true); + PlatformMediaSettings media_settings(PlatformResolutionPreset::kMax, true); media_settings.set_frames_per_second(kFps); media_settings.set_video_bitrate(kVideoBitrate); media_settings.set_audio_bitrate(kAudioBitrate); diff --git a/packages/file_selector/file_selector_windows/CHANGELOG.md b/packages/file_selector/file_selector_windows/CHANGELOG.md index 7d50124560ae..d6e52874d0f3 100644 --- a/packages/file_selector/file_selector_windows/CHANGELOG.md +++ b/packages/file_selector/file_selector_windows/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 0.9.3+2 +* Updates to pigeon 21. * Updates minimum supported SDK version to Flutter 3.16/Dart 3.2. ## 0.9.3+1 diff --git a/packages/file_selector/file_selector_windows/lib/file_selector_windows.dart b/packages/file_selector/file_selector_windows/lib/file_selector_windows.dart index b96886bd0df6..96f53b6ca0f7 100644 --- a/packages/file_selector/file_selector_windows/lib/file_selector_windows.dart +++ b/packages/file_selector/file_selector_windows/lib/file_selector_windows.dart @@ -23,8 +23,6 @@ class FileSelectorWindows extends FileSelectorPlatform { }) async { final FileDialogResult result = await _hostApi.showOpenDialog( SelectionOptions( - allowMultiple: false, - selectFolders: false, allowedTypes: _typeGroupsFromXTypeGroups(acceptedTypeGroups), ), initialDirectory, @@ -41,7 +39,6 @@ class FileSelectorWindows extends FileSelectorPlatform { final FileDialogResult result = await _hostApi.showOpenDialog( SelectionOptions( allowMultiple: true, - selectFolders: false, allowedTypes: _typeGroupsFromXTypeGroups(acceptedTypeGroups), ), initialDirectory, @@ -73,8 +70,6 @@ class FileSelectorWindows extends FileSelectorPlatform { }) async { final FileDialogResult result = await _hostApi.showSaveDialog( SelectionOptions( - allowMultiple: false, - selectFolders: false, allowedTypes: _typeGroupsFromXTypeGroups(acceptedTypeGroups), ), options.initialDirectory, @@ -95,7 +90,6 @@ class FileSelectorWindows extends FileSelectorPlatform { }) async { final FileDialogResult result = await _hostApi.showOpenDialog( SelectionOptions( - allowMultiple: false, selectFolders: true, allowedTypes: [], ), diff --git a/packages/file_selector/file_selector_windows/lib/src/messages.g.dart b/packages/file_selector/file_selector_windows/lib/src/messages.g.dart index b5b4a7943888..12f57b1969e4 100644 --- a/packages/file_selector/file_selector_windows/lib/src/messages.g.dart +++ b/packages/file_selector/file_selector_windows/lib/src/messages.g.dart @@ -1,9 +1,9 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v10.0.1), do not edit directly. +// Autogenerated from Pigeon (v21.0.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 +// 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 import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; @@ -11,6 +11,24 @@ import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; +PlatformException _createConnectionError(String channelName) { + return PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); +} + +List wrapResponse( + {Object? result, PlatformException? error, bool empty = false}) { + if (empty) { + return []; + } + if (error == null) { + return [result]; + } + return [error.code, error.message, error.details]; +} + class TypeGroup { TypeGroup({ required this.label, @@ -39,9 +57,9 @@ class TypeGroup { class SelectionOptions { SelectionOptions({ - required this.allowMultiple, - required this.selectFolders, - required this.allowedTypes, + this.allowMultiple = false, + this.selectFolders = false, + this.allowedTypes = const [], }); bool allowMultiple; @@ -102,19 +120,19 @@ class FileDialogResult { } } -class _FileSelectorApiCodec extends StandardMessageCodec { - const _FileSelectorApiCodec(); +class _PigeonCodec extends StandardMessageCodec { + const _PigeonCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is FileDialogResult) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else if (value is SelectionOptions) { + if (value is TypeGroup) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is TypeGroup) { + } else if (value is SelectionOptions) { buffer.putUint8(130); writeValue(buffer, value.encode()); + } else if (value is FileDialogResult) { + buffer.putUint8(131); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -123,12 +141,12 @@ class _FileSelectorApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: - return FileDialogResult.decode(readValue(buffer)!); case 129: - return SelectionOptions.decode(readValue(buffer)!); - case 130: return TypeGroup.decode(readValue(buffer)!); + case 130: + return SelectionOptions.decode(readValue(buffer)!); + case 131: + return FileDialogResult.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -139,73 +157,83 @@ class FileSelectorApi { /// Constructor for [FileSelectorApi]. 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. - FileSelectorApi({BinaryMessenger? binaryMessenger}) - : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; - - static const MessageCodec codec = _FileSelectorApiCodec(); - - Future showOpenDialog(SelectionOptions arg_options, - String? arg_initialDirectory, String? arg_confirmButtonText) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FileSelectorApi.showOpenDialog', codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send( - [arg_options, arg_initialDirectory, arg_confirmButtonText]) + FileSelectorApi( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : __pigeon_binaryMessenger = binaryMessenger, + __pigeon_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + final BinaryMessenger? __pigeon_binaryMessenger; + + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); + + final String __pigeon_messageChannelSuffix; + + Future showOpenDialog(SelectionOptions options, + String? initialDirectory, String? confirmButtonText) async { + final String __pigeon_channelName = + 'dev.flutter.pigeon.file_selector_windows.FileSelectorApi.showOpenDialog$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( + __pigeon_channelName, + pigeonChannelCodec, + binaryMessenger: __pigeon_binaryMessenger, + ); + final List? __pigeon_replyList = await __pigeon_channel + .send([options, initialDirectory, confirmButtonText]) as List?; - if (replyList == null) { + if (__pigeon_replyList == null) { + throw _createConnectionError(__pigeon_channelName); + } else if (__pigeon_replyList.length > 1) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', + code: __pigeon_replyList[0]! as String, + message: __pigeon_replyList[1] as String?, + details: __pigeon_replyList[2], ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else if (replyList[0] == null) { + } else if (__pigeon_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyList[0] as FileDialogResult?)!; + return (__pigeon_replyList[0] as FileDialogResult?)!; } } Future showSaveDialog( - SelectionOptions arg_options, - String? arg_initialDirectory, - String? arg_suggestedName, - String? arg_confirmButtonText) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FileSelectorApi.showSaveDialog', codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send([ - arg_options, - arg_initialDirectory, - arg_suggestedName, - arg_confirmButtonText + SelectionOptions options, + String? initialDirectory, + String? suggestedName, + String? confirmButtonText) async { + final String __pigeon_channelName = + 'dev.flutter.pigeon.file_selector_windows.FileSelectorApi.showSaveDialog$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( + __pigeon_channelName, + pigeonChannelCodec, + binaryMessenger: __pigeon_binaryMessenger, + ); + final List? __pigeon_replyList = await __pigeon_channel + .send([ + options, + initialDirectory, + suggestedName, + confirmButtonText ]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + if (__pigeon_replyList == null) { + throw _createConnectionError(__pigeon_channelName); + } else if (__pigeon_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: __pigeon_replyList[0]! as String, + message: __pigeon_replyList[1] as String?, + details: __pigeon_replyList[2], ); - } else if (replyList[0] == null) { + } else if (__pigeon_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyList[0] as FileDialogResult?)!; + return (__pigeon_replyList[0] as FileDialogResult?)!; } } } diff --git a/packages/file_selector/file_selector_windows/pubspec.yaml b/packages/file_selector/file_selector_windows/pubspec.yaml index 93159d888fd1..385c63a9f00d 100644 --- a/packages/file_selector/file_selector_windows/pubspec.yaml +++ b/packages/file_selector/file_selector_windows/pubspec.yaml @@ -2,7 +2,7 @@ name: file_selector_windows description: Windows implementation of the file_selector plugin. repository: https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_windows issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+file_selector%22 -version: 0.9.3+1 +version: 0.9.3+2 environment: sdk: ^3.2.0 @@ -27,7 +27,7 @@ dev_dependencies: flutter_test: sdk: flutter mockito: 5.4.4 - pigeon: ^10.0.0 + pigeon: ^21.0.0 topics: - files diff --git a/packages/file_selector/file_selector_windows/test/file_selector_windows_test.dart b/packages/file_selector/file_selector_windows/test/file_selector_windows_test.dart index 4f455ee3088b..4d67562f03cd 100644 --- a/packages/file_selector/file_selector_windows/test/file_selector_windows_test.dart +++ b/packages/file_selector/file_selector_windows/test/file_selector_windows_test.dart @@ -22,7 +22,7 @@ void main() { setUp(() { mockApi = MockTestFileSelectorApi(); - TestFileSelectorApi.setup(mockApi); + TestFileSelectorApi.setUp(mockApi); }); test('registered instance', () { diff --git a/packages/file_selector/file_selector_windows/test/test_api.g.dart b/packages/file_selector/file_selector_windows/test/test_api.g.dart index 778ae4fc16c3..2f9cabdef2df 100644 --- a/packages/file_selector/file_selector_windows/test/test_api.g.dart +++ b/packages/file_selector/file_selector_windows/test/test_api.g.dart @@ -1,9 +1,9 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v10.0.1), do not edit directly. +// Autogenerated from Pigeon (v21.0.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, unnecessary_import +// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import, no_leading_underscores_for_local_identifiers // ignore_for_file: avoid_relative_lib_imports import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; @@ -13,19 +13,19 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:file_selector_windows/src/messages.g.dart'; -class _TestFileSelectorApiCodec extends StandardMessageCodec { - const _TestFileSelectorApiCodec(); +class _PigeonCodec extends StandardMessageCodec { + const _PigeonCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is FileDialogResult) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else if (value is SelectionOptions) { + if (value is TypeGroup) { buffer.putUint8(129); writeValue(buffer, value.encode()); - } else if (value is TypeGroup) { + } else if (value is SelectionOptions) { buffer.putUint8(130); writeValue(buffer, value.encode()); + } else if (value is FileDialogResult) { + buffer.putUint8(131); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -34,12 +34,12 @@ class _TestFileSelectorApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: - return FileDialogResult.decode(readValue(buffer)!); case 129: - return SelectionOptions.decode(readValue(buffer)!); - case 130: return TypeGroup.decode(readValue(buffer)!); + case 130: + return SelectionOptions.decode(readValue(buffer)!); + case 131: + return FileDialogResult.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -49,7 +49,7 @@ class _TestFileSelectorApiCodec extends StandardMessageCodec { abstract class TestFileSelectorApi { static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; - static const MessageCodec codec = _TestFileSelectorApiCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); FileDialogResult showOpenDialog(SelectionOptions options, String? initialDirectory, String? confirmButtonText); @@ -60,56 +60,79 @@ abstract class TestFileSelectorApi { String? suggestedName, String? confirmButtonText); - static void setup(TestFileSelectorApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setUp( + TestFileSelectorApi? api, { + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) { + messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FileSelectorApi.showOpenDialog', codec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.file_selector_windows.FileSelectorApi.showOpenDialog$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + .setMockDecodedMessageHandler(__pigeon_channel, null); } else { _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, + .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FileSelectorApi.showOpenDialog was null.'); + 'Argument for dev.flutter.pigeon.file_selector_windows.FileSelectorApi.showOpenDialog was null.'); final List args = (message as List?)!; final SelectionOptions? arg_options = (args[0] as SelectionOptions?); assert(arg_options != null, - 'Argument for dev.flutter.pigeon.FileSelectorApi.showOpenDialog was null, expected non-null SelectionOptions.'); + 'Argument for dev.flutter.pigeon.file_selector_windows.FileSelectorApi.showOpenDialog was null, expected non-null SelectionOptions.'); final String? arg_initialDirectory = (args[1] as String?); final String? arg_confirmButtonText = (args[2] as String?); - final FileDialogResult output = api.showOpenDialog( - arg_options!, arg_initialDirectory, arg_confirmButtonText); - return [output]; + try { + final FileDialogResult output = api.showOpenDialog( + arg_options!, arg_initialDirectory, arg_confirmButtonText); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FileSelectorApi.showSaveDialog', codec, + final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.file_selector_windows.FileSelectorApi.showSaveDialog$messageChannelSuffix', + pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + .setMockDecodedMessageHandler(__pigeon_channel, null); } else { _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, + .setMockDecodedMessageHandler(__pigeon_channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FileSelectorApi.showSaveDialog was null.'); + 'Argument for dev.flutter.pigeon.file_selector_windows.FileSelectorApi.showSaveDialog was null.'); final List args = (message as List?)!; final SelectionOptions? arg_options = (args[0] as SelectionOptions?); assert(arg_options != null, - 'Argument for dev.flutter.pigeon.FileSelectorApi.showSaveDialog was null, expected non-null SelectionOptions.'); + 'Argument for dev.flutter.pigeon.file_selector_windows.FileSelectorApi.showSaveDialog was null, expected non-null SelectionOptions.'); final String? arg_initialDirectory = (args[1] as String?); final String? arg_suggestedName = (args[2] as String?); final String? arg_confirmButtonText = (args[3] as String?); - final FileDialogResult output = api.showSaveDialog(arg_options!, - arg_initialDirectory, arg_suggestedName, arg_confirmButtonText); - return [output]; + try { + final FileDialogResult output = api.showSaveDialog(arg_options!, + arg_initialDirectory, arg_suggestedName, arg_confirmButtonText); + return [output]; + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } }); } } diff --git a/packages/file_selector/file_selector_windows/windows/messages.g.cpp b/packages/file_selector/file_selector_windows/windows/messages.g.cpp index a60fd92a974c..fc145c6740f1 100644 --- a/packages/file_selector/file_selector_windows/windows/messages.g.cpp +++ b/packages/file_selector/file_selector_windows/windows/messages.g.cpp @@ -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 (v10.0.1), do not edit directly. +// Autogenerated from Pigeon (v21.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #undef _HAS_EXCEPTIONS @@ -24,6 +24,13 @@ using flutter::EncodableList; using flutter::EncodableMap; using flutter::EncodableValue; +FlutterError CreateConnectionError(const std::string channel_name) { + return FlutterError( + "channel-error", + "Unable to establish connection on channel: '" + channel_name + "'.", + EncodableValue("")); +} + // TypeGroup TypeGroup::TypeGroup(const std::string& label, const EncodableList& extensions) @@ -147,50 +154,50 @@ FileDialogResult FileDialogResult::FromEncodableList( return decoded; } -FileSelectorApiCodecSerializer::FileSelectorApiCodecSerializer() {} +PigeonCodecSerializer::PigeonCodecSerializer() {} -EncodableValue FileSelectorApiCodecSerializer::ReadValueOfType( +EncodableValue PigeonCodecSerializer::ReadValueOfType( uint8_t type, flutter::ByteStreamReader* stream) const { switch (type) { - case 128: - return CustomEncodableValue(FileDialogResult::FromEncodableList( - std::get(ReadValue(stream)))); case 129: - return CustomEncodableValue(SelectionOptions::FromEncodableList( + return CustomEncodableValue(TypeGroup::FromEncodableList( std::get(ReadValue(stream)))); case 130: - return CustomEncodableValue(TypeGroup::FromEncodableList( + return CustomEncodableValue(SelectionOptions::FromEncodableList( + std::get(ReadValue(stream)))); + case 131: + return CustomEncodableValue(FileDialogResult::FromEncodableList( std::get(ReadValue(stream)))); default: return flutter::StandardCodecSerializer::ReadValueOfType(type, stream); } } -void FileSelectorApiCodecSerializer::WriteValue( +void PigeonCodecSerializer::WriteValue( const EncodableValue& value, flutter::ByteStreamWriter* stream) const { if (const CustomEncodableValue* custom_value = std::get_if(&value)) { - if (custom_value->type() == typeid(FileDialogResult)) { - stream->WriteByte(128); - WriteValue( - EncodableValue( - std::any_cast(*custom_value).ToEncodableList()), - stream); + if (custom_value->type() == typeid(TypeGroup)) { + stream->WriteByte(129); + WriteValue(EncodableValue( + std::any_cast(*custom_value).ToEncodableList()), + stream); return; } if (custom_value->type() == typeid(SelectionOptions)) { - stream->WriteByte(129); + stream->WriteByte(130); WriteValue( EncodableValue( std::any_cast(*custom_value).ToEncodableList()), stream); return; } - if (custom_value->type() == typeid(TypeGroup)) { - stream->WriteByte(130); - WriteValue(EncodableValue( - std::any_cast(*custom_value).ToEncodableList()), - stream); + if (custom_value->type() == typeid(FileDialogResult)) { + stream->WriteByte(131); + WriteValue( + EncodableValue( + std::any_cast(*custom_value).ToEncodableList()), + stream); return; } } @@ -200,19 +207,31 @@ void FileSelectorApiCodecSerializer::WriteValue( /// The codec used by FileSelectorApi. const flutter::StandardMessageCodec& FileSelectorApi::GetCodec() { return flutter::StandardMessageCodec::GetInstance( - &FileSelectorApiCodecSerializer::GetInstance()); + &PigeonCodecSerializer::GetInstance()); } // Sets up an instance of `FileSelectorApi` to handle messages through the // `binary_messenger`. void FileSelectorApi::SetUp(flutter::BinaryMessenger* binary_messenger, FileSelectorApi* api) { + FileSelectorApi::SetUp(binary_messenger, api, ""); +} + +void FileSelectorApi::SetUp(flutter::BinaryMessenger* binary_messenger, + FileSelectorApi* api, + const std::string& message_channel_suffix) { + const std::string prepended_suffix = + message_channel_suffix.length() > 0 + ? std::string(".") + message_channel_suffix + : ""; { - auto channel = std::make_unique>( - binary_messenger, "dev.flutter.pigeon.FileSelectorApi.showOpenDialog", - &GetCodec()); + BasicMessageChannel<> channel(binary_messenger, + "dev.flutter.pigeon.file_selector_windows." + "FileSelectorApi.showOpenDialog" + + prepended_suffix, + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler( + channel.SetMessageHandler( [api](const EncodableValue& message, const flutter::MessageReply& reply) { try { @@ -245,15 +264,17 @@ void FileSelectorApi::SetUp(flutter::BinaryMessenger* binary_messenger, } }); } else { - channel->SetMessageHandler(nullptr); + channel.SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>( - binary_messenger, "dev.flutter.pigeon.FileSelectorApi.showSaveDialog", - &GetCodec()); + BasicMessageChannel<> channel(binary_messenger, + "dev.flutter.pigeon.file_selector_windows." + "FileSelectorApi.showSaveDialog" + + prepended_suffix, + &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler( + channel.SetMessageHandler( [api](const EncodableValue& message, const flutter::MessageReply& reply) { try { @@ -290,7 +311,7 @@ void FileSelectorApi::SetUp(flutter::BinaryMessenger* binary_messenger, } }); } else { - channel->SetMessageHandler(nullptr); + channel.SetMessageHandler(nullptr); } } } diff --git a/packages/file_selector/file_selector_windows/windows/messages.g.h b/packages/file_selector/file_selector_windows/windows/messages.g.h index ab8afd7d703b..43f671480501 100644 --- a/packages/file_selector/file_selector_windows/windows/messages.g.h +++ b/packages/file_selector/file_selector_windows/windows/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 (v10.0.1), do not edit directly. +// Autogenerated from Pigeon (v21.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #ifndef PIGEON_MESSAGES_G_H_ @@ -75,7 +75,7 @@ class TypeGroup { static TypeGroup FromEncodableList(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; friend class FileSelectorApi; - friend class FileSelectorApiCodecSerializer; + friend class PigeonCodecSerializer; std::string label_; flutter::EncodableList extensions_; }; @@ -100,7 +100,7 @@ class SelectionOptions { static SelectionOptions FromEncodableList(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; friend class FileSelectorApi; - friend class FileSelectorApiCodecSerializer; + friend class PigeonCodecSerializer; bool allow_multiple_; bool select_folders_; flutter::EncodableList allowed_types_; @@ -136,16 +136,16 @@ class FileDialogResult { static FileDialogResult FromEncodableList(const flutter::EncodableList& list); flutter::EncodableList ToEncodableList() const; friend class FileSelectorApi; - friend class FileSelectorApiCodecSerializer; + friend class PigeonCodecSerializer; flutter::EncodableList paths_; std::optional type_group_index_; }; -class FileSelectorApiCodecSerializer : public flutter::StandardCodecSerializer { +class PigeonCodecSerializer : public flutter::StandardCodecSerializer { public: - FileSelectorApiCodecSerializer(); - inline static FileSelectorApiCodecSerializer& GetInstance() { - static FileSelectorApiCodecSerializer sInstance; + PigeonCodecSerializer(); + inline static PigeonCodecSerializer& GetInstance() { + static PigeonCodecSerializer sInstance; return sInstance; } @@ -178,6 +178,9 @@ class FileSelectorApi { // `binary_messenger`. static void SetUp(flutter::BinaryMessenger* binary_messenger, FileSelectorApi* api); + static void SetUp(flutter::BinaryMessenger* binary_messenger, + FileSelectorApi* api, + const std::string& message_channel_suffix); static flutter::EncodableValue WrapError(std::string_view error_message); static flutter::EncodableValue WrapError(const FlutterError& error); diff --git a/packages/local_auth/local_auth_windows/CHANGELOG.md b/packages/local_auth/local_auth_windows/CHANGELOG.md index 46d66bac3615..321e78c0fb25 100644 --- a/packages/local_auth/local_auth_windows/CHANGELOG.md +++ b/packages/local_auth/local_auth_windows/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 1.0.11 +* Updates to pigeon 21. * Updates minimum supported SDK version to Flutter 3.16/Dart 3.2. ## 1.0.10 diff --git a/packages/local_auth/local_auth_windows/lib/src/messages.g.dart b/packages/local_auth/local_auth_windows/lib/src/messages.g.dart index f303a0803c32..e1c45ef20c5d 100644 --- a/packages/local_auth/local_auth_windows/lib/src/messages.g.dart +++ b/packages/local_auth/local_auth_windows/lib/src/messages.g.dart @@ -1,9 +1,9 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v10.1.2), do not edit directly. +// Autogenerated from Pigeon (v21.0.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 +// 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 import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; @@ -11,40 +11,59 @@ import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; +PlatformException _createConnectionError(String channelName) { + return PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); +} + +class _PigeonCodec extends StandardMessageCodec { + const _PigeonCodec(); +} + class LocalAuthApi { /// Constructor for [LocalAuthApi]. 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. - LocalAuthApi({BinaryMessenger? binaryMessenger}) - : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; + LocalAuthApi( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : __pigeon_binaryMessenger = binaryMessenger, + __pigeon_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + final BinaryMessenger? __pigeon_binaryMessenger; + + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - static const MessageCodec codec = StandardMessageCodec(); + final String __pigeon_messageChannelSuffix; /// Returns true if this device supports authentication. Future isDeviceSupported() async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.LocalAuthApi.isDeviceSupported', codec, - binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; - if (replyList == null) { + final String __pigeon_channelName = + 'dev.flutter.pigeon.local_auth_windows.LocalAuthApi.isDeviceSupported$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( + __pigeon_channelName, + pigeonChannelCodec, + binaryMessenger: __pigeon_binaryMessenger, + ); + final List? __pigeon_replyList = + await __pigeon_channel.send(null) as List?; + if (__pigeon_replyList == null) { + throw _createConnectionError(__pigeon_channelName); + } else if (__pigeon_replyList.length > 1) { throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', + code: __pigeon_replyList[0]! as String, + message: __pigeon_replyList[1] as String?, + details: __pigeon_replyList[2], ); - } else if (replyList.length > 1) { - throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], - ); - } else if (replyList[0] == null) { + } else if (__pigeon_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyList[0] as bool?)!; + return (__pigeon_replyList[0] as bool?)!; } } @@ -53,30 +72,32 @@ class LocalAuthApi { /// /// Returns true if authorization succeeds, false if it is attempted but is /// not successful, and an error if authorization could not be attempted. - Future authenticate(String arg_localizedReason) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.LocalAuthApi.authenticate', codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_localizedReason]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + Future authenticate(String localizedReason) async { + final String __pigeon_channelName = + 'dev.flutter.pigeon.local_auth_windows.LocalAuthApi.authenticate$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( + __pigeon_channelName, + pigeonChannelCodec, + binaryMessenger: __pigeon_binaryMessenger, + ); + final List? __pigeon_replyList = await __pigeon_channel + .send([localizedReason]) as List?; + if (__pigeon_replyList == null) { + throw _createConnectionError(__pigeon_channelName); + } else if (__pigeon_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: __pigeon_replyList[0]! as String, + message: __pigeon_replyList[1] as String?, + details: __pigeon_replyList[2], ); - } else if (replyList[0] == null) { + } else if (__pigeon_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyList[0] as bool?)!; + return (__pigeon_replyList[0] as bool?)!; } } } diff --git a/packages/local_auth/local_auth_windows/pubspec.yaml b/packages/local_auth/local_auth_windows/pubspec.yaml index 52a4240fa8a1..b275c09158f6 100644 --- a/packages/local_auth/local_auth_windows/pubspec.yaml +++ b/packages/local_auth/local_auth_windows/pubspec.yaml @@ -2,7 +2,7 @@ name: local_auth_windows description: Windows implementation of the local_auth plugin. repository: https://github.com/flutter/packages/tree/main/packages/local_auth/local_auth_windows issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+local_auth%22 -version: 1.0.10 +version: 1.0.11 environment: sdk: ^3.2.0 @@ -24,7 +24,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - pigeon: ^10.1.2 + pigeon: ^21.0.0 topics: - authentication diff --git a/packages/local_auth/local_auth_windows/windows/messages.g.cpp b/packages/local_auth/local_auth_windows/windows/messages.g.cpp index 6b771904dd52..ce0f578edfc3 100644 --- a/packages/local_auth/local_auth_windows/windows/messages.g.cpp +++ b/packages/local_auth/local_auth_windows/windows/messages.g.cpp @@ -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 (v10.1.2), do not edit directly. +// Autogenerated from Pigeon (v21.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #undef _HAS_EXCEPTIONS @@ -24,22 +24,53 @@ using flutter::EncodableList; using flutter::EncodableMap; using flutter::EncodableValue; +FlutterError CreateConnectionError(const std::string channel_name) { + return FlutterError( + "channel-error", + "Unable to establish connection on channel: '" + channel_name + "'.", + EncodableValue("")); +} + +PigeonCodecSerializer::PigeonCodecSerializer() {} + +EncodableValue PigeonCodecSerializer::ReadValueOfType( + uint8_t type, flutter::ByteStreamReader* stream) const { + return flutter::StandardCodecSerializer::ReadValueOfType(type, stream); +} + +void PigeonCodecSerializer::WriteValue( + const EncodableValue& value, flutter::ByteStreamWriter* stream) const { + flutter::StandardCodecSerializer::WriteValue(value, stream); +} + /// The codec used by LocalAuthApi. const flutter::StandardMessageCodec& LocalAuthApi::GetCodec() { return flutter::StandardMessageCodec::GetInstance( - &flutter::StandardCodecSerializer::GetInstance()); + &PigeonCodecSerializer::GetInstance()); } // Sets up an instance of `LocalAuthApi` to handle messages through the // `binary_messenger`. void LocalAuthApi::SetUp(flutter::BinaryMessenger* binary_messenger, LocalAuthApi* api) { + LocalAuthApi::SetUp(binary_messenger, api, ""); +} + +void LocalAuthApi::SetUp(flutter::BinaryMessenger* binary_messenger, + LocalAuthApi* api, + const std::string& message_channel_suffix) { + const std::string prepended_suffix = + message_channel_suffix.length() > 0 + ? std::string(".") + message_channel_suffix + : ""; { - auto channel = std::make_unique>( - binary_messenger, "dev.flutter.pigeon.LocalAuthApi.isDeviceSupported", + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.local_auth_windows.LocalAuthApi.isDeviceSupported" + + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler( + channel.SetMessageHandler( [api](const EncodableValue& message, const flutter::MessageReply& reply) { try { @@ -58,15 +89,17 @@ void LocalAuthApi::SetUp(flutter::BinaryMessenger* binary_messenger, } }); } else { - channel->SetMessageHandler(nullptr); + channel.SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>( - binary_messenger, "dev.flutter.pigeon.LocalAuthApi.authenticate", + BasicMessageChannel<> channel( + binary_messenger, + "dev.flutter.pigeon.local_auth_windows.LocalAuthApi.authenticate" + + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler( + channel.SetMessageHandler( [api](const EncodableValue& message, const flutter::MessageReply& reply) { try { @@ -94,7 +127,7 @@ void LocalAuthApi::SetUp(flutter::BinaryMessenger* binary_messenger, } }); } else { - channel->SetMessageHandler(nullptr); + channel.SetMessageHandler(nullptr); } } } diff --git a/packages/local_auth/local_auth_windows/windows/messages.g.h b/packages/local_auth/local_auth_windows/windows/messages.g.h index 60a809514ee4..60d35feec399 100644 --- a/packages/local_auth/local_auth_windows/windows/messages.g.h +++ b/packages/local_auth/local_auth_windows/windows/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 (v10.1.2), do not edit directly. +// Autogenerated from Pigeon (v21.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #ifndef PIGEON_MESSAGES_G_H_ @@ -58,6 +58,22 @@ class ErrorOr { std::variant v_; }; +class PigeonCodecSerializer : public flutter::StandardCodecSerializer { + public: + PigeonCodecSerializer(); + inline static PigeonCodecSerializer& GetInstance() { + static PigeonCodecSerializer sInstance; + return sInstance; + } + + void WriteValue(const flutter::EncodableValue& value, + flutter::ByteStreamWriter* stream) const override; + + protected: + flutter::EncodableValue ReadValueOfType( + uint8_t type, flutter::ByteStreamReader* stream) const override; +}; + // Generated interface from Pigeon that represents a handler of messages from // Flutter. class LocalAuthApi { @@ -83,6 +99,9 @@ class LocalAuthApi { // `binary_messenger`. static void SetUp(flutter::BinaryMessenger* binary_messenger, LocalAuthApi* api); + static void SetUp(flutter::BinaryMessenger* binary_messenger, + LocalAuthApi* api, + const std::string& message_channel_suffix); static flutter::EncodableValue WrapError(std::string_view error_message); static flutter::EncodableValue WrapError(const FlutterError& error); diff --git a/packages/url_launcher/url_launcher_windows/CHANGELOG.md b/packages/url_launcher/url_launcher_windows/CHANGELOG.md index 978a224433d0..6382593e2e52 100644 --- a/packages/url_launcher/url_launcher_windows/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_windows/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 3.1.2 +* Updates to pigeon 21. * Updates minimum supported SDK version to Flutter 3.16/Dart 3.2. ## 3.1.1 diff --git a/packages/url_launcher/url_launcher_windows/lib/src/messages.g.dart b/packages/url_launcher/url_launcher_windows/lib/src/messages.g.dart index 2d84f683abac..f076f3ecc99c 100644 --- a/packages/url_launcher/url_launcher_windows/lib/src/messages.g.dart +++ b/packages/url_launcher/url_launcher_windows/lib/src/messages.g.dart @@ -1,9 +1,9 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v13.0.0), do not edit directly. +// Autogenerated from Pigeon (v21.0.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 +// 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 import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; @@ -11,80 +11,87 @@ import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer; import 'package:flutter/services.dart'; -List wrapResponse( - {Object? result, PlatformException? error, bool empty = false}) { - if (empty) { - return []; - } - if (error == null) { - return [result]; - } - return [error.code, error.message, error.details]; +PlatformException _createConnectionError(String channelName) { + return PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); +} + +class _PigeonCodec extends StandardMessageCodec { + const _PigeonCodec(); } class UrlLauncherApi { /// Constructor for [UrlLauncherApi]. 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. - UrlLauncherApi({BinaryMessenger? binaryMessenger}) - : _binaryMessenger = binaryMessenger; - final BinaryMessenger? _binaryMessenger; + UrlLauncherApi( + {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : __pigeon_binaryMessenger = binaryMessenger, + __pigeon_messageChannelSuffix = + messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; + final BinaryMessenger? __pigeon_binaryMessenger; - static const MessageCodec codec = StandardMessageCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - Future canLaunchUrl(String arg_url) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.url_launcher_windows.UrlLauncherApi.canLaunchUrl', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_url]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + final String __pigeon_messageChannelSuffix; + + Future canLaunchUrl(String url) async { + final String __pigeon_channelName = + 'dev.flutter.pigeon.url_launcher_windows.UrlLauncherApi.canLaunchUrl$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( + __pigeon_channelName, + pigeonChannelCodec, + binaryMessenger: __pigeon_binaryMessenger, + ); + final List? __pigeon_replyList = + await __pigeon_channel.send([url]) as List?; + if (__pigeon_replyList == null) { + throw _createConnectionError(__pigeon_channelName); + } else if (__pigeon_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: __pigeon_replyList[0]! as String, + message: __pigeon_replyList[1] as String?, + details: __pigeon_replyList[2], ); - } else if (replyList[0] == null) { + } else if (__pigeon_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyList[0] as bool?)!; + return (__pigeon_replyList[0] as bool?)!; } } - Future launchUrl(String arg_url) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.url_launcher_windows.UrlLauncherApi.launchUrl', - codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_url]) as List?; - if (replyList == null) { - throw PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel.', - ); - } else if (replyList.length > 1) { + Future launchUrl(String url) async { + final String __pigeon_channelName = + 'dev.flutter.pigeon.url_launcher_windows.UrlLauncherApi.launchUrl$__pigeon_messageChannelSuffix'; + final BasicMessageChannel __pigeon_channel = + BasicMessageChannel( + __pigeon_channelName, + pigeonChannelCodec, + binaryMessenger: __pigeon_binaryMessenger, + ); + final List? __pigeon_replyList = + await __pigeon_channel.send([url]) as List?; + if (__pigeon_replyList == null) { + throw _createConnectionError(__pigeon_channelName); + } else if (__pigeon_replyList.length > 1) { throw PlatformException( - code: replyList[0]! as String, - message: replyList[1] as String?, - details: replyList[2], + code: __pigeon_replyList[0]! as String, + message: __pigeon_replyList[1] as String?, + details: __pigeon_replyList[2], ); - } else if (replyList[0] == null) { + } else if (__pigeon_replyList[0] == null) { throw PlatformException( code: 'null-error', message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyList[0] as bool?)!; + return (__pigeon_replyList[0] as bool?)!; } } } diff --git a/packages/url_launcher/url_launcher_windows/pubspec.yaml b/packages/url_launcher/url_launcher_windows/pubspec.yaml index 214806e482a6..8d22ee96aeda 100644 --- a/packages/url_launcher/url_launcher_windows/pubspec.yaml +++ b/packages/url_launcher/url_launcher_windows/pubspec.yaml @@ -2,7 +2,7 @@ name: url_launcher_windows description: Windows implementation of the url_launcher plugin. repository: https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher_windows issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22 -version: 3.1.1 +version: 3.1.2 environment: sdk: ^3.2.0 @@ -24,7 +24,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - pigeon: ^13.0.0 + pigeon: ^21.0.0 test: ^1.16.3 topics: diff --git a/packages/url_launcher/url_launcher_windows/windows/messages.g.cpp b/packages/url_launcher/url_launcher_windows/windows/messages.g.cpp index 43c6254a2a44..babca59ffecb 100644 --- a/packages/url_launcher/url_launcher_windows/windows/messages.g.cpp +++ b/packages/url_launcher/url_launcher_windows/windows/messages.g.cpp @@ -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 (v13.0.0), do not edit directly. +// Autogenerated from Pigeon (v21.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #undef _HAS_EXCEPTIONS @@ -24,23 +24,53 @@ using flutter::EncodableList; using flutter::EncodableMap; using flutter::EncodableValue; +FlutterError CreateConnectionError(const std::string channel_name) { + return FlutterError( + "channel-error", + "Unable to establish connection on channel: '" + channel_name + "'.", + EncodableValue("")); +} + +PigeonCodecSerializer::PigeonCodecSerializer() {} + +EncodableValue PigeonCodecSerializer::ReadValueOfType( + uint8_t type, flutter::ByteStreamReader* stream) const { + return flutter::StandardCodecSerializer::ReadValueOfType(type, stream); +} + +void PigeonCodecSerializer::WriteValue( + const EncodableValue& value, flutter::ByteStreamWriter* stream) const { + flutter::StandardCodecSerializer::WriteValue(value, stream); +} + /// The codec used by UrlLauncherApi. const flutter::StandardMessageCodec& UrlLauncherApi::GetCodec() { return flutter::StandardMessageCodec::GetInstance( - &flutter::StandardCodecSerializer::GetInstance()); + &PigeonCodecSerializer::GetInstance()); } // Sets up an instance of `UrlLauncherApi` to handle messages through the // `binary_messenger`. void UrlLauncherApi::SetUp(flutter::BinaryMessenger* binary_messenger, UrlLauncherApi* api) { + UrlLauncherApi::SetUp(binary_messenger, api, ""); +} + +void UrlLauncherApi::SetUp(flutter::BinaryMessenger* binary_messenger, + UrlLauncherApi* api, + const std::string& message_channel_suffix) { + const std::string prepended_suffix = + message_channel_suffix.length() > 0 + ? std::string(".") + message_channel_suffix + : ""; { - auto channel = std::make_unique>( + BasicMessageChannel<> channel( binary_messenger, - "dev.flutter.pigeon.url_launcher_windows.UrlLauncherApi.canLaunchUrl", + "dev.flutter.pigeon.url_launcher_windows.UrlLauncherApi.canLaunchUrl" + + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler( + channel.SetMessageHandler( [api](const EncodableValue& message, const flutter::MessageReply& reply) { try { @@ -64,16 +94,17 @@ void UrlLauncherApi::SetUp(flutter::BinaryMessenger* binary_messenger, } }); } else { - channel->SetMessageHandler(nullptr); + channel.SetMessageHandler(nullptr); } } { - auto channel = std::make_unique>( + BasicMessageChannel<> channel( binary_messenger, - "dev.flutter.pigeon.url_launcher_windows.UrlLauncherApi.launchUrl", + "dev.flutter.pigeon.url_launcher_windows.UrlLauncherApi.launchUrl" + + prepended_suffix, &GetCodec()); if (api != nullptr) { - channel->SetMessageHandler( + channel.SetMessageHandler( [api](const EncodableValue& message, const flutter::MessageReply& reply) { try { @@ -97,7 +128,7 @@ void UrlLauncherApi::SetUp(flutter::BinaryMessenger* binary_messenger, } }); } else { - channel->SetMessageHandler(nullptr); + channel.SetMessageHandler(nullptr); } } } diff --git a/packages/url_launcher/url_launcher_windows/windows/messages.g.h b/packages/url_launcher/url_launcher_windows/windows/messages.g.h index f725b019aad0..c940969f9d25 100644 --- a/packages/url_launcher/url_launcher_windows/windows/messages.g.h +++ b/packages/url_launcher/url_launcher_windows/windows/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 (v13.0.0), do not edit directly. +// Autogenerated from Pigeon (v21.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon #ifndef PIGEON_MESSAGES_G_H_ @@ -58,6 +58,22 @@ class ErrorOr { std::variant v_; }; +class PigeonCodecSerializer : public flutter::StandardCodecSerializer { + public: + PigeonCodecSerializer(); + inline static PigeonCodecSerializer& GetInstance() { + static PigeonCodecSerializer sInstance; + return sInstance; + } + + void WriteValue(const flutter::EncodableValue& value, + flutter::ByteStreamWriter* stream) const override; + + protected: + flutter::EncodableValue ReadValueOfType( + uint8_t type, flutter::ByteStreamReader* stream) const override; +}; + // Generated interface from Pigeon that represents a handler of messages from // Flutter. class UrlLauncherApi { @@ -74,6 +90,9 @@ class UrlLauncherApi { // `binary_messenger`. static void SetUp(flutter::BinaryMessenger* binary_messenger, UrlLauncherApi* api); + static void SetUp(flutter::BinaryMessenger* binary_messenger, + UrlLauncherApi* api, + const std::string& message_channel_suffix); static flutter::EncodableValue WrapError(std::string_view error_message); static flutter::EncodableValue WrapError(const FlutterError& error);