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.
Files changed (217) hide show
  1. package/README.md +83 -93
  2. package/android/.DS_Store +0 -0
  3. package/android/build/.transforms/4e87ba7f47baac309fba5367e008cf44/results.bin +1 -0
  4. package/android/build/.transforms/4e87ba7f47baac309fba5367e008cf44/transformed/classes/classes.dex +0 -0
  5. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +3 -5
  6. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +4 -2
  7. package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +2 -0
  8. package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
  9. package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
  10. package/android/build/intermediates/compile_symbol_list/debug/R.txt +72 -8
  11. package/android/build/intermediates/compiled_local_resources/debug/out/xml_file_provider_paths.xml.flat +0 -0
  12. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +1 -1
  13. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +1 -1
  14. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +1 -1
  15. package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +2 -2
  16. package/android/build/intermediates/incremental/packageDebugResources/merger.xml +1 -1
  17. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebChromeClient.class +0 -0
  18. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebView.class +0 -0
  19. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewClient.class +0 -0
  20. package/android/build/intermediates/library_java_res/debug/res.jar +0 -0
  21. package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +198 -200
  22. package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +100 -0
  23. package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +5 -3
  24. package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
  25. package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +66 -8
  26. package/android/build/kotlin/compileDebugKotlin/build-history.bin +0 -0
  27. package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab +0 -0
  28. package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
  29. package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
  30. package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab.len +0 -0
  31. package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  32. package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab_i +0 -0
  33. package/android/build/kotlin/compileDebugKotlin/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
  34. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  35. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
  36. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
  37. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
  38. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  39. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
  40. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
  41. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  42. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  43. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  44. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
  45. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  46. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  47. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
  48. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/constants.tab +0 -0
  49. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream +0 -0
  50. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/constants.tab.keystream.len +0 -0
  51. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/constants.tab.len +0 -0
  52. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/constants.tab.values.at +0 -0
  53. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/constants.tab_i +0 -0
  54. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/constants.tab_i.len +0 -0
  55. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  56. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  57. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  58. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  59. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  60. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  61. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
  62. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab +0 -0
  63. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  64. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  65. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
  66. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  67. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  68. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
  69. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  70. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
  71. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
  72. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
  73. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  74. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
  75. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
  76. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  77. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
  78. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
  79. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
  80. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  81. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/{java-sources-proto-map.tab_i → subtypes.tab_i} +0 -0
  82. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
  83. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  84. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
  85. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
  86. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
  87. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  88. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
  89. package/android/build/kotlin/compileDebugKotlin/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
  90. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/counters.tab +2 -0
  91. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab +0 -0
  92. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
  93. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
  94. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab.len +0 -0
  95. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  96. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab_i +0 -0
  97. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
  98. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab +0 -0
  99. package/android/build/kotlin/compileDebugKotlin/caches-jvm/{jvm/kotlin/java-sources-proto-map.tab → lookups/id-to-file.tab.keystream} +0 -0
  100. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  101. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab.len +0 -0
  102. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  103. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab_i +0 -0
  104. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
  105. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab +0 -0
  106. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab.keystream +0 -0
  107. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  108. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab.len +0 -0
  109. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab.values.at +0 -0
  110. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab_i +0 -0
  111. package/android/build/kotlin/compileDebugKotlin/caches-jvm/lookups/lookups.tab_i.len +0 -0
  112. package/android/build/kotlin/compileDebugKotlin/last-build.bin +0 -0
  113. package/android/build/outputs/logs/manifest-merger-debug-report.txt +116 -128
  114. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  115. package/android/build/tmp/kotlin-classes/debug/META-INF/react-native-webview-bootpay_debug.kotlin_module +0 -0
  116. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/BPCWebViewPackage.class +0 -0
  117. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent$Companion.class +0 -0
  118. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent.class +0 -0
  119. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent$Companion.class +0 -0
  120. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent.class +0 -0
  121. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent$Companion.class +0 -0
  122. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent.class +0 -0
  123. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent$Companion.class +0 -0
  124. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent.class +0 -0
  125. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent$Companion.class +0 -0
  126. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent.class +0 -0
  127. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopMessageEvent$Companion.class +0 -0
  128. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopMessageEvent.class +0 -0
  129. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent$Companion.class +0 -0
  130. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent.class +0 -0
  131. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent$Companion.class +0 -0
  132. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent.class +0 -0
  133. package/android/build.gradle +7 -9
  134. package/android/gradle.properties +2 -1
  135. package/android/src/.DS_Store +0 -0
  136. package/android/src/main/.DS_Store +0 -0
  137. package/android/src/main/java/.DS_Store +0 -0
  138. package/android/src/main/java/kr/.DS_Store +0 -0
  139. package/android/src/main/java/kr/co/.DS_Store +0 -0
  140. package/android/src/main/java/kr/co/bootpay/.DS_Store +0 -0
  141. package/android/src/main/java/kr/co/bootpay/webview/BPCWebChromeClient.java +2 -2
  142. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewClient.java +20 -4
  143. package/apple/BPCWebView.h +19 -0
  144. package/apple/BPCWebView.m +284 -104
  145. package/apple/BPCWebViewManager.h +2 -0
  146. package/apple/BPCWebViewManager.m +25 -1
  147. package/index.d.ts +5 -5
  148. package/ios/.DS_Store +0 -0
  149. package/ios/RNCWebView.xcodeproj/project.pbxproj +18 -18
  150. package/ios/RNCWebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  151. package/ios/RNCWebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  152. package/ios/RNCWebView.xcodeproj/project.xcworkspace/xcuserdata/bootpay.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  153. package/ios/RNCWebView.xcodeproj/xcuserdata/bootpay.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  154. package/lib/WebView.android.d.ts +3 -0
  155. package/lib/WebView.android.d.ts.map +1 -1
  156. package/lib/WebView.android.js +22 -11
  157. package/lib/WebView.d.ts +2 -2
  158. package/lib/WebView.d.ts.map +1 -1
  159. package/lib/WebView.ios.d.ts +1 -0
  160. package/lib/WebView.ios.d.ts.map +1 -1
  161. package/lib/WebView.ios.js +23 -14
  162. package/lib/WebView.js +4 -4
  163. package/lib/WebView.macos.d.ts.map +1 -1
  164. package/lib/WebView.macos.js +21 -13
  165. package/lib/WebView.windows.d.ts +4 -2
  166. package/lib/WebView.windows.d.ts.map +1 -1
  167. package/lib/WebView.windows.js +22 -14
  168. package/lib/WebViewNativeComponent.android.d.ts +4 -0
  169. package/lib/WebViewNativeComponent.android.d.ts.map +1 -0
  170. package/lib/WebViewNativeComponent.android.js +3 -0
  171. package/lib/WebViewNativeComponent.ios.d.ts +4 -0
  172. package/lib/WebViewNativeComponent.ios.d.ts.map +1 -0
  173. package/lib/WebViewNativeComponent.ios.js +3 -0
  174. package/lib/WebViewNativeComponent.macos.d.ts +4 -0
  175. package/lib/WebViewNativeComponent.macos.d.ts.map +1 -0
  176. package/lib/WebViewNativeComponent.macos.js +3 -0
  177. package/lib/WebViewNativeComponent.windows.d.ts +4 -0
  178. package/lib/WebViewNativeComponent.windows.d.ts.map +1 -0
  179. package/lib/WebViewNativeComponent.windows.js +3 -0
  180. package/lib/WebViewShared.d.ts +1 -0
  181. package/lib/WebViewShared.d.ts.map +1 -1
  182. package/lib/WebViewShared.js +14 -12
  183. package/lib/WebViewTypes.d.ts +113 -2
  184. package/lib/WebViewTypes.d.ts.map +1 -1
  185. package/lib/WebViewTypes.js +3 -1
  186. package/lib/index.d.ts +4 -0
  187. package/lib/index.d.ts.map +1 -0
  188. package/lib/index.js +3 -0
  189. package/package.json +25 -27
  190. package/react-native-webview-bootpay.podspec +1 -3
  191. package/react-native.config.js +47 -61
  192. package/windows/ExperimentalFeatures.props +12 -0
  193. package/windows/ReactNativeWebView/ReactNativeWebView.vcxproj +37 -20
  194. package/windows/ReactNativeWebView/ReactPackageProvider.cpp +5 -1
  195. package/windows/ReactNativeWebView/ReactWebView.cpp +2 -6
  196. package/windows/ReactNativeWebView/ReactWebView.h +3 -2
  197. package/windows/ReactNativeWebView/ReactWebView.idl +13 -1
  198. package/windows/ReactNativeWebView/ReactWebView2.cpp +119 -0
  199. package/windows/ReactNativeWebView/ReactWebView2.h +43 -0
  200. package/windows/ReactNativeWebView/ReactWebView2Manager.cpp +147 -0
  201. package/windows/ReactNativeWebView/ReactWebView2Manager.h +54 -0
  202. package/windows/ReactNativeWebView/ReactWebViewManager.cpp +36 -31
  203. package/windows/{WebViewBridgeComponent → ReactNativeWebView}/WebBridge.cpp +1 -1
  204. package/windows/{WebViewBridgeComponent → ReactNativeWebView}/WebBridge.h +2 -2
  205. package/windows/{WebViewBridgeComponent → ReactNativeWebView}/WebBridge.idl +1 -1
  206. package/windows/ReactNativeWebView/packages.config +2 -0
  207. package/windows/ReactNativeWebView/pch.h +6 -0
  208. package/windows/ReactNativeWebView.sln +81 -119
  209. package/android/build/tmp/kotlin-classes/debug/META-INF/rnWebView_debug.kotlin_module +0 -0
  210. package/windows/WebViewBridgeComponent/PropertySheet.props +0 -16
  211. package/windows/WebViewBridgeComponent/WebViewBridgeComponent.def +0 -3
  212. package/windows/WebViewBridgeComponent/WebViewBridgeComponent.vcxproj +0 -160
  213. package/windows/WebViewBridgeComponent/WebViewBridgeComponent.vcxproj.filters +0 -33
  214. package/windows/WebViewBridgeComponent/packages.config +0 -4
  215. package/windows/WebViewBridgeComponent/pch.cpp +0 -1
  216. package/windows/WebViewBridgeComponent/pch.h +0 -4
  217. package/windows/WebViewBridgeComponent/readme.txt +0 -23
@@ -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;
@@ -18,11 +18,13 @@
18
18
  #import "objc/runtime.h"
19
19
 
20
20
  static NSTimer *keyboardTimer;
21
- static NSString *const HistoryShimName = @"ReactNativeHistoryShimBootpay";
22
- static NSString *const MessageHandlerName = @"BootpayRNWebView";
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 *bpcWebView = (BPCWebView *)[self superview];
55
- RCTAssert([bpcWebView isKindOfClass:[bpcWebView class]], @"superview must be an BPCWebView");
56
- if (![bpcWebView scrollEnabled]) {
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
- NSLog(@"------ popup url: %@", navigationAction.request.URL.absoluteString);
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
- if([navigationAction.request.URL.absoluteString rangeOfString:@"bootpay.co.kr"].location == NSNotFound) {
205
- NSLog(@"111");
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
- if (!navigationAction.targetFrame.isMainFrame) {
209
- [webView loadRequest:navigationAction.request];
210
- }
211
- return nil;
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
- NSLog(@"222");
288
+ // Allows the instance to respond to UIMenuController Actions
289
+ - (BOOL)canBecomeFirstResponder
290
+ {
291
+ return YES;
292
+ }
215
293
 
216
- WKWebView *popupView = [[WKWebView alloc] initWithFrame:webView.bounds configuration:configuration];
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
- popupView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
219
- popupView.navigationDelegate = self;
220
- popupView.UIDelegate = self;
221
- [webView addSubview:popupView];
222
-
223
- return popupView;
224
- }
301
+ if (match.location == 0) {
302
+ return YES;
303
+ }
304
+ return NO;
225
305
  }
226
306
 
227
-
228
- - (void)webViewDidClose:(WKWebView *)webView {
229
- [webView removeFromSuperview];
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
- if (_userAgent) {
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
- for (NSHTTPCookie *httpCookie in httpCookies) {
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
- // Because of the way React works, as pages redirect, we actually end up
596
- // passing the redirect urls back here, so we ignore them if trying to load
597
- // the same url. We'll expose a call to 'reload' to allow a user to load
598
- // the existing page.
599
- if ([request.URL isEqual:_webView.URL]) {
600
- return;
601
- }
602
- if (!request.URL) {
603
- // Clear the webview
604
- [_webView loadHTMLString:@"" baseURL:nil];
605
- return;
606
- }
607
- if (request.URL.host) {
608
- [_webView loadRequest:request];
609
- }
610
- else {
611
- NSURL* readAccessUrl = _allowingReadAccessToURL ? [RCTConvert NSURL:_allowingReadAccessToURL] : request.URL;
612
- [_webView loadFileURL:request.URL allowingReadAccessToURL:readAccessUrl];
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
- - (void) navigationOriginRN:(WKWebView *)webView
1204
+
1205
+ - (void) navigationOriginRN:(WKWebView *)webView
1059
1206
  decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction
1060
1207
  decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
1061
1208
  {
1062
- static NSDictionary<NSNumber *, NSString *> *navigationTypes;
1063
- static dispatch_once_t onceToken;
1064
-
1065
- dispatch_once(&onceToken, ^{
1066
- navigationTypes = @{
1067
- @(WKNavigationTypeLinkActivated): @"click",
1068
- @(WKNavigationTypeFormSubmitted): @"formsubmit",
1069
- @(WKNavigationTypeBackForward): @"backforward",
1070
- @(WKNavigationTypeReload): @"reload",
1071
- @(WKNavigationTypeFormResubmitted): @"formresubmit",
1072
- @(WKNavigationTypeOther): @"other",
1073
- };
1074
- });
1075
-
1076
- WKNavigationType navigationType = navigationAction.navigationType;
1077
- NSURLRequest *request = navigationAction.request;
1078
- BOOL isTopFrame = [request.URL isEqual:request.mainDocumentURL];
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
- if (_onShouldStartLoadWithRequest) {
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
- @"mainDocumentURL": (request.mainDocumentURL).absoluteString,
1085
- @"navigationType": navigationTypes[@(navigationType)],
1086
- @"isTopFrame": @(isTopFrame)
1249
+ @"navigationType": navigationTypes[@(navigationType)]
1087
1250
  }];
1088
- if (![self.delegate webView:self
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
- // Allow all navigation by default
1109
- decisionHandler(WKNavigationActionPolicyAllow);
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
- for (NSHTTPCookie *cookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]) {
1453
- [wkWebViewConfig.websiteDataStore.httpCookieStore setCookie:cookie completionHandler:nil];
1454
- }
1634
+ [self syncCookiesToWebView:nil];
1455
1635
  } else {
1456
1636
  NSMutableString *script = [NSMutableString string];
1457
1637
 
@@ -8,4 +8,6 @@
8
8
  #import <React/RCTViewManager.h>
9
9
 
10
10
  @interface BPCWebViewManager : RCTViewManager
11
+ @property (nonatomic, copy) NSArray<NSDictionary *> * _Nullable menuItems;
12
+ @property (nonatomic, copy) RCTDirectEventBlock onCustomMenuSelection;
11
13
  @end
@@ -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: () => void;
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: (clear: boolean) => void;
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: () => void;
61
+ clearHistory?: () => void;
62
62
  }
63
63
 
64
64
  export {WebView};