diff --git a/flutter_custom_tabs/example/pubspec.yaml b/flutter_custom_tabs/example/pubspec.yaml index 7748802..4dbaf5c 100644 --- a/flutter_custom_tabs/example/pubspec.yaml +++ b/flutter_custom_tabs/example/pubspec.yaml @@ -16,7 +16,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^4.0.0 + flutter_lints: ^5.0.0 flutter: uses-material-design: true \ No newline at end of file diff --git a/flutter_custom_tabs/pubspec.yaml b/flutter_custom_tabs/pubspec.yaml index f784d72..86e70e7 100644 --- a/flutter_custom_tabs/pubspec.yaml +++ b/flutter_custom_tabs/pubspec.yaml @@ -31,7 +31,7 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - flutter_lints: ^4.0.0 + flutter_lints: ^5.0.0 plugin_platform_interface: ^2.1.8 flutter: diff --git a/flutter_custom_tabs_android/android/src/main/kotlin/com/github/droibit/flutter/plugins/customtabs/Messages.kt b/flutter_custom_tabs_android/android/src/main/kotlin/com/github/droibit/flutter/plugins/customtabs/Messages.kt index b6d7500..cb9795e 100644 --- a/flutter_custom_tabs_android/android/src/main/kotlin/com/github/droibit/flutter/plugins/customtabs/Messages.kt +++ b/flutter_custom_tabs_android/android/src/main/kotlin/com/github/droibit/flutter/plugins/customtabs/Messages.kt @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v22.7.0), do not edit directly. +// Autogenerated from Pigeon (v26.0.1), do not edit directly. // See also: https://pub.dev/packages/pigeon @file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") @@ -13,24 +13,26 @@ import io.flutter.plugin.common.StandardMethodCodec import io.flutter.plugin.common.StandardMessageCodec import java.io.ByteArrayOutputStream import java.nio.ByteBuffer +private object MessagesPigeonUtils { -private fun wrapResult(result: Any?): List { - return listOf(result) -} + fun wrapResult(result: Any?): List { + return listOf(result) + } -private fun wrapError(exception: Throwable): List { - return if (exception is FlutterError) { - listOf( - exception.code, - exception.message, - exception.details - ) - } else { - listOf( - exception.javaClass.simpleName, - exception.toString(), - "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception) - ) + fun wrapError(exception: Throwable): List { + return if (exception is FlutterError) { + listOf( + exception.code, + exception.message, + exception.details + ) + } else { + listOf( + exception.javaClass.simpleName, + exception.toString(), + "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception) + ) + } } } @@ -83,7 +85,7 @@ interface CustomTabsApi { api.launch(urlStringArg, prefersDeepLinkArg, optionsArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + MessagesPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -99,7 +101,7 @@ interface CustomTabsApi { api.closeAllIfPossible() listOf(null) } catch (exception: Throwable) { - wrapError(exception) + MessagesPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -116,7 +118,7 @@ interface CustomTabsApi { val wrapped: List = try { listOf(api.warmup(optionsArg)) } catch (exception: Throwable) { - wrapError(exception) + MessagesPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -135,7 +137,7 @@ interface CustomTabsApi { api.mayLaunch(urlsArg, sessionPackageNameArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + MessagesPigeonUtils.wrapError(exception) } reply.reply(wrapped) } @@ -153,7 +155,7 @@ interface CustomTabsApi { api.invalidate(sessionPackageNameArg) listOf(null) } catch (exception: Throwable) { - wrapError(exception) + MessagesPigeonUtils.wrapError(exception) } reply.reply(wrapped) } diff --git a/flutter_custom_tabs_android/example/pubspec.yaml b/flutter_custom_tabs_android/example/pubspec.yaml index 6dfd1a0..a32cec0 100644 --- a/flutter_custom_tabs_android/example/pubspec.yaml +++ b/flutter_custom_tabs_android/example/pubspec.yaml @@ -15,7 +15,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^4.0.0 + flutter_lints: ^5.0.0 flutter: uses-material-design: true diff --git a/flutter_custom_tabs_android/lib/src/messages/messages.g.dart b/flutter_custom_tabs_android/lib/src/messages/messages.g.dart index 2d8da97..b2732ea 100644 --- a/flutter_custom_tabs_android/lib/src/messages/messages.g.dart +++ b/flutter_custom_tabs_android/lib/src/messages/messages.g.dart @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v22.7.0), do not edit directly. +// Autogenerated from Pigeon (v26.0.1), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers @@ -57,8 +57,9 @@ class CustomTabsApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send([urlString, prefersDeepLink, options]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([urlString, prefersDeepLink, options]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -79,8 +80,9 @@ class CustomTabsApi { 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) { @@ -101,8 +103,9 @@ class CustomTabsApi { 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) { @@ -123,8 +126,9 @@ class CustomTabsApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send([urls, sessionPackageName]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([urls, sessionPackageName]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -145,8 +149,9 @@ class CustomTabsApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send([sessionPackageName]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([sessionPackageName]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { diff --git a/flutter_custom_tabs_android/pubspec.yaml b/flutter_custom_tabs_android/pubspec.yaml index 2950ad8..c76e73b 100644 --- a/flutter_custom_tabs_android/pubspec.yaml +++ b/flutter_custom_tabs_android/pubspec.yaml @@ -30,5 +30,5 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^4.0.0 - pigeon: ^22.7.0 \ No newline at end of file + flutter_lints: ^5.0.0 + pigeon: ^26.0.0 \ No newline at end of file diff --git a/flutter_custom_tabs_ios/example/pubspec.yaml b/flutter_custom_tabs_ios/example/pubspec.yaml index e81f306..d0761f1 100644 --- a/flutter_custom_tabs_ios/example/pubspec.yaml +++ b/flutter_custom_tabs_ios/example/pubspec.yaml @@ -16,7 +16,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^4.0.0 + flutter_lints: ^5.0.0 flutter: uses-material-design: true diff --git a/flutter_custom_tabs_ios/ios/flutter_custom_tabs_ios/Sources/flutter_custom_tabs_ios/messages.g.swift b/flutter_custom_tabs_ios/ios/flutter_custom_tabs_ios/Sources/flutter_custom_tabs_ios/messages.g.swift index b62cfc3..6855912 100644 --- a/flutter_custom_tabs_ios/ios/flutter_custom_tabs_ios/Sources/flutter_custom_tabs_ios/messages.g.swift +++ b/flutter_custom_tabs_ios/ios/flutter_custom_tabs_ios/Sources/flutter_custom_tabs_ios/messages.g.swift @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v22.7.0), do not edit directly. +// Autogenerated from Pigeon (v26.0.1), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation @@ -15,9 +15,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 @@ -26,7 +26,7 @@ final class PigeonError: Error { var localizedDescription: String { return "PigeonError(code: \(code), message: \(message ?? ""), details: \(details ?? "")" - } + } } private func wrapResult(_ result: Any?) -> [Any?] { @@ -64,8 +64,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)) +} + + + /// Generated class from Pigeon that represents data sent in messages. -struct SFSafariViewControllerOptions { +struct SFSafariViewControllerOptions: Hashable { var preferredBarTintColor: Int64? = nil var preferredControlTintColor: Int64? = nil var barCollapsingEnabled: Bool? = nil @@ -106,10 +170,15 @@ struct SFSafariViewControllerOptions { pageSheet, ] } + static func == (lhs: SFSafariViewControllerOptions, rhs: SFSafariViewControllerOptions) -> Bool { + return deepEqualsmessages(lhs.toList(), rhs.toList()) } + func hash(into hasher: inout Hasher) { + deepHashmessages(value: toList(), hasher: &hasher) + } } /// Generated class from Pigeon that represents data sent in messages. -struct UISheetPresentationControllerConfiguration { +struct UISheetPresentationControllerConfiguration: Hashable { var detents: [String] var largestUndimmedDetentIdentifier: String? = nil var prefersScrollingExpandsWhenScrolledToEdge: Bool? = nil @@ -146,6 +215,11 @@ struct UISheetPresentationControllerConfiguration { preferredCornerRadius, ] } + static func == (lhs: UISheetPresentationControllerConfiguration, rhs: UISheetPresentationControllerConfiguration) -> Bool { + return deepEqualsmessages(lhs.toList(), rhs.toList()) } + func hash(into hasher: inout Hasher) { + deepHashmessages(value: toList(), hasher: &hasher) + } } private class MessagesPigeonCodecReader: FlutterStandardReader { diff --git a/flutter_custom_tabs_ios/lib/src/messages/messages.g.dart b/flutter_custom_tabs_ios/lib/src/messages/messages.g.dart index 4fdfb0f..08736a9 100644 --- a/flutter_custom_tabs_ios/lib/src/messages/messages.g.dart +++ b/flutter_custom_tabs_ios/lib/src/messages/messages.g.dart @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v22.7.0), do not edit directly. +// Autogenerated from Pigeon (v26.0.1), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers @@ -14,6 +14,20 @@ PlatformException _createConnectionError(String channelName) { message: 'Unable to establish connection on channel: "$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; +} + class SFSafariViewControllerOptions { SFSafariViewControllerOptions({ @@ -40,7 +54,7 @@ class SFSafariViewControllerOptions { UISheetPresentationControllerConfiguration? pageSheet; - Object encode() { + List _toList() { return [ preferredBarTintColor, preferredControlTintColor, @@ -52,6 +66,9 @@ class SFSafariViewControllerOptions { ]; } + Object encode() { + return _toList(); } + static SFSafariViewControllerOptions decode(Object result) { result as List; return SFSafariViewControllerOptions( @@ -64,6 +81,23 @@ class SFSafariViewControllerOptions { pageSheet: result[6] as UISheetPresentationControllerConfiguration?, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! SFSafariViewControllerOptions || 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 UISheetPresentationControllerConfiguration { @@ -88,7 +122,7 @@ class UISheetPresentationControllerConfiguration { double? preferredCornerRadius; - Object encode() { + List _toList() { return [ detents, largestUndimmedDetentIdentifier, @@ -99,6 +133,9 @@ class UISheetPresentationControllerConfiguration { ]; } + Object encode() { + return _toList(); } + static UISheetPresentationControllerConfiguration decode(Object result) { result as List; return UISheetPresentationControllerConfiguration( @@ -110,6 +147,23 @@ class UISheetPresentationControllerConfiguration { preferredCornerRadius: result[5] as double?, ); } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! UISheetPresentationControllerConfiguration || 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()) +; } @@ -164,8 +218,9 @@ class CustomTabsApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send([urlString, prefersDeepLink, options]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([urlString, prefersDeepLink, options]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -186,8 +241,9 @@ class CustomTabsApi { 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) { @@ -208,8 +264,9 @@ class CustomTabsApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send([urlStrings]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([urlStrings]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -230,8 +287,9 @@ class CustomTabsApi { pigeonChannelCodec, binaryMessenger: pigeonVar_binaryMessenger, ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send([sessionId]); final List? pigeonVar_replyList = - await pigeonVar_channel.send([sessionId]) as List?; + await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { diff --git a/flutter_custom_tabs_ios/pubspec.yaml b/flutter_custom_tabs_ios/pubspec.yaml index b4e2e16..d077fbb 100644 --- a/flutter_custom_tabs_ios/pubspec.yaml +++ b/flutter_custom_tabs_ios/pubspec.yaml @@ -21,8 +21,8 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^4.0.0 - pigeon: ^22.7.0 + flutter_lints: ^5.0.0 + pigeon: ^26.0.0 flutter: plugin: diff --git a/flutter_custom_tabs_platform_interface/pubspec.yaml b/flutter_custom_tabs_platform_interface/pubspec.yaml index a9a155d..e6f2e55 100644 --- a/flutter_custom_tabs_platform_interface/pubspec.yaml +++ b/flutter_custom_tabs_platform_interface/pubspec.yaml @@ -19,5 +19,5 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - mockito: ^5.4.2 - flutter_lints: ^4.0.0 \ No newline at end of file + mockito: ^5.4.4 + flutter_lints: ^5.0.0 \ No newline at end of file diff --git a/flutter_custom_tabs_web/example/pubspec.yaml b/flutter_custom_tabs_web/example/pubspec.yaml index cb3fcb3..8f564ec 100644 --- a/flutter_custom_tabs_web/example/pubspec.yaml +++ b/flutter_custom_tabs_web/example/pubspec.yaml @@ -20,4 +20,4 @@ dev_dependencies: sdk: flutter mockito: ^5.4.4 plugin_platform_interface: ^2.1.8 - flutter_lints: ^4.0.0 + flutter_lints: ^5.0.0 diff --git a/flutter_custom_tabs_web/pubspec.yaml b/flutter_custom_tabs_web/pubspec.yaml index 88e713e..ec42092 100644 --- a/flutter_custom_tabs_web/pubspec.yaml +++ b/flutter_custom_tabs_web/pubspec.yaml @@ -33,4 +33,4 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^4.0.0 + flutter_lints: ^5.0.0