From f7967d0a4251e316212012ba5522e8e5653a0e58 Mon Sep 17 00:00:00 2001 From: Lorenzo Pichilli Date: Tue, 28 Nov 2023 01:27:06 +0100 Subject: [PATCH] fix #1881, fixed PlatformPrintJobController.onComplete setter --- CHANGELOG.md | 5 +++++ .../lib/chrome_safari_browser_example.screen.dart | 3 ++- example/pubspec.yaml | 12 ++++++++++++ flutter_inappwebview_android/CHANGELOG.md | 5 +++++ .../chrome_custom_tabs/ChromeCustomTabsActivity.java | 4 +++- .../ChromeCustomTabsChannelDelegate.java | 2 +- flutter_inappwebview_android/example/pubspec.lock | 11 +++++------ flutter_inappwebview_android/pubspec.yaml | 4 ++-- flutter_inappwebview_ios/CHANGELOG.md | 5 +++++ flutter_inappwebview_ios/example/pubspec.lock | 11 +++++------ .../lib/src/print_job/print_job_controller.dart | 5 +++-- flutter_inappwebview_ios/pubspec.yaml | 4 ++-- flutter_inappwebview_macos/CHANGELOG.md | 5 +++++ .../lib/src/print_job/print_job_controller.dart | 5 +++-- flutter_inappwebview_macos/pubspec.yaml | 4 ++-- flutter_inappwebview_platform_interface/CHANGELOG.md | 4 ++++ .../src/print_job/platform_print_job_controller.dart | 2 +- flutter_inappwebview_platform_interface/pubspec.yaml | 2 +- flutter_inappwebview_web/CHANGELOG.md | 4 ++++ flutter_inappwebview_web/pubspec.yaml | 4 ++-- lib/src/print_job/print_job_controller.dart | 4 ++++ pubspec.yaml | 12 ++++++------ 22 files changed, 82 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6a3a371..99966d0d 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 6.0.0-beta.30 + +- Updated minimum platform interface and implementation versions +- Fixed "Crash when starting ChromeSafariBrowser on Android java.lang.NoSuchMethodError: No virtual method isEngagementSignalsApiAvailable" [#1881](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1881) + ## 6.0.0-beta.29 ### BREAKING CHANGES diff --git a/example/lib/chrome_safari_browser_example.screen.dart b/example/lib/chrome_safari_browser_example.screen.dart index 99995909..c8066996 100755 --- a/example/lib/chrome_safari_browser_example.screen.dart +++ b/example/lib/chrome_safari_browser_example.screen.dart @@ -6,8 +6,9 @@ import 'main.dart'; class MyChromeSafariBrowser extends ChromeSafariBrowser { @override - void onOpened() { + void onOpened() async { print("ChromeSafari browser opened"); + print(await isEngagementSignalsApiAvailable()); } @override diff --git a/example/pubspec.yaml b/example/pubspec.yaml index b0201df9..46df9552 100755 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -31,6 +31,18 @@ dependencies: flutter_inappwebview: path: ../ +dependency_overrides: + flutter_inappwebview_platform_interface: + path: ../flutter_inappwebview_platform_interface + flutter_inappwebview_android: + path: ../flutter_inappwebview_android + flutter_inappwebview_ios: + path: ../flutter_inappwebview_ios + flutter_inappwebview_macos: + path: ../flutter_inappwebview_macos + flutter_inappwebview_web: + path: ../flutter_inappwebview_web + dev_dependencies: flutter_test: sdk: flutter diff --git a/flutter_inappwebview_android/CHANGELOG.md b/flutter_inappwebview_android/CHANGELOG.md index 91460049..eac4d2c7 100644 --- a/flutter_inappwebview_android/CHANGELOG.md +++ b/flutter_inappwebview_android/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.0.2 + +- Updated `flutter_inappwebview_platform_interface` version dependency to `1.0.2` +- Fixed "Crash when starting ChromeSafariBrowser on Android java.lang.NoSuchMethodError: No virtual method isEngagementSignalsApiAvailable" [#1881](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1881) + ## 1.0.1 - Updated README diff --git a/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/chrome_custom_tabs/ChromeCustomTabsActivity.java b/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/chrome_custom_tabs/ChromeCustomTabsActivity.java index 9cf0b9fe..05d41a26 100755 --- a/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/chrome_custom_tabs/ChromeCustomTabsActivity.java +++ b/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/chrome_custom_tabs/ChromeCustomTabsActivity.java @@ -9,6 +9,7 @@ import android.graphics.Color; import android.net.Uri; import android.os.Build; import android.os.Bundle; +import android.util.Log; import android.widget.RemoteViews; import androidx.annotation.CallSuper; @@ -239,7 +240,8 @@ public class ChromeCustomTabsActivity extends Activity implements Disposable { } }, bundle); } - } catch (Exception ignored) { + } catch (Throwable e) { + Log.d(LOG_TAG, "Custom Tabs Engagement Signals API not supported", e); } } diff --git a/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/chrome_custom_tabs/ChromeCustomTabsChannelDelegate.java b/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/chrome_custom_tabs/ChromeCustomTabsChannelDelegate.java index 511768db..703a337f 100644 --- a/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/chrome_custom_tabs/ChromeCustomTabsChannelDelegate.java +++ b/flutter_inappwebview_android/android/src/main/java/com/pichillilorenzo/flutter_inappwebview_android/chrome_custom_tabs/ChromeCustomTabsChannelDelegate.java @@ -106,7 +106,7 @@ public class ChromeCustomTabsChannelDelegate extends ChannelDelegateImpl { if (chromeCustomTabsActivity != null && chromeCustomTabsActivity.customTabsSession != null) { try { result.success(chromeCustomTabsActivity.customTabsSession.isEngagementSignalsApiAvailable(new Bundle())); - } catch (Exception e) { + } catch (Throwable e) { result.success(false); } } else { diff --git a/flutter_inappwebview_android/example/pubspec.lock b/flutter_inappwebview_android/example/pubspec.lock index e3488aae..6a29d8e6 100644 --- a/flutter_inappwebview_android/example/pubspec.lock +++ b/flutter_inappwebview_android/example/pubspec.lock @@ -81,7 +81,7 @@ packages: path: ".." relative: true source: path - version: "1.0.0" + version: "1.0.1" flutter_inappwebview_internal_annotations: dependency: transitive description: @@ -93,11 +93,10 @@ packages: flutter_inappwebview_platform_interface: dependency: transitive description: - name: flutter_inappwebview_platform_interface - sha256: c221a6788c73421284208e3449cad07d8c65fdace120322483181a2b94d95697 - url: "https://pub.dev" - source: hosted - version: "1.0.0" + path: "../../flutter_inappwebview_platform_interface" + relative: true + source: path + version: "1.0.2" flutter_lints: dependency: "direct dev" description: diff --git a/flutter_inappwebview_android/pubspec.yaml b/flutter_inappwebview_android/pubspec.yaml index b0c2e745..882cccb9 100644 --- a/flutter_inappwebview_android/pubspec.yaml +++ b/flutter_inappwebview_android/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_inappwebview_android description: Android implementation of the flutter_inappwebview plugin. -version: 1.0.1 +version: 1.0.2 homepage: https://inappwebview.dev/ repository: https://github.com/pichillilorenzo/flutter_inappwebview/tree/master/flutter_inappwebview_android issue_tracker: https://github.com/pichillilorenzo/flutter_inappwebview/issues @@ -18,7 +18,7 @@ environment: dependencies: flutter: sdk: flutter - flutter_inappwebview_platform_interface: ^1.0.0 + flutter_inappwebview_platform_interface: ^1.0.2 dev_dependencies: flutter_test: diff --git a/flutter_inappwebview_ios/CHANGELOG.md b/flutter_inappwebview_ios/CHANGELOG.md index 91460049..392fbfe4 100644 --- a/flutter_inappwebview_ios/CHANGELOG.md +++ b/flutter_inappwebview_ios/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.0.2 + +- Added `PlatformPrintJobController.onComplete` setter +- Updated `flutter_inappwebview_platform_interface` version dependency to `1.0.2` + ## 1.0.1 - Updated README diff --git a/flutter_inappwebview_ios/example/pubspec.lock b/flutter_inappwebview_ios/example/pubspec.lock index e065f713..59f80b3a 100644 --- a/flutter_inappwebview_ios/example/pubspec.lock +++ b/flutter_inappwebview_ios/example/pubspec.lock @@ -89,15 +89,14 @@ packages: path: ".." relative: true source: path - version: "1.0.0" + version: "1.0.2" flutter_inappwebview_platform_interface: dependency: transitive description: - name: flutter_inappwebview_platform_interface - sha256: c221a6788c73421284208e3449cad07d8c65fdace120322483181a2b94d95697 - url: "https://pub.dev" - source: hosted - version: "1.0.0" + path: "../../flutter_inappwebview_platform_interface" + relative: true + source: path + version: "1.0.2" flutter_lints: dependency: "direct dev" description: diff --git a/flutter_inappwebview_ios/lib/src/print_job/print_job_controller.dart b/flutter_inappwebview_ios/lib/src/print_job/print_job_controller.dart index f56b826d..e2385f9c 100644 --- a/flutter_inappwebview_ios/lib/src/print_job/print_job_controller.dart +++ b/flutter_inappwebview_ios/lib/src/print_job/print_job_controller.dart @@ -35,6 +35,7 @@ class IOSPrintJobController extends PlatformPrintJobController : IOSPrintJobControllerCreationParams .fromPlatformPrintJobControllerCreationParams(params), ) { + onComplete = params.onComplete; channel = MethodChannel( 'com.pichillilorenzo/flutter_inappwebview_printjobcontroller_${params.id}'); handler = _handleMethod; @@ -46,8 +47,8 @@ class IOSPrintJobController extends PlatformPrintJobController case "onComplete": bool completed = call.arguments["completed"]; String? error = call.arguments["error"]; - if (params.onComplete != null) { - params.onComplete!(completed, error); + if (onComplete != null) { + onComplete!(completed, error); } break; default: diff --git a/flutter_inappwebview_ios/pubspec.yaml b/flutter_inappwebview_ios/pubspec.yaml index 3df35559..7b02b0cc 100644 --- a/flutter_inappwebview_ios/pubspec.yaml +++ b/flutter_inappwebview_ios/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_inappwebview_ios description: iOS implementation of the flutter_inappwebview plugin. -version: 1.0.1 +version: 1.0.2 homepage: https://inappwebview.dev/ repository: https://github.com/pichillilorenzo/flutter_inappwebview/tree/master/flutter_inappwebview_ios issue_tracker: https://github.com/pichillilorenzo/flutter_inappwebview/issues @@ -18,7 +18,7 @@ environment: dependencies: flutter: sdk: flutter - flutter_inappwebview_platform_interface: ^1.0.0 + flutter_inappwebview_platform_interface: ^1.0.2 dev_dependencies: flutter_test: diff --git a/flutter_inappwebview_macos/CHANGELOG.md b/flutter_inappwebview_macos/CHANGELOG.md index 227f4433..cbe42f3e 100644 --- a/flutter_inappwebview_macos/CHANGELOG.md +++ b/flutter_inappwebview_macos/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.0.1 + +- Added `PlatformPrintJobController.onComplete` setter +- Updated `flutter_inappwebview_platform_interface` version dependency to `1.0.2` + ## 1.0.0 Initial release. diff --git a/flutter_inappwebview_macos/lib/src/print_job/print_job_controller.dart b/flutter_inappwebview_macos/lib/src/print_job/print_job_controller.dart index b1a95ce2..be3136d6 100644 --- a/flutter_inappwebview_macos/lib/src/print_job/print_job_controller.dart +++ b/flutter_inappwebview_macos/lib/src/print_job/print_job_controller.dart @@ -35,6 +35,7 @@ class MacOSPrintJobController extends PlatformPrintJobController : MacOSPrintJobControllerCreationParams .fromPlatformPrintJobControllerCreationParams(params), ) { + onComplete = params.onComplete; channel = MethodChannel( 'com.pichillilorenzo/flutter_inappwebview_printjobcontroller_${params.id}'); handler = _handleMethod; @@ -46,8 +47,8 @@ class MacOSPrintJobController extends PlatformPrintJobController case "onComplete": bool completed = call.arguments["completed"]; String? error = call.arguments["error"]; - if (params.onComplete != null) { - params.onComplete!(completed, error); + if (onComplete != null) { + onComplete!(completed, error); } break; default: diff --git a/flutter_inappwebview_macos/pubspec.yaml b/flutter_inappwebview_macos/pubspec.yaml index eaaf0a90..d994d941 100644 --- a/flutter_inappwebview_macos/pubspec.yaml +++ b/flutter_inappwebview_macos/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_inappwebview_macos description: macOS implementation of the flutter_inappwebview plugin. -version: 1.0.0 +version: 1.0.1 homepage: https://inappwebview.dev/ repository: https://github.com/pichillilorenzo/flutter_inappwebview/tree/master/flutter_inappwebview_macos issue_tracker: https://github.com/pichillilorenzo/flutter_inappwebview/issues @@ -18,7 +18,7 @@ environment: dependencies: flutter: sdk: flutter - flutter_inappwebview_platform_interface: ^1.0.0 + flutter_inappwebview_platform_interface: ^1.0.2 dev_dependencies: flutter_test: diff --git a/flutter_inappwebview_platform_interface/CHANGELOG.md b/flutter_inappwebview_platform_interface/CHANGELOG.md index 16477d94..a22c6254 100644 --- a/flutter_inappwebview_platform_interface/CHANGELOG.md +++ b/flutter_inappwebview_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.2 + +- Added `PlatformPrintJobController.onComplete` setter + ## 1.0.1 - Updated README diff --git a/flutter_inappwebview_platform_interface/lib/src/print_job/platform_print_job_controller.dart b/flutter_inappwebview_platform_interface/lib/src/print_job/platform_print_job_controller.dart index 4d782314..e2abce43 100644 --- a/flutter_inappwebview_platform_interface/lib/src/print_job/platform_print_job_controller.dart +++ b/flutter_inappwebview_platform_interface/lib/src/print_job/platform_print_job_controller.dart @@ -76,7 +76,7 @@ abstract class PlatformPrintJobController extends PlatformInterface ///- iOS ([Official API - UIPrintInteractionController.CompletionHandler](https://developer.apple.com/documentation/uikit/uiprintinteractioncontroller/completionhandler)) ///- MacOS ([Official API - NSPrintOperation.runModal](https://developer.apple.com/documentation/appkit/nsprintoperation/1532065-runmodal)) ///{@endtemplate} - PrintJobCompletionHandler? get onComplete => params.onComplete; + PrintJobCompletionHandler? onComplete; ///{@template flutter_inappwebview_platform_interface.PlatformPrintJobController.cancel} ///Cancels this print job. diff --git a/flutter_inappwebview_platform_interface/pubspec.yaml b/flutter_inappwebview_platform_interface/pubspec.yaml index c179d274..0b61a34e 100644 --- a/flutter_inappwebview_platform_interface/pubspec.yaml +++ b/flutter_inappwebview_platform_interface/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_inappwebview_platform_interface description: A common platform interface for the flutter_inappwebview plugin. -version: 1.0.1 +version: 1.0.2 homepage: https://inappwebview.dev/ repository: https://github.com/pichillilorenzo/flutter_inappwebview/tree/master/flutter_inappwebview_platform_interface issue_tracker: https://github.com/pichillilorenzo/flutter_inappwebview/issues diff --git a/flutter_inappwebview_web/CHANGELOG.md b/flutter_inappwebview_web/CHANGELOG.md index 227f4433..b4685c54 100644 --- a/flutter_inappwebview_web/CHANGELOG.md +++ b/flutter_inappwebview_web/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.1 + +- Updated `flutter_inappwebview_platform_interface` version dependency to `1.0.2` + ## 1.0.0 Initial release. diff --git a/flutter_inappwebview_web/pubspec.yaml b/flutter_inappwebview_web/pubspec.yaml index b4fdee39..238f89ee 100644 --- a/flutter_inappwebview_web/pubspec.yaml +++ b/flutter_inappwebview_web/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_inappwebview_web description: Web implementation of the flutter_inappwebview plugin. -version: 1.0.0 +version: 1.0.1 homepage: https://inappwebview.dev/ repository: https://github.com/pichillilorenzo/flutter_inappwebview/tree/master/flutter_inappwebview_web issue_tracker: https://github.com/pichillilorenzo/flutter_inappwebview/issues @@ -21,7 +21,7 @@ dependencies: flutter_web_plugins: sdk: flutter js: ^0.6.4 - flutter_inappwebview_platform_interface: ^1.0.0 + flutter_inappwebview_platform_interface: ^1.0.2 dev_dependencies: flutter_test: diff --git a/lib/src/print_job/print_job_controller.dart b/lib/src/print_job/print_job_controller.dart index 860976ac..427d1e8c 100644 --- a/lib/src/print_job/print_job_controller.dart +++ b/lib/src/print_job/print_job_controller.dart @@ -28,6 +28,10 @@ class PrintJobController { ///{@macro flutter_inappwebview_platform_interface.PlatformPrintJobController.onComplete} PrintJobCompletionHandler? get onComplete => platform.onComplete; + void set onComplete(PrintJobCompletionHandler? handler) { + platform.onComplete = handler; + } + ///{@macro flutter_inappwebview_platform_interface.PlatformPrintJobController.cancel} Future cancel() => platform.cancel(); diff --git a/pubspec.yaml b/pubspec.yaml index 675e0c44..bff80ba5 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_inappwebview description: A Flutter plugin that allows you to add an inline webview, to use an headless webview, and to open an in-app browser window. -version: 6.0.0-beta.29 +version: 6.0.0-beta.30 homepage: https://inappwebview.dev/ repository: https://github.com/pichillilorenzo/flutter_inappwebview issue_tracker: https://github.com/pichillilorenzo/flutter_inappwebview/issues @@ -18,11 +18,11 @@ environment: dependencies: flutter: sdk: flutter - flutter_inappwebview_platform_interface: ^1.0.0 - flutter_inappwebview_android: ^1.0.0 - flutter_inappwebview_ios: ^1.0.0 - flutter_inappwebview_macos: ^1.0.0 - flutter_inappwebview_web: ^1.0.0 + flutter_inappwebview_platform_interface: ^1.0.2 + flutter_inappwebview_android: ^1.0.2 + flutter_inappwebview_ios: ^1.0.2 + flutter_inappwebview_macos: ^1.0.1 + flutter_inappwebview_web: ^1.0.1 dev_dependencies: flutter_test: