Skip to content

Commit

Permalink
Merge pull request #214 from droibit/feature/update
Browse files Browse the repository at this point in the history
Update dependencies and minimum SDK to Flutter 3.16.0/Dart 3.2
  • Loading branch information
droibit authored Nov 18, 2024
2 parents 7858046 + 8f4c83f commit 24f1a4d
Show file tree
Hide file tree
Showing 16 changed files with 177 additions and 117 deletions.
1 change: 0 additions & 1 deletion .github/workflows/app_facing_package.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: CI for app-facing package

on:
Expand Down
6 changes: 3 additions & 3 deletions flutter_custom_tabs/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
8 changes: 4 additions & 4 deletions flutter_custom_tabs/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -30,8 +30,8 @@ dev_dependencies:
flutter_test:
sdk: flutter
mockito: ^5.4.4
flutter_lints: ^3.0.1
plugin_platform_interface: ^2.1.7
flutter_lints: ^4.0.0
plugin_platform_interface: ^2.1.8

flutter:
plugin:
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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"})
Expand Down Expand Up @@ -56,6 +57,28 @@ protected static ArrayList<Object> 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 {

Expand All @@ -72,14 +95,18 @@ public interface CustomTabsApi {

/** The codec used by CustomTabsApi. */
static @NonNull MessageCodec<Object> 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<Object> 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) -> {
Expand All @@ -105,7 +132,7 @@ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable CustomTabs
{
BasicMessageChannel<Object> 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) -> {
Expand All @@ -127,7 +154,7 @@ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable CustomTabs
{
BasicMessageChannel<Object> 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) -> {
Expand All @@ -151,7 +178,7 @@ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable CustomTabs
{
BasicMessageChannel<Object> 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) -> {
Expand All @@ -176,7 +203,7 @@ static void setUp(@NonNull BinaryMessenger binaryMessenger, @Nullable CustomTabs
{
BasicMessageChannel<Object> 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) -> {
Expand Down
6 changes: 3 additions & 3 deletions flutter_custom_tabs_android/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
26 changes: 17 additions & 9 deletions flutter_custom_tabs_android/lib/src/messages/messages.g.dart
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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<Object?> pigeonChannelCodec = StandardMessageCodec();
static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();

final String __pigeon_messageChannelSuffix;

Future<void> launch(String urlString, {required bool prefersDeepLink, Map<String?, Object?>? 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<Object?> __pigeon_channel = BasicMessageChannel<Object?>(
__pigeon_channelName,
pigeonChannelCodec,
Expand All @@ -48,7 +56,7 @@ class CustomTabsApi {
}

Future<void> 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<Object?> __pigeon_channel = BasicMessageChannel<Object?>(
__pigeon_channelName,
pigeonChannelCodec,
Expand All @@ -70,7 +78,7 @@ class CustomTabsApi {
}

Future<String?> warmup(Map<String?, Object?>? 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<Object?> __pigeon_channel = BasicMessageChannel<Object?>(
__pigeon_channelName,
pigeonChannelCodec,
Expand All @@ -92,7 +100,7 @@ class CustomTabsApi {
}

Future<void> mayLaunch(List<String?> 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<Object?> __pigeon_channel = BasicMessageChannel<Object?>(
__pigeon_channelName,
pigeonChannelCodec,
Expand All @@ -114,7 +122,7 @@ class CustomTabsApi {
}

Future<void> 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<Object?> __pigeon_channel = BasicMessageChannel<Object?>(
__pigeon_channelName,
pigeonChannelCodec,
Expand Down
8 changes: 4 additions & 4 deletions flutter_custom_tabs_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -28,5 +28,5 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^3.0.1
pigeon: ^17.0.0
flutter_lints: ^4.0.0
pigeon: ^21.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down Expand Up @@ -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")
}
Expand Down
6 changes: 3 additions & 3 deletions flutter_custom_tabs_ios/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
6 changes: 3 additions & 3 deletions flutter_custom_tabs_ios/ios/Classes/CustomTabsPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
))
}
}
Expand All @@ -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)
}
Expand Down
Loading

0 comments on commit 24f1a4d

Please sign in to comment.