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.
- package/README.md +9 -31
- package/android/build.gradle +70 -112
- package/android/gradle.properties +5 -6
- package/android/src/main/java/kr/co/bootpay/webview/BPCBasicAuthCredential.java +11 -0
- package/android/src/main/java/kr/co/bootpay/webview/BPCWebChromeClient.java +354 -434
- package/android/src/main/java/kr/co/bootpay/webview/BPCWebView.java +350 -259
- package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewClient.java +253 -399
- package/android/src/main/java/kr/co/bootpay/webview/{WebViewConfig.java → BPCWebViewConfig.java} +3 -4
- package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewFileProvider.java +1 -1
- package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewManager.java +290 -877
- package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewManagerImpl.kt +664 -0
- package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewModule.java +29 -520
- package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewModuleImpl.java +554 -0
- package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewPackage.java +56 -0
- package/android/src/main/java/kr/co/bootpay/webview/BootpayUrlHelper.java +122 -0
- package/android/src/main/java/kr/co/bootpay/webview/events/TopCustomMenuSelectionEvent.kt +24 -0
- package/android/src/main/java/kr/co/bootpay/webview/events/TopNewWindowEvent.kt +25 -0
- package/android/src/newarch/com/reactnativecommunity/webview/BPCWebViewManager.java +544 -0
- package/android/src/newarch/com/reactnativecommunity/webview/BPCWebViewModule.java +57 -0
- package/apple/BPCWebView.h +22 -126
- package/apple/BPCWebView.mm +528 -0
- package/apple/BPCWebViewDecisionManager.h +20 -0
- package/apple/BPCWebViewDecisionManager.m +47 -0
- package/apple/BPCWebViewImpl.h +150 -0
- package/apple/{BPCWebView.m → BPCWebViewImpl.m} +381 -214
- package/apple/BPCWebViewManager.h +4 -8
- package/apple/{BPCWebViewManager.m → BPCWebViewManager.mm} +93 -149
- package/{android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream → ios/.DS_Store} +0 -0
- package/ios/{BPCWebView.xcodeproj → RNCWebView.xcodeproj}/project.pbxproj +18 -18
- package/ios/main.jsbundle +457 -0
- package/lib/BPCWebViewNativeComponent.d.ts +242 -0
- package/lib/BPCWebViewNativeComponent.d.ts.map +1 -0
- package/lib/BPCWebViewNativeComponent.js +6 -0
- package/lib/NativeBPCWebView.d.ts +10 -0
- package/lib/NativeBPCWebView.d.ts.map +1 -0
- package/lib/NativeBPCWebView.js +2 -0
- package/lib/NativeRNCWebView.d.ts +10 -0
- package/lib/NativeRNCWebView.d.ts.map +1 -0
- package/lib/NativeRNCWebView.js +2 -0
- package/lib/RNCWebViewNativeComponent.d.ts +242 -0
- package/lib/RNCWebViewNativeComponent.d.ts.map +1 -0
- package/lib/RNCWebViewNativeComponent.js +6 -0
- package/lib/WebView.android.d.ts.map +1 -1
- package/lib/WebView.android.js +53 -29
- package/lib/WebView.ios.d.ts.map +1 -1
- package/lib/WebView.ios.js +49 -28
- package/lib/WebView.macos.d.ts.map +1 -1
- package/lib/WebView.macos.js +10 -14
- package/lib/WebView.windows.d.ts.map +1 -1
- package/lib/WebView.windows.js +4 -6
- package/lib/WebViewNativeComponent.macos.d.ts +2 -2
- package/lib/WebViewNativeComponent.macos.js +2 -2
- package/lib/WebViewShared.d.ts +4 -2
- package/lib/WebViewShared.d.ts.map +1 -1
- package/lib/WebViewShared.js +8 -2
- package/lib/WebViewTypes.d.ts +62 -95
- package/lib/WebViewTypes.d.ts.map +1 -1
- package/lib/WebViewTypes.js +0 -16
- package/macos/RNCWebView.xcodeproj/project.pbxproj +44 -44
- package/package.json +38 -20
- package/react-native-webview-bootpay.podspec +22 -3
- package/react-native.config.js +1 -2
- package/src/BPCWebViewNativeComponent.ts +281 -0
- package/src/NativeBPCWebView.ts +14 -0
- package/src/WebView.android.tsx +229 -0
- package/src/WebView.ios.tsx +232 -0
- package/src/WebView.macos.tsx +177 -0
- package/src/WebView.styles.ts +44 -0
- package/src/WebView.tsx +18 -0
- package/src/WebView.windows.tsx +156 -0
- package/src/WebViewNativeComponent.macos.ts +8 -0
- package/src/WebViewNativeComponent.windows.ts +10 -0
- package/src/WebViewShared.tsx +235 -0
- package/src/WebViewTypes.ts +1287 -0
- package/src/__tests__/WebViewShared-test.js +208 -0
- package/src/__tests__/__snapshots__/WebViewShared-test.js.snap +8 -0
- package/src/index.ts +4 -0
- package/windows/.gitignore +353 -0
- package/windows/ReactNativeWebView/ReactNativeWebView.vcxproj +1 -1
- package/windows/ReactNativeWebView/ReactWebView.idl +1 -0
- package/windows/ReactNativeWebView/ReactWebView2.cpp +142 -19
- package/windows/ReactNativeWebView/ReactWebView2.h +3 -0
- package/windows/ReactNativeWebView/ReactWebView2Manager.cpp +29 -5
- package/windows/ReactNativeWebView/pch.h +1 -0
- package/android/.editorconfig +0 -6
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/results.bin +0 -1
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebChromeClient$1.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebChromeClient.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebView$1.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebView$BPCWebViewBridge.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebView$ProgressChangedFilter.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebView.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewClient.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewFileProvider.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewManager$1.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewManager$2.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewManager$3.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewManager$4.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewManager.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule$1.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule$2.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule$MimeType.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock$ShouldOverrideCallbackState.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewModule.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BPCWebViewPackage.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BasicAuthCredential.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/BuildConfig.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/URLUtil.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/WebViewConfig.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent$Companion.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent$Companion.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent$Companion.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent$Companion.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent$Companion.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopMessageEvent$Companion.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopMessageEvent.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent$Companion.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent$Companion.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent.dex +0 -0
- package/android/build/.transforms/547b28b34bd585663252523c1a7a53e6/transformed/desugar_graph.bin +0 -0
- package/android/build/.transforms/88c49d67076e4458a9ddee82f875eb6a/results.bin +0 -1
- package/android/build/.transforms/88c49d67076e4458a9ddee82f875eb6a/transformed/classes/classes.dex +0 -0
- package/android/build/.transforms/c0e86b44db04fcaf424a5b7ce79324f4/results.bin +0 -1
- package/android/build/generated/source/buildConfig/debug/kr/co/bootpay/webview/BuildConfig.java +0 -10
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -106
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +0 -18
- package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +0 -4
- package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +0 -1
- package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/R.txt +0 -1861
- package/android/build/intermediates/compiled_local_resources/debug/out/xml_file_provider_paths.xml.flat +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +0 -2
- package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +0 -2
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +0 -2
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +0 -2
- package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +0 -2
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebChromeClient$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebChromeClient.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebView$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebView$BPCWebViewBridge.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebView$ProgressChangedFilter.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebView.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewClient.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewFileProvider.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewManager$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewManager$2.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewManager$3.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewManager$4.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewManager.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule$1.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule$2.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule$MimeType.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock$ShouldOverrideCallbackState.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BPCWebViewModule.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BasicAuthCredential.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/BuildConfig.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/URLUtil.class +0 -0
- package/android/build/intermediates/javac/debug/classes/kr/co/bootpay/webview/WebViewConfig.class +0 -0
- package/android/build/intermediates/library_java_res/debug/res.jar +0 -0
- package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +0 -3
- package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +0 -210
- package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +0 -106
- package/android/build/intermediates/navigation_json/debug/navigation.json +0 -1
- package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +0 -18
- package/android/build/intermediates/packaged_res/debug/xml/file_provider_paths.xml +0 -6
- package/android/build/intermediates/runtime_library_classes_dir/debug/META-INF/react-native-webview-bootpay_debug.kotlin_module +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebChromeClient$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebChromeClient.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebView$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebView$BPCWebViewBridge.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebView$ProgressChangedFilter.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebView.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewClient.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewFileProvider.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewManager$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewManager$2.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewManager$3.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewManager$4.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewManager.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule$2.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule$MimeType.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock$ShouldOverrideCallbackState.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule$ShouldOverrideUrlLoadingLock.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewModule.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BPCWebViewPackage.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BasicAuthCredential.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/BuildConfig.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/URLUtil.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/WebViewConfig.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent$Companion.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent$Companion.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent$Companion.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent$Companion.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent$Companion.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopMessageEvent$Companion.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopMessageEvent.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent$Companion.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent$Companion.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent.class +0 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +0 -1381
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +0 -2
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -229
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build/tmp/kotlin-classes/debug/META-INF/react-native-webview-bootpay_debug.kotlin_module +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/BPCWebViewPackage.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopHttpErrorEvent.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingErrorEvent.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingFinishEvent.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingProgressEvent.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopLoadingStartEvent.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopMessageEvent$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopMessageEvent.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopRenderProcessGoneEvent.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/kr/co/bootpay/webview/events/TopShouldStartLoadWithRequestEvent.class +0 -0
- package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewPackage.kt +0 -15
- package/android/src/main/java/kr/co/bootpay/webview/BasicAuthCredential.java +0 -11
- package/ios/BPCWebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/BPCWebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/BPCWebView.xcodeproj/project.xcworkspace/xcuserdata/ehowlsla.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/BPCWebView.xcodeproj/xcuserdata/ehowlsla.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/lib/WebViewNativeComponent.android.d.ts +0 -4
- package/lib/WebViewNativeComponent.android.d.ts.map +0 -1
- package/lib/WebViewNativeComponent.android.js +0 -3
- package/lib/WebViewNativeComponent.ios.d.ts +0 -4
- package/lib/WebViewNativeComponent.ios.d.ts.map +0 -1
- package/lib/WebViewNativeComponent.ios.js +0 -3
|
@@ -0,0 +1,554 @@
|
|
|
1
|
+
package kr.co.bootpay.webview;
|
|
2
|
+
|
|
3
|
+
import android.Manifest;
|
|
4
|
+
import android.app.Activity;
|
|
5
|
+
import android.app.DownloadManager;
|
|
6
|
+
import android.content.Context;
|
|
7
|
+
import android.content.Intent;
|
|
8
|
+
import android.content.pm.PackageManager;
|
|
9
|
+
import android.net.Uri;
|
|
10
|
+
import android.os.Build;
|
|
11
|
+
import android.os.Environment;
|
|
12
|
+
import android.os.Parcelable;
|
|
13
|
+
import android.provider.MediaStore;
|
|
14
|
+
|
|
15
|
+
import androidx.annotation.Nullable;
|
|
16
|
+
import androidx.annotation.RequiresApi;
|
|
17
|
+
import androidx.core.content.ContextCompat;
|
|
18
|
+
import androidx.core.content.FileProvider;
|
|
19
|
+
import androidx.core.util.Pair;
|
|
20
|
+
|
|
21
|
+
import android.util.Log;
|
|
22
|
+
import android.webkit.MimeTypeMap;
|
|
23
|
+
import android.webkit.ValueCallback;
|
|
24
|
+
import android.webkit.WebChromeClient;
|
|
25
|
+
import android.widget.Toast;
|
|
26
|
+
|
|
27
|
+
import com.facebook.common.activitylistener.ActivityListenerManager;
|
|
28
|
+
import com.facebook.react.bridge.ActivityEventListener;
|
|
29
|
+
import com.facebook.react.bridge.Promise;
|
|
30
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
31
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
32
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
33
|
+
import com.facebook.react.module.annotations.ReactModule;
|
|
34
|
+
import com.facebook.react.modules.core.PermissionAwareActivity;
|
|
35
|
+
import com.facebook.react.modules.core.PermissionListener;
|
|
36
|
+
|
|
37
|
+
import java.io.File;
|
|
38
|
+
import java.io.IOException;
|
|
39
|
+
import java.lang.SecurityException;
|
|
40
|
+
import java.util.ArrayList;
|
|
41
|
+
import java.util.Arrays;
|
|
42
|
+
import java.util.HashMap;
|
|
43
|
+
import java.util.concurrent.atomic.AtomicReference;
|
|
44
|
+
|
|
45
|
+
import static android.app.Activity.RESULT_OK;
|
|
46
|
+
|
|
47
|
+
public class BPCWebViewModuleImpl implements ActivityEventListener {
|
|
48
|
+
public static final String NAME = "BPCWebView";
|
|
49
|
+
|
|
50
|
+
public static final int PICKER = 1;
|
|
51
|
+
public static final int PICKER_LEGACY = 3;
|
|
52
|
+
public static final int FILE_DOWNLOAD_PERMISSION_REQUEST = 1;
|
|
53
|
+
|
|
54
|
+
final private ReactApplicationContext mContext;
|
|
55
|
+
|
|
56
|
+
private DownloadManager.Request mDownloadRequest;
|
|
57
|
+
|
|
58
|
+
private ValueCallback<Uri> mFilePathCallbackLegacy;
|
|
59
|
+
private ValueCallback<Uri[]> mFilePathCallback;
|
|
60
|
+
private File mOutputImage;
|
|
61
|
+
private File mOutputVideo;
|
|
62
|
+
|
|
63
|
+
public BPCWebViewModuleImpl(ReactApplicationContext context) {
|
|
64
|
+
mContext = context;
|
|
65
|
+
context.addActivityEventListener(this);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@Override
|
|
69
|
+
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
|
|
70
|
+
if (mFilePathCallback == null && mFilePathCallbackLegacy == null) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
boolean imageTaken = false;
|
|
75
|
+
boolean videoTaken = false;
|
|
76
|
+
|
|
77
|
+
if (mOutputImage != null && mOutputImage.length() > 0) {
|
|
78
|
+
imageTaken = true;
|
|
79
|
+
}
|
|
80
|
+
if (mOutputVideo != null && mOutputVideo.length() > 0) {
|
|
81
|
+
videoTaken = true;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// based off of which button was pressed, we get an activity result and a file
|
|
85
|
+
// the camera activity doesn't properly return the filename* (I think?) so we use
|
|
86
|
+
// this filename instead
|
|
87
|
+
switch (requestCode) {
|
|
88
|
+
case BPCWebViewModuleImpl.PICKER:
|
|
89
|
+
if (resultCode != RESULT_OK) {
|
|
90
|
+
if (mFilePathCallback != null) {
|
|
91
|
+
mFilePathCallback.onReceiveValue(null);
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
if (imageTaken) {
|
|
95
|
+
mFilePathCallback.onReceiveValue(new Uri[]{getOutputUri(mOutputImage)});
|
|
96
|
+
} else if (videoTaken) {
|
|
97
|
+
mFilePathCallback.onReceiveValue(new Uri[]{getOutputUri(mOutputVideo)});
|
|
98
|
+
} else {
|
|
99
|
+
mFilePathCallback.onReceiveValue(getSelectedFiles(data, resultCode));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
break;
|
|
103
|
+
case BPCWebViewModuleImpl.PICKER_LEGACY:
|
|
104
|
+
if (resultCode != RESULT_OK) {
|
|
105
|
+
mFilePathCallbackLegacy.onReceiveValue(null);
|
|
106
|
+
} else {
|
|
107
|
+
if (imageTaken) {
|
|
108
|
+
mFilePathCallbackLegacy.onReceiveValue(getOutputUri(mOutputImage));
|
|
109
|
+
} else if (videoTaken) {
|
|
110
|
+
mFilePathCallbackLegacy.onReceiveValue(getOutputUri(mOutputVideo));
|
|
111
|
+
} else {
|
|
112
|
+
mFilePathCallbackLegacy.onReceiveValue(data.getData());
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
break;
|
|
116
|
+
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (mOutputImage != null && !imageTaken) {
|
|
120
|
+
mOutputImage.delete();
|
|
121
|
+
}
|
|
122
|
+
if (mOutputVideo != null && !videoTaken) {
|
|
123
|
+
mOutputVideo.delete();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
mFilePathCallback = null;
|
|
127
|
+
mFilePathCallbackLegacy = null;
|
|
128
|
+
mOutputImage = null;
|
|
129
|
+
mOutputVideo = null;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
@Override
|
|
133
|
+
public void onNewIntent(Intent intent) {
|
|
134
|
+
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
protected static class ShouldOverrideUrlLoadingLock {
|
|
138
|
+
protected enum ShouldOverrideCallbackState {
|
|
139
|
+
UNDECIDED,
|
|
140
|
+
SHOULD_OVERRIDE,
|
|
141
|
+
DO_NOT_OVERRIDE,
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
private double nextLockIdentifier = 1;
|
|
145
|
+
private final HashMap<Double, AtomicReference<ShouldOverrideCallbackState>> shouldOverrideLocks = new HashMap<>();
|
|
146
|
+
|
|
147
|
+
public synchronized Pair<Double, AtomicReference<ShouldOverrideCallbackState>> getNewLock() {
|
|
148
|
+
final double lockIdentifier = nextLockIdentifier++;
|
|
149
|
+
final AtomicReference<ShouldOverrideCallbackState> shouldOverride = new AtomicReference<>(ShouldOverrideCallbackState.UNDECIDED);
|
|
150
|
+
shouldOverrideLocks.put(lockIdentifier, shouldOverride);
|
|
151
|
+
return new Pair<>(lockIdentifier, shouldOverride);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
@Nullable
|
|
155
|
+
public synchronized AtomicReference<ShouldOverrideCallbackState> getLock(Double lockIdentifier) {
|
|
156
|
+
return shouldOverrideLocks.get(lockIdentifier);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
public synchronized void removeLock(Double lockIdentifier) {
|
|
160
|
+
shouldOverrideLocks.remove(lockIdentifier);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
protected static final ShouldOverrideUrlLoadingLock shouldOverrideUrlLoadingLock = new ShouldOverrideUrlLoadingLock();
|
|
165
|
+
|
|
166
|
+
private enum MimeType {
|
|
167
|
+
DEFAULT("*/*"),
|
|
168
|
+
IMAGE("image"),
|
|
169
|
+
VIDEO("video");
|
|
170
|
+
|
|
171
|
+
private final String value;
|
|
172
|
+
|
|
173
|
+
MimeType(String value) {
|
|
174
|
+
this.value = value;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
private PermissionListener getWebviewFileDownloaderPermissionListener(String downloadingMessage, String lackPermissionToDownloadMessage) {
|
|
179
|
+
return new PermissionListener() {
|
|
180
|
+
@Override
|
|
181
|
+
public boolean onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
|
182
|
+
switch (requestCode) {
|
|
183
|
+
case FILE_DOWNLOAD_PERMISSION_REQUEST: {
|
|
184
|
+
// If request is cancelled, the result arrays are empty.
|
|
185
|
+
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
|
186
|
+
if (mDownloadRequest != null) {
|
|
187
|
+
downloadFile(downloadingMessage);
|
|
188
|
+
}
|
|
189
|
+
} else {
|
|
190
|
+
Toast.makeText(mContext, lackPermissionToDownloadMessage, Toast.LENGTH_LONG).show();
|
|
191
|
+
}
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
public boolean isFileUploadSupported() {
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
public void shouldStartLoadWithLockIdentifier(boolean shouldStart, double lockIdentifier) {
|
|
205
|
+
final AtomicReference<ShouldOverrideUrlLoadingLock.ShouldOverrideCallbackState> lockObject = shouldOverrideUrlLoadingLock.getLock(lockIdentifier);
|
|
206
|
+
if (lockObject != null) {
|
|
207
|
+
synchronized (lockObject) {
|
|
208
|
+
lockObject.set(shouldStart ? ShouldOverrideUrlLoadingLock.ShouldOverrideCallbackState.DO_NOT_OVERRIDE : ShouldOverrideUrlLoadingLock.ShouldOverrideCallbackState.SHOULD_OVERRIDE);
|
|
209
|
+
lockObject.notify();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
public Uri[] getSelectedFiles(Intent data, int resultCode) {
|
|
215
|
+
if (data == null) {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// we have multiple files selected
|
|
220
|
+
if (data.getClipData() != null) {
|
|
221
|
+
final int numSelectedFiles = data.getClipData().getItemCount();
|
|
222
|
+
Uri[] result = new Uri[numSelectedFiles];
|
|
223
|
+
for (int i = 0; i < numSelectedFiles; i++) {
|
|
224
|
+
result[i] = data.getClipData().getItemAt(i).getUri();
|
|
225
|
+
}
|
|
226
|
+
return result;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// we have one file selected
|
|
230
|
+
if (data.getData() != null && resultCode == RESULT_OK && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
231
|
+
return WebChromeClient.FileChooserParams.parseResult(resultCode, data);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
public void startPhotoPickerIntent(String acceptType, ValueCallback<Uri> callback) {
|
|
238
|
+
mFilePathCallbackLegacy = callback;
|
|
239
|
+
Activity activity = mContext.getCurrentActivity();
|
|
240
|
+
Intent fileChooserIntent = getFileChooserIntent(acceptType);
|
|
241
|
+
Intent chooserIntent = Intent.createChooser(fileChooserIntent, "");
|
|
242
|
+
|
|
243
|
+
ArrayList<Parcelable> extraIntents = new ArrayList<>();
|
|
244
|
+
if (acceptsImages(acceptType)) {
|
|
245
|
+
Intent photoIntent = getPhotoIntent();
|
|
246
|
+
if (photoIntent != null) {
|
|
247
|
+
extraIntents.add(photoIntent);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
if (acceptsVideo(acceptType)) {
|
|
251
|
+
Intent videoIntent = getVideoIntent();
|
|
252
|
+
if (videoIntent != null) {
|
|
253
|
+
extraIntents.add(videoIntent);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, extraIntents.toArray(new Parcelable[]{}));
|
|
257
|
+
|
|
258
|
+
if (chooserIntent.resolveActivity(activity.getPackageManager()) != null) {
|
|
259
|
+
activity.startActivityForResult(chooserIntent, PICKER_LEGACY);
|
|
260
|
+
} else {
|
|
261
|
+
Log.w("BPCWebViewModule", "there is no Activity to handle this Intent");
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
public boolean startPhotoPickerIntent(final String[] acceptTypes, final boolean allowMultiple, final ValueCallback<Uri[]> callback, final boolean isCaptureEnabled) {
|
|
266
|
+
mFilePathCallback = callback;
|
|
267
|
+
Activity activity = mContext.getCurrentActivity();
|
|
268
|
+
|
|
269
|
+
ArrayList<Parcelable> extraIntents = new ArrayList<>();
|
|
270
|
+
Intent photoIntent = null;
|
|
271
|
+
if (!needsCameraPermission()) {
|
|
272
|
+
if (acceptsImages(acceptTypes)) {
|
|
273
|
+
photoIntent = getPhotoIntent();
|
|
274
|
+
if (photoIntent != null) {
|
|
275
|
+
extraIntents.add(photoIntent);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (acceptsVideo(acceptTypes)) {
|
|
279
|
+
Intent videoIntent = getVideoIntent();
|
|
280
|
+
if (videoIntent != null) {
|
|
281
|
+
extraIntents.add(videoIntent);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER);
|
|
287
|
+
if (isCaptureEnabled) {
|
|
288
|
+
chooserIntent = photoIntent;
|
|
289
|
+
} else {
|
|
290
|
+
Intent fileSelectionIntent = getFileChooserIntent(acceptTypes, allowMultiple);
|
|
291
|
+
|
|
292
|
+
chooserIntent.putExtra(Intent.EXTRA_INTENT, fileSelectionIntent);
|
|
293
|
+
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, extraIntents.toArray(new Parcelable[]{}));
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if (chooserIntent != null) {
|
|
297
|
+
if (chooserIntent.resolveActivity(activity.getPackageManager()) != null) {
|
|
298
|
+
activity.startActivityForResult(chooserIntent, PICKER);
|
|
299
|
+
} else {
|
|
300
|
+
Log.w("BPCWebViewModule", "there is no Activity to handle this Intent");
|
|
301
|
+
}
|
|
302
|
+
} else {
|
|
303
|
+
Log.w("BPCWebViewModule", "there is no Camera permission");
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
public void setDownloadRequest(DownloadManager.Request request) {
|
|
310
|
+
mDownloadRequest = request;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
public void downloadFile(String downloadingMessage) {
|
|
314
|
+
DownloadManager dm = (DownloadManager) mContext.getSystemService(Context.DOWNLOAD_SERVICE);
|
|
315
|
+
|
|
316
|
+
try {
|
|
317
|
+
dm.enqueue(mDownloadRequest);
|
|
318
|
+
} catch (IllegalArgumentException | SecurityException e) {
|
|
319
|
+
Log.w("BPCWebViewModule", "Unsupported URI, aborting download", e);
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
Toast.makeText(mContext, downloadingMessage, Toast.LENGTH_LONG).show();
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
public boolean grantFileDownloaderPermissions(String downloadingMessage, String lackPermissionToDownloadMessage) {
|
|
327
|
+
Activity activity = mContext.getCurrentActivity();
|
|
328
|
+
// Permission not required for Android Q and above
|
|
329
|
+
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P) {
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
boolean result = ContextCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
|
|
334
|
+
if (!result && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
335
|
+
PermissionAwareActivity PAactivity = getPermissionAwareActivity();
|
|
336
|
+
PAactivity.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, FILE_DOWNLOAD_PERMISSION_REQUEST, getWebviewFileDownloaderPermissionListener(downloadingMessage, lackPermissionToDownloadMessage));
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return result;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
protected boolean needsCameraPermission() {
|
|
343
|
+
Activity activity = mContext.getCurrentActivity();
|
|
344
|
+
boolean needed = false;
|
|
345
|
+
|
|
346
|
+
PackageManager packageManager = activity.getPackageManager();
|
|
347
|
+
try {
|
|
348
|
+
String[] requestedPermissions = packageManager.getPackageInfo(activity.getApplicationContext().getPackageName(), PackageManager.GET_PERMISSIONS).requestedPermissions;
|
|
349
|
+
if (Arrays.asList(requestedPermissions).contains(Manifest.permission.CAMERA)
|
|
350
|
+
&& ContextCompat.checkSelfPermission(activity, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
|
|
351
|
+
needed = true;
|
|
352
|
+
}
|
|
353
|
+
} catch (PackageManager.NameNotFoundException e) {
|
|
354
|
+
needed = true;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
return needed;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
public Intent getPhotoIntent() {
|
|
361
|
+
Intent intent = null;
|
|
362
|
+
|
|
363
|
+
try {
|
|
364
|
+
mOutputImage = getCapturedFile(MimeType.IMAGE);
|
|
365
|
+
Uri outputImageUri = getOutputUri(mOutputImage);
|
|
366
|
+
intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
|
367
|
+
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputImageUri);
|
|
368
|
+
} catch (IOException | IllegalArgumentException e) {
|
|
369
|
+
Log.e("CREATE FILE", "Error occurred while creating the File", e);
|
|
370
|
+
e.printStackTrace();
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
return intent;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
public Intent getVideoIntent() {
|
|
377
|
+
Intent intent = null;
|
|
378
|
+
|
|
379
|
+
try {
|
|
380
|
+
mOutputVideo = getCapturedFile(MimeType.VIDEO);
|
|
381
|
+
Uri outputVideoUri = getOutputUri(mOutputVideo);
|
|
382
|
+
intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
|
|
383
|
+
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputVideoUri);
|
|
384
|
+
} catch (IOException | IllegalArgumentException e) {
|
|
385
|
+
Log.e("CREATE FILE", "Error occurred while creating the File", e);
|
|
386
|
+
e.printStackTrace();
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
return intent;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
private Intent getFileChooserIntent(String acceptTypes) {
|
|
393
|
+
String _acceptTypes = acceptTypes;
|
|
394
|
+
if (acceptTypes.isEmpty()) {
|
|
395
|
+
_acceptTypes = MimeType.DEFAULT.value;
|
|
396
|
+
}
|
|
397
|
+
if (acceptTypes.matches("\\.\\w+")) {
|
|
398
|
+
_acceptTypes = getMimeTypeFromExtension(acceptTypes.replace(".", ""));
|
|
399
|
+
}
|
|
400
|
+
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
|
401
|
+
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
|
402
|
+
intent.setType(_acceptTypes);
|
|
403
|
+
return intent;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
private Intent getFileChooserIntent(String[] acceptTypes, boolean allowMultiple) {
|
|
407
|
+
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
|
408
|
+
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
|
409
|
+
intent.setType(MimeType.DEFAULT.value);
|
|
410
|
+
intent.putExtra(Intent.EXTRA_MIME_TYPES, getAcceptedMimeType(acceptTypes));
|
|
411
|
+
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, allowMultiple);
|
|
412
|
+
return intent;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
private Boolean acceptsImages(String types) {
|
|
416
|
+
String mimeType = types;
|
|
417
|
+
if (types.matches("\\.\\w+")) {
|
|
418
|
+
mimeType = getMimeTypeFromExtension(types.replace(".", ""));
|
|
419
|
+
}
|
|
420
|
+
return mimeType.isEmpty() || mimeType.toLowerCase().contains(MimeType.IMAGE.value);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
private Boolean acceptsImages(String[] types) {
|
|
424
|
+
String[] mimeTypes = getAcceptedMimeType(types);
|
|
425
|
+
return arrayContainsString(mimeTypes, MimeType.DEFAULT.value) || arrayContainsString(mimeTypes, MimeType.IMAGE.value);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
private Boolean acceptsVideo(String types) {
|
|
429
|
+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
|
430
|
+
return false;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
String mimeType = types;
|
|
434
|
+
if (types.matches("\\.\\w+")) {
|
|
435
|
+
mimeType = getMimeTypeFromExtension(types.replace(".", ""));
|
|
436
|
+
}
|
|
437
|
+
return mimeType.isEmpty() || mimeType.toLowerCase().contains(MimeType.VIDEO.value);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
private Boolean acceptsVideo(String[] types) {
|
|
441
|
+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
|
442
|
+
return false;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
String[] mimeTypes = getAcceptedMimeType(types);
|
|
446
|
+
return arrayContainsString(mimeTypes, MimeType.DEFAULT.value) || arrayContainsString(mimeTypes, MimeType.VIDEO.value);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
private Boolean arrayContainsString(String[] array, String pattern) {
|
|
450
|
+
for (String content : array) {
|
|
451
|
+
if (content.contains(pattern)) {
|
|
452
|
+
return true;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
return false;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
private String[] getAcceptedMimeType(String[] types) {
|
|
459
|
+
if (noAcceptTypesSet(types)) {
|
|
460
|
+
return new String[]{MimeType.DEFAULT.value};
|
|
461
|
+
}
|
|
462
|
+
String[] mimeTypes = new String[types.length];
|
|
463
|
+
for (int i = 0; i < types.length; i++) {
|
|
464
|
+
String t = types[i];
|
|
465
|
+
// convert file extensions to mime types
|
|
466
|
+
if (t.matches("\\.\\w+")) {
|
|
467
|
+
String mimeType = getMimeTypeFromExtension(t.replace(".", ""));
|
|
468
|
+
if(mimeType != null) {
|
|
469
|
+
mimeTypes[i] = mimeType;
|
|
470
|
+
} else {
|
|
471
|
+
mimeTypes[i] = t;
|
|
472
|
+
}
|
|
473
|
+
} else {
|
|
474
|
+
mimeTypes[i] = t;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
return mimeTypes;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
private String getMimeTypeFromExtension(String extension) {
|
|
481
|
+
String type = null;
|
|
482
|
+
if (extension != null) {
|
|
483
|
+
type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
|
|
484
|
+
}
|
|
485
|
+
return type;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
public Uri getOutputUri(File capturedFile) {
|
|
489
|
+
// for versions below 6.0 (23) we use the old File creation & permissions model
|
|
490
|
+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
|
491
|
+
return Uri.fromFile(capturedFile);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// for versions 6.0+ (23) we use the FileProvider to avoid runtime permissions
|
|
495
|
+
String packageName = mContext.getPackageName();
|
|
496
|
+
return FileProvider.getUriForFile(mContext, packageName + ".fileprovider", capturedFile);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
public File getCapturedFile(MimeType mimeType) throws IOException {
|
|
500
|
+
String prefix = "";
|
|
501
|
+
String suffix = "";
|
|
502
|
+
String dir = "";
|
|
503
|
+
|
|
504
|
+
switch (mimeType) {
|
|
505
|
+
case IMAGE:
|
|
506
|
+
prefix = "image-";
|
|
507
|
+
suffix = ".jpg";
|
|
508
|
+
dir = Environment.DIRECTORY_PICTURES;
|
|
509
|
+
break;
|
|
510
|
+
case VIDEO:
|
|
511
|
+
prefix = "video-";
|
|
512
|
+
suffix = ".mp4";
|
|
513
|
+
dir = Environment.DIRECTORY_MOVIES;
|
|
514
|
+
break;
|
|
515
|
+
|
|
516
|
+
default:
|
|
517
|
+
break;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
String filename = prefix + String.valueOf(System.currentTimeMillis()) + suffix;
|
|
521
|
+
File outputFile = null;
|
|
522
|
+
|
|
523
|
+
// for versions below 6.0 (23) we use the old File creation & permissions model
|
|
524
|
+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
|
525
|
+
// only this Directory works on all tested Android versions
|
|
526
|
+
// ctx.getExternalFilesDir(dir) was failing on Android 5.0 (sdk 21)
|
|
527
|
+
File storageDir = Environment.getExternalStoragePublicDirectory(dir);
|
|
528
|
+
outputFile = new File(storageDir, filename);
|
|
529
|
+
} else {
|
|
530
|
+
File storageDir = mContext.getExternalFilesDir(null);
|
|
531
|
+
outputFile = File.createTempFile(prefix, suffix, storageDir);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
return outputFile;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
private Boolean noAcceptTypesSet(String[] types) {
|
|
538
|
+
// when our array returned from getAcceptTypes() has no values set from the webview
|
|
539
|
+
// i.e. <input type="file" />, without any "accept" attr
|
|
540
|
+
// will be an array with one empty string element, afaik
|
|
541
|
+
|
|
542
|
+
return types.length == 0 || (types.length == 1 && types[0] != null && types[0].length() == 0);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
private PermissionAwareActivity getPermissionAwareActivity() {
|
|
546
|
+
Activity activity = mContext.getCurrentActivity();
|
|
547
|
+
if (activity == null) {
|
|
548
|
+
throw new IllegalStateException("Tried to use permissions API while not attached to an Activity.");
|
|
549
|
+
} else if (!(activity instanceof PermissionAwareActivity)) {
|
|
550
|
+
throw new IllegalStateException("Tried to use permissions API but the host Activity doesn't implement PermissionAwareActivity.");
|
|
551
|
+
}
|
|
552
|
+
return (PermissionAwareActivity) activity;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
package kr.co.bootpay.webview;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
|
|
5
|
+
import com.facebook.react.TurboReactPackage;
|
|
6
|
+
import com.facebook.react.bridge.NativeModule;
|
|
7
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
8
|
+
import com.facebook.react.module.model.ReactModuleInfo;
|
|
9
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider;
|
|
10
|
+
import com.facebook.react.uimanager.ViewManager;
|
|
11
|
+
|
|
12
|
+
import java.util.ArrayList;
|
|
13
|
+
import java.util.HashMap;
|
|
14
|
+
import java.util.List;
|
|
15
|
+
import java.util.Map;
|
|
16
|
+
|
|
17
|
+
public class BPCWebViewPackage extends TurboReactPackage {
|
|
18
|
+
|
|
19
|
+
@Override
|
|
20
|
+
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
|
21
|
+
List<ViewManager> viewManagers = new ArrayList<>();
|
|
22
|
+
viewManagers.add(new BPCWebViewManager());
|
|
23
|
+
return viewManagers;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@Override
|
|
27
|
+
public ReactModuleInfoProvider getReactModuleInfoProvider() {
|
|
28
|
+
return () -> {
|
|
29
|
+
final Map<String, ReactModuleInfo> moduleInfos = new HashMap<>();
|
|
30
|
+
boolean isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
|
|
31
|
+
moduleInfos.put(
|
|
32
|
+
BPCWebViewModuleImpl.NAME,
|
|
33
|
+
new ReactModuleInfo(
|
|
34
|
+
BPCWebViewModuleImpl.NAME,
|
|
35
|
+
BPCWebViewModuleImpl.NAME,
|
|
36
|
+
false, // canOverrideExistingModule
|
|
37
|
+
false, // needsEagerInit
|
|
38
|
+
true, // hasConstants
|
|
39
|
+
false, // isCxxModule
|
|
40
|
+
isTurboModule // isTurboModule
|
|
41
|
+
));
|
|
42
|
+
return moduleInfos;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@Nullable
|
|
47
|
+
@Override
|
|
48
|
+
public NativeModule getModule(String name, ReactApplicationContext reactContext) {
|
|
49
|
+
if (name.equals(BPCWebViewModuleImpl.NAME)) {
|
|
50
|
+
return new BPCWebViewModule(reactContext);
|
|
51
|
+
} else {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
}
|