added enterpriseAuthenticationAppLinkPolicyEnabled android webview setting

This commit is contained in:
Lorenzo Pichilli 2022-10-07 02:34:09 +02:00
parent b889efebf3
commit 6d2408de0e
6 changed files with 63 additions and 2 deletions

View File

@ -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

View File

@ -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<String, Map<String, Object>> 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;
}

View File

@ -117,6 +117,7 @@ public class InAppWebViewSettings implements ISettings<InAppWebViewInterface> {
public Boolean algorithmicDarkeningAllowed = false;
@Nullable
public Integer requestedWithHeaderMode;
public Boolean enterpriseAuthenticationAppLinkPolicyEnabled = true;
@NonNull
@Override
@ -384,6 +385,9 @@ public class InAppWebViewSettings implements ISettings<InAppWebViewInterface> {
case "requestedWithHeaderMode":
requestedWithHeaderMode = (Integer) value;
break;
case "enterpriseAuthenticationAppLinkPolicyEnabled":
enterpriseAuthenticationAppLinkPolicyEnabled = (Boolean) value;
break;
}
}
@ -479,6 +483,7 @@ public class InAppWebViewSettings implements ISettings<InAppWebViewInterface> {
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<InAppWebViewInterface> {
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;
}

View File

@ -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`.

View File

@ -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<WebViewFeature> 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<AndroidWebViewFeature> 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.

View File

@ -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) {