mirror of
https://github.com/status-im/react-native-webview.git
synced 2026-08-31 11:41:08 +00:00
feat(iOS & MacOS): allowUniversalAccessFromFileURLs property(#1730)
* Added allowUniversalAccessFromFileURLs property to iOS and macOS Updated the types to include allowUniversalAccessFromFileURLs and allowFileAccessFromFileURLs for iOS and macOS Updated the Reference.md to include in the allowUniversalAccessFromFileURLs section iOS and macOS * Updated platform in the type definition
This commit is contained in:
@@ -57,6 +57,7 @@
|
|||||||
@property (nonatomic, assign) BOOL javaScriptEnabled;
|
@property (nonatomic, assign) BOOL javaScriptEnabled;
|
||||||
@property (nonatomic, assign) BOOL javaScriptCanOpenWindowsAutomatically;
|
@property (nonatomic, assign) BOOL javaScriptCanOpenWindowsAutomatically;
|
||||||
@property (nonatomic, assign) BOOL allowFileAccessFromFileURLs;
|
@property (nonatomic, assign) BOOL allowFileAccessFromFileURLs;
|
||||||
|
@property (nonatomic, assign) BOOL allowUniversalAccessFromFileURLs;
|
||||||
@property (nonatomic, assign) BOOL allowsLinkPreview;
|
@property (nonatomic, assign) BOOL allowsLinkPreview;
|
||||||
@property (nonatomic, assign) BOOL showsHorizontalScrollIndicator;
|
@property (nonatomic, assign) BOOL showsHorizontalScrollIndicator;
|
||||||
@property (nonatomic, assign) BOOL showsVerticalScrollIndicator;
|
@property (nonatomic, assign) BOOL showsVerticalScrollIndicator;
|
||||||
|
|||||||
@@ -213,6 +213,9 @@ static NSDictionary* customCertificatesForHost;
|
|||||||
prefs.javaScriptEnabled = NO;
|
prefs.javaScriptEnabled = NO;
|
||||||
_prefsUsed = YES;
|
_prefsUsed = YES;
|
||||||
}
|
}
|
||||||
|
if (_allowUniversalAccessFromFileURLs) {
|
||||||
|
[wkWebViewConfig setValue:@TRUE forKey:@"allowUniversalAccessFromFileURLs"];
|
||||||
|
}
|
||||||
if (_allowFileAccessFromFileURLs) {
|
if (_allowFileAccessFromFileURLs) {
|
||||||
[prefs setValue:@TRUE forKey:@"allowFileAccessFromFileURLs"];
|
[prefs setValue:@TRUE forKey:@"allowFileAccessFromFileURLs"];
|
||||||
_prefsUsed = YES;
|
_prefsUsed = YES;
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ RCT_EXPORT_VIEW_PROPERTY(injectedJavaScriptBeforeContentLoadedForMainFrameOnly,
|
|||||||
RCT_EXPORT_VIEW_PROPERTY(javaScriptEnabled, BOOL)
|
RCT_EXPORT_VIEW_PROPERTY(javaScriptEnabled, BOOL)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(javaScriptCanOpenWindowsAutomatically, BOOL)
|
RCT_EXPORT_VIEW_PROPERTY(javaScriptCanOpenWindowsAutomatically, BOOL)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(allowFileAccessFromFileURLs, BOOL)
|
RCT_EXPORT_VIEW_PROPERTY(allowFileAccessFromFileURLs, BOOL)
|
||||||
|
RCT_EXPORT_VIEW_PROPERTY(allowUniversalAccessFromFileURLs, BOOL)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(allowsInlineMediaPlayback, BOOL)
|
RCT_EXPORT_VIEW_PROPERTY(allowsInlineMediaPlayback, BOOL)
|
||||||
RCT_EXPORT_VIEW_PROPERTY(mediaPlaybackRequiresUserAction, BOOL)
|
RCT_EXPORT_VIEW_PROPERTY(mediaPlaybackRequiresUserAction, BOOL)
|
||||||
#if WEBKIT_IOS_10_APIS_AVAILABLE
|
#if WEBKIT_IOS_10_APIS_AVAILABLE
|
||||||
|
|||||||
+3
-3
@@ -1092,9 +1092,9 @@ Boolean that sets whether JavaScript running in the context of a file scheme URL
|
|||||||
|
|
||||||
Boolean that sets whether JavaScript running in the context of a file scheme URL should be allowed to access content from any origin. Including accessing content from other file scheme URLs. The default value is `false`.
|
Boolean that sets whether JavaScript running in the context of a file scheme URL should be allowed to access content from any origin. Including accessing content from other file scheme URLs. The default value is `false`.
|
||||||
|
|
||||||
| Type | Required | Platform |
|
| Type | Required | Platform |
|
||||||
| ---- | -------- | -------- |
|
| ---- | -------- | -------------------- |
|
||||||
| bool | No | Android |
|
| bool | No | iOS, Android, macOS |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -313,6 +313,8 @@ export interface IOSNativeWebViewProps extends CommonNativeWebViewProps {
|
|||||||
allowsBackForwardNavigationGestures?: boolean;
|
allowsBackForwardNavigationGestures?: boolean;
|
||||||
allowsInlineMediaPlayback?: boolean;
|
allowsInlineMediaPlayback?: boolean;
|
||||||
allowsLinkPreview?: boolean;
|
allowsLinkPreview?: boolean;
|
||||||
|
allowFileAccessFromFileURLs?: boolean;
|
||||||
|
allowUniversalAccessFromFileURLs?: boolean;
|
||||||
automaticallyAdjustContentInsets?: boolean;
|
automaticallyAdjustContentInsets?: boolean;
|
||||||
autoManageStatusBarEnabled?: boolean;
|
autoManageStatusBarEnabled?: boolean;
|
||||||
bounces?: boolean;
|
bounces?: boolean;
|
||||||
@@ -334,6 +336,8 @@ export interface IOSNativeWebViewProps extends CommonNativeWebViewProps {
|
|||||||
|
|
||||||
export interface MacOSNativeWebViewProps extends CommonNativeWebViewProps {
|
export interface MacOSNativeWebViewProps extends CommonNativeWebViewProps {
|
||||||
allowingReadAccessToURL?: string;
|
allowingReadAccessToURL?: string;
|
||||||
|
allowFileAccessFromFileURLs?: boolean;
|
||||||
|
allowUniversalAccessFromFileURLs?: boolean;
|
||||||
allowsBackForwardNavigationGestures?: boolean;
|
allowsBackForwardNavigationGestures?: boolean;
|
||||||
allowsInlineMediaPlayback?: boolean;
|
allowsInlineMediaPlayback?: boolean;
|
||||||
allowsLinkPreview?: boolean;
|
allowsLinkPreview?: boolean;
|
||||||
@@ -548,6 +552,22 @@ export interface IOSWebViewProps extends WebViewSharedProps {
|
|||||||
*/
|
*/
|
||||||
allowingReadAccessToURL?: string;
|
allowingReadAccessToURL?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boolean that sets whether JavaScript running in the context of a file
|
||||||
|
* scheme URL should be allowed to access content from other file scheme URLs.
|
||||||
|
* Including accessing content from other file scheme URLs
|
||||||
|
* @platform ios
|
||||||
|
*/
|
||||||
|
allowFileAccessFromFileURLs?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boolean that sets whether JavaScript running in the context of a file
|
||||||
|
* scheme URL should be allowed to access content from any origin.
|
||||||
|
* Including accessing content from other file scheme URLs
|
||||||
|
* @platform ios
|
||||||
|
*/
|
||||||
|
allowUniversalAccessFromFileURLs?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function that is invoked when the WebKit WebView content process gets terminated.
|
* Function that is invoked when the WebKit WebView content process gets terminated.
|
||||||
* @platform ios
|
* @platform ios
|
||||||
@@ -726,6 +746,22 @@ export interface MacOSWebViewProps extends WebViewSharedProps {
|
|||||||
*/
|
*/
|
||||||
allowingReadAccessToURL?: string;
|
allowingReadAccessToURL?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boolean that sets whether JavaScript running in the context of a file
|
||||||
|
* scheme URL should be allowed to access content from other file scheme URLs.
|
||||||
|
* Including accessing content from other file scheme URLs
|
||||||
|
* @platform macos
|
||||||
|
*/
|
||||||
|
allowFileAccessFromFileURLs?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boolean that sets whether JavaScript running in the context of a file
|
||||||
|
* scheme URL should be allowed to access content from any origin.
|
||||||
|
* Including accessing content from other file scheme URLs
|
||||||
|
* @platform macos
|
||||||
|
*/
|
||||||
|
allowUniversalAccessFromFileURLs?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function that is invoked when the WebKit WebView content process gets terminated.
|
* Function that is invoked when the WebKit WebView content process gets terminated.
|
||||||
* @platform macos
|
* @platform macos
|
||||||
|
|||||||
Reference in New Issue
Block a user