diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a5fb627..43639d1c 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ - Added `PrintJobController` to manage print jobs - Added `WebAuthenticationSession` for iOS - Added `pauseAllMediaPlayback`, `setAllMediaPlaybackSuspended`, `closeAllMediaPresentations`, `requestMediaPlaybackState`, `isInFullscreen`, `getCameraCaptureState`, `setCameraCaptureState`, `getMicrophoneCaptureState`, `setMicrophoneCaptureState` WebView controller methods -- Added `underPageBackgroundColor`, `isTextInteractionEnabled`, `isSiteSpecificQuirksModeEnabled`, `upgradeKnownHostsToHTTPS`, `forceDarkStrategy`, `willSuppressErrorPage`, `algorithmicDarkeningAllowed`, `requestedWithHeaderMode` WebView settings +- Added `underPageBackgroundColor`, `isTextInteractionEnabled`, `isSiteSpecificQuirksModeEnabled`, `upgradeKnownHostsToHTTPS`, `forceDarkStrategy`, `willSuppressErrorPage`, `algorithmicDarkeningAllowed`, `requestedWithHeaderMode`, `enterpriseAuthenticationAppLinkPolicyEnabled` WebView settings - Added `onCameraCaptureStateChanged`, `onMicrophoneCaptureStateChanged` WebView events - Added support for `onPermissionRequest` event on iOS 15.0+ - Added `debugLoggingSettings` static property for WebView and ChromeSafariBrowser diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/webview/in_app_webview/InAppWebView.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/webview/in_app_webview/InAppWebView.java index 6dc3ee4c..096452bc 100755 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/webview/in_app_webview/InAppWebView.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/webview/in_app_webview/InAppWebView.java @@ -391,6 +391,9 @@ final public class InAppWebView extends InputAwareWebView implements InAppWebVie customSettings.requestedWithHeaderMode != null) { WebSettingsCompat.setRequestedWithHeaderMode(settings, customSettings.requestedWithHeaderMode); } + if (WebViewFeature.isFeatureSupported(WebViewFeature.ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY)) { + WebSettingsCompat.setEnterpriseAuthenticationAppLinkPolicyEnabled(settings, customSettings.enterpriseAuthenticationAppLinkPolicyEnabled); + } contentBlockerHandler.getRuleList().clear(); for (Map> contentBlocker : customSettings.contentBlockers) { @@ -1043,6 +1046,11 @@ final public class InAppWebView extends InputAwareWebView implements InAppWebVie newCustomSettings.requestedWithHeaderMode != null) { WebSettingsCompat.setRequestedWithHeaderMode(settings, newCustomSettings.requestedWithHeaderMode); } + if (newSettingsMap.get("enterpriseAuthenticationAppLinkPolicyEnabled") != null && + !Util.objEquals(customSettings.enterpriseAuthenticationAppLinkPolicyEnabled, newCustomSettings.enterpriseAuthenticationAppLinkPolicyEnabled) && + WebViewFeature.isFeatureSupported(WebViewFeature.ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY)) { + WebSettingsCompat.setEnterpriseAuthenticationAppLinkPolicyEnabled(settings, newCustomSettings.enterpriseAuthenticationAppLinkPolicyEnabled); + } customSettings = newCustomSettings; } diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/webview/in_app_webview/InAppWebViewSettings.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/webview/in_app_webview/InAppWebViewSettings.java index 3edbc110..3f1a7c2a 100755 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/webview/in_app_webview/InAppWebViewSettings.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/webview/in_app_webview/InAppWebViewSettings.java @@ -117,6 +117,7 @@ public class InAppWebViewSettings implements ISettings { public Boolean algorithmicDarkeningAllowed = false; @Nullable public Integer requestedWithHeaderMode; + public Boolean enterpriseAuthenticationAppLinkPolicyEnabled = true; @NonNull @Override @@ -384,6 +385,9 @@ public class InAppWebViewSettings implements ISettings { case "requestedWithHeaderMode": requestedWithHeaderMode = (Integer) value; break; + case "enterpriseAuthenticationAppLinkPolicyEnabled": + enterpriseAuthenticationAppLinkPolicyEnabled = (Boolean) value; + break; } } @@ -479,6 +483,7 @@ public class InAppWebViewSettings implements ISettings { settings.put("willSuppressErrorPage", willSuppressErrorPage); settings.put("algorithmicDarkeningAllowed", algorithmicDarkeningAllowed); settings.put("requestedWithHeaderMode", requestedWithHeaderMode); + settings.put("enterpriseAuthenticationAppLinkPolicyEnabled", enterpriseAuthenticationAppLinkPolicyEnabled); return settings; } @@ -573,6 +578,9 @@ public class InAppWebViewSettings implements ISettings { if (WebViewFeature.isFeatureSupported(WebViewFeature.REQUESTED_WITH_HEADER_CONTROL)) { realSettings.put("requestedWithHeaderMode", WebSettingsCompat.getRequestedWithHeaderMode(settings)); } + if (WebViewFeature.isFeatureSupported(WebViewFeature.ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY)) { + realSettings.put("enterpriseAuthenticationAppLinkPolicyEnabled", WebSettingsCompat.getEnterpriseAuthenticationAppLinkPolicyEnabled(settings)); + } } return realSettings; } diff --git a/lib/src/android/webview_feature.dart b/lib/src/android/webview_feature.dart index 299d4239..811a38e7 100644 --- a/lib/src/android/webview_feature.dart +++ b/lib/src/android/webview_feature.dart @@ -204,6 +204,10 @@ class WebViewFeature_ { static const REQUESTED_WITH_HEADER_CONTROL = const WebViewFeature_._internal("REQUESTED_WITH_HEADER_CONTROL"); + ///This feature covers [InAppWebViewSettings.enterpriseAuthenticationAppLinkPolicyEnabled]. + static const ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY = + const WebViewFeature_._internal("ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY"); + ///Return whether a feature is supported at run-time. On devices running Android version `Build.VERSION_CODES.LOLLIPOP` and higher, ///this will check whether a feature is supported, depending on the combination of the desired feature, the Android version of device, ///and the WebView APK on the device. If running on a device with a lower API level, this will always return `false`. @@ -419,6 +423,10 @@ class AndroidWebViewFeature_ { static const REQUESTED_WITH_HEADER_CONTROL = const AndroidWebViewFeature_._internal("REQUESTED_WITH_HEADER_CONTROL"); + ///This feature covers [InAppWebViewSettings.enterpriseAuthenticationAppLinkPolicyEnabled]. + static const ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY = + const AndroidWebViewFeature_._internal("ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY"); + ///Return whether a feature is supported at run-time. On devices running Android version `Build.VERSION_CODES.LOLLIPOP` and higher, ///this will check whether a feature is supported, depending on the combination of the desired feature, the Android version of device, ///and the WebView APK on the device. If running on a device with a lower API level, this will always return `false`. diff --git a/lib/src/android/webview_feature.g.dart b/lib/src/android/webview_feature.g.dart index 1f33c22b..d43b7692 100644 --- a/lib/src/android/webview_feature.g.dart +++ b/lib/src/android/webview_feature.g.dart @@ -205,6 +205,11 @@ class WebViewFeature { static const REQUESTED_WITH_HEADER_CONTROL = WebViewFeature._internal( 'REQUESTED_WITH_HEADER_CONTROL', 'REQUESTED_WITH_HEADER_CONTROL'); + ///This feature covers [InAppWebViewSettings.enterpriseAuthenticationAppLinkPolicyEnabled]. + static const ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY = + WebViewFeature._internal('ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY', + 'ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY'); + ///Set of all values of [WebViewFeature]. static final Set values = [ WebViewFeature.CREATE_WEB_MESSAGE_CHANNEL, @@ -252,6 +257,7 @@ class WebViewFeature { WebViewFeature.SUPPRESS_ERROR_PAGE, WebViewFeature.ALGORITHMIC_DARKENING, WebViewFeature.REQUESTED_WITH_HEADER_CONTROL, + WebViewFeature.ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY, ].toSet(); ///Gets a possible [WebViewFeature] instance from [String] value. @@ -515,6 +521,12 @@ class AndroidWebViewFeature { static const REQUESTED_WITH_HEADER_CONTROL = AndroidWebViewFeature._internal( 'REQUESTED_WITH_HEADER_CONTROL', 'REQUESTED_WITH_HEADER_CONTROL'); + ///This feature covers [InAppWebViewSettings.enterpriseAuthenticationAppLinkPolicyEnabled]. + static const ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY = + AndroidWebViewFeature._internal( + 'ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY', + 'ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY'); + ///Set of all values of [AndroidWebViewFeature]. static final Set values = [ AndroidWebViewFeature.CREATE_WEB_MESSAGE_CHANNEL, @@ -562,6 +574,7 @@ class AndroidWebViewFeature { AndroidWebViewFeature.SUPPRESS_ERROR_PAGE, AndroidWebViewFeature.ALGORITHMIC_DARKENING, AndroidWebViewFeature.REQUESTED_WITH_HEADER_CONTROL, + AndroidWebViewFeature.ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY, ].toSet(); ///Gets a possible [AndroidWebViewFeature] instance from [String] value. diff --git a/lib/src/in_app_webview/in_app_webview_settings.dart b/lib/src/in_app_webview/in_app_webview_settings.dart index a0c15603..8a696154 100755 --- a/lib/src/in_app_webview/in_app_webview_settings.dart +++ b/lib/src/in_app_webview/in_app_webview_settings.dart @@ -673,7 +673,10 @@ class InAppWebViewSettings { /// ///If Android is applying Force Dark to WebView then WebView will ignore the value of this setting and behave as if it were set to true. /// - ///**NOTE**: available on Android 29+ and only if [WebViewFeature.ALGORITHMIC_DARKENING] feature is supported. + ///**NOTE**: available on Android only if [WebViewFeature.ALGORITHMIC_DARKENING] feature is supported. + /// + ///**Supported Platforms/Implementations**: + ///- Android native WebView bool algorithmicDarkeningAllowed; ///Sets how the WebView will set the `X-Requested-With` header on requests. @@ -682,8 +685,26 @@ class InAppWebViewSettings { ///The default behavior may vary depending on the WebView implementation. /// ///**NOTE**: available on Android only if [WebViewFeature.REQUESTED_WITH_HEADER_CONTROL] feature is supported. + /// + ///**Supported Platforms/Implementations**: + ///- Android native WebView RequestedWithHeaderMode? requestedWithHeaderMode; + ///Sets whether EnterpriseAuthenticationAppLinkPolicy if set by admin is allowed to have any + ///effect on WebView. + /// + ///EnterpriseAuthenticationAppLinkPolicy in WebView allows admins to specify authentication + ///urls. When WebView is redirected to authentication url, and an app on the device has + ///registered as the default handler for the url, that app is launched. + /// + ///The default value is `true`. + /// + ///**NOTE**: available on Android only if [WebViewFeature.ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY] feature is supported. + /// + ///**Supported Platforms/Implementations**: + ///- Android native WebView + bool enterpriseAuthenticationAppLinkPolicyEnabled; + ///Set to `true` to disable the bouncing of the WebView when the scrolling has reached an edge of the content. The default value is `false`. /// ///**Supported Platforms/Implementations**: @@ -1161,6 +1182,7 @@ class InAppWebViewSettings { this.willSuppressErrorPage = false, this.algorithmicDarkeningAllowed = false, this.requestedWithHeaderMode, + this.enterpriseAuthenticationAppLinkPolicyEnabled = true, this.disallowOverScroll = false, this.enableViewportScale = false, this.suppressesIncrementalRendering = false, @@ -1310,6 +1332,7 @@ class InAppWebViewSettings { "willSuppressErrorPage": willSuppressErrorPage, "algorithmicDarkeningAllowed": algorithmicDarkeningAllowed, "requestedWithHeaderMode": requestedWithHeaderMode?.toNativeValue(), + "enterpriseAuthenticationAppLinkPolicyEnabled": enterpriseAuthenticationAppLinkPolicyEnabled, "disallowOverScroll": disallowOverScroll, "enableViewportScale": enableViewportScale, "suppressesIncrementalRendering": suppressesIncrementalRendering, @@ -1496,6 +1519,7 @@ class InAppWebViewSettings { settings.willSuppressErrorPage = map["willSuppressErrorPage"]; settings.algorithmicDarkeningAllowed = map["algorithmicDarkeningAllowed"]; settings.requestedWithHeaderMode = RequestedWithHeaderMode.fromNativeValue(map["requestedWithHeaderMode"]); + settings.enterpriseAuthenticationAppLinkPolicyEnabled = map["enterpriseAuthenticationAppLinkPolicyEnabled"]; } else if (defaultTargetPlatform == TargetPlatform.iOS || defaultTargetPlatform == TargetPlatform.macOS) {