react-native-webview-bootpay 11.26.20 → 13.6.0

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 (342) hide show
  1. package/README.md +9 -31
  2. package/android/build.gradle +70 -112
  3. package/android/gradle.properties +5 -6
  4. package/android/src/main/java/kr/co/bootpay/webview/BPCBasicAuthCredential.java +11 -0
  5. package/android/src/main/java/kr/co/bootpay/webview/BPCWebChromeClient.java +354 -434
  6. package/android/src/main/java/kr/co/bootpay/webview/BPCWebView.java +350 -259
  7. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewClient.java +253 -399
  8. package/android/src/main/java/kr/co/bootpay/webview/{WebViewConfig.java → BPCWebViewConfig.java} +3 -4
  9. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewFileProvider.java +1 -1
  10. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewManager.java +290 -877
  11. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewManagerImpl.kt +664 -0
  12. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewModule.java +29 -520
  13. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewModuleImpl.java +554 -0
  14. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewPackage.java +56 -0
  15. package/android/src/main/java/kr/co/bootpay/webview/BootpayUrlHelper.java +122 -0
  16. package/android/src/main/java/kr/co/bootpay/webview/events/TopCustomMenuSelectionEvent.kt +24 -0
  17. package/android/src/main/java/kr/co/bootpay/webview/events/TopNewWindowEvent.kt +25 -0
  18. package/android/src/newarch/com/reactnativecommunity/webview/BPCWebViewManager.java +544 -0
  19. package/android/src/newarch/com/reactnativecommunity/webview/BPCWebViewModule.java +57 -0
  20. package/apple/BPCWebView.h +22 -126
  21. package/apple/BPCWebView.mm +528 -0
  22. package/apple/BPCWebViewDecisionManager.h +20 -0
  23. package/apple/BPCWebViewDecisionManager.m +47 -0
  24. package/apple/BPCWebViewImpl.h +150 -0
  25. package/apple/{BPCWebView.m → BPCWebViewImpl.m} +381 -214
  26. package/apple/BPCWebViewManager.h +4 -8
  27. package/apple/{BPCWebViewManager.m → BPCWebViewManager.mm} +93 -149
  28. package/{android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream → ios/.DS_Store} +0 -0
  29. package/ios/{BPCWebView.xcodeproj → RNCWebView.xcodeproj}/project.pbxproj +18 -18
  30. package/ios/main.jsbundle +457 -0
  31. package/lib/BPCWebViewNativeComponent.d.ts +242 -0
  32. package/lib/BPCWebViewNativeComponent.d.ts.map +1 -0
  33. package/lib/BPCWebViewNativeComponent.js +6 -0
  34. package/lib/NativeBPCWebView.d.ts +10 -0
  35. package/lib/NativeBPCWebView.d.ts.map +1 -0
  36. package/lib/NativeBPCWebView.js +2 -0
  37. package/lib/NativeRNCWebView.d.ts +10 -0
  38. package/lib/NativeRNCWebView.d.ts.map +1 -0
  39. package/lib/NativeRNCWebView.js +2 -0
  40. package/lib/RNCWebViewNativeComponent.d.ts +242 -0
  41. package/lib/RNCWebViewNativeComponent.d.ts.map +1 -0
  42. package/lib/RNCWebViewNativeComponent.js +6 -0
  43. package/lib/WebView.android.d.ts.map +1 -1
  44. package/lib/WebView.android.js +53 -29
  45. package/lib/WebView.ios.d.ts.map +1 -1
  46. package/lib/WebView.ios.js +49 -28
  47. package/lib/WebView.macos.d.ts.map +1 -1
  48. package/lib/WebView.macos.js +10 -14
  49. package/lib/WebView.windows.d.ts.map +1 -1
  50. package/lib/WebView.windows.js +4 -6
  51. package/lib/WebViewNativeComponent.macos.d.ts +2 -2
  52. package/lib/WebViewNativeComponent.macos.js +2 -2
  53. package/lib/WebViewShared.d.ts +4 -2
  54. package/lib/WebViewShared.d.ts.map +1 -1
  55. package/lib/WebViewShared.js +8 -2
  56. package/lib/WebViewTypes.d.ts +62 -95
  57. package/lib/WebViewTypes.d.ts.map +1 -1
  58. package/lib/WebViewTypes.js +0 -16
  59. package/macos/RNCWebView.xcodeproj/project.pbxproj +44 -44
  60. package/package.json +38 -20
  61. package/react-native-webview-bootpay.podspec +22 -3
  62. package/react-native.config.js +1 -2
  63. package/src/BPCWebViewNativeComponent.ts +281 -0
  64. package/src/NativeBPCWebView.ts +14 -0
  65. package/src/WebView.android.tsx +229 -0
  66. package/src/WebView.ios.tsx +232 -0
  67. package/src/WebView.macos.tsx +177 -0
  68. package/src/WebView.styles.ts +44 -0
  69. package/src/WebView.tsx +18 -0
  70. package/src/WebView.windows.tsx +156 -0
  71. package/src/WebViewNativeComponent.macos.ts +8 -0
  72. package/src/WebViewNativeComponent.windows.ts +10 -0
  73. package/src/WebViewShared.tsx +235 -0
  74. package/src/WebViewTypes.ts +1287 -0
  75. package/src/__tests__/WebViewShared-test.js +208 -0
  76. package/src/__tests__/__snapshots__/WebViewShared-test.js.snap +8 -0
  77. package/src/index.ts +4 -0
  78. package/windows/.gitignore +353 -0
  79. package/windows/ReactNativeWebView/ReactNativeWebView.vcxproj +1 -1
  80. package/windows/ReactNativeWebView/ReactWebView.idl +1 -0
  81. package/windows/ReactNativeWebView/ReactWebView2.cpp +142 -19
  82. package/windows/ReactNativeWebView/ReactWebView2.h +3 -0
  83. package/windows/ReactNativeWebView/ReactWebView2Manager.cpp +29 -5
  84. package/windows/ReactNativeWebView/pch.h +1 -0
  85. package/android/.editorconfig +0 -6
  86. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/results.bin +0 -1
  87. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebChromeClient$1.dex +0 -0
  88. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebChromeClient.dex +0 -0
  89. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebView$1.dex +0 -0
  90. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebView$BPCWebViewBridge.dex +0 -0
  91. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebView$ProgressChangedFilter.dex +0 -0
  92. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebView.dex +0 -0
  93. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewClient.dex +0 -0
  94. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewFileProvider.dex +0 -0
  95. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewManager$1.dex +0 -0
  96. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewManager$2.dex +0 -0
  97. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewManager$3.dex +0 -0
  98. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewManager$4.dex +0 -0
  99. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewManager.dex +0 -0
  100. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule$1.dex +0 -0
  101. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule$2.dex +0 -0
  102. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule$MimeType.dex +0 -0
  103. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock$ShouldOverrideCallbackState.dex +0 -0
  104. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock.dex +0 -0
  105. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule.dex +0 -0
  106. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewPackage.dex +0 -0
  107. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BasicAuthCredential.dex +0 -0
  108. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BuildConfig.dex +0 -0
  109. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/URLUtil.dex +0 -0
  110. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/WebViewConfig.dex +0 -0
  111. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent$Companion.dex +0 -0
  112. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent.dex +0 -0
  113. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent$Companion.dex +0 -0
  114. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent.dex +0 -0
  115. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent$Companion.dex +0 -0
  116. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent.dex +0 -0
  117. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent$Companion.dex +0 -0
  118. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent.dex +0 -0
  119. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent$Companion.dex +0 -0
  120. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent.dex +0 -0
  121. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopMessageEvent$Companion.dex +0 -0
  122. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopMessageEvent.dex +0 -0
  123. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent$Companion.dex +0 -0
  124. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent.dex +0 -0
  125. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent$Companion.dex +0 -0
  126. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent.dex +0 -0
  127. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/desugar_graph.bin +0 -0
  128. package/android/build/.transforms/88c49d67076e4458a9ddee82f875eb6a/results.bin +0 -1
  129. package/android/build/.transforms/88c49d67076e4458a9ddee82f875eb6a/transformed/classes/classes.dex +0 -0
  130. package/android/build/.transforms/c0e86b44db04fcaf424a5b7ce79324f4/results.bin +0 -1
  131. package/android/build/generated/source/buildConfig/debug/kr/co/bootpay/webview/BuildConfig.java +0 -10
  132. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -106
  133. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +0 -18
  134. package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +0 -4
  135. package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +0 -1
  136. package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
  137. package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
  138. package/android/build/intermediates/compile_symbol_list/debug/R.txt +0 -1861
  139. package/android/build/intermediates/compiled_local_resources/debug/out/xml_file_provider_paths.xml.flat +0 -0
  140. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +0 -2
  141. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +0 -2
  142. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +0 -2
  143. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +0 -2
  144. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +0 -2
  145. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebChromeClient$1.class +0 -0
  146. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebChromeClient.class +0 -0
  147. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebView$1.class +0 -0
  148. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebView$BPCWebViewBridge.class +0 -0
  149. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebView$ProgressChangedFilter.class +0 -0
  150. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebView.class +0 -0
  151. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewClient.class +0 -0
  152. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewFileProvider.class +0 -0
  153. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewManager$1.class +0 -0
  154. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewManager$2.class +0 -0
  155. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewManager$3.class +0 -0
  156. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewManager$4.class +0 -0
  157. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewManager.class +0 -0
  158. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule$1.class +0 -0
  159. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule$2.class +0 -0
  160. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule$MimeType.class +0 -0
  161. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock$ShouldOverrideCallbackState.class +0 -0
  162. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock.class +0 -0
  163. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule.class +0 -0
  164. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BasicAuthCredential.class +0 -0
  165. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BuildConfig.class +0 -0
  166. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/URLUtil.class +0 -0
  167. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/WebViewConfig.class +0 -0
  168. package/android/build/intermediates/library_java_res/debug/res.jar +0 -0
  169. package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +0 -3
  170. package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +0 -210
  171. package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +0 -106
  172. package/android/build/intermediates/navigation_json/debug/navigation.json +0 -1
  173. package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +0 -18
  174. package/android/build/intermediates/packaged_res/debug/xml/file_provider_paths.xml +0 -6
  175. package/android/build/intermediates/runtime_library_classes_dir/debug/META-INF/react-native-webview-bootpay_debug.kotlin_module +0 -0
  176. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebChromeClient$1.class +0 -0
  177. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebChromeClient.class +0 -0
  178. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebView$1.class +0 -0
  179. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebView$BPCWebViewBridge.class +0 -0
  180. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebView$ProgressChangedFilter.class +0 -0
  181. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebView.class +0 -0
  182. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewClient.class +0 -0
  183. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewFileProvider.class +0 -0
  184. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewManager$1.class +0 -0
  185. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewManager$2.class +0 -0
  186. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewManager$3.class +0 -0
  187. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewManager$4.class +0 -0
  188. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewManager.class +0 -0
  189. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule$1.class +0 -0
  190. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule$2.class +0 -0
  191. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule$MimeType.class +0 -0
  192. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock$ShouldOverrideCallbackState.class +0 -0
  193. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock.class +0 -0
  194. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule.class +0 -0
  195. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewPackage.class +0 -0
  196. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BasicAuthCredential.class +0 -0
  197. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BuildConfig.class +0 -0
  198. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/URLUtil.class +0 -0
  199. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/WebViewConfig.class +0 -0
  200. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent$Companion.class +0 -0
  201. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent.class +0 -0
  202. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent$Companion.class +0 -0
  203. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent.class +0 -0
  204. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent$Companion.class +0 -0
  205. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent.class +0 -0
  206. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent$Companion.class +0 -0
  207. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent.class +0 -0
  208. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent$Companion.class +0 -0
  209. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent.class +0 -0
  210. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopMessageEvent$Companion.class +0 -0
  211. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopMessageEvent.class +0 -0
  212. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent$Companion.class +0 -0
  213. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent.class +0 -0
  214. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent$Companion.class +0 -0
  215. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent.class +0 -0
  216. package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
  217. package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +0 -1381
  218. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  219. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
  220. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
  221. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
  222. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  223. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
  224. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
  225. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  226. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
  227. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
  228. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
  229. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  230. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
  231. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
  232. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  233. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  234. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  235. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
  236. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  237. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  238. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
  239. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab +0 -0
  240. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream +0 -0
  241. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream.len +0 -0
  242. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.len +0 -0
  243. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at +0 -0
  244. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i +0 -0
  245. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i.len +0 -0
  246. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  247. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  248. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  249. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  250. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  251. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  252. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
  253. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab +0 -0
  254. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.keystream +0 -0
  255. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.keystream.len +0 -0
  256. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.len +0 -0
  257. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.values.at +0 -0
  258. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab_i +0 -0
  259. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab_i.len +0 -0
  260. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  261. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  262. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  263. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
  264. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  265. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  266. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
  267. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  268. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
  269. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
  270. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
  271. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  272. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
  273. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
  274. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  275. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
  276. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
  277. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
  278. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  279. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
  280. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
  281. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  282. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
  283. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
  284. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
  285. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  286. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
  287. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
  288. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +0 -2
  289. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  290. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
  291. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
  292. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
  293. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  294. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
  295. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
  296. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  297. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  298. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  299. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  300. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
  301. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
  302. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  303. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  304. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  305. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  306. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  307. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  308. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
  309. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  310. package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
  311. package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -229
  312. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  313. package/android/build/tmp/kotlin-classes/debug/META-INF/react-native-webview-bootpay_debug.kotlin_module +0 -0
  314. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/BPCWebViewPackage.class +0 -0
  315. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent$Companion.class +0 -0
  316. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent.class +0 -0
  317. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent$Companion.class +0 -0
  318. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent.class +0 -0
  319. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent$Companion.class +0 -0
  320. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent.class +0 -0
  321. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent$Companion.class +0 -0
  322. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent.class +0 -0
  323. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent$Companion.class +0 -0
  324. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent.class +0 -0
  325. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopMessageEvent$Companion.class +0 -0
  326. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopMessageEvent.class +0 -0
  327. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent$Companion.class +0 -0
  328. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent.class +0 -0
  329. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent$Companion.class +0 -0
  330. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent.class +0 -0
  331. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewPackage.kt +0 -15
  332. package/android/src/main/java/kr/co/bootpay/webview/BasicAuthCredential.java +0 -11
  333. package/ios/BPCWebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  334. package/ios/BPCWebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  335. package/ios/BPCWebView.xcodeproj/project.xcworkspace/xcuserdata/ehowlsla.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  336. package/ios/BPCWebView.xcodeproj/xcuserdata/ehowlsla.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  337. package/lib/WebViewNativeComponent.android.d.ts +0 -4
  338. package/lib/WebViewNativeComponent.android.d.ts.map +0 -1
  339. package/lib/WebViewNativeComponent.android.js +0 -3
  340. package/lib/WebViewNativeComponent.ios.d.ts +0 -4
  341. package/lib/WebViewNativeComponent.ios.d.ts.map +0 -1
  342. package/lib/WebViewNativeComponent.ios.js +0 -3
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #import "BPCWebView.h"
8
+ #import "BPCWebViewImpl.h"
9
9
  #import <React/RCTConvert.h>
10
10
  #import <React/RCTAutoInsetsProtocol.h>
11
11
  #import "BPCWKProcessPoolManager.h"
@@ -23,7 +23,7 @@ static NSString *const MessageHandlerName = @"BootpayRNWebView";
23
23
  static NSURLCredential* clientAuthenticationCredential;
24
24
  static NSDictionary* customCertificatesForHost;
25
25
 
26
- NSString *const BPCUSTOM_SELECTOR = @"_BPCUSTOM_SELECTOR_";
26
+ NSString *const CUSTOM_SELECTOR = @"_BPCUSTOM_SELECTOR_";
27
27
 
28
28
  #if !TARGET_OS_OSX
29
29
  // runtime trick to remove WKWebView keyboard default toolbar
@@ -37,7 +37,7 @@ NSString *const BPCUSTOM_SELECTOR = @"_BPCUSTOM_SELECTOR_";
37
37
  if (_webView == nil) {
38
38
  return nil;
39
39
  }
40
-
40
+
41
41
  if ([_webView respondsToSelector:@selector(inputAssistantItem)]) {
42
42
  UITextInputAssistantItem *inputAssistantItem = [_webView inputAssistantItem];
43
43
  inputAssistantItem.leadingBarButtonGroups = @[];
@@ -48,49 +48,85 @@ NSString *const BPCUSTOM_SELECTOR = @"_BPCUSTOM_SELECTOR_";
48
48
  @end
49
49
  #endif // !TARGET_OS_OSX
50
50
 
51
- #if TARGET_OS_OSX
52
51
  @interface BPCWKWebView : WKWebView
52
+ #if !TARGET_OS_OSX
53
+ @property (nonatomic, copy) NSArray<NSDictionary *> * _Nullable menuItems;
54
+ @property (nonatomic, copy) NSArray<NSString *> * _Nullable suppressMenuItems;
55
+ #endif // !TARGET_OS_OSX
53
56
  @end
54
57
  @implementation BPCWKWebView
58
+ #if !TARGET_OS_OSX
59
+ - (NSString *)stringFromAction:(SEL) action {
60
+ NSString *sel = NSStringFromSelector(action);
61
+
62
+ NSDictionary *map = @{
63
+ @"cut:": @"cut",
64
+ @"copy:": @"copy",
65
+ @"paste:": @"paste",
66
+ @"delete:": @"delete",
67
+ @"select:": @"select",
68
+ @"selectAll:": @"selectAll",
69
+ @"_promptForReplace:": @"replace",
70
+ @"_define:": @"lookup",
71
+ @"_translate:": @"translate",
72
+ @"toggleBoldface:": @"bold",
73
+ @"toggleItalics:": @"italic",
74
+ @"toggleUnderline:": @"underline",
75
+ @"_share:": @"share",
76
+ };
77
+
78
+ return map[sel] ?: sel;
79
+ }
80
+
81
+ - (BOOL)canPerformAction:(SEL)action
82
+ withSender:(id)sender{
83
+ if(self.suppressMenuItems) {
84
+ NSString * sel = [self stringFromAction:action];
85
+ if ([self.suppressMenuItems containsObject: sel]) {
86
+ return NO;
87
+ }
88
+ }
89
+
90
+ if (!self.menuItems) {
91
+ return [super canPerformAction:action withSender:sender];
92
+ }
93
+
94
+ return NO;
95
+ }
96
+ - (void)buildMenuWithBuilder:(id<UIMenuBuilder>)builder API_AVAILABLE(ios(13.0)) {
97
+ if (@available(iOS 16.0, *)) {
98
+ if(self.menuItems){
99
+ [builder removeMenuForIdentifier:UIMenuLookup];
100
+ }
101
+ }
102
+ [super buildMenuWithBuilder:builder];
103
+ }
104
+ #else // TARGET_OS_OSX
55
105
  - (void)scrollWheel:(NSEvent *)theEvent {
56
- BPCWebView *bpcWebView = (BPCWebView *)[self superview];
57
- RCTAssert([bpcWebView isKindOfClass:[bpcWebView class]], @"superview must be an BPCWebView");
58
- if (![bpcWebView scrollEnabled]) {
106
+ BPCWebViewImpl *BPCWebView = (BPCWebViewImpl *)[self superview];
107
+ RCTAssert([BPCWebView isKindOfClass:[BPCWebView class]], @"superview must be an BPCWebViewImpl");
108
+ if (![BPCWebView scrollEnabled]) {
59
109
  [[self nextResponder] scrollWheel:theEvent];
60
110
  return;
61
111
  }
62
112
  [super scrollWheel:theEvent];
63
113
  }
64
- @end
65
114
  #endif // TARGET_OS_OSX
115
+ @end
66
116
 
67
- @interface BPCWebView () <WKUIDelegate, WKNavigationDelegate, WKScriptMessageHandler, WKHTTPCookieStoreObserver,
117
+ @interface BPCWebViewImpl () <WKUIDelegate, WKNavigationDelegate, WKScriptMessageHandler, WKHTTPCookieStoreObserver,
68
118
  #if !TARGET_OS_OSX
69
119
  UIScrollViewDelegate,
70
120
  #endif // !TARGET_OS_OSX
71
121
  RCTAutoInsetsProtocol>
72
122
 
73
- @property (nonatomic, copy) RCTDirectEventBlock onFileDownload;
74
- @property (nonatomic, copy) RCTDirectEventBlock onLoadingStart;
75
- @property (nonatomic, copy) RCTDirectEventBlock onLoadingFinish;
76
- @property (nonatomic, copy) RCTDirectEventBlock onLoadingError;
77
- @property (nonatomic, copy) RCTDirectEventBlock onLoadingProgress;
78
- @property (nonatomic, copy) RCTDirectEventBlock onShouldStartLoadWithRequest;
79
- @property (nonatomic, copy) RCTDirectEventBlock onHttpError;
80
- @property (nonatomic, copy) RCTDirectEventBlock onMessage;
81
- @property (nonatomic, copy) RCTDirectEventBlock onScroll;
82
- @property (nonatomic, copy) RCTDirectEventBlock onContentProcessDidTerminate;
83
- #if !TARGET_OS_OSX
84
- @property (nonatomic, copy) WKWebView *webView;
85
- #else
86
123
  @property (nonatomic, copy) BPCWKWebView *webView;
87
- #endif // !TARGET_OS_OSX
88
124
  @property (nonatomic, strong) WKUserScript *postMessageScript;
89
125
  @property (nonatomic, strong) WKUserScript *atStartScript;
90
126
  @property (nonatomic, strong) WKUserScript *atEndScript;
91
127
  @end
92
128
 
93
- @implementation BPCWebView
129
+ @implementation BPCWebViewImpl
94
130
  {
95
131
  #if !TARGET_OS_OSX
96
132
  UIColor * _savedBackgroundColor;
@@ -99,15 +135,15 @@ RCTAutoInsetsProtocol>
99
135
  #endif // !TARGET_OS_OSX
100
136
  BOOL _savedHideKeyboardAccessoryView;
101
137
  BOOL _savedKeyboardDisplayRequiresUserAction;
102
-
138
+
103
139
  // Workaround for StatusBar appearance bug for iOS 12
104
- // https://github.com/react-native-webview/react-native-webview/issues/62
140
+ // https://github.com/react-native-webview-bootpay/react-native-webview-bootpay/issues/62
105
141
  BOOL _isFullScreenVideoOpen;
106
142
  #if !TARGET_OS_OSX
107
143
  UIStatusBarStyle _savedStatusBarStyle;
108
144
  #endif // !TARGET_OS_OSX
109
145
  BOOL _savedStatusBarHidden;
110
-
146
+
111
147
  #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
112
148
  UIScrollViewContentInsetAdjustmentBehavior _savedContentInsetAdjustmentBehavior;
113
149
  #endif
@@ -141,7 +177,7 @@ RCTAutoInsetsProtocol>
141
177
  _injectedJavaScriptForMainFrameOnly = YES;
142
178
  _injectedJavaScriptBeforeContentLoaded = nil;
143
179
  _injectedJavaScriptBeforeContentLoadedForMainFrameOnly = YES;
144
-
180
+
145
181
  #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
146
182
  _savedContentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
147
183
  #endif
@@ -153,13 +189,13 @@ RCTAutoInsetsProtocol>
153
189
  _mediaCapturePermissionGrantType = BPCWebViewPermissionGrantType_Prompt;
154
190
  #endif
155
191
  }
156
-
192
+
157
193
  #if !TARGET_OS_OSX
158
194
  [[NSNotificationCenter defaultCenter]addObserver:self
159
195
  selector:@selector(appDidBecomeActive)
160
196
  name:UIApplicationDidBecomeActiveNotification
161
197
  object:nil];
162
-
198
+
163
199
  [[NSNotificationCenter defaultCenter]addObserver:self
164
200
  selector:@selector(appWillResignActive)
165
201
  name:UIApplicationWillResignActiveNotification
@@ -175,19 +211,19 @@ RCTAutoInsetsProtocol>
175
211
  addObserver:self
176
212
  selector:@selector(keyboardWillShow)
177
213
  name:UIKeyboardWillShowNotification object:nil];
178
-
214
+
179
215
  // Workaround for StatusBar appearance bug for iOS 12
180
- // https://github.com/react-native-webview/react-native-webview/issues/62
216
+ // https://github.com/react-native-webview-bootpay/react-native-webview-bootpay/issues/62
181
217
  [[NSNotificationCenter defaultCenter] addObserver:self
182
218
  selector:@selector(showFullScreenVideoStatusBars)
183
219
  name:UIWindowDidBecomeVisibleNotification
184
220
  object:nil];
185
-
221
+
186
222
  [[NSNotificationCenter defaultCenter] addObserver:self
187
223
  selector:@selector(hideFullScreenVideoStatusBars)
188
224
  name:UIWindowDidBecomeHiddenNotification
189
225
  object:nil];
190
-
226
+
191
227
  }
192
228
  #endif // !TARGET_OS_OSX
193
229
  return self;
@@ -206,27 +242,30 @@ RCTAutoInsetsProtocol>
206
242
  // Listener for long presses
207
243
  - (void)startLongPress:(UILongPressGestureRecognizer *)pressSender
208
244
  {
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;
245
+ if (pressSender.state != UIGestureRecognizerStateEnded || !self.menuItems) {
246
+ return;
247
+ }
248
+ // When a long press ends, bring up our custom UIMenu if defined
249
+ if (self.menuItems.count == 0) {
250
+ UIMenuController *menuController = [UIMenuController sharedMenuController];
251
+ menuController.menuItems = nil;
252
+ [menuController setMenuVisible:NO animated:YES];
253
+ return;
213
254
  }
214
255
  UIMenuController *menuController = [UIMenuController sharedMenuController];
215
256
  NSMutableArray *menuControllerItems = [NSMutableArray arrayWithCapacity:self.menuItems.count];
216
-
257
+
217
258
  for(NSDictionary *menuItem in self.menuItems) {
218
259
  NSString *menuItemLabel = [RCTConvert NSString:menuItem[@"label"]];
219
260
  NSString *menuItemKey = [RCTConvert NSString:menuItem[@"key"]];
220
- NSString *sel = [NSString stringWithFormat:@"%@%@", BPCUSTOM_SELECTOR, menuItemKey];
261
+ NSString *sel = [NSString stringWithFormat:@"%@%@", CUSTOM_SELECTOR, menuItemKey];
221
262
  UIMenuItem *item = [[UIMenuItem alloc] initWithTitle: menuItemLabel
222
263
  action: NSSelectorFromString(sel)];
223
-
224
264
  [menuControllerItems addObject: item];
225
265
  }
226
-
266
+
227
267
  menuController.menuItems = menuControllerItems;
228
268
  [menuController setMenuVisible:YES animated:YES];
229
- }
230
269
  }
231
270
 
232
271
  #endif // !TARGET_OS_OSX
@@ -280,7 +319,7 @@ RCTAutoInsetsProtocol>
280
319
  - (void)forwardInvocation:(NSInvocation *)invocation
281
320
  {
282
321
  NSString *sel = NSStringFromSelector([invocation selector]);
283
- NSRange match = [sel rangeOfString:BPCUSTOM_SELECTOR];
322
+ NSRange match = [sel rangeOfString:CUSTOM_SELECTOR];
284
323
  if (match.location == 0) {
285
324
  [self tappedMenuItem:[sel substringFromIndex:17]];
286
325
  } else {
@@ -299,8 +338,8 @@ RCTAutoInsetsProtocol>
299
338
  {
300
339
  NSString *sel = NSStringFromSelector(action);
301
340
  // Do any of them have our custom keys?
302
- NSRange match = [sel rangeOfString:BPCUSTOM_SELECTOR];
303
-
341
+ NSRange match = [sel rangeOfString:CUSTOM_SELECTOR];
342
+
304
343
  if (match.location == 0) {
305
344
  return YES;
306
345
  }
@@ -312,17 +351,12 @@ RCTAutoInsetsProtocol>
312
351
  */
313
352
  - (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures
314
353
  {
315
- /*
316
354
  if (!navigationAction.targetFrame.isMainFrame) {
317
- [webView loadRequest:navigationAction.request];
318
- }
319
- return nil;
320
- */
321
- NSString *url = navigationAction.request.URL.absoluteString;
355
+
356
+ NSString *url = navigationAction.request.URL.absoluteString;
357
+ // NSURL *url = navigationAction.request.URL;
322
358
 
323
- if (!navigationAction.targetFrame.isMainFrame) {
324
-
325
- if ([url containsString:@"bootpay.co.kr"]) {
359
+ if ([url containsString:@"bootpay.co.kr"]) {
326
360
  // 팝업(새 창) 뜨는 경우 호출됨 (window.open 또는 target="_blank")
327
361
  WKWebView *popupView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height) configuration:configuration];
328
362
 
@@ -333,11 +367,18 @@ RCTAutoInsetsProtocol>
333
367
  [self addSubview:popupView];
334
368
 
335
369
  return popupView;
370
+ } else {
371
+ if (_onOpenWindow) {
372
+ NSMutableDictionary<NSString *, id> *event = [self baseEvent];
373
+ [event addEntriesFromDictionary: @{@"targetUrl": url}];
374
+ _onOpenWindow(event);
336
375
  } else {
337
- [webView loadRequest:navigationAction.request];
338
- return nil;
376
+ [webView loadRequest:navigationAction.request];
339
377
  }
340
- }
378
+
379
+ }
380
+
381
+ }
341
382
  return nil;
342
383
  }
343
384
 
@@ -372,6 +413,14 @@ RCTAutoInsetsProtocol>
372
413
  prefs.javaScriptEnabled = NO;
373
414
  _prefsUsed = YES;
374
415
  }
416
+ #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */
417
+ if (@available(iOS 13.0, *)) {
418
+ if (!_fraudulentWebsiteWarningEnabled) {
419
+ prefs.fraudulentWebsiteWarningEnabled = NO;
420
+ _prefsUsed = YES;
421
+ }
422
+ }
423
+ #endif
375
424
  if (_allowUniversalAccessFromFileURLs) {
376
425
  [wkWebViewConfig setValue:@TRUE forKey:@"allowUniversalAccessFromFileURLs"];
377
426
  }
@@ -403,7 +452,7 @@ RCTAutoInsetsProtocol>
403
452
  wkWebViewConfig.processPool = [[BPCWKProcessPoolManager sharedManager] sharedProcessPool];
404
453
  }
405
454
  wkWebViewConfig.userContentController = [WKUserContentController new];
406
-
455
+
407
456
  #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */
408
457
  if (@available(iOS 13.0, *)) {
409
458
  WKWebpagePreferences *pagePrefs = [[WKWebpagePreferences alloc]init];
@@ -411,7 +460,7 @@ RCTAutoInsetsProtocol>
411
460
  wkWebViewConfig.defaultWebpagePreferences = pagePrefs;
412
461
  }
413
462
  #endif
414
-
463
+
415
464
  #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 /* iOS 14 */
416
465
  if (@available(iOS 14.0, *)) {
417
466
  if ([wkWebViewConfig respondsToSelector:@selector(limitsNavigationsToAppBoundDomains)]) {
@@ -421,32 +470,28 @@ RCTAutoInsetsProtocol>
421
470
  }
422
471
  }
423
472
  #endif
424
-
473
+
425
474
  // Shim the HTML5 history API:
426
475
  [wkWebViewConfig.userContentController addScriptMessageHandler:[[BPCWeakScriptMessageDelegate alloc] initWithDelegate:self]
427
476
  name:HistoryShimName];
428
477
  [self resetupScripts:wkWebViewConfig];
429
-
478
+
430
479
  if(@available(macos 10.11, ios 9.0, *)) {
431
480
  wkWebViewConfig.allowsAirPlayForMediaPlayback = _allowsAirPlayForMediaPlayback;
432
481
  }
433
-
482
+
434
483
  #if !TARGET_OS_OSX
435
484
  wkWebViewConfig.allowsInlineMediaPlayback = _allowsInlineMediaPlayback;
436
- #if WEBKIT_IOS_10_APIS_AVAILABLE
437
485
  wkWebViewConfig.mediaTypesRequiringUserActionForPlayback = _mediaPlaybackRequiresUserAction
438
486
  ? WKAudiovisualMediaTypeAll
439
487
  : WKAudiovisualMediaTypeNone;
440
488
  wkWebViewConfig.dataDetectorTypes = _dataDetectorTypes;
441
- #else
442
- wkWebViewConfig.mediaPlaybackRequiresUserAction = _mediaPlaybackRequiresUserAction;
443
- #endif
444
489
  #endif // !TARGET_OS_OSX
445
-
490
+
446
491
  if (_applicationNameForUserAgent) {
447
492
  wkWebViewConfig.applicationNameForUserAgent = [NSString stringWithFormat:@"%@ %@", wkWebViewConfig.applicationNameForUserAgent, _applicationNameForUserAgent];
448
493
  }
449
-
494
+
450
495
  return wkWebViewConfig;
451
496
  }
452
497
 
@@ -454,14 +499,11 @@ RCTAutoInsetsProtocol>
454
499
  {
455
500
  if (self.window != nil && _webView == nil) {
456
501
  WKWebViewConfiguration *wkWebViewConfig = [self setUpWkWebViewConfig];
457
- #if !TARGET_OS_OSX
458
- _webView = [[WKWebView alloc] initWithFrame:self.bounds configuration: wkWebViewConfig];
459
- #else
460
502
  _webView = [[BPCWKWebView alloc] initWithFrame:self.bounds configuration: wkWebViewConfig];
461
- #endif // !TARGET_OS_OSX
462
-
463
503
  [self setBackgroundColor: _savedBackgroundColor];
464
504
  #if !TARGET_OS_OSX
505
+ _webView.menuItems = _menuItems;
506
+ _webView.suppressMenuItems = _suppressMenuItems;
465
507
  _webView.scrollView.delegate = self;
466
508
  #endif // !TARGET_OS_OSX
467
509
  _webView.UIDelegate = self;
@@ -481,19 +523,28 @@ RCTAutoInsetsProtocol>
481
523
  _webView.allowsLinkPreview = _allowsLinkPreview;
482
524
  [_webView addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:nil];
483
525
  _webView.allowsBackForwardNavigationGestures = _allowsBackForwardNavigationGestures;
484
-
526
+
485
527
  _webView.customUserAgent = _userAgent;
486
- #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
528
+
529
+ #if !TARGET_OS_OSX
487
530
  if ([_webView.scrollView respondsToSelector:@selector(setContentInsetAdjustmentBehavior:)]) {
488
531
  _webView.scrollView.contentInsetAdjustmentBehavior = _savedContentInsetAdjustmentBehavior;
489
532
  }
490
- #endif
533
+ #endif // !TARGET_OS_OSX
534
+
491
535
  #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */
492
536
  if (@available(iOS 13.0, *)) {
493
537
  _webView.scrollView.automaticallyAdjustsScrollIndicatorInsets = _savedAutomaticallyAdjustsScrollIndicatorInsets;
494
538
  }
495
539
  #endif
496
-
540
+
541
+ #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130300 || \
542
+ __IPHONE_OS_VERSION_MAX_ALLOWED >= 160400 || \
543
+ __TV_OS_VERSION_MAX_ALLOWED >= 160400
544
+ if (@available(macOS 13.3, iOS 16.4, tvOS 16.4, *))
545
+ _webView.inspectable = _webviewDebuggingEnabled;
546
+ #endif
547
+
497
548
  [self addSubview:_webView];
498
549
  [self setHideKeyboardAccessoryView: _savedHideKeyboardAccessoryView];
499
550
  [self setKeyboardDisplayRequiresUserAction: _savedKeyboardDisplayRequiresUserAction];
@@ -504,7 +555,7 @@ RCTAutoInsetsProtocol>
504
555
  if (self.menuItems != nil) {
505
556
  UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(startLongPress:)];
506
557
  longPress.delegate = self;
507
-
558
+
508
559
  longPress.minimumPressDuration = 0.4f;
509
560
  longPress.numberOfTouchesRequired = 1;
510
561
  longPress.cancelsTouchesInView = YES;
@@ -519,7 +570,21 @@ RCTAutoInsetsProtocol>
519
570
  _webView.allowsBackForwardNavigationGestures = _allowsBackForwardNavigationGestures;
520
571
  }
521
572
 
573
+ #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130300 || \
574
+ __IPHONE_OS_VERSION_MAX_ALLOWED >= 160400 || \
575
+ __TV_OS_VERSION_MAX_ALLOWED >= 160400
576
+ - (void)setWebviewDebuggingEnabled:(BOOL)webviewDebuggingEnabled {
577
+ _webviewDebuggingEnabled = webviewDebuggingEnabled;
578
+ if (@available(macOS 13.3, iOS 16.4, tvOS 16.4, *))
579
+ _webView.inspectable = _webviewDebuggingEnabled;
580
+ }
581
+ #endif
582
+
583
+ #ifdef RCT_NEW_ARCH_ENABLED
584
+ - (void)destroyWebView
585
+ #else
522
586
  - (void)removeFromSuperview
587
+ #endif
523
588
  {
524
589
  if (_webView) {
525
590
  [_webView.configuration.userContentController removeScriptMessageHandlerForName:HistoryShimName];
@@ -528,6 +593,10 @@ RCTAutoInsetsProtocol>
528
593
  [_webView removeFromSuperview];
529
594
  #if !TARGET_OS_OSX
530
595
  _webView.scrollView.delegate = nil;
596
+ if (_menuItems) {
597
+ UIMenuController *menuController = [UIMenuController sharedMenuController];
598
+ menuController.menuItems = nil;
599
+ }
531
600
  #endif // !TARGET_OS_OSX
532
601
  _webView = nil;
533
602
  if (_onContentProcessDidTerminate) {
@@ -535,8 +604,10 @@ RCTAutoInsetsProtocol>
535
604
  _onContentProcessDidTerminate(event);
536
605
  }
537
606
  }
538
-
607
+
608
+ #ifndef RCT_NEW_ARCH_ENABLED
539
609
  [super removeFromSuperview];
610
+ #endif
540
611
  }
541
612
 
542
613
  #if !TARGET_OS_OSX
@@ -546,7 +617,7 @@ RCTAutoInsetsProtocol>
546
617
  if (!_autoManageStatusBarEnabled) {
547
618
  return;
548
619
  }
549
-
620
+
550
621
  _isFullScreenVideoOpen = YES;
551
622
  RCTUnsafeExecuteOnMainQueueSync(^{
552
623
  [RCTSharedApplication() setStatusBarStyle:self->_savedStatusBarStyle animated:YES];
@@ -560,7 +631,7 @@ RCTAutoInsetsProtocol>
560
631
  if (!_autoManageStatusBarEnabled) {
561
632
  return;
562
633
  }
563
-
634
+
564
635
  _isFullScreenVideoOpen = NO;
565
636
  RCTUnsafeExecuteOnMainQueueSync(^{
566
637
  [RCTSharedApplication() setStatusBarHidden:self->_savedStatusBarHidden animated:YES];
@@ -619,7 +690,7 @@ RCTAutoInsetsProtocol>
619
690
  if (_webView == nil) {
620
691
  return;
621
692
  }
622
-
693
+
623
694
  CGFloat alpha = CGColorGetAlpha(backgroundColor.CGColor);
624
695
  BOOL opaque = (alpha == 1.0);
625
696
  #if !TARGET_OS_OSX
@@ -637,21 +708,22 @@ RCTAutoInsetsProtocol>
637
708
  #endif // !TARGET_OS_OSX
638
709
  }
639
710
 
640
- #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
711
+ #if !TARGET_OS_OSX
641
712
  - (void)setContentInsetAdjustmentBehavior:(UIScrollViewContentInsetAdjustmentBehavior)behavior
642
713
  {
643
714
  _savedContentInsetAdjustmentBehavior = behavior;
644
715
  if (_webView == nil) {
645
716
  return;
646
717
  }
647
-
718
+
648
719
  if ([_webView.scrollView respondsToSelector:@selector(setContentInsetAdjustmentBehavior:)]) {
649
720
  CGPoint contentOffset = _webView.scrollView.contentOffset;
650
721
  _webView.scrollView.contentInsetAdjustmentBehavior = behavior;
651
722
  _webView.scrollView.contentOffset = contentOffset;
652
723
  }
653
724
  }
654
- #endif
725
+ #endif // !TARGET_OS_OSX
726
+
655
727
  #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */
656
728
  - (void)setAutomaticallyAdjustsScrollIndicatorInsets:(BOOL)automaticallyAdjustsScrollIndicatorInsets{
657
729
  _savedAutomaticallyAdjustsScrollIndicatorInsets = automaticallyAdjustsScrollIndicatorInsets;
@@ -663,6 +735,7 @@ RCTAutoInsetsProtocol>
663
735
  }
664
736
  }
665
737
  #endif
738
+
666
739
  /**
667
740
  * This method is called whenever JavaScript running within the web view calls:
668
741
  * - window.webkit.messageHandlers[MessageHandlerName].postMessage
@@ -689,7 +762,7 @@ RCTAutoInsetsProtocol>
689
762
  {
690
763
  if (![_source isEqualToDictionary:source]) {
691
764
  _source = [source copy];
692
-
765
+
693
766
  if (_webView != nil) {
694
767
  [self visitSource];
695
768
  }
@@ -700,7 +773,7 @@ RCTAutoInsetsProtocol>
700
773
  {
701
774
  if (![_allowingReadAccessToURL isEqualToString:allowingReadAccessToURL]) {
702
775
  _allowingReadAccessToURL = [allowingReadAccessToURL copy];
703
-
776
+
704
777
  if (_webView != nil) {
705
778
  [self visitSource];
706
779
  }
@@ -744,62 +817,74 @@ RCTAutoInsetsProtocol>
744
817
  NSArray *httpCookies = [NSHTTPCookie cookiesWithResponseHeaderFields:headers forURL:urlString];
745
818
  [self writeCookiesToWebView:httpCookies completion:nil];
746
819
  }
747
-
820
+
748
821
  NSURLRequest *request = [self requestForSource:_source];
749
-
822
+ __weak WKWebView *webView = _webView;
823
+ NSString *allowingReadAccessToURL = _allowingReadAccessToURL;
824
+
750
825
  [self syncCookiesToWebView:^{
751
826
  // Because of the way React works, as pages redirect, we actually end up
752
827
  // passing the redirect urls back here, so we ignore them if trying to load
753
828
  // the same url. We'll expose a call to 'reload' to allow a user to load
754
829
  // the existing page.
755
- if ([request.URL isEqual:_webView.URL]) {
830
+ if ([request.URL isEqual:webView.URL]) {
756
831
  return;
757
832
  }
758
833
  if (!request.URL) {
759
834
  // Clear the webview
760
- [_webView loadHTMLString:@"" baseURL:nil];
835
+ [webView loadHTMLString:@"" baseURL:nil];
761
836
  return;
762
837
  }
763
838
  if (request.URL.host) {
764
- [_webView loadRequest:request];
839
+ [webView loadRequest:request];
765
840
  }
766
841
  else {
767
- NSURL* readAccessUrl = _allowingReadAccessToURL ? [RCTConvert NSURL:_allowingReadAccessToURL] : request.URL;
768
- [_webView loadFileURL:request.URL allowingReadAccessToURL:readAccessUrl];
842
+ NSURL* readAccessUrl = allowingReadAccessToURL ? [RCTConvert NSURL:allowingReadAccessToURL] : request.URL;
843
+ [webView loadFileURL:request.URL allowingReadAccessToURL:readAccessUrl];
769
844
  }
770
845
  }];
771
846
  }
772
847
 
773
848
  #if !TARGET_OS_OSX
849
+ -(void)setMenuItems:(NSArray<NSDictionary *> *)menuItems {
850
+ _menuItems = menuItems;
851
+ _webView.menuItems = menuItems;
852
+ }
853
+
854
+ -(void)setSuppressMenuItems:(NSArray<NSString *> *)suppressMenuItems {
855
+ _suppressMenuItems = suppressMenuItems;
856
+ _webView.suppressMenuItems = suppressMenuItems;
857
+ }
858
+
774
859
  -(void)setKeyboardDisplayRequiresUserAction:(BOOL)keyboardDisplayRequiresUserAction
775
860
  {
776
861
  if (_webView == nil) {
777
862
  _savedKeyboardDisplayRequiresUserAction = keyboardDisplayRequiresUserAction;
778
863
  return;
779
864
  }
780
-
865
+
781
866
  if (_savedKeyboardDisplayRequiresUserAction == true) {
782
867
  return;
783
868
  }
784
-
869
+
785
870
  UIView* subview;
786
-
871
+
787
872
  for (UIView* view in _webView.scrollView.subviews) {
788
873
  if([[view.class description] hasPrefix:@"WK"])
789
874
  subview = view;
790
875
  }
791
-
876
+
792
877
  if(subview == nil) return;
793
-
878
+
794
879
  Class class = subview.class;
795
-
880
+
796
881
  NSOperatingSystemVersion iOS_11_3_0 = (NSOperatingSystemVersion){11, 3, 0};
797
882
  NSOperatingSystemVersion iOS_12_2_0 = (NSOperatingSystemVersion){12, 2, 0};
798
883
  NSOperatingSystemVersion iOS_13_0_0 = (NSOperatingSystemVersion){13, 0, 0};
799
-
884
+
800
885
  Method method;
801
886
  IMP override;
802
-
887
+
803
888
  if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion: iOS_13_0_0]) {
804
889
  // iOS 13.0.0 - Future
805
890
  SEL selector = sel_getUid("_elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:");
@@ -835,7 +920,7 @@ RCTAutoInsetsProtocol>
835
920
  ((void (*)(id, SEL, void*, BOOL, BOOL, id))original)(me, selector, arg0, TRUE, arg2, arg3);
836
921
  });
837
922
  }
838
-
923
+
839
924
  method_setImplementation(method, override);
840
925
  }
841
926
 
@@ -845,34 +930,34 @@ RCTAutoInsetsProtocol>
845
930
  _savedHideKeyboardAccessoryView = hideKeyboardAccessoryView;
846
931
  return;
847
932
  }
848
-
933
+
849
934
  if (_savedHideKeyboardAccessoryView == false) {
850
935
  return;
851
936
  }
852
-
937
+
853
938
  UIView* subview;
854
-
939
+
855
940
  for (UIView* view in _webView.scrollView.subviews) {
856
941
  if([[view.class description] hasPrefix:@"WK"])
857
942
  subview = view;
858
943
  }
859
-
944
+
860
945
  if(subview == nil) return;
861
-
946
+
862
947
  NSString* name = [NSString stringWithFormat:@"%@_BPSwizzleHelperWK", subview.class.superclass];
863
948
  Class newClass = NSClassFromString(name);
864
-
949
+
865
950
  if(newClass == nil)
866
951
  {
867
952
  newClass = objc_allocateClassPair(subview.class, [name cStringUsingEncoding:NSASCIIStringEncoding], 0);
868
953
  if(!newClass) return;
869
-
954
+
870
955
  Method method = class_getInstanceMethod([_BPSwizzleHelperWK class], @selector(inputAccessoryView));
871
956
  class_addMethod(newClass, @selector(inputAccessoryView), method_getImplementation(method), method_getTypeEncoding(method));
872
-
957
+
873
958
  objc_registerClassPair(newClass);
874
959
  }
875
-
960
+
876
961
  object_setClass(subview, newClass);
877
962
  }
878
963
 
@@ -963,8 +1048,8 @@ RCTAutoInsetsProtocol>
963
1048
  - (void)layoutSubviews
964
1049
  {
965
1050
  [super layoutSubviews];
966
-
967
- // Ensure webview takes the position and dimensions of BPCWebView
1051
+
1052
+ // Ensure webview takes the position and dimensions of BPCWebViewImpl
968
1053
  _webView.frame = self.bounds;
969
1054
  #if !TARGET_OS_OSX
970
1055
  _webView.scrollView.contentInset = _contentInset;
@@ -1105,7 +1190,7 @@ RCTAutoInsetsProtocol>
1105
1190
  #else
1106
1191
  NSAlert *alert = [[NSAlert alloc] init];
1107
1192
  [alert setMessageText:prompt];
1108
-
1193
+
1109
1194
  const NSRect RCTSingleTextFieldFrame = NSMakeRect(0.0, 0.0, 275.0, 22.0);
1110
1195
  NSTextField *textField = [[NSTextField alloc] initWithFrame:RCTSingleTextFieldFrame];
1111
1196
  textField.cell.scrollable = YES;
@@ -1114,7 +1199,7 @@ RCTAutoInsetsProtocol>
1114
1199
  }
1115
1200
  textField.stringValue = defaultText;
1116
1201
  [alert setAccessoryView:textField];
1117
-
1202
+
1118
1203
  [alert addButtonWithTitle:NSLocalizedString(@"OK", @"OK button")];
1119
1204
  [alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"Cancel button")];
1120
1205
  [alert beginSheetModalForWindow:[NSApp keyWindow] completionHandler:^(NSModalResponse response) {
@@ -1167,14 +1252,13 @@ RCTAutoInsetsProtocol>
1167
1252
  * Decides whether to allow or cancel a navigation.
1168
1253
  * @see https://fburl.com/42r9fxob
1169
1254
  */
1170
-
1171
- - (void) webView:(WKWebView *)webView
1255
+ - (void) webView:(WKWebView *)webView
1172
1256
  decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction
1173
1257
  decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
1174
- {
1175
- NSString *url = navigationAction.request.URL.absoluteString;
1258
+ {
1259
+ NSString *url = navigationAction.request.URL.absoluteString;
1176
1260
 
1177
- _beforeUrl = url;
1261
+ // _beforeUrl = url;
1178
1262
 
1179
1263
  // [self updateBlindViewIfNaverLogin:url];
1180
1264
 
@@ -1190,7 +1274,8 @@ RCTAutoInsetsProtocol>
1190
1274
  [self webViewRN:webView decidePolicyForNavigationAction:navigationAction decisionHandler:decisionHandler];
1191
1275
  //decisionHandler(WKNavigationActionPolicyAllow);
1192
1276
  }
1193
- }
1277
+
1278
+ }
1194
1279
 
1195
1280
 
1196
1281
  - (void) webViewRN:(WKWebView *)webView
@@ -1199,54 +1284,91 @@ RCTAutoInsetsProtocol>
1199
1284
  {
1200
1285
  static NSDictionary<NSNumber *, NSString *> *navigationTypes;
1201
1286
  static dispatch_once_t onceToken;
1202
-
1287
+
1203
1288
  dispatch_once(&onceToken, ^{
1204
- navigationTypes = @{
1205
- @(WKNavigationTypeLinkActivated): @"click",
1206
- @(WKNavigationTypeFormSubmitted): @"formsubmit",
1207
- @(WKNavigationTypeBackForward): @"backforward",
1208
- @(WKNavigationTypeReload): @"reload",
1209
- @(WKNavigationTypeFormResubmitted): @"formresubmit",
1210
- @(WKNavigationTypeOther): @"other",
1211
- };
1289
+ navigationTypes = @{
1290
+ @(WKNavigationTypeLinkActivated): @"click",
1291
+ @(WKNavigationTypeFormSubmitted): @"formsubmit",
1292
+ @(WKNavigationTypeBackForward): @"backforward",
1293
+ @(WKNavigationTypeReload): @"reload",
1294
+ @(WKNavigationTypeFormResubmitted): @"formresubmit",
1295
+ @(WKNavigationTypeOther): @"other",
1296
+ };
1212
1297
  });
1213
-
1298
+
1214
1299
  WKNavigationType navigationType = navigationAction.navigationType;
1215
1300
  NSURLRequest *request = navigationAction.request;
1216
1301
  BOOL isTopFrame = [request.URL isEqual:request.mainDocumentURL];
1217
-
1218
- if (_onShouldStartLoadWithRequest) {
1302
+ BOOL hasTargetFrame = navigationAction.targetFrame != nil;
1303
+
1304
+ if (_onOpenWindow && !hasTargetFrame) {
1305
+ // When OnOpenWindow should be called, we want to prevent the navigation
1306
+ // If not prevented, the `decisionHandler` is called first and after that `createWebViewWithConfiguration` is called
1307
+ // In that order the WebView's ref would be updated with the target URL even if `createWebViewWithConfiguration` does not call `loadRequest`
1308
+ // So the WebView's document stays on the current URL, but the WebView's ref is replaced by the target URL
1309
+ // By preventing the navigation here, we also prevent the WebView's ref mutation
1310
+ // The counterpart is that we have to manually call `_onOpenWindow` here, because no navigation means no call to `createWebViewWithConfiguration`
1219
1311
  NSMutableDictionary<NSString *, id> *event = [self baseEvent];
1220
- if (request.mainDocumentURL) {
1312
+ [event addEntriesFromDictionary: @{@"targetUrl": request.URL.absoluteString}];
1313
+ decisionHandler(WKNavigationActionPolicyCancel);
1314
+ _onOpenWindow(event);
1315
+ return;
1316
+ }
1317
+
1318
+ if (_onShouldStartLoadWithRequest) {
1319
+ NSMutableDictionary<NSString *, id> *event = [self baseEvent];
1320
+ int lockIdentifier = [[BPCWebViewDecisionManager getInstance] setDecisionHandler: ^(BOOL shouldStart){
1321
+ dispatch_async(dispatch_get_main_queue(), ^{
1322
+ if (!shouldStart) {
1323
+ decisionHandler(WKNavigationActionPolicyCancel);
1324
+ return;
1325
+ }
1326
+ if (self->_onLoadingStart) {
1327
+ // We have this check to filter out iframe requests and whatnot
1328
+ if (isTopFrame) {
1329
+ NSMutableDictionary<NSString *, id> *event = [self baseEvent];
1330
+ [event addEntriesFromDictionary: @{
1331
+ @"url": (request.URL).absoluteString,
1332
+ @"navigationType": navigationTypes[@(navigationType)]
1333
+ }];
1334
+ self->_onLoadingStart(event);
1335
+ }
1336
+ }
1337
+
1338
+ // Allow all navigation by default
1339
+ decisionHandler(WKNavigationActionPolicyAllow);
1340
+ });
1341
+
1342
+ }];
1343
+ if (request.mainDocumentURL) {
1344
+ [event addEntriesFromDictionary: @{
1345
+ @"mainDocumentURL": (request.mainDocumentURL).absoluteString,
1346
+ }];
1347
+ }
1221
1348
  [event addEntriesFromDictionary: @{
1222
- @"mainDocumentURL": (request.mainDocumentURL).absoluteString,
1349
+ @"url": (request.URL).absoluteString,
1350
+ @"navigationType": navigationTypes[@(navigationType)],
1351
+ @"isTopFrame": @(isTopFrame),
1352
+ @"hasTargetFrame": @(hasTargetFrame),
1353
+ @"lockIdentifier": @(lockIdentifier)
1223
1354
  }];
1224
- }
1225
- [event addEntriesFromDictionary: @{
1226
- @"url": (request.URL).absoluteString,
1227
- @"navigationType": navigationTypes[@(navigationType)],
1228
- @"isTopFrame": @(isTopFrame)
1229
- }];
1230
- if (![self.delegate webView:self
1231
- shouldStartLoadForRequest:event
1232
- withCallback:_onShouldStartLoadWithRequest]) {
1233
- decisionHandler(WKNavigationActionPolicyCancel);
1355
+ _onShouldStartLoadWithRequest(event);
1356
+ // decisionHandler(WKNavigationActionPolicyAllow);
1234
1357
  return;
1235
- }
1236
1358
  }
1237
-
1359
+
1238
1360
  if (_onLoadingStart) {
1239
- // We have this check to filter out iframe requests and whatnot
1240
- if (isTopFrame) {
1241
- NSMutableDictionary<NSString *, id> *event = [self baseEvent];
1242
- [event addEntriesFromDictionary: @{
1243
- @"url": (request.URL).absoluteString,
1244
- @"navigationType": navigationTypes[@(navigationType)]
1245
- }];
1246
- _onLoadingStart(event);
1247
- }
1361
+ // We have this check to filter out iframe requests and whatnot
1362
+ if (isTopFrame) {
1363
+ NSMutableDictionary<NSString *, id> *event = [self baseEvent];
1364
+ [event addEntriesFromDictionary: @{
1365
+ @"url": (request.URL).absoluteString,
1366
+ @"navigationType": navigationTypes[@(navigationType)]
1367
+ }];
1368
+ _onLoadingStart(event);
1369
+ }
1248
1370
  }
1249
-
1371
+
1250
1372
  // Allow all navigation by default
1251
1373
  decisionHandler(WKNavigationActionPolicyAllow);
1252
1374
  }
@@ -1277,26 +1399,26 @@ RCTAutoInsetsProtocol>
1277
1399
  if ([navigationResponse.response isKindOfClass:[NSHTTPURLResponse class]]) {
1278
1400
  NSHTTPURLResponse *response = (NSHTTPURLResponse *)navigationResponse.response;
1279
1401
  NSInteger statusCode = response.statusCode;
1280
-
1402
+
1281
1403
  if (statusCode >= 400) {
1282
1404
  NSMutableDictionary<NSString *, id> *httpErrorEvent = [self baseEvent];
1283
1405
  [httpErrorEvent addEntriesFromDictionary: @{
1284
1406
  @"url": response.URL.absoluteString,
1285
1407
  @"statusCode": @(statusCode)
1286
1408
  }];
1287
-
1409
+
1288
1410
  _onHttpError(httpErrorEvent);
1289
1411
  }
1290
-
1412
+
1291
1413
  NSString *disposition = nil;
1292
- if (@available(iOS 13, *)) {
1414
+ if (@available(iOS 13, macOS 10.15, *)) {
1293
1415
  disposition = [response valueForHTTPHeaderField:@"Content-Disposition"];
1294
1416
  }
1295
1417
  BOOL isAttachment = disposition != nil && [disposition hasPrefix:@"attachment"];
1296
1418
  if (isAttachment || !navigationResponse.canShowMIMEType) {
1297
1419
  if (_onFileDownload) {
1298
1420
  policy = WKNavigationResponsePolicyCancel;
1299
-
1421
+
1300
1422
  NSMutableDictionary<NSString *, id> *downloadEvent = [self baseEvent];
1301
1423
  [downloadEvent addEntriesFromDictionary: @{
1302
1424
  @"downloadUrl": (response.URL).absoluteString,
@@ -1306,7 +1428,7 @@ RCTAutoInsetsProtocol>
1306
1428
  }
1307
1429
  }
1308
1430
  }
1309
-
1431
+
1310
1432
  decisionHandler(policy);
1311
1433
  }
1312
1434
 
@@ -1326,7 +1448,7 @@ RCTAutoInsetsProtocol>
1326
1448
  // http://stackoverflow.com/questions/1024748/how-do-i-fix-nsurlerrordomain-error-999-in-iphone-3-0-os
1327
1449
  return;
1328
1450
  }
1329
-
1451
+
1330
1452
  if ([error.domain isEqualToString:@"WebKitErrorDomain"] &&
1331
1453
  (error.code == 102 || error.code == 101)) {
1332
1454
  // Error code 102 "Frame load interrupted" is raised by the WKWebView
@@ -1334,7 +1456,7 @@ RCTAutoInsetsProtocol>
1334
1456
  // implementing OAuth with a WebView.
1335
1457
  return;
1336
1458
  }
1337
-
1459
+
1338
1460
  NSMutableDictionary<NSString *, id> *event = [self baseEvent];
1339
1461
  [event addEntriesFromDictionary:@{
1340
1462
  @"didFailProvisionalNavigation": @YES,
@@ -1412,13 +1534,15 @@ didFinishNavigation:(WKNavigation *)navigation
1412
1534
 
1413
1535
  - (void)cookiesDidChangeInCookieStore:(WKHTTPCookieStore *)cookieStore
1414
1536
  {
1415
- if(_sharedCookiesEnabled && @available(iOS 11.0, *)) {
1416
- // Write all cookies from WKWebView back to sharedHTTPCookieStorage
1417
- [cookieStore getAllCookies:^(NSArray* cookies) {
1418
- for (NSHTTPCookie *cookie in cookies) {
1419
- [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:cookie];
1420
- }
1421
- }];
1537
+ if (@available(iOS 11.0, *)) {
1538
+ if(_sharedCookiesEnabled) {
1539
+ // Write all cookies from WKWebView back to sharedHTTPCookieStorage
1540
+ [cookieStore getAllCookies:^(NSArray* cookies) {
1541
+ for (NSHTTPCookie *cookie in cookies) {
1542
+ [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:cookie];
1543
+ }
1544
+ }];
1545
+ }
1422
1546
  }
1423
1547
  }
1424
1548
 
@@ -1445,7 +1569,7 @@ didFinishNavigation:(WKNavigation *)navigation
1445
1569
  * manually call [_webView loadRequest:request].
1446
1570
  */
1447
1571
  NSURLRequest *request = [self requestForSource:self.source];
1448
-
1572
+
1449
1573
  if (request.URL && !_webView.URL.absoluteString.length) {
1450
1574
  [_webView loadRequest:request];
1451
1575
  } else {
@@ -1471,13 +1595,13 @@ didFinishNavigation:(WKNavigation *)navigation
1471
1595
  - (void)setPullToRefreshEnabled:(BOOL)pullToRefreshEnabled
1472
1596
  {
1473
1597
  _pullToRefreshEnabled = pullToRefreshEnabled;
1474
-
1598
+
1475
1599
  if (pullToRefreshEnabled) {
1476
1600
  [self addPullToRefreshControl];
1477
1601
  } else {
1478
1602
  [_refreshControl removeFromSuperview];
1479
1603
  }
1480
-
1604
+
1481
1605
  [self setBounces:_bounces];
1482
1606
  }
1483
1607
  #endif // !TARGET_OS_OSX
@@ -1494,6 +1618,37 @@ didFinishNavigation:(WKNavigation *)navigation
1494
1618
  #endif // !TARGET_OS_OSX
1495
1619
  }
1496
1620
 
1621
+ - (void)clearCache:(BOOL)includeDiskFiles
1622
+ {
1623
+ NSMutableSet *dataTypes = [NSMutableSet setWithArray:@[
1624
+ WKWebsiteDataTypeMemoryCache,
1625
+ WKWebsiteDataTypeOfflineWebApplicationCache,
1626
+ ]];
1627
+ if (@available(iOS 11.3, *)) {
1628
+ [dataTypes addObject:WKWebsiteDataTypeFetchCache];
1629
+ }
1630
+ if (includeDiskFiles) {
1631
+ [dataTypes addObjectsFromArray:@[
1632
+ WKWebsiteDataTypeDiskCache,
1633
+ WKWebsiteDataTypeSessionStorage,
1634
+ WKWebsiteDataTypeLocalStorage,
1635
+ WKWebsiteDataTypeWebSQLDatabases,
1636
+ WKWebsiteDataTypeIndexedDBDatabases
1637
+ ]];
1638
+ }
1639
+ [self removeData:dataTypes];
1640
+ }
1641
+
1642
+ - (void)removeData:(NSSet *)dataTypes
1643
+ {
1644
+ if (_webView == nil) {
1645
+ return;
1646
+ }
1647
+ NSDate *dateFrom = [NSDate dateWithTimeIntervalSince1970:0];
1648
+
1649
+ [_webView.configuration.websiteDataStore removeDataOfTypes:dataTypes modifiedSince:dateFrom completionHandler:^{}];
1650
+ }
1651
+
1497
1652
  #if !TARGET_OS_OSX
1498
1653
  - (void)setBounces:(BOOL)bounces
1499
1654
  {
@@ -1505,23 +1660,30 @@ didFinishNavigation:(WKNavigation *)navigation
1505
1660
 
1506
1661
  - (void)setInjectedJavaScript:(NSString *)source {
1507
1662
  _injectedJavaScript = source;
1508
-
1663
+
1509
1664
  self.atEndScript = source == nil ? nil : [[WKUserScript alloc] initWithSource:source
1510
1665
  injectionTime:WKUserScriptInjectionTimeAtDocumentEnd
1511
1666
  forMainFrameOnly:_injectedJavaScriptForMainFrameOnly];
1512
-
1667
+
1513
1668
  if(_webView != nil){
1514
1669
  [self resetupScripts:_webView.configuration];
1515
1670
  }
1516
1671
  }
1517
1672
 
1673
+ - (void)setEnableApplePay:(BOOL)enableApplePay {
1674
+ _enableApplePay = enableApplePay;
1675
+ if(_webView != nil){
1676
+ [self resetupScripts:_webView.configuration];
1677
+ }
1678
+ }
1679
+
1518
1680
  - (void)setInjectedJavaScriptBeforeContentLoaded:(NSString *)source {
1519
1681
  _injectedJavaScriptBeforeContentLoaded = source;
1520
-
1682
+
1521
1683
  self.atStartScript = source == nil ? nil : [[WKUserScript alloc] initWithSource:source
1522
1684
  injectionTime:WKUserScriptInjectionTimeAtDocumentStart
1523
1685
  forMainFrameOnly:_injectedJavaScriptBeforeContentLoadedForMainFrameOnly];
1524
-
1686
+
1525
1687
  if(_webView != nil){
1526
1688
  [self resetupScripts:_webView.configuration];
1527
1689
  }
@@ -1539,7 +1701,7 @@ didFinishNavigation:(WKNavigation *)navigation
1539
1701
 
1540
1702
  - (void)setMessagingEnabled:(BOOL)messagingEnabled {
1541
1703
  _messagingEnabled = messagingEnabled;
1542
-
1704
+
1543
1705
  self.postMessageScript = _messagingEnabled ?
1544
1706
  [
1545
1707
  [WKUserScript alloc]
@@ -1559,7 +1721,7 @@ didFinishNavigation:(WKNavigation *)navigation
1559
1721
  forMainFrameOnly:YES
1560
1722
  ] :
1561
1723
  nil;
1562
-
1724
+
1563
1725
  if(_webView != nil){
1564
1726
  [self resetupScripts:_webView.configuration];
1565
1727
  }
@@ -1567,22 +1729,28 @@ didFinishNavigation:(WKNavigation *)navigation
1567
1729
 
1568
1730
  - (void)writeCookiesToWebView:(NSArray<NSHTTPCookie *>*)cookies completion:(void (^)(void))completion {
1569
1731
  // The required cookie APIs only became available on iOS 11
1570
- if(_sharedCookiesEnabled && @available(iOS 11.0, *)) {
1571
- dispatch_async(dispatch_get_main_queue(), ^{
1572
- dispatch_group_t group = dispatch_group_create();
1573
- for (NSHTTPCookie *cookie in cookies) {
1574
- dispatch_group_enter(group);
1575
- [_webView.configuration.websiteDataStore.httpCookieStore setCookie:cookie completionHandler:^{
1576
- dispatch_group_leave(group);
1577
- }];
1578
- }
1579
- dispatch_group_notify(group, dispatch_get_main_queue(), ^{
1580
- if (completion) {
1581
- completion();
1732
+ if (@available(iOS 11.0, *)) {
1733
+ if (_sharedCookiesEnabled) {
1734
+ __weak WKWebView *webView = _webView;
1735
+ dispatch_async(dispatch_get_main_queue(), ^{
1736
+ dispatch_group_t group = dispatch_group_create();
1737
+ for (NSHTTPCookie *cookie in cookies) {
1738
+ dispatch_group_enter(group);
1739
+ [webView.configuration.websiteDataStore.httpCookieStore setCookie:cookie completionHandler:^{
1740
+ dispatch_group_leave(group);
1741
+ }];
1582
1742
  }
1743
+ dispatch_group_notify(group, dispatch_get_main_queue(), ^{
1744
+ if (completion) {
1745
+ completion();
1746
+ }
1747
+ });
1583
1748
  });
1584
- });
1585
- } else if (completion) {
1749
+ return;
1750
+ }
1751
+ }
1752
+
1753
+ if (completion) {
1586
1754
  completion();
1587
1755
  }
1588
1756
  }
@@ -1602,7 +1770,7 @@ didFinishNavigation:(WKNavigation *)navigation
1602
1770
  }
1603
1771
  return;
1604
1772
  }
1605
-
1773
+
1606
1774
  NSString *html5HistoryAPIShimSource = [NSString stringWithFormat:
1607
1775
  @"(function(history) {\n"
1608
1776
  " function notify(type) {\n"
@@ -1625,7 +1793,7 @@ didFinishNavigation:(WKNavigation *)navigation
1625
1793
  ];
1626
1794
  WKUserScript *script = [[WKUserScript alloc] initWithSource:html5HistoryAPIShimSource injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:YES];
1627
1795
  [wkWebViewConfig.userContentController addUserScript:script];
1628
-
1796
+
1629
1797
  if(_sharedCookiesEnabled) {
1630
1798
  // More info to sending cookies with WKWebView
1631
1799
  // https://stackoverflow.com/questions/26573137/can-i-set-the-cookies-to-be-used-by-a-wkwebview/26577303#26577303
@@ -1641,7 +1809,7 @@ didFinishNavigation:(WKNavigation *)navigation
1641
1809
  }];
1642
1810
  } else {
1643
1811
  NSMutableString *script = [NSMutableString string];
1644
-
1812
+
1645
1813
  // Clear all existing cookies in a direct called function. This ensures that no
1646
1814
  // javascript error will break the web content javascript.
1647
1815
  // We keep this code here, if someone requires that Cookies are also removed within the
@@ -1659,7 +1827,7 @@ didFinishNavigation:(WKNavigation *)navigation
1659
1827
  [script appendString:@" }\n"];
1660
1828
  [script appendString:@"})();\n\n"];
1661
1829
  */
1662
-
1830
+
1663
1831
  // Set cookies in a direct called function. This ensures that no
1664
1832
  // javascript error will break the web content javascript.
1665
1833
  // Generates JS: document.cookie = "key=value; Path=/; Expires=Thu, 01 Jan 20xx 00:00:01 GMT;"
@@ -1680,14 +1848,14 @@ didFinishNavigation:(WKNavigation *)navigation
1680
1848
  [script appendString:@";\n"];
1681
1849
  }
1682
1850
  [script appendString:@"})();\n"];
1683
-
1851
+
1684
1852
  WKUserScript* cookieInScript = [[WKUserScript alloc] initWithSource:script
1685
1853
  injectionTime:WKUserScriptInjectionTimeAtDocumentStart
1686
1854
  forMainFrameOnly:YES];
1687
1855
  [wkWebViewConfig.userContentController addUserScript:cookieInScript];
1688
1856
  }
1689
1857
  }
1690
-
1858
+
1691
1859
  if(_messagingEnabled){
1692
1860
  if (self.postMessageScript){
1693
1861
  [wkWebViewConfig.userContentController addScriptMessageHandler:[[BPCWeakScriptMessageDelegate alloc] initWithDelegate:self]
@@ -1706,7 +1874,7 @@ didFinishNavigation:(WKNavigation *)navigation
1706
1874
 
1707
1875
  - (NSURLRequest *)requestForSource:(id)json {
1708
1876
  NSURLRequest *request = [RCTConvert NSURLRequest:self.source];
1709
-
1877
+
1710
1878
  // If sharedCookiesEnabled we automatically add all application cookies to the
1711
1879
  // http request. This is automatically done on iOS 11+ in the WebView constructor.
1712
1880
  // Se we need to manually add these shared cookies here only for iOS versions < 11.
@@ -1738,14 +1906,14 @@ didFinishNavigation:(WKNavigation *)navigation
1738
1906
  }
1739
1907
 
1740
1908
  - (void) naverLoginBugFix {
1741
- if([_beforeUrl hasPrefix:@"naversearchthirdlogin://"]) {
1742
- NSString* value = [self getQueryStringParameter:_beforeUrl :@"session"];
1743
- if(value != nil && [value length] > 0) {
1744
- NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://nid.naver.com/login/scheme.redirect?session=%@", value]];
1745
- NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
1746
- [_webView loadRequest:request];
1747
- }
1748
- }
1909
+ // if([_beforeUrl hasPrefix:@"naversearchthirdlogin://"]) {
1910
+ // NSString* value = [self getQueryStringParameter:_beforeUrl :@"session"];
1911
+ // if(value != nil && [value length] > 0) {
1912
+ // NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://nid.naver.com/login/scheme.redirect?session=%@", value]];
1913
+ // NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
1914
+ // [_webView loadRequest:request];
1915
+ // }
1916
+ // }
1749
1917
  }
1750
1918
 
1751
1919
  - (NSString*) getQueryStringParameter:(NSString*)url :(NSString*)param {
@@ -1872,7 +2040,6 @@ didFinishNavigation:(WKNavigation *)navigation
1872
2040
  [self.scriptDelegate userContentController:userContentController didReceiveScriptMessage:message];
1873
2041
  }
1874
2042
 
1875
-
1876
-
1877
2043
  @end
1878
2044
 
2045
+