diff --git a/.ci.yaml b/.ci.yaml index 44cd7331ba24..aa3aa6502933 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -1043,10 +1043,6 @@ targets: properties: version_file: flutter_master.version target_file: macos_repo_checks.yaml - dependencies: > - [ - {"dependency": "swift_format", "version": "build_id:8797338979890974865"} - ] ### macOS desktop tasks ### # macos-platform_tests builds all the packages on ARM, so this build is run @@ -1116,10 +1112,6 @@ targets: { "CHANNEL": "master" } - dependencies: > - [ - {"dependency": "swift_format", "version": "build_id:8797338979890974865"} - ] - name: Mac_arm64 custom_package_tests stable recipe: packages/packages @@ -1132,10 +1124,6 @@ targets: { "CHANNEL": "stable" } - dependencies: > - [ - {"dependency": "swift_format", "version": "build_id:8797338979890974865"} - ] ### iOS tasks ### # ios_platform_tests builds all the packages on ARM, so this build is run diff --git a/packages/file_selector/file_selector_ios/CHANGELOG.md b/packages/file_selector/file_selector_ios/CHANGELOG.md index 6e4aea69dc48..9bbea7376a47 100644 --- a/packages/file_selector/file_selector_ios/CHANGELOG.md +++ b/packages/file_selector/file_selector_ios/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 0.5.3+2 +* Updates to Pigeon 25.5.0. * Updates minimum supported SDK version to Flutter 3.27/Dart 3.6. ## 0.5.3+1 diff --git a/packages/file_selector/file_selector_ios/ios/file_selector_ios/Sources/file_selector_ios/messages.g.swift b/packages/file_selector/file_selector_ios/ios/file_selector_ios/Sources/file_selector_ios/messages.g.swift index 3d20e5a697b2..70413414bb90 100644 --- a/packages/file_selector/file_selector_ios/ios/file_selector_ios/Sources/file_selector_ios/messages.g.swift +++ b/packages/file_selector/file_selector_ios/ios/file_selector_ios/Sources/file_selector_ios/messages.g.swift @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.4.1), do not edit directly. +// Autogenerated from Pigeon (v25.5.0), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation @@ -18,9 +18,9 @@ import Foundation final class PigeonError: Error { let code: String let message: String? - let details: Any? + let details: Sendable? - init(code: String, message: String?, details: Any?) { + init(code: String, message: String?, details: Sendable?) { self.code = code self.message = message self.details = details @@ -67,8 +67,70 @@ private func nilOrValue(_ value: Any?) -> T? { return value as! T? } +func deepEqualsmessages(_ lhs: Any?, _ rhs: Any?) -> Bool { + let cleanLhs = nilOrValue(lhs) as Any? + let cleanRhs = nilOrValue(rhs) as Any? + switch (cleanLhs, cleanRhs) { + case (nil, nil): + return true + + case (nil, _), (_, nil): + return false + + case is (Void, Void): + return true + + case let (cleanLhsHashable, cleanRhsHashable) as (AnyHashable, AnyHashable): + return cleanLhsHashable == cleanRhsHashable + + case let (cleanLhsArray, cleanRhsArray) as ([Any?], [Any?]): + guard cleanLhsArray.count == cleanRhsArray.count else { return false } + for (index, element) in cleanLhsArray.enumerated() { + if !deepEqualsmessages(element, cleanRhsArray[index]) { + return false + } + } + return true + + case let (cleanLhsDictionary, cleanRhsDictionary) as ([AnyHashable: Any?], [AnyHashable: Any?]): + guard cleanLhsDictionary.count == cleanRhsDictionary.count else { return false } + for (key, cleanLhsValue) in cleanLhsDictionary { + guard cleanRhsDictionary.index(forKey: key) != nil else { return false } + if !deepEqualsmessages(cleanLhsValue, cleanRhsDictionary[key]!) { + return false + } + } + return true + + default: + // Any other type shouldn't be able to be used with pigeon. File an issue if you find this to be untrue. + return false + } +} + +func deepHashmessages(value: Any?, hasher: inout Hasher) { + if let valueList = value as? [AnyHashable] { + for item in valueList { deepHashmessages(value: item, hasher: &hasher) } + return + } + + if let valueDict = value as? [AnyHashable: AnyHashable] { + for key in valueDict.keys { + hasher.combine(key) + deepHashmessages(value: valueDict[key]!, hasher: &hasher) + } + return + } + + if let hashableValue = value as? AnyHashable { + hasher.combine(hashableValue.hashValue) + } + + return hasher.combine(String(describing: value)) +} + /// Generated class from Pigeon that represents data sent in messages. -struct FileSelectorConfig { +struct FileSelectorConfig: Hashable { var utis: [String] var allowMultiSelection: Bool @@ -88,9 +150,15 @@ struct FileSelectorConfig { allowMultiSelection, ] } + static func == (lhs: FileSelectorConfig, rhs: FileSelectorConfig) -> Bool { + return deepEqualsmessages(lhs.toList(), rhs.toList()) + } + func hash(into hasher: inout Hasher) { + deepHashmessages(value: toList(), hasher: &hasher) + } } -private class messagesPigeonCodecReader: FlutterStandardReader { +private class MessagesPigeonCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { case 129: @@ -101,7 +169,7 @@ private class messagesPigeonCodecReader: FlutterStandardReader { } } -private class messagesPigeonCodecWriter: FlutterStandardWriter { +private class MessagesPigeonCodecWriter: FlutterStandardWriter { override func writeValue(_ value: Any) { if let value = value as? FileSelectorConfig { super.writeByte(129) @@ -112,18 +180,18 @@ private class messagesPigeonCodecWriter: FlutterStandardWriter { } } -private class messagesPigeonCodecReaderWriter: FlutterStandardReaderWriter { +private class MessagesPigeonCodecReaderWriter: FlutterStandardReaderWriter { override func reader(with data: Data) -> FlutterStandardReader { - return messagesPigeonCodecReader(data: data) + return MessagesPigeonCodecReader(data: data) } override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return messagesPigeonCodecWriter(data: data) + return MessagesPigeonCodecWriter(data: data) } } -class messagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { - static let shared = messagesPigeonCodec(readerWriter: messagesPigeonCodecReaderWriter()) +class MessagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { + static let shared = MessagesPigeonCodec(readerWriter: MessagesPigeonCodecReaderWriter()) } /// Generated protocol from Pigeon that represents a handler of messages from Flutter. @@ -133,7 +201,7 @@ protocol FileSelectorApi { /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class FileSelectorApiSetup { - static var codec: FlutterStandardMessageCodec { messagesPigeonCodec.shared } + static var codec: FlutterStandardMessageCodec { MessagesPigeonCodec.shared } /// Sets up an instance of `FileSelectorApi` to handle messages through the `binaryMessenger`. static func setUp( binaryMessenger: FlutterBinaryMessenger, api: FileSelectorApi?, diff --git a/packages/file_selector/file_selector_ios/lib/src/messages.g.dart b/packages/file_selector/file_selector_ios/lib/src/messages.g.dart index c9c8d6cdbc4d..59e67959051b 100644 --- a/packages/file_selector/file_selector_ios/lib/src/messages.g.dart +++ b/packages/file_selector/file_selector_ios/lib/src/messages.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.4.1), do not edit directly. +// Autogenerated from Pigeon (v25.5.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 @@ -29,6 +29,21 @@ List wrapResponse( return [error.code, error.message, error.details]; } +bool _deepEquals(Object? a, Object? b) { + if (a is List && b is List) { + return a.length == b.length && + a.indexed + .every(((int, dynamic) item) => _deepEquals(item.$2, b[item.$1])); + } + if (a is Map && b is Map) { + return a.length == b.length && + a.entries.every((MapEntry entry) => + (b as Map).containsKey(entry.key) && + _deepEquals(entry.value, b[entry.key])); + } + return a == b; +} + class FileSelectorConfig { FileSelectorConfig({ this.utis = const [], @@ -39,13 +54,17 @@ class FileSelectorConfig { bool allowMultiSelection; - Object encode() { + List _toList() { return [ utis, allowMultiSelection, ]; } + Object encode() { + return _toList(); + } + static FileSelectorConfig decode(Object result) { result as List; return FileSelectorConfig( @@ -53,6 +72,22 @@ class FileSelectorConfig { allowMultiSelection: result[1]! as bool, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! FileSelectorConfig || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(encode(), other.encode()); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); } class _PigeonCodec extends StandardMessageCodec { @@ -105,8 +140,10 @@ class FileSelectorApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([config]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([config]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { diff --git a/packages/file_selector/file_selector_ios/pubspec.yaml b/packages/file_selector/file_selector_ios/pubspec.yaml index 44a4e6a9d95f..a3ea607806a6 100644 --- a/packages/file_selector/file_selector_ios/pubspec.yaml +++ b/packages/file_selector/file_selector_ios/pubspec.yaml @@ -2,7 +2,7 @@ name: file_selector_ios description: iOS implementation of the file_selector plugin. repository: https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_ios issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+file_selector%22 -version: 0.5.3+1 +version: 0.5.3+2 environment: sdk: ^3.6.0 @@ -26,7 +26,7 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - pigeon: ^22.4.1 + pigeon: ^25.5.0 topics: - files diff --git a/packages/file_selector/file_selector_ios/test/test_api.g.dart b/packages/file_selector/file_selector_ios/test/test_api.g.dart index fbe4e1acd920..5a95dc1782d2 100644 --- a/packages/file_selector/file_selector_ios/test/test_api.g.dart +++ b/packages/file_selector/file_selector_ios/test/test_api.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.4.1), do not edit directly. +// Autogenerated from Pigeon (v25.5.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, no_leading_underscores_for_local_identifiers // ignore_for_file: avoid_relative_lib_imports diff --git a/packages/file_selector/file_selector_macos/CHANGELOG.md b/packages/file_selector/file_selector_macos/CHANGELOG.md index d8f59fe16422..c65d5d3a93c3 100644 --- a/packages/file_selector/file_selector_macos/CHANGELOG.md +++ b/packages/file_selector/file_selector_macos/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.9.4+4 + +* Updates to Pigeon 25.5.0. + ## 0.9.4+3 * Updates configuration to not set `nameFieldStringValue` for `NSOpenPanel`. diff --git a/packages/file_selector/file_selector_macos/lib/src/messages.g.dart b/packages/file_selector/file_selector_macos/lib/src/messages.g.dart index d1d45a2777e5..087f9abbadb3 100644 --- a/packages/file_selector/file_selector_macos/lib/src/messages.g.dart +++ b/packages/file_selector/file_selector_macos/lib/src/messages.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.4.1), do not edit directly. +// Autogenerated from Pigeon (v25.5.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 @@ -29,6 +29,21 @@ List wrapResponse( return [error.code, error.message, error.details]; } +bool _deepEquals(Object? a, Object? b) { + if (a is List && b is List) { + return a.length == b.length && + a.indexed + .every(((int, dynamic) item) => _deepEquals(item.$2, b[item.$1])); + } + if (a is Map && b is Map) { + return a.length == b.length && + a.entries.every((MapEntry entry) => + (b as Map).containsKey(entry.key) && + _deepEquals(entry.value, b[entry.key])); + } + return a == b; +} + /// A Pigeon representation of the macOS portion of an `XTypeGroup`. class AllowedTypes { AllowedTypes({ @@ -43,7 +58,7 @@ class AllowedTypes { List utis; - Object encode() { + List _toList() { return [ extensions, mimeTypes, @@ -51,6 +66,10 @@ class AllowedTypes { ]; } + Object encode() { + return _toList(); + } + static AllowedTypes decode(Object result) { result as List; return AllowedTypes( @@ -59,6 +78,22 @@ class AllowedTypes { utis: (result[2] as List?)!.cast(), ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! AllowedTypes || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(encode(), other.encode()); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); } /// Options for save panels. @@ -81,7 +116,7 @@ class SavePanelOptions { String? prompt; - Object encode() { + List _toList() { return [ allowedFileTypes, directoryPath, @@ -90,6 +125,10 @@ class SavePanelOptions { ]; } + Object encode() { + return _toList(); + } + static SavePanelOptions decode(Object result) { result as List; return SavePanelOptions( @@ -99,6 +138,22 @@ class SavePanelOptions { prompt: result[3] as String?, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! SavePanelOptions || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(encode(), other.encode()); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); } /// Options for open panels. @@ -120,7 +175,7 @@ class OpenPanelOptions { SavePanelOptions baseOptions; - Object encode() { + List _toList() { return [ allowsMultipleSelection, canChooseDirectories, @@ -129,6 +184,10 @@ class OpenPanelOptions { ]; } + Object encode() { + return _toList(); + } + static OpenPanelOptions decode(Object result) { result as List; return OpenPanelOptions( @@ -138,6 +197,22 @@ class OpenPanelOptions { baseOptions: result[3]! as SavePanelOptions, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! OpenPanelOptions || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(encode(), other.encode()); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); } class _PigeonCodec extends StandardMessageCodec { @@ -204,8 +279,10 @@ class FileSelectorApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([options]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([options]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -236,8 +313,10 @@ class FileSelectorApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([options]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([options]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { diff --git a/packages/file_selector/file_selector_macos/macos/file_selector_macos/Sources/file_selector_macos/messages.g.swift b/packages/file_selector/file_selector_macos/macos/file_selector_macos/Sources/file_selector_macos/messages.g.swift index 62590d1a46e2..e5b6450f9aac 100644 --- a/packages/file_selector/file_selector_macos/macos/file_selector_macos/Sources/file_selector_macos/messages.g.swift +++ b/packages/file_selector/file_selector_macos/macos/file_selector_macos/Sources/file_selector_macos/messages.g.swift @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.4.1), do not edit directly. +// Autogenerated from Pigeon (v25.5.0), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation @@ -18,9 +18,9 @@ import Foundation final class PigeonError: Error { let code: String let message: String? - let details: Any? + let details: Sendable? - init(code: String, message: String?, details: Any?) { + init(code: String, message: String?, details: Sendable?) { self.code = code self.message = message self.details = details @@ -67,10 +67,72 @@ private func nilOrValue(_ value: Any?) -> T? { return value as! T? } +func deepEqualsmessages(_ lhs: Any?, _ rhs: Any?) -> Bool { + let cleanLhs = nilOrValue(lhs) as Any? + let cleanRhs = nilOrValue(rhs) as Any? + switch (cleanLhs, cleanRhs) { + case (nil, nil): + return true + + case (nil, _), (_, nil): + return false + + case is (Void, Void): + return true + + case let (cleanLhsHashable, cleanRhsHashable) as (AnyHashable, AnyHashable): + return cleanLhsHashable == cleanRhsHashable + + case let (cleanLhsArray, cleanRhsArray) as ([Any?], [Any?]): + guard cleanLhsArray.count == cleanRhsArray.count else { return false } + for (index, element) in cleanLhsArray.enumerated() { + if !deepEqualsmessages(element, cleanRhsArray[index]) { + return false + } + } + return true + + case let (cleanLhsDictionary, cleanRhsDictionary) as ([AnyHashable: Any?], [AnyHashable: Any?]): + guard cleanLhsDictionary.count == cleanRhsDictionary.count else { return false } + for (key, cleanLhsValue) in cleanLhsDictionary { + guard cleanRhsDictionary.index(forKey: key) != nil else { return false } + if !deepEqualsmessages(cleanLhsValue, cleanRhsDictionary[key]!) { + return false + } + } + return true + + default: + // Any other type shouldn't be able to be used with pigeon. File an issue if you find this to be untrue. + return false + } +} + +func deepHashmessages(value: Any?, hasher: inout Hasher) { + if let valueList = value as? [AnyHashable] { + for item in valueList { deepHashmessages(value: item, hasher: &hasher) } + return + } + + if let valueDict = value as? [AnyHashable: AnyHashable] { + for key in valueDict.keys { + hasher.combine(key) + deepHashmessages(value: valueDict[key]!, hasher: &hasher) + } + return + } + + if let hashableValue = value as? AnyHashable { + hasher.combine(hashableValue.hashValue) + } + + return hasher.combine(String(describing: value)) +} + /// A Pigeon representation of the macOS portion of an `XTypeGroup`. /// /// Generated class from Pigeon that represents data sent in messages. -struct AllowedTypes { +struct AllowedTypes: Hashable { var extensions: [String] var mimeTypes: [String] var utis: [String] @@ -94,6 +156,12 @@ struct AllowedTypes { utis, ] } + static func == (lhs: AllowedTypes, rhs: AllowedTypes) -> Bool { + return deepEqualsmessages(lhs.toList(), rhs.toList()) + } + func hash(into hasher: inout Hasher) { + deepHashmessages(value: toList(), hasher: &hasher) + } } /// Options for save panels. @@ -102,7 +170,7 @@ struct AllowedTypes { /// NSOpenPanel properties as well). /// /// Generated class from Pigeon that represents data sent in messages. -struct SavePanelOptions { +struct SavePanelOptions: Hashable { var allowedFileTypes: AllowedTypes? = nil var directoryPath: String? = nil var nameFieldStringValue: String? = nil @@ -130,6 +198,12 @@ struct SavePanelOptions { prompt, ] } + static func == (lhs: SavePanelOptions, rhs: SavePanelOptions) -> Bool { + return deepEqualsmessages(lhs.toList(), rhs.toList()) + } + func hash(into hasher: inout Hasher) { + deepHashmessages(value: toList(), hasher: &hasher) + } } /// Options for open panels. @@ -137,7 +211,7 @@ struct SavePanelOptions { /// These correspond to NSOpenPanel properties. /// /// Generated class from Pigeon that represents data sent in messages. -struct OpenPanelOptions { +struct OpenPanelOptions: Hashable { var allowsMultipleSelection: Bool var canChooseDirectories: Bool var canChooseFiles: Bool @@ -165,9 +239,15 @@ struct OpenPanelOptions { baseOptions, ] } + static func == (lhs: OpenPanelOptions, rhs: OpenPanelOptions) -> Bool { + return deepEqualsmessages(lhs.toList(), rhs.toList()) + } + func hash(into hasher: inout Hasher) { + deepHashmessages(value: toList(), hasher: &hasher) + } } -private class messagesPigeonCodecReader: FlutterStandardReader { +private class MessagesPigeonCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { case 129: @@ -182,7 +262,7 @@ private class messagesPigeonCodecReader: FlutterStandardReader { } } -private class messagesPigeonCodecWriter: FlutterStandardWriter { +private class MessagesPigeonCodecWriter: FlutterStandardWriter { override func writeValue(_ value: Any) { if let value = value as? AllowedTypes { super.writeByte(129) @@ -199,18 +279,18 @@ private class messagesPigeonCodecWriter: FlutterStandardWriter { } } -private class messagesPigeonCodecReaderWriter: FlutterStandardReaderWriter { +private class MessagesPigeonCodecReaderWriter: FlutterStandardReaderWriter { override func reader(with data: Data) -> FlutterStandardReader { - return messagesPigeonCodecReader(data: data) + return MessagesPigeonCodecReader(data: data) } override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return messagesPigeonCodecWriter(data: data) + return MessagesPigeonCodecWriter(data: data) } } -class messagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { - static let shared = messagesPigeonCodec(readerWriter: messagesPigeonCodecReaderWriter()) +class MessagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { + static let shared = MessagesPigeonCodec(readerWriter: MessagesPigeonCodecReaderWriter()) } /// Generated protocol from Pigeon that represents a handler of messages from Flutter. @@ -230,7 +310,7 @@ protocol FileSelectorApi { /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class FileSelectorApiSetup { - static var codec: FlutterStandardMessageCodec { messagesPigeonCodec.shared } + static var codec: FlutterStandardMessageCodec { MessagesPigeonCodec.shared } /// Sets up an instance of `FileSelectorApi` to handle messages through the `binaryMessenger`. static func setUp( binaryMessenger: FlutterBinaryMessenger, api: FileSelectorApi?, diff --git a/packages/file_selector/file_selector_macos/pigeons/messages.dart b/packages/file_selector/file_selector_macos/pigeons/messages.dart index 6b80c3d29c48..fa92741d4cda 100644 --- a/packages/file_selector/file_selector_macos/pigeons/messages.dart +++ b/packages/file_selector/file_selector_macos/pigeons/messages.dart @@ -45,7 +45,7 @@ class SavePanelOptions { /// Options for open panels. /// /// These correspond to NSOpenPanel properties. -class OpenPanelOptions extends SavePanelOptions { +class OpenPanelOptions { const OpenPanelOptions({ required this.allowsMultipleSelection, required this.canChooseDirectories, diff --git a/packages/file_selector/file_selector_macos/pubspec.yaml b/packages/file_selector/file_selector_macos/pubspec.yaml index 365dff81ff9a..2c73dc8add78 100644 --- a/packages/file_selector/file_selector_macos/pubspec.yaml +++ b/packages/file_selector/file_selector_macos/pubspec.yaml @@ -2,7 +2,7 @@ name: file_selector_macos description: macOS implementation of the file_selector plugin. repository: https://github.com/flutter/packages/tree/main/packages/file_selector/file_selector_macos issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+file_selector%22 -version: 0.9.4+3 +version: 0.9.4+4 environment: sdk: ^3.6.0 @@ -27,7 +27,7 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - pigeon: ^22.4.1 + pigeon: ^25.5.0 topics: - files diff --git a/packages/file_selector/file_selector_macos/test/messages_test.g.dart b/packages/file_selector/file_selector_macos/test/messages_test.g.dart index 98f1e560b9e0..ec908611ec30 100644 --- a/packages/file_selector/file_selector_macos/test/messages_test.g.dart +++ b/packages/file_selector/file_selector_macos/test/messages_test.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.4.1), do not edit directly. +// Autogenerated from Pigeon (v25.5.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, no_leading_underscores_for_local_identifiers // ignore_for_file: avoid_relative_lib_imports diff --git a/packages/path_provider/path_provider_foundation/CHANGELOG.md b/packages/path_provider/path_provider_foundation/CHANGELOG.md index c9b476281f0c..095dfc8da721 100644 --- a/packages/path_provider/path_provider_foundation/CHANGELOG.md +++ b/packages/path_provider/path_provider_foundation/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 2.4.2 +* Updates to Pigeon 25.5.0. * Updates minimum supported SDK version to Flutter 3.27/Dart 3.6. ## 2.4.1 diff --git a/packages/path_provider/path_provider_foundation/darwin/path_provider_foundation/Sources/path_provider_foundation/messages.g.swift b/packages/path_provider/path_provider_foundation/darwin/path_provider_foundation/Sources/path_provider_foundation/messages.g.swift index c12242270baf..99df5a9cde4c 100644 --- a/packages/path_provider/path_provider_foundation/darwin/path_provider_foundation/Sources/path_provider_foundation/messages.g.swift +++ b/packages/path_provider/path_provider_foundation/darwin/path_provider_foundation/Sources/path_provider_foundation/messages.g.swift @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.6.4), do not edit directly. +// Autogenerated from Pigeon (v25.5.0), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation @@ -18,9 +18,9 @@ import Foundation final class PigeonError: Error { let code: String let message: String? - let details: Any? + let details: Sendable? - init(code: String, message: String?, details: Any?) { + init(code: String, message: String?, details: Sendable?) { self.code = code self.message = message self.details = details @@ -76,7 +76,7 @@ enum DirectoryType: Int { case applicationCache = 5 } -private class messagesPigeonCodecReader: FlutterStandardReader { +private class MessagesPigeonCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { case 129: @@ -91,7 +91,7 @@ private class messagesPigeonCodecReader: FlutterStandardReader { } } -private class messagesPigeonCodecWriter: FlutterStandardWriter { +private class MessagesPigeonCodecWriter: FlutterStandardWriter { override func writeValue(_ value: Any) { if let value = value as? DirectoryType { super.writeByte(129) @@ -102,18 +102,18 @@ private class messagesPigeonCodecWriter: FlutterStandardWriter { } } -private class messagesPigeonCodecReaderWriter: FlutterStandardReaderWriter { +private class MessagesPigeonCodecReaderWriter: FlutterStandardReaderWriter { override func reader(with data: Data) -> FlutterStandardReader { - return messagesPigeonCodecReader(data: data) + return MessagesPigeonCodecReader(data: data) } override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return messagesPigeonCodecWriter(data: data) + return MessagesPigeonCodecWriter(data: data) } } -class messagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { - static let shared = messagesPigeonCodec(readerWriter: messagesPigeonCodecReaderWriter()) +class MessagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { + static let shared = MessagesPigeonCodec(readerWriter: MessagesPigeonCodecReaderWriter()) } /// Generated protocol from Pigeon that represents a handler of messages from Flutter. @@ -124,7 +124,7 @@ protocol PathProviderApi { /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class PathProviderApiSetup { - static var codec: FlutterStandardMessageCodec { messagesPigeonCodec.shared } + static var codec: FlutterStandardMessageCodec { MessagesPigeonCodec.shared } /// Sets up an instance of `PathProviderApi` to handle messages through the `binaryMessenger`. static func setUp( binaryMessenger: FlutterBinaryMessenger, api: PathProviderApi?, diff --git a/packages/path_provider/path_provider_foundation/lib/messages.g.dart b/packages/path_provider/path_provider_foundation/lib/messages.g.dart index dbe046b89ad2..2f9942377336 100644 --- a/packages/path_provider/path_provider_foundation/lib/messages.g.dart +++ b/packages/path_provider/path_provider_foundation/lib/messages.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.6.4), do not edit directly. +// Autogenerated from Pigeon (v25.5.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 @@ -89,8 +89,10 @@ class PathProviderApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([type]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([type]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -113,8 +115,10 @@ class PathProviderApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([appGroupIdentifier]) as List?; + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([appGroupIdentifier]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { diff --git a/packages/path_provider/path_provider_foundation/pubspec.yaml b/packages/path_provider/path_provider_foundation/pubspec.yaml index 724ca54f2b97..f9232c8b5d65 100644 --- a/packages/path_provider/path_provider_foundation/pubspec.yaml +++ b/packages/path_provider/path_provider_foundation/pubspec.yaml @@ -2,7 +2,7 @@ name: path_provider_foundation description: iOS and macOS implementation of the path_provider plugin repository: https://github.com/flutter/packages/tree/main/packages/path_provider/path_provider_foundation issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+path_provider%22 -version: 2.4.1 +version: 2.4.2 environment: sdk: ^3.6.0 @@ -32,7 +32,7 @@ dev_dependencies: sdk: flutter mockito: ^5.4.4 path: ^1.8.0 - pigeon: ^22.6.4 + pigeon: ^25.5.0 topics: - files diff --git a/packages/path_provider/path_provider_foundation/test/messages_test.g.dart b/packages/path_provider/path_provider_foundation/test/messages_test.g.dart index 36b84bc1f94a..29ad5a4eacd2 100644 --- a/packages/path_provider/path_provider_foundation/test/messages_test.g.dart +++ b/packages/path_provider/path_provider_foundation/test/messages_test.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.6.4), do not edit directly. +// Autogenerated from Pigeon (v25.5.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, no_leading_underscores_for_local_identifiers // ignore_for_file: avoid_relative_lib_imports diff --git a/packages/quick_actions/quick_actions_ios/CHANGELOG.md b/packages/quick_actions/quick_actions_ios/CHANGELOG.md index 14dec698faef..cfbb740a98f0 100644 --- a/packages/quick_actions/quick_actions_ios/CHANGELOG.md +++ b/packages/quick_actions/quick_actions_ios/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 1.2.1 +* Updates to Pigeon 25.5.0. * Updates minimum supported SDK version to Flutter 3.27/Dart 3.6. ## 1.2.0 diff --git a/packages/quick_actions/quick_actions_ios/ios/quick_actions_ios/Sources/quick_actions_ios/messages.g.swift b/packages/quick_actions/quick_actions_ios/ios/quick_actions_ios/Sources/quick_actions_ios/messages.g.swift index dbfea4f1e026..c47d242219d3 100644 --- a/packages/quick_actions/quick_actions_ios/ios/quick_actions_ios/Sources/quick_actions_ios/messages.g.swift +++ b/packages/quick_actions/quick_actions_ios/ios/quick_actions_ios/Sources/quick_actions_ios/messages.g.swift @@ -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.1), do not edit directly. +// Autogenerated from Pigeon (v25.5.0), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation @@ -18,9 +18,9 @@ import Foundation final class PigeonError: Error { let code: String let message: String? - let details: Any? + let details: Sendable? - init(code: String, message: String?, details: Any?) { + init(code: String, message: String?, details: Sendable?) { self.code = code self.message = message self.details = details @@ -73,10 +73,72 @@ private func nilOrValue(_ value: Any?) -> T? { return value as! T? } +func deepEqualsmessages(_ lhs: Any?, _ rhs: Any?) -> Bool { + let cleanLhs = nilOrValue(lhs) as Any? + let cleanRhs = nilOrValue(rhs) as Any? + switch (cleanLhs, cleanRhs) { + case (nil, nil): + return true + + case (nil, _), (_, nil): + return false + + case is (Void, Void): + return true + + case let (cleanLhsHashable, cleanRhsHashable) as (AnyHashable, AnyHashable): + return cleanLhsHashable == cleanRhsHashable + + case let (cleanLhsArray, cleanRhsArray) as ([Any?], [Any?]): + guard cleanLhsArray.count == cleanRhsArray.count else { return false } + for (index, element) in cleanLhsArray.enumerated() { + if !deepEqualsmessages(element, cleanRhsArray[index]) { + return false + } + } + return true + + case let (cleanLhsDictionary, cleanRhsDictionary) as ([AnyHashable: Any?], [AnyHashable: Any?]): + guard cleanLhsDictionary.count == cleanRhsDictionary.count else { return false } + for (key, cleanLhsValue) in cleanLhsDictionary { + guard cleanRhsDictionary.index(forKey: key) != nil else { return false } + if !deepEqualsmessages(cleanLhsValue, cleanRhsDictionary[key]!) { + return false + } + } + return true + + default: + // Any other type shouldn't be able to be used with pigeon. File an issue if you find this to be untrue. + return false + } +} + +func deepHashmessages(value: Any?, hasher: inout Hasher) { + if let valueList = value as? [AnyHashable] { + for item in valueList { deepHashmessages(value: item, hasher: &hasher) } + return + } + + if let valueDict = value as? [AnyHashable: AnyHashable] { + for key in valueDict.keys { + hasher.combine(key) + deepHashmessages(value: valueDict[key]!, hasher: &hasher) + } + return + } + + if let hashableValue = value as? AnyHashable { + hasher.combine(hashableValue.hashValue) + } + + return hasher.combine(String(describing: value)) +} + /// Home screen quick-action shortcut item. /// /// Generated class from Pigeon that represents data sent in messages. -struct ShortcutItemMessage { +struct ShortcutItemMessage: Hashable { /// The identifier of this item; should be unique within the app. var type: String /// Localized title of the item. @@ -87,11 +149,11 @@ struct ShortcutItemMessage { var icon: String? = nil // swift-format-ignore: AlwaysUseLowerCamelCase - static func fromList(_ __pigeon_list: [Any?]) -> ShortcutItemMessage? { - let type = __pigeon_list[0] as! String - let localizedTitle = __pigeon_list[1] as! String - let localizedSubtitle: String? = nilOrValue(__pigeon_list[2]) - let icon: String? = nilOrValue(__pigeon_list[3]) + static func fromList(_ pigeonVar_list: [Any?]) -> ShortcutItemMessage? { + let type = pigeonVar_list[0] as! String + let localizedTitle = pigeonVar_list[1] as! String + let localizedSubtitle: String? = nilOrValue(pigeonVar_list[2]) + let icon: String? = nilOrValue(pigeonVar_list[3]) return ShortcutItemMessage( type: type, @@ -108,9 +170,15 @@ struct ShortcutItemMessage { icon, ] } + static func == (lhs: ShortcutItemMessage, rhs: ShortcutItemMessage) -> Bool { + return deepEqualsmessages(lhs.toList(), rhs.toList()) + } + func hash(into hasher: inout Hasher) { + deepHashmessages(value: toList(), hasher: &hasher) + } } -private class messagesPigeonCodecReader: FlutterStandardReader { +private class MessagesPigeonCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { case 129: @@ -121,7 +189,7 @@ private class messagesPigeonCodecReader: FlutterStandardReader { } } -private class messagesPigeonCodecWriter: FlutterStandardWriter { +private class MessagesPigeonCodecWriter: FlutterStandardWriter { override func writeValue(_ value: Any) { if let value = value as? ShortcutItemMessage { super.writeByte(129) @@ -132,18 +200,18 @@ private class messagesPigeonCodecWriter: FlutterStandardWriter { } } -private class messagesPigeonCodecReaderWriter: FlutterStandardReaderWriter { +private class MessagesPigeonCodecReaderWriter: FlutterStandardReaderWriter { override func reader(with data: Data) -> FlutterStandardReader { - return messagesPigeonCodecReader(data: data) + return MessagesPigeonCodecReader(data: data) } override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return messagesPigeonCodecWriter(data: data) + return MessagesPigeonCodecWriter(data: data) } } -class messagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { - static let shared = messagesPigeonCodec(readerWriter: messagesPigeonCodecReaderWriter()) +class MessagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { + static let shared = MessagesPigeonCodec(readerWriter: MessagesPigeonCodecReaderWriter()) } /// Generated protocol from Pigeon that represents a handler of messages from Flutter. @@ -156,7 +224,7 @@ protocol IOSQuickActionsApi { /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class IOSQuickActionsApiSetup { - static var codec: FlutterStandardMessageCodec { messagesPigeonCodec.shared } + static var codec: FlutterStandardMessageCodec { MessagesPigeonCodec.shared } /// Sets up an instance of `IOSQuickActionsApi` to handle messages through the `binaryMessenger`. static func setUp( binaryMessenger: FlutterBinaryMessenger, api: IOSQuickActionsApi?, @@ -201,14 +269,12 @@ class IOSQuickActionsApiSetup { } } } - /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. protocol IOSQuickActionsFlutterApiProtocol { /// Sends a string representing a shortcut from the native platform to the app. func launchAction( action actionArg: String, completion: @escaping (Result) -> Void) } - class IOSQuickActionsFlutterApi: IOSQuickActionsFlutterApiProtocol { private let binaryMessenger: FlutterBinaryMessenger private let messageChannelSuffix: String @@ -216,8 +282,8 @@ class IOSQuickActionsFlutterApi: IOSQuickActionsFlutterApiProtocol { self.binaryMessenger = binaryMessenger self.messageChannelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" } - var codec: messagesPigeonCodec { - return messagesPigeonCodec.shared + var codec: MessagesPigeonCodec { + return MessagesPigeonCodec.shared } /// Sends a string representing a shortcut from the native platform to the app. func launchAction( @@ -238,7 +304,7 @@ class IOSQuickActionsFlutterApi: IOSQuickActionsFlutterApiProtocol { let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } diff --git a/packages/quick_actions/quick_actions_ios/lib/messages.g.dart b/packages/quick_actions/quick_actions_ios/lib/messages.g.dart index 6678bbc840be..8f2633adea0b 100644 --- a/packages/quick_actions/quick_actions_ios/lib/messages.g.dart +++ b/packages/quick_actions/quick_actions_ios/lib/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.1), do not edit directly. +// Autogenerated from Pigeon (v25.5.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 @@ -29,6 +29,21 @@ List wrapResponse( return [error.code, error.message, error.details]; } +bool _deepEquals(Object? a, Object? b) { + if (a is List && b is List) { + return a.length == b.length && + a.indexed + .every(((int, dynamic) item) => _deepEquals(item.$2, b[item.$1])); + } + if (a is Map && b is Map) { + return a.length == b.length && + a.entries.every((MapEntry entry) => + (b as Map).containsKey(entry.key) && + _deepEquals(entry.value, b[entry.key])); + } + return a == b; +} + /// Home screen quick-action shortcut item. class ShortcutItemMessage { ShortcutItemMessage({ @@ -50,7 +65,7 @@ class ShortcutItemMessage { /// Name of native resource to be displayed as the icon for this item. String? icon; - Object encode() { + List _toList() { return [ type, localizedTitle, @@ -59,6 +74,10 @@ class ShortcutItemMessage { ]; } + Object encode() { + return _toList(); + } + static ShortcutItemMessage decode(Object result) { result as List; return ShortcutItemMessage( @@ -68,13 +87,32 @@ class ShortcutItemMessage { icon: result[3] as String?, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! ShortcutItemMessage || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(encode(), other.encode()); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); } class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is ShortcutItemMessage) { + if (value is int) { + buffer.putUint8(4); + buffer.putInt64(value); + } else if (value is ShortcutItemMessage) { buffer.putUint8(129); writeValue(buffer, value.encode()); } else { @@ -99,34 +137,36 @@ class IOSQuickActionsApi { /// BinaryMessenger will be used which routes to the host platform. IOSQuickActionsApi( {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : __pigeon_binaryMessenger = binaryMessenger, - __pigeon_messageChannelSuffix = + : pigeonVar_binaryMessenger = binaryMessenger, + pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? __pigeon_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - final String __pigeon_messageChannelSuffix; + final String pigeonVar_messageChannelSuffix; /// Sets the dynamic shortcuts for the app. - Future setShortcutItems(List itemsList) async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.quick_actions_ios.IOSQuickActionsApi.setShortcutItems$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + Future setShortcutItems(List itemsList) async { + final String pigeonVar_channelName = + 'dev.flutter.pigeon.quick_actions_ios.IOSQuickActionsApi.setShortcutItems$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_binaryMessenger, ); - final List? __pigeon_replyList = - await __pigeon_channel.send([itemsList]) as List?; - if (__pigeon_replyList == null) { - throw _createConnectionError(__pigeon_channelName); - } else if (__pigeon_replyList.length > 1) { + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([itemsList]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; @@ -135,23 +175,24 @@ class IOSQuickActionsApi { /// Removes all dynamic shortcuts. Future clearShortcutItems() async { - final String __pigeon_channelName = - 'dev.flutter.pigeon.quick_actions_ios.IOSQuickActionsApi.clearShortcutItems$__pigeon_messageChannelSuffix'; - final BasicMessageChannel __pigeon_channel = + final String pigeonVar_channelName = + 'dev.flutter.pigeon.quick_actions_ios.IOSQuickActionsApi.clearShortcutItems$pigeonVar_messageChannelSuffix'; + final BasicMessageChannel pigeonVar_channel = BasicMessageChannel( - __pigeon_channelName, + pigeonVar_channelName, pigeonChannelCodec, - binaryMessenger: __pigeon_binaryMessenger, + binaryMessenger: pigeonVar_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) { + final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { throw PlatformException( - code: __pigeon_replyList[0]! as String, - message: __pigeon_replyList[1] as String?, - details: __pigeon_replyList[2], + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], ); } else { return; @@ -173,15 +214,16 @@ abstract class IOSQuickActionsFlutterApi { messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel __pigeon_channel = BasicMessageChannel< + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< Object?>( 'dev.flutter.pigeon.quick_actions_ios.IOSQuickActionsFlutterApi.launchAction$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger); if (api == null) { - __pigeon_channel.setMessageHandler(null); + pigeonVar_channel.setMessageHandler(null); } else { - __pigeon_channel.setMessageHandler((Object? message) async { + pigeonVar_channel.setMessageHandler((Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.quick_actions_ios.IOSQuickActionsFlutterApi.launchAction was null.'); final List args = (message as List?)!; diff --git a/packages/quick_actions/quick_actions_ios/pubspec.yaml b/packages/quick_actions/quick_actions_ios/pubspec.yaml index bab1fb27b3af..dcc278b2da22 100644 --- a/packages/quick_actions/quick_actions_ios/pubspec.yaml +++ b/packages/quick_actions/quick_actions_ios/pubspec.yaml @@ -2,7 +2,7 @@ name: quick_actions_ios description: An implementation for the iOS platform of the Flutter `quick_actions` plugin. repository: https://github.com/flutter/packages/tree/main/packages/quick_actions/quick_actions_ios issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 -version: 1.2.0 +version: 1.2.1 environment: sdk: ^3.6.0 @@ -24,7 +24,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - pigeon: ^20.0.1 + pigeon: ^25.5.0 plugin_platform_interface: ^2.1.7 topics: diff --git a/packages/quick_actions/quick_actions_ios/test/quick_actions_ios_test.dart b/packages/quick_actions/quick_actions_ios/test/quick_actions_ios_test.dart index b53137dcc9db..642928839e22 100644 --- a/packages/quick_actions/quick_actions_ios/test/quick_actions_ios_test.dart +++ b/packages/quick_actions/quick_actions_ios/test/quick_actions_ios_test.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'package:flutter/src/services/binary_messenger.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:quick_actions_ios/messages.g.dart'; import 'package:quick_actions_ios/quick_actions_ios.dart'; @@ -91,6 +92,14 @@ class _FakeQuickActionsApi implements IOSQuickActionsApi { items.add(shortcutItemMessageToShortcutItem(element!)); } } + + @override + // ignore: non_constant_identifier_names + BinaryMessenger? get pigeonVar_binaryMessenger => null; + + @override + // ignore: non_constant_identifier_names + String get pigeonVar_messageChannelSuffix => ''; } /// Conversion tool to change [ShortcutItemMessage] back to [ShortcutItem] diff --git a/packages/url_launcher/url_launcher_ios/CHANGELOG.md b/packages/url_launcher/url_launcher_ios/CHANGELOG.md index 5b02496df592..c00d6abce38d 100644 --- a/packages/url_launcher/url_launcher_ios/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_ios/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 6.3.4 +* Updates to Pigeon 25.5.0. * Updates minimum supported SDK version to Flutter 3.27/Dart 3.6. ## 6.3.3 diff --git a/packages/url_launcher/url_launcher_ios/ios/url_launcher_ios/Sources/url_launcher_ios/messages.g.swift b/packages/url_launcher/url_launcher_ios/ios/url_launcher_ios/Sources/url_launcher_ios/messages.g.swift index 85e1e3944c20..9dae106eb0a7 100644 --- a/packages/url_launcher/url_launcher_ios/ios/url_launcher_ios/Sources/url_launcher_ios/messages.g.swift +++ b/packages/url_launcher/url_launcher_ios/ios/url_launcher_ios/Sources/url_launcher_ios/messages.g.swift @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.6.4), do not edit directly. +// Autogenerated from Pigeon (v25.5.0), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation @@ -18,9 +18,9 @@ import Foundation final class PigeonError: Error { let code: String let message: String? - let details: Any? + let details: Sendable? - init(code: String, message: String?, details: Any?) { + init(code: String, message: String?, details: Sendable?) { self.code = code self.message = message self.details = details @@ -89,7 +89,7 @@ enum InAppLoadResult: Int { case dismissed = 3 } -private class messagesPigeonCodecReader: FlutterStandardReader { +private class MessagesPigeonCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { case 129: @@ -110,7 +110,7 @@ private class messagesPigeonCodecReader: FlutterStandardReader { } } -private class messagesPigeonCodecWriter: FlutterStandardWriter { +private class MessagesPigeonCodecWriter: FlutterStandardWriter { override func writeValue(_ value: Any) { if let value = value as? LaunchResult { super.writeByte(129) @@ -124,18 +124,18 @@ private class messagesPigeonCodecWriter: FlutterStandardWriter { } } -private class messagesPigeonCodecReaderWriter: FlutterStandardReaderWriter { +private class MessagesPigeonCodecReaderWriter: FlutterStandardReaderWriter { override func reader(with data: Data) -> FlutterStandardReader { - return messagesPigeonCodecReader(data: data) + return MessagesPigeonCodecReader(data: data) } override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return messagesPigeonCodecWriter(data: data) + return MessagesPigeonCodecWriter(data: data) } } -class messagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { - static let shared = messagesPigeonCodec(readerWriter: messagesPigeonCodecReaderWriter()) +class MessagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { + static let shared = MessagesPigeonCodec(readerWriter: MessagesPigeonCodecReaderWriter()) } /// Generated protocol from Pigeon that represents a handler of messages from Flutter. @@ -156,7 +156,7 @@ protocol UrlLauncherApi { /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class UrlLauncherApiSetup { - static var codec: FlutterStandardMessageCodec { messagesPigeonCodec.shared } + static var codec: FlutterStandardMessageCodec { MessagesPigeonCodec.shared } /// Sets up an instance of `UrlLauncherApi` to handle messages through the `binaryMessenger`. static func setUp( binaryMessenger: FlutterBinaryMessenger, api: UrlLauncherApi?, messageChannelSuffix: String = "" diff --git a/packages/url_launcher/url_launcher_ios/lib/src/messages.g.dart b/packages/url_launcher/url_launcher_ios/lib/src/messages.g.dart index 8aeea1a66a11..84f983173473 100644 --- a/packages/url_launcher/url_launcher_ios/lib/src/messages.g.dart +++ b/packages/url_launcher/url_launcher_ios/lib/src/messages.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.6.4), do not edit directly. +// Autogenerated from Pigeon (v25.5.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 @@ -103,8 +103,10 @@ class UrlLauncherApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([url]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([url]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -133,8 +135,10 @@ class UrlLauncherApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); - final List? pigeonVar_replyList = await pigeonVar_channel - .send([url, universalLinksOnly]) as List?; + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([url, universalLinksOnly]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -164,8 +168,10 @@ class UrlLauncherApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([url]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([url]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -194,8 +200,9 @@ class UrlLauncherApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final List? pigeonVar_replyList = - await pigeonVar_channel.send(null) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { diff --git a/packages/url_launcher/url_launcher_ios/pubspec.yaml b/packages/url_launcher/url_launcher_ios/pubspec.yaml index d4a037086c11..b01543bfbb87 100644 --- a/packages/url_launcher/url_launcher_ios/pubspec.yaml +++ b/packages/url_launcher/url_launcher_ios/pubspec.yaml @@ -2,7 +2,7 @@ name: url_launcher_ios description: iOS implementation of the url_launcher plugin. repository: https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher_ios issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22 -version: 6.3.3 +version: 6.3.4 environment: sdk: ^3.6.0 @@ -26,7 +26,7 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - pigeon: ^22.6.4 + pigeon: ^25.5.0 plugin_platform_interface: ^2.1.7 test: ^1.16.3 diff --git a/packages/url_launcher/url_launcher_macos/CHANGELOG.md b/packages/url_launcher/url_launcher_macos/CHANGELOG.md index 53c7e44153d9..f2c0db11d78c 100644 --- a/packages/url_launcher/url_launcher_macos/CHANGELOG.md +++ b/packages/url_launcher/url_launcher_macos/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 3.2.3 +* Updates to Pigeon 25.5.0. * Updates minimum supported SDK version to Flutter 3.27/Dart 3.6. ## 3.2.2 diff --git a/packages/url_launcher/url_launcher_macos/lib/src/messages.g.dart b/packages/url_launcher/url_launcher_macos/lib/src/messages.g.dart index 15252ef6e5ed..392a393e6c7a 100644 --- a/packages/url_launcher/url_launcher_macos/lib/src/messages.g.dart +++ b/packages/url_launcher/url_launcher_macos/lib/src/messages.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.6.4), do not edit directly. +// Autogenerated from Pigeon (v25.5.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 @@ -18,6 +18,21 @@ PlatformException _createConnectionError(String channelName) { ); } +bool _deepEquals(Object? a, Object? b) { + if (a is List && b is List) { + return a.length == b.length && + a.indexed + .every(((int, dynamic) item) => _deepEquals(item.$2, b[item.$1])); + } + if (a is Map && b is Map) { + return a.length == b.length && + a.entries.every((MapEntry entry) => + (b as Map).containsKey(entry.key) && + _deepEquals(entry.value, b[entry.key])); + } + return a == b; +} + /// Possible error conditions for [UrlLauncherApi] calls. enum UrlLauncherError { /// The URL could not be parsed as an NSURL. @@ -35,13 +50,17 @@ class UrlLauncherBoolResult { UrlLauncherError? error; - Object encode() { + List _toList() { return [ value, error, ]; } + Object encode() { + return _toList(); + } + static UrlLauncherBoolResult decode(Object result) { result as List; return UrlLauncherBoolResult( @@ -49,6 +68,22 @@ class UrlLauncherBoolResult { error: result[1] as UrlLauncherError?, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! UrlLauncherBoolResult || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(encode(), other.encode()); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); } class _PigeonCodec extends StandardMessageCodec { @@ -108,8 +143,10 @@ class UrlLauncherApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([url]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([url]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -138,8 +175,10 @@ class UrlLauncherApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([url]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([url]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { diff --git a/packages/url_launcher/url_launcher_macos/macos/url_launcher_macos/Sources/url_launcher_macos/messages.g.swift b/packages/url_launcher/url_launcher_macos/macos/url_launcher_macos/Sources/url_launcher_macos/messages.g.swift index 01be19b92f57..ce7a3a8dcd86 100644 --- a/packages/url_launcher/url_launcher_macos/macos/url_launcher_macos/Sources/url_launcher_macos/messages.g.swift +++ b/packages/url_launcher/url_launcher_macos/macos/url_launcher_macos/Sources/url_launcher_macos/messages.g.swift @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.6.4), do not edit directly. +// Autogenerated from Pigeon (v25.5.0), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation @@ -18,9 +18,9 @@ import Foundation final class PigeonError: Error { let code: String let message: String? - let details: Any? + let details: Sendable? - init(code: String, message: String?, details: Any?) { + init(code: String, message: String?, details: Sendable?) { self.code = code self.message = message self.details = details @@ -67,6 +67,68 @@ private func nilOrValue(_ value: Any?) -> T? { return value as! T? } +func deepEqualsmessages(_ lhs: Any?, _ rhs: Any?) -> Bool { + let cleanLhs = nilOrValue(lhs) as Any? + let cleanRhs = nilOrValue(rhs) as Any? + switch (cleanLhs, cleanRhs) { + case (nil, nil): + return true + + case (nil, _), (_, nil): + return false + + case is (Void, Void): + return true + + case let (cleanLhsHashable, cleanRhsHashable) as (AnyHashable, AnyHashable): + return cleanLhsHashable == cleanRhsHashable + + case let (cleanLhsArray, cleanRhsArray) as ([Any?], [Any?]): + guard cleanLhsArray.count == cleanRhsArray.count else { return false } + for (index, element) in cleanLhsArray.enumerated() { + if !deepEqualsmessages(element, cleanRhsArray[index]) { + return false + } + } + return true + + case let (cleanLhsDictionary, cleanRhsDictionary) as ([AnyHashable: Any?], [AnyHashable: Any?]): + guard cleanLhsDictionary.count == cleanRhsDictionary.count else { return false } + for (key, cleanLhsValue) in cleanLhsDictionary { + guard cleanRhsDictionary.index(forKey: key) != nil else { return false } + if !deepEqualsmessages(cleanLhsValue, cleanRhsDictionary[key]!) { + return false + } + } + return true + + default: + // Any other type shouldn't be able to be used with pigeon. File an issue if you find this to be untrue. + return false + } +} + +func deepHashmessages(value: Any?, hasher: inout Hasher) { + if let valueList = value as? [AnyHashable] { + for item in valueList { deepHashmessages(value: item, hasher: &hasher) } + return + } + + if let valueDict = value as? [AnyHashable: AnyHashable] { + for key in valueDict.keys { + hasher.combine(key) + deepHashmessages(value: valueDict[key]!, hasher: &hasher) + } + return + } + + if let hashableValue = value as? AnyHashable { + hasher.combine(hashableValue.hashValue) + } + + return hasher.combine(String(describing: value)) +} + /// Possible error conditions for [UrlLauncherApi] calls. enum UrlLauncherError: Int { /// The URL could not be parsed as an NSURL. @@ -76,7 +138,7 @@ enum UrlLauncherError: Int { /// Possible results for a [UrlLauncherApi] call with a boolean outcome. /// /// Generated class from Pigeon that represents data sent in messages. -struct UrlLauncherBoolResult { +struct UrlLauncherBoolResult: Hashable { var value: Bool var error: UrlLauncherError? = nil @@ -96,9 +158,15 @@ struct UrlLauncherBoolResult { error, ] } + static func == (lhs: UrlLauncherBoolResult, rhs: UrlLauncherBoolResult) -> Bool { + return deepEqualsmessages(lhs.toList(), rhs.toList()) + } + func hash(into hasher: inout Hasher) { + deepHashmessages(value: toList(), hasher: &hasher) + } } -private class messagesPigeonCodecReader: FlutterStandardReader { +private class MessagesPigeonCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { case 129: @@ -115,7 +183,7 @@ private class messagesPigeonCodecReader: FlutterStandardReader { } } -private class messagesPigeonCodecWriter: FlutterStandardWriter { +private class MessagesPigeonCodecWriter: FlutterStandardWriter { override func writeValue(_ value: Any) { if let value = value as? UrlLauncherError { super.writeByte(129) @@ -129,18 +197,18 @@ private class messagesPigeonCodecWriter: FlutterStandardWriter { } } -private class messagesPigeonCodecReaderWriter: FlutterStandardReaderWriter { +private class MessagesPigeonCodecReaderWriter: FlutterStandardReaderWriter { override func reader(with data: Data) -> FlutterStandardReader { - return messagesPigeonCodecReader(data: data) + return MessagesPigeonCodecReader(data: data) } override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return messagesPigeonCodecWriter(data: data) + return MessagesPigeonCodecWriter(data: data) } } -class messagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { - static let shared = messagesPigeonCodec(readerWriter: messagesPigeonCodecReaderWriter()) +class MessagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { + static let shared = MessagesPigeonCodec(readerWriter: MessagesPigeonCodecReaderWriter()) } /// Generated protocol from Pigeon that represents a handler of messages from Flutter. @@ -153,7 +221,7 @@ protocol UrlLauncherApi { /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class UrlLauncherApiSetup { - static var codec: FlutterStandardMessageCodec { messagesPigeonCodec.shared } + static var codec: FlutterStandardMessageCodec { MessagesPigeonCodec.shared } /// Sets up an instance of `UrlLauncherApi` to handle messages through the `binaryMessenger`. static func setUp( binaryMessenger: FlutterBinaryMessenger, api: UrlLauncherApi?, messageChannelSuffix: String = "" diff --git a/packages/url_launcher/url_launcher_macos/pubspec.yaml b/packages/url_launcher/url_launcher_macos/pubspec.yaml index de84f6be2d40..d8c42b5d575e 100644 --- a/packages/url_launcher/url_launcher_macos/pubspec.yaml +++ b/packages/url_launcher/url_launcher_macos/pubspec.yaml @@ -2,7 +2,7 @@ name: url_launcher_macos description: macOS implementation of the url_launcher plugin. repository: https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher_macos issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22 -version: 3.2.2 +version: 3.2.3 environment: sdk: ^3.6.0 @@ -25,7 +25,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - pigeon: ^22.6.4 + pigeon: ^25.5.0 test: ^1.16.3 topics: diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/FrameInfoProxyAPIDelegate.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/FrameInfoProxyAPIDelegate.swift index 5fd11474f80d..fe668c2c11b8 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/FrameInfoProxyAPIDelegate.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/FrameInfoProxyAPIDelegate.swift @@ -11,7 +11,7 @@ extension WKFrameInfo { // // See https://github.com/flutter/flutter/issues/163549 and https://developer.apple.com/forums/thread/77888. var maybeRequest: URLRequest? { - return self.perform(#selector(getter:WKFrameInfo.request))?.takeUnretainedValue() + return self.perform(#selector(getter: WKFrameInfo.request))?.takeUnretainedValue() as! URLRequest? } } diff --git a/script/tool/lib/src/format_command.dart b/script/tool/lib/src/format_command.dart index 7d13919d96e8..5581775882c2 100644 --- a/script/tool/lib/src/format_command.dart +++ b/script/tool/lib/src/format_command.dart @@ -58,14 +58,17 @@ class FormatCommand extends PackageLoopingCommand { argParser.addFlag(_kotlinArg, help: 'Format Kotlin files', defaultsTo: true); argParser.addFlag(_javaArg, help: 'Format Java files', defaultsTo: true); + // Currently swift-format is run via xcrun, so only works on macOS. If that + // ever becomes an issue, the ability to find it in the path and/or allow + // providing a path could be restored, to allow developers on Linux or + // Windows to build swift-format from source and use that. See + // https://github.com/flutter/packages/pull/9460. argParser.addFlag(_swiftArg, - help: 'Format and lint Swift files', defaultsTo: true); + help: 'Format and lint Swift files', defaultsTo: platform.isMacOS); argParser.addOption(_clangFormatPathArg, defaultsTo: 'clang-format', help: 'Path to "clang-format" executable.'); argParser.addOption(_javaPathArg, defaultsTo: 'java', help: 'Path to "java" executable.'); - argParser.addOption(_swiftFormatPathArg, - defaultsTo: 'swift-format', help: 'Path to "swift-format" executable.'); } static const String _dartArg = 'dart'; @@ -76,7 +79,6 @@ class FormatCommand extends PackageLoopingCommand { static const String _swiftArg = 'swift'; static const String _clangFormatPathArg = 'clang-format-path'; static const String _javaPathArg = 'java-path'; - static const String _swiftFormatPathArg = 'swift-format-path'; @override final String name = 'format'; @@ -223,10 +225,10 @@ class FormatCommand extends PackageLoopingCommand { final Iterable swiftFiles = _getPathsWithExtensions(files, {'.swift'}); if (swiftFiles.isNotEmpty) { - final String swiftFormat = await _findValidSwiftFormat(); print('Formatting .swift files...'); - final int formatExitCode = - await _runBatched(swiftFormat, ['-i'], files: swiftFiles); + final int formatExitCode = await _runBatched( + 'xcrun', ['swift-format', '-i'], + files: swiftFiles); if (formatExitCode != 0) { printError('Failed to format Swift files: exit code $formatExitCode.'); throw ToolExit(_exitSwiftFormatFailed); @@ -234,8 +236,9 @@ class FormatCommand extends PackageLoopingCommand { print('Linting .swift files...'); final int lintExitCode = await _runBatched( - swiftFormat, + 'xcrun', [ + 'swift-format', 'lint', '--parallel', '--strict', @@ -271,17 +274,6 @@ class FormatCommand extends PackageLoopingCommand { throw ToolExit(_exitDependencyMissing); } - Future _findValidSwiftFormat() async { - final String swiftFormat = getStringArg(_swiftFormatPathArg); - if (await _hasDependency(swiftFormat)) { - return swiftFormat; - } - - printError('Unable to run "swift-format". Make sure that it is in your ' - 'path, or provide a full path with --$_swiftFormatPathArg.'); - throw ToolExit(_exitDependencyMissing); - } - Future _formatJava(Iterable files, String formatterPath) async { final Iterable javaFiles = _getPathsWithExtensions(files, {'.java'}); diff --git a/script/tool/test/format_command_test.dart b/script/tool/test/format_command_test.dart index 56911300912f..8b2cbbc518f5 100644 --- a/script/tool/test/format_command_test.dart +++ b/script/tool/test/format_command_test.dart @@ -555,7 +555,9 @@ void main() { }); group('swift-format', () { - test('formats Swift if --swift-format flag is provided', () async { + test('formats Swift if --swift flag is provided', () async { + mockPlatform.isMacOS = false; + const List files = [ 'macos/foo.swift', ]; @@ -569,25 +571,24 @@ void main() { await runCapturingPrint(runner, [ 'format', '--swift', - '--swift-format-path=/path/to/swift-format' ]); expect( processRunner.recordedCalls, orderedEquals([ - const ProcessCall( - '/path/to/swift-format', - ['--version'], - null, - ), ProcessCall( - '/path/to/swift-format', - ['-i', ...getPackagesDirRelativePaths(plugin, files)], + 'xcrun', + [ + 'swift-format', + '-i', + ...getPackagesDirRelativePaths(plugin, files) + ], packagesDir.path, ), ProcessCall( - '/path/to/swift-format', + 'xcrun', [ + 'swift-format', 'lint', '--parallel', '--strict', @@ -599,6 +600,8 @@ void main() { }); test('skips Swift if --no-swift flag is provided', () async { + mockPlatform.isMacOS = true; + const List files = [ 'macos/foo.swift', ]; @@ -614,35 +617,6 @@ void main() { expect(processRunner.recordedCalls, orderedEquals([])); }); - test('fails with a clear message if swift-format is not in the path', - () async { - const List files = [ - 'macos/foo.swift', - ]; - final RepositoryPackage plugin = - createFakePlugin('a_plugin', packagesDir, extraFiles: files); - fakePubGet(plugin); - - processRunner.mockProcessesForExecutable['swift-format'] = - [ - FakeProcessInfo(MockProcess(exitCode: 1), ['--version']), - ]; - Error? commandError; - final List output = await runCapturingPrint( - runner, ['format', '--swift'], errorHandler: (Error e) { - commandError = e; - }); - - expect(commandError, isA()); - expect( - output, - containsAllInOrder([ - contains( - 'Unable to run "swift-format". Make sure that it is in your path, or ' - 'provide a full path with --swift-format-path.'), - ])); - }); - test('fails if swift-format lint finds issues', () async { const List files = [ 'macos/foo.swift', @@ -651,12 +625,10 @@ void main() { createFakePlugin('a_plugin', packagesDir, extraFiles: files); fakePubGet(plugin); - processRunner.mockProcessesForExecutable['swift-format'] = - [ - FakeProcessInfo(MockProcess(), - ['--version']), // check for working swift-format - FakeProcessInfo(MockProcess(), ['-i']), + processRunner.mockProcessesForExecutable['xcrun'] = [ + FakeProcessInfo(MockProcess(), ['swift-format', '-i']), FakeProcessInfo(MockProcess(exitCode: 1), [ + 'swift-format', 'lint', '--parallel', '--strict', @@ -666,7 +638,6 @@ void main() { final List output = await runCapturingPrint(runner, [ 'format', '--swift', - '--swift-format-path=swift-format' ], errorHandler: (Error e) { commandError = e; }); @@ -687,12 +658,10 @@ void main() { createFakePlugin('a_plugin', packagesDir, extraFiles: files); fakePubGet(plugin); - processRunner.mockProcessesForExecutable['swift-format'] = - [ - FakeProcessInfo(MockProcess(), - ['--version']), // check for working swift-format - FakeProcessInfo(MockProcess(), ['-i']), + processRunner.mockProcessesForExecutable['xcrun'] = [ + FakeProcessInfo(MockProcess(), ['swift-format', '-i']), FakeProcessInfo(MockProcess(exitCode: 99), [ + 'swift-format', 'lint', '--parallel', '--strict', @@ -702,7 +671,6 @@ void main() { final List output = await runCapturingPrint(runner, [ 'format', '--swift', - '--swift-format-path=swift-format' ], errorHandler: (Error e) { commandError = e; }); @@ -723,17 +691,14 @@ void main() { createFakePlugin('a_plugin', packagesDir, extraFiles: files); fakePubGet(plugin); - processRunner.mockProcessesForExecutable['swift-format'] = - [ - FakeProcessInfo(MockProcess(), - ['--version']), // check for working swift-format - FakeProcessInfo(MockProcess(exitCode: 1), ['-i']), + processRunner.mockProcessesForExecutable['xcrun'] = [ + FakeProcessInfo( + MockProcess(exitCode: 1), ['swift-format', '-i']), ]; Error? commandError; final List output = await runCapturingPrint(runner, [ 'format', '--swift', - '--swift-format-path=swift-format' ], errorHandler: (Error e) { commandError = e; }); @@ -816,28 +781,24 @@ void main() { await runCapturingPrint(runner, [ 'format', '--swift', - '--swift-format-path=/path/to/swift-format' ]); expect( processRunner.recordedCalls, orderedEquals([ - const ProcessCall( - '/path/to/swift-format', - ['--version'], - null, - ), ProcessCall( - '/path/to/swift-format', + 'xcrun', [ + 'swift-format', '-i', ...getPackagesDirRelativePaths(plugin, [sourceFile]) ], packagesDir.path, ), ProcessCall( - '/path/to/swift-format', + 'xcrun', [ + 'swift-format', 'lint', '--parallel', '--strict',