react-native-webview-bootpay 11.26.20 → 13.6.1

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 (335) 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} +377 -210
  26. package/apple/BPCWebViewManager.h +4 -8
  27. package/apple/{BPCWebViewManager.m → BPCWebViewManager.mm} +93 -149
  28. package/ios/{BPCWebView.xcodeproj → RNCWebView.xcodeproj}/project.pbxproj +18 -18
  29. package/ios/main.jsbundle +457 -0
  30. package/lib/BPCWebViewNativeComponent.d.ts +242 -0
  31. package/lib/BPCWebViewNativeComponent.d.ts.map +1 -0
  32. package/lib/BPCWebViewNativeComponent.js +6 -0
  33. package/lib/NativeBPCWebView.d.ts +10 -0
  34. package/lib/NativeBPCWebView.d.ts.map +1 -0
  35. package/lib/NativeBPCWebView.js +2 -0
  36. package/lib/WebView.android.d.ts.map +1 -1
  37. package/lib/WebView.android.js +53 -29
  38. package/lib/WebView.ios.d.ts.map +1 -1
  39. package/lib/WebView.ios.js +49 -28
  40. package/lib/WebView.macos.d.ts.map +1 -1
  41. package/lib/WebView.macos.js +10 -14
  42. package/lib/WebView.windows.d.ts.map +1 -1
  43. package/lib/WebView.windows.js +4 -6
  44. package/lib/WebViewNativeComponent.macos.d.ts +2 -2
  45. package/lib/WebViewNativeComponent.macos.js +2 -2
  46. package/lib/WebViewShared.d.ts +4 -2
  47. package/lib/WebViewShared.d.ts.map +1 -1
  48. package/lib/WebViewShared.js +8 -2
  49. package/lib/WebViewTypes.d.ts +62 -95
  50. package/lib/WebViewTypes.d.ts.map +1 -1
  51. package/lib/WebViewTypes.js +0 -16
  52. package/macos/RNCWebView.xcodeproj/project.pbxproj +44 -44
  53. package/package.json +38 -20
  54. package/react-native-webview-bootpay.podspec +22 -3
  55. package/react-native.config.js +1 -2
  56. package/src/BPCWebViewNativeComponent.ts +281 -0
  57. package/src/NativeBPCWebView.ts +14 -0
  58. package/src/WebView.android.tsx +229 -0
  59. package/src/WebView.ios.tsx +232 -0
  60. package/src/WebView.macos.tsx +177 -0
  61. package/src/WebView.styles.ts +44 -0
  62. package/src/WebView.tsx +18 -0
  63. package/src/WebView.windows.tsx +156 -0
  64. package/src/WebViewNativeComponent.macos.ts +8 -0
  65. package/src/WebViewNativeComponent.windows.ts +10 -0
  66. package/src/WebViewShared.tsx +235 -0
  67. package/src/WebViewTypes.ts +1287 -0
  68. package/src/__tests__/WebViewShared-test.js +208 -0
  69. package/src/__tests__/__snapshots__/WebViewShared-test.js.snap +8 -0
  70. package/src/index.ts +4 -0
  71. package/windows/ReactNativeWebView/ReactNativeWebView.vcxproj +1 -1
  72. package/windows/ReactNativeWebView/ReactWebView.idl +1 -0
  73. package/windows/ReactNativeWebView/ReactWebView2.cpp +142 -19
  74. package/windows/ReactNativeWebView/ReactWebView2.h +3 -0
  75. package/windows/ReactNativeWebView/ReactWebView2Manager.cpp +29 -5
  76. package/windows/ReactNativeWebView/pch.h +1 -0
  77. package/android/.editorconfig +0 -6
  78. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/results.bin +0 -1
  79. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebChromeClient$1.dex +0 -0
  80. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebChromeClient.dex +0 -0
  81. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebView$1.dex +0 -0
  82. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebView$BPCWebViewBridge.dex +0 -0
  83. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebView$ProgressChangedFilter.dex +0 -0
  84. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebView.dex +0 -0
  85. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewClient.dex +0 -0
  86. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewFileProvider.dex +0 -0
  87. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewManager$1.dex +0 -0
  88. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewManager$2.dex +0 -0
  89. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewManager$3.dex +0 -0
  90. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewManager$4.dex +0 -0
  91. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewManager.dex +0 -0
  92. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule$1.dex +0 -0
  93. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule$2.dex +0 -0
  94. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule$MimeType.dex +0 -0
  95. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock$ShouldOverrideCallbackState.dex +0 -0
  96. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock.dex +0 -0
  97. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule.dex +0 -0
  98. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewPackage.dex +0 -0
  99. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BasicAuthCredential.dex +0 -0
  100. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BuildConfig.dex +0 -0
  101. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/URLUtil.dex +0 -0
  102. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/WebViewConfig.dex +0 -0
  103. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent$Companion.dex +0 -0
  104. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent.dex +0 -0
  105. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent$Companion.dex +0 -0
  106. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent.dex +0 -0
  107. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent$Companion.dex +0 -0
  108. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent.dex +0 -0
  109. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent$Companion.dex +0 -0
  110. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent.dex +0 -0
  111. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent$Companion.dex +0 -0
  112. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent.dex +0 -0
  113. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopMessageEvent$Companion.dex +0 -0
  114. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopMessageEvent.dex +0 -0
  115. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent$Companion.dex +0 -0
  116. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent.dex +0 -0
  117. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent$Companion.dex +0 -0
  118. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent.dex +0 -0
  119. package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/desugar_graph.bin +0 -0
  120. package/android/build/.transforms/88c49d67076e4458a9ddee82f875eb6a/results.bin +0 -1
  121. package/android/build/.transforms/88c49d67076e4458a9ddee82f875eb6a/transformed/classes/classes.dex +0 -0
  122. package/android/build/.transforms/c0e86b44db04fcaf424a5b7ce79324f4/results.bin +0 -1
  123. package/android/build/generated/source/buildConfig/debug/kr/co/bootpay/webview/BuildConfig.java +0 -10
  124. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -106
  125. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +0 -18
  126. package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +0 -4
  127. package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +0 -1
  128. package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
  129. package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
  130. package/android/build/intermediates/compile_symbol_list/debug/R.txt +0 -1861
  131. package/android/build/intermediates/compiled_local_resources/debug/out/xml_file_provider_paths.xml.flat +0 -0
  132. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +0 -2
  133. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +0 -2
  134. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +0 -2
  135. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +0 -2
  136. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +0 -2
  137. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebChromeClient$1.class +0 -0
  138. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebChromeClient.class +0 -0
  139. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebView$1.class +0 -0
  140. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebView$BPCWebViewBridge.class +0 -0
  141. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebView$ProgressChangedFilter.class +0 -0
  142. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebView.class +0 -0
  143. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewClient.class +0 -0
  144. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewFileProvider.class +0 -0
  145. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewManager$1.class +0 -0
  146. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewManager$2.class +0 -0
  147. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewManager$3.class +0 -0
  148. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewManager$4.class +0 -0
  149. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewManager.class +0 -0
  150. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule$1.class +0 -0
  151. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule$2.class +0 -0
  152. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule$MimeType.class +0 -0
  153. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock$ShouldOverrideCallbackState.class +0 -0
  154. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock.class +0 -0
  155. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule.class +0 -0
  156. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BasicAuthCredential.class +0 -0
  157. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BuildConfig.class +0 -0
  158. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/URLUtil.class +0 -0
  159. package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/WebViewConfig.class +0 -0
  160. package/android/build/intermediates/library_java_res/debug/res.jar +0 -0
  161. package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +0 -3
  162. package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +0 -210
  163. package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +0 -106
  164. package/android/build/intermediates/navigation_json/debug/navigation.json +0 -1
  165. package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +0 -18
  166. package/android/build/intermediates/packaged_res/debug/xml/file_provider_paths.xml +0 -6
  167. package/android/build/intermediates/runtime_library_classes_dir/debug/META-INF/react-native-webview-bootpay_debug.kotlin_module +0 -0
  168. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebChromeClient$1.class +0 -0
  169. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebChromeClient.class +0 -0
  170. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebView$1.class +0 -0
  171. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebView$BPCWebViewBridge.class +0 -0
  172. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebView$ProgressChangedFilter.class +0 -0
  173. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebView.class +0 -0
  174. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewClient.class +0 -0
  175. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewFileProvider.class +0 -0
  176. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewManager$1.class +0 -0
  177. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewManager$2.class +0 -0
  178. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewManager$3.class +0 -0
  179. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewManager$4.class +0 -0
  180. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewManager.class +0 -0
  181. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule$1.class +0 -0
  182. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule$2.class +0 -0
  183. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule$MimeType.class +0 -0
  184. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock$ShouldOverrideCallbackState.class +0 -0
  185. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock.class +0 -0
  186. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule.class +0 -0
  187. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewPackage.class +0 -0
  188. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BasicAuthCredential.class +0 -0
  189. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BuildConfig.class +0 -0
  190. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/URLUtil.class +0 -0
  191. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/WebViewConfig.class +0 -0
  192. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent$Companion.class +0 -0
  193. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent.class +0 -0
  194. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent$Companion.class +0 -0
  195. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent.class +0 -0
  196. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent$Companion.class +0 -0
  197. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent.class +0 -0
  198. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent$Companion.class +0 -0
  199. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent.class +0 -0
  200. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent$Companion.class +0 -0
  201. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent.class +0 -0
  202. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopMessageEvent$Companion.class +0 -0
  203. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopMessageEvent.class +0 -0
  204. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent$Companion.class +0 -0
  205. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent.class +0 -0
  206. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent$Companion.class +0 -0
  207. package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent.class +0 -0
  208. package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
  209. package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +0 -1381
  210. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  211. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
  212. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
  213. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
  214. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  215. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
  216. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
  217. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  218. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
  219. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
  220. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
  221. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  222. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
  223. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
  224. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  225. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  226. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  227. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
  228. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  229. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  230. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
  231. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab +0 -0
  232. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream +0 -0
  233. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream.len +0 -0
  234. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.len +0 -0
  235. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at +0 -0
  236. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i +0 -0
  237. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i.len +0 -0
  238. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  239. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  240. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  241. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  242. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  243. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  244. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
  245. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab +0 -0
  246. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.keystream +0 -0
  247. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.keystream.len +0 -0
  248. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.len +0 -0
  249. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.values.at +0 -0
  250. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab_i +0 -0
  251. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab_i.len +0 -0
  252. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  253. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  254. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  255. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
  256. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  257. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  258. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
  259. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  260. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
  261. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
  262. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
  263. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  264. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
  265. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
  266. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  267. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
  268. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
  269. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
  270. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  271. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
  272. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
  273. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  274. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
  275. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
  276. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
  277. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  278. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
  279. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
  280. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +0 -2
  281. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  282. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
  283. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
  284. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
  285. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  286. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
  287. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
  288. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  289. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  290. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  291. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  292. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  293. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
  294. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
  295. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  296. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  297. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  298. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  299. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  300. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  301. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
  302. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  303. package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
  304. package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -229
  305. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  306. package/android/build/tmp/kotlin-classes/debug/META-INF/react-native-webview-bootpay_debug.kotlin_module +0 -0
  307. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/BPCWebViewPackage.class +0 -0
  308. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent$Companion.class +0 -0
  309. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent.class +0 -0
  310. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent$Companion.class +0 -0
  311. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent.class +0 -0
  312. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent$Companion.class +0 -0
  313. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent.class +0 -0
  314. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent$Companion.class +0 -0
  315. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent.class +0 -0
  316. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent$Companion.class +0 -0
  317. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent.class +0 -0
  318. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopMessageEvent$Companion.class +0 -0
  319. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopMessageEvent.class +0 -0
  320. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent$Companion.class +0 -0
  321. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent.class +0 -0
  322. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent$Companion.class +0 -0
  323. package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent.class +0 -0
  324. package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewPackage.kt +0 -15
  325. package/android/src/main/java/kr/co/bootpay/webview/BasicAuthCredential.java +0 -11
  326. package/ios/BPCWebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  327. package/ios/BPCWebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  328. package/ios/BPCWebView.xcodeproj/project.xcworkspace/xcuserdata/ehowlsla.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  329. package/ios/BPCWebView.xcodeproj/xcuserdata/ehowlsla.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  330. package/lib/WebViewNativeComponent.android.d.ts +0 -4
  331. package/lib/WebViewNativeComponent.android.d.ts.map +0 -1
  332. package/lib/WebViewNativeComponent.android.js +0 -3
  333. package/lib/WebViewNativeComponent.ios.d.ts +0 -4
  334. package/lib/WebViewNativeComponent.ios.d.ts.map +0 -1
  335. package/lib/WebViewNativeComponent.ios.js +0 -3
@@ -0,0 +1,208 @@
1
+ import { Linking } from 'react-native';
2
+
3
+ import {
4
+ defaultOriginWhitelist,
5
+ createOnShouldStartLoadWithRequest,
6
+ } from '../WebViewShared';
7
+
8
+ Linking.openURL.mockResolvedValue(undefined);
9
+ Linking.canOpenURL.mockResolvedValue(true);
10
+
11
+ // The tests that call createOnShouldStartLoadWithRequest will cause a promise
12
+ // to get kicked off (by calling the mocked `Linking.canOpenURL`) that the tests
13
+ // _need_ to get run to completion _before_ doing any `expect`ing. The reason
14
+ // is: once that promise is resolved another function should get run which will
15
+ // call `Linking.openURL`, and we want to test that.
16
+ //
17
+ // Normally we would probably do something like `await
18
+ // createShouldStartLoadWithRequest(...)` in the tests, but that doesn't work
19
+ // here because the promise that gets kicked off is not returned (because
20
+ // non-test code doesn't need to know about it).
21
+ //
22
+ // The tests thus need a way to "flush any pending promises" (to make sure
23
+ // pending promises run to completion) before doing any `expect`ing. `jest`
24
+ // doesn't provide a way to do this out of the box, but we can use this function
25
+ // to do it.
26
+ //
27
+ // See this issue for more discussion: https://github.com/facebook/jest/issues/2157
28
+ function flushPromises() {
29
+ return new Promise(resolve => setImmediate(resolve));
30
+ }
31
+
32
+
33
+ describe('WebViewShared', () => {
34
+ test('exports defaultOriginWhitelist', () => {
35
+ expect(defaultOriginWhitelist).toMatchSnapshot();
36
+ });
37
+
38
+ describe('createOnShouldStartLoadWithRequest', () => {
39
+ const alwaysTrueOnShouldStartLoadWithRequest = (nativeEvent) => {
40
+ return true;
41
+ };
42
+
43
+ const alwaysFalseOnShouldStartLoadWithRequest = (nativeEvent) => {
44
+ return false;
45
+ };
46
+
47
+ const loadRequest = jest.fn();
48
+
49
+ test('loadRequest is called without onShouldStartLoadWithRequest override', async () => {
50
+ const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
51
+ loadRequest,
52
+ defaultOriginWhitelist,
53
+ );
54
+
55
+ onShouldStartLoadWithRequest({ nativeEvent: { url: 'https://www.example.com/', lockIdentifier: 1 } });
56
+
57
+ await flushPromises();
58
+
59
+ expect(Linking.openURL).toHaveBeenCalledTimes(0);
60
+ expect(loadRequest).toHaveBeenCalledWith(true, 'https://www.example.com/', 1);
61
+ });
62
+
63
+ test('Linking.openURL is called without onShouldStartLoadWithRequest override', async () => {
64
+ const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
65
+ loadRequest,
66
+ defaultOriginWhitelist,
67
+ );
68
+
69
+ onShouldStartLoadWithRequest({ nativeEvent: { url: 'invalid://example.com/', lockIdentifier: 2 } });
70
+
71
+ await flushPromises();
72
+
73
+ expect(Linking.openURL).toHaveBeenCalledWith('invalid://example.com/');
74
+ expect(loadRequest).toHaveBeenCalledWith(false, 'invalid://example.com/', 2);
75
+ });
76
+
77
+ test('loadRequest with true onShouldStartLoadWithRequest override is called', async () => {
78
+ const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
79
+ loadRequest,
80
+ defaultOriginWhitelist,
81
+ alwaysTrueOnShouldStartLoadWithRequest,
82
+ );
83
+
84
+ onShouldStartLoadWithRequest({ nativeEvent: { url: 'https://www.example.com/', lockIdentifier: 1 } });
85
+
86
+ await flushPromises();
87
+
88
+ expect(Linking.openURL).toHaveBeenCalledTimes(0);
89
+ expect(loadRequest).toHaveBeenLastCalledWith(true, 'https://www.example.com/', 1);
90
+ });
91
+
92
+ test('Linking.openURL with true onShouldStartLoadWithRequest override is called for links not passing the whitelist', async () => {
93
+ const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
94
+ loadRequest,
95
+ defaultOriginWhitelist,
96
+ alwaysTrueOnShouldStartLoadWithRequest,
97
+ );
98
+
99
+ var a = 10;
100
+ onShouldStartLoadWithRequest({ nativeEvent: { url: 'invalid://example.com/', lockIdentifier: 1 } });
101
+
102
+ await flushPromises();
103
+
104
+ expect(Linking.openURL).toHaveBeenLastCalledWith('invalid://example.com/');
105
+ // We don't expect the URL to have been loaded in the WebView because it
106
+ // is not in the origin whitelist
107
+ expect(loadRequest).toHaveBeenLastCalledWith(false, 'invalid://example.com/', 1);
108
+ });
109
+
110
+ test('loadRequest with false onShouldStartLoadWithRequest override is called', async () => {
111
+ const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
112
+ loadRequest,
113
+ defaultOriginWhitelist,
114
+ alwaysFalseOnShouldStartLoadWithRequest,
115
+ );
116
+
117
+ onShouldStartLoadWithRequest({ nativeEvent: { url: 'https://www.example.com/', lockIdentifier: 1 } });
118
+
119
+ await flushPromises();
120
+
121
+ expect(Linking.openURL).toHaveBeenCalledTimes(0);
122
+ expect(loadRequest).toHaveBeenLastCalledWith(false, 'https://www.example.com/', 1);
123
+ });
124
+
125
+ test('loadRequest with limited whitelist', async () => {
126
+ const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
127
+ loadRequest,
128
+ ['https://*'],
129
+ );
130
+
131
+ onShouldStartLoadWithRequest({ nativeEvent: { url: 'https://www.example.com/', lockIdentifier: 1 } });
132
+
133
+ await flushPromises();
134
+
135
+ expect(Linking.openURL).toHaveBeenCalledTimes(0);
136
+ expect(loadRequest).toHaveBeenLastCalledWith(true, 'https://www.example.com/', 1);
137
+
138
+ onShouldStartLoadWithRequest({ nativeEvent: { url: 'http://insecure.com/', lockIdentifier: 2 } });
139
+
140
+ await flushPromises();
141
+
142
+ expect(Linking.openURL).toHaveBeenLastCalledWith('http://insecure.com/');
143
+ expect(loadRequest).toHaveBeenLastCalledWith(false, 'http://insecure.com/', 2);
144
+
145
+ onShouldStartLoadWithRequest({ nativeEvent: { url: 'git+https://insecure.com/', lockIdentifier: 3 } });
146
+
147
+ await flushPromises();
148
+
149
+ expect(Linking.openURL).toHaveBeenLastCalledWith('git+https://insecure.com/');
150
+ expect(loadRequest).toHaveBeenLastCalledWith(false, 'git+https://insecure.com/', 3);
151
+
152
+ onShouldStartLoadWithRequest({ nativeEvent: { url: 'fakehttps://insecure.com/', lockIdentifier: 4 } });
153
+
154
+ await flushPromises();
155
+
156
+ expect(Linking.openURL).toHaveBeenLastCalledWith('fakehttps://insecure.com/');
157
+ expect(loadRequest).toHaveBeenLastCalledWith(false, 'fakehttps://insecure.com/', 4);
158
+ });
159
+
160
+ test('loadRequest allows for valid URIs', async () => {
161
+ const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
162
+ loadRequest,
163
+ ['plus+https://*', 'DOT.https://*', 'dash-https://*', '0invalid://*', '+invalid://*'],
164
+ );
165
+
166
+ onShouldStartLoadWithRequest({ nativeEvent: { url: 'plus+https://www.example.com/', lockIdentifier: 1 } });
167
+
168
+ await flushPromises();
169
+ expect(Linking.openURL).toHaveBeenCalledTimes(0);
170
+ expect(loadRequest).toHaveBeenLastCalledWith(true, 'plus+https://www.example.com/', 1);
171
+
172
+ onShouldStartLoadWithRequest({ nativeEvent: { url: 'DOT.https://www.example.com/', lockIdentifier: 2 } });
173
+
174
+ await flushPromises();
175
+
176
+ expect(Linking.openURL).toHaveBeenCalledTimes(0);
177
+ expect(loadRequest).toHaveBeenLastCalledWith(true, 'DOT.https://www.example.com/', 2);
178
+
179
+ onShouldStartLoadWithRequest({ nativeEvent: { url: 'dash-https://www.example.com/', lockIdentifier: 3 } });
180
+
181
+ await flushPromises();
182
+
183
+ expect(Linking.openURL).toHaveBeenCalledTimes(0);
184
+ expect(loadRequest).toHaveBeenLastCalledWith(true, 'dash-https://www.example.com/', 3);
185
+
186
+ onShouldStartLoadWithRequest({ nativeEvent: { url: '0invalid://www.example.com/', lockIdentifier: 4 } });
187
+
188
+ await flushPromises();
189
+
190
+ expect(Linking.openURL).toHaveBeenLastCalledWith('0invalid://www.example.com/');
191
+ expect(loadRequest).toHaveBeenLastCalledWith(false, '0invalid://www.example.com/', 4);
192
+
193
+ onShouldStartLoadWithRequest({ nativeEvent: { url: '+invalid://www.example.com/', lockIdentifier: 5 } });
194
+
195
+ await flushPromises();
196
+
197
+ expect(Linking.openURL).toHaveBeenLastCalledWith('+invalid://www.example.com/');
198
+ expect(loadRequest).toHaveBeenLastCalledWith(false, '+invalid://www.example.com/', 5);
199
+
200
+ onShouldStartLoadWithRequest({ nativeEvent: { url: 'FAKE+plus+https://www.example.com/', lockIdentifier: 6 } });
201
+
202
+ await flushPromises();
203
+
204
+ expect(Linking.openURL).toHaveBeenLastCalledWith('FAKE+plus+https://www.example.com/');
205
+ expect(loadRequest).toHaveBeenLastCalledWith(false, 'FAKE+plus+https://www.example.com/', 6);
206
+ });
207
+ });
208
+ });
@@ -0,0 +1,8 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`WebViewShared exports defaultOriginWhitelist 1`] = `
4
+ [
5
+ "http://*",
6
+ "https://*",
7
+ ]
8
+ `;
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ import WebView from './WebView';
2
+
3
+ export { WebView };
4
+ export default WebView;
@@ -15,7 +15,7 @@
15
15
  <ApplicationType>Windows Store</ApplicationType>
16
16
  <ApplicationTypeRevision>10.0</ApplicationTypeRevision>
17
17
  <WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0</WindowsTargetPlatformVersion>
18
- <WindowsTargetPlatformMinVersion>10.0.15063.0</WindowsTargetPlatformMinVersion>
18
+ <WindowsTargetPlatformMinVersion>10.0.17763.0</WindowsTargetPlatformMinVersion>
19
19
  </PropertyGroup>
20
20
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
21
21
  <ItemGroup Label="ProjectConfigurations">
@@ -15,6 +15,7 @@ namespace ReactNativeWebView{
15
15
  runtimeclass ReactWebView2 : Windows.UI.Xaml.Controls.ContentPresenter{
16
16
  ReactWebView2(Microsoft.ReactNative.IReactContext context);
17
17
  void NavigateToHtml(String html);
18
+ void NavigateWithHeaders(String uri, Windows.Foundation.Collections.IMapView<String, String> headers);
18
19
  Boolean MessagingEnabled;
19
20
  };
20
21
  #endif
@@ -9,6 +9,11 @@
9
9
  #include "ReactWebView2.g.cpp"
10
10
  #include <winrt/Windows.Foundation.Metadata.h>
11
11
  #include <optional>
12
+ #include <iostream>
13
+ #include <vector>
14
+ #include <algorithm>
15
+ #include <cctype>
16
+
12
17
 
13
18
  namespace winrt {
14
19
  using namespace Microsoft::ReactNative;
@@ -22,9 +27,68 @@ namespace winrt {
22
27
  using namespace Windows::UI::Popups;
23
28
  using namespace Windows::UI::Xaml::Input;
24
29
  using namespace Windows::UI::Xaml::Media;
30
+ using namespace Windows::Storage::Streams;
25
31
  } // namespace winrt
26
32
 
27
33
  namespace winrt::ReactNativeWebView::implementation {
34
+ namespace helpers {
35
+ std::string trimString(const std::string& str) {
36
+ std::string trimmedString = str;
37
+
38
+ // Trim from start
39
+ trimmedString.erase(0, trimmedString.find_first_not_of(" \t\n\r\f\v"));
40
+
41
+ // Trim from end
42
+ trimmedString.erase(trimmedString.find_last_not_of(" \t\n\r\f\v") + 1);
43
+
44
+ return trimmedString;
45
+ }
46
+ std::vector<std::string> splitString(
47
+ const std::string& str,
48
+ const std::string& delim) {
49
+ std::vector<std::string> tokens;
50
+ auto startPos = 0;
51
+ auto endPos = str.find(delim);
52
+
53
+ while (endPos != std::string::npos) {
54
+ auto token = str.substr(startPos, endPos - startPos);
55
+ tokens.push_back(trimString(token));
56
+
57
+ startPos = endPos + delim.length();
58
+ endPos = str.find(delim, startPos);
59
+ }
60
+
61
+ auto lastToken = str.substr(startPos);
62
+ tokens.push_back(trimString(lastToken));
63
+
64
+ return tokens;
65
+ }
66
+
67
+ std::map<std::string, std::string> parseSetCookieHeader(
68
+ const std::string& setCookieHeader) {
69
+ std::map<std::string, std::string> cookie;
70
+
71
+ // Split the header into individual cookie strings
72
+ auto cookieStrings = splitString(setCookieHeader, ";");
73
+
74
+ // Extract the cookie name and value from the first string
75
+ auto nameValuePair = splitString(cookieStrings[0], "=");
76
+ cookie["Name"] = trimString(nameValuePair[0]);
77
+ cookie["Value"] = trimString(nameValuePair[1]);
78
+
79
+ // Extract the attributes from the remaining strings
80
+ for (std::size_t i = 1; i < cookieStrings.size(); ++i) {
81
+ auto attributeValuePair = splitString(cookieStrings[i], "=");
82
+ auto attributeName = attributeValuePair[0];
83
+ auto attributeValue =
84
+ attributeValuePair.size() > 1 ? attributeValuePair[1] : "";
85
+ cookie[attributeName] = trimString(attributeValue);
86
+ }
87
+
88
+ return cookie;
89
+ }
90
+ } // namespace HP
91
+
28
92
 
29
93
  ReactWebView2::ReactWebView2(winrt::IReactContext const& reactContext) : m_reactContext(reactContext) {
30
94
  m_webView = winrt::WebView2();
@@ -32,23 +96,23 @@ namespace winrt::ReactNativeWebView::implementation {
32
96
  RegisterEvents();
33
97
  }
34
98
 
35
- ReactWebView2::~ReactWebView2(){}
99
+ ReactWebView2::~ReactWebView2() {}
36
100
 
37
101
  void ReactWebView2::RegisterEvents() {
38
102
  m_navigationStartingRevoker = m_webView.NavigationStarting(
39
103
  winrt::auto_revoke, [ref = get_weak()](auto const& sender, auto const& args) {
40
- if (auto self = ref.get()) {
41
- self->OnNavigationStarting(sender, args);
42
- }
43
-
44
- });
104
+ if (auto self = ref.get()) {
105
+ self->OnNavigationStarting(sender, args);
106
+ }
107
+
108
+ });
45
109
 
46
110
  m_navigationCompletedRevoker = m_webView.NavigationCompleted(
47
111
  winrt::auto_revoke, [ref = get_weak()](auto const& sender, auto const& args) {
48
- if (auto self = ref.get()) {
49
- self->OnNavigationCompleted(sender, args);
50
- }
51
- });
112
+ if (auto self = ref.get()) {
113
+ self->OnNavigationCompleted(sender, args);
114
+ }
115
+ });
52
116
 
53
117
  m_CoreWebView2InitializedRevoker = m_webView.CoreWebView2Initialized(
54
118
  winrt::auto_revoke, [ref = get_weak()](auto const& sender, auto const& args){
@@ -56,13 +120,13 @@ namespace winrt::ReactNativeWebView::implementation {
56
120
  self->OnCoreWebView2Initialized(sender, args);
57
121
  }
58
122
  });
59
- }
123
+ }
60
124
 
61
125
  bool ReactWebView2::Is17763OrHigher() {
62
126
  static std::optional<bool> hasUniversalAPIContract_v7;
63
127
 
64
128
  if (!hasUniversalAPIContract_v7.has_value()) {
65
- hasUniversalAPIContract_v7 = winrt::Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent(L"Windows.Foundation.UniversalApiContract", 7);
129
+ hasUniversalAPIContract_v7 = winrt::Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent(L"Windows.Foundation.UniversalApiContract", 7);
66
130
  }
67
131
  return hasUniversalAPIContract_v7.value();
68
132
  }
@@ -72,11 +136,11 @@ namespace winrt::ReactNativeWebView::implementation {
72
136
  WriteProperty(eventDataWriter, L"canGoBack", sender.CanGoBack());
73
137
  WriteProperty(eventDataWriter, L"canGoForward", sender.CanGoForward());
74
138
  if (Is17763OrHigher()) {
75
- WriteProperty(eventDataWriter, L"loading", !sender.IsLoaded());
139
+ WriteProperty(eventDataWriter, L"loading", !sender.IsLoaded());
76
140
  }
77
141
  WriteProperty(eventDataWriter, L"target", tag);
78
142
  if (auto uri = sender.Source()) {
79
- WriteProperty(eventDataWriter, L"url", uri.AbsoluteCanonicalUri());
143
+ WriteProperty(eventDataWriter, L"url", uri.AbsoluteCanonicalUri());
80
144
  }
81
145
  }
82
146
 
@@ -90,9 +154,9 @@ namespace winrt::ReactNativeWebView::implementation {
90
154
  eventDataWriter.WriteObjectEnd();
91
155
  });
92
156
 
93
-
157
+
94
158
  if (m_messagingEnabled) {
95
- m_messageToken = webView.WebMessageReceived([this](auto const& /* sender */ , winrt::CoreWebView2WebMessageReceivedEventArgs const& messageArgs)
159
+ m_messageToken = webView.WebMessageReceived([this](auto const& /* sender */, winrt::CoreWebView2WebMessageReceivedEventArgs const& messageArgs)
96
160
  {
97
161
  try {
98
162
  auto message = messageArgs.TryGetWebMessageAsString();
@@ -121,7 +185,7 @@ namespace winrt::ReactNativeWebView::implementation {
121
185
  });
122
186
 
123
187
  if (m_messagingEnabled) {
124
- winrt::hstring message = LR"(window.alert = function (msg) {window.chrome.webview.postMessage(`{"type":"__alert","message":"${msg}"}`)};
188
+ winrt::hstring message = LR"(window.alert = function (msg) {window.chrome.webview.postMessage(`{"type":"__alert","message":"${msg}"}`)};
125
189
  window.ReactNativeWebView = {postMessage: function (data) {window.chrome.webview.postMessage(String(data))}};)";
126
190
  webView.ExecuteScriptAsync(message);
127
191
  }
@@ -129,10 +193,40 @@ namespace winrt::ReactNativeWebView::implementation {
129
193
 
130
194
  void ReactWebView2::OnCoreWebView2Initialized(winrt::Microsoft::UI::Xaml::Controls::WebView2 const& sender, winrt::Microsoft::UI::Xaml::Controls::CoreWebView2InitializedEventArgs const& /* args */) {
131
195
  assert(sender.CoreWebView2());
196
+
132
197
  if (m_navigateToHtml != L"") {
133
198
  m_webView.NavigateToString(m_navigateToHtml);
134
199
  m_navigateToHtml = L"";
135
200
  }
201
+ else if (m_navigationWithHeaders.has_value()) {
202
+ auto headers = m_navigationWithHeaders.value().second;
203
+
204
+ auto stream = InMemoryRandomAccessStream();
205
+
206
+ // construct headers string
207
+ winrt::hstring headers_str;
208
+ for (auto const& header : headers) {
209
+ if (header.Key() == L"cookie" || header.Key() == L"Cookie") {
210
+ WriteCookiesToWebView2(header.Value());
211
+ }
212
+ else {
213
+ headers_str = headers_str + header.Key() + L": " +
214
+ header.Value() + L"\r\n";
215
+ }
216
+
217
+ }
218
+
219
+ auto request =
220
+ m_webView.CoreWebView2().Environment().CreateWebResourceRequest(
221
+ m_navigationWithHeaders.value().first,
222
+ L"GET",
223
+ stream,
224
+ headers_str
225
+ );
226
+
227
+ m_webView.CoreWebView2().NavigateWithWebResourceRequest(request);
228
+ m_navigationWithHeaders.reset();
229
+ }
136
230
  }
137
231
 
138
232
  void ReactWebView2::HandleMessageFromJS(winrt::hstring const& message) {
@@ -161,11 +255,11 @@ namespace winrt::ReactNativeWebView::implementation {
161
255
  });
162
256
  }
163
257
 
164
- void ReactWebView2::MessagingEnabled(bool enabled) noexcept{
258
+ void ReactWebView2::MessagingEnabled(bool enabled) noexcept {
165
259
  m_messagingEnabled = enabled;
166
260
  }
167
261
 
168
- bool ReactWebView2::MessagingEnabled() const noexcept{
262
+ bool ReactWebView2::MessagingEnabled() const noexcept {
169
263
  return m_messagingEnabled;
170
264
  }
171
265
 
@@ -180,6 +274,35 @@ namespace winrt::ReactNativeWebView::implementation {
180
274
  }
181
275
  }
182
276
 
277
+ void ReactWebView2::NavigateWithHeaders(winrt::hstring uri, IMapView<winrt::hstring, winrt::hstring> headers) {
278
+ m_navigationWithHeaders = std::make_pair(uri, headers);
279
+ m_webView.EnsureCoreWebView2Async();
280
+ }
281
+
282
+ void ReactWebView2::WriteCookiesToWebView2(winrt::hstring cookies) {
283
+ // Persisting cookies passed from JS
284
+ // Cookies are separated by ;, and adheres to the Set-Cookie HTTP header format of RFC-6265.
285
+
286
+ auto cm = m_webView.CoreWebView2().CookieManager();
287
+ auto cookies_list =
288
+ helpers::splitString(winrt::to_string(cookies), ";,");
289
+ for (const auto& cookie_str : cookies_list) {
290
+ auto cookieData = helpers::parseSetCookieHeader(helpers::trimString(cookie_str));
291
+
292
+ if (!cookieData.count("Name") || !cookieData.count("Value")) {
293
+ continue;
294
+ }
295
+ auto cookie = cm.CreateCookie(
296
+ winrt::to_hstring(cookieData["Name"]),
297
+ winrt::to_hstring(cookieData["Value"]),
298
+ cookieData.count("Domain")
299
+ ? winrt::to_hstring(cookieData["Domain"])
300
+ : L"",
301
+ cookieData.count("Path")
302
+ ? winrt::to_hstring(cookieData["Path"]) : L"");
303
+ cm.AddOrUpdateCookie(cookie);
304
+ }
305
+ }
183
306
  } // namespace winrt::ReactNativeWebView::implementation
184
307
 
185
308
  #endif // HAS_WEBVIEW2
@@ -21,10 +21,12 @@ namespace winrt::ReactNativeWebView::implementation {
21
21
  void MessagingEnabled(bool enabled) noexcept;
22
22
  bool MessagingEnabled() const noexcept;
23
23
  void NavigateToHtml(winrt::hstring html);
24
+ void NavigateWithHeaders(winrt::hstring uri, IMapView<winrt::hstring, winrt::hstring> headers);
24
25
  ~ReactWebView2();
25
26
 
26
27
  private:
27
28
  winrt::hstring m_navigateToHtml = L"";
29
+ std::optional<std::pair<winrt::hstring, IMapView<winrt::hstring, winrt::hstring>>> m_navigationWithHeaders;
28
30
  bool m_messagingEnabled{ true };
29
31
 
30
32
  winrt::Microsoft::UI::Xaml::Controls::WebView2 m_webView{ nullptr };
@@ -35,6 +37,7 @@ namespace winrt::ReactNativeWebView::implementation {
35
37
  winrt::Microsoft::UI::Xaml::Controls::WebView2::CoreWebView2Initialized_revoker m_CoreWebView2InitializedRevoker{};
36
38
  void HandleMessageFromJS(winrt::hstring const& message);
37
39
  void RegisterEvents();
40
+ void WriteCookiesToWebView2(winrt::hstring cookies);
38
41
  void WriteWebViewNavigationEventArg(winrt::Microsoft::UI::Xaml::Controls::WebView2 const& sender, winrt::Microsoft::ReactNative::IJSValueWriter const& eventDataWriter);
39
42
  void OnNavigationStarting(winrt::Microsoft::UI::Xaml::Controls::WebView2 const& sender, winrt::Microsoft::Web::WebView2::Core::CoreWebView2NavigationStartingEventArgs const& args);
40
43
  void OnNavigationCompleted(winrt::Microsoft::UI::Xaml::Controls::WebView2 const& sender, winrt::Microsoft::Web::WebView2::Core::CoreWebView2NavigationCompletedEventArgs const& args);
@@ -16,6 +16,8 @@ namespace winrt {
16
16
  using namespace Microsoft::UI::Xaml::Controls;
17
17
  using namespace Windows::Web::Http;
18
18
  using namespace Windows::Web::Http::Headers;
19
+ using namespace Microsoft::Web::WebView2::Core;
20
+ using namespace Windows::Storage::Streams;
19
21
  }
20
22
 
21
23
  namespace winrt::ReactNativeWebView::implementation {
@@ -28,8 +30,8 @@ namespace winrt::ReactNativeWebView::implementation {
28
30
  }
29
31
 
30
32
  winrt::FrameworkElement ReactWebView2Manager::CreateView() noexcept {
31
- auto view = winrt::ReactNativeWebView::ReactWebView2(m_reactContext);
32
- return view;
33
+ auto view = winrt::ReactNativeWebView::ReactWebView2(m_reactContext);
34
+ return view;
33
35
  }
34
36
 
35
37
  // IViewManagerWithReactContext
@@ -79,7 +81,29 @@ namespace winrt::ReactNativeWebView::implementation {
79
81
  auto bundleRootPath = winrt::to_string(ReactNativeHost().InstanceSettings().BundleRootPath());
80
82
  uriString.replace(0, std::size(file), bundleRootPath.empty() ? "ms-appx-web:///Bundle/" : bundleRootPath);
81
83
  }
82
- webView.Source(winrt::Uri(to_hstring(uriString)));
84
+
85
+ if (uriString.find("ms-appdata://") == 0 || uriString.find("ms-appx-web://") == 0) {
86
+ webView.Source(winrt::Uri(to_hstring(uriString)));
87
+ }
88
+ else {
89
+ const auto hasHeaders = srcMap.find("headers") != srcMap.end();
90
+
91
+ if (hasHeaders) {
92
+ auto headers = winrt::single_threaded_map<winrt::hstring, winrt::hstring>();
93
+
94
+ for (auto const& header : srcMap.at("headers").AsObject()) {
95
+ auto const& headerKey = header.first;
96
+ auto const& headerValue = header.second;
97
+ headers.Insert(winrt::to_hstring(headerKey), winrt::to_hstring(headerValue.AsString()));
98
+ }
99
+
100
+ const auto reactWebView2 = view.as<ReactNativeWebView::ReactWebView2>();
101
+ reactWebView2.NavigateWithHeaders(to_hstring(uriString), headers.GetView());
102
+ }
103
+ else {
104
+ webView.Source(winrt::Uri(to_hstring(uriString)));
105
+ }
106
+ }
83
107
  }
84
108
  else if (srcMap.find("html") != srcMap.end()) {
85
109
  auto htmlString = srcMap.at("html").AsString();
@@ -92,7 +116,7 @@ namespace winrt::ReactNativeWebView::implementation {
92
116
  auto reactWebView2 = view.as<ReactNativeWebView::ReactWebView2>();
93
117
  reactWebView2.MessagingEnabled(messagingEnabled);
94
118
  }
95
- }
119
+ }
96
120
  }
97
121
 
98
122
  // IViewManagerWithExportedEventTypeConstants
@@ -147,7 +171,7 @@ namespace winrt::ReactNativeWebView::implementation {
147
171
  }
148
172
  else if (commandId == L"injectJavaScript") {
149
173
  webView.ExecuteScriptAsync(winrt::to_hstring(commandArgs[0].AsString()));
150
- }
174
+ }
151
175
  }
152
176
 
153
177
  } // namespace winrt::ReactNativeWebView::implementation
@@ -29,4 +29,5 @@
29
29
  #include <winrt/Microsoft.UI.Xaml.Controls.h>
30
30
  #if HAS_WEBVIEW2
31
31
  #include <winrt/Microsoft.Web.WebView2.Core.h>
32
+ #include <winrt/Windows.Storage.Streams.h>
32
33
  #endif
@@ -1,6 +0,0 @@
1
- [*]
2
- charset=utf-8
3
- end_of_line=lf
4
- insert_final_newline=false
5
- indent_style=space
6
- indent_size=2