This commit is contained in:
Lorenzo Pichilli 2022-05-05 21:46:14 +02:00
parent 1fbabf1e8f
commit a6cb4105b1
7 changed files with 42 additions and 15 deletions

View File

@ -1,3 +1,7 @@
## 5.4.3+6
- Fixed "iOS flutter_inappwebview/URLRequest.swift:13: Fatal error: Unexpectedly found nil while unwrapping an Optional value" [#1173](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1173)
## 5.4.3+5
- Fixed possible java.lang.NullPointerException in `Runnable` of `InputAwareWebView.setInputConnectionTarget` method

View File

@ -1,6 +1,5 @@
package com.pichillilorenzo.flutter_inappwebview.types;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.Arrays;
@ -8,7 +7,7 @@ import java.util.HashMap;
import java.util.Map;
public class URLRequest {
@NonNull
@Nullable
private String url;
@Nullable
private String method;
@ -17,7 +16,7 @@ public class URLRequest {
@Nullable
private Map<String, String> headers;
public URLRequest(@NonNull String url, @Nullable String method, @Nullable byte[] body, @Nullable Map<String, String> headers) {
public URLRequest(@Nullable String url, @Nullable String method, @Nullable byte[] body, @Nullable Map<String, String> headers) {
this.url = url;
this.method = method;
this.body = body;
@ -30,10 +29,12 @@ public class URLRequest {
return null;
}
String url = (String) map.get("url");
if (url == null) {
url = "about:blank";
}
String method = (String) map.get("method");
byte[] body = (byte[]) map.get("body");
Map<String, String> headers = (Map<String, String>) map.get("headers");
assert url != null;
return new URLRequest(url, method, body, headers);
}
@ -45,12 +46,12 @@ public class URLRequest {
return urlRequestMap;
}
@NonNull
@Nullable
public String getUrl() {
return url;
}
public void setUrl(@NonNull String url) {
public void setUrl(@Nullable String url) {
this.url = url;
}
@ -88,7 +89,7 @@ public class URLRequest {
URLRequest that = (URLRequest) o;
if (!url.equals(that.url)) return false;
if (url != null ? !url.equals(that.url) : that.url != null) return false;
if (method != null ? !method.equals(that.method) : that.method != null) return false;
if (!Arrays.equals(body, that.body)) return false;
return headers != null ? headers.equals(that.headers) : that.headers == null;
@ -96,7 +97,7 @@ public class URLRequest {
@Override
public int hashCode() {
int result = url.hashCode();
int result = url != null ? url.hashCode() : 0;
result = 31 * result + (method != null ? method.hashCode() : 0);
result = 31 * result + Arrays.hashCode(body);
result = 31 * result + (headers != null ? headers.hashCode() : 0);

View File

@ -0,0 +1,18 @@
#
# NOTE: This podspec is NOT to be published. It is only used as a local source!
# This is a generated file; do not edit or check into version control.
#
Pod::Spec.new do |s|
s.name = 'Flutter'
s.version = '1.0.0'
s.summary = 'High-performance, high-fidelity mobile apps.'
s.homepage = 'https://flutter.io'
s.license = { :type => 'MIT' }
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
s.ios.deployment_target = '9.0'
# Framework linking is handled by Flutter tooling, not CocoaPods.
# Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs.
s.vendored_frameworks = 'path/to/nothing'
end

View File

@ -3,11 +3,12 @@
export "FLUTTER_ROOT=/Users/lorenzopichilli/fvm/versions/2.10.4"
export "FLUTTER_APPLICATION_PATH=/Users/lorenzopichilli/flutter_inappwebview_v5/example"
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_TARGET=integration_test/webview_flutter_test.dart"
export "FLUTTER_BUILD_DIR=build"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
export "DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ=="
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=false"
export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=.packages"
export "PACKAGE_CONFIG=/Users/lorenzopichilli/flutter_inappwebview_v5/example/.dart_tool/package_config.json"

View File

@ -9,8 +9,11 @@ import Foundation
extension URLRequest {
public init(fromPluginMap: [String:Any?]) {
let url = fromPluginMap["url"] as! String
self.init(url: URL(string: url)!)
if let urlString = fromPluginMap["url"] as? String, let url = URL(string: urlString) {
self.init(url: url)
} else {
self.init(url: URL(string: "about:blank")!)
}
if let method = fromPluginMap["method"] as? String {
httpMethod = method

View File

@ -6328,7 +6328,7 @@ class IOSShouldAllowDeprecatedTLSAction {
///A URL load request that is independent of protocol or URL scheme.
class URLRequest {
///The URL of the request.
///The URL of the request. Setting this to `null` will load `about:blank`.
Uri? url;
///The HTTP request method.

View File

@ -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: 5.4.3+5
version: 5.4.3+6
homepage: https://github.com/pichillilorenzo/flutter_inappwebview
environment: