react-native-webview-bootpay 11.6.51 → 11.18.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -93
- package/android/.DS_Store +0 -0
- package/android/build/.transforms/4e87ba7f47baac309fba5367e008cf44/results.bin +1 -0
- package/android/build/.transforms/4e87ba7f47baac309fba5367e008cf44/transformed/classes/classes.dex +0 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +3 -5
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +4 -2
- package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +2 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/R.txt +72 -8
- package/android/build/intermediates/compiled_local_resources/debug/out/xml_file_provider_paths.xml.flat +0 -0
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +1 -1
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +1 -1
- package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +1 -1
- package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +2 -2
- package/android/build/intermediates/incremental/packageDebugResources/merger.xml +1 -1
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebChromeClient.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebView.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewClient.class +0 -0
- package/android/build/intermediates/library_java_res/debug/res.jar +0 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +198 -200
- package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +100 -0
- package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +5 -3
- package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +66 -8
- package/android/build/kotlin/compileDebugKotlin/build-history.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/constants.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/constants.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/constants.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/constants.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/constants.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/{java-sources-proto-map.tab_i → subtypes.tab_i} +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/counters.tab +2 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/{jvm/kotlin/java-sources-proto-map.tab → lookups/id-to-file.tab.keystream} +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/last-build.bin +0 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +116 -128
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build/tmp/kotlin-classes/debug/META-INF/react-native-webview-bootpay_debug.kotlin_module +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/BPCWebViewPackage.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopMessageEvent$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopMessageEvent.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent.class +0 -0
- package/android/build.gradle +7 -9
- package/android/gradle.properties +2 -1
- package/android/src/.DS_Store +0 -0
- package/android/src/main/.DS_Store +0 -0
- package/android/src/main/java/.DS_Store +0 -0
- package/android/src/main/java/kr/.DS_Store +0 -0
- package/android/src/main/java/kr/co/.DS_Store +0 -0
- package/android/src/main/java/kr/co/bootpay/.DS_Store +0 -0
- package/android/src/main/java/kr/co/bootpay/webview/BPCWebChromeClient.java +2 -2
- package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewClient.java +20 -4
- package/apple/BPCWebView.h +19 -0
- package/apple/BPCWebView.m +284 -104
- package/apple/BPCWebViewManager.h +2 -0
- package/apple/BPCWebViewManager.m +25 -1
- package/index.d.ts +5 -5
- package/ios/.DS_Store +0 -0
- package/ios/RNCWebView.xcodeproj/project.pbxproj +18 -18
- package/ios/RNCWebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/RNCWebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/RNCWebView.xcodeproj/project.xcworkspace/xcuserdata/bootpay.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/RNCWebView.xcodeproj/xcuserdata/bootpay.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/lib/WebView.android.d.ts +3 -0
- package/lib/WebView.android.d.ts.map +1 -1
- package/lib/WebView.android.js +22 -11
- package/lib/WebView.d.ts +2 -2
- package/lib/WebView.d.ts.map +1 -1
- package/lib/WebView.ios.d.ts +1 -0
- package/lib/WebView.ios.d.ts.map +1 -1
- package/lib/WebView.ios.js +23 -14
- package/lib/WebView.js +4 -4
- package/lib/WebView.macos.d.ts.map +1 -1
- package/lib/WebView.macos.js +21 -13
- package/lib/WebView.windows.d.ts +4 -2
- package/lib/WebView.windows.d.ts.map +1 -1
- package/lib/WebView.windows.js +22 -14
- package/lib/WebViewNativeComponent.android.d.ts +4 -0
- package/lib/WebViewNativeComponent.android.d.ts.map +1 -0
- package/lib/WebViewNativeComponent.android.js +3 -0
- package/lib/WebViewNativeComponent.ios.d.ts +4 -0
- package/lib/WebViewNativeComponent.ios.d.ts.map +1 -0
- package/lib/WebViewNativeComponent.ios.js +3 -0
- package/lib/WebViewNativeComponent.macos.d.ts +4 -0
- package/lib/WebViewNativeComponent.macos.d.ts.map +1 -0
- package/lib/WebViewNativeComponent.macos.js +3 -0
- package/lib/WebViewNativeComponent.windows.d.ts +4 -0
- package/lib/WebViewNativeComponent.windows.d.ts.map +1 -0
- package/lib/WebViewNativeComponent.windows.js +3 -0
- package/lib/WebViewShared.d.ts +1 -0
- package/lib/WebViewShared.d.ts.map +1 -1
- package/lib/WebViewShared.js +14 -12
- package/lib/WebViewTypes.d.ts +113 -2
- package/lib/WebViewTypes.d.ts.map +1 -1
- package/lib/WebViewTypes.js +3 -1
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +3 -0
- package/package.json +25 -27
- package/react-native-webview-bootpay.podspec +1 -3
- package/react-native.config.js +47 -61
- package/windows/ExperimentalFeatures.props +12 -0
- package/windows/ReactNativeWebView/ReactNativeWebView.vcxproj +37 -20
- package/windows/ReactNativeWebView/ReactPackageProvider.cpp +5 -1
- package/windows/ReactNativeWebView/ReactWebView.cpp +2 -6
- package/windows/ReactNativeWebView/ReactWebView.h +3 -2
- package/windows/ReactNativeWebView/ReactWebView.idl +13 -1
- package/windows/ReactNativeWebView/ReactWebView2.cpp +119 -0
- package/windows/ReactNativeWebView/ReactWebView2.h +43 -0
- package/windows/ReactNativeWebView/ReactWebView2Manager.cpp +147 -0
- package/windows/ReactNativeWebView/ReactWebView2Manager.h +54 -0
- package/windows/ReactNativeWebView/ReactWebViewManager.cpp +36 -31
- package/windows/{WebViewBridgeComponent → ReactNativeWebView}/WebBridge.cpp +1 -1
- package/windows/{WebViewBridgeComponent → ReactNativeWebView}/WebBridge.h +2 -2
- package/windows/{WebViewBridgeComponent → ReactNativeWebView}/WebBridge.idl +1 -1
- package/windows/ReactNativeWebView/packages.config +2 -0
- package/windows/ReactNativeWebView/pch.h +6 -0
- package/windows/ReactNativeWebView.sln +81 -119
- package/android/build/tmp/kotlin-classes/debug/META-INF/rnWebView_debug.kotlin_module +0 -0
- package/windows/WebViewBridgeComponent/PropertySheet.props +0 -16
- package/windows/WebViewBridgeComponent/WebViewBridgeComponent.def +0 -3
- package/windows/WebViewBridgeComponent/WebViewBridgeComponent.vcxproj +0 -160
- package/windows/WebViewBridgeComponent/WebViewBridgeComponent.vcxproj.filters +0 -33
- package/windows/WebViewBridgeComponent/packages.config +0 -4
- package/windows/WebViewBridgeComponent/pch.cpp +0 -1
- package/windows/WebViewBridgeComponent/pch.h +0 -4
- package/windows/WebViewBridgeComponent/readme.txt +0 -23
package/apple/BPCWebView.h
CHANGED
|
@@ -9,6 +9,14 @@
|
|
|
9
9
|
#import <React/RCTDefines.h>
|
|
10
10
|
#import <WebKit/WebKit.h>
|
|
11
11
|
|
|
12
|
+
typedef enum BPCWebViewPermissionGrantType : NSUInteger {
|
|
13
|
+
BPCWebViewPermissionGrantType_GrantIfSameHost_ElsePrompt,
|
|
14
|
+
BPCWebViewPermissionGrantType_GrantIfSameHost_ElseDeny,
|
|
15
|
+
BPCWebViewPermissionGrantType_Deny,
|
|
16
|
+
BPCWebViewPermissionGrantType_Grant,
|
|
17
|
+
BPCWebViewPermissionGrantType_Prompt
|
|
18
|
+
} BPCWebViewPermissionGrantType;
|
|
19
|
+
|
|
12
20
|
@class BPCWebView;
|
|
13
21
|
|
|
14
22
|
@protocol BPCWebViewDelegate <NSObject>
|
|
@@ -67,8 +75,11 @@
|
|
|
67
75
|
@property (nonatomic, assign) BOOL directionalLockEnabled;
|
|
68
76
|
@property (nonatomic, assign) BOOL ignoreSilentHardwareSwitch;
|
|
69
77
|
@property (nonatomic, copy) NSString * _Nullable allowingReadAccessToURL;
|
|
78
|
+
@property (nonatomic, copy) NSDictionary * _Nullable basicAuthCredential;
|
|
70
79
|
@property (nonatomic, assign) BOOL pullToRefreshEnabled;
|
|
71
80
|
@property (nonatomic, assign) BOOL enableApplePay;
|
|
81
|
+
@property (nonatomic, copy) NSArray<NSDictionary *> * _Nullable menuItems;
|
|
82
|
+
@property (nonatomic, copy) RCTDirectEventBlock onCustomMenuSelection;
|
|
72
83
|
#if !TARGET_OS_OSX
|
|
73
84
|
@property (nonatomic, weak) UIRefreshControl * _Nullable refreshControl;
|
|
74
85
|
#endif
|
|
@@ -81,6 +92,14 @@
|
|
|
81
92
|
@property (nonatomic, assign) BOOL limitsNavigationsToAppBoundDomains;
|
|
82
93
|
#endif
|
|
83
94
|
|
|
95
|
+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140500 /* iOS 14.5 */
|
|
96
|
+
@property (nonatomic, assign) BOOL textInteractionEnabled;
|
|
97
|
+
#endif
|
|
98
|
+
|
|
99
|
+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000 /* iOS 15 */
|
|
100
|
+
@property (nonatomic, assign) BPCWebViewPermissionGrantType mediaCapturePermissionGrantType;
|
|
101
|
+
#endif
|
|
102
|
+
|
|
84
103
|
+ (void)setClientAuthenticationCredential:(nullable NSURLCredential*)credential;
|
|
85
104
|
+ (void)setCustomCertificatesForHost:(nullable NSDictionary *)certificates;
|
|
86
105
|
- (void)postMessage:(NSString *_Nullable)message;
|
package/apple/BPCWebView.m
CHANGED
|
@@ -18,11 +18,13 @@
|
|
|
18
18
|
#import "objc/runtime.h"
|
|
19
19
|
|
|
20
20
|
static NSTimer *keyboardTimer;
|
|
21
|
-
static NSString *const HistoryShimName = @"
|
|
22
|
-
static NSString *const MessageHandlerName = @"
|
|
21
|
+
static NSString *const HistoryShimName = @"ReactNativeHistoryShim";
|
|
22
|
+
static NSString *const MessageHandlerName = @"ReactNativeWebView";
|
|
23
23
|
static NSURLCredential* clientAuthenticationCredential;
|
|
24
24
|
static NSDictionary* customCertificatesForHost;
|
|
25
25
|
|
|
26
|
+
NSString *const CUSTOM_SELECTOR = @"_CUSTOM_SELECTOR_";
|
|
27
|
+
|
|
26
28
|
#if !TARGET_OS_OSX
|
|
27
29
|
// runtime trick to remove WKWebView keyboard default toolbar
|
|
28
30
|
// see: http://stackoverflow.com/questions/19033292/ios-7-uiwebview-keyboard-issue/19042279#19042279
|
|
@@ -51,9 +53,9 @@ static NSDictionary* customCertificatesForHost;
|
|
|
51
53
|
@end
|
|
52
54
|
@implementation BPCWKWebView
|
|
53
55
|
- (void)scrollWheel:(NSEvent *)theEvent {
|
|
54
|
-
BPCWebView *
|
|
55
|
-
RCTAssert([
|
|
56
|
-
if (![
|
|
56
|
+
BPCWebView *BPCWebView = (BPCWebView *)[self superview];
|
|
57
|
+
RCTAssert([BPCWebView isKindOfClass:[BPCWebView class]], @"superview must be an BPCWebView");
|
|
58
|
+
if (![BPCWebView scrollEnabled]) {
|
|
57
59
|
[[self nextResponder] scrollWheel:theEvent];
|
|
58
60
|
return;
|
|
59
61
|
}
|
|
@@ -147,6 +149,9 @@ static NSDictionary* customCertificatesForHost;
|
|
|
147
149
|
_savedAutomaticallyAdjustsScrollIndicatorInsets = NO;
|
|
148
150
|
#endif
|
|
149
151
|
_enableApplePay = NO;
|
|
152
|
+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000 /* iOS 15 */
|
|
153
|
+
_mediaCapturePermissionGrantType = BPCWebViewPermissionGrantType_Prompt;
|
|
154
|
+
#endif
|
|
150
155
|
}
|
|
151
156
|
|
|
152
157
|
#if !TARGET_OS_OSX
|
|
@@ -188,45 +193,126 @@ static NSDictionary* customCertificatesForHost;
|
|
|
188
193
|
return self;
|
|
189
194
|
}
|
|
190
195
|
|
|
196
|
+
#if !TARGET_OS_OSX
|
|
197
|
+
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
|
|
198
|
+
// Only allow long press gesture
|
|
199
|
+
if ([otherGestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]]) {
|
|
200
|
+
return YES;
|
|
201
|
+
}else{
|
|
202
|
+
return NO;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Listener for long presses
|
|
207
|
+
- (void)startLongPress:(UILongPressGestureRecognizer *)pressSender
|
|
208
|
+
{
|
|
209
|
+
// When a long press ends, bring up our custom UIMenu
|
|
210
|
+
if(pressSender.state == UIGestureRecognizerStateEnded) {
|
|
211
|
+
if (!self.menuItems || self.menuItems.count == 0) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
UIMenuController *menuController = [UIMenuController sharedMenuController];
|
|
215
|
+
NSMutableArray *menuControllerItems = [NSMutableArray arrayWithCapacity:self.menuItems.count];
|
|
216
|
+
|
|
217
|
+
for(NSDictionary *menuItem in self.menuItems) {
|
|
218
|
+
NSString *menuItemLabel = [RCTConvert NSString:menuItem[@"label"]];
|
|
219
|
+
NSString *menuItemKey = [RCTConvert NSString:menuItem[@"key"]];
|
|
220
|
+
NSString *sel = [NSString stringWithFormat:@"%@%@", CUSTOM_SELECTOR, menuItemKey];
|
|
221
|
+
UIMenuItem *item = [[UIMenuItem alloc] initWithTitle: menuItemLabel
|
|
222
|
+
action: NSSelectorFromString(sel)];
|
|
223
|
+
|
|
224
|
+
[menuControllerItems addObject: item];
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
menuController.menuItems = menuControllerItems;
|
|
228
|
+
[menuController setMenuVisible:YES animated:YES];
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
#endif // !TARGET_OS_OSX
|
|
233
|
+
|
|
191
234
|
- (void)dealloc
|
|
192
235
|
{
|
|
193
236
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
194
237
|
}
|
|
195
238
|
|
|
196
|
-
|
|
197
|
-
* See https://stackoverflow.com/questions/25713069/why-is-wkwebview-not-opening-links-with-target-blank/25853806#25853806 for details.
|
|
198
|
-
*/
|
|
199
|
-
- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures
|
|
239
|
+
- (void)tappedMenuItem:(NSString *)eventType
|
|
200
240
|
{
|
|
201
|
-
|
|
202
|
-
|
|
241
|
+
// Get the selected text
|
|
242
|
+
// NOTE: selecting text in an iframe or shadow DOM will not work
|
|
243
|
+
[self.webView evaluateJavaScript: @"window.getSelection().toString()" completionHandler: ^(id result, NSError *error) {
|
|
244
|
+
if (error != nil) {
|
|
245
|
+
RCTLogWarn(@"%@", [NSString stringWithFormat:@"Error evaluating injectedJavaScript: This is possibly due to an unsupported return type. Try adding true to the end of your injectedJavaScript string. %@", error]);
|
|
246
|
+
} else {
|
|
247
|
+
if (self.onCustomMenuSelection) {
|
|
248
|
+
NSPredicate *filter = [NSPredicate predicateWithFormat:@"key contains[c] %@ ",eventType];
|
|
249
|
+
NSArray *filteredMenuItems = [self.menuItems filteredArrayUsingPredicate:filter];
|
|
250
|
+
NSDictionary *selectedMenuItem = filteredMenuItems[0];
|
|
251
|
+
NSString *label = [RCTConvert NSString:selectedMenuItem[@"label"]];
|
|
252
|
+
self.onCustomMenuSelection(@{
|
|
253
|
+
@"key": eventType,
|
|
254
|
+
@"label": label,
|
|
255
|
+
@"selectedText": result
|
|
256
|
+
});
|
|
257
|
+
} else {
|
|
258
|
+
RCTLogWarn(@"Error evaluating onCustomMenuSelection: You must implement an `onCustomMenuSelection` callback when using custom menu items");
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}];
|
|
262
|
+
}
|
|
203
263
|
|
|
204
|
-
|
|
205
|
-
|
|
264
|
+
// Overwrite method that interprets which action to call upon UIMenu Selection
|
|
265
|
+
// https://developer.apple.com/documentation/objectivec/nsobject/1571960-methodsignatureforselector
|
|
266
|
+
- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel
|
|
267
|
+
{
|
|
268
|
+
NSMethodSignature *existingSelector = [super methodSignatureForSelector:sel];
|
|
269
|
+
if (existingSelector) {
|
|
270
|
+
return existingSelector;
|
|
271
|
+
}
|
|
272
|
+
return [super methodSignatureForSelector:@selector(tappedMenuItem:)];
|
|
273
|
+
}
|
|
206
274
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
275
|
+
// Needed to forward messages to other objects
|
|
276
|
+
// https://developer.apple.com/documentation/objectivec/nsobject/1571955-forwardinvocation
|
|
277
|
+
- (void)forwardInvocation:(NSInvocation *)invocation
|
|
278
|
+
{
|
|
279
|
+
NSString *sel = NSStringFromSelector([invocation selector]);
|
|
280
|
+
NSRange match = [sel rangeOfString:CUSTOM_SELECTOR];
|
|
281
|
+
if (match.location == 0) {
|
|
282
|
+
[self tappedMenuItem:[sel substringFromIndex:17]];
|
|
212
283
|
} else {
|
|
284
|
+
[super forwardInvocation:invocation];
|
|
285
|
+
}
|
|
286
|
+
}
|
|
213
287
|
|
|
214
|
-
|
|
288
|
+
// Allows the instance to respond to UIMenuController Actions
|
|
289
|
+
- (BOOL)canBecomeFirstResponder
|
|
290
|
+
{
|
|
291
|
+
return YES;
|
|
292
|
+
}
|
|
215
293
|
|
|
216
|
-
|
|
294
|
+
// Control which items show up on the UIMenuController
|
|
295
|
+
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
|
|
296
|
+
{
|
|
297
|
+
NSString *sel = NSStringFromSelector(action);
|
|
298
|
+
// Do any of them have our custom keys?
|
|
299
|
+
NSRange match = [sel rangeOfString:CUSTOM_SELECTOR];
|
|
217
300
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
return popupView;
|
|
224
|
-
}
|
|
301
|
+
if (match.location == 0) {
|
|
302
|
+
return YES;
|
|
303
|
+
}
|
|
304
|
+
return NO;
|
|
225
305
|
}
|
|
226
306
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
307
|
+
/**
|
|
308
|
+
* See https://stackoverflow.com/questions/25713069/why-is-wkwebview-not-opening-links-with-target-blank/25853806#25853806 for details.
|
|
309
|
+
*/
|
|
310
|
+
- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures
|
|
311
|
+
{
|
|
312
|
+
if (!navigationAction.targetFrame.isMainFrame) {
|
|
313
|
+
[webView loadRequest:navigationAction.request];
|
|
314
|
+
}
|
|
315
|
+
return nil;
|
|
230
316
|
}
|
|
231
317
|
|
|
232
318
|
- (WKWebViewConfiguration *)setUpWkWebViewConfig
|
|
@@ -249,6 +335,14 @@ static NSDictionary* customCertificatesForHost;
|
|
|
249
335
|
[prefs setValue:@TRUE forKey:@"javaScriptCanOpenWindowsAutomatically"];
|
|
250
336
|
_prefsUsed = YES;
|
|
251
337
|
}
|
|
338
|
+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140500 /* iOS 14.5 */
|
|
339
|
+
if (@available(iOS 14.5, *)) {
|
|
340
|
+
if (!_textInteractionEnabled) {
|
|
341
|
+
[prefs setValue:@FALSE forKey:@"textInteractionEnabled"];
|
|
342
|
+
_prefsUsed = YES;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
#endif
|
|
252
346
|
if (_prefsUsed) {
|
|
253
347
|
wkWebViewConfig.preferences = prefs;
|
|
254
348
|
}
|
|
@@ -336,9 +430,7 @@ static NSDictionary* customCertificatesForHost;
|
|
|
336
430
|
[_webView addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:nil];
|
|
337
431
|
_webView.allowsBackForwardNavigationGestures = _allowsBackForwardNavigationGestures;
|
|
338
432
|
|
|
339
|
-
|
|
340
|
-
_webView.customUserAgent = _userAgent;
|
|
341
|
-
}
|
|
433
|
+
_webView.customUserAgent = _userAgent;
|
|
342
434
|
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
|
|
343
435
|
if ([_webView.scrollView respondsToSelector:@selector(setContentInsetAdjustmentBehavior:)]) {
|
|
344
436
|
_webView.scrollView.contentInsetAdjustmentBehavior = _savedContentInsetAdjustmentBehavior;
|
|
@@ -355,6 +447,18 @@ static NSDictionary* customCertificatesForHost;
|
|
|
355
447
|
[self setKeyboardDisplayRequiresUserAction: _savedKeyboardDisplayRequiresUserAction];
|
|
356
448
|
[self visitSource];
|
|
357
449
|
}
|
|
450
|
+
#if !TARGET_OS_OSX
|
|
451
|
+
// Allow this object to recognize gestures
|
|
452
|
+
if (self.menuItems != nil) {
|
|
453
|
+
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(startLongPress:)];
|
|
454
|
+
longPress.delegate = self;
|
|
455
|
+
|
|
456
|
+
longPress.minimumPressDuration = 0.4f;
|
|
457
|
+
longPress.numberOfTouchesRequired = 1;
|
|
458
|
+
longPress.cancelsTouchesInView = YES;
|
|
459
|
+
[self addGestureRecognizer:longPress];
|
|
460
|
+
}
|
|
461
|
+
#endif // !TARGET_OS_OSX
|
|
358
462
|
}
|
|
359
463
|
|
|
360
464
|
// Update webview property when the component prop changes.
|
|
@@ -579,38 +683,39 @@ static NSDictionary* customCertificatesForHost;
|
|
|
579
683
|
}
|
|
580
684
|
[_webView loadHTMLString:html baseURL:baseURL];
|
|
581
685
|
return;
|
|
582
|
-
}
|
|
583
|
-
//Add cookie for subsequent resource requests sent by page itself, if cookie was set in headers on WebView
|
|
584
|
-
NSString *headerCookie = [RCTConvert NSString:_source[@"headers"][@"cookie"]];
|
|
686
|
+
}
|
|
687
|
+
// Add cookie for subsequent resource requests sent by page itself, if cookie was set in headers on WebView
|
|
688
|
+
NSString *headerCookie = [RCTConvert NSString:_source[@"headers"][@"cookie"]];
|
|
585
689
|
if(headerCookie) {
|
|
586
690
|
NSDictionary *headers = [NSDictionary dictionaryWithObjectsAndKeys:headerCookie,@"Set-Cookie",nil];
|
|
587
691
|
NSURL *urlString = [NSURL URLWithString:_source[@"uri"]];
|
|
588
692
|
NSArray *httpCookies = [NSHTTPCookie cookiesWithResponseHeaderFields:headers forURL:urlString];
|
|
589
|
-
|
|
590
|
-
[_webView.configuration.websiteDataStore.httpCookieStore setCookie:httpCookie completionHandler:nil];
|
|
591
|
-
}
|
|
693
|
+
[self writeCookiesToWebView:httpCookies completion:nil];
|
|
592
694
|
}
|
|
593
695
|
|
|
594
696
|
NSURLRequest *request = [self requestForSource:_source];
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
697
|
+
|
|
698
|
+
[self syncCookiesToWebView:^{
|
|
699
|
+
// Because of the way React works, as pages redirect, we actually end up
|
|
700
|
+
// passing the redirect urls back here, so we ignore them if trying to load
|
|
701
|
+
// the same url. We'll expose a call to 'reload' to allow a user to load
|
|
702
|
+
// the existing page.
|
|
703
|
+
if ([request.URL isEqual:_webView.URL]) {
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
if (!request.URL) {
|
|
707
|
+
// Clear the webview
|
|
708
|
+
[_webView loadHTMLString:@"" baseURL:nil];
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
711
|
+
if (request.URL.host) {
|
|
712
|
+
[_webView loadRequest:request];
|
|
713
|
+
}
|
|
714
|
+
else {
|
|
715
|
+
NSURL* readAccessUrl = _allowingReadAccessToURL ? [RCTConvert NSURL:_allowingReadAccessToURL] : request.URL;
|
|
716
|
+
[_webView loadFileURL:request.URL allowingReadAccessToURL:readAccessUrl];
|
|
717
|
+
}
|
|
718
|
+
}];
|
|
614
719
|
}
|
|
615
720
|
|
|
616
721
|
#if !TARGET_OS_OSX
|
|
@@ -726,6 +831,12 @@ static NSDictionary* customCertificatesForHost;
|
|
|
726
831
|
}
|
|
727
832
|
#endif // !TARGET_OS_OSX
|
|
728
833
|
|
|
834
|
+
- (void)setUserAgent:(NSString*)userAgent
|
|
835
|
+
{
|
|
836
|
+
_userAgent = userAgent;
|
|
837
|
+
_webView.customUserAgent = userAgent;
|
|
838
|
+
}
|
|
839
|
+
|
|
729
840
|
- (void)setScrollEnabled:(BOOL)scrollEnabled
|
|
730
841
|
{
|
|
731
842
|
_scrollEnabled = scrollEnabled;
|
|
@@ -861,6 +972,15 @@ static NSDictionary* customCertificatesForHost;
|
|
|
861
972
|
}
|
|
862
973
|
}
|
|
863
974
|
}
|
|
975
|
+
if ([[challenge protectionSpace] authenticationMethod] == NSURLAuthenticationMethodHTTPBasic) {
|
|
976
|
+
NSString *username = [_basicAuthCredential valueForKey:@"username"];
|
|
977
|
+
NSString *password = [_basicAuthCredential valueForKey:@"password"];
|
|
978
|
+
if (username && password) {
|
|
979
|
+
NSURLCredential *credential = [NSURLCredential credentialWithUser:username password:password persistence:NSURLCredentialPersistenceNone];
|
|
980
|
+
completionHandler(NSURLSessionAuthChallengeUseCredential, credential);
|
|
981
|
+
return;
|
|
982
|
+
}
|
|
983
|
+
}
|
|
864
984
|
completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
|
|
865
985
|
}
|
|
866
986
|
|
|
@@ -955,6 +1075,32 @@ static NSDictionary* customCertificatesForHost;
|
|
|
955
1075
|
#endif // !TARGET_OS_OSX
|
|
956
1076
|
}
|
|
957
1077
|
|
|
1078
|
+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000 /* iOS 15 */
|
|
1079
|
+
/**
|
|
1080
|
+
* Media capture permissions (prevent multiple prompts)
|
|
1081
|
+
*/
|
|
1082
|
+
- (void) webView:(WKWebView *)webView
|
|
1083
|
+
requestMediaCapturePermissionForOrigin:(WKSecurityOrigin *)origin
|
|
1084
|
+
initiatedByFrame:(WKFrameInfo *)frame
|
|
1085
|
+
type:(WKMediaCaptureType)type
|
|
1086
|
+
decisionHandler:(void (^)(WKPermissionDecision decision))decisionHandler {
|
|
1087
|
+
if (_mediaCapturePermissionGrantType == BPCWebViewPermissionGrantType_GrantIfSameHost_ElsePrompt || _mediaCapturePermissionGrantType == BPCWebViewPermissionGrantType_GrantIfSameHost_ElseDeny) {
|
|
1088
|
+
if ([origin.host isEqualToString:webView.URL.host]) {
|
|
1089
|
+
decisionHandler(WKPermissionDecisionGrant);
|
|
1090
|
+
} else {
|
|
1091
|
+
WKPermissionDecision decision = _mediaCapturePermissionGrantType == BPCWebViewPermissionGrantType_GrantIfSameHost_ElsePrompt ? WKPermissionDecisionPrompt : WKPermissionDecisionDeny;
|
|
1092
|
+
decisionHandler(decision);
|
|
1093
|
+
}
|
|
1094
|
+
} else if (_mediaCapturePermissionGrantType == BPCWebViewPermissionGrantType_Deny) {
|
|
1095
|
+
decisionHandler(WKPermissionDecisionDeny);
|
|
1096
|
+
} else if (_mediaCapturePermissionGrantType == BPCWebViewPermissionGrantType_Grant) {
|
|
1097
|
+
decisionHandler(WKPermissionDecisionGrant);
|
|
1098
|
+
} else {
|
|
1099
|
+
decisionHandler(WKPermissionDecisionPrompt);
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
#endif
|
|
1103
|
+
|
|
958
1104
|
#if !TARGET_OS_OSX
|
|
959
1105
|
/**
|
|
960
1106
|
* topViewController
|
|
@@ -1055,58 +1201,59 @@ static NSDictionary* customCertificatesForHost;
|
|
|
1055
1201
|
}
|
|
1056
1202
|
|
|
1057
1203
|
|
|
1058
|
-
|
|
1204
|
+
|
|
1205
|
+
- (void) navigationOriginRN:(WKWebView *)webView
|
|
1059
1206
|
decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction
|
|
1060
1207
|
decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
|
|
1061
1208
|
{
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1209
|
+
static NSDictionary<NSNumber *, NSString *> *navigationTypes;
|
|
1210
|
+
static dispatch_once_t onceToken;
|
|
1211
|
+
|
|
1212
|
+
dispatch_once(&onceToken, ^{
|
|
1213
|
+
navigationTypes = @{
|
|
1214
|
+
@(WKNavigationTypeLinkActivated): @"click",
|
|
1215
|
+
@(WKNavigationTypeFormSubmitted): @"formsubmit",
|
|
1216
|
+
@(WKNavigationTypeBackForward): @"backforward",
|
|
1217
|
+
@(WKNavigationTypeReload): @"reload",
|
|
1218
|
+
@(WKNavigationTypeFormResubmitted): @"formresubmit",
|
|
1219
|
+
@(WKNavigationTypeOther): @"other",
|
|
1220
|
+
};
|
|
1221
|
+
});
|
|
1222
|
+
|
|
1223
|
+
WKNavigationType navigationType = navigationAction.navigationType;
|
|
1224
|
+
NSURLRequest *request = navigationAction.request;
|
|
1225
|
+
BOOL isTopFrame = [request.URL isEqual:request.mainDocumentURL];
|
|
1226
|
+
|
|
1227
|
+
if (_onShouldStartLoadWithRequest) {
|
|
1228
|
+
NSMutableDictionary<NSString *, id> *event = [self baseEvent];
|
|
1229
|
+
[event addEntriesFromDictionary: @{
|
|
1230
|
+
@"url": (request.URL).absoluteString,
|
|
1231
|
+
@"mainDocumentURL": (request.mainDocumentURL).absoluteString,
|
|
1232
|
+
@"navigationType": navigationTypes[@(navigationType)],
|
|
1233
|
+
@"isTopFrame": @(isTopFrame)
|
|
1234
|
+
}];
|
|
1235
|
+
if (![self.delegate webView:self
|
|
1236
|
+
shouldStartLoadForRequest:event
|
|
1237
|
+
withCallback:_onShouldStartLoadWithRequest]) {
|
|
1238
|
+
decisionHandler(WKNavigationActionPolicyCancel);
|
|
1239
|
+
return;
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1079
1242
|
|
|
1080
|
-
|
|
1243
|
+
if (_onLoadingStart) {
|
|
1244
|
+
// We have this check to filter out iframe requests and whatnot
|
|
1245
|
+
if (isTopFrame) {
|
|
1081
1246
|
NSMutableDictionary<NSString *, id> *event = [self baseEvent];
|
|
1082
1247
|
[event addEntriesFromDictionary: @{
|
|
1083
1248
|
@"url": (request.URL).absoluteString,
|
|
1084
|
-
@"
|
|
1085
|
-
@"navigationType": navigationTypes[@(navigationType)],
|
|
1086
|
-
@"isTopFrame": @(isTopFrame)
|
|
1249
|
+
@"navigationType": navigationTypes[@(navigationType)]
|
|
1087
1250
|
}];
|
|
1088
|
-
|
|
1089
|
-
shouldStartLoadForRequest:event
|
|
1090
|
-
withCallback:_onShouldStartLoadWithRequest]) {
|
|
1091
|
-
decisionHandler(WKNavigationActionPolicyCancel);
|
|
1092
|
-
return;
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
if (_onLoadingStart) {
|
|
1097
|
-
// We have this check to filter out iframe requests and whatnot
|
|
1098
|
-
if (isTopFrame) {
|
|
1099
|
-
NSMutableDictionary<NSString *, id> *event = [self baseEvent];
|
|
1100
|
-
[event addEntriesFromDictionary: @{
|
|
1101
|
-
@"url": (request.URL).absoluteString,
|
|
1102
|
-
@"navigationType": navigationTypes[@(navigationType)]
|
|
1103
|
-
}];
|
|
1104
|
-
_onLoadingStart(event);
|
|
1105
|
-
}
|
|
1251
|
+
_onLoadingStart(event);
|
|
1106
1252
|
}
|
|
1253
|
+
}
|
|
1107
1254
|
|
|
1108
|
-
|
|
1109
|
-
|
|
1255
|
+
// Allow all navigation by default
|
|
1256
|
+
decisionHandler(WKNavigationActionPolicyAllow);
|
|
1110
1257
|
}
|
|
1111
1258
|
|
|
1112
1259
|
/**
|
|
@@ -1259,6 +1406,15 @@ static NSDictionary* customCertificatesForHost;
|
|
|
1259
1406
|
- (void)webView:(WKWebView *)webView
|
|
1260
1407
|
didFinishNavigation:(WKNavigation *)navigation
|
|
1261
1408
|
{
|
|
1409
|
+
if(_sharedCookiesEnabled && @available(iOS 11.0, *)) {
|
|
1410
|
+
// Write all cookies from WKWebView back to sharedHTTPCookieStorage
|
|
1411
|
+
[webView.configuration.websiteDataStore.httpCookieStore getAllCookies:^(NSArray* cookies) {
|
|
1412
|
+
for (NSHTTPCookie *cookie in cookies) {
|
|
1413
|
+
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:cookie];
|
|
1414
|
+
}
|
|
1415
|
+
}];
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1262
1418
|
if (_ignoreSilentHardwareSwitch) {
|
|
1263
1419
|
[self forceIgnoreSilentHardwareSwitch:true];
|
|
1264
1420
|
}
|
|
@@ -1292,7 +1448,6 @@ static NSDictionary* customCertificatesForHost;
|
|
|
1292
1448
|
*/
|
|
1293
1449
|
NSURLRequest *request = [self requestForSource:self.source];
|
|
1294
1450
|
|
|
1295
|
-
|
|
1296
1451
|
if (request.URL && !_webView.URL.absoluteString.length) {
|
|
1297
1452
|
[_webView loadRequest:request];
|
|
1298
1453
|
} else {
|
|
@@ -1405,6 +1560,33 @@ static NSDictionary* customCertificatesForHost;
|
|
|
1405
1560
|
}
|
|
1406
1561
|
}
|
|
1407
1562
|
|
|
1563
|
+
- (void)writeCookiesToWebView:(NSArray<NSHTTPCookie *>*)cookies completion:(void (^)(void))completion {
|
|
1564
|
+
// The required cookie APIs only became available on iOS 11
|
|
1565
|
+
if(_sharedCookiesEnabled && @available(iOS 11.0, *)) {
|
|
1566
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
1567
|
+
dispatch_group_t group = dispatch_group_create();
|
|
1568
|
+
for (NSHTTPCookie *cookie in cookies) {
|
|
1569
|
+
dispatch_group_enter(group);
|
|
1570
|
+
[_webView.configuration.websiteDataStore.httpCookieStore setCookie:cookie completionHandler:^{
|
|
1571
|
+
dispatch_group_leave(group);
|
|
1572
|
+
}];
|
|
1573
|
+
}
|
|
1574
|
+
dispatch_group_notify(group, dispatch_get_main_queue(), ^{
|
|
1575
|
+
if (completion) {
|
|
1576
|
+
completion();
|
|
1577
|
+
}
|
|
1578
|
+
});
|
|
1579
|
+
});
|
|
1580
|
+
} else if (completion) {
|
|
1581
|
+
completion();
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
- (void)syncCookiesToWebView:(void (^)(void))completion {
|
|
1586
|
+
NSArray<NSHTTPCookie *> *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies];
|
|
1587
|
+
[self writeCookiesToWebView:cookies completion:completion];
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1408
1590
|
- (void)resetupScripts:(WKWebViewConfiguration *)wkWebViewConfig {
|
|
1409
1591
|
[wkWebViewConfig.userContentController removeAllUserScripts];
|
|
1410
1592
|
[wkWebViewConfig.userContentController removeScriptMessageHandlerForName:MessageHandlerName];
|
|
@@ -1449,9 +1631,7 @@ static NSDictionary* customCertificatesForHost;
|
|
|
1449
1631
|
if(!_incognito && !_cacheEnabled) {
|
|
1450
1632
|
wkWebViewConfig.websiteDataStore = [WKWebsiteDataStore nonPersistentDataStore];
|
|
1451
1633
|
}
|
|
1452
|
-
|
|
1453
|
-
[wkWebViewConfig.websiteDataStore.httpCookieStore setCookie:cookie completionHandler:nil];
|
|
1454
|
-
}
|
|
1634
|
+
[self syncCookiesToWebView:nil];
|
|
1455
1635
|
} else {
|
|
1456
1636
|
NSMutableString *script = [NSMutableString string];
|
|
1457
1637
|
|
|
@@ -22,6 +22,16 @@ RCT_ENUM_CONVERTER(WKContentMode, (@{
|
|
|
22
22
|
@"desktop": @(WKContentModeDesktop),
|
|
23
23
|
}), WKContentModeRecommended, integerValue)
|
|
24
24
|
#endif
|
|
25
|
+
|
|
26
|
+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000 /* iOS 15 */
|
|
27
|
+
RCT_ENUM_CONVERTER(BPCWebViewPermissionGrantType, (@{
|
|
28
|
+
@"grantIfSameHostElsePrompt": @(BPCWebViewPermissionGrantType_GrantIfSameHost_ElsePrompt),
|
|
29
|
+
@"grantIfSameHostElseDeny": @(BPCWebViewPermissionGrantType_GrantIfSameHost_ElseDeny),
|
|
30
|
+
@"deny": @(BPCWebViewPermissionGrantType_Deny),
|
|
31
|
+
@"grant": @(BPCWebViewPermissionGrantType_Grant),
|
|
32
|
+
@"prompt": @(BPCWebViewPermissionGrantType_Prompt),
|
|
33
|
+
}), BPCWebViewPermissionGrantType_Prompt, integerValue)
|
|
34
|
+
#endif
|
|
25
35
|
@end
|
|
26
36
|
|
|
27
37
|
@implementation BPCWebViewManager
|
|
@@ -72,11 +82,11 @@ RCT_EXPORT_VIEW_PROPERTY(hideKeyboardAccessoryView, BOOL)
|
|
|
72
82
|
RCT_EXPORT_VIEW_PROPERTY(allowsBackForwardNavigationGestures, BOOL)
|
|
73
83
|
RCT_EXPORT_VIEW_PROPERTY(incognito, BOOL)
|
|
74
84
|
RCT_EXPORT_VIEW_PROPERTY(pagingEnabled, BOOL)
|
|
75
|
-
RCT_EXPORT_VIEW_PROPERTY(userAgent, NSString)
|
|
76
85
|
RCT_EXPORT_VIEW_PROPERTY(applicationNameForUserAgent, NSString)
|
|
77
86
|
RCT_EXPORT_VIEW_PROPERTY(cacheEnabled, BOOL)
|
|
78
87
|
RCT_EXPORT_VIEW_PROPERTY(allowsLinkPreview, BOOL)
|
|
79
88
|
RCT_EXPORT_VIEW_PROPERTY(allowingReadAccessToURL, NSString)
|
|
89
|
+
RCT_EXPORT_VIEW_PROPERTY(basicAuthCredential, NSDictionary)
|
|
80
90
|
|
|
81
91
|
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
|
|
82
92
|
RCT_EXPORT_VIEW_PROPERTY(contentInsetAdjustmentBehavior, UIScrollViewContentInsetAdjustmentBehavior)
|
|
@@ -93,6 +103,14 @@ RCT_EXPORT_VIEW_PROPERTY(contentMode, WKContentMode)
|
|
|
93
103
|
RCT_EXPORT_VIEW_PROPERTY(limitsNavigationsToAppBoundDomains, BOOL)
|
|
94
104
|
#endif
|
|
95
105
|
|
|
106
|
+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140500 /* iOS 14.5 */
|
|
107
|
+
RCT_EXPORT_VIEW_PROPERTY(textInteractionEnabled, BOOL)
|
|
108
|
+
#endif
|
|
109
|
+
|
|
110
|
+
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000 /* iOS 15 */
|
|
111
|
+
RCT_EXPORT_VIEW_PROPERTY(mediaCapturePermissionGrantType, BPCWebViewPermissionGrantType)
|
|
112
|
+
#endif
|
|
113
|
+
|
|
96
114
|
/**
|
|
97
115
|
* Expose methods to enable messaging the webview.
|
|
98
116
|
*/
|
|
@@ -100,6 +118,8 @@ RCT_EXPORT_VIEW_PROPERTY(messagingEnabled, BOOL)
|
|
|
100
118
|
RCT_EXPORT_VIEW_PROPERTY(onMessage, RCTDirectEventBlock)
|
|
101
119
|
RCT_EXPORT_VIEW_PROPERTY(onScroll, RCTDirectEventBlock)
|
|
102
120
|
RCT_EXPORT_VIEW_PROPERTY(enableApplePay, BOOL)
|
|
121
|
+
RCT_EXPORT_VIEW_PROPERTY(menuItems, NSArray);
|
|
122
|
+
RCT_EXPORT_VIEW_PROPERTY(onCustomMenuSelection, RCTDirectEventBlock)
|
|
103
123
|
|
|
104
124
|
RCT_EXPORT_METHOD(postMessage:(nonnull NSNumber *)reactTag message:(NSString *)message)
|
|
105
125
|
{
|
|
@@ -125,6 +145,10 @@ RCT_CUSTOM_VIEW_PROPERTY(useSharedProcessPool, BOOL, BPCWebView) {
|
|
|
125
145
|
view.useSharedProcessPool = json == nil ? true : [RCTConvert BOOL: json];
|
|
126
146
|
}
|
|
127
147
|
|
|
148
|
+
RCT_CUSTOM_VIEW_PROPERTY(userAgent, NSString, BPCWebView) {
|
|
149
|
+
view.userAgent = [RCTConvert NSString: json];
|
|
150
|
+
}
|
|
151
|
+
|
|
128
152
|
RCT_CUSTOM_VIEW_PROPERTY(scrollEnabled, BOOL, BPCWebView) {
|
|
129
153
|
view.scrollEnabled = json == nil ? true : [RCTConvert BOOL: json];
|
|
130
154
|
}
|
package/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
2
|
// eslint-disable-next-line
|
|
3
|
-
import { IOSWebViewProps, AndroidWebViewProps } from './lib/WebViewTypes';
|
|
3
|
+
import { IOSWebViewProps, AndroidWebViewProps, WindowsWebViewProps } from './lib/WebViewTypes';
|
|
4
4
|
|
|
5
5
|
export { FileDownload, WebViewMessageEvent, WebViewNavigation } from "./lib/WebViewTypes";
|
|
6
6
|
|
|
7
|
-
export type WebViewProps = IOSWebViewProps & AndroidWebViewProps;
|
|
7
|
+
export type WebViewProps = IOSWebViewProps & AndroidWebViewProps & WindowsWebViewProps;
|
|
8
8
|
|
|
9
9
|
declare class WebView<P = {}> extends Component<WebViewProps & P> {
|
|
10
10
|
/**
|
|
@@ -46,19 +46,19 @@ declare class WebView<P = {}> extends Component<WebViewProps & P> {
|
|
|
46
46
|
* (Android only)
|
|
47
47
|
* Removes the autocomplete popup from the currently focused form field, if present.
|
|
48
48
|
*/
|
|
49
|
-
clearFormData
|
|
49
|
+
clearFormData?: () => void;
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* (Android only)
|
|
53
53
|
* Clears the resource cache. Note that the cache is per-application, so this will clear the cache for all WebViews used.
|
|
54
54
|
*/
|
|
55
|
-
clearCache
|
|
55
|
+
clearCache?: (clear: boolean) => void;
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
* (Android only)
|
|
59
59
|
* Tells this WebView to clear its internal back/forward list.
|
|
60
60
|
*/
|
|
61
|
-
clearHistory
|
|
61
|
+
clearHistory?: () => void;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
export {WebView};
|