From 479492f814541bf48053326e3b7f4556908ff5c7 Mon Sep 17 00:00:00 2001 From: Shinya Kumagai Date: Mon, 18 Nov 2024 21:15:19 +0900 Subject: [PATCH 1/5] Update the minimum supported SDK version to Flutter 3.16.0/Dart 3.2 --- .github/workflows/app_facing_package.yml | 1 - flutter_custom_tabs/example/pubspec.yaml | 4 ++-- flutter_custom_tabs/pubspec.yaml | 4 ++-- flutter_custom_tabs_android/example/pubspec.yaml | 4 ++-- flutter_custom_tabs_android/pubspec.yaml | 4 ++-- flutter_custom_tabs_ios/example/pubspec.yaml | 4 ++-- flutter_custom_tabs_ios/pubspec.yaml | 4 ++-- flutter_custom_tabs_platform_interface/pubspec.yaml | 4 ++-- flutter_custom_tabs_web/example/pubspec.yaml | 4 ++-- flutter_custom_tabs_web/pubspec.yaml | 4 ++-- 10 files changed, 18 insertions(+), 19 deletions(-) diff --git a/.github/workflows/app_facing_package.yml b/.github/workflows/app_facing_package.yml index 09176baf..e2dfeb57 100644 --- a/.github/workflows/app_facing_package.yml +++ b/.github/workflows/app_facing_package.yml @@ -1,4 +1,3 @@ - name: CI for app-facing package on: diff --git a/flutter_custom_tabs/example/pubspec.yaml b/flutter_custom_tabs/example/pubspec.yaml index 5e1378b5..533bd711 100644 --- a/flutter_custom_tabs/example/pubspec.yaml +++ b/flutter_custom_tabs/example/pubspec.yaml @@ -4,8 +4,8 @@ description: Demonstrates how to use the flutter_custom_tabs plugin. publish_to: none environment: - sdk: ">=3.0.0 <4.0.0" - flutter: ">=3.10.0" + sdk: ^3.2.0 + flutter: ">=3.16.0" dependencies: flutter: diff --git a/flutter_custom_tabs/pubspec.yaml b/flutter_custom_tabs/pubspec.yaml index f67a4c5c..9f872c99 100644 --- a/flutter_custom_tabs/pubspec.yaml +++ b/flutter_custom_tabs/pubspec.yaml @@ -5,8 +5,8 @@ repository: https://github.com/droibit/flutter_custom_tabs/tree/main/flutter_cus publish_to: 'none' environment: - sdk: ">=3.0.0 <4.0.0" - flutter: ">=3.10.0" + sdk: ^3.2.0 + flutter: ">=3.16.0" dependencies: flutter: diff --git a/flutter_custom_tabs_android/example/pubspec.yaml b/flutter_custom_tabs_android/example/pubspec.yaml index 878cd348..0d7f16a9 100644 --- a/flutter_custom_tabs_android/example/pubspec.yaml +++ b/flutter_custom_tabs_android/example/pubspec.yaml @@ -3,8 +3,8 @@ description: Demonstrates how to use the flutter_custom_tabs_android plugin. publish_to: 'none' environment: - sdk: ">=3.0.0 <4.0.0" - flutter: ">=3.10.0" + sdk: ^3.2.0 + flutter: ">=3.16.0" dependencies: flutter: diff --git a/flutter_custom_tabs_android/pubspec.yaml b/flutter_custom_tabs_android/pubspec.yaml index 3be01712..46f36d8e 100644 --- a/flutter_custom_tabs_android/pubspec.yaml +++ b/flutter_custom_tabs_android/pubspec.yaml @@ -5,8 +5,8 @@ repository: https://github.com/droibit/flutter_custom_tabs/tree/main/flutter_cus publish_to: 'none' environment: - sdk: '>=3.0.0 <4.0.0' - flutter: '>=3.10.0' + sdk: ^3.2.0 + flutter: ">=3.16.0" flutter: plugin: diff --git a/flutter_custom_tabs_ios/example/pubspec.yaml b/flutter_custom_tabs_ios/example/pubspec.yaml index e38c4208..d3a69818 100644 --- a/flutter_custom_tabs_ios/example/pubspec.yaml +++ b/flutter_custom_tabs_ios/example/pubspec.yaml @@ -3,8 +3,8 @@ description: Demonstrates how to use the flutter_custom_tabs_ios plugin. publish_to: 'none' environment: - sdk: ">=3.0.0 <4.0.0" - flutter: ">=3.10.0" + sdk: ^3.2.0 + flutter: ">=3.16.0" dependencies: flutter: diff --git a/flutter_custom_tabs_ios/pubspec.yaml b/flutter_custom_tabs_ios/pubspec.yaml index 45da7b4f..affc9309 100644 --- a/flutter_custom_tabs_ios/pubspec.yaml +++ b/flutter_custom_tabs_ios/pubspec.yaml @@ -5,8 +5,8 @@ repository: https://github.com/droibit/flutter_custom_tabs/tree/main/flutter_cus publish_to: 'none' environment: - sdk: '>=3.0.0 <4.0.0' - flutter: '>=3.10.0' + sdk: ^3.2.0 + flutter: ">=3.16.0" dependencies: flutter: diff --git a/flutter_custom_tabs_platform_interface/pubspec.yaml b/flutter_custom_tabs_platform_interface/pubspec.yaml index 67f65a0c..cb418311 100644 --- a/flutter_custom_tabs_platform_interface/pubspec.yaml +++ b/flutter_custom_tabs_platform_interface/pubspec.yaml @@ -5,8 +5,8 @@ repository: https://github.com/droibit/flutter_custom_tabs/tree/main/flutter_cus publish_to: 'none' environment: - sdk: ">=3.0.0 <4.0.0" - flutter: ">=3.10.0" + sdk: ^3.2.0 + flutter: ">=3.16.0" dependencies: flutter: diff --git a/flutter_custom_tabs_web/example/pubspec.yaml b/flutter_custom_tabs_web/example/pubspec.yaml index b5eab505..4717ccb4 100644 --- a/flutter_custom_tabs_web/example/pubspec.yaml +++ b/flutter_custom_tabs_web/example/pubspec.yaml @@ -2,8 +2,8 @@ name: regular_integration_tests publish_to: none environment: - sdk: ">=3.0.0 <4.0.0" - flutter: ">=3.10.0" + sdk: ^3.2.0 + flutter: ">=3.16.0" dependencies: flutter: diff --git a/flutter_custom_tabs_web/pubspec.yaml b/flutter_custom_tabs_web/pubspec.yaml index 8b0276ad..092f8a69 100644 --- a/flutter_custom_tabs_web/pubspec.yaml +++ b/flutter_custom_tabs_web/pubspec.yaml @@ -5,8 +5,8 @@ repository: https://github.com/droibit/flutter_custom_tabs/tree/main/flutter_cus publish_to: 'none' environment: - sdk: ">=3.0.0 <4.0.0" - flutter: ">=3.10.0" + sdk: ^3.2.0 + flutter: ">=3.16.0" flutter: plugin: From 96ecfd4bbb9a7525958a71544fcab23faf0312b0 Mon Sep 17 00:00:00 2001 From: Shinya Kumagai Date: Mon, 18 Nov 2024 21:18:23 +0900 Subject: [PATCH 2/5] Update url_launcher_web dependency to version 2.2.3 --- flutter_custom_tabs_web/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flutter_custom_tabs_web/pubspec.yaml b/flutter_custom_tabs_web/pubspec.yaml index 092f8a69..55f4c5a8 100644 --- a/flutter_custom_tabs_web/pubspec.yaml +++ b/flutter_custom_tabs_web/pubspec.yaml @@ -25,7 +25,7 @@ dependencies: flutter_custom_tabs_platform_interface: path: ../flutter_custom_tabs_platform_interface meta: ^1.10.0 - url_launcher_web: ^2.0.19 + url_launcher_web: ^2.2.3 url_launcher_platform_interface: ^2.2.0 dev_dependencies: From 7a1f140ac4060045908977182568c02f00106d0e Mon Sep 17 00:00:00 2001 From: Shinya Kumagai Date: Mon, 18 Nov 2024 21:19:53 +0900 Subject: [PATCH 3/5] Update plugin_platform_interface dependency to version 2.1.8 --- flutter_custom_tabs/pubspec.yaml | 2 +- flutter_custom_tabs_platform_interface/pubspec.yaml | 2 +- flutter_custom_tabs_web/example/pubspec.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/flutter_custom_tabs/pubspec.yaml b/flutter_custom_tabs/pubspec.yaml index 9f872c99..ca340888 100644 --- a/flutter_custom_tabs/pubspec.yaml +++ b/flutter_custom_tabs/pubspec.yaml @@ -31,7 +31,7 @@ dev_dependencies: sdk: flutter mockito: ^5.4.4 flutter_lints: ^3.0.1 - plugin_platform_interface: ^2.1.7 + plugin_platform_interface: ^2.1.8 flutter: plugin: diff --git a/flutter_custom_tabs_platform_interface/pubspec.yaml b/flutter_custom_tabs_platform_interface/pubspec.yaml index cb418311..50d8550f 100644 --- a/flutter_custom_tabs_platform_interface/pubspec.yaml +++ b/flutter_custom_tabs_platform_interface/pubspec.yaml @@ -12,7 +12,7 @@ dependencies: flutter: sdk: flutter meta: ^1.10.0 - plugin_platform_interface: ^2.1.7 + plugin_platform_interface: ^2.1.8 dev_dependencies: flutter_test: diff --git a/flutter_custom_tabs_web/example/pubspec.yaml b/flutter_custom_tabs_web/example/pubspec.yaml index 4717ccb4..490e476a 100644 --- a/flutter_custom_tabs_web/example/pubspec.yaml +++ b/flutter_custom_tabs_web/example/pubspec.yaml @@ -19,5 +19,5 @@ dev_dependencies: integration_test: sdk: flutter mockito: ^5.4.4 - plugin_platform_interface: ^2.1.7 + plugin_platform_interface: ^2.1.8 flutter_lints: ^3.0.1 From 392d76918324724118c0401f5ead801b4875baec Mon Sep 17 00:00:00 2001 From: Shinya Kumagai Date: Mon, 18 Nov 2024 21:28:59 +0900 Subject: [PATCH 4/5] Update flutter_lints dependency to version 4.0.0 across all packages --- flutter_custom_tabs/example/pubspec.yaml | 2 +- flutter_custom_tabs/pubspec.yaml | 2 +- flutter_custom_tabs_android/example/pubspec.yaml | 2 +- flutter_custom_tabs_android/pubspec.yaml | 2 +- flutter_custom_tabs_ios/example/pubspec.yaml | 2 +- flutter_custom_tabs_ios/pubspec.yaml | 2 +- flutter_custom_tabs_platform_interface/pubspec.yaml | 2 +- flutter_custom_tabs_web/example/pubspec.yaml | 2 +- flutter_custom_tabs_web/pubspec.yaml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/flutter_custom_tabs/example/pubspec.yaml b/flutter_custom_tabs/example/pubspec.yaml index 533bd711..055727be 100644 --- a/flutter_custom_tabs/example/pubspec.yaml +++ b/flutter_custom_tabs/example/pubspec.yaml @@ -17,7 +17,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^3.0.1 + flutter_lints: ^4.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 ca340888..1429834b 100644 --- a/flutter_custom_tabs/pubspec.yaml +++ b/flutter_custom_tabs/pubspec.yaml @@ -30,7 +30,7 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - flutter_lints: ^3.0.1 + flutter_lints: ^4.0.0 plugin_platform_interface: ^2.1.8 flutter: diff --git a/flutter_custom_tabs_android/example/pubspec.yaml b/flutter_custom_tabs_android/example/pubspec.yaml index 0d7f16a9..ad6690e1 100644 --- a/flutter_custom_tabs_android/example/pubspec.yaml +++ b/flutter_custom_tabs_android/example/pubspec.yaml @@ -17,7 +17,7 @@ dev_dependencies: sdk: flutter flutter_test: sdk: flutter - flutter_lints: ^3.0.1 + flutter_lints: ^4.0.0 flutter: uses-material-design: true diff --git a/flutter_custom_tabs_android/pubspec.yaml b/flutter_custom_tabs_android/pubspec.yaml index 46f36d8e..37af30d1 100644 --- a/flutter_custom_tabs_android/pubspec.yaml +++ b/flutter_custom_tabs_android/pubspec.yaml @@ -28,5 +28,5 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^3.0.1 + flutter_lints: ^4.0.0 pigeon: ^17.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 d3a69818..ae508c4c 100644 --- a/flutter_custom_tabs_ios/example/pubspec.yaml +++ b/flutter_custom_tabs_ios/example/pubspec.yaml @@ -18,7 +18,7 @@ dev_dependencies: sdk: flutter flutter_test: sdk: flutter - flutter_lints: ^3.0.1 + flutter_lints: ^4.0.0 flutter: uses-material-design: true diff --git a/flutter_custom_tabs_ios/pubspec.yaml b/flutter_custom_tabs_ios/pubspec.yaml index affc9309..186bd8c9 100644 --- a/flutter_custom_tabs_ios/pubspec.yaml +++ b/flutter_custom_tabs_ios/pubspec.yaml @@ -19,7 +19,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^3.0.1 + flutter_lints: ^4.0.0 pigeon: ^17.0.0 flutter: diff --git a/flutter_custom_tabs_platform_interface/pubspec.yaml b/flutter_custom_tabs_platform_interface/pubspec.yaml index 50d8550f..719ada16 100644 --- a/flutter_custom_tabs_platform_interface/pubspec.yaml +++ b/flutter_custom_tabs_platform_interface/pubspec.yaml @@ -18,4 +18,4 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.2 - flutter_lints: ^3.0.1 \ No newline at end of file + flutter_lints: ^4.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 490e476a..b687cd6c 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: ^3.0.1 + flutter_lints: ^4.0.0 diff --git a/flutter_custom_tabs_web/pubspec.yaml b/flutter_custom_tabs_web/pubspec.yaml index 55f4c5a8..9249406b 100644 --- a/flutter_custom_tabs_web/pubspec.yaml +++ b/flutter_custom_tabs_web/pubspec.yaml @@ -31,4 +31,4 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^3.0.1 + flutter_lints: ^4.0.0 From 8f4c83f83b803007e5d31d714aa9f6d8285aeec0 Mon Sep 17 00:00:00 2001 From: Shinya Kumagai Date: Mon, 18 Nov 2024 22:06:42 +0900 Subject: [PATCH 5/5] Update pigeon dependency to version 21.1.0 in Android and iOS packages --- .../flutter/plugins/customtabs/Messages.java | 41 +++++-- .../lib/src/messages/messages.g.dart | 26 +++-- flutter_custom_tabs_android/pubspec.yaml | 2 +- .../RunnerTests/CustomTabsPluginTest.swift | 12 +-- .../ios/Classes/CustomTabsPlugin.swift | 6 +- .../ios/Classes/messages.g.swift | 102 +++++++++++------- .../lib/src/messages/messages.g.dart | 40 +++---- flutter_custom_tabs_ios/pubspec.yaml | 2 +- 8 files changed, 146 insertions(+), 85 deletions(-) diff --git a/flutter_custom_tabs_android/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/Messages.java b/flutter_custom_tabs_android/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/Messages.java index 2c0a7beb..85ca3f83 100644 --- a/flutter_custom_tabs_android/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/Messages.java +++ b/flutter_custom_tabs_android/android/src/main/java/com/github/droibit/flutter/plugins/customtabs/Messages.java @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v17.1.1), do not edit directly. +// Autogenerated from Pigeon (v21.1.0), do not edit directly. // See also: https://pub.dev/packages/pigeon package com.github.droibit.flutter.plugins.customtabs; @@ -18,6 +18,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; /** Generated class from Pigeon. */ @SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression", "serial"}) @@ -56,6 +57,28 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { } return errorList; } + + private static class PigeonCodec extends StandardMessageCodec { + public static final PigeonCodec INSTANCE = new PigeonCodec(); + + private PigeonCodec() {} + + @Override + protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { + switch (type) { + default: + return super.readValueOfType(type, buffer); + } + } + + @Override + protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { +{ + super.writeValue(stream, value); + } + } + } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CustomTabsApi { @@ -72,14 +95,18 @@ public interface CustomTabsApi { /** The codec used by CustomTabsApi. */ static @NonNull MessageCodec getCodec() { - return new StandardMessageCodec(); + return PigeonCodec.INSTANCE; } /**Sets up an instance of `CustomTabsApi` to handle messages through the `binaryMessenger`. */ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable CustomTabsApi api) { + setUp(binaryMessenger, "", api); + } + static void setUp(@NonNull BinaryMessenger binaryMessenger, @NonNull String messageChannelSuffix, @Nullable CustomTabsApi api) { + messageChannelSuffix = messageChannelSuffix.isEmpty() ? "" : "." + messageChannelSuffix; { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.flutter_custom_tabs_android.CustomTabsApi.launch", getCodec()); + binaryMessenger, "dev.flutter.pigeon.flutter_custom_tabs_android.CustomTabsApi.launch" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -105,7 +132,7 @@ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable CustomTabs { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.flutter_custom_tabs_android.CustomTabsApi.closeAllIfPossible", getCodec()); + binaryMessenger, "dev.flutter.pigeon.flutter_custom_tabs_android.CustomTabsApi.closeAllIfPossible" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -127,7 +154,7 @@ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable CustomTabs { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.flutter_custom_tabs_android.CustomTabsApi.warmup", getCodec()); + binaryMessenger, "dev.flutter.pigeon.flutter_custom_tabs_android.CustomTabsApi.warmup" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -151,7 +178,7 @@ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable CustomTabs { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.flutter_custom_tabs_android.CustomTabsApi.mayLaunch", getCodec()); + binaryMessenger, "dev.flutter.pigeon.flutter_custom_tabs_android.CustomTabsApi.mayLaunch" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -176,7 +203,7 @@ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable CustomTabs { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.flutter_custom_tabs_android.CustomTabsApi.invalidate", getCodec()); + binaryMessenger, "dev.flutter.pigeon.flutter_custom_tabs_android.CustomTabsApi.invalidate" + messageChannelSuffix, getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { 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 12d6f885..1484dbdc 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 (v17.1.1), do not edit directly. +// Autogenerated from Pigeon (v21.1.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 @@ -15,18 +15,26 @@ PlatformException _createConnectionError(String channelName) { ); } + +class _PigeonCodec extends StandardMessageCodec { + const _PigeonCodec(); +} + class CustomTabsApi { /// Constructor for [CustomTabsApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - CustomTabsApi({BinaryMessenger? binaryMessenger}) - : __pigeon_binaryMessenger = binaryMessenger; + CustomTabsApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : __pigeon_binaryMessenger = binaryMessenger, + __pigeon_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? __pigeon_binaryMessenger; - static const MessageCodec pigeonChannelCodec = StandardMessageCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); + + final String __pigeon_messageChannelSuffix; Future launch(String urlString, {required bool prefersDeepLink, Map? options,}) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.flutter_custom_tabs_android.CustomTabsApi.launch'; + final String __pigeon_channelName = 'dev.flutter.pigeon.flutter_custom_tabs_android.CustomTabsApi.launch$__pigeon_messageChannelSuffix'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, @@ -48,7 +56,7 @@ class CustomTabsApi { } Future closeAllIfPossible() async { - const String __pigeon_channelName = 'dev.flutter.pigeon.flutter_custom_tabs_android.CustomTabsApi.closeAllIfPossible'; + final String __pigeon_channelName = 'dev.flutter.pigeon.flutter_custom_tabs_android.CustomTabsApi.closeAllIfPossible$__pigeon_messageChannelSuffix'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, @@ -70,7 +78,7 @@ class CustomTabsApi { } Future warmup(Map? options) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.flutter_custom_tabs_android.CustomTabsApi.warmup'; + final String __pigeon_channelName = 'dev.flutter.pigeon.flutter_custom_tabs_android.CustomTabsApi.warmup$__pigeon_messageChannelSuffix'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, @@ -92,7 +100,7 @@ class CustomTabsApi { } Future mayLaunch(List urls, String sessionPackageName) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.flutter_custom_tabs_android.CustomTabsApi.mayLaunch'; + final String __pigeon_channelName = 'dev.flutter.pigeon.flutter_custom_tabs_android.CustomTabsApi.mayLaunch$__pigeon_messageChannelSuffix'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, @@ -114,7 +122,7 @@ class CustomTabsApi { } Future invalidate(String sessionPackageName) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.flutter_custom_tabs_android.CustomTabsApi.invalidate'; + final String __pigeon_channelName = 'dev.flutter.pigeon.flutter_custom_tabs_android.CustomTabsApi.invalidate$__pigeon_messageChannelSuffix'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, diff --git a/flutter_custom_tabs_android/pubspec.yaml b/flutter_custom_tabs_android/pubspec.yaml index 37af30d1..fc8cbaf1 100644 --- a/flutter_custom_tabs_android/pubspec.yaml +++ b/flutter_custom_tabs_android/pubspec.yaml @@ -29,4 +29,4 @@ dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^4.0.0 - pigeon: ^17.0.0 \ No newline at end of file + pigeon: ^21.1.0 \ No newline at end of file diff --git a/flutter_custom_tabs_ios/example/ios/RunnerTests/CustomTabsPluginTest.swift b/flutter_custom_tabs_ios/example/ios/RunnerTests/CustomTabsPluginTest.swift index 6d144e69..609f95ac 100644 --- a/flutter_custom_tabs_ios/example/ios/RunnerTests/CustomTabsPluginTest.swift +++ b/flutter_custom_tabs_ios/example/ios/RunnerTests/CustomTabsPluginTest.swift @@ -40,9 +40,9 @@ final class CustomTabsPluginTest: XCTestCase { let options = SFSafariViewControllerOptions() plugin.launchURL(url.absoluteString, prefersDeepLink: false, options: options) { result in if case let .failure(error) = result { - XCTAssertTrue(error is FlutterError) - let actualError = error as! FlutterError - XCTAssertEqual(actualError.code, FlutterError.errorCode) + XCTAssertTrue(error is PigeonError) + let actualError = error as! PigeonError + XCTAssertEqual(actualError.code, PigeonError.errorCode) } else { XCTFail("error") } @@ -74,9 +74,9 @@ final class CustomTabsPluginTest: XCTestCase { let url = URL(string: "https://example.com")! plugin.launchURL(url.absoluteString, prefersDeepLink: false, options: nil) { result in if case let .failure(error) = result { - XCTAssertTrue(error is FlutterError) - let actualError = error as! FlutterError - XCTAssertEqual(actualError.code, FlutterError.errorCode) + XCTAssertTrue(error is PigeonError) + let actualError = error as! PigeonError + XCTAssertEqual(actualError.code, PigeonError.errorCode) } else { XCTFail("error") } diff --git a/flutter_custom_tabs_ios/ios/Classes/CustomTabsPlugin.swift b/flutter_custom_tabs_ios/ios/Classes/CustomTabsPlugin.swift index b4e1fb80..0c6f99ff 100644 --- a/flutter_custom_tabs_ios/ios/Classes/CustomTabsPlugin.swift +++ b/flutter_custom_tabs_ios/ios/Classes/CustomTabsPlugin.swift @@ -65,7 +65,7 @@ public class CustomTabsPlugin: NSObject, FlutterPlugin, CustomTabsApi { completion(.success(())) } else { completion(.failure( - FlutterError(message: "Failed to launch external browser.") + PigeonError(message: "Failed to launch external browser.") )) } } @@ -78,14 +78,14 @@ public class CustomTabsPlugin: NSObject, FlutterPlugin, CustomTabsApi { completion(.success(())) } else { completion(.failure( - FlutterError(message: "Failed to launch SFSafariViewController.") + PigeonError(message: "Failed to launch SFSafariViewController.") )) } } } } -extension FlutterError: Error { +extension PigeonError { convenience init(message: String) { self.init(code: Self.errorCode, message: message, details: nil) } diff --git a/flutter_custom_tabs_ios/ios/Classes/messages.g.swift b/flutter_custom_tabs_ios/ios/Classes/messages.g.swift index 4f76248b..430188b4 100644 --- a/flutter_custom_tabs_ios/ios/Classes/messages.g.swift +++ b/flutter_custom_tabs_ios/ios/Classes/messages.g.swift @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v17.1.1), do not edit directly. +// Autogenerated from Pigeon (v21.1.0), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation @@ -11,11 +11,36 @@ import Foundation #error("Unsupported platform.") #endif +/// Error class for passing custom error details to Dart side. +final class PigeonError: Error { + let code: String + let message: String? + let details: Any? + + init(code: String, message: String?, details: Any?) { + self.code = code + self.message = message + self.details = details + } + + var localizedDescription: String { + return + "PigeonError(code: \(code), message: \(message ?? ""), details: \(details ?? "")" + } +} + private func wrapResult(_ result: Any?) -> [Any?] { return [result] } private func wrapError(_ error: Any) -> [Any?] { + if let pigeonError = error as? PigeonError { + return [ + pigeonError.code, + pigeonError.message, + pigeonError.details, + ] + } if let flutterError = error as? FlutterError { return [ flutterError.code, @@ -49,17 +74,15 @@ struct SFSafariViewControllerOptions { var modalPresentationStyle: Int64? = nil var pageSheet: UISheetPresentationControllerConfiguration? = nil - static func fromList(_ list: [Any?]) -> SFSafariViewControllerOptions? { - let preferredBarTintColor: Int64? = isNullish(list[0]) ? nil : (list[0] is Int64? ? list[0] as! Int64? : Int64(list[0] as! Int32)) - let preferredControlTintColor: Int64? = isNullish(list[1]) ? nil : (list[1] is Int64? ? list[1] as! Int64? : Int64(list[1] as! Int32)) - let barCollapsingEnabled: Bool? = nilOrValue(list[2]) - let entersReaderIfAvailable: Bool? = nilOrValue(list[3]) - let dismissButtonStyle: Int64? = isNullish(list[4]) ? nil : (list[4] is Int64? ? list[4] as! Int64? : Int64(list[4] as! Int32)) - let modalPresentationStyle: Int64? = isNullish(list[5]) ? nil : (list[5] is Int64? ? list[5] as! Int64? : Int64(list[5] as! Int32)) - var pageSheet: UISheetPresentationControllerConfiguration? = nil - if let pageSheetList: [Any?] = nilOrValue(list[6]) { - pageSheet = UISheetPresentationControllerConfiguration.fromList(pageSheetList) - } + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> SFSafariViewControllerOptions? { + let preferredBarTintColor: Int64? = isNullish(__pigeon_list[0]) ? nil : (__pigeon_list[0] is Int64? ? __pigeon_list[0] as! Int64? : Int64(__pigeon_list[0] as! Int32)) + let preferredControlTintColor: Int64? = isNullish(__pigeon_list[1]) ? nil : (__pigeon_list[1] is Int64? ? __pigeon_list[1] as! Int64? : Int64(__pigeon_list[1] as! Int32)) + let barCollapsingEnabled: Bool? = nilOrValue(__pigeon_list[2]) + let entersReaderIfAvailable: Bool? = nilOrValue(__pigeon_list[3]) + let dismissButtonStyle: Int64? = isNullish(__pigeon_list[4]) ? nil : (__pigeon_list[4] is Int64? ? __pigeon_list[4] as! Int64? : Int64(__pigeon_list[4] as! Int32)) + let modalPresentationStyle: Int64? = isNullish(__pigeon_list[5]) ? nil : (__pigeon_list[5] is Int64? ? __pigeon_list[5] as! Int64? : Int64(__pigeon_list[5] as! Int32)) + let pageSheet: UISheetPresentationControllerConfiguration? = nilOrValue(__pigeon_list[6]) return SFSafariViewControllerOptions( preferredBarTintColor: preferredBarTintColor, @@ -79,7 +102,7 @@ struct SFSafariViewControllerOptions { entersReaderIfAvailable, dismissButtonStyle, modalPresentationStyle, - pageSheet?.toList(), + pageSheet, ] } } @@ -93,13 +116,14 @@ struct UISheetPresentationControllerConfiguration { var prefersEdgeAttachedInCompactHeight: Bool? = nil var preferredCornerRadius: Double? = nil - static func fromList(_ list: [Any?]) -> UISheetPresentationControllerConfiguration? { - let detents = list[0] as! [String?] - let largestUndimmedDetentIdentifier: String? = nilOrValue(list[1]) - let prefersScrollingExpandsWhenScrolledToEdge: Bool? = nilOrValue(list[2]) - let prefersGrabberVisible: Bool? = nilOrValue(list[3]) - let prefersEdgeAttachedInCompactHeight: Bool? = nilOrValue(list[4]) - let preferredCornerRadius: Double? = nilOrValue(list[5]) + // swift-format-ignore: AlwaysUseLowerCamelCase + static func fromList(_ __pigeon_list: [Any?]) -> UISheetPresentationControllerConfiguration? { + let detents = __pigeon_list[0] as! [String?] + let largestUndimmedDetentIdentifier: String? = nilOrValue(__pigeon_list[1]) + let prefersScrollingExpandsWhenScrolledToEdge: Bool? = nilOrValue(__pigeon_list[2]) + let prefersGrabberVisible: Bool? = nilOrValue(__pigeon_list[3]) + let prefersEdgeAttachedInCompactHeight: Bool? = nilOrValue(__pigeon_list[4]) + let preferredCornerRadius: Double? = nilOrValue(__pigeon_list[5]) return UISheetPresentationControllerConfiguration( detents: detents, @@ -121,13 +145,12 @@ struct UISheetPresentationControllerConfiguration { ] } } - -private class CustomTabsApiCodecReader: FlutterStandardReader { +private class messagesPigeonCodecReader: FlutterStandardReader { override func readValue(ofType type: UInt8) -> Any? { switch type { - case 128: - return SFSafariViewControllerOptions.fromList(self.readValue() as! [Any?]) case 129: + return SFSafariViewControllerOptions.fromList(self.readValue() as! [Any?]) + case 130: return UISheetPresentationControllerConfiguration.fromList(self.readValue() as! [Any?]) default: return super.readValue(ofType: type) @@ -135,13 +158,13 @@ private class CustomTabsApiCodecReader: FlutterStandardReader { } } -private class CustomTabsApiCodecWriter: FlutterStandardWriter { +private class messagesPigeonCodecWriter: FlutterStandardWriter { override func writeValue(_ value: Any) { if let value = value as? SFSafariViewControllerOptions { - super.writeByte(128) + super.writeByte(129) super.writeValue(value.toList()) } else if let value = value as? UISheetPresentationControllerConfiguration { - super.writeByte(129) + super.writeByte(130) super.writeValue(value.toList()) } else { super.writeValue(value) @@ -149,20 +172,21 @@ private class CustomTabsApiCodecWriter: FlutterStandardWriter { } } -private class CustomTabsApiCodecReaderWriter: FlutterStandardReaderWriter { +private class messagesPigeonCodecReaderWriter: FlutterStandardReaderWriter { override func reader(with data: Data) -> FlutterStandardReader { - return CustomTabsApiCodecReader(data: data) + return messagesPigeonCodecReader(data: data) } override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return CustomTabsApiCodecWriter(data: data) + return messagesPigeonCodecWriter(data: data) } } -class CustomTabsApiCodec: FlutterStandardMessageCodec { - static let shared = CustomTabsApiCodec(readerWriter: CustomTabsApiCodecReaderWriter()) +class messagesPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable { + static let shared = messagesPigeonCodec(readerWriter: messagesPigeonCodecReaderWriter()) } + /// Generated protocol from Pigeon that represents a handler of messages from Flutter. protocol CustomTabsApi { func launchURL(_ urlString: String, prefersDeepLink: Bool, options: SFSafariViewControllerOptions?, completion: @escaping (Result) -> Void) @@ -173,11 +197,11 @@ protocol CustomTabsApi { /// Generated setup class from Pigeon to handle messages through the `binaryMessenger`. class CustomTabsApiSetup { - /// The codec used by CustomTabsApi. - static var codec: FlutterStandardMessageCodec { CustomTabsApiCodec.shared } + static var codec: FlutterStandardMessageCodec { messagesPigeonCodec.shared } /// Sets up an instance of `CustomTabsApi` to handle messages through the `binaryMessenger`. - static func setUp(binaryMessenger: FlutterBinaryMessenger, api: CustomTabsApi?) { - let launchChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.flutter_custom_tabs_ios.CustomTabsApi.launch", binaryMessenger: binaryMessenger, codec: codec) + static func setUp(binaryMessenger: FlutterBinaryMessenger, api: CustomTabsApi?, messageChannelSuffix: String = "") { + let channelSuffix = messageChannelSuffix.count > 0 ? ".\(messageChannelSuffix)" : "" + let launchChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.flutter_custom_tabs_ios.CustomTabsApi.launch\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { launchChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -196,7 +220,7 @@ class CustomTabsApiSetup { } else { launchChannel.setMessageHandler(nil) } - let closeAllIfPossibleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.flutter_custom_tabs_ios.CustomTabsApi.closeAllIfPossible", binaryMessenger: binaryMessenger, codec: codec) + let closeAllIfPossibleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.flutter_custom_tabs_ios.CustomTabsApi.closeAllIfPossible\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { closeAllIfPossibleChannel.setMessageHandler { _, reply in api.closeAllIfPossible { result in @@ -211,7 +235,7 @@ class CustomTabsApiSetup { } else { closeAllIfPossibleChannel.setMessageHandler(nil) } - let mayLaunchChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.flutter_custom_tabs_ios.CustomTabsApi.mayLaunch", binaryMessenger: binaryMessenger, codec: codec) + let mayLaunchChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.flutter_custom_tabs_ios.CustomTabsApi.mayLaunch\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { mayLaunchChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -226,7 +250,7 @@ class CustomTabsApiSetup { } else { mayLaunchChannel.setMessageHandler(nil) } - let invalidateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.flutter_custom_tabs_ios.CustomTabsApi.invalidate", binaryMessenger: binaryMessenger, codec: codec) + let invalidateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.flutter_custom_tabs_ios.CustomTabsApi.invalidate\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) if let api = api { invalidateChannel.setMessageHandler { message, reply in let args = message as! [Any?] 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 11256b0f..f6e83e3f 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 (v17.1.1), do not edit directly. +// Autogenerated from Pigeon (v21.1.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 @@ -48,7 +48,7 @@ class SFSafariViewControllerOptions { entersReaderIfAvailable, dismissButtonStyle, modalPresentationStyle, - pageSheet?.encode(), + pageSheet, ]; } @@ -61,9 +61,7 @@ class SFSafariViewControllerOptions { entersReaderIfAvailable: result[3] as bool?, dismissButtonStyle: result[4] as int?, modalPresentationStyle: result[5] as int?, - pageSheet: result[6] != null - ? UISheetPresentationControllerConfiguration.decode(result[6]! as List) - : null, + pageSheet: result[6] as UISheetPresentationControllerConfiguration?, ); } } @@ -114,16 +112,17 @@ class UISheetPresentationControllerConfiguration { } } -class _CustomTabsApiCodec extends StandardMessageCodec { - const _CustomTabsApiCodec(); + +class _PigeonCodec extends StandardMessageCodec { + const _PigeonCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { if (value is SFSafariViewControllerOptions) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else if (value is UISheetPresentationControllerConfiguration) { buffer.putUint8(129); writeValue(buffer, value.encode()); + } else if (value is UISheetPresentationControllerConfiguration) { + buffer.putUint8(130); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -132,9 +131,9 @@ class _CustomTabsApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: - return SFSafariViewControllerOptions.decode(readValue(buffer)!); case 129: + return SFSafariViewControllerOptions.decode(readValue(buffer)!); + case 130: return UISheetPresentationControllerConfiguration.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -146,14 +145,17 @@ class CustomTabsApi { /// Constructor for [CustomTabsApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default /// BinaryMessenger will be used which routes to the host platform. - CustomTabsApi({BinaryMessenger? binaryMessenger}) - : __pigeon_binaryMessenger = binaryMessenger; + CustomTabsApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) + : __pigeon_binaryMessenger = binaryMessenger, + __pigeon_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; final BinaryMessenger? __pigeon_binaryMessenger; - static const MessageCodec pigeonChannelCodec = _CustomTabsApiCodec(); + static const MessageCodec pigeonChannelCodec = _PigeonCodec(); + + final String __pigeon_messageChannelSuffix; Future launch(String urlString, {required bool prefersDeepLink, SFSafariViewControllerOptions? options,}) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.flutter_custom_tabs_ios.CustomTabsApi.launch'; + final String __pigeon_channelName = 'dev.flutter.pigeon.flutter_custom_tabs_ios.CustomTabsApi.launch$__pigeon_messageChannelSuffix'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, @@ -175,7 +177,7 @@ class CustomTabsApi { } Future closeAllIfPossible() async { - const String __pigeon_channelName = 'dev.flutter.pigeon.flutter_custom_tabs_ios.CustomTabsApi.closeAllIfPossible'; + final String __pigeon_channelName = 'dev.flutter.pigeon.flutter_custom_tabs_ios.CustomTabsApi.closeAllIfPossible$__pigeon_messageChannelSuffix'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, @@ -197,7 +199,7 @@ class CustomTabsApi { } Future mayLaunch(List urlStrings) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.flutter_custom_tabs_ios.CustomTabsApi.mayLaunch'; + final String __pigeon_channelName = 'dev.flutter.pigeon.flutter_custom_tabs_ios.CustomTabsApi.mayLaunch$__pigeon_messageChannelSuffix'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, @@ -219,7 +221,7 @@ class CustomTabsApi { } Future invalidate(String sessionId) async { - const String __pigeon_channelName = 'dev.flutter.pigeon.flutter_custom_tabs_ios.CustomTabsApi.invalidate'; + final String __pigeon_channelName = 'dev.flutter.pigeon.flutter_custom_tabs_ios.CustomTabsApi.invalidate$__pigeon_messageChannelSuffix'; final BasicMessageChannel __pigeon_channel = BasicMessageChannel( __pigeon_channelName, pigeonChannelCodec, diff --git a/flutter_custom_tabs_ios/pubspec.yaml b/flutter_custom_tabs_ios/pubspec.yaml index 186bd8c9..2857fdea 100644 --- a/flutter_custom_tabs_ios/pubspec.yaml +++ b/flutter_custom_tabs_ios/pubspec.yaml @@ -20,7 +20,7 @@ dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^4.0.0 - pigeon: ^17.0.0 + pigeon: ^21.1.0 flutter: plugin: