Merge fixes of version 5.5.0+5
This commit is contained in:
parent
00cf46faed
commit
b6e7699ef8
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -1,3 +1,7 @@
|
||||||
|
## 6.0.0-beta.5
|
||||||
|
|
||||||
|
- Merge fixes of version `5.5.0+5`
|
||||||
|
|
||||||
## 6.0.0-beta.4
|
## 6.0.0-beta.4
|
||||||
|
|
||||||
- Added `InAppWebView.headlessWebView` property to convert an `HeadlessWebView` to `InAppWebView` widget
|
- Added `InAppWebView.headlessWebView` property to convert an `HeadlessWebView` to `InAppWebView` widget
|
||||||
|
@ -50,6 +54,12 @@
|
||||||
- Removed `URLProtectionSpace.iosIsProxy` property
|
- Removed `URLProtectionSpace.iosIsProxy` property
|
||||||
- `historyUrl` and `baseUrl` of `InAppWebViewInitialData` can be `null`
|
- `historyUrl` and `baseUrl` of `InAppWebViewInitialData` can be `null`
|
||||||
|
|
||||||
|
## 5.5.0+5
|
||||||
|
|
||||||
|
- Fixed `HeadlessInAppWebView` default size on Android
|
||||||
|
- Fixed "🐞[Android] execution of the workmanager destroys in_app_webview library's platform channel" [#1348](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1348)
|
||||||
|
- Fixed "HeadlessInAppWebView called from WorkManager background task triggers NullPointerException on missing context" [#912](https://github.com/pichillilorenzo/flutter_inappwebview/issues/912)
|
||||||
|
|
||||||
## 5.5.0+4
|
## 5.5.0+4
|
||||||
|
|
||||||
- Fixed "Many crashes on iOS: Completion handler was not called" [#1221](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1221)
|
- Fixed "Many crashes on iOS: Completion handler was not called" [#1221](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1221)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.pichillilorenzo.flutter_inappwebview;
|
package com.pichillilorenzo.flutter_inappwebview;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.webkit.ValueCallback;
|
import android.webkit.ValueCallback;
|
||||||
|
@ -81,8 +82,12 @@ public class InAppWebViewStatic extends ChannelDelegateImpl {
|
||||||
result.success(false);
|
result.success(false);
|
||||||
break;
|
break;
|
||||||
case "getCurrentWebViewPackage":
|
case "getCurrentWebViewPackage":
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && plugin != null && plugin.activity != null) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && plugin != null && (plugin.activity != null || plugin.applicationContext != null)) {
|
||||||
result.success(convertWebViewPackageToMap(WebViewCompat.getCurrentWebViewPackage(plugin.activity)));
|
Context context = plugin.activity;
|
||||||
|
if (context == null) {
|
||||||
|
context = plugin.applicationContext;
|
||||||
|
}
|
||||||
|
result.success(convertWebViewPackageToMap(WebViewCompat.getCurrentWebViewPackage(context)));
|
||||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
//with Android Lollipop (API 21) they started to update the WebView
|
//with Android Lollipop (API 21) they started to update the WebView
|
||||||
//as a separate APK with the PlayStore and they added the
|
//as a separate APK with the PlayStore and they added the
|
||||||
|
|
|
@ -45,6 +45,18 @@ public class HeadlessInAppWebView implements Disposable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void prepare(Map<String, Object> params) {
|
public void prepare(Map<String, Object> params) {
|
||||||
|
if (flutterWebView != null) {
|
||||||
|
View view = flutterWebView.getView();
|
||||||
|
if (view != null) {
|
||||||
|
final Map<String, Object> initialSize = (Map<String, Object>) params.get("initialSize");
|
||||||
|
Size2D size = Size2D.fromMap(initialSize);
|
||||||
|
if (size == null) {
|
||||||
|
size = new Size2D(-1, -1);
|
||||||
|
}
|
||||||
|
setSize(size);
|
||||||
|
view.setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (plugin != null && plugin.activity != null) {
|
if (plugin != null && plugin.activity != null) {
|
||||||
// Add the headless WebView to the view hierarchy.
|
// Add the headless WebView to the view hierarchy.
|
||||||
// This way is also possible to take screenshots.
|
// This way is also possible to take screenshots.
|
||||||
|
@ -54,14 +66,7 @@ public class HeadlessInAppWebView implements Disposable {
|
||||||
if (mainView != null && flutterWebView != null) {
|
if (mainView != null && flutterWebView != null) {
|
||||||
View view = flutterWebView.getView();
|
View view = flutterWebView.getView();
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
final Map<String, Object> initialSize = (Map<String, Object>) params.get("initialSize");
|
|
||||||
Size2D size = Size2D.fromMap(initialSize);
|
|
||||||
if (size == null) {
|
|
||||||
size = new Size2D(-1, -1);
|
|
||||||
}
|
|
||||||
setSize(size);
|
|
||||||
mainView.addView(view, 0);
|
mainView.addView(view, 0);
|
||||||
view.setVisibility(View.INVISIBLE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
package com.pichillilorenzo.flutter_inappwebview.headless_in_app_webview;
|
package com.pichillilorenzo.flutter_inappwebview.headless_in_app_webview;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
@ -67,9 +69,12 @@ public class HeadlessInAppWebViewManager extends ChannelDelegateImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run(String id, HashMap<String, Object> params) {
|
public void run(String id, HashMap<String, Object> params) {
|
||||||
if (plugin == null || plugin.activity == null) return;
|
if (plugin == null || (plugin.activity == null && plugin.applicationContext == null)) return;
|
||||||
|
Context context = plugin.activity;
|
||||||
FlutterWebView flutterWebView = new FlutterWebView(plugin, plugin.activity, id, params);
|
if (context == null) {
|
||||||
|
context = plugin.applicationContext;
|
||||||
|
}
|
||||||
|
FlutterWebView flutterWebView = new FlutterWebView(plugin, context, id, params);
|
||||||
HeadlessInAppWebView headlessInAppWebView = new HeadlessInAppWebView(plugin, id, flutterWebView);
|
HeadlessInAppWebView headlessInAppWebView = new HeadlessInAppWebView(plugin, id, flutterWebView);
|
||||||
HeadlessInAppWebViewManager.webViews.put(id, headlessInAppWebView);
|
HeadlessInAppWebViewManager.webViews.put(id, headlessInAppWebView);
|
||||||
|
|
||||||
|
|
|
@ -57,13 +57,6 @@ public class FlutterWebView implements PlatformWebView {
|
||||||
InAppWebViewSettings customSettings = new InAppWebViewSettings();
|
InAppWebViewSettings customSettings = new InAppWebViewSettings();
|
||||||
customSettings.parse(initialSettings);
|
customSettings.parse(initialSettings);
|
||||||
|
|
||||||
if (plugin == null || plugin.activity == null) {
|
|
||||||
Log.e(LOG_TAG, "\n\n\nERROR: You need to upgrade your Flutter project to use the new Java Embedding API:\n\n" +
|
|
||||||
"- Take a look at the \"IMPORTANT Note for Android\" section here: https://github.com/pichillilorenzo/flutter_inappwebview#important-note-for-android\n" +
|
|
||||||
"- See the official wiki here: https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects\n\n\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<UserScript> userScripts = new ArrayList<>();
|
List<UserScript> userScripts = new ArrayList<>();
|
||||||
if (initialUserScripts != null) {
|
if (initialUserScripts != null) {
|
||||||
for (Map<String, Object> initialUserScript : initialUserScripts) {
|
for (Map<String, Object> initialUserScript : initialUserScripts) {
|
||||||
|
|
|
@ -114,9 +114,8 @@ class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
|
||||||
children: [
|
children: [
|
||||||
InAppWebView(
|
InAppWebView(
|
||||||
key: webViewKey,
|
key: webViewKey,
|
||||||
headlessWebView: headlessWebView,
|
|
||||||
initialUrlRequest:
|
initialUrlRequest:
|
||||||
URLRequest(url: Uri.parse('https://google.com')),
|
URLRequest(url: Uri.parse('https://flutter.dev')),
|
||||||
// initialUrlRequest:
|
// initialUrlRequest:
|
||||||
// URLRequest(url: Uri.parse(Uri.base.toString().replaceFirst("/#/", "/") + 'page.html')),
|
// URLRequest(url: Uri.parse(Uri.base.toString().replaceFirst("/#/", "/") + 'page.html')),
|
||||||
// initialFile: "assets/index.html",
|
// initialFile: "assets/index.html",
|
||||||
|
|
|
@ -15,13 +15,6 @@ import 'package:pointer_interceptor/pointer_interceptor.dart';
|
||||||
|
|
||||||
InAppLocalhostServer localhostServer = new InAppLocalhostServer(documentRoot: 'assets');
|
InAppLocalhostServer localhostServer = new InAppLocalhostServer(documentRoot: 'assets');
|
||||||
|
|
||||||
var headlessWebView = new HeadlessInAppWebView(
|
|
||||||
initialUrlRequest: URLRequest(url: Uri.parse('https://flutter.dev')),
|
|
||||||
shouldOverrideUrlLoading: (controller, navigationAction) async {
|
|
||||||
return NavigationActionPolicy.ALLOW;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
Future main() async {
|
Future main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
// await Permission.camera.request();
|
// await Permission.camera.request();
|
||||||
|
@ -36,10 +29,6 @@ Future main() async {
|
||||||
await localhostServer.start();
|
await localhostServer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
headlessWebView.run();
|
|
||||||
|
|
||||||
await Future.delayed(Duration(seconds: 1));
|
|
||||||
|
|
||||||
runApp(MyApp());
|
runApp(MyApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: flutter_inappwebview
|
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.
|
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.4
|
version: 6.0.0-beta.5
|
||||||
homepage: https://inappwebview.dev/
|
homepage: https://inappwebview.dev/
|
||||||
repository: https://github.com/pichillilorenzo/flutter_inappwebview
|
repository: https://github.com/pichillilorenzo/flutter_inappwebview
|
||||||
issue_tracker: https://github.com/pichillilorenzo/flutter_inappwebview/issues
|
issue_tracker: https://github.com/pichillilorenzo/flutter_inappwebview/issues
|
||||||
|
|
Loading…
Reference in New Issue