Added 'toString()' method to various classes in order to have a better output instead of simply 'Instance of ...', updated getOptions() method
This commit is contained in:
parent
7d88cd80be
commit
ad56ca6621
|
@ -1,5 +1,6 @@
|
||||||
## 3.3.0
|
## 3.3.0
|
||||||
|
|
||||||
|
- Updated API docs
|
||||||
- Updated Android context menu workaround
|
- Updated Android context menu workaround
|
||||||
- Calling `onCreateContextMenu` event on iOS also when the context menu is disabled in order to have the same effect as Android
|
- Calling `onCreateContextMenu` event on iOS also when the context menu is disabled in order to have the same effect as Android
|
||||||
- Added Android keyboard workaround to hide the keyboard when clicking other HTML elements, losing the focus on the previous input
|
- Added Android keyboard workaround to hide the keyboard when clicking other HTML elements, losing the focus on the previous input
|
||||||
|
@ -10,11 +11,13 @@
|
||||||
- Added `getCurrentWebViewPackage` static webview method on Android
|
- Added `getCurrentWebViewPackage` static webview method on Android
|
||||||
- Added `onPageCommitVisible` webview event
|
- Added `onPageCommitVisible` webview event
|
||||||
- Added `androidShouldInterceptRequest`, `androidOnRenderProcessUnresponsive`, `androidOnRenderProcessResponsive`, `androidOnRenderProcessGone`, `androidOnFormResubmission`, `androidOnScaleChanged` Android events
|
- Added `androidShouldInterceptRequest`, `androidOnRenderProcessUnresponsive`, `androidOnRenderProcessResponsive`, `androidOnRenderProcessGone`, `androidOnFormResubmission`, `androidOnScaleChanged` Android events
|
||||||
|
- Added `toString()` method to various classes in order to have a better output instead of simply `Instance of ...`
|
||||||
- Fixed `Print preview is not working? java.lang.IllegalStateException: Can print only from an activity` [#128](https://github.com/pichillilorenzo/flutter_inappwebview/issues/128)
|
- Fixed `Print preview is not working? java.lang.IllegalStateException: Can print only from an activity` [#128](https://github.com/pichillilorenzo/flutter_inappwebview/issues/128)
|
||||||
- Fixed `onJsAlert`, `onJsConfirm`, `onJsPrompt` for `InAppBrowser` on Android
|
- Fixed `onJsAlert`, `onJsConfirm`, `onJsPrompt` for `InAppBrowser` on Android
|
||||||
- Fixed `onActivityResult` for `InAppBrowser` on Android
|
- Fixed `onActivityResult` for `InAppBrowser` on Android
|
||||||
- Fixed `InAppBrowser.openWithSystemBrowser crash on iOS` [#358](https://github.com/pichillilorenzo/flutter_inappwebview/issues/358)
|
- Fixed `InAppBrowser.openWithSystemBrowser crash on iOS` [#358](https://github.com/pichillilorenzo/flutter_inappwebview/issues/358)
|
||||||
- Fixed `Attempt to invoke virtual method 'java.util.Set java.util.HashMap.entrySet()' on a null object reference` [#367](https://github.com/pichillilorenzo/flutter_inappwebview/issues/367)
|
- Fixed `Attempt to invoke virtual method 'java.util.Set java.util.HashMap.entrySet()' on a null object reference` [#367](https://github.com/pichillilorenzo/flutter_inappwebview/issues/367)
|
||||||
|
- Fixed missing `allowsAirPlayForMediaPlayback` iOS webview options implementation
|
||||||
|
|
||||||
### BREAKING CHANGES
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
|
|
@ -29,13 +29,13 @@ public class ChromeCustomTabsActivity extends Activity implements MethodChannel.
|
||||||
protected static final String LOG_TAG = "CustomTabsActivity";
|
protected static final String LOG_TAG = "CustomTabsActivity";
|
||||||
public MethodChannel channel;
|
public MethodChannel channel;
|
||||||
public String uuid;
|
public String uuid;
|
||||||
private CustomTabsIntent.Builder builder;
|
public CustomTabsIntent.Builder builder;
|
||||||
private ChromeCustomTabsOptions options;
|
public ChromeCustomTabsOptions options;
|
||||||
private CustomTabActivityHelper customTabActivityHelper;
|
public CustomTabActivityHelper customTabActivityHelper;
|
||||||
private CustomTabsSession customTabsSession;
|
public CustomTabsSession customTabsSession;
|
||||||
private final int CHROME_CUSTOM_TAB_REQUEST_CODE = 100;
|
protected final int CHROME_CUSTOM_TAB_REQUEST_CODE = 100;
|
||||||
private boolean onChromeSafariBrowserOpened = false;
|
protected boolean onChromeSafariBrowserOpened = false;
|
||||||
private boolean onChromeSafariBrowserCompletedInitialLoad = false;
|
protected boolean onChromeSafariBrowserCompletedInitialLoad = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
|
@ -1,69 +1,84 @@
|
||||||
package com.pichillilorenzo.flutter_inappwebview.ChromeCustomTabs;
|
package com.pichillilorenzo.flutter_inappwebview.ChromeCustomTabs;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
import com.pichillilorenzo.flutter_inappwebview.Options;
|
import com.pichillilorenzo.flutter_inappwebview.Options;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class ChromeCustomTabsOptions implements Options {
|
public class ChromeCustomTabsOptions implements Options<ChromeCustomTabsActivity> {
|
||||||
|
|
||||||
final static String LOG_TAG = "ChromeCustomTabsOptions";
|
final static String LOG_TAG = "ChromeCustomTabsOptions";
|
||||||
|
|
||||||
public Boolean addDefaultShareMenuItem = true;
|
public Boolean addDefaultShareMenuItem = true;
|
||||||
public Boolean showTitle = true;
|
public Boolean showTitle = true;
|
||||||
public String toolbarBackgroundColor = "";
|
public String toolbarBackgroundColor = "";
|
||||||
public Boolean enableUrlBarHiding = false;
|
public Boolean enableUrlBarHiding = false;
|
||||||
public Boolean instantAppsEnabled = false;
|
public Boolean instantAppsEnabled = false;
|
||||||
public String packageName;
|
public String packageName;
|
||||||
public Boolean keepAliveEnabled = false;
|
public Boolean keepAliveEnabled = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChromeCustomTabsOptions parse(HashMap<String, Object> options) {
|
public ChromeCustomTabsOptions parse(Map<String, Object> options) {
|
||||||
for (Map.Entry<String, Object> pair : options.entrySet()) {
|
for (Map.Entry<String, Object> pair : options.entrySet()) {
|
||||||
String key = pair.getKey();
|
String key = pair.getKey();
|
||||||
Object value = pair.getValue();
|
Object value = pair.getValue();
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case "addDefaultShareMenuItem":
|
case "addDefaultShareMenuItem":
|
||||||
addDefaultShareMenuItem = (boolean) value;
|
addDefaultShareMenuItem = (boolean) value;
|
||||||
break;
|
break;
|
||||||
case "showTitle":
|
case "showTitle":
|
||||||
showTitle = (boolean) value;
|
showTitle = (boolean) value;
|
||||||
break;
|
break;
|
||||||
case "toolbarBackgroundColor":
|
case "toolbarBackgroundColor":
|
||||||
toolbarBackgroundColor = (String) value;
|
toolbarBackgroundColor = (String) value;
|
||||||
break;
|
break;
|
||||||
case "enableUrlBarHiding":
|
case "enableUrlBarHiding":
|
||||||
enableUrlBarHiding = (boolean) value;
|
enableUrlBarHiding = (boolean) value;
|
||||||
break;
|
break;
|
||||||
case "instantAppsEnabled":
|
case "instantAppsEnabled":
|
||||||
instantAppsEnabled = (boolean) value;
|
instantAppsEnabled = (boolean) value;
|
||||||
break;
|
break;
|
||||||
case "packageName":
|
case "packageName":
|
||||||
packageName = (String) value;
|
packageName = (String) value;
|
||||||
break;
|
break;
|
||||||
case "keepAliveEnabled":
|
case "keepAliveEnabled":
|
||||||
keepAliveEnabled = (boolean) value;
|
keepAliveEnabled = (boolean) value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
return this;
|
||||||
public HashMap<String, Object> getHashMap() {
|
}
|
||||||
HashMap<String, Object> options = new HashMap<>();
|
|
||||||
options.put("addDefaultShareMenuItem", addDefaultShareMenuItem);
|
@Override
|
||||||
options.put("showTitle", showTitle);
|
public Map<String, Object> toMap() {
|
||||||
options.put("toolbarBackgroundColor", toolbarBackgroundColor);
|
Map<String, Object> options = new HashMap<>();
|
||||||
options.put("enableUrlBarHiding", enableUrlBarHiding);
|
options.put("addDefaultShareMenuItem", addDefaultShareMenuItem);
|
||||||
options.put("instantAppsEnabled", instantAppsEnabled);
|
options.put("showTitle", showTitle);
|
||||||
options.put("packageName", packageName);
|
options.put("toolbarBackgroundColor", toolbarBackgroundColor);
|
||||||
options.put("keepAliveEnabled", keepAliveEnabled);
|
options.put("enableUrlBarHiding", enableUrlBarHiding);
|
||||||
return options;
|
options.put("instantAppsEnabled", instantAppsEnabled);
|
||||||
|
options.put("packageName", packageName);
|
||||||
|
options.put("keepAliveEnabled", keepAliveEnabled);
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getRealOptions(ChromeCustomTabsActivity chromeCustomTabsActivity) {
|
||||||
|
Map<String, Object> realOptions = toMap();
|
||||||
|
if (chromeCustomTabsActivity != null) {
|
||||||
|
Intent intent = chromeCustomTabsActivity.getIntent();
|
||||||
|
if (intent != null) {
|
||||||
|
realOptions.put("packageName", intent.getPackage());
|
||||||
|
realOptions.put("keepAliveEnabled", intent.hasExtra(CustomTabsHelper.EXTRA_CUSTOM_TABS_KEEP_ALIVE));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return realOptions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,12 +18,12 @@ import java.util.List;
|
||||||
* Helper class for Custom Tabs.
|
* Helper class for Custom Tabs.
|
||||||
*/
|
*/
|
||||||
public class CustomTabsHelper {
|
public class CustomTabsHelper {
|
||||||
private static final String TAG = "CustomTabsHelper";
|
protected static final String TAG = "CustomTabsHelper";
|
||||||
static final String STABLE_PACKAGE = "com.android.chrome";
|
static final String STABLE_PACKAGE = "com.android.chrome";
|
||||||
static final String BETA_PACKAGE = "com.chrome.beta";
|
static final String BETA_PACKAGE = "com.chrome.beta";
|
||||||
static final String DEV_PACKAGE = "com.chrome.dev";
|
static final String DEV_PACKAGE = "com.chrome.dev";
|
||||||
static final String LOCAL_PACKAGE = "com.google.android.apps.chrome";
|
static final String LOCAL_PACKAGE = "com.google.android.apps.chrome";
|
||||||
private static final String EXTRA_CUSTOM_TABS_KEEP_ALIVE =
|
protected static final String EXTRA_CUSTOM_TABS_KEEP_ALIVE =
|
||||||
"android.support.customtabs.extra.KEEP_ALIVE";
|
"android.support.customtabs.extra.KEEP_ALIVE";
|
||||||
|
|
||||||
private static String sPackageNameToUse;
|
private static String sPackageNameToUse;
|
||||||
|
|
|
@ -72,14 +72,14 @@ public class ChromeSafariBrowserManager implements MethodChannel.MethodCallHandl
|
||||||
intent = new Intent(activity, ChromeCustomTabsActivity.class);
|
intent = new Intent(activity, ChromeCustomTabsActivity.class);
|
||||||
}
|
}
|
||||||
// check for webview fallback
|
// check for webview fallback
|
||||||
else if (!CustomTabActivityHelper.isAvailable(activity) && !uuidFallback.isEmpty()) {
|
else if (!CustomTabActivityHelper.isAvailable(activity) && uuidFallback != null) {
|
||||||
Log.d(LOG_TAG, "WebView fallback declared.");
|
Log.d(LOG_TAG, "WebView fallback declared.");
|
||||||
// overwrite with extras fallback parameters
|
// overwrite with extras fallback parameters
|
||||||
extras.putString("uuid", uuidFallback);
|
extras.putString("uuid", uuidFallback);
|
||||||
if (optionsFallback != null)
|
if (optionsFallback != null)
|
||||||
extras.putSerializable("options", optionsFallback);
|
extras.putSerializable("options", optionsFallback);
|
||||||
else
|
else
|
||||||
extras.putSerializable("options", (new InAppBrowserOptions()).getHashMap());
|
extras.putSerializable("options", (Serializable) (new InAppBrowserOptions()).toMap());
|
||||||
intent = new Intent(activity, InAppBrowserActivity.class);
|
intent = new Intent(activity, InAppBrowserActivity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -707,12 +707,12 @@ public class InAppBrowserActivity extends AppCompatActivity implements MethodCha
|
||||||
options = newOptions;
|
options = newOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String, Object> getOptions() {
|
public Map<String, Object> getOptions() {
|
||||||
HashMap<String, Object> webViewOptionsMap = webView.getOptions();
|
Map<String, Object> webViewOptionsMap = webView.getOptions();
|
||||||
if (options == null || webViewOptionsMap == null)
|
if (options == null || webViewOptionsMap == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
HashMap<String, Object> optionsMap = options.getHashMap();
|
Map<String, Object> optionsMap = options.getRealOptions(this);
|
||||||
optionsMap.putAll(webViewOptionsMap);
|
optionsMap.putAll(webViewOptionsMap);
|
||||||
return optionsMap;
|
return optionsMap;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.pichillilorenzo.flutter_inappwebview.Options;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class InAppBrowserOptions implements Options {
|
public class InAppBrowserOptions implements Options<InAppBrowserActivity> {
|
||||||
|
|
||||||
public static final String LOG_TAG = "InAppBrowserOptions";
|
public static final String LOG_TAG = "InAppBrowserOptions";
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class InAppBrowserOptions implements Options {
|
||||||
public Boolean progressBar = true;
|
public Boolean progressBar = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InAppBrowserOptions parse(HashMap<String, Object> options) {
|
public InAppBrowserOptions parse(Map<String, Object> options) {
|
||||||
for (Map.Entry<String, Object> pair : options.entrySet()) {
|
for (Map.Entry<String, Object> pair : options.entrySet()) {
|
||||||
String key = pair.getKey();
|
String key = pair.getKey();
|
||||||
Object value = pair.getValue();
|
Object value = pair.getValue();
|
||||||
|
@ -60,8 +60,8 @@ public class InAppBrowserOptions implements Options {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HashMap<String, Object> getHashMap() {
|
public Map<String, Object> toMap() {
|
||||||
HashMap<String, Object> options = new HashMap<>();
|
Map<String, Object> options = new HashMap<>();
|
||||||
options.put("hidden", hidden);
|
options.put("hidden", hidden);
|
||||||
options.put("toolbarTop", toolbarTop);
|
options.put("toolbarTop", toolbarTop);
|
||||||
options.put("toolbarTopBackgroundColor", toolbarTopBackgroundColor);
|
options.put("toolbarTopBackgroundColor", toolbarTopBackgroundColor);
|
||||||
|
@ -72,4 +72,10 @@ public class InAppBrowserOptions implements Options {
|
||||||
options.put("progressBar", progressBar);
|
options.put("progressBar", progressBar);
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getRealOptions(InAppBrowserActivity inAppBrowserActivity) {
|
||||||
|
Map<String, Object> realOptions = toMap();
|
||||||
|
return realOptions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.pichillilorenzo.flutter_inappwebview.InAppWebView;
|
package com.pichillilorenzo.flutter_inappwebview.InAppWebView;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
@ -73,6 +72,7 @@ final public class InAppWebView extends InputAwareWebView {
|
||||||
public InAppWebViewClient inAppWebViewClient;
|
public InAppWebViewClient inAppWebViewClient;
|
||||||
public InAppWebViewChromeClient inAppWebViewChromeClient;
|
public InAppWebViewChromeClient inAppWebViewChromeClient;
|
||||||
public InAppWebViewRenderProcessClient inAppWebViewRenderProcessClient;
|
public InAppWebViewRenderProcessClient inAppWebViewRenderProcessClient;
|
||||||
|
public JavaScriptBridgeInterface javaScriptBridgeInterface;
|
||||||
public InAppWebViewOptions options;
|
public InAppWebViewOptions options;
|
||||||
public boolean isLoading = false;
|
public boolean isLoading = false;
|
||||||
public OkHttpClient httpClient;
|
public OkHttpClient httpClient;
|
||||||
|
@ -632,7 +632,8 @@ final public class InAppWebView extends InputAwareWebView {
|
||||||
|
|
||||||
httpClient = new OkHttpClient().newBuilder().build();
|
httpClient = new OkHttpClient().newBuilder().build();
|
||||||
|
|
||||||
addJavascriptInterface(new JavaScriptBridgeInterface((isFromInAppBrowserActivity) ? inAppBrowserActivity : flutterWebView), JavaScriptBridgeInterface.name);
|
javaScriptBridgeInterface = new JavaScriptBridgeInterface((isFromInAppBrowserActivity) ? inAppBrowserActivity : flutterWebView);
|
||||||
|
addJavascriptInterface(javaScriptBridgeInterface, JavaScriptBridgeInterface.name);
|
||||||
|
|
||||||
inAppWebViewChromeClient = new InAppWebViewChromeClient((isFromInAppBrowserActivity) ? inAppBrowserActivity : flutterWebView);
|
inAppWebViewChromeClient = new InAppWebViewChromeClient((isFromInAppBrowserActivity) ? inAppBrowserActivity : flutterWebView);
|
||||||
setWebChromeClient(inAppWebViewChromeClient);
|
setWebChromeClient(inAppWebViewChromeClient);
|
||||||
|
@ -1373,8 +1374,8 @@ final public class InAppWebView extends InputAwareWebView {
|
||||||
options = newOptions;
|
options = newOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String, Object> getOptions() {
|
public Map<String, Object> getOptions() {
|
||||||
return (options != null) ? options.getHashMap() : null;
|
return (options != null) ? options.getRealOptions(this) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void injectDeferredObject(String source, String jsWrapper, final MethodChannel.Result result) {
|
public void injectDeferredObject(String source, String jsWrapper, final MethodChannel.Result result) {
|
||||||
|
|
|
@ -5,18 +5,17 @@ import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.webkit.WebSettings;
|
import android.webkit.WebSettings;
|
||||||
|
|
||||||
import com.pichillilorenzo.flutter_inappwebview.ChromeCustomTabs.ChromeCustomTabsOptions;
|
|
||||||
import com.pichillilorenzo.flutter_inappwebview.Options;
|
import com.pichillilorenzo.flutter_inappwebview.Options;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static android.webkit.WebSettings.LayoutAlgorithm.NARROW_COLUMNS;
|
||||||
import static android.webkit.WebSettings.LayoutAlgorithm.NORMAL;
|
import static android.webkit.WebSettings.LayoutAlgorithm.NORMAL;
|
||||||
|
|
||||||
public class InAppWebViewOptions implements Options {
|
public class InAppWebViewOptions implements Options<InAppWebView> {
|
||||||
|
|
||||||
public static final String LOG_TAG = "InAppWebViewOptions";
|
public static final String LOG_TAG = "InAppWebViewOptions";
|
||||||
|
|
||||||
|
@ -99,7 +98,7 @@ public class InAppWebViewOptions implements Options {
|
||||||
public Boolean useOnRenderProcessGone = false;
|
public Boolean useOnRenderProcessGone = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InAppWebViewOptions parse(HashMap<String, Object> options) {
|
public InAppWebViewOptions parse(Map<String, Object> options) {
|
||||||
for (Map.Entry<String, Object> pair : options.entrySet()) {
|
for (Map.Entry<String, Object> pair : options.entrySet()) {
|
||||||
String key = pair.getKey();
|
String key = pair.getKey();
|
||||||
Object value = pair.getValue();
|
Object value = pair.getValue();
|
||||||
|
@ -343,8 +342,8 @@ public class InAppWebViewOptions implements Options {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HashMap<String, Object> getHashMap() {
|
public Map<String, Object> toMap() {
|
||||||
HashMap<String, Object> options = new HashMap<>();
|
Map<String, Object> options = new HashMap<>();
|
||||||
options.put("useShouldOverrideUrlLoading", useShouldOverrideUrlLoading);
|
options.put("useShouldOverrideUrlLoading", useShouldOverrideUrlLoading);
|
||||||
options.put("useOnLoadResource", useOnLoadResource);
|
options.put("useOnLoadResource", useOnLoadResource);
|
||||||
options.put("useOnDownloadStart", useOnDownloadStart);
|
options.put("useOnDownloadStart", useOnDownloadStart);
|
||||||
|
@ -424,9 +423,83 @@ public class InAppWebViewOptions implements Options {
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getRealOptions(InAppWebView webView) {
|
||||||
|
Map<String, Object> realOptions = toMap();
|
||||||
|
if (webView != null) {
|
||||||
|
WebSettings settings = webView.getSettings();
|
||||||
|
realOptions.put("userAgent", settings.getUserAgentString());
|
||||||
|
realOptions.put("javaScriptEnabled", settings.getJavaScriptEnabled());
|
||||||
|
realOptions.put("javaScriptCanOpenWindowsAutomatically", settings.getJavaScriptCanOpenWindowsAutomatically());
|
||||||
|
realOptions.put("mediaPlaybackRequiresUserGesture", settings.getMediaPlaybackRequiresUserGesture());
|
||||||
|
realOptions.put("minimumFontSize", settings.getMinimumFontSize());
|
||||||
|
realOptions.put("verticalScrollBarEnabled", webView.isVerticalScrollBarEnabled());
|
||||||
|
realOptions.put("horizontalScrollBarEnabled", webView.isHorizontalScrollBarEnabled());
|
||||||
|
realOptions.put("textZoom", settings.getTextZoom());
|
||||||
|
realOptions.put("builtInZoomControls", settings.getBuiltInZoomControls());
|
||||||
|
realOptions.put("supportZoom", settings.supportZoom());
|
||||||
|
realOptions.put("displayZoomControls", settings.getDisplayZoomControls());
|
||||||
|
realOptions.put("databaseEnabled", settings.getDatabaseEnabled());
|
||||||
|
realOptions.put("domStorageEnabled", settings.getDomStorageEnabled());
|
||||||
|
realOptions.put("useWideViewPort", settings.getUseWideViewPort());
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
realOptions.put("safeBrowsingEnabled", settings.getSafeBrowsingEnabled());
|
||||||
|
}
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
realOptions.put("mixedContentMode", settings.getMixedContentMode());
|
||||||
|
}
|
||||||
|
realOptions.put("allowContentAccess", settings.getAllowContentAccess());
|
||||||
|
realOptions.put("allowFileAccess", settings.getAllowFileAccess());
|
||||||
|
realOptions.put("allowFileAccessFromFileURLs", settings.getAllowFileAccessFromFileURLs());
|
||||||
|
realOptions.put("allowUniversalAccessFromFileURLs", settings.getAllowUniversalAccessFromFileURLs());
|
||||||
|
realOptions.put("blockNetworkImage", settings.getBlockNetworkImage());
|
||||||
|
realOptions.put("blockNetworkLoads", settings.getBlockNetworkLoads());
|
||||||
|
realOptions.put("cacheMode", settings.getCacheMode());
|
||||||
|
realOptions.put("cursiveFontFamily", settings.getCursiveFontFamily());
|
||||||
|
realOptions.put("defaultFixedFontSize", settings.getDefaultFixedFontSize());
|
||||||
|
realOptions.put("defaultFontSize", settings.getDefaultFontSize());
|
||||||
|
realOptions.put("defaultTextEncodingName", settings.getDefaultTextEncodingName());
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
realOptions.put("disabledActionModeMenuItems", settings.getDisabledActionModeMenuItems());
|
||||||
|
}
|
||||||
|
realOptions.put("fantasyFontFamily", settings.getFantasyFontFamily());
|
||||||
|
realOptions.put("fixedFontFamily", settings.getFixedFontFamily());
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
|
realOptions.put("forceDark", settings.getForceDark());
|
||||||
|
}
|
||||||
|
realOptions.put("layoutAlgorithm", settings.getLayoutAlgorithm().name());
|
||||||
|
realOptions.put("loadWithOverviewMode", settings.getLoadWithOverviewMode());
|
||||||
|
realOptions.put("loadsImagesAutomatically", settings.getLoadsImagesAutomatically());
|
||||||
|
realOptions.put("minimumLogicalFontSize", settings.getMinimumLogicalFontSize());
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
realOptions.put("offscreenPreRaster", settings.getOffscreenPreRaster());
|
||||||
|
}
|
||||||
|
realOptions.put("sansSerifFontFamily", settings.getSansSerifFontFamily());
|
||||||
|
realOptions.put("serifFontFamily", settings.getSerifFontFamily());
|
||||||
|
realOptions.put("standardFontFamily", settings.getStandardFontFamily());
|
||||||
|
realOptions.put("saveFormData", settings.getSaveFormData());
|
||||||
|
realOptions.put("supportMultipleWindows", settings.supportMultipleWindows());
|
||||||
|
realOptions.put("overScrollMode", webView.getOverScrollMode());
|
||||||
|
realOptions.put("scrollBarStyle", webView.getScrollBarStyle());
|
||||||
|
realOptions.put("verticalScrollbarPosition", webView.getVerticalScrollbarPosition());
|
||||||
|
realOptions.put("scrollBarDefaultDelayBeforeFade", webView.getScrollBarDefaultDelayBeforeFade());
|
||||||
|
realOptions.put("scrollbarFadingEnabled", webView.isScrollbarFadingEnabled());
|
||||||
|
realOptions.put("scrollBarFadeDuration", webView.getScrollBarFadeDuration());
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
Map<String, Object> rendererPriorityPolicy = new HashMap<>();
|
||||||
|
rendererPriorityPolicy.put("rendererRequestedPriority", webView.getRendererRequestedPriority());
|
||||||
|
rendererPriorityPolicy.put("waivedWhenNotVisible", webView.getRendererPriorityWaivedWhenNotVisible());
|
||||||
|
realOptions.put("rendererPriorityPolicy", rendererPriorityPolicy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return realOptions;
|
||||||
|
}
|
||||||
|
|
||||||
private void setLayoutAlgorithm(String value) {
|
private void setLayoutAlgorithm(String value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
|
case "NARROW_COLUMNS":
|
||||||
|
layoutAlgorithm = NARROW_COLUMNS;
|
||||||
case "NORMAL":
|
case "NORMAL":
|
||||||
layoutAlgorithm = NORMAL;
|
layoutAlgorithm = NORMAL;
|
||||||
case "TEXT_AUTOSIZING":
|
case "TEXT_AUTOSIZING":
|
||||||
|
@ -451,6 +524,8 @@ public class InAppWebViewOptions implements Options {
|
||||||
} else {
|
} else {
|
||||||
return "NORMAL";
|
return "NORMAL";
|
||||||
}
|
}
|
||||||
|
case NARROW_COLUMNS:
|
||||||
|
return "NARROW_COLUMNS";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package com.pichillilorenzo.flutter_inappwebview;
|
package com.pichillilorenzo.flutter_inappwebview;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.Map;
|
||||||
|
|
||||||
public interface Options {
|
public interface Options<T> {
|
||||||
static String LOG_TAG = "Options";
|
static String LOG_TAG = "Options";
|
||||||
public Options parse(HashMap<String, Object> options);
|
public Options parse(Map<String, Object> options);
|
||||||
public HashMap<String, Object> getHashMap();
|
public Map<String, Object> toMap();
|
||||||
|
public Map<String, Object> getRealOptions(T webView);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"e2e","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/e2e-0.2.4+4/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.0.0+hotfix.6/","dependencies":[]}],"android":[{"name":"e2e","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/e2e-0.2.4+4/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.0.0+hotfix.6/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"e2e","dependencies":[]},{"name":"flutter_inappwebview","dependencies":[]},{"name":"permission_handler","dependencies":[]}],"date_created":"2020-05-29 10:25:22.515235","version":"1.17.1"}
|
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"e2e","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/e2e-0.2.4+4/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.0.0+hotfix.6/","dependencies":[]}],"android":[{"name":"e2e","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/e2e-0.2.4+4/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.0.0+hotfix.6/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"e2e","dependencies":[]},{"name":"flutter_inappwebview","dependencies":[]},{"name":"permission_handler","dependencies":[]}],"date_created":"2020-05-29 19:53:44.213613","version":"1.17.1"}
|
|
@ -4,7 +4,7 @@ import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||||
import 'main.dart';
|
import 'main.dart';
|
||||||
|
|
||||||
class MyChromeSafariBrowser extends ChromeSafariBrowser {
|
class MyChromeSafariBrowser extends ChromeSafariBrowser {
|
||||||
MyChromeSafariBrowser(browserFallback) : super(bFallback: browserFallback);
|
MyChromeSafariBrowser({browserFallback}) : super(bFallback: browserFallback);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onOpened() {
|
void onOpened() {
|
||||||
|
@ -24,23 +24,23 @@ class MyChromeSafariBrowser extends ChromeSafariBrowser {
|
||||||
|
|
||||||
class ChromeSafariBrowserExampleScreen extends StatefulWidget {
|
class ChromeSafariBrowserExampleScreen extends StatefulWidget {
|
||||||
final ChromeSafariBrowser browser =
|
final ChromeSafariBrowser browser =
|
||||||
new MyChromeSafariBrowser(new InAppBrowser());
|
MyChromeSafariBrowser(browserFallback: InAppBrowser());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_ChromeSafariBrowserExampleScreenState createState() =>
|
_ChromeSafariBrowserExampleScreenState createState() =>
|
||||||
new _ChromeSafariBrowserExampleScreenState();
|
_ChromeSafariBrowserExampleScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ChromeSafariBrowserExampleScreenState
|
class _ChromeSafariBrowserExampleScreenState
|
||||||
extends State<ChromeSafariBrowserExampleScreen> {
|
extends State<ChromeSafariBrowserExampleScreen> {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
widget.browser.addMenuItem(new ChromeSafariBrowserMenuItem(id: 1, label: 'Custom item menu 1', action: (url, title) {
|
widget.browser.addMenuItem(ChromeSafariBrowserMenuItem(id: 1, label: 'Custom item menu 1', action: (url, title) {
|
||||||
print('Custom item menu 1 clicked!');
|
print('Custom item menu 1 clicked!');
|
||||||
print(url);
|
print(url);
|
||||||
print(title);
|
print(title);
|
||||||
}));
|
}));
|
||||||
widget.browser.addMenuItem(new ChromeSafariBrowserMenuItem(id: 2, label: 'Custom item menu 2', action: (url, title) {
|
widget.browser.addMenuItem(ChromeSafariBrowserMenuItem(id: 2, label: 'Custom item menu 2', action: (url, title) {
|
||||||
print('Custom item menu 2 clicked!');
|
print('Custom item menu 2 clicked!');
|
||||||
print(url);
|
print(url);
|
||||||
print(title);
|
print(title);
|
||||||
|
|
|
@ -39,10 +39,10 @@ public class ChromeSafariBrowserManager: NSObject, FlutterPlugin {
|
||||||
let url = arguments!["url"] as! String
|
let url = arguments!["url"] as! String
|
||||||
let options = arguments!["options"] as! [String: Any?]
|
let options = arguments!["options"] as! [String: Any?]
|
||||||
let menuItemList = arguments!["menuItemList"] as! [[String: Any]]
|
let menuItemList = arguments!["menuItemList"] as! [[String: Any]]
|
||||||
let uuidFallback: String = arguments!["uuidFallback"] as! String
|
let uuidFallback = arguments!["uuidFallback"] as? String
|
||||||
let headersFallback = arguments!["headersFallback"] as! [String: String]
|
let headersFallback = arguments!["headersFallback"] as? [String: String]
|
||||||
let optionsFallback = arguments!["optionsFallback"] as! [String: Any?]
|
let optionsFallback = arguments!["optionsFallback"] as? [String: Any?]
|
||||||
let contextMenuFallback = arguments!["contextMenuFallback"] as! [String: Any]
|
let contextMenuFallback = arguments!["contextMenuFallback"] as? [String: Any]
|
||||||
open(uuid: uuid, url: url, options: options, menuItemList: menuItemList, uuidFallback: uuidFallback, headersFallback: headersFallback, optionsFallback: optionsFallback, contextMenuFallback: contextMenuFallback, result: result)
|
open(uuid: uuid, url: url, options: options, menuItemList: menuItemList, uuidFallback: uuidFallback, headersFallback: headersFallback, optionsFallback: optionsFallback, contextMenuFallback: contextMenuFallback, result: result)
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
|
@ -51,7 +51,7 @@ public class ChromeSafariBrowserManager: NSObject, FlutterPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func open(uuid: String, url: String, options: [String: Any?], menuItemList: [[String: Any]], uuidFallback: String, headersFallback: [String: String], optionsFallback: [String: Any?], contextMenuFallback: [String: Any], result: @escaping FlutterResult) {
|
public func open(uuid: String, url: String, options: [String: Any?], menuItemList: [[String: Any]], uuidFallback: String?, headersFallback: [String: String]?, optionsFallback: [String: Any?]?, contextMenuFallback: [String: Any]?, result: @escaping FlutterResult) {
|
||||||
let absoluteUrl = URL(string: url)!.absoluteURL
|
let absoluteUrl = URL(string: url)!.absoluteURL
|
||||||
|
|
||||||
if self.previousStatusBarStyle == -1 {
|
if self.previousStatusBarStyle == -1 {
|
||||||
|
@ -106,7 +106,7 @@ public class ChromeSafariBrowserManager: NSObject, FlutterPlugin {
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
SwiftFlutterPlugin.instance!.inAppBrowserManager!.openUrl(uuid: uuidFallback, url: url, options: optionsFallback, headers: headersFallback, contextMenu: contextMenuFallback)
|
SwiftFlutterPlugin.instance!.inAppBrowserManager!.openUrl(uuid: uuidFallback!, url: url, options: optionsFallback ?? [:], headers: headersFallback ?? [:], contextMenu: contextMenuFallback ?? [:])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
@objcMembers
|
@objcMembers
|
||||||
public class InAppBrowserOptions: Options {
|
public class InAppBrowserOptions: Options<InAppBrowserWebViewController> {
|
||||||
|
|
||||||
var hidden = false
|
var hidden = false
|
||||||
var toolbarTop = true
|
var toolbarTop = true
|
||||||
|
@ -29,5 +29,12 @@ public class InAppBrowserOptions: Options {
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func getRealOptions(obj: InAppBrowserWebViewController?) -> [String: Any?] {
|
||||||
|
var realOptions: [String: Any?] = toMap()
|
||||||
|
if let inAppBrowserWebViewController = obj {
|
||||||
|
realOptions["presentationStyle"] = inAppBrowserWebViewController.modalPresentationStyle.rawValue
|
||||||
|
realOptions["transitionStyle"] = inAppBrowserWebViewController.modalTransitionStyle.rawValue
|
||||||
|
}
|
||||||
|
return realOptions
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -688,11 +688,12 @@ public class InAppBrowserWebViewController: UIViewController, FlutterPlugin, UIS
|
||||||
}
|
}
|
||||||
|
|
||||||
public func getOptions() -> [String: Any?]? {
|
public func getOptions() -> [String: Any?]? {
|
||||||
if (self.browserOptions == nil || self.webView.getOptions() == nil) {
|
let webViewOptionsMap = self.webView.getOptions()
|
||||||
|
if (self.browserOptions == nil || webViewOptionsMap == nil) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
var optionsMap = self.browserOptions!.getHashMap()
|
var optionsMap = self.browserOptions!.getRealOptions(obj: self)
|
||||||
optionsMap.merge(self.webView.getOptions()!, uniquingKeysWith: { (current, _) in current })
|
optionsMap.merge(webViewOptionsMap!, uniquingKeysWith: { (current, _) in current })
|
||||||
return optionsMap
|
return optionsMap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1056,6 +1056,7 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
|
||||||
allowsBackForwardNavigationGestures = (options?.allowsBackForwardNavigationGestures)!
|
allowsBackForwardNavigationGestures = (options?.allowsBackForwardNavigationGestures)!
|
||||||
if #available(iOS 9.0, *) {
|
if #available(iOS 9.0, *) {
|
||||||
allowsLinkPreview = (options?.allowsLinkPreview)!
|
allowsLinkPreview = (options?.allowsLinkPreview)!
|
||||||
|
configuration.allowsAirPlayForMediaPlayback = (options?.allowsAirPlayForMediaPlayback)!
|
||||||
configuration.allowsPictureInPictureMediaPlayback = (options?.allowsPictureInPictureMediaPlayback)!
|
configuration.allowsPictureInPictureMediaPlayback = (options?.allowsPictureInPictureMediaPlayback)!
|
||||||
if (options?.applicationNameForUserAgent != nil && (options?.applicationNameForUserAgent)! != "") {
|
if (options?.applicationNameForUserAgent != nil && (options?.applicationNameForUserAgent)! != "") {
|
||||||
configuration.applicationNameForUserAgent = (options?.applicationNameForUserAgent)!
|
configuration.applicationNameForUserAgent = (options?.applicationNameForUserAgent)!
|
||||||
|
@ -1075,7 +1076,7 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
|
||||||
|
|
||||||
var dataDetectorTypes = WKDataDetectorTypes.init(rawValue: 0)
|
var dataDetectorTypes = WKDataDetectorTypes.init(rawValue: 0)
|
||||||
for type in options?.dataDetectorTypes ?? [] {
|
for type in options?.dataDetectorTypes ?? [] {
|
||||||
let dataDetectorType = getDataDetectorType(type: type)
|
let dataDetectorType = InAppWebView.getDataDetectorType(type: type)
|
||||||
dataDetectorTypes = WKDataDetectorTypes(rawValue: dataDetectorTypes.rawValue | dataDetectorType.rawValue)
|
dataDetectorTypes = WKDataDetectorTypes(rawValue: dataDetectorTypes.rawValue | dataDetectorType.rawValue)
|
||||||
}
|
}
|
||||||
configuration.dataDetectorTypes = dataDetectorTypes
|
configuration.dataDetectorTypes = dataDetectorTypes
|
||||||
|
@ -1094,7 +1095,7 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
|
||||||
scrollView.showsVerticalScrollIndicator = (options?.verticalScrollBarEnabled)!
|
scrollView.showsVerticalScrollIndicator = (options?.verticalScrollBarEnabled)!
|
||||||
scrollView.showsHorizontalScrollIndicator = (options?.horizontalScrollBarEnabled)!
|
scrollView.showsHorizontalScrollIndicator = (options?.horizontalScrollBarEnabled)!
|
||||||
|
|
||||||
scrollView.decelerationRate = getDecelerationRate(type: (options?.decelerationRate)!)
|
scrollView.decelerationRate = InAppWebView.getDecelerationRate(type: (options?.decelerationRate)!)
|
||||||
scrollView.alwaysBounceVertical = (options?.alwaysBounceVertical)!
|
scrollView.alwaysBounceVertical = (options?.alwaysBounceVertical)!
|
||||||
scrollView.alwaysBounceHorizontal = (options?.alwaysBounceHorizontal)!
|
scrollView.alwaysBounceHorizontal = (options?.alwaysBounceHorizontal)!
|
||||||
scrollView.scrollsToTop = (options?.scrollsToTop)!
|
scrollView.scrollsToTop = (options?.scrollsToTop)!
|
||||||
|
@ -1110,7 +1111,7 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(iOS 10.0, *)
|
@available(iOS 10.0, *)
|
||||||
public func getDataDetectorType(type: String) -> WKDataDetectorTypes {
|
static public func getDataDetectorType(type: String) -> WKDataDetectorTypes {
|
||||||
switch type {
|
switch type {
|
||||||
case "NONE":
|
case "NONE":
|
||||||
return WKDataDetectorTypes.init(rawValue: 0)
|
return WKDataDetectorTypes.init(rawValue: 0)
|
||||||
|
@ -1137,7 +1138,44 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func getDecelerationRate(type: String) -> UIScrollView.DecelerationRate {
|
@available(iOS 10.0, *)
|
||||||
|
static public func getDataDetectorTypeString(type: WKDataDetectorTypes) -> [String] {
|
||||||
|
var dataDetectorTypeString: [String] = []
|
||||||
|
if type.contains(.all) {
|
||||||
|
dataDetectorTypeString.append("ALL")
|
||||||
|
} else {
|
||||||
|
if type.contains(.phoneNumber) {
|
||||||
|
dataDetectorTypeString.append("PHONE_NUMBER")
|
||||||
|
}
|
||||||
|
if type.contains(.link) {
|
||||||
|
dataDetectorTypeString.append("LINK")
|
||||||
|
}
|
||||||
|
if type.contains(.address) {
|
||||||
|
dataDetectorTypeString.append("ADDRESS")
|
||||||
|
}
|
||||||
|
if type.contains(.calendarEvent) {
|
||||||
|
dataDetectorTypeString.append("CALENDAR_EVENT")
|
||||||
|
}
|
||||||
|
if type.contains(.trackingNumber) {
|
||||||
|
dataDetectorTypeString.append("TRACKING_NUMBER")
|
||||||
|
}
|
||||||
|
if type.contains(.flightNumber) {
|
||||||
|
dataDetectorTypeString.append("FLIGHT_NUMBER")
|
||||||
|
}
|
||||||
|
if type.contains(.lookupSuggestion) {
|
||||||
|
dataDetectorTypeString.append("LOOKUP_SUGGESTION")
|
||||||
|
}
|
||||||
|
if type.contains(.spotlightSuggestion) {
|
||||||
|
dataDetectorTypeString.append("SPOTLIGHT_SUGGESTION")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if dataDetectorTypeString.count == 0 {
|
||||||
|
dataDetectorTypeString = ["NONE"]
|
||||||
|
}
|
||||||
|
return dataDetectorTypeString
|
||||||
|
}
|
||||||
|
|
||||||
|
static public func getDecelerationRate(type: String) -> UIScrollView.DecelerationRate {
|
||||||
switch type {
|
switch type {
|
||||||
case "NORMAL":
|
case "NORMAL":
|
||||||
return .normal
|
return .normal
|
||||||
|
@ -1148,6 +1186,17 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public func getDecelerationRateString(type: UIScrollView.DecelerationRate) -> String {
|
||||||
|
switch type {
|
||||||
|
case .normal:
|
||||||
|
return "NORMAL"
|
||||||
|
case .fast:
|
||||||
|
return "FAST"
|
||||||
|
default:
|
||||||
|
return "NORMAL"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static func preWKWebViewConfiguration(options: InAppWebViewOptions?) -> WKWebViewConfiguration {
|
public static func preWKWebViewConfiguration(options: InAppWebViewOptions?) -> WKWebViewConfiguration {
|
||||||
let configuration = WKWebViewConfiguration()
|
let configuration = WKWebViewConfiguration()
|
||||||
|
|
||||||
|
@ -1403,10 +1452,6 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
|
||||||
allowsBackForwardNavigationGestures = newOptions.allowsBackForwardNavigationGestures
|
allowsBackForwardNavigationGestures = newOptions.allowsBackForwardNavigationGestures
|
||||||
}
|
}
|
||||||
|
|
||||||
if newOptionsMap["allowsInlineMediaPlayback"] != nil && options?.allowsInlineMediaPlayback != newOptions.allowsInlineMediaPlayback {
|
|
||||||
configuration.allowsInlineMediaPlayback = newOptions.allowsInlineMediaPlayback
|
|
||||||
}
|
|
||||||
|
|
||||||
if newOptionsMap["javaScriptCanOpenWindowsAutomatically"] != nil && options?.javaScriptCanOpenWindowsAutomatically != newOptions.javaScriptCanOpenWindowsAutomatically {
|
if newOptionsMap["javaScriptCanOpenWindowsAutomatically"] != nil && options?.javaScriptCanOpenWindowsAutomatically != newOptions.javaScriptCanOpenWindowsAutomatically {
|
||||||
configuration.preferences.javaScriptCanOpenWindowsAutomatically = newOptions.javaScriptCanOpenWindowsAutomatically
|
configuration.preferences.javaScriptCanOpenWindowsAutomatically = newOptions.javaScriptCanOpenWindowsAutomatically
|
||||||
}
|
}
|
||||||
|
@ -1431,7 +1476,7 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
|
||||||
if newOptionsMap["dataDetectorTypes"] != nil && options?.dataDetectorTypes != newOptions.dataDetectorTypes {
|
if newOptionsMap["dataDetectorTypes"] != nil && options?.dataDetectorTypes != newOptions.dataDetectorTypes {
|
||||||
var dataDetectorTypes = WKDataDetectorTypes.init(rawValue: 0)
|
var dataDetectorTypes = WKDataDetectorTypes.init(rawValue: 0)
|
||||||
for type in newOptions.dataDetectorTypes {
|
for type in newOptions.dataDetectorTypes {
|
||||||
let dataDetectorType = getDataDetectorType(type: type)
|
let dataDetectorType = InAppWebView.getDataDetectorType(type: type)
|
||||||
dataDetectorTypes = WKDataDetectorTypes(rawValue: dataDetectorTypes.rawValue | dataDetectorType.rawValue)
|
dataDetectorTypes = WKDataDetectorTypes(rawValue: dataDetectorTypes.rawValue | dataDetectorType.rawValue)
|
||||||
}
|
}
|
||||||
configuration.dataDetectorTypes = dataDetectorTypes
|
configuration.dataDetectorTypes = dataDetectorTypes
|
||||||
|
@ -1465,7 +1510,7 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
|
||||||
}
|
}
|
||||||
|
|
||||||
if newOptionsMap["decelerationRate"] != nil && options?.decelerationRate != newOptions.decelerationRate {
|
if newOptionsMap["decelerationRate"] != nil && options?.decelerationRate != newOptions.decelerationRate {
|
||||||
scrollView.decelerationRate = getDecelerationRate(type: newOptions.decelerationRate)
|
scrollView.decelerationRate = InAppWebView.getDecelerationRate(type: newOptions.decelerationRate)
|
||||||
}
|
}
|
||||||
if newOptionsMap["alwaysBounceVertical"] != nil && options?.alwaysBounceVertical != newOptions.alwaysBounceVertical {
|
if newOptionsMap["alwaysBounceVertical"] != nil && options?.alwaysBounceVertical != newOptions.alwaysBounceVertical {
|
||||||
scrollView.alwaysBounceVertical = newOptions.alwaysBounceVertical
|
scrollView.alwaysBounceVertical = newOptions.alwaysBounceVertical
|
||||||
|
@ -1490,6 +1535,9 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
|
||||||
if newOptionsMap["allowsLinkPreview"] != nil && options?.allowsLinkPreview != newOptions.allowsLinkPreview {
|
if newOptionsMap["allowsLinkPreview"] != nil && options?.allowsLinkPreview != newOptions.allowsLinkPreview {
|
||||||
allowsLinkPreview = newOptions.allowsLinkPreview
|
allowsLinkPreview = newOptions.allowsLinkPreview
|
||||||
}
|
}
|
||||||
|
if newOptionsMap["allowsAirPlayForMediaPlayback"] != nil && options?.allowsAirPlayForMediaPlayback != newOptions.allowsAirPlayForMediaPlayback {
|
||||||
|
configuration.allowsAirPlayForMediaPlayback = newOptions.allowsAirPlayForMediaPlayback
|
||||||
|
}
|
||||||
if newOptionsMap["allowsPictureInPictureMediaPlayback"] != nil && options?.allowsPictureInPictureMediaPlayback != newOptions.allowsPictureInPictureMediaPlayback {
|
if newOptionsMap["allowsPictureInPictureMediaPlayback"] != nil && options?.allowsPictureInPictureMediaPlayback != newOptions.allowsPictureInPictureMediaPlayback {
|
||||||
configuration.allowsPictureInPictureMediaPlayback = newOptions.allowsPictureInPictureMediaPlayback
|
configuration.allowsPictureInPictureMediaPlayback = newOptions.allowsPictureInPictureMediaPlayback
|
||||||
}
|
}
|
||||||
|
@ -1534,7 +1582,7 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
|
||||||
if (self.options == nil) {
|
if (self.options == nil) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return self.options!.getHashMap()
|
return self.options!.getRealOptions(obj: self)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func clearCache() {
|
public func clearCache() {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import Foundation
|
||||||
import WebKit
|
import WebKit
|
||||||
|
|
||||||
@objcMembers
|
@objcMembers
|
||||||
public class InAppWebViewOptions: Options {
|
public class InAppWebViewOptions: Options<InAppWebView> {
|
||||||
|
|
||||||
var useShouldOverrideUrlLoading = false
|
var useShouldOverrideUrlLoading = false
|
||||||
var useOnLoadResource = false
|
var useOnLoadResource = false
|
||||||
|
@ -63,4 +63,47 @@ public class InAppWebViewOptions: Options {
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func getRealOptions(obj: InAppWebView?) -> [String: Any?] {
|
||||||
|
var realOptions: [String: Any?] = toMap()
|
||||||
|
if let webView = obj {
|
||||||
|
let configuration = webView.configuration
|
||||||
|
if #available(iOS 9.0, *) {
|
||||||
|
realOptions["userAgent"] = webView.customUserAgent
|
||||||
|
realOptions["applicationNameForUserAgent"] = configuration.applicationNameForUserAgent
|
||||||
|
realOptions["allowsAirPlayForMediaPlayback"] = configuration.allowsAirPlayForMediaPlayback
|
||||||
|
realOptions["allowsLinkPreview"] = webView.allowsLinkPreview
|
||||||
|
realOptions["allowsPictureInPictureMediaPlayback"] = configuration.allowsPictureInPictureMediaPlayback
|
||||||
|
}
|
||||||
|
realOptions["javaScriptEnabled"] = configuration.preferences.javaScriptEnabled
|
||||||
|
realOptions["javaScriptCanOpenWindowsAutomatically"] = configuration.preferences.javaScriptCanOpenWindowsAutomatically
|
||||||
|
if #available(iOS 10.0, *) {
|
||||||
|
realOptions["mediaPlaybackRequiresUserGesture"] = configuration.mediaTypesRequiringUserActionForPlayback == .all
|
||||||
|
realOptions["ignoresViewportScaleLimits"] = configuration.ignoresViewportScaleLimits
|
||||||
|
realOptions["dataDetectorTypes"] = InAppWebView.getDataDetectorTypeString(type: configuration.dataDetectorTypes)
|
||||||
|
} else {
|
||||||
|
realOptions["mediaPlaybackRequiresUserGesture"] = configuration.mediaPlaybackRequiresUserAction
|
||||||
|
}
|
||||||
|
realOptions["minimumFontSize"] = configuration.preferences.minimumFontSize
|
||||||
|
realOptions["suppressesIncrementalRendering"] = configuration.suppressesIncrementalRendering
|
||||||
|
realOptions["allowsBackForwardNavigationGestures"] = webView.allowsBackForwardNavigationGestures
|
||||||
|
realOptions["allowsInlineMediaPlayback"] = configuration.allowsInlineMediaPlayback
|
||||||
|
if #available(iOS 13.0, *) {
|
||||||
|
realOptions["isFraudulentWebsiteWarningEnabled"] = configuration.preferences.isFraudulentWebsiteWarningEnabled
|
||||||
|
realOptions["preferredContentMode"] = configuration.defaultWebpagePreferences.preferredContentMode.rawValue
|
||||||
|
realOptions["automaticallyAdjustsScrollIndicatorInsets"] = webView.scrollView.automaticallyAdjustsScrollIndicatorInsets
|
||||||
|
}
|
||||||
|
realOptions["selectionGranularity"] = configuration.selectionGranularity.rawValue
|
||||||
|
if #available(iOS 11.0, *) {
|
||||||
|
realOptions["accessibilityIgnoresInvertColors"] = webView.accessibilityIgnoresInvertColors
|
||||||
|
}
|
||||||
|
realOptions["decelerationRate"] = InAppWebView.getDecelerationRateString(type: webView.scrollView.decelerationRate)
|
||||||
|
realOptions["alwaysBounceVertical"] = webView.scrollView.alwaysBounceVertical
|
||||||
|
realOptions["alwaysBounceHorizontal"] = webView.scrollView.alwaysBounceHorizontal
|
||||||
|
realOptions["scrollsToTop"] = webView.scrollView.scrollsToTop
|
||||||
|
realOptions["isPagingEnabled"] = webView.scrollView.isPagingEnabled
|
||||||
|
realOptions["maximumZoomScale"] = webView.scrollView.maximumZoomScale
|
||||||
|
realOptions["minimumZoomScale"] = webView.scrollView.minimumZoomScale
|
||||||
|
}
|
||||||
|
return realOptions
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
@objcMembers
|
@objcMembers
|
||||||
public class Options: NSObject {
|
public class Options<T>: NSObject {
|
||||||
|
|
||||||
override init(){
|
override init(){
|
||||||
super.init()
|
super.init()
|
||||||
|
@ -23,7 +23,7 @@ public class Options: NSObject {
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
func getHashMap() -> [String: Any?] {
|
func toMap() -> [String: Any?] {
|
||||||
var options: [String: Any?] = [:]
|
var options: [String: Any?] = [:]
|
||||||
var counts = UInt32();
|
var counts = UInt32();
|
||||||
let properties = class_copyPropertyList(object_getClass(self), &counts);
|
let properties = class_copyPropertyList(object_getClass(self), &counts);
|
||||||
|
@ -38,4 +38,9 @@ public class Options: NSObject {
|
||||||
free(properties)
|
free(properties)
|
||||||
return options
|
return options
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getRealOptions(obj: T?) -> [String: Any?] {
|
||||||
|
let realOptions: [String: Any?] = toMap()
|
||||||
|
return realOptions
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,9 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
@available(iOS 9.0, *)
|
||||||
@objcMembers
|
@objcMembers
|
||||||
public class SafariBrowserOptions: Options {
|
public class SafariBrowserOptions: Options<SafariViewController> {
|
||||||
|
|
||||||
var entersReaderIfAvailable = false
|
var entersReaderIfAvailable = false
|
||||||
var barCollapsingEnabled = false
|
var barCollapsingEnabled = false
|
||||||
|
@ -22,4 +23,17 @@ public class SafariBrowserOptions: Options {
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func getRealOptions(obj: SafariViewController?) -> [String: Any?] {
|
||||||
|
var realOptions: [String: Any?] = toMap()
|
||||||
|
if let safariViewController = obj {
|
||||||
|
if #available(iOS 11.0, *) {
|
||||||
|
realOptions["entersReaderIfAvailable"] = safariViewController.configuration.entersReaderIfAvailable
|
||||||
|
realOptions["barCollapsingEnabled"] = safariViewController.configuration.barCollapsingEnabled
|
||||||
|
realOptions["dismissButtonStyle"] = safariViewController.dismissButtonStyle.rawValue
|
||||||
|
}
|
||||||
|
realOptions["presentationStyle"] = safariViewController.modalPresentationStyle.rawValue
|
||||||
|
realOptions["transitionStyle"] = safariViewController.modalTransitionStyle.rawValue
|
||||||
|
}
|
||||||
|
return realOptions
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,8 @@ class ChromeSafariBrowser {
|
||||||
Map<int, ChromeSafariBrowserMenuItem> _menuItems = new HashMap();
|
Map<int, ChromeSafariBrowserMenuItem> _menuItems = new HashMap();
|
||||||
bool _isOpened = false;
|
bool _isOpened = false;
|
||||||
MethodChannel _channel;
|
MethodChannel _channel;
|
||||||
static const MethodChannel _sharedChannel = const MethodChannel('com.pichillilorenzo/flutter_chromesafaribrowser');
|
static const MethodChannel _sharedChannel =
|
||||||
|
const MethodChannel('com.pichillilorenzo/flutter_chromesafaribrowser');
|
||||||
|
|
||||||
///Initialize the [ChromeSafariBrowser] instance with an [InAppBrowser] fallback instance or `null`.
|
///Initialize the [ChromeSafariBrowser] instance with an [InAppBrowser] fallback instance or `null`.
|
||||||
ChromeSafariBrowser({bFallback}) {
|
ChromeSafariBrowser({bFallback}) {
|
||||||
|
@ -73,10 +74,7 @@ class ChromeSafariBrowser {
|
||||||
|
|
||||||
List<Map<String, dynamic>> menuItemList = new List();
|
List<Map<String, dynamic>> menuItemList = new List();
|
||||||
_menuItems.forEach((key, value) {
|
_menuItems.forEach((key, value) {
|
||||||
menuItemList.add({
|
menuItemList.add({"id": value.id, "label": value.label});
|
||||||
"id": value.id,
|
|
||||||
"label": value.label
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
|
@ -84,11 +82,11 @@ class ChromeSafariBrowser {
|
||||||
args.putIfAbsent('url', () => url);
|
args.putIfAbsent('url', () => url);
|
||||||
args.putIfAbsent('options', () => options?.toMap() ?? {});
|
args.putIfAbsent('options', () => options?.toMap() ?? {});
|
||||||
args.putIfAbsent('menuItemList', () => menuItemList);
|
args.putIfAbsent('menuItemList', () => menuItemList);
|
||||||
args.putIfAbsent('uuidFallback',
|
args.putIfAbsent('uuidFallback', () => browserFallback?.uuid);
|
||||||
() => (browserFallback != null) ? browserFallback.uuid : '');
|
args.putIfAbsent('headersFallback', () => headersFallback ?? {});
|
||||||
args.putIfAbsent('headersFallback', () => headersFallback);
|
|
||||||
args.putIfAbsent('optionsFallback', () => optionsFallback?.toMap() ?? {});
|
args.putIfAbsent('optionsFallback', () => optionsFallback?.toMap() ?? {});
|
||||||
args.putIfAbsent('contextMenuFallback', () => browserFallback?.contextMenu?.toMap() ?? {});
|
args.putIfAbsent('contextMenuFallback',
|
||||||
|
() => browserFallback?.contextMenu?.toMap() ?? {});
|
||||||
await _sharedChannel.invokeMethod('open', args);
|
await _sharedChannel.invokeMethod('open', args);
|
||||||
this._isOpened = true;
|
this._isOpened = true;
|
||||||
}
|
}
|
||||||
|
@ -142,10 +140,30 @@ class ChromeSafariBrowser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///Class that represents a custom menu item for a [ChromeSafariBrowser] instance.
|
||||||
class ChromeSafariBrowserMenuItem {
|
class ChromeSafariBrowserMenuItem {
|
||||||
|
///The menu item id
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
|
///The label of the menu item
|
||||||
String label;
|
String label;
|
||||||
|
|
||||||
|
///Callback function to be invoked when the menu item is clicked
|
||||||
final void Function(String url, String title) action;
|
final void Function(String url, String title) action;
|
||||||
|
|
||||||
ChromeSafariBrowserMenuItem({@required this.id, @required this.label, @required this.action});
|
ChromeSafariBrowserMenuItem(
|
||||||
}
|
{@required this.id, @required this.label, @required this.action});
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {"id": id, "label": label};
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -7,11 +7,11 @@ import 'types.dart';
|
||||||
///
|
///
|
||||||
///**NOTE**: To make it work properly on Android, JavaScript should be enabled!
|
///**NOTE**: To make it work properly on Android, JavaScript should be enabled!
|
||||||
class ContextMenu {
|
class ContextMenu {
|
||||||
|
|
||||||
///Event fired when the context menu for this WebView is being built.
|
///Event fired when the context menu for this WebView is being built.
|
||||||
///
|
///
|
||||||
///[hitTestResult] represents the hit result for hitting an HTML elements.
|
///[hitTestResult] represents the hit result for hitting an HTML elements.
|
||||||
final void Function(InAppWebViewHitTestResult hitTestResult) onCreateContextMenu;
|
final void Function(InAppWebViewHitTestResult hitTestResult)
|
||||||
|
onCreateContextMenu;
|
||||||
|
|
||||||
///Event fired when the context menu for this WebView is being hidden.
|
///Event fired when the context menu for this WebView is being hidden.
|
||||||
final void Function() onHideContextMenu;
|
final void Function() onHideContextMenu;
|
||||||
|
@ -19,17 +19,17 @@ class ContextMenu {
|
||||||
///Event fired when a context menu item has been clicked.
|
///Event fired when a context menu item has been clicked.
|
||||||
///
|
///
|
||||||
///[contextMenuItemClicked] represents the [ContextMenuItem] clicked.
|
///[contextMenuItemClicked] represents the [ContextMenuItem] clicked.
|
||||||
final void Function(ContextMenuItem contextMenuItemClicked) onContextMenuActionItemClicked;
|
final void Function(ContextMenuItem contextMenuItemClicked)
|
||||||
|
onContextMenuActionItemClicked;
|
||||||
|
|
||||||
///List of the custom [ContextMenuItem].
|
///List of the custom [ContextMenuItem].
|
||||||
List<ContextMenuItem> menuItems = List();
|
List<ContextMenuItem> menuItems = List();
|
||||||
|
|
||||||
ContextMenu({
|
ContextMenu(
|
||||||
this.menuItems,
|
{this.menuItems,
|
||||||
this.onCreateContextMenu,
|
this.onCreateContextMenu,
|
||||||
this.onHideContextMenu,
|
this.onHideContextMenu,
|
||||||
this.onContextMenuActionItemClicked
|
this.onContextMenuActionItemClicked});
|
||||||
});
|
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {
|
return {
|
||||||
|
@ -46,21 +46,24 @@ class ContextMenu {
|
||||||
class ContextMenuItem {
|
class ContextMenuItem {
|
||||||
///Android menu item ID.
|
///Android menu item ID.
|
||||||
int androidId;
|
int androidId;
|
||||||
|
|
||||||
///iOS menu item ID.
|
///iOS menu item ID.
|
||||||
String iosId;
|
String iosId;
|
||||||
|
|
||||||
///Menu item title.
|
///Menu item title.
|
||||||
String title;
|
String title;
|
||||||
|
|
||||||
///Menu item action that will be called when an user clicks on it.
|
///Menu item action that will be called when an user clicks on it.
|
||||||
Function() action;
|
Function() action;
|
||||||
|
|
||||||
ContextMenuItem({@required this.androidId, @required this.iosId, @required this.title, this.action});
|
ContextMenuItem(
|
||||||
|
{@required this.androidId,
|
||||||
|
@required this.iosId,
|
||||||
|
@required this.title,
|
||||||
|
this.action});
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {
|
return {"androidId": androidId, "iosId": iosId, "title": title};
|
||||||
"androidId": androidId,
|
|
||||||
"iosId": iosId,
|
|
||||||
"title": title
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
|
|
|
@ -22,7 +22,7 @@ class CookieManager {
|
||||||
|
|
||||||
static CookieManager _init() {
|
static CookieManager _init() {
|
||||||
_channel.setMethodCallHandler(_handleMethod);
|
_channel.setMethodCallHandler(_handleMethod);
|
||||||
_instance = new CookieManager();
|
_instance = CookieManager();
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,61 +12,61 @@ import 'in_app_webview_controller.dart';
|
||||||
class HeadlessInAppWebView implements WebView {
|
class HeadlessInAppWebView implements WebView {
|
||||||
String uuid;
|
String uuid;
|
||||||
bool _isDisposed = true;
|
bool _isDisposed = true;
|
||||||
static const MethodChannel _sharedChannel = const MethodChannel('com.pichillilorenzo/flutter_headless_inappwebview');
|
static const MethodChannel _sharedChannel =
|
||||||
|
const MethodChannel('com.pichillilorenzo/flutter_headless_inappwebview');
|
||||||
|
|
||||||
///WebView Controller that can be used to access the [InAppWebViewController] API.
|
///WebView Controller that can be used to access the [InAppWebViewController] API.
|
||||||
InAppWebViewController webViewController;
|
InAppWebViewController webViewController;
|
||||||
|
|
||||||
HeadlessInAppWebView({
|
HeadlessInAppWebView(
|
||||||
this.onWebViewCreated,
|
{this.onWebViewCreated,
|
||||||
this.onLoadStart,
|
this.onLoadStart,
|
||||||
this.onLoadStop,
|
this.onLoadStop,
|
||||||
this.onLoadError,
|
this.onLoadError,
|
||||||
this.onLoadHttpError,
|
this.onLoadHttpError,
|
||||||
this.onProgressChanged,
|
this.onProgressChanged,
|
||||||
this.onConsoleMessage,
|
this.onConsoleMessage,
|
||||||
this.shouldOverrideUrlLoading,
|
this.shouldOverrideUrlLoading,
|
||||||
this.onLoadResource,
|
this.onLoadResource,
|
||||||
this.onScrollChanged,
|
this.onScrollChanged,
|
||||||
this.onDownloadStart,
|
this.onDownloadStart,
|
||||||
this.onLoadResourceCustomScheme,
|
this.onLoadResourceCustomScheme,
|
||||||
this.onCreateWindow,
|
this.onCreateWindow,
|
||||||
this.onJsAlert,
|
this.onJsAlert,
|
||||||
this.onJsConfirm,
|
this.onJsConfirm,
|
||||||
this.onJsPrompt,
|
this.onJsPrompt,
|
||||||
this.onReceivedHttpAuthRequest,
|
this.onReceivedHttpAuthRequest,
|
||||||
this.onReceivedServerTrustAuthRequest,
|
this.onReceivedServerTrustAuthRequest,
|
||||||
this.onReceivedClientCertRequest,
|
this.onReceivedClientCertRequest,
|
||||||
this.onFindResultReceived,
|
this.onFindResultReceived,
|
||||||
this.shouldInterceptAjaxRequest,
|
this.shouldInterceptAjaxRequest,
|
||||||
this.onAjaxReadyStateChange,
|
this.onAjaxReadyStateChange,
|
||||||
this.onAjaxProgress,
|
this.onAjaxProgress,
|
||||||
this.shouldInterceptFetchRequest,
|
this.shouldInterceptFetchRequest,
|
||||||
this.onUpdateVisitedHistory,
|
this.onUpdateVisitedHistory,
|
||||||
this.onPrint,
|
this.onPrint,
|
||||||
this.onLongPressHitTestResult,
|
this.onLongPressHitTestResult,
|
||||||
this.onEnterFullscreen,
|
this.onEnterFullscreen,
|
||||||
this.onExitFullscreen,
|
this.onExitFullscreen,
|
||||||
this.onPageCommitVisible,
|
this.onPageCommitVisible,
|
||||||
this.androidOnSafeBrowsingHit,
|
this.androidOnSafeBrowsingHit,
|
||||||
this.androidOnPermissionRequest,
|
this.androidOnPermissionRequest,
|
||||||
this.androidOnGeolocationPermissionsShowPrompt,
|
this.androidOnGeolocationPermissionsShowPrompt,
|
||||||
this.androidOnGeolocationPermissionsHidePrompt,
|
this.androidOnGeolocationPermissionsHidePrompt,
|
||||||
this.androidShouldInterceptRequest,
|
this.androidShouldInterceptRequest,
|
||||||
this.androidOnRenderProcessGone,
|
this.androidOnRenderProcessGone,
|
||||||
this.androidOnRenderProcessResponsive,
|
this.androidOnRenderProcessResponsive,
|
||||||
this.androidOnRenderProcessUnresponsive,
|
this.androidOnRenderProcessUnresponsive,
|
||||||
this.androidOnFormResubmission,
|
this.androidOnFormResubmission,
|
||||||
this.androidOnScaleChanged,
|
this.androidOnScaleChanged,
|
||||||
this.iosOnWebContentProcessDidTerminate,
|
this.iosOnWebContentProcessDidTerminate,
|
||||||
this.iosOnDidReceiveServerRedirectForProvisionalNavigation,
|
this.iosOnDidReceiveServerRedirectForProvisionalNavigation,
|
||||||
this.initialUrl,
|
this.initialUrl,
|
||||||
this.initialFile,
|
this.initialFile,
|
||||||
this.initialData,
|
this.initialData,
|
||||||
this.initialHeaders,
|
this.initialHeaders,
|
||||||
this.initialOptions,
|
this.initialOptions,
|
||||||
this.contextMenu
|
this.contextMenu}) {
|
||||||
}) {
|
|
||||||
uuid = uuidGenerator.v4();
|
uuid = uuidGenerator.v4();
|
||||||
webViewController = new InAppWebViewController(uuid, this);
|
webViewController = new InAppWebViewController(uuid, this);
|
||||||
}
|
}
|
||||||
|
@ -89,14 +89,16 @@ class HeadlessInAppWebView implements WebView {
|
||||||
_isDisposed = false;
|
_isDisposed = false;
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
args.putIfAbsent('uuid', () => uuid);
|
args.putIfAbsent('uuid', () => uuid);
|
||||||
args.putIfAbsent('params', () => <String, dynamic>{
|
args.putIfAbsent(
|
||||||
'initialUrl': '${Uri.parse(this.initialUrl)}',
|
'params',
|
||||||
'initialFile': this.initialFile,
|
() => <String, dynamic>{
|
||||||
'initialData': this.initialData?.toMap(),
|
'initialUrl': '${Uri.parse(this.initialUrl)}',
|
||||||
'initialHeaders': this.initialHeaders,
|
'initialFile': this.initialFile,
|
||||||
'initialOptions': this.initialOptions?.toMap() ?? {},
|
'initialData': this.initialData?.toMap(),
|
||||||
'contextMenu': this.contextMenu?.toMap() ?? {}
|
'initialHeaders': this.initialHeaders,
|
||||||
});
|
'initialOptions': this.initialOptions?.toMap() ?? {},
|
||||||
|
'contextMenu': this.contextMenu?.toMap() ?? {}
|
||||||
|
});
|
||||||
await _sharedChannel.invokeMethod('createHeadlessWebView', args);
|
await _sharedChannel.invokeMethod('createHeadlessWebView', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,12 +115,12 @@ class HeadlessInAppWebView implements WebView {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<void> Function(InAppWebViewController controller)
|
final Future<void> Function(InAppWebViewController controller)
|
||||||
androidOnGeolocationPermissionsHidePrompt;
|
androidOnGeolocationPermissionsHidePrompt;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<GeolocationPermissionShowPromptResponse> Function(
|
final Future<GeolocationPermissionShowPromptResponse> Function(
|
||||||
InAppWebViewController controller, String origin)
|
InAppWebViewController controller, String origin)
|
||||||
androidOnGeolocationPermissionsShowPrompt;
|
androidOnGeolocationPermissionsShowPrompt;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<PermissionRequestResponse> Function(
|
final Future<PermissionRequestResponse> Function(
|
||||||
|
@ -149,30 +151,31 @@ class HeadlessInAppWebView implements WebView {
|
||||||
final String initialUrl;
|
final String initialUrl;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<void> Function(InAppWebViewController controller, String url) onPageCommitVisible;
|
final Future<void> Function(InAppWebViewController controller, String url)
|
||||||
|
onPageCommitVisible;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<void> Function(InAppWebViewController controller)
|
final Future<void> Function(InAppWebViewController controller)
|
||||||
iosOnDidReceiveServerRedirectForProvisionalNavigation;
|
iosOnDidReceiveServerRedirectForProvisionalNavigation;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<void> Function(InAppWebViewController controller)
|
final Future<void> Function(InAppWebViewController controller)
|
||||||
iosOnWebContentProcessDidTerminate;
|
iosOnWebContentProcessDidTerminate;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<AjaxRequestAction> Function(
|
final Future<AjaxRequestAction> Function(
|
||||||
InAppWebViewController controller, AjaxRequest ajaxRequest)
|
InAppWebViewController controller, AjaxRequest ajaxRequest)
|
||||||
onAjaxProgress;
|
onAjaxProgress;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<AjaxRequestAction> Function(
|
final Future<AjaxRequestAction> Function(
|
||||||
InAppWebViewController controller, AjaxRequest ajaxRequest)
|
InAppWebViewController controller, AjaxRequest ajaxRequest)
|
||||||
onAjaxReadyStateChange;
|
onAjaxReadyStateChange;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final void Function(
|
final void Function(
|
||||||
InAppWebViewController controller, ConsoleMessage consoleMessage)
|
InAppWebViewController controller, ConsoleMessage consoleMessage)
|
||||||
onConsoleMessage;
|
onConsoleMessage;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final void Function(InAppWebViewController controller,
|
final void Function(InAppWebViewController controller,
|
||||||
|
@ -180,7 +183,7 @@ class HeadlessInAppWebView implements WebView {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final void Function(InAppWebViewController controller, String url)
|
final void Function(InAppWebViewController controller, String url)
|
||||||
onDownloadStart;
|
onDownloadStart;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final void Function(InAppWebViewController controller, int activeMatchOrdinal,
|
final void Function(InAppWebViewController controller, int activeMatchOrdinal,
|
||||||
|
@ -208,17 +211,17 @@ class HeadlessInAppWebView implements WebView {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final void Function(
|
final void Function(
|
||||||
InAppWebViewController controller, LoadedResource resource)
|
InAppWebViewController controller, LoadedResource resource)
|
||||||
onLoadResource;
|
onLoadResource;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<CustomSchemeResponse> Function(
|
final Future<CustomSchemeResponse> Function(
|
||||||
InAppWebViewController controller, String scheme, String url)
|
InAppWebViewController controller, String scheme, String url)
|
||||||
onLoadResourceCustomScheme;
|
onLoadResourceCustomScheme;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final void Function(InAppWebViewController controller, String url)
|
final void Function(InAppWebViewController controller, String url)
|
||||||
onLoadStart;
|
onLoadStart;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final void Function(InAppWebViewController controller, String url) onLoadStop;
|
final void Function(InAppWebViewController controller, String url) onLoadStop;
|
||||||
|
@ -232,50 +235,50 @@ class HeadlessInAppWebView implements WebView {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final void Function(InAppWebViewController controller, int progress)
|
final void Function(InAppWebViewController controller, int progress)
|
||||||
onProgressChanged;
|
onProgressChanged;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<ClientCertResponse> Function(
|
final Future<ClientCertResponse> Function(
|
||||||
InAppWebViewController controller, ClientCertChallenge challenge)
|
InAppWebViewController controller, ClientCertChallenge challenge)
|
||||||
onReceivedClientCertRequest;
|
onReceivedClientCertRequest;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<HttpAuthResponse> Function(
|
final Future<HttpAuthResponse> Function(
|
||||||
InAppWebViewController controller, HttpAuthChallenge challenge)
|
InAppWebViewController controller, HttpAuthChallenge challenge)
|
||||||
onReceivedHttpAuthRequest;
|
onReceivedHttpAuthRequest;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<ServerTrustAuthResponse> Function(
|
final Future<ServerTrustAuthResponse> Function(
|
||||||
InAppWebViewController controller, ServerTrustChallenge challenge)
|
InAppWebViewController controller, ServerTrustChallenge challenge)
|
||||||
onReceivedServerTrustAuthRequest;
|
onReceivedServerTrustAuthRequest;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final void Function(InAppWebViewController controller, int x, int y)
|
final void Function(InAppWebViewController controller, int x, int y)
|
||||||
onScrollChanged;
|
onScrollChanged;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final void Function(
|
final void Function(
|
||||||
InAppWebViewController controller, String url, bool androidIsReload)
|
InAppWebViewController controller, String url, bool androidIsReload)
|
||||||
onUpdateVisitedHistory;
|
onUpdateVisitedHistory;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final void Function(InAppWebViewController controller) onWebViewCreated;
|
final void Function(InAppWebViewController controller) onWebViewCreated;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<AjaxRequest> Function(
|
final Future<AjaxRequest> Function(
|
||||||
InAppWebViewController controller, AjaxRequest ajaxRequest)
|
InAppWebViewController controller, AjaxRequest ajaxRequest)
|
||||||
shouldInterceptAjaxRequest;
|
shouldInterceptAjaxRequest;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<FetchRequest> Function(
|
final Future<FetchRequest> Function(
|
||||||
InAppWebViewController controller, FetchRequest fetchRequest)
|
InAppWebViewController controller, FetchRequest fetchRequest)
|
||||||
shouldInterceptFetchRequest;
|
shouldInterceptFetchRequest;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<ShouldOverrideUrlLoadingAction> Function(
|
final Future<ShouldOverrideUrlLoadingAction> Function(
|
||||||
InAppWebViewController controller,
|
InAppWebViewController controller,
|
||||||
ShouldOverrideUrlLoadingRequest shouldOverrideUrlLoadingRequest)
|
ShouldOverrideUrlLoadingRequest shouldOverrideUrlLoadingRequest)
|
||||||
shouldOverrideUrlLoading;
|
shouldOverrideUrlLoading;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final void Function(InAppWebViewController controller) onEnterFullscreen;
|
final void Function(InAppWebViewController controller) onEnterFullscreen;
|
||||||
|
@ -284,26 +287,31 @@ class HeadlessInAppWebView implements WebView {
|
||||||
final void Function(InAppWebViewController controller) onExitFullscreen;
|
final void Function(InAppWebViewController controller) onExitFullscreen;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<WebResourceResponse> Function(InAppWebViewController controller, WebResourceRequest request)
|
final Future<WebResourceResponse> Function(
|
||||||
androidShouldInterceptRequest;
|
InAppWebViewController controller, WebResourceRequest request)
|
||||||
|
androidShouldInterceptRequest;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<WebViewRenderProcessAction> Function(InAppWebViewController controller, String url)
|
final Future<WebViewRenderProcessAction> Function(
|
||||||
androidOnRenderProcessUnresponsive;
|
InAppWebViewController controller, String url)
|
||||||
|
androidOnRenderProcessUnresponsive;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<WebViewRenderProcessAction> Function(InAppWebViewController controller, String url)
|
final Future<WebViewRenderProcessAction> Function(
|
||||||
androidOnRenderProcessResponsive;
|
InAppWebViewController controller, String url)
|
||||||
|
androidOnRenderProcessResponsive;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<void> Function(InAppWebViewController controller, RenderProcessGoneDetail detail)
|
final Future<void> Function(
|
||||||
androidOnRenderProcessGone;
|
InAppWebViewController controller, RenderProcessGoneDetail detail)
|
||||||
|
androidOnRenderProcessGone;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<FormResubmissionAction> Function(InAppWebViewController controller, String url)
|
final Future<FormResubmissionAction> Function(
|
||||||
androidOnFormResubmission;
|
InAppWebViewController controller, String url) androidOnFormResubmission;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<void> Function(InAppWebViewController controller, double oldScale, double newScale)
|
final Future<void> Function(
|
||||||
androidOnScaleChanged;
|
InAppWebViewController controller, double oldScale, double newScale)
|
||||||
}
|
androidOnScaleChanged;
|
||||||
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ class HttpAuthCredentialDatabase {
|
||||||
|
|
||||||
static HttpAuthCredentialDatabase _init() {
|
static HttpAuthCredentialDatabase _init() {
|
||||||
_channel.setMethodCallHandler(_handleMethod);
|
_channel.setMethodCallHandler(_handleMethod);
|
||||||
_instance = new HttpAuthCredentialDatabase();
|
_instance = HttpAuthCredentialDatabase();
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,8 @@ class InAppBrowser {
|
||||||
HashMap<String, JavaScriptHandlerCallback>();
|
HashMap<String, JavaScriptHandlerCallback>();
|
||||||
bool _isOpened = false;
|
bool _isOpened = false;
|
||||||
MethodChannel _channel;
|
MethodChannel _channel;
|
||||||
static const MethodChannel _sharedChannel = const MethodChannel('com.pichillilorenzo/flutter_inappbrowser');
|
static const MethodChannel _sharedChannel =
|
||||||
|
const MethodChannel('com.pichillilorenzo/flutter_inappbrowser');
|
||||||
|
|
||||||
/// WebView Controller that can be used to access the [InAppWebViewController] API.
|
/// WebView Controller that can be used to access the [InAppWebViewController] API.
|
||||||
InAppWebViewController webViewController;
|
InAppWebViewController webViewController;
|
||||||
|
@ -35,8 +36,8 @@ class InAppBrowser {
|
||||||
MethodChannel('com.pichillilorenzo/flutter_inappbrowser_$uuid');
|
MethodChannel('com.pichillilorenzo/flutter_inappbrowser_$uuid');
|
||||||
this._channel.setMethodCallHandler(handleMethod);
|
this._channel.setMethodCallHandler(handleMethod);
|
||||||
_isOpened = false;
|
_isOpened = false;
|
||||||
webViewController = new InAppWebViewController.fromInAppBrowser(
|
webViewController =
|
||||||
uuid, this._channel, this);
|
new InAppWebViewController.fromInAppBrowser(uuid, this._channel, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> handleMethod(MethodCall call) async {
|
Future<dynamic> handleMethod(MethodCall call) async {
|
||||||
|
@ -117,8 +118,6 @@ class InAppBrowser {
|
||||||
assert(assetFilePath != null && assetFilePath.isNotEmpty);
|
assert(assetFilePath != null && assetFilePath.isNotEmpty);
|
||||||
this.throwIsAlreadyOpened(message: 'Cannot open $assetFilePath!');
|
this.throwIsAlreadyOpened(message: 'Cannot open $assetFilePath!');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
args.putIfAbsent('uuid', () => uuid);
|
args.putIfAbsent('uuid', () => uuid);
|
||||||
args.putIfAbsent('url', () => assetFilePath);
|
args.putIfAbsent('url', () => assetFilePath);
|
||||||
|
@ -217,20 +216,19 @@ class InAppBrowser {
|
||||||
options = options.cast<String, dynamic>();
|
options = options.cast<String, dynamic>();
|
||||||
inAppBrowserClassOptions.crossPlatform =
|
inAppBrowserClassOptions.crossPlatform =
|
||||||
InAppBrowserOptions.fromMap(options);
|
InAppBrowserOptions.fromMap(options);
|
||||||
inAppBrowserClassOptions.inAppWebViewGroupOptions = InAppWebViewGroupOptions();
|
inAppBrowserClassOptions.inAppWebViewGroupOptions =
|
||||||
|
InAppWebViewGroupOptions();
|
||||||
inAppBrowserClassOptions.inAppWebViewGroupOptions.crossPlatform =
|
inAppBrowserClassOptions.inAppWebViewGroupOptions.crossPlatform =
|
||||||
InAppWebViewOptions.fromMap(options);
|
InAppWebViewOptions.fromMap(options);
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
inAppBrowserClassOptions.android =
|
inAppBrowserClassOptions.android =
|
||||||
AndroidInAppBrowserOptions.fromMap(options);
|
AndroidInAppBrowserOptions.fromMap(options);
|
||||||
inAppBrowserClassOptions
|
inAppBrowserClassOptions.inAppWebViewGroupOptions.android =
|
||||||
.inAppWebViewGroupOptions.android =
|
|
||||||
AndroidInAppWebViewOptions.fromMap(options);
|
AndroidInAppWebViewOptions.fromMap(options);
|
||||||
} else if (Platform.isIOS) {
|
} else if (Platform.isIOS) {
|
||||||
inAppBrowserClassOptions.ios =
|
inAppBrowserClassOptions.ios = IOSInAppBrowserOptions.fromMap(options);
|
||||||
IOSInAppBrowserOptions.fromMap(options);
|
inAppBrowserClassOptions.inAppWebViewGroupOptions.ios =
|
||||||
inAppBrowserClassOptions.inAppWebViewGroupOptions
|
IOSInAppWebViewOptions.fromMap(options);
|
||||||
.ios = IOSInAppWebViewOptions.fromMap(options);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,7 +303,8 @@ class InAppBrowser {
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#shouldOverrideUrlLoading(android.webkit.WebView,%20java.lang.String)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#shouldOverrideUrlLoading(android.webkit.WebView,%20java.lang.String)
|
||||||
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455641-webview
|
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455641-webview
|
||||||
// ignore: missing_return
|
// ignore: missing_return
|
||||||
Future<ShouldOverrideUrlLoadingAction> shouldOverrideUrlLoading(ShouldOverrideUrlLoadingRequest shouldOverrideUrlLoadingRequest) {}
|
Future<ShouldOverrideUrlLoadingAction> shouldOverrideUrlLoading(
|
||||||
|
ShouldOverrideUrlLoadingRequest shouldOverrideUrlLoadingRequest) {}
|
||||||
|
|
||||||
///Event fired when the [InAppBrowser] webview loads a resource.
|
///Event fired when the [InAppBrowser] webview loads a resource.
|
||||||
///
|
///
|
||||||
|
@ -555,8 +554,8 @@ class InAppBrowser {
|
||||||
///
|
///
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsShowPrompt(java.lang.String,%20android.webkit.GeolocationPermissions.Callback)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsShowPrompt(java.lang.String,%20android.webkit.GeolocationPermissions.Callback)
|
||||||
Future<GeolocationPermissionShowPromptResponse>
|
Future<GeolocationPermissionShowPromptResponse>
|
||||||
// ignore: missing_return
|
// ignore: missing_return
|
||||||
androidOnGeolocationPermissionsShowPrompt(String origin) {}
|
androidOnGeolocationPermissionsShowPrompt(String origin) {}
|
||||||
|
|
||||||
///Notify the host application that a request for Geolocation permissions, made with a previous call to [androidOnGeolocationPermissionsShowPrompt] has been canceled.
|
///Notify the host application that a request for Geolocation permissions, made with a previous call to [androidOnGeolocationPermissionsShowPrompt] has been canceled.
|
||||||
///Any related UI should therefore be hidden.
|
///Any related UI should therefore be hidden.
|
||||||
|
@ -584,8 +583,8 @@ class InAppBrowser {
|
||||||
///- https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20android.webkit.WebResourceRequest)
|
///- https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20android.webkit.WebResourceRequest)
|
||||||
///- https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20java.lang.String)
|
///- https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20java.lang.String)
|
||||||
Future<WebResourceResponse>
|
Future<WebResourceResponse>
|
||||||
// ignore: missing_return
|
// ignore: missing_return
|
||||||
androidShouldInterceptRequest(WebResourceRequest request) {}
|
androidShouldInterceptRequest(WebResourceRequest request) {}
|
||||||
|
|
||||||
///Event called when the renderer currently associated with the WebView becomes unresponsive as a result of a long running blocking task such as the execution of JavaScript.
|
///Event called when the renderer currently associated with the WebView becomes unresponsive as a result of a long running blocking task such as the execution of JavaScript.
|
||||||
///
|
///
|
||||||
|
@ -606,8 +605,8 @@ class InAppBrowser {
|
||||||
///
|
///
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessUnresponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessUnresponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess)
|
||||||
Future<WebViewRenderProcessAction>
|
Future<WebViewRenderProcessAction>
|
||||||
// ignore: missing_return
|
// ignore: missing_return
|
||||||
androidOnRenderProcessUnresponsive(String url) {}
|
androidOnRenderProcessUnresponsive(String url) {}
|
||||||
|
|
||||||
///Event called once when an unresponsive renderer currently associated with the WebView becomes responsive.
|
///Event called once when an unresponsive renderer currently associated with the WebView becomes responsive.
|
||||||
///
|
///
|
||||||
|
@ -621,8 +620,8 @@ class InAppBrowser {
|
||||||
///
|
///
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessResponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessResponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess)
|
||||||
Future<WebViewRenderProcessAction>
|
Future<WebViewRenderProcessAction>
|
||||||
// ignore: missing_return
|
// ignore: missing_return
|
||||||
androidOnRenderProcessResponsive(String url) {}
|
androidOnRenderProcessResponsive(String url) {}
|
||||||
|
|
||||||
///Event fired when the given WebView's render process has exited.
|
///Event fired when the given WebView's render process has exited.
|
||||||
///The application's implementation of this callback should only attempt to clean up the WebView.
|
///The application's implementation of this callback should only attempt to clean up the WebView.
|
||||||
|
@ -641,8 +640,8 @@ class InAppBrowser {
|
||||||
///
|
///
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onFormResubmission(android.webkit.WebView,%20android.os.Message,%20android.os.Message)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onFormResubmission(android.webkit.WebView,%20android.os.Message,%20android.os.Message)
|
||||||
Future<FormResubmissionAction>
|
Future<FormResubmissionAction>
|
||||||
// ignore: missing_return
|
// ignore: missing_return
|
||||||
androidOnFormResubmission(String url) {}
|
androidOnFormResubmission(String url) {}
|
||||||
|
|
||||||
///Event fired when the scale applied to the WebView has changed.
|
///Event fired when the scale applied to the WebView has changed.
|
||||||
///
|
///
|
||||||
|
|
|
@ -29,7 +29,7 @@ class InAppLocalhostServer {
|
||||||
throw Exception('Server already started on http://localhost:$_port');
|
throw Exception('Server already started on http://localhost:$_port');
|
||||||
}
|
}
|
||||||
|
|
||||||
var completer = new Completer();
|
var completer = Completer();
|
||||||
|
|
||||||
runZoned(() {
|
runZoned(() {
|
||||||
HttpServer.bind('127.0.0.1', _port).then((server) {
|
HttpServer.bind('127.0.0.1', _port).then((server) {
|
||||||
|
@ -62,7 +62,7 @@ class InAppLocalhostServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
request.response.headers.contentType =
|
request.response.headers.contentType =
|
||||||
new ContentType(contentType[0], contentType[1], charset: 'utf-8');
|
ContentType(contentType[0], contentType[1], charset: 'utf-8');
|
||||||
request.response.add(body);
|
request.response.add(body);
|
||||||
request.response.close();
|
request.response.close();
|
||||||
});
|
});
|
||||||
|
|
|
@ -116,7 +116,8 @@ class InAppWebView extends StatefulWidget implements WebView {
|
||||||
final ContextMenu contextMenu;
|
final ContextMenu contextMenu;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<void> Function(InAppWebViewController controller, String url) onPageCommitVisible;
|
final Future<void> Function(InAppWebViewController controller, String url)
|
||||||
|
onPageCommitVisible;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<void> Function(InAppWebViewController controller)
|
final Future<void> Function(InAppWebViewController controller)
|
||||||
|
@ -251,28 +252,33 @@ class InAppWebView extends StatefulWidget implements WebView {
|
||||||
final void Function(InAppWebViewController controller) onExitFullscreen;
|
final void Function(InAppWebViewController controller) onExitFullscreen;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<WebResourceResponse> Function(InAppWebViewController controller, WebResourceRequest request)
|
final Future<WebResourceResponse> Function(
|
||||||
androidShouldInterceptRequest;
|
InAppWebViewController controller, WebResourceRequest request)
|
||||||
|
androidShouldInterceptRequest;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<WebViewRenderProcessAction> Function(InAppWebViewController controller, String url)
|
final Future<WebViewRenderProcessAction> Function(
|
||||||
androidOnRenderProcessUnresponsive;
|
InAppWebViewController controller, String url)
|
||||||
|
androidOnRenderProcessUnresponsive;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<WebViewRenderProcessAction> Function(InAppWebViewController controller, String url)
|
final Future<WebViewRenderProcessAction> Function(
|
||||||
androidOnRenderProcessResponsive;
|
InAppWebViewController controller, String url)
|
||||||
|
androidOnRenderProcessResponsive;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<void> Function(InAppWebViewController controller, RenderProcessGoneDetail detail)
|
final Future<void> Function(
|
||||||
androidOnRenderProcessGone;
|
InAppWebViewController controller, RenderProcessGoneDetail detail)
|
||||||
|
androidOnRenderProcessGone;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<FormResubmissionAction> Function(InAppWebViewController controller, String url)
|
final Future<FormResubmissionAction> Function(
|
||||||
androidOnFormResubmission;
|
InAppWebViewController controller, String url) androidOnFormResubmission;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Future<void> Function(InAppWebViewController controller, double oldScale, double newScale)
|
final Future<void> Function(
|
||||||
androidOnScaleChanged;
|
InAppWebViewController controller, double oldScale, double newScale)
|
||||||
|
androidOnScaleChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
class _InAppWebViewState extends State<InAppWebView> {
|
class _InAppWebViewState extends State<InAppWebView> {
|
||||||
|
|
|
@ -1590,7 +1590,8 @@ class AndroidInAppWebViewController {
|
||||||
///If `true`, [basename] is assumed to be a directory in which a filename will be chosen according to the URL of the current page.
|
///If `true`, [basename] is assumed to be a directory in which a filename will be chosen according to the URL of the current page.
|
||||||
///
|
///
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#saveWebArchive(java.lang.String,%20boolean,%20android.webkit.ValueCallback%3Cjava.lang.String%3E)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#saveWebArchive(java.lang.String,%20boolean,%20android.webkit.ValueCallback%3Cjava.lang.String%3E)
|
||||||
Future<String> saveWebArchive({@required String basename, @required bool autoname}) async {
|
Future<String> saveWebArchive(
|
||||||
|
{@required String basename, @required bool autoname}) async {
|
||||||
assert(basename != null && autoname != null);
|
assert(basename != null && autoname != null);
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
args.putIfAbsent("basename", () => basename);
|
args.putIfAbsent("basename", () => basename);
|
||||||
|
@ -1681,7 +1682,10 @@ class AndroidInAppWebViewController {
|
||||||
///**Official Android API**: https://developer.android.com/reference/androidx/webkit/WebViewCompat#getCurrentWebViewPackage(android.content.Context)
|
///**Official Android API**: https://developer.android.com/reference/androidx/webkit/WebViewCompat#getCurrentWebViewPackage(android.content.Context)
|
||||||
static Future<AndroidWebViewPackageInfo> getCurrentWebViewPackage() async {
|
static Future<AndroidWebViewPackageInfo> getCurrentWebViewPackage() async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
Map<String, dynamic> packageInfo = (await InAppWebViewController._staticChannel.invokeMethod('getCurrentWebViewPackage', args))?.cast<String, dynamic>();
|
Map<String, dynamic> packageInfo = (await InAppWebViewController
|
||||||
|
._staticChannel
|
||||||
|
.invokeMethod('getCurrentWebViewPackage', args))
|
||||||
|
?.cast<String, dynamic>();
|
||||||
return AndroidWebViewPackageInfo.fromMap(packageInfo);
|
return AndroidWebViewPackageInfo.fromMap(packageInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,24 @@ class LoadedResource {
|
||||||
double duration;
|
double duration;
|
||||||
|
|
||||||
LoadedResource({this.initiatorType, this.url, this.startTime, this.duration});
|
LoadedResource({this.initiatorType, this.url, this.startTime, this.duration});
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {
|
||||||
|
"initiatorType": initiatorType,
|
||||||
|
"url": url,
|
||||||
|
"startTime": startTime,
|
||||||
|
"duration": duration
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Initial [data] as a content for an [WebView] instance, using [baseUrl] as the base URL for it.
|
///Initial [data] as a content for an [WebView] instance, using [baseUrl] as the base URL for it.
|
||||||
|
@ -122,6 +140,15 @@ class InAppWebViewInitialData {
|
||||||
"historyUrl": historyUrl
|
"historyUrl": historyUrl
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, String> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class representing a resource request of the WebView used by the event [WebView.androidShouldInterceptRequest].
|
///Class representing a resource request of the WebView used by the event [WebView.androidShouldInterceptRequest].
|
||||||
|
@ -131,14 +158,17 @@ class InAppWebViewInitialData {
|
||||||
class WebResourceRequest {
|
class WebResourceRequest {
|
||||||
///The URL for which the resource request was made.
|
///The URL for which the resource request was made.
|
||||||
String url;
|
String url;
|
||||||
|
|
||||||
///The headers associated with the request.
|
///The headers associated with the request.
|
||||||
///
|
///
|
||||||
///**NOTE**: Available on Android 21+. For Android < 21 it will be always `null`.
|
///**NOTE**: Available on Android 21+. For Android < 21 it will be always `null`.
|
||||||
Map<String, String> headers;
|
Map<String, String> headers;
|
||||||
|
|
||||||
///The method associated with the request, for example `GET`.
|
///The method associated with the request, for example `GET`.
|
||||||
///
|
///
|
||||||
///**NOTE**: Available on Android 21+. For Android < 21 it will be always "GET".
|
///**NOTE**: Available on Android 21+. For Android < 21 it will be always "GET".
|
||||||
String method;
|
String method;
|
||||||
|
|
||||||
///Gets whether a gesture (such as a click) was associated with the request.
|
///Gets whether a gesture (such as a click) was associated with the request.
|
||||||
///For security reasons in certain situations this method may return `false` even though
|
///For security reasons in certain situations this method may return `false` even though
|
||||||
///the sequence of events which caused the request to be created was initiated by a user
|
///the sequence of events which caused the request to be created was initiated by a user
|
||||||
|
@ -146,23 +176,44 @@ class WebResourceRequest {
|
||||||
///
|
///
|
||||||
///**NOTE**: Available on Android 21+. For Android < 21 it will be always `false`.
|
///**NOTE**: Available on Android 21+. For Android < 21 it will be always `false`.
|
||||||
bool hasGesture;
|
bool hasGesture;
|
||||||
|
|
||||||
///Whether the request was made in order to fetch the main frame's document.
|
///Whether the request was made in order to fetch the main frame's document.
|
||||||
///
|
///
|
||||||
///**NOTE**: Available on Android 21+. For Android < 21 it will be always `true`.
|
///**NOTE**: Available on Android 21+. For Android < 21 it will be always `true`.
|
||||||
bool isForMainFrame;
|
bool isForMainFrame;
|
||||||
|
|
||||||
///Whether the request was a result of a server-side redirect.
|
///Whether the request was a result of a server-side redirect.
|
||||||
///
|
///
|
||||||
///**NOTE**: Available on Android 21+. For Android < 21 it will be always `false`.
|
///**NOTE**: Available on Android 21+. For Android < 21 it will be always `false`.
|
||||||
bool isRedirect;
|
bool isRedirect;
|
||||||
|
|
||||||
WebResourceRequest({
|
WebResourceRequest(
|
||||||
@required this.url,
|
{@required this.url,
|
||||||
this.headers,
|
this.headers,
|
||||||
this.method,
|
this.method,
|
||||||
this.hasGesture,
|
this.hasGesture,
|
||||||
this.isForMainFrame,
|
this.isForMainFrame,
|
||||||
this.isRedirect
|
this.isRedirect});
|
||||||
});
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {
|
||||||
|
"url": url,
|
||||||
|
"headers": headers,
|
||||||
|
"method": method,
|
||||||
|
"hasGesture": hasGesture,
|
||||||
|
"isForMainFrame": isForMainFrame,
|
||||||
|
"isRedirect": isRedirect
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class representing a resource response of the WebView used by the event [WebView.androidShouldInterceptRequest].
|
///Class representing a resource response of the WebView used by the event [WebView.androidShouldInterceptRequest].
|
||||||
|
@ -172,33 +223,37 @@ class WebResourceRequest {
|
||||||
class WebResourceResponse {
|
class WebResourceResponse {
|
||||||
///The resource response's MIME type, for example `text/html`.
|
///The resource response's MIME type, for example `text/html`.
|
||||||
String contentType;
|
String contentType;
|
||||||
|
|
||||||
///The resource response's encoding. The default value is `utf-8`.
|
///The resource response's encoding. The default value is `utf-8`.
|
||||||
String contentEncoding;
|
String contentEncoding;
|
||||||
|
|
||||||
///The data provided by the resource response.
|
///The data provided by the resource response.
|
||||||
Uint8List data;
|
Uint8List data;
|
||||||
|
|
||||||
///The headers for the resource response. If [headers] isn't `null`, then you need to set also [statusCode] and [reasonPhrase].
|
///The headers for the resource response. If [headers] isn't `null`, then you need to set also [statusCode] and [reasonPhrase].
|
||||||
///
|
///
|
||||||
///**NOTE**: Available on Android 21+. For Android < 21 it won't be used.
|
///**NOTE**: Available on Android 21+. For Android < 21 it won't be used.
|
||||||
Map<String, String> headers;
|
Map<String, String> headers;
|
||||||
|
|
||||||
///The status code needs to be in the ranges [100, 299], [400, 599]. Causing a redirect by specifying a 3xx code is not supported.
|
///The status code needs to be in the ranges [100, 299], [400, 599]. Causing a redirect by specifying a 3xx code is not supported.
|
||||||
///If statusCode is set, then you need to set also [headers] and [reasonPhrase]. This value cannot be `null`.
|
///If statusCode is set, then you need to set also [headers] and [reasonPhrase]. This value cannot be `null`.
|
||||||
///
|
///
|
||||||
///**NOTE**: Available on Android 21+. For Android < 21 it won't be used.
|
///**NOTE**: Available on Android 21+. For Android < 21 it won't be used.
|
||||||
int statusCode;
|
int statusCode;
|
||||||
|
|
||||||
///The phrase describing the status code, for example `"OK"`. Must be non-empty.
|
///The phrase describing the status code, for example `"OK"`. Must be non-empty.
|
||||||
///If reasonPhrase is set, then you need to set also [headers] and [reasonPhrase]. This value cannot be `null`.
|
///If reasonPhrase is set, then you need to set also [headers] and [reasonPhrase]. This value cannot be `null`.
|
||||||
///
|
///
|
||||||
///**NOTE**: Available on Android 21+. For Android < 21 it won't be used.
|
///**NOTE**: Available on Android 21+. For Android < 21 it won't be used.
|
||||||
String reasonPhrase;
|
String reasonPhrase;
|
||||||
|
|
||||||
WebResourceResponse({
|
WebResourceResponse(
|
||||||
this.contentType = "",
|
{this.contentType = "",
|
||||||
this.contentEncoding = "utf-8",
|
this.contentEncoding = "utf-8",
|
||||||
this.data = null,
|
this.data = null,
|
||||||
this.headers,
|
this.headers,
|
||||||
this.statusCode,
|
this.statusCode,
|
||||||
this.reasonPhrase
|
this.reasonPhrase});
|
||||||
});
|
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {
|
return {
|
||||||
|
@ -209,6 +264,15 @@ class WebResourceResponse {
|
||||||
"reasonPhrase": reasonPhrase
|
"reasonPhrase": reasonPhrase
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class representing the response returned by the [WebView.onLoadResourceCustomScheme] event.
|
///Class representing the response returned by the [WebView.onLoadResourceCustomScheme] event.
|
||||||
|
@ -228,13 +292,22 @@ class CustomSchemeResponse {
|
||||||
@required this.contentType,
|
@required this.contentType,
|
||||||
this.contentEnconding = 'utf-8'});
|
this.contentEnconding = 'utf-8'});
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toMap() {
|
||||||
return {
|
return {
|
||||||
'content-type': contentType,
|
'content-type': contentType,
|
||||||
'content-encoding': contentEnconding,
|
'content-encoding': contentEnconding,
|
||||||
'data': data
|
'data': data
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class representing a JavaScript console message from WebCore.
|
///Class representing a JavaScript console message from WebCore.
|
||||||
|
@ -247,6 +320,19 @@ class ConsoleMessage {
|
||||||
|
|
||||||
ConsoleMessage(
|
ConsoleMessage(
|
||||||
{this.message = "", this.messageLevel = ConsoleMessageLevel.LOG});
|
{this.message = "", this.messageLevel = ConsoleMessageLevel.LOG});
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {"message": message, "messageLevel": messageLevel?.toValue()};
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///This class contains a snapshot of the current back/forward list for a [WebView].
|
///This class contains a snapshot of the current back/forward list for a [WebView].
|
||||||
|
@ -258,6 +344,19 @@ class WebHistory {
|
||||||
int currentIndex;
|
int currentIndex;
|
||||||
|
|
||||||
WebHistory({this.list, this.currentIndex});
|
WebHistory({this.list, this.currentIndex});
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {"list": list, "currentIndex": currentIndex};
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///A convenience class for accessing fields in an entry in the back/forward list of a WebView. Each [WebHistoryItem] is a snapshot of the requested history item.
|
///A convenience class for accessing fields in an entry in the back/forward list of a WebView. Each [WebHistoryItem] is a snapshot of the requested history item.
|
||||||
|
@ -279,6 +378,25 @@ class WebHistoryItem {
|
||||||
|
|
||||||
WebHistoryItem(
|
WebHistoryItem(
|
||||||
{this.originalUrl, this.title, this.url, this.index, this.offset});
|
{this.originalUrl, this.title, this.url, this.index, this.offset});
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {
|
||||||
|
"originalUrl": originalUrl,
|
||||||
|
"title": title,
|
||||||
|
"url": url,
|
||||||
|
"index": index,
|
||||||
|
"offset": offset
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class used by the host application to set the Geolocation permission state for an origin during the [WebView.androidOnGeolocationPermissionsShowPrompt] event.
|
///Class used by the host application to set the Geolocation permission state for an origin during the [WebView.androidOnGeolocationPermissionsShowPrompt] event.
|
||||||
|
@ -298,6 +416,15 @@ class GeolocationPermissionShowPromptResponse {
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {"origin": origin, "allow": allow, "retain": retain};
|
return {"origin": origin, "allow": allow, "retain": retain};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class used by [JsAlertResponse] class.
|
///Class used by [JsAlertResponse] class.
|
||||||
|
@ -344,6 +471,15 @@ class JsAlertResponse {
|
||||||
"action": action?.toValue()
|
"action": action?.toValue()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class used by [JsConfirmResponse] class.
|
///Class used by [JsConfirmResponse] class.
|
||||||
|
@ -396,6 +532,15 @@ class JsConfirmResponse {
|
||||||
"action": action?.toValue()
|
"action": action?.toValue()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class used by [JsPromptResponse] class.
|
///Class used by [JsPromptResponse] class.
|
||||||
|
@ -458,6 +603,15 @@ class JsPromptResponse {
|
||||||
"action": action?.toValue()
|
"action": action?.toValue()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class that represents the reason the resource was caught by Safe Browsing.
|
///Class that represents the reason the resource was caught by Safe Browsing.
|
||||||
|
@ -547,6 +701,15 @@ class SafeBrowsingResponse {
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {"report": report, "action": action?.toValue()};
|
return {"report": report, "action": action?.toValue()};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class used by [HttpAuthResponse] class.
|
///Class used by [HttpAuthResponse] class.
|
||||||
|
@ -601,6 +764,15 @@ class HttpAuthResponse {
|
||||||
"action": action?.toValue()
|
"action": action?.toValue()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class that represents the challenge of the [WebView.onReceivedHttpAuthRequest] event.
|
///Class that represents the challenge of the [WebView.onReceivedHttpAuthRequest] event.
|
||||||
|
@ -615,6 +787,22 @@ class HttpAuthChallenge {
|
||||||
HttpAuthChallenge(
|
HttpAuthChallenge(
|
||||||
{@required this.previousFailureCount, @required this.protectionSpace})
|
{@required this.previousFailureCount, @required this.protectionSpace})
|
||||||
: assert(previousFailureCount != null && protectionSpace != null);
|
: assert(previousFailureCount != null && protectionSpace != null);
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {
|
||||||
|
"previousFailureCount": previousFailureCount,
|
||||||
|
"protectionSpace": protectionSpace?.toMap()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class that represents a protection space requiring authentication.
|
///Class that represents a protection space requiring authentication.
|
||||||
|
@ -636,6 +824,19 @@ class ProtectionSpace {
|
||||||
ProtectionSpace(
|
ProtectionSpace(
|
||||||
{@required this.host, @required this.protocol, this.realm, this.port})
|
{@required this.host, @required this.protocol, this.realm, this.port})
|
||||||
: assert(host != null && protocol != null);
|
: assert(host != null && protocol != null);
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {"host": host, "protocol": protocol, "realm": realm, "port": port};
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class that represents the credentials of an http authentication.
|
///Class that represents the credentials of an http authentication.
|
||||||
|
@ -649,6 +850,19 @@ class HttpAuthCredential {
|
||||||
|
|
||||||
HttpAuthCredential({@required this.username, @required this.password})
|
HttpAuthCredential({@required this.username, @required this.password})
|
||||||
: assert(username != null && password != null);
|
: assert(username != null && password != null);
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {"username": username, "password": password};
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class used by [ServerTrustAuthResponse] class.
|
///Class used by [ServerTrustAuthResponse] class.
|
||||||
|
@ -681,6 +895,15 @@ class ServerTrustAuthResponse {
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {"action": action?.toValue()};
|
return {"action": action?.toValue()};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class that represents the challenge of the [WebView.onReceivedServerTrustAuthRequest] event.
|
///Class that represents the challenge of the [WebView.onReceivedServerTrustAuthRequest] event.
|
||||||
|
@ -708,6 +931,24 @@ class ServerTrustChallenge {
|
||||||
this.message,
|
this.message,
|
||||||
this.serverCertificate})
|
this.serverCertificate})
|
||||||
: assert(protectionSpace != null && error != null);
|
: assert(protectionSpace != null && error != null);
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {
|
||||||
|
"protectionSpace": protectionSpace?.toMap(),
|
||||||
|
"error": error,
|
||||||
|
"message": message,
|
||||||
|
"serverCertificate": serverCertificate
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class used by [ClientCertResponse] class.
|
///Class used by [ClientCertResponse] class.
|
||||||
|
@ -764,6 +1005,15 @@ class ClientCertResponse {
|
||||||
"action": action?.toValue()
|
"action": action?.toValue()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class that represents the challenge of the [WebView.onReceivedClientCertRequest] event.
|
///Class that represents the challenge of the [WebView.onReceivedClientCertRequest] event.
|
||||||
|
@ -774,6 +1024,19 @@ class ClientCertChallenge {
|
||||||
|
|
||||||
ClientCertChallenge({@required this.protectionSpace})
|
ClientCertChallenge({@required this.protectionSpace})
|
||||||
: assert(protectionSpace != null);
|
: assert(protectionSpace != null);
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {"protectionSpace": protectionSpace?.toMap()};
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class that represents a favicon of a website. It is used by [InAppWebViewController.getFavicons] method.
|
///Class that represents a favicon of a website. It is used by [InAppWebViewController.getFavicons] method.
|
||||||
|
@ -793,8 +1056,17 @@ class Favicon {
|
||||||
Favicon({@required this.url, this.rel, this.width, this.height})
|
Favicon({@required this.url, this.rel, this.width, this.height})
|
||||||
: assert(url != null);
|
: assert(url != null);
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {"url": url, "rel": rel, "width": width, "height": height};
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return "url: $url, rel: $rel, width: $width, height: $height";
|
return toMap().toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -949,7 +1221,7 @@ class AndroidLayoutAlgorithm {
|
||||||
const AndroidLayoutAlgorithm._internal(this._value);
|
const AndroidLayoutAlgorithm._internal(this._value);
|
||||||
|
|
||||||
static AndroidLayoutAlgorithm fromValue(String value) {
|
static AndroidLayoutAlgorithm fromValue(String value) {
|
||||||
return (["NORMAL", "TEXT_AUTOSIZING"].contains(value))
|
return (["NORMAL", "TEXT_AUTOSIZING", "NARROW_COLUMNS"].contains(value))
|
||||||
? AndroidLayoutAlgorithm._internal(value)
|
? AndroidLayoutAlgorithm._internal(value)
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
@ -969,6 +1241,10 @@ class AndroidLayoutAlgorithm {
|
||||||
static const TEXT_AUTOSIZING =
|
static const TEXT_AUTOSIZING =
|
||||||
const AndroidLayoutAlgorithm._internal("TEXT_AUTOSIZING");
|
const AndroidLayoutAlgorithm._internal("TEXT_AUTOSIZING");
|
||||||
|
|
||||||
|
///NARROW_COLUMNS makes all columns no wider than the screen if possible. Only use this for API levels prior to `Build.VERSION_CODES.KITKAT`.
|
||||||
|
static const NARROW_COLUMNS =
|
||||||
|
const AndroidLayoutAlgorithm._internal("NARROW_COLUMNS");
|
||||||
|
|
||||||
bool operator ==(value) => value == _value;
|
bool operator ==(value) => value == _value;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -1414,6 +1690,11 @@ class InAppWebViewGroupOptions {
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return this.toMap();
|
return this.toMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class that represents the options that can be used for an [InAppBrowser] WebView.
|
///Class that represents the options that can be used for an [InAppBrowser] WebView.
|
||||||
|
@ -1455,6 +1736,11 @@ class InAppBrowserClassOptions {
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return this.toMap();
|
return this.toMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class that represents the options that can be used for an [ChromeSafariBrowser] window.
|
///Class that represents the options that can be used for an [ChromeSafariBrowser] window.
|
||||||
|
@ -1479,6 +1765,11 @@ class ChromeSafariBrowserClassOptions {
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return this.toMap();
|
return this.toMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class used by [AjaxRequest] class.
|
///Class used by [AjaxRequest] class.
|
||||||
|
@ -1509,6 +1800,11 @@ class AjaxRequestAction {
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return this.toMap();
|
return this.toMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class used by [AjaxRequestEvent] class.
|
///Class used by [AjaxRequestEvent] class.
|
||||||
|
@ -1770,6 +2066,11 @@ class AjaxRequest {
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return this.toMap();
|
return this.toMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class used by [FetchRequest] class.
|
///Class used by [FetchRequest] class.
|
||||||
|
@ -1802,6 +2103,15 @@ class FetchRequestCredential {
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {"type": type};
|
return {"type": type};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class that represents the default credentials used by an [FetchRequest].
|
///Class that represents the default credentials used by an [FetchRequest].
|
||||||
|
@ -1817,6 +2127,15 @@ class FetchRequestCredentialDefault extends FetchRequestCredential {
|
||||||
"value": value,
|
"value": value,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class that represents a [FederatedCredential](https://developer.mozilla.org/en-US/docs/Web/API/FederatedCredential) type of credentials.
|
///Class that represents a [FederatedCredential](https://developer.mozilla.org/en-US/docs/Web/API/FederatedCredential) type of credentials.
|
||||||
|
@ -1850,6 +2169,15 @@ class FetchRequestFederatedCredential extends FetchRequestCredential {
|
||||||
"iconURL": iconURL
|
"iconURL": iconURL
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class that represents a [PasswordCredential](https://developer.mozilla.org/en-US/docs/Web/API/PasswordCredential) type of credentials.
|
///Class that represents a [PasswordCredential](https://developer.mozilla.org/en-US/docs/Web/API/PasswordCredential) type of credentials.
|
||||||
|
@ -1879,6 +2207,15 @@ class FetchRequestPasswordCredential extends FetchRequestCredential {
|
||||||
"iconURL": iconURL
|
"iconURL": iconURL
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class that represents a HTTP request created with JavaScript using the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch).
|
///Class that represents a HTTP request created with JavaScript using the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch).
|
||||||
|
@ -1959,6 +2296,11 @@ class FetchRequest {
|
||||||
return this.toMap();
|
return this.toMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
|
|
||||||
static FetchRequestCredential createFetchRequestCredentialFromMap(
|
static FetchRequestCredential createFetchRequestCredentialFromMap(
|
||||||
credentialsMap) {
|
credentialsMap) {
|
||||||
if (credentialsMap != null) {
|
if (credentialsMap != null) {
|
||||||
|
@ -2111,6 +2453,19 @@ class Cookie {
|
||||||
dynamic value;
|
dynamic value;
|
||||||
|
|
||||||
Cookie({@required this.name, @required this.value});
|
Cookie({@required this.name, @required this.value});
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {"name": name, "value": value};
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class used by [PermissionRequestResponse] class.
|
///Class used by [PermissionRequestResponse] class.
|
||||||
|
@ -2148,6 +2503,15 @@ class PermissionRequestResponse {
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {"resources": resources, "action": action?.toValue()};
|
return {"resources": resources, "action": action?.toValue()};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class that is used by [WebView.shouldOverrideUrlLoading] event.
|
///Class that is used by [WebView.shouldOverrideUrlLoading] event.
|
||||||
|
@ -2251,6 +2615,27 @@ class ShouldOverrideUrlLoadingRequest {
|
||||||
this.androidHasGesture,
|
this.androidHasGesture,
|
||||||
this.androidIsRedirect,
|
this.androidIsRedirect,
|
||||||
this.iosWKNavigationType});
|
this.iosWKNavigationType});
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {
|
||||||
|
"url": url,
|
||||||
|
"headers": headers,
|
||||||
|
"method": method,
|
||||||
|
"isForMainFrame": isForMainFrame,
|
||||||
|
"androidHasGesture": androidHasGesture,
|
||||||
|
"androidIsRedirect": androidIsRedirect,
|
||||||
|
"iosWKNavigationType": iosWKNavigationType?.toValue()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class that represents the navigation request used by the [WebView.onCreateWindow] event.
|
///Class that represents the navigation request used by the [WebView.onCreateWindow] event.
|
||||||
|
@ -2272,6 +2657,24 @@ class OnCreateWindowRequest {
|
||||||
this.androidIsDialog,
|
this.androidIsDialog,
|
||||||
this.androidIsUserGesture,
|
this.androidIsUserGesture,
|
||||||
this.iosWKNavigationType});
|
this.iosWKNavigationType});
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {
|
||||||
|
"url": url,
|
||||||
|
"androidIsDialog": androidIsDialog,
|
||||||
|
"androidIsUserGesture": androidIsUserGesture,
|
||||||
|
"iosWKNavigationType": iosWKNavigationType?.toValue()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class that encapsulates information about the amount of storage currently used by an origin for the JavaScript storage APIs.
|
///Class that encapsulates information about the amount of storage currently used by an origin for the JavaScript storage APIs.
|
||||||
|
@ -2292,6 +2695,11 @@ class AndroidWebStorageOrigin {
|
||||||
return {"origin": origin, "quota": quota, "usage": usage};
|
return {"origin": origin, "quota": quota, "usage": usage};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return toMap().toString();
|
return toMap().toString();
|
||||||
}
|
}
|
||||||
|
@ -2415,6 +2823,11 @@ class IOSWKWebsiteDataRecord {
|
||||||
return {"displayName": displayName, "dataTypes": dataTypesString};
|
return {"displayName": displayName, "dataTypes": dataTypesString};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return toMap().toString();
|
return toMap().toString();
|
||||||
}
|
}
|
||||||
|
@ -2499,6 +2912,19 @@ class InAppWebViewHitTestResult {
|
||||||
String extra;
|
String extra;
|
||||||
|
|
||||||
InAppWebViewHitTestResult({this.type, this.extra});
|
InAppWebViewHitTestResult({this.type, this.extra});
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {"type": type?.toValue(), "extra": extra};
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class that represents the action to take used by the [WebView.androidOnRenderProcessUnresponsive] and [WebView.androidOnRenderProcessResponsive] event
|
///Class that represents the action to take used by the [WebView.androidOnRenderProcessUnresponsive] and [WebView.androidOnRenderProcessResponsive] event
|
||||||
|
@ -2519,9 +2945,7 @@ class WebViewRenderProcessAction {
|
||||||
int get hashCode => _value.hashCode;
|
int get hashCode => _value.hashCode;
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {
|
return {"action": _value};
|
||||||
"action": _value
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2532,11 +2956,28 @@ class RenderProcessGoneDetail {
|
||||||
///
|
///
|
||||||
///If the render process was killed, this is most likely caused by the system being low on memory.
|
///If the render process was killed, this is most likely caused by the system being low on memory.
|
||||||
bool didCrash;
|
bool didCrash;
|
||||||
|
|
||||||
/// Returns the renderer priority that was set at the time that the renderer exited. This may be greater than the priority that
|
/// Returns the renderer priority that was set at the time that the renderer exited. This may be greater than the priority that
|
||||||
/// any individual [WebView] requested using [].
|
/// any individual [WebView] requested using [].
|
||||||
RendererPriority rendererPriorityAtExit;
|
RendererPriority rendererPriorityAtExit;
|
||||||
|
|
||||||
RenderProcessGoneDetail({this.didCrash, this.rendererPriorityAtExit});
|
RenderProcessGoneDetail({this.didCrash, this.rendererPriorityAtExit});
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {
|
||||||
|
"didCrash": didCrash,
|
||||||
|
"rendererPriorityAtExit": rendererPriorityAtExit?.toValue()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class used by [RendererPriorityPolicy] class.
|
///Class used by [RendererPriorityPolicy] class.
|
||||||
|
@ -2574,7 +3015,8 @@ class RendererPriority {
|
||||||
static const RENDERER_PRIORITY_BOUND = const RendererPriority._internal(1);
|
static const RENDERER_PRIORITY_BOUND = const RendererPriority._internal(1);
|
||||||
|
|
||||||
///The renderer associated with this WebView is bound with Android `Context#BIND_IMPORTANT`.
|
///The renderer associated with this WebView is bound with Android `Context#BIND_IMPORTANT`.
|
||||||
static const RENDERER_PRIORITY_IMPORTANT = const RendererPriority._internal(2);
|
static const RENDERER_PRIORITY_IMPORTANT =
|
||||||
|
const RendererPriority._internal(2);
|
||||||
|
|
||||||
bool operator ==(value) => value == _value;
|
bool operator ==(value) => value == _value;
|
||||||
|
|
||||||
|
@ -2591,10 +3033,13 @@ class RendererPriority {
|
||||||
class RendererPriorityPolicy {
|
class RendererPriorityPolicy {
|
||||||
///The minimum priority at which this WebView desires the renderer process to be bound.
|
///The minimum priority at which this WebView desires the renderer process to be bound.
|
||||||
RendererPriority rendererRequestedPriority;
|
RendererPriority rendererRequestedPriority;
|
||||||
|
|
||||||
///If true, this flag specifies that when this WebView is not visible, it will be treated as if it had requested a priority of [RendererPriority.RENDERER_PRIORITY_WAIVED].
|
///If true, this flag specifies that when this WebView is not visible, it will be treated as if it had requested a priority of [RendererPriority.RENDERER_PRIORITY_WAIVED].
|
||||||
bool waivedWhenNotVisible;
|
bool waivedWhenNotVisible;
|
||||||
|
|
||||||
RendererPriorityPolicy({@required this.rendererRequestedPriority, @required this.waivedWhenNotVisible});
|
RendererPriorityPolicy(
|
||||||
|
{@required this.rendererRequestedPriority,
|
||||||
|
@required this.waivedWhenNotVisible});
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {
|
return {
|
||||||
|
@ -2603,11 +3048,22 @@ class RendererPriorityPolicy {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
|
|
||||||
static RendererPriorityPolicy fromMap(Map<String, dynamic> map) {
|
static RendererPriorityPolicy fromMap(Map<String, dynamic> map) {
|
||||||
return map != null ? RendererPriorityPolicy(
|
return map != null
|
||||||
rendererRequestedPriority: RendererPriority.fromValue(map["rendererRequestedPriority"]),
|
? RendererPriorityPolicy(
|
||||||
waivedWhenNotVisible: map["waivedWhenNotVisible"]
|
rendererRequestedPriority:
|
||||||
) : RendererPriorityPolicy();
|
RendererPriority.fromValue(map["rendererRequestedPriority"]),
|
||||||
|
waivedWhenNotVisible: map["waivedWhenNotVisible"])
|
||||||
|
: RendererPriorityPolicy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2631,9 +3087,16 @@ class FormResubmissionAction {
|
||||||
int get hashCode => _value.hashCode;
|
int get hashCode => _value.hashCode;
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {
|
return {"action": _value};
|
||||||
"action": _value
|
}
|
||||||
};
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2666,16 +3129,14 @@ class AndroidOverScrollMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
///Always allow a user to over-scroll this view, provided it is a view that can scroll.
|
///Always allow a user to over-scroll this view, provided it is a view that can scroll.
|
||||||
static const OVER_SCROLL_ALWAYS =
|
static const OVER_SCROLL_ALWAYS = const AndroidOverScrollMode._internal(0);
|
||||||
const AndroidOverScrollMode._internal(0);
|
|
||||||
|
|
||||||
///Allow a user to over-scroll this view only if the content is large enough to meaningfully scroll, provided it is a view that can scroll.
|
///Allow a user to over-scroll this view only if the content is large enough to meaningfully scroll, provided it is a view that can scroll.
|
||||||
static const OVER_SCROLL_IF_CONTENT_SCROLLS =
|
static const OVER_SCROLL_IF_CONTENT_SCROLLS =
|
||||||
const AndroidOverScrollMode._internal(1);
|
const AndroidOverScrollMode._internal(1);
|
||||||
|
|
||||||
///Never allow a user to over-scroll this view.
|
///Never allow a user to over-scroll this view.
|
||||||
static const OVER_SCROLL_NEVER =
|
static const OVER_SCROLL_NEVER = const AndroidOverScrollMode._internal(2);
|
||||||
const AndroidOverScrollMode._internal(2);
|
|
||||||
|
|
||||||
bool operator ==(value) => value == _value;
|
bool operator ==(value) => value == _value;
|
||||||
|
|
||||||
|
@ -2721,22 +3182,22 @@ class AndroidScrollBarStyle {
|
||||||
///The scrollbar style to display the scrollbars inside the content area, without increasing the padding.
|
///The scrollbar style to display the scrollbars inside the content area, without increasing the padding.
|
||||||
///The scrollbars will be overlaid with translucency on the view's content.
|
///The scrollbars will be overlaid with translucency on the view's content.
|
||||||
static const SCROLLBARS_INSIDE_OVERLAY =
|
static const SCROLLBARS_INSIDE_OVERLAY =
|
||||||
const AndroidScrollBarStyle._internal(0);
|
const AndroidScrollBarStyle._internal(0);
|
||||||
|
|
||||||
///The scrollbar style to display the scrollbars inside the padded area, increasing the padding of the view.
|
///The scrollbar style to display the scrollbars inside the padded area, increasing the padding of the view.
|
||||||
///The scrollbars will not overlap the content area of the view.
|
///The scrollbars will not overlap the content area of the view.
|
||||||
static const SCROLLBARS_INSIDE_INSET =
|
static const SCROLLBARS_INSIDE_INSET =
|
||||||
const AndroidScrollBarStyle._internal(16777216);
|
const AndroidScrollBarStyle._internal(16777216);
|
||||||
|
|
||||||
///The scrollbar style to display the scrollbars at the edge of the view, without increasing the padding.
|
///The scrollbar style to display the scrollbars at the edge of the view, without increasing the padding.
|
||||||
///The scrollbars will be overlaid with translucency.
|
///The scrollbars will be overlaid with translucency.
|
||||||
static const SCROLLBARS_OUTSIDE_OVERLAY =
|
static const SCROLLBARS_OUTSIDE_OVERLAY =
|
||||||
const AndroidScrollBarStyle._internal(33554432);
|
const AndroidScrollBarStyle._internal(33554432);
|
||||||
|
|
||||||
///The scrollbar style to display the scrollbars at the edge of the view, increasing the padding of the view.
|
///The scrollbar style to display the scrollbars at the edge of the view, increasing the padding of the view.
|
||||||
///The scrollbars will only overlap the background, if any.
|
///The scrollbars will only overlap the background, if any.
|
||||||
static const SCROLLBARS_OUTSIDE_INSET =
|
static const SCROLLBARS_OUTSIDE_INSET =
|
||||||
const AndroidScrollBarStyle._internal(50331648);
|
const AndroidScrollBarStyle._internal(50331648);
|
||||||
|
|
||||||
bool operator ==(value) => value == _value;
|
bool operator ==(value) => value == _value;
|
||||||
|
|
||||||
|
@ -2773,15 +3234,15 @@ class AndroidVerticalScrollbarPosition {
|
||||||
|
|
||||||
///Position the scroll bar at the default position as determined by the system.
|
///Position the scroll bar at the default position as determined by the system.
|
||||||
static const SCROLLBAR_POSITION_DEFAULT =
|
static const SCROLLBAR_POSITION_DEFAULT =
|
||||||
const AndroidVerticalScrollbarPosition._internal(0);
|
const AndroidVerticalScrollbarPosition._internal(0);
|
||||||
|
|
||||||
///Position the scroll bar along the left edge.
|
///Position the scroll bar along the left edge.
|
||||||
static const SCROLLBAR_POSITION_LEFT =
|
static const SCROLLBAR_POSITION_LEFT =
|
||||||
const AndroidVerticalScrollbarPosition._internal(1);
|
const AndroidVerticalScrollbarPosition._internal(1);
|
||||||
|
|
||||||
///Position the scroll bar along the right edge.
|
///Position the scroll bar along the right edge.
|
||||||
static const SCROLLBAR_POSITION_RIGHT =
|
static const SCROLLBAR_POSITION_RIGHT =
|
||||||
const AndroidVerticalScrollbarPosition._internal(2);
|
const AndroidVerticalScrollbarPosition._internal(2);
|
||||||
|
|
||||||
bool operator ==(value) => value == _value;
|
bool operator ==(value) => value == _value;
|
||||||
|
|
||||||
|
@ -2793,15 +3254,29 @@ class AndroidVerticalScrollbarPosition {
|
||||||
class AndroidWebViewPackageInfo {
|
class AndroidWebViewPackageInfo {
|
||||||
///The version name of this WebView package.
|
///The version name of this WebView package.
|
||||||
String versionName;
|
String versionName;
|
||||||
|
|
||||||
///The name of this WebView package.
|
///The name of this WebView package.
|
||||||
String packageName;
|
String packageName;
|
||||||
|
|
||||||
AndroidWebViewPackageInfo({this.versionName, this.packageName});
|
AndroidWebViewPackageInfo({this.versionName, this.packageName});
|
||||||
|
|
||||||
static AndroidWebViewPackageInfo fromMap(Map<String, dynamic> map) {
|
static AndroidWebViewPackageInfo fromMap(Map<String, dynamic> map) {
|
||||||
return map != null ? AndroidWebViewPackageInfo(
|
return map != null
|
||||||
versionName: map["versionName"],
|
? AndroidWebViewPackageInfo(
|
||||||
packageName: map["packageName"]
|
versionName: map["versionName"], packageName: map["packageName"])
|
||||||
) : AndroidWebViewPackageInfo();
|
: AndroidWebViewPackageInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {"versionName": versionName, "packageName": packageName};
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,15 @@ class AndroidWebStorageManager {
|
||||||
List<AndroidWebStorageOrigin> originsList = [];
|
List<AndroidWebStorageOrigin> originsList = [];
|
||||||
|
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
List<Map<dynamic, dynamic>> origins = (await WebStorageManager._channel.invokeMethod('getOrigins', args)).cast<Map<dynamic, dynamic>>();
|
List<Map<dynamic, dynamic>> origins =
|
||||||
|
(await WebStorageManager._channel.invokeMethod('getOrigins', args))
|
||||||
|
.cast<Map<dynamic, dynamic>>();
|
||||||
|
|
||||||
for(var origin in origins) {
|
for (var origin in origins) {
|
||||||
originsList.add(AndroidWebStorageOrigin(origin: origin["origin"], quota: origin["quota"], usage: origin["usage"]));
|
originsList.add(AndroidWebStorageOrigin(
|
||||||
|
origin: origin["origin"],
|
||||||
|
quota: origin["quota"],
|
||||||
|
usage: origin["usage"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return originsList;
|
return originsList;
|
||||||
|
@ -72,7 +77,8 @@ class AndroidWebStorageManager {
|
||||||
assert(origin != null);
|
assert(origin != null);
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
args.putIfAbsent("origin", () => origin);
|
args.putIfAbsent("origin", () => origin);
|
||||||
return await WebStorageManager._channel.invokeMethod('getQuotaForOrigin', args);
|
return await WebStorageManager._channel
|
||||||
|
.invokeMethod('getQuotaForOrigin', args);
|
||||||
}
|
}
|
||||||
|
|
||||||
///Gets the amount of storage currently being used by both the Application Cache and Web SQL Database APIs by the given [origin].
|
///Gets the amount of storage currently being used by both the Application Cache and Web SQL Database APIs by the given [origin].
|
||||||
|
@ -81,7 +87,8 @@ class AndroidWebStorageManager {
|
||||||
assert(origin != null);
|
assert(origin != null);
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
args.putIfAbsent("origin", () => origin);
|
args.putIfAbsent("origin", () => origin);
|
||||||
return await WebStorageManager._channel.invokeMethod('getUsageForOrigin', args);
|
return await WebStorageManager._channel
|
||||||
|
.invokeMethod('getUsageForOrigin', args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +100,8 @@ class IOSWebStorageManager {
|
||||||
///Fetches data records containing the given website data types.
|
///Fetches data records containing the given website data types.
|
||||||
///
|
///
|
||||||
///[dataTypes] represents the website data types to fetch records for.
|
///[dataTypes] represents the website data types to fetch records for.
|
||||||
Future<List<IOSWKWebsiteDataRecord>> fetchDataRecords({@required Set<IOSWKWebsiteDataType> dataTypes}) async {
|
Future<List<IOSWKWebsiteDataRecord>> fetchDataRecords(
|
||||||
|
{@required Set<IOSWKWebsiteDataType> dataTypes}) async {
|
||||||
assert(dataTypes != null);
|
assert(dataTypes != null);
|
||||||
List<IOSWKWebsiteDataRecord> recordList = [];
|
List<IOSWKWebsiteDataRecord> recordList = [];
|
||||||
List<String> dataTypesList = [];
|
List<String> dataTypesList = [];
|
||||||
|
@ -102,14 +110,17 @@ class IOSWebStorageManager {
|
||||||
}
|
}
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
args.putIfAbsent("dataTypes", () => dataTypesList);
|
args.putIfAbsent("dataTypes", () => dataTypesList);
|
||||||
List<Map<dynamic, dynamic>> records = (await WebStorageManager._channel.invokeMethod('fetchDataRecords', args)).cast<Map<dynamic, dynamic>>();
|
List<Map<dynamic, dynamic>> records = (await WebStorageManager._channel
|
||||||
for(var record in records) {
|
.invokeMethod('fetchDataRecords', args))
|
||||||
|
.cast<Map<dynamic, dynamic>>();
|
||||||
|
for (var record in records) {
|
||||||
List<String> dataTypesString = record["dataTypes"].cast<String>();
|
List<String> dataTypesString = record["dataTypes"].cast<String>();
|
||||||
Set<IOSWKWebsiteDataType> dataTypes = Set();
|
Set<IOSWKWebsiteDataType> dataTypes = Set();
|
||||||
for(var dataType in dataTypesString) {
|
for (var dataType in dataTypesString) {
|
||||||
dataTypes.add(IOSWKWebsiteDataType.fromValue(dataType));
|
dataTypes.add(IOSWKWebsiteDataType.fromValue(dataType));
|
||||||
}
|
}
|
||||||
recordList.add(IOSWKWebsiteDataRecord(displayName: record["displayName"], dataTypes: dataTypes));
|
recordList.add(IOSWKWebsiteDataRecord(
|
||||||
|
displayName: record["displayName"], dataTypes: dataTypes));
|
||||||
}
|
}
|
||||||
return recordList;
|
return recordList;
|
||||||
}
|
}
|
||||||
|
@ -119,7 +130,9 @@ class IOSWebStorageManager {
|
||||||
///[dataTypes] represents the website data types that should be removed.
|
///[dataTypes] represents the website data types that should be removed.
|
||||||
///
|
///
|
||||||
///[dataRecords] represents the website data records to delete website data for.
|
///[dataRecords] represents the website data records to delete website data for.
|
||||||
Future<void> removeDataFor({@required Set<IOSWKWebsiteDataType> dataTypes, @required List<IOSWKWebsiteDataRecord> dataRecords}) async {
|
Future<void> removeDataFor(
|
||||||
|
{@required Set<IOSWKWebsiteDataType> dataTypes,
|
||||||
|
@required List<IOSWKWebsiteDataRecord> dataRecords}) async {
|
||||||
assert(dataTypes != null && dataRecords != null);
|
assert(dataTypes != null && dataRecords != null);
|
||||||
|
|
||||||
List<String> dataTypesList = [];
|
List<String> dataTypesList = [];
|
||||||
|
@ -143,7 +156,9 @@ class IOSWebStorageManager {
|
||||||
///[dataTypes] represents the website data types that should be removed.
|
///[dataTypes] represents the website data types that should be removed.
|
||||||
///
|
///
|
||||||
///[date] represents a date. All website data modified after this date will be removed.
|
///[date] represents a date. All website data modified after this date will be removed.
|
||||||
Future<void> removeDataModifiedSince({@required Set<IOSWKWebsiteDataType> dataTypes, @required DateTime date}) async {
|
Future<void> removeDataModifiedSince(
|
||||||
|
{@required Set<IOSWKWebsiteDataType> dataTypes,
|
||||||
|
@required DateTime date}) async {
|
||||||
assert(dataTypes != null && date != null);
|
assert(dataTypes != null && date != null);
|
||||||
|
|
||||||
List<String> dataTypesList = [];
|
List<String> dataTypesList = [];
|
||||||
|
@ -156,6 +171,7 @@ class IOSWebStorageManager {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
args.putIfAbsent("dataTypes", () => dataTypesList);
|
args.putIfAbsent("dataTypes", () => dataTypesList);
|
||||||
args.putIfAbsent("timestamp", () => timestamp);
|
args.putIfAbsent("timestamp", () => timestamp);
|
||||||
await WebStorageManager._channel.invokeMethod('removeDataModifiedSince', args);
|
await WebStorageManager._channel
|
||||||
|
.invokeMethod('removeDataModifiedSince', args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ abstract class WebView {
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onPageStarted(android.webkit.WebView,%20java.lang.String,%20android.graphics.Bitmap)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onPageStarted(android.webkit.WebView,%20java.lang.String,%20android.graphics.Bitmap)
|
||||||
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455621-webview
|
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455621-webview
|
||||||
final void Function(InAppWebViewController controller, String url)
|
final void Function(InAppWebViewController controller, String url)
|
||||||
onLoadStart;
|
onLoadStart;
|
||||||
|
|
||||||
///Event fired when the [WebView] finishes loading an [url].
|
///Event fired when the [WebView] finishes loading an [url].
|
||||||
///
|
///
|
||||||
|
@ -49,14 +49,14 @@ abstract class WebView {
|
||||||
///
|
///
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onProgressChanged(android.webkit.WebView,%20int)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onProgressChanged(android.webkit.WebView,%20int)
|
||||||
final void Function(InAppWebViewController controller, int progress)
|
final void Function(InAppWebViewController controller, int progress)
|
||||||
onProgressChanged;
|
onProgressChanged;
|
||||||
|
|
||||||
///Event fired when the [WebView] receives a [ConsoleMessage].
|
///Event fired when the [WebView] receives a [ConsoleMessage].
|
||||||
///
|
///
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onConsoleMessage(android.webkit.ConsoleMessage)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onConsoleMessage(android.webkit.ConsoleMessage)
|
||||||
final void Function(
|
final void Function(
|
||||||
InAppWebViewController controller, ConsoleMessage consoleMessage)
|
InAppWebViewController controller, ConsoleMessage consoleMessage)
|
||||||
onConsoleMessage;
|
onConsoleMessage;
|
||||||
|
|
||||||
///Give the host application a chance to take control when a URL is about to be loaded in the current WebView. This event is not called on the initial load of the WebView.
|
///Give the host application a chance to take control when a URL is about to be loaded in the current WebView. This event is not called on the initial load of the WebView.
|
||||||
///
|
///
|
||||||
|
@ -73,16 +73,16 @@ abstract class WebView {
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#shouldOverrideUrlLoading(android.webkit.WebView,%20java.lang.String)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#shouldOverrideUrlLoading(android.webkit.WebView,%20java.lang.String)
|
||||||
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455641-webview
|
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455641-webview
|
||||||
final Future<ShouldOverrideUrlLoadingAction> Function(
|
final Future<ShouldOverrideUrlLoadingAction> Function(
|
||||||
InAppWebViewController controller,
|
InAppWebViewController controller,
|
||||||
ShouldOverrideUrlLoadingRequest shouldOverrideUrlLoadingRequest)
|
ShouldOverrideUrlLoadingRequest shouldOverrideUrlLoadingRequest)
|
||||||
shouldOverrideUrlLoading;
|
shouldOverrideUrlLoading;
|
||||||
|
|
||||||
///Event fired when the [WebView] loads a resource.
|
///Event fired when the [WebView] loads a resource.
|
||||||
///
|
///
|
||||||
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useOnLoadResource] and [InAppWebViewOptions.javaScriptEnabled] options to `true`.
|
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useOnLoadResource] and [InAppWebViewOptions.javaScriptEnabled] options to `true`.
|
||||||
final void Function(
|
final void Function(
|
||||||
InAppWebViewController controller, LoadedResource resource)
|
InAppWebViewController controller, LoadedResource resource)
|
||||||
onLoadResource;
|
onLoadResource;
|
||||||
|
|
||||||
///Event fired when the [WebView] scrolls.
|
///Event fired when the [WebView] scrolls.
|
||||||
///
|
///
|
||||||
|
@ -93,7 +93,7 @@ abstract class WebView {
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#onScrollChanged(int,%20int,%20int,%20int)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#onScrollChanged(int,%20int,%20int,%20int)
|
||||||
///**Official iOS API**: https://developer.apple.com/documentation/uikit/uiscrollviewdelegate/1619392-scrollviewdidscroll
|
///**Official iOS API**: https://developer.apple.com/documentation/uikit/uiscrollviewdelegate/1619392-scrollviewdidscroll
|
||||||
final void Function(InAppWebViewController controller, int x, int y)
|
final void Function(InAppWebViewController controller, int x, int y)
|
||||||
onScrollChanged;
|
onScrollChanged;
|
||||||
|
|
||||||
///Event fired when [WebView] recognizes a downloadable file.
|
///Event fired when [WebView] recognizes a downloadable file.
|
||||||
///To download the file, you can use the [flutter_downloader](https://pub.dev/packages/flutter_downloader) plugin.
|
///To download the file, you can use the [flutter_downloader](https://pub.dev/packages/flutter_downloader) plugin.
|
||||||
|
@ -105,7 +105,7 @@ abstract class WebView {
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#setDownloadListener(android.webkit.DownloadListener)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#setDownloadListener(android.webkit.DownloadListener)
|
||||||
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview
|
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview
|
||||||
final void Function(InAppWebViewController controller, String url)
|
final void Function(InAppWebViewController controller, String url)
|
||||||
onDownloadStart;
|
onDownloadStart;
|
||||||
|
|
||||||
///Event fired when the [WebView] finds the `custom-scheme` while loading a resource. Here you can handle the url request and return a [CustomSchemeResponse] to load a specific resource encoded to `base64`.
|
///Event fired when the [WebView] finds the `custom-scheme` while loading a resource. Here you can handle the url request and return a [CustomSchemeResponse] to load a specific resource encoded to `base64`.
|
||||||
///
|
///
|
||||||
|
@ -115,8 +115,8 @@ abstract class WebView {
|
||||||
///
|
///
|
||||||
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkurlschemehandler
|
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkurlschemehandler
|
||||||
final Future<CustomSchemeResponse> Function(
|
final Future<CustomSchemeResponse> Function(
|
||||||
InAppWebViewController controller, String scheme, String url)
|
InAppWebViewController controller, String scheme, String url)
|
||||||
onLoadResourceCustomScheme;
|
onLoadResourceCustomScheme;
|
||||||
|
|
||||||
///Event fired when the [WebView] requests the host application to create a new window,
|
///Event fired when the [WebView] requests the host application to create a new window,
|
||||||
///for example when trying to open a link with `target="_blank"` or when `window.open()` is called by JavaScript side.
|
///for example when trying to open a link with `target="_blank"` or when `window.open()` is called by JavaScript side.
|
||||||
|
@ -169,8 +169,8 @@ abstract class WebView {
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpAuthRequest(android.webkit.WebView,%20android.webkit.HttpAuthHandler,%20java.lang.String,%20java.lang.String)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpAuthRequest(android.webkit.WebView,%20android.webkit.HttpAuthHandler,%20java.lang.String,%20java.lang.String)
|
||||||
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview
|
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview
|
||||||
final Future<HttpAuthResponse> Function(
|
final Future<HttpAuthResponse> Function(
|
||||||
InAppWebViewController controller, HttpAuthChallenge challenge)
|
InAppWebViewController controller, HttpAuthChallenge challenge)
|
||||||
onReceivedHttpAuthRequest;
|
onReceivedHttpAuthRequest;
|
||||||
|
|
||||||
///Event fired when the WebView need to perform server trust authentication (certificate validation).
|
///Event fired when the WebView need to perform server trust authentication (certificate validation).
|
||||||
///The host application must return either [ServerTrustAuthResponse] instance with [ServerTrustAuthResponseAction.CANCEL] or [ServerTrustAuthResponseAction.PROCEED].
|
///The host application must return either [ServerTrustAuthResponse] instance with [ServerTrustAuthResponseAction.CANCEL] or [ServerTrustAuthResponseAction.PROCEED].
|
||||||
|
@ -180,8 +180,8 @@ abstract class WebView {
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedSslError(android.webkit.WebView,%20android.webkit.SslErrorHandler,%20android.net.http.SslError)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedSslError(android.webkit.WebView,%20android.webkit.SslErrorHandler,%20android.net.http.SslError)
|
||||||
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview
|
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview
|
||||||
final Future<ServerTrustAuthResponse> Function(
|
final Future<ServerTrustAuthResponse> Function(
|
||||||
InAppWebViewController controller, ServerTrustChallenge challenge)
|
InAppWebViewController controller, ServerTrustChallenge challenge)
|
||||||
onReceivedServerTrustAuthRequest;
|
onReceivedServerTrustAuthRequest;
|
||||||
|
|
||||||
///Notify the host application to handle an SSL client certificate request.
|
///Notify the host application to handle an SSL client certificate request.
|
||||||
///Webview stores the response in memory (for the life of the application) if [ClientCertResponseAction.PROCEED] or [ClientCertResponseAction.CANCEL]
|
///Webview stores the response in memory (for the life of the application) if [ClientCertResponseAction.PROCEED] or [ClientCertResponseAction.CANCEL]
|
||||||
|
@ -193,8 +193,8 @@ abstract class WebView {
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedClientCertRequest(android.webkit.WebView,%20android.webkit.ClientCertRequest)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedClientCertRequest(android.webkit.WebView,%20android.webkit.ClientCertRequest)
|
||||||
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview
|
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview
|
||||||
final Future<ClientCertResponse> Function(
|
final Future<ClientCertResponse> Function(
|
||||||
InAppWebViewController controller, ClientCertChallenge challenge)
|
InAppWebViewController controller, ClientCertChallenge challenge)
|
||||||
onReceivedClientCertRequest;
|
onReceivedClientCertRequest;
|
||||||
|
|
||||||
///Event fired as find-on-page operations progress.
|
///Event fired as find-on-page operations progress.
|
||||||
///The listener may be notified multiple times while the operation is underway, and the numberOfMatches value should not be considered final unless [isDoneCounting] is true.
|
///The listener may be notified multiple times while the operation is underway, and the numberOfMatches value should not be considered final unless [isDoneCounting] is true.
|
||||||
|
@ -220,8 +220,8 @@ abstract class WebView {
|
||||||
///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
|
///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
|
||||||
///Inside the `window.addEventListener("flutterInAppWebViewPlatformReady")` event, the ajax requests will be intercept for sure.
|
///Inside the `window.addEventListener("flutterInAppWebViewPlatformReady")` event, the ajax requests will be intercept for sure.
|
||||||
final Future<AjaxRequest> Function(
|
final Future<AjaxRequest> Function(
|
||||||
InAppWebViewController controller, AjaxRequest ajaxRequest)
|
InAppWebViewController controller, AjaxRequest ajaxRequest)
|
||||||
shouldInterceptAjaxRequest;
|
shouldInterceptAjaxRequest;
|
||||||
|
|
||||||
///Event fired whenever the `readyState` attribute of an `XMLHttpRequest` changes.
|
///Event fired whenever the `readyState` attribute of an `XMLHttpRequest` changes.
|
||||||
///It gives the host application a chance to abort the request.
|
///It gives the host application a chance to abort the request.
|
||||||
|
@ -234,8 +234,8 @@ abstract class WebView {
|
||||||
///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
|
///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
|
||||||
///Inside the `window.addEventListener("flutterInAppWebViewPlatformReady")` event, the ajax requests will be intercept for sure.
|
///Inside the `window.addEventListener("flutterInAppWebViewPlatformReady")` event, the ajax requests will be intercept for sure.
|
||||||
final Future<AjaxRequestAction> Function(
|
final Future<AjaxRequestAction> Function(
|
||||||
InAppWebViewController controller, AjaxRequest ajaxRequest)
|
InAppWebViewController controller, AjaxRequest ajaxRequest)
|
||||||
onAjaxReadyStateChange;
|
onAjaxReadyStateChange;
|
||||||
|
|
||||||
///Event fired as an `XMLHttpRequest` progress.
|
///Event fired as an `XMLHttpRequest` progress.
|
||||||
///It gives the host application a chance to abort the request.
|
///It gives the host application a chance to abort the request.
|
||||||
|
@ -248,8 +248,8 @@ abstract class WebView {
|
||||||
///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
|
///used to intercept ajax requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
|
||||||
///Inside the `window.addEventListener("flutterInAppWebViewPlatformReady")` event, the ajax requests will be intercept for sure.
|
///Inside the `window.addEventListener("flutterInAppWebViewPlatformReady")` event, the ajax requests will be intercept for sure.
|
||||||
final Future<AjaxRequestAction> Function(
|
final Future<AjaxRequestAction> Function(
|
||||||
InAppWebViewController controller, AjaxRequest ajaxRequest)
|
InAppWebViewController controller, AjaxRequest ajaxRequest)
|
||||||
onAjaxProgress;
|
onAjaxProgress;
|
||||||
|
|
||||||
///Event fired when a request is sent to a server through [Fetch API](https://developer.mozilla.org/it/docs/Web/API/Fetch_API).
|
///Event fired when a request is sent to a server through [Fetch API](https://developer.mozilla.org/it/docs/Web/API/Fetch_API).
|
||||||
///It gives the host application a chance to take control over the request before sending it.
|
///It gives the host application a chance to take control over the request before sending it.
|
||||||
|
@ -262,8 +262,8 @@ abstract class WebView {
|
||||||
///used to intercept fetch requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
|
///used to intercept fetch requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms).
|
||||||
///Inside the `window.addEventListener("flutterInAppWebViewPlatformReady")` event, the fetch requests will be intercept for sure.
|
///Inside the `window.addEventListener("flutterInAppWebViewPlatformReady")` event, the fetch requests will be intercept for sure.
|
||||||
final Future<FetchRequest> Function(
|
final Future<FetchRequest> Function(
|
||||||
InAppWebViewController controller, FetchRequest fetchRequest)
|
InAppWebViewController controller, FetchRequest fetchRequest)
|
||||||
shouldInterceptFetchRequest;
|
shouldInterceptFetchRequest;
|
||||||
|
|
||||||
///Event fired when the host application updates its visited links database.
|
///Event fired when the host application updates its visited links database.
|
||||||
///This event is also fired when the navigation state of the [WebView] changes through the usage of
|
///This event is also fired when the navigation state of the [WebView] changes through the usage of
|
||||||
|
@ -276,8 +276,8 @@ abstract class WebView {
|
||||||
///
|
///
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#doUpdateVisitedHistory(android.webkit.WebView,%20java.lang.String,%20boolean)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#doUpdateVisitedHistory(android.webkit.WebView,%20java.lang.String,%20boolean)
|
||||||
final void Function(
|
final void Function(
|
||||||
InAppWebViewController controller, String url, bool androidIsReload)
|
InAppWebViewController controller, String url, bool androidIsReload)
|
||||||
onUpdateVisitedHistory;
|
onUpdateVisitedHistory;
|
||||||
|
|
||||||
///Event fired when `window.print()` is called from JavaScript side.
|
///Event fired when `window.print()` is called from JavaScript side.
|
||||||
///
|
///
|
||||||
|
@ -316,7 +316,8 @@ abstract class WebView {
|
||||||
///
|
///
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onPageCommitVisible(android.webkit.WebView,%20java.lang.String)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onPageCommitVisible(android.webkit.WebView,%20java.lang.String)
|
||||||
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455635-webview
|
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455635-webview
|
||||||
final Future<void> Function(InAppWebViewController controller, String url) onPageCommitVisible;
|
final Future<void> Function(InAppWebViewController controller, String url)
|
||||||
|
onPageCommitVisible;
|
||||||
|
|
||||||
///Event fired when the webview notifies that a loading URL has been flagged by Safe Browsing.
|
///Event fired when the webview notifies that a loading URL has been flagged by Safe Browsing.
|
||||||
///The default behavior is to show an interstitial to the user, with the reporting checkbox visible.
|
///The default behavior is to show an interstitial to the user, with the reporting checkbox visible.
|
||||||
|
@ -355,8 +356,8 @@ abstract class WebView {
|
||||||
///
|
///
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsShowPrompt(java.lang.String,%20android.webkit.GeolocationPermissions.Callback)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsShowPrompt(java.lang.String,%20android.webkit.GeolocationPermissions.Callback)
|
||||||
final Future<GeolocationPermissionShowPromptResponse> Function(
|
final Future<GeolocationPermissionShowPromptResponse> Function(
|
||||||
InAppWebViewController controller, String origin)
|
InAppWebViewController controller, String origin)
|
||||||
androidOnGeolocationPermissionsShowPrompt;
|
androidOnGeolocationPermissionsShowPrompt;
|
||||||
|
|
||||||
///Notify the host application that a request for Geolocation permissions, made with a previous call to [androidOnGeolocationPermissionsShowPrompt] has been canceled.
|
///Notify the host application that a request for Geolocation permissions, made with a previous call to [androidOnGeolocationPermissionsShowPrompt] has been canceled.
|
||||||
///Any related UI should therefore be hidden.
|
///Any related UI should therefore be hidden.
|
||||||
|
@ -365,7 +366,7 @@ abstract class WebView {
|
||||||
///
|
///
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsHidePrompt()
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsHidePrompt()
|
||||||
final Future<void> Function(InAppWebViewController controller)
|
final Future<void> Function(InAppWebViewController controller)
|
||||||
androidOnGeolocationPermissionsHidePrompt;
|
androidOnGeolocationPermissionsHidePrompt;
|
||||||
|
|
||||||
///Notify the host application of a resource request and allow the application to return the data.
|
///Notify the host application of a resource request and allow the application to return the data.
|
||||||
///If the return value is `null`, the WebView will continue to load the resource as usual.
|
///If the return value is `null`, the WebView will continue to load the resource as usual.
|
||||||
|
@ -384,8 +385,9 @@ abstract class WebView {
|
||||||
///**Official Android API**:
|
///**Official Android API**:
|
||||||
///- https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20android.webkit.WebResourceRequest)
|
///- https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20android.webkit.WebResourceRequest)
|
||||||
///- https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20java.lang.String)
|
///- https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20java.lang.String)
|
||||||
final Future<WebResourceResponse> Function(InAppWebViewController controller, WebResourceRequest request)
|
final Future<WebResourceResponse> Function(
|
||||||
androidShouldInterceptRequest;
|
InAppWebViewController controller, WebResourceRequest request)
|
||||||
|
androidShouldInterceptRequest;
|
||||||
|
|
||||||
///Event called when the renderer currently associated with the WebView becomes unresponsive as a result of a long running blocking task such as the execution of JavaScript.
|
///Event called when the renderer currently associated with the WebView becomes unresponsive as a result of a long running blocking task such as the execution of JavaScript.
|
||||||
///
|
///
|
||||||
|
@ -405,8 +407,9 @@ abstract class WebView {
|
||||||
///**NOTE**: available only on Android 29+.
|
///**NOTE**: available only on Android 29+.
|
||||||
///
|
///
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessUnresponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessUnresponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess)
|
||||||
final Future<WebViewRenderProcessAction> Function(InAppWebViewController controller, String url)
|
final Future<WebViewRenderProcessAction> Function(
|
||||||
androidOnRenderProcessUnresponsive;
|
InAppWebViewController controller, String url)
|
||||||
|
androidOnRenderProcessUnresponsive;
|
||||||
|
|
||||||
///Event called once when an unresponsive renderer currently associated with the WebView becomes responsive.
|
///Event called once when an unresponsive renderer currently associated with the WebView becomes responsive.
|
||||||
///
|
///
|
||||||
|
@ -419,8 +422,9 @@ abstract class WebView {
|
||||||
///**NOTE**: available only on Android 29+.
|
///**NOTE**: available only on Android 29+.
|
||||||
///
|
///
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessResponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessResponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess)
|
||||||
final Future<WebViewRenderProcessAction> Function(InAppWebViewController controller, String url)
|
final Future<WebViewRenderProcessAction> Function(
|
||||||
androidOnRenderProcessResponsive;
|
InAppWebViewController controller, String url)
|
||||||
|
androidOnRenderProcessResponsive;
|
||||||
|
|
||||||
///Event fired when the given WebView's render process has exited.
|
///Event fired when the given WebView's render process has exited.
|
||||||
///The application's implementation of this callback should only attempt to clean up the WebView.
|
///The application's implementation of this callback should only attempt to clean up the WebView.
|
||||||
|
@ -431,16 +435,17 @@ abstract class WebView {
|
||||||
///**NOTE**: available only on Android 26+.
|
///**NOTE**: available only on Android 26+.
|
||||||
///
|
///
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onRenderProcessGone(android.webkit.WebView,%20android.webkit.RenderProcessGoneDetail)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onRenderProcessGone(android.webkit.WebView,%20android.webkit.RenderProcessGoneDetail)
|
||||||
final Future<void> Function(InAppWebViewController controller, RenderProcessGoneDetail detail)
|
final Future<void> Function(
|
||||||
androidOnRenderProcessGone;
|
InAppWebViewController controller, RenderProcessGoneDetail detail)
|
||||||
|
androidOnRenderProcessGone;
|
||||||
|
|
||||||
///As the host application if the browser should resend data as the requested page was a result of a POST. The default is to not resend the data.
|
///As the host application if the browser should resend data as the requested page was a result of a POST. The default is to not resend the data.
|
||||||
///
|
///
|
||||||
///**NOTE**: available only on Android.
|
///**NOTE**: available only on Android.
|
||||||
///
|
///
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onFormResubmission(android.webkit.WebView,%20android.os.Message,%20android.os.Message)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onFormResubmission(android.webkit.WebView,%20android.os.Message,%20android.os.Message)
|
||||||
final Future<FormResubmissionAction> Function(InAppWebViewController controller, String url)
|
final Future<FormResubmissionAction> Function(
|
||||||
androidOnFormResubmission;
|
InAppWebViewController controller, String url) androidOnFormResubmission;
|
||||||
|
|
||||||
///Event fired when the scale applied to the WebView has changed.
|
///Event fired when the scale applied to the WebView has changed.
|
||||||
///
|
///
|
||||||
|
@ -451,8 +456,9 @@ abstract class WebView {
|
||||||
///**NOTE**: available only on Android.
|
///**NOTE**: available only on Android.
|
||||||
///
|
///
|
||||||
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onScaleChanged(android.webkit.WebView,%20float,%20float)
|
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onScaleChanged(android.webkit.WebView,%20float,%20float)
|
||||||
final Future<void> Function(InAppWebViewController controller, double oldScale, double newScale)
|
final Future<void> Function(
|
||||||
androidOnScaleChanged;
|
InAppWebViewController controller, double oldScale, double newScale)
|
||||||
|
androidOnScaleChanged;
|
||||||
|
|
||||||
///Invoked when the web view's web content process is terminated.
|
///Invoked when the web view's web content process is terminated.
|
||||||
///
|
///
|
||||||
|
@ -460,7 +466,7 @@ abstract class WebView {
|
||||||
///
|
///
|
||||||
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi
|
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi
|
||||||
final Future<void> Function(InAppWebViewController controller)
|
final Future<void> Function(InAppWebViewController controller)
|
||||||
iosOnWebContentProcessDidTerminate;
|
iosOnWebContentProcessDidTerminate;
|
||||||
|
|
||||||
///Called when a web view receives a server redirect.
|
///Called when a web view receives a server redirect.
|
||||||
///
|
///
|
||||||
|
@ -468,7 +474,7 @@ abstract class WebView {
|
||||||
///
|
///
|
||||||
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455627-webview
|
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455627-webview
|
||||||
final Future<void> Function(InAppWebViewController controller)
|
final Future<void> Function(InAppWebViewController controller)
|
||||||
iosOnDidReceiveServerRedirectForProvisionalNavigation;
|
iosOnDidReceiveServerRedirectForProvisionalNavigation;
|
||||||
|
|
||||||
///Initial url that will be loaded.
|
///Initial url that will be loaded.
|
||||||
final String initialUrl;
|
final String initialUrl;
|
||||||
|
@ -488,54 +494,53 @@ abstract class WebView {
|
||||||
///Context menu which contains custom menu items to be shown when [ContextMenu] is presented.
|
///Context menu which contains custom menu items to be shown when [ContextMenu] is presented.
|
||||||
final ContextMenu contextMenu;
|
final ContextMenu contextMenu;
|
||||||
|
|
||||||
WebView({
|
WebView(
|
||||||
this.onWebViewCreated,
|
{this.onWebViewCreated,
|
||||||
this.onLoadStart,
|
this.onLoadStart,
|
||||||
this.onLoadStop,
|
this.onLoadStop,
|
||||||
this.onLoadError,
|
this.onLoadError,
|
||||||
this.onLoadHttpError,
|
this.onLoadHttpError,
|
||||||
this.onProgressChanged,
|
this.onProgressChanged,
|
||||||
this.onConsoleMessage,
|
this.onConsoleMessage,
|
||||||
this.shouldOverrideUrlLoading,
|
this.shouldOverrideUrlLoading,
|
||||||
this.onLoadResource,
|
this.onLoadResource,
|
||||||
this.onScrollChanged,
|
this.onScrollChanged,
|
||||||
this.onDownloadStart,
|
this.onDownloadStart,
|
||||||
this.onLoadResourceCustomScheme,
|
this.onLoadResourceCustomScheme,
|
||||||
this.onCreateWindow,
|
this.onCreateWindow,
|
||||||
this.onJsAlert,
|
this.onJsAlert,
|
||||||
this.onJsConfirm,
|
this.onJsConfirm,
|
||||||
this.onJsPrompt,
|
this.onJsPrompt,
|
||||||
this.onReceivedHttpAuthRequest,
|
this.onReceivedHttpAuthRequest,
|
||||||
this.onReceivedServerTrustAuthRequest,
|
this.onReceivedServerTrustAuthRequest,
|
||||||
this.onReceivedClientCertRequest,
|
this.onReceivedClientCertRequest,
|
||||||
this.onFindResultReceived,
|
this.onFindResultReceived,
|
||||||
this.shouldInterceptAjaxRequest,
|
this.shouldInterceptAjaxRequest,
|
||||||
this.onAjaxReadyStateChange,
|
this.onAjaxReadyStateChange,
|
||||||
this.onAjaxProgress,
|
this.onAjaxProgress,
|
||||||
this.shouldInterceptFetchRequest,
|
this.shouldInterceptFetchRequest,
|
||||||
this.onUpdateVisitedHistory,
|
this.onUpdateVisitedHistory,
|
||||||
this.onPrint,
|
this.onPrint,
|
||||||
this.onLongPressHitTestResult,
|
this.onLongPressHitTestResult,
|
||||||
this.onEnterFullscreen,
|
this.onEnterFullscreen,
|
||||||
this.onExitFullscreen,
|
this.onExitFullscreen,
|
||||||
this.onPageCommitVisible,
|
this.onPageCommitVisible,
|
||||||
this.androidOnSafeBrowsingHit,
|
this.androidOnSafeBrowsingHit,
|
||||||
this.androidOnPermissionRequest,
|
this.androidOnPermissionRequest,
|
||||||
this.androidOnGeolocationPermissionsShowPrompt,
|
this.androidOnGeolocationPermissionsShowPrompt,
|
||||||
this.androidOnGeolocationPermissionsHidePrompt,
|
this.androidOnGeolocationPermissionsHidePrompt,
|
||||||
this.androidShouldInterceptRequest,
|
this.androidShouldInterceptRequest,
|
||||||
this.androidOnRenderProcessGone,
|
this.androidOnRenderProcessGone,
|
||||||
this.androidOnRenderProcessResponsive,
|
this.androidOnRenderProcessResponsive,
|
||||||
this.androidOnRenderProcessUnresponsive,
|
this.androidOnRenderProcessUnresponsive,
|
||||||
this.androidOnFormResubmission,
|
this.androidOnFormResubmission,
|
||||||
this.androidOnScaleChanged,
|
this.androidOnScaleChanged,
|
||||||
this.iosOnWebContentProcessDidTerminate,
|
this.iosOnWebContentProcessDidTerminate,
|
||||||
this.iosOnDidReceiveServerRedirectForProvisionalNavigation,
|
this.iosOnDidReceiveServerRedirectForProvisionalNavigation,
|
||||||
this.initialUrl,
|
this.initialUrl,
|
||||||
this.initialFile,
|
this.initialFile,
|
||||||
this.initialData,
|
this.initialData,
|
||||||
this.initialHeaders,
|
this.initialHeaders,
|
||||||
this.initialOptions,
|
this.initialOptions,
|
||||||
this.contextMenu
|
this.contextMenu});
|
||||||
});
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -16,6 +16,15 @@ class WebViewOptions {
|
||||||
static WebViewOptions fromMap(Map<String, dynamic> map) {
|
static WebViewOptions fromMap(Map<String, dynamic> map) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BrowserOptions {
|
class BrowserOptions {
|
||||||
|
@ -26,6 +35,15 @@ class BrowserOptions {
|
||||||
static BrowserOptions fromMap(Map<String, dynamic> map) {
|
static BrowserOptions fromMap(Map<String, dynamic> map) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ChromeSafariBrowserOptions {
|
class ChromeSafariBrowserOptions {
|
||||||
|
@ -36,6 +54,15 @@ class ChromeSafariBrowserOptions {
|
||||||
static ChromeSafariBrowserOptions fromMap(Map<String, dynamic> map) {
|
static ChromeSafariBrowserOptions fromMap(Map<String, dynamic> map) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///This class represents all the cross-platform WebView options available.
|
///This class represents all the cross-platform WebView options available.
|
||||||
|
@ -148,8 +175,7 @@ class InAppWebViewOptions
|
||||||
this.horizontalScrollBarEnabled = true,
|
this.horizontalScrollBarEnabled = true,
|
||||||
this.resourceCustomSchemes = const [],
|
this.resourceCustomSchemes = const [],
|
||||||
this.contentBlockers = const [],
|
this.contentBlockers = const [],
|
||||||
this.preferredContentMode =
|
this.preferredContentMode = UserPreferredContentMode.RECOMMENDED,
|
||||||
UserPreferredContentMode.RECOMMENDED,
|
|
||||||
this.useShouldInterceptAjaxRequest = false,
|
this.useShouldInterceptAjaxRequest = false,
|
||||||
this.useShouldInterceptFetchRequest = false,
|
this.useShouldInterceptFetchRequest = false,
|
||||||
this.incognito = false,
|
this.incognito = false,
|
||||||
|
@ -229,8 +255,7 @@ class InAppWebViewOptions
|
||||||
List<String>.from(map["resourceCustomSchemes"] ?? []);
|
List<String>.from(map["resourceCustomSchemes"] ?? []);
|
||||||
options.contentBlockers = contentBlockers;
|
options.contentBlockers = contentBlockers;
|
||||||
options.preferredContentMode =
|
options.preferredContentMode =
|
||||||
UserPreferredContentMode.fromValue(
|
UserPreferredContentMode.fromValue(map["preferredContentMode"]);
|
||||||
map["preferredContentMode"]);
|
|
||||||
options.useShouldInterceptAjaxRequest =
|
options.useShouldInterceptAjaxRequest =
|
||||||
map["useShouldInterceptAjaxRequest"];
|
map["useShouldInterceptAjaxRequest"];
|
||||||
options.useShouldInterceptFetchRequest =
|
options.useShouldInterceptFetchRequest =
|
||||||
|
@ -243,6 +268,16 @@ class InAppWebViewOptions
|
||||||
options.disableContextMenu = map["disableContextMenu"];
|
options.disableContextMenu = map["disableContextMenu"];
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///This class represents all the Android-only WebView options available.
|
///This class represents all the Android-only WebView options available.
|
||||||
|
@ -503,7 +538,8 @@ class AndroidInAppWebViewOptions
|
||||||
this.overScrollMode = AndroidOverScrollMode.OVER_SCROLL_IF_CONTENT_SCROLLS,
|
this.overScrollMode = AndroidOverScrollMode.OVER_SCROLL_IF_CONTENT_SCROLLS,
|
||||||
this.networkAvailable,
|
this.networkAvailable,
|
||||||
this.scrollBarStyle = AndroidScrollBarStyle.SCROLLBARS_INSIDE_OVERLAY,
|
this.scrollBarStyle = AndroidScrollBarStyle.SCROLLBARS_INSIDE_OVERLAY,
|
||||||
this.verticalScrollbarPosition = AndroidVerticalScrollbarPosition.SCROLLBAR_POSITION_DEFAULT,
|
this.verticalScrollbarPosition =
|
||||||
|
AndroidVerticalScrollbarPosition.SCROLLBAR_POSITION_DEFAULT,
|
||||||
this.scrollBarDefaultDelayBeforeFade,
|
this.scrollBarDefaultDelayBeforeFade,
|
||||||
this.scrollbarFadingEnabled = true,
|
this.scrollbarFadingEnabled = true,
|
||||||
this.scrollBarFadeDuration,
|
this.scrollBarFadeDuration,
|
||||||
|
@ -589,19 +625,16 @@ class AndroidInAppWebViewOptions
|
||||||
options.appCachePath = map["appCachePath"];
|
options.appCachePath = map["appCachePath"];
|
||||||
options.blockNetworkImage = map["blockNetworkImage"];
|
options.blockNetworkImage = map["blockNetworkImage"];
|
||||||
options.blockNetworkLoads = map["blockNetworkLoads"];
|
options.blockNetworkLoads = map["blockNetworkLoads"];
|
||||||
options.cacheMode =
|
options.cacheMode = AndroidCacheMode.fromValue(map["cacheMode"]);
|
||||||
AndroidCacheMode.fromValue(map["cacheMode"]);
|
|
||||||
options.cursiveFontFamily = map["cursiveFontFamily"];
|
options.cursiveFontFamily = map["cursiveFontFamily"];
|
||||||
options.defaultFixedFontSize = map["defaultFixedFontSize"];
|
options.defaultFixedFontSize = map["defaultFixedFontSize"];
|
||||||
options.defaultFontSize = map["defaultFontSize"];
|
options.defaultFontSize = map["defaultFontSize"];
|
||||||
options.defaultTextEncodingName = map["defaultTextEncodingName"];
|
options.defaultTextEncodingName = map["defaultTextEncodingName"];
|
||||||
options.disabledActionModeMenuItems =
|
options.disabledActionModeMenuItems =
|
||||||
AndroidActionModeMenuItem.fromValue(
|
AndroidActionModeMenuItem.fromValue(map["disabledActionModeMenuItems"]);
|
||||||
map["disabledActionModeMenuItems"]);
|
|
||||||
options.fantasyFontFamily = map["fantasyFontFamily"];
|
options.fantasyFontFamily = map["fantasyFontFamily"];
|
||||||
options.fixedFontFamily = map["fixedFontFamily"];
|
options.fixedFontFamily = map["fixedFontFamily"];
|
||||||
options.forceDark =
|
options.forceDark = AndroidForceDark.fromValue(map["forceDark"]);
|
||||||
AndroidForceDark.fromValue(map["forceDark"]);
|
|
||||||
options.geolocationEnabled = map["geolocationEnabled"];
|
options.geolocationEnabled = map["geolocationEnabled"];
|
||||||
options.layoutAlgorithm =
|
options.layoutAlgorithm =
|
||||||
AndroidLayoutAlgorithm.fromValue(map["layoutAlgorithm"]);
|
AndroidLayoutAlgorithm.fromValue(map["layoutAlgorithm"]);
|
||||||
|
@ -618,19 +651,36 @@ class AndroidInAppWebViewOptions
|
||||||
options.thirdPartyCookiesEnabled = map["thirdPartyCookiesEnabled"];
|
options.thirdPartyCookiesEnabled = map["thirdPartyCookiesEnabled"];
|
||||||
options.hardwareAcceleration = map["hardwareAcceleration"];
|
options.hardwareAcceleration = map["hardwareAcceleration"];
|
||||||
options.supportMultipleWindows = map["supportMultipleWindows"];
|
options.supportMultipleWindows = map["supportMultipleWindows"];
|
||||||
options.regexToCancelSubFramesLoading = map["regexToCancelSubFramesLoading"];
|
options.regexToCancelSubFramesLoading =
|
||||||
|
map["regexToCancelSubFramesLoading"];
|
||||||
options.useShouldInterceptRequest = map["useShouldInterceptRequest"];
|
options.useShouldInterceptRequest = map["useShouldInterceptRequest"];
|
||||||
options.useOnRenderProcessGone = map["useOnRenderProcessGone"];
|
options.useOnRenderProcessGone = map["useOnRenderProcessGone"];
|
||||||
options.overScrollMode = AndroidOverScrollMode.fromValue(map["overScrollMode"]);
|
options.overScrollMode =
|
||||||
|
AndroidOverScrollMode.fromValue(map["overScrollMode"]);
|
||||||
options.networkAvailable = map["networkAvailable"];
|
options.networkAvailable = map["networkAvailable"];
|
||||||
options.scrollBarStyle = AndroidScrollBarStyle.fromValue(map["scrollBarStyle"]);
|
options.scrollBarStyle =
|
||||||
options.verticalScrollbarPosition = AndroidVerticalScrollbarPosition.fromValue(map["verticalScrollbarPosition"]);
|
AndroidScrollBarStyle.fromValue(map["scrollBarStyle"]);
|
||||||
options.scrollBarDefaultDelayBeforeFade = map["scrollBarDefaultDelayBeforeFade"];
|
options.verticalScrollbarPosition =
|
||||||
|
AndroidVerticalScrollbarPosition.fromValue(
|
||||||
|
map["verticalScrollbarPosition"]);
|
||||||
|
options.scrollBarDefaultDelayBeforeFade =
|
||||||
|
map["scrollBarDefaultDelayBeforeFade"];
|
||||||
options.scrollbarFadingEnabled = map["scrollbarFadingEnabled"];
|
options.scrollbarFadingEnabled = map["scrollbarFadingEnabled"];
|
||||||
options.scrollBarFadeDuration = map["scrollBarFadeDuration"];
|
options.scrollBarFadeDuration = map["scrollBarFadeDuration"];
|
||||||
options.rendererPriorityPolicy = RendererPriorityPolicy.fromMap(map["rendererPriorityPolicy"]?.cast<String, dynamic>());
|
options.rendererPriorityPolicy = RendererPriorityPolicy.fromMap(
|
||||||
|
map["rendererPriorityPolicy"]?.cast<String, dynamic>());
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///This class represents all the iOS-only WebView options available.
|
///This class represents all the iOS-only WebView options available.
|
||||||
|
@ -786,7 +836,8 @@ class IOSInAppWebViewOptions
|
||||||
"selectionGranularity": selectionGranularity.toValue(),
|
"selectionGranularity": selectionGranularity.toValue(),
|
||||||
"dataDetectorTypes": dataDetectorTypesList,
|
"dataDetectorTypes": dataDetectorTypesList,
|
||||||
"sharedCookiesEnabled": sharedCookiesEnabled,
|
"sharedCookiesEnabled": sharedCookiesEnabled,
|
||||||
"automaticallyAdjustsScrollIndicatorInsets": automaticallyAdjustsScrollIndicatorInsets,
|
"automaticallyAdjustsScrollIndicatorInsets":
|
||||||
|
automaticallyAdjustsScrollIndicatorInsets,
|
||||||
"accessibilityIgnoresInvertColors": accessibilityIgnoresInvertColors,
|
"accessibilityIgnoresInvertColors": accessibilityIgnoresInvertColors,
|
||||||
"decelerationRate": decelerationRate.toValue(),
|
"decelerationRate": decelerationRate.toValue(),
|
||||||
"alwaysBounceVertical": alwaysBounceVertical,
|
"alwaysBounceVertical": alwaysBounceVertical,
|
||||||
|
@ -803,8 +854,7 @@ class IOSInAppWebViewOptions
|
||||||
List<String> dataDetectorTypesList =
|
List<String> dataDetectorTypesList =
|
||||||
List<String>.from(map["dataDetectorTypes"] ?? []);
|
List<String>.from(map["dataDetectorTypes"] ?? []);
|
||||||
dataDetectorTypesList.forEach((dataDetectorType) {
|
dataDetectorTypesList.forEach((dataDetectorType) {
|
||||||
dataDetectorTypes
|
dataDetectorTypes.add(IOSWKDataDetectorTypes.fromValue(dataDetectorType));
|
||||||
.add(IOSWKDataDetectorTypes.fromValue(dataDetectorType));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
IOSInAppWebViewOptions options = IOSInAppWebViewOptions();
|
IOSInAppWebViewOptions options = IOSInAppWebViewOptions();
|
||||||
|
@ -824,13 +874,15 @@ class IOSInAppWebViewOptions
|
||||||
options.isFraudulentWebsiteWarningEnabled =
|
options.isFraudulentWebsiteWarningEnabled =
|
||||||
map["isFraudulentWebsiteWarningEnabled"];
|
map["isFraudulentWebsiteWarningEnabled"];
|
||||||
options.selectionGranularity =
|
options.selectionGranularity =
|
||||||
IOSWKSelectionGranularity.fromValue(
|
IOSWKSelectionGranularity.fromValue(map["selectionGranularity"]);
|
||||||
map["selectionGranularity"]);
|
|
||||||
options.dataDetectorTypes = dataDetectorTypes;
|
options.dataDetectorTypes = dataDetectorTypes;
|
||||||
options.sharedCookiesEnabled = map["sharedCookiesEnabled"];
|
options.sharedCookiesEnabled = map["sharedCookiesEnabled"];
|
||||||
options.automaticallyAdjustsScrollIndicatorInsets = map["automaticallyAdjustsScrollIndicatorInsets"];
|
options.automaticallyAdjustsScrollIndicatorInsets =
|
||||||
options.accessibilityIgnoresInvertColors = map["accessibilityIgnoresInvertColors"];
|
map["automaticallyAdjustsScrollIndicatorInsets"];
|
||||||
options.decelerationRate = IOSUIScrollViewDecelerationRate.fromValue(map["decelerationRate"]);
|
options.accessibilityIgnoresInvertColors =
|
||||||
|
map["accessibilityIgnoresInvertColors"];
|
||||||
|
options.decelerationRate =
|
||||||
|
IOSUIScrollViewDecelerationRate.fromValue(map["decelerationRate"]);
|
||||||
options.alwaysBounceVertical = map["alwaysBounceVertical"];
|
options.alwaysBounceVertical = map["alwaysBounceVertical"];
|
||||||
options.alwaysBounceHorizontal = map["alwaysBounceHorizontal"];
|
options.alwaysBounceHorizontal = map["alwaysBounceHorizontal"];
|
||||||
options.scrollsToTop = map["scrollsToTop"];
|
options.scrollsToTop = map["scrollsToTop"];
|
||||||
|
@ -839,6 +891,16 @@ class IOSInAppWebViewOptions
|
||||||
options.minimumZoomScale = map["minimumZoomScale"];
|
options.minimumZoomScale = map["minimumZoomScale"];
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///This class represents all the cross-platform [InAppBrowser] options available.
|
///This class represents all the cross-platform [InAppBrowser] options available.
|
||||||
|
@ -881,6 +943,16 @@ class InAppBrowserOptions
|
||||||
options.hideUrlBar = map["hideUrlBar"];
|
options.hideUrlBar = map["hideUrlBar"];
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///This class represents all the Android-only [InAppBrowser] options available.
|
///This class represents all the Android-only [InAppBrowser] options available.
|
||||||
|
@ -921,6 +993,16 @@ class AndroidInAppBrowserOptions implements BrowserOptions, AndroidOptions {
|
||||||
options.progressBar = map["progressBar"];
|
options.progressBar = map["progressBar"];
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///This class represents all the iOS-only [InAppBrowser] options available.
|
///This class represents all the iOS-only [InAppBrowser] options available.
|
||||||
|
@ -987,6 +1069,16 @@ class IOSInAppBrowserOptions implements BrowserOptions, IosOptions {
|
||||||
options.spinner = map["spinner"];
|
options.spinner = map["spinner"];
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///This class represents all the Android-only [ChromeSafariBrowser] options available.
|
///This class represents all the Android-only [ChromeSafariBrowser] options available.
|
||||||
|
@ -1051,6 +1143,16 @@ class AndroidChromeCustomTabsOptions
|
||||||
options.keepAliveEnabled = map["keepAliveEnabled"];
|
options.keepAliveEnabled = map["keepAliveEnabled"];
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///This class represents all the iOS-only [ChromeSafariBrowser] options available.
|
///This class represents all the iOS-only [ChromeSafariBrowser] options available.
|
||||||
|
@ -1118,4 +1220,14 @@ class IOSSafariOptions implements ChromeSafariBrowserOptions, IosOptions {
|
||||||
IOSUIModalTransitionStyle.fromValue(map["transitionStyle"]);
|
IOSUIModalTransitionStyle.fromValue(map["transitionStyle"]);
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue