diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b2a003..b5f7884 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ Types of changes - `Fixed` for any bug fixes. - `Security` in case of vulnerabilities. +## 5.1.0 +### Changed +- + ## 5.0.0+1 ### Changed - `flutter_inappwebview` plugin updated to new breaking change ^6.0.0 diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 5c1c861..3c803df 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,3 +1,9 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) { } } -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' @@ -21,10 +22,6 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { compileSdkVersion 34 @@ -45,7 +42,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.example" minSdkVersion 23 - targetSdkVersion 34 + targetSdkVersion 35 versionCode flutterVersionCode.toInteger() versionName flutterVersionName } @@ -62,7 +59,3 @@ android { flutter { source '../..' } - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 7423720..060587a 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -3,7 +3,9 @@ + android:icon="@mipmap/ic_launcher" + android:usesCleartextTraffic="true" + > properties.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "7.3.1" apply false + id "org.jetbrains.kotlin.android" version "1.8.0" apply false +} + +include ":app" \ No newline at end of file diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 99ccc92..d3752f9 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -33,8 +33,8 @@ SPEC CHECKSUMS: Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 flutter_inappwebview_ios: 97215cf7d4677db55df76782dbd2930c5e1c1ea0 OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c - shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126 + shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 PODFILE CHECKSUM: cc1f88378b4bfcf93a6ce00d2c587857c6008d3b -COCOAPODS: 1.13.0 +COCOAPODS: 1.15.2 diff --git a/example/ios/Runner/AppDelegate.swift b/example/ios/Runner/AppDelegate.swift index 70693e4..b636303 100644 --- a/example/ios/Runner/AppDelegate.swift +++ b/example/ios/Runner/AppDelegate.swift @@ -1,7 +1,7 @@ import UIKit import Flutter -@UIApplicationMain +@main @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, diff --git a/example/lib/src/buttons.dart b/example/lib/src/buttons.dart index ce2494c..af0aefc 100644 --- a/example/lib/src/buttons.dart +++ b/example/lib/src/buttons.dart @@ -14,9 +14,9 @@ class PrimaryButton extends StatelessWidget { ? null : ButtonStyle( backgroundColor: - MaterialStateProperty.all(theme.colorScheme.primary), + WidgetStateProperty.all(theme.colorScheme.primary), foregroundColor: - MaterialStateProperty.all(theme.colorScheme.onPrimary), + WidgetStateProperty.all(theme.colorScheme.onPrimary), ), child: Text(text), ); diff --git a/example/pubspec.lock b/example/pubspec.lock index fa5b92c..49a68cd 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -45,10 +45,10 @@ packages: dependency: transitive description: name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + sha256: "1dceb0cf05cb63a7852c11560060e53ec2f182079a16ced6f4395c5b0875baf8" url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.4" fake_async: dependency: transitive description: @@ -61,18 +61,18 @@ packages: dependency: transitive description: name: ffi - sha256: ed5337a5660c506388a9f012be0288fb38b49020ce2b45fe1f8b8323fe429f99 + sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" url: "https://pub.dev" source: hosted - version: "2.0.2" + version: "2.1.3" file: dependency: transitive description: name: file - sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" url: "https://pub.dev" source: hosted - version: "6.1.4" + version: "7.0.0" flutter: dependency: "direct main" description: flutter @@ -90,10 +90,10 @@ packages: dependency: transitive description: name: flutter_inappwebview_android - sha256: fd4db51e46f49b140d83a3206851432c54ea920b381137c0ba82d0cf59be1dee + sha256: d247f6ed417f1f8c364612fa05a2ecba7f775c8d0c044c1d3b9ee33a6515c421 url: "https://pub.dev" source: hosted - version: "1.0.12" + version: "1.0.13" flutter_inappwebview_internal_annotations: dependency: transitive description: @@ -138,10 +138,10 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7 + sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "4.0.0" flutter_test: dependency: "direct dev" description: flutter @@ -156,10 +156,10 @@ packages: dependency: transitive description: name: http - sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" + sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.2" http_parser: dependency: transitive description: @@ -180,34 +180,34 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" url: "https://pub.dev" source: hosted - version: "10.0.0" + version: "10.0.5" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.5" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.1" lints: dependency: transitive description: name: lints - sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 + sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "4.0.0" matcher: dependency: transitive description: @@ -220,18 +220,18 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.8.0" + version: "0.11.1" meta: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.15.0" oauth2: dependency: transitive description: @@ -246,7 +246,7 @@ packages: path: ".." relative: true source: path - version: "5.0.0+1" + version: "6.0.0" path: dependency: transitive description: @@ -259,34 +259,34 @@ packages: dependency: transitive description: name: path_provider_linux - sha256: ffbb8cc9ed2c9ec0e4b7a541e56fd79b138e8f47d2fb86815f15358a349b3b57 + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 url: "https://pub.dev" source: hosted - version: "2.1.11" + version: "2.2.1" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - sha256: "57585299a729335f1298b43245842678cb9f43a6310351b18fb577d6e33165ec" + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" url: "https://pub.dev" source: hosted - version: "2.0.6" + version: "2.1.2" path_provider_windows: dependency: transitive description: name: path_provider_windows - sha256: "1cb68ba4cd3a795033de62ba1b7b4564dace301f952de6bfb3cd91b202b6ee96" + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 url: "https://pub.dev" source: hosted - version: "2.1.7" + version: "2.3.0" platform: dependency: transitive description: name: platform - sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" + sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.1.5" plugin_platform_interface: dependency: transitive description: @@ -299,58 +299,58 @@ packages: dependency: transitive description: name: shared_preferences - sha256: "0344316c947ffeb3a529eac929e1978fcd37c26be4e8468628bac399365a3ca1" + sha256: c272f9cabca5a81adc9b0894381e9c1def363e980f960fa903c604c471b22f68 url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.3.1" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - sha256: fe8401ec5b6dcd739a0fe9588802069e608c3fdbfd3c3c93e546cf2f90438076 + sha256: a7e8467e9181cef109f601e3f65765685786c1a738a83d7fbbde377589c0d974 url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.3.1" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: f39696b83e844923b642ce9dd4bd31736c17e697f6731a5adf445b1274cf3cd4 + sha256: c4b35f6cb8f63c147312c054ce7c2254c8066745125264f0c88739c417fc9d9f url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.5.2" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - sha256: "71d6806d1449b0a9d4e85e0c7a917771e672a3d5dc61149cc9fac871115018e1" + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.4.1" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - sha256: "23b052f17a25b90ff2b61aad4cc962154da76fb62848a9ce088efe30d7c50ab1" + sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.4.1" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - sha256: "7347b194fb0bbeb4058e6a4e87ee70350b6b2b90f8ac5f8bd5b3a01548f6d33a" + sha256: d2ca4132d3946fec2184261726b355836a82c33d7d5b67af32692aff18a4684e url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.4.2" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - sha256: f95e6a43162bce43c9c3405f3eb6f39e5b5d11f65fab19196cf8225e2777624d + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.4.1" sky_engine: dependency: transitive description: flutter @@ -400,10 +400,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.7.2" typed_data: dependency: transitive description: @@ -424,26 +424,26 @@ packages: dependency: transitive description: name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc url: "https://pub.dev" source: hosted - version: "13.0.0" - win32: + version: "14.2.4" + web: dependency: transitive description: - name: win32 - sha256: dfdf0136e0aa7a1b474ea133e67cb0154a0acd2599c4f3ada3b49d38d38793ee + name: web + sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062 url: "https://pub.dev" source: hosted - version: "5.0.5" + version: "1.0.0" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: e0b1147eec179d3911f1f19b59206448f78195ca1d20514134e10641b7d7fbff + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.0.4" sdks: - dart: ">=3.2.0-0 <4.0.0" - flutter: ">=3.3.0" + dart: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index a02cd65..780fa54 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -42,7 +42,7 @@ dev_dependencies: # activated in the `analysis_options.yaml` file located at the root of your # package. See that file for information about deactivating specific lint # rules and activating additional ones. - flutter_lints: ^3.0.1 + flutter_lints: ^4.0.0 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/lib/src/base_web_screen.dart b/lib/src/base_web_screen.dart index b5cb3dd..42acda2 100644 --- a/lib/src/base_web_screen.dart +++ b/lib/src/base_web_screen.dart @@ -91,8 +91,8 @@ class BaseWebScreen extends StatelessWidget { configuration.onCancel?.call(); } - Future onBackPressed() async { - if (!((await globalKey.currentState?.onBackPressed()) ?? false)) { + Future onBackPressed(dynamic result) async { + if (!((await globalKey.currentState?.onBackPressed(result)) ?? false)) { return false; } configuration.onCancel?.call(); diff --git a/lib/src/base_web_view.dart b/lib/src/base_web_view.dart index f430244..2c6974e 100644 --- a/lib/src/base_web_view.dart +++ b/lib/src/base_web_view.dart @@ -438,7 +438,7 @@ class BaseWebViewState extends State } } - Future onBackPressed() async { + Future onBackPressed(dynamic result) async { if (await controllerCanGoBack()) { controllerGoBack(); return false; diff --git a/lib/src/oauth_web_screen.dart b/lib/src/oauth_web_screen.dart index 07e1ca7..0d8a230 100644 --- a/lib/src/oauth_web_screen.dart +++ b/lib/src/oauth_web_screen.dart @@ -88,8 +88,8 @@ class OAuthWebScreen extends StatelessWidget { configuration.onCancel?.call(); } - Future onBackPressed() async { - if (!((await globalKey.currentState?.onBackPressed()) ?? false)) { + Future onBackPressed(dynamic result) async { + if (!((await globalKey.currentState?.onBackPressed(result)) ?? false)) { return false; } configuration.onCancel?.call(); diff --git a/lib/src/utils/custom_pop_scope.dart b/lib/src/utils/custom_pop_scope.dart index e112aa1..f9242f9 100644 --- a/lib/src/utils/custom_pop_scope.dart +++ b/lib/src/utils/custom_pop_scope.dart @@ -1,29 +1,29 @@ import 'package:flutter/material.dart'; -typedef CanGoBackCallback = Future Function(); +typedef CanGoBackCallback = Future Function(T? result); -class CustomPopScope extends StatelessWidget { +class CustomPopScope extends StatelessWidget { const CustomPopScope({ required this.child, - this.onPopInvoked, + this.onPopInvokedWithResult, this.canGoBack, super.key, - }) : assert(onPopInvoked != null || canGoBack != null); + }) : assert(onPopInvokedWithResult != null || canGoBack != null); final Widget child; - final PopInvokedCallback? onPopInvoked; - final CanGoBackCallback? canGoBack; + final PopInvokedWithResultCallback? onPopInvokedWithResult; + final CanGoBackCallback? canGoBack; @override Widget build(BuildContext context) { return PopScope( canPop: false, - onPopInvoked: onPopInvoked ?? - (didPop) { + onPopInvokedWithResult: onPopInvokedWithResult ?? + (bool didPop, T? result) { if (didPop) return; - canGoBack?.call().then((canPop) { - if (canPop) { - Navigator.of(context).pop(); + canGoBack?.call(result).then((canPop) { + if (canPop && context.mounted) { + Navigator.of(context).pop(result); } }); }, diff --git a/lib/src/utils/widget_utils.dart b/lib/src/utils/widget_utils.dart deleted file mode 100644 index e424cbf..0000000 --- a/lib/src/utils/widget_utils.dart +++ /dev/null @@ -1,81 +0,0 @@ -import 'dart:ui' as ui; - -import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; - -extension WidgetUtils on Widget { - /// It's recommended to use a context when using this function. - /// Check docs: https://docs.flutter.dev/release/breaking-changes/window-singleton#migration-guide - Future buildWidgetOnBackground({ - BuildContext? context, - Duration waitToRender = const Duration(milliseconds: 300), - }) async { - final widget = RepaintBoundary( - child: MediaQuery( - data: const MediaQueryData(), - child: Directionality(textDirection: TextDirection.ltr, child: this)), - ); - await _buildImageFromWidget( - context, - widget, - waitToRender, - ); - } - - /// Builds an image from the given widget by first spinning up a element and render tree, - /// wait [waitToRender] to render the widget - /// It's recommended to use a context when using this function. - /// Check docs: https://docs.flutter.dev/release/breaking-changes/window-singleton#migration-guide - Future _buildImageFromWidget( - BuildContext? context, - Widget widget, - Duration waitToRender, - ) async { - final RenderRepaintBoundary repaintBoundary = RenderRepaintBoundary(); - - final view = context != null - ? View.of(context) - : WidgetsBinding.instance.platformDispatcher.implicitView ?? - WidgetsBinding.instance.platformDispatcher.views.first; - - final logicalSize = view.physicalSize / view.devicePixelRatio; - final imageSize = view.physicalSize; - - final RenderView renderView = RenderView( - view: view, - child: RenderPositionedBox( - alignment: Alignment.center, child: repaintBoundary), - configuration: ViewConfiguration( - size: logicalSize, - devicePixelRatio: 1.0, - ), - ); - - final PipelineOwner pipelineOwner = PipelineOwner(); - final BuildOwner buildOwner = BuildOwner(focusManager: FocusManager()); - - pipelineOwner.rootNode = renderView; - renderView.prepareInitialFrame(); - - final RenderObjectToWidgetElement rootElement = - RenderObjectToWidgetAdapter( - container: repaintBoundary, - child: widget, - ).attachToRenderTree(buildOwner); - - buildOwner.buildScope(rootElement); - - await Future.delayed(waitToRender); - - buildOwner.buildScope(rootElement); - buildOwner.finalizeTree(); - - pipelineOwner.flushLayout(); - pipelineOwner.flushCompositingBits(); - pipelineOwner.flushPaint(); - - final ui.Image image = await repaintBoundary.toImage( - pixelRatio: imageSize.width / logicalSize.width); - await image.toByteData(); - } -} diff --git a/pubspec.yaml b/pubspec.yaml index 2e0605e..899d235 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: oauth_webauth description: This plugin provides an alternative to AppAuth using WebView for OAuth 2.0 authorization/authentication. -version: 5.0.0+1 +version: 5.1.0 repository: https://github.com/luis901101/oauth_webauth issue_tracker: https://github.com/luis901101/oauth_webauth/issues topics: @@ -27,7 +27,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^3.0.1 + flutter_lints: ^4.0.0 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec