react-native-webview-bootpay 13.13.43-3.alpha.2 → 13.13.44
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/android/src/main/AndroidManifest.xml +84 -0
- package/android/src/main/AndroidManifestNew.xml +84 -0
- package/android/src/main/java/kr/co/bootpay/webview/BPCWebChromeClient.java +174 -14
- package/android/src/main/java/kr/co/bootpay/webview/BPCWebView.java +25 -1
- package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewClient.java +48 -0
- package/android/src/main/java/kr/co/bootpay/webview/BootpayUrlHelper.java +138 -0
- package/index.d.ts +54 -48
- package/ios/RNCWebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/RNCWebView.xcodeproj/project.xcworkspace/xcuserdata/taesupyoon.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/RNCWebView.xcodeproj/xcuserdata/taesupyoon.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/lib/NativeBPCWebViewModule.d.ts +2 -2
- package/lib/NativeBPCWebViewModule.js +1 -1
- package/lib/WebView.android.js +1 -1
- package/lib/WebView.ios.js +1 -1
- package/lib/WebView.js +1 -1
- package/lib/WebView.macos.js +1 -1
- package/lib/WebView.windows.js +1 -1
- package/lib/WebViewShared.js +1 -1
- package/package.json +2 -3
- package/react-native-webview-bootpay.podspec +46 -0
- package/src/NativeBPCWebViewModule.ts +2 -21
|
@@ -12,4 +12,88 @@
|
|
|
12
12
|
android:resource="@xml/file_provider_paths" />
|
|
13
13
|
</provider>
|
|
14
14
|
</application>
|
|
15
|
+
|
|
16
|
+
<!-- android 11 모든 앱 접근 권한 사용 (Google Play 가이드라인 참고 - 2021-02-19 기준 못찾았음) -->
|
|
17
|
+
<!-- <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" tools:ignore="QueryAllPackagesPermission" />-->
|
|
18
|
+
<!-- android 11 Package Visibility 설정 (compileSdkVersion, targetSdkVersion 30 이상 설정시 필수) -->
|
|
19
|
+
<!-- 2021-02-19 -->
|
|
20
|
+
<queries>
|
|
21
|
+
<!-- 다날[신한, BC(페이북), 국민, 현대, 삼성, 하나, 롯데, 농협, 우리, 씨티, 페이코, 삼성페이, 카카오페이, 뱅크페이, SSG페이, 스마일페이, 엘페이] -->
|
|
22
|
+
<!-- KCP [페이코, 현대, BC(페이북), 롯데, 국민, 농협, 삼성, 신한, 우리, 하나, 씨티] -->
|
|
23
|
+
<!-- 이니시스 [카카오페이, 네이버페이, 신한, 하나, 현대, 삼성, 국민, BC(페이북), 농협, 롯데, 씨티, 페이코, 엘페이, SSG페이, 차이, 토스, 삼성페이] -->
|
|
24
|
+
<!-- 나이스페이 [신한, 국민, 삼성, BC(페이북), 롯데, 현대, 하나 농협, 씨티, 우리] -->
|
|
25
|
+
<!-- 토스페이먼츠 [현대, 신한, 페이북, 국민, 삼성, 롯데, 농협, 우리] -->
|
|
26
|
+
<!-- 이지페이 [현대, 하나, 국민, 롯데, 삼성, BC(페이북) 신한, 하나, 농협, 씨티, 우리, 페이코] -->
|
|
27
|
+
<!-- 티페이 [BC(페이북), 국민, 하나, 삼성, 신한, 현대, 롯데, 농협, 씨티, 우리] -->
|
|
28
|
+
<!-- 페이레터 [BC(페이북), 국민, 하나, 삼성, 신한, 현대. 롯데, 농협, 씨티, ] -->
|
|
29
|
+
<!-- 월컴페이먼츠 [카카오스, 엘페이, 현대, BC(페이북), 국민, 삼성, 신한, 롯데, 농협, 하나, 씨티, 하나, 우리] -->
|
|
30
|
+
|
|
31
|
+
<!-- 간편결제 -->
|
|
32
|
+
<package android:name="com.nhnent.payapp" /> <!-- 페이코 -->
|
|
33
|
+
<package android:name="com.lottemembers.android" /> <!-- LPAY -->
|
|
34
|
+
<package android:name="com.ssg.serviceapp.android.egiftcertificate" /> <!-- SSG 페이 -->
|
|
35
|
+
<package android:name="com.inicis.kpay" /> <!-- 이니시스 KPAY -->
|
|
36
|
+
<package android:name="com.tmoney.tmpay" /> <!-- 티머니페이 -->
|
|
37
|
+
<package android:name="viva.republica.toss" /> <!-- 토스페이 -->
|
|
38
|
+
<package android:name="com.kakao.talk" /> <!-- 카카오페이 -->
|
|
39
|
+
<package android:name="com.mysmilepay.app" /> <!-- 스마일 페이 -->
|
|
40
|
+
<package android:name="com.lotte.lpay" /> <!-- 엘페이 -->
|
|
41
|
+
<package android:name="finance.chai.app" /> <!-- 차이 -->
|
|
42
|
+
<package android:name="com.nhn.android.search" /> <!-- 네이버 -->
|
|
43
|
+
|
|
44
|
+
<!-- 앱카드 -->
|
|
45
|
+
<package android:name="kvp.jjy.MispAndroid320" /> <!-- BC 페이북 -->
|
|
46
|
+
<package android:name="com.kbcard.kbkookmincard" /> <!-- 국민카드 -->
|
|
47
|
+
<package android:name="com.kbcard.cxh.appcard" /> <!-- 국민카드 -->
|
|
48
|
+
<package android:name="com.kbstar.liivbank" /> <!-- 국민 리브 -->
|
|
49
|
+
<package android:name="com.kbstar.reboot" /> <!-- 국민 new 리브 -->
|
|
50
|
+
<package android:name="com.kbstar.kbbank" /> <!-- KB 스타뱅킹 -->
|
|
51
|
+
|
|
52
|
+
<package android:name="com.samsung.android.spay" /> <!-- 삼성페이 -->
|
|
53
|
+
<package android:name="com.samsung.android.spaylite" /> <!-- 삼성페이 미니 -->
|
|
54
|
+
<package android:name="com.lge.lgpay" /> <!-- 엘지페이 -->
|
|
55
|
+
<package android:name="com.hanaskcard.paycla" /> <!-- 하나카드 -->
|
|
56
|
+
<package android:name="kr.co.hanamembers.hmscustomer" /> <!-- 하나카드(멤버스결제) -->
|
|
57
|
+
<package android:name="com.lcacApp" /> <!-- 롯데카드 -->
|
|
58
|
+
<package android:name="kr.co.samsungcard.mpocket" /> <!-- 삼성카드 -->
|
|
59
|
+
<package android:name="com.shcard.smartpay" /> <!-- 신한카드-->
|
|
60
|
+
<package android:name="com.shinhan.smartcaremgr" /> <!-- 신한 쏠-->
|
|
61
|
+
<package android:name="com.shinhancard.smartshinhan" /> <!-- 신한카드 (ARS/일반결제/Smart결제) -->
|
|
62
|
+
<package android:name="com.hyundaicard.appcard" /> <!-- 현대카드 -->
|
|
63
|
+
<package android:name="nh.smart.nhallonepay" /> <!-- 농협카드 -->
|
|
64
|
+
<package android:name="com.wooricard.wpay" /> <!-- 우리카드 -->
|
|
65
|
+
<package android:name="com.wooricard.smartapp" /> <!-- 우리 WON 카드 -->
|
|
66
|
+
<package android:name="com.wooribank.smart.npib" /> <!-- 우리 WON 뱅킹 -->
|
|
67
|
+
<package android:name="kr.co.citibank.citimobile" /> <!-- 씨티카드 -->
|
|
68
|
+
<package android:name="com.mobiletoong.travelwallet" /> <!-- 트레블월렛 -->
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
<!-- 계좌이체 -->
|
|
73
|
+
<package android:name="com.kftc.bankpay.android" /> <!-- 뱅크페이 -->
|
|
74
|
+
<package android:name="com.kbankwith.smartbank" /> <!-- 케이뱅크 -->
|
|
75
|
+
<package android:name="com.knb.psb" /> <!-- BNK 경남은행 모바일뱅킹 -->
|
|
76
|
+
<package android:name="kr.co.kfcc.mobilebank" /> <!-- MG 새마을금고 -->
|
|
77
|
+
<package android:name="com.nh.cashcardapp" /> <!-- NH앱캐시 -->
|
|
78
|
+
|
|
79
|
+
<!-- 공인인증(신용카드) -->
|
|
80
|
+
<package android:name="com.hanaskcard.rocomo.potal" /> <!-- 하나카드 -->
|
|
81
|
+
<package android:name="com.lumensoft.touchenappfree" /> <!-- 현대카드 -->
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
<!-- 보안앱 -->
|
|
85
|
+
<package android:name="com.TouchEn.mVaccine.webs" /> <!-- 신한, 씨티 -->
|
|
86
|
+
<package android:name="kr.co.shiftworks.vguardweb" /> <!-- 삼성 -->
|
|
87
|
+
<package android:name="com.ahnlab.v3mobileplus" /> <!-- 하나, 농협, 우리, 국민 리브 -->
|
|
88
|
+
|
|
89
|
+
<!-- 휴대폰 결제 -->
|
|
90
|
+
<package android:name="com.kt.ktauth" /> <!-- KT 본인인증 -->
|
|
91
|
+
<package android:name="kr.danal.app.damoum" /> <!-- 다모음 -->
|
|
92
|
+
<package android:name="uplus.membership" /> <!-- U+ 멤버스 -->
|
|
93
|
+
<package android:name="com.sktelecom.tauth" /> <!--PASS-->
|
|
94
|
+
<package android:name="com.lguplus.smartotp" /> <!--PASS-->
|
|
95
|
+
|
|
96
|
+
<!--해외결제-->
|
|
97
|
+
<package android:name="com.eg.android.AlipayGphone" />
|
|
98
|
+
</queries>
|
|
15
99
|
</manifest>
|
|
@@ -10,4 +10,88 @@
|
|
|
10
10
|
android:resource="@xml/file_provider_paths" />
|
|
11
11
|
</provider>
|
|
12
12
|
</application>
|
|
13
|
+
|
|
14
|
+
<!-- android 11 모든 앱 접근 권한 사용 (Google Play 가이드라인 참고 - 2021-02-19 기준 못찾았음) -->
|
|
15
|
+
<!-- <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" tools:ignore="QueryAllPackagesPermission" />-->
|
|
16
|
+
<!-- android 11 Package Visibility 설정 (compileSdkVersion, targetSdkVersion 30 이상 설정시 필수) -->
|
|
17
|
+
<!-- 2021-02-19 -->
|
|
18
|
+
<queries>
|
|
19
|
+
<!-- 다날[신한, BC(페이북), 국민, 현대, 삼성, 하나, 롯데, 농협, 우리, 씨티, 페이코, 삼성페이, 카카오페이, 뱅크페이, SSG페이, 스마일페이, 엘페이] -->
|
|
20
|
+
<!-- KCP [페이코, 현대, BC(페이북), 롯데, 국민, 농협, 삼성, 신한, 우리, 하나, 씨티] -->
|
|
21
|
+
<!-- 이니시스 [카카오페이, 네이버페이, 신한, 하나, 현대, 삼성, 국민, BC(페이북), 농협, 롯데, 씨티, 페이코, 엘페이, SSG페이, 차이, 토스, 삼성페이] -->
|
|
22
|
+
<!-- 나이스페이 [신한, 국민, 삼성, BC(페이북), 롯데, 현대, 하나 농협, 씨티, 우리] -->
|
|
23
|
+
<!-- 토스페이먼츠 [현대, 신한, 페이북, 국민, 삼성, 롯데, 농협, 우리] -->
|
|
24
|
+
<!-- 이지페이 [현대, 하나, 국민, 롯데, 삼성, BC(페이북) 신한, 하나, 농협, 씨티, 우리, 페이코] -->
|
|
25
|
+
<!-- 티페이 [BC(페이북), 국민, 하나, 삼성, 신한, 현대, 롯데, 농협, 씨티, 우리] -->
|
|
26
|
+
<!-- 페이레터 [BC(페이북), 국민, 하나, 삼성, 신한, 현대. 롯데, 농협, 씨티, ] -->
|
|
27
|
+
<!-- 월컴페이먼츠 [카카오스, 엘페이, 현대, BC(페이북), 국민, 삼성, 신한, 롯데, 농협, 하나, 씨티, 하나, 우리] -->
|
|
28
|
+
|
|
29
|
+
<!-- 간편결제 -->
|
|
30
|
+
<package android:name="com.nhnent.payapp" /> <!-- 페이코 -->
|
|
31
|
+
<package android:name="com.lottemembers.android" /> <!-- LPAY -->
|
|
32
|
+
<package android:name="com.ssg.serviceapp.android.egiftcertificate" /> <!-- SSG 페이 -->
|
|
33
|
+
<package android:name="com.inicis.kpay" /> <!-- 이니시스 KPAY -->
|
|
34
|
+
<package android:name="com.tmoney.tmpay" /> <!-- 티머니페이 -->
|
|
35
|
+
<package android:name="viva.republica.toss" /> <!-- 토스페이 -->
|
|
36
|
+
<package android:name="com.kakao.talk" /> <!-- 카카오페이 -->
|
|
37
|
+
<package android:name="com.mysmilepay.app" /> <!-- 스마일 페이 -->
|
|
38
|
+
<package android:name="com.lotte.lpay" /> <!-- 엘페이 -->
|
|
39
|
+
<package android:name="finance.chai.app" /> <!-- 차이 -->
|
|
40
|
+
<package android:name="com.nhn.android.search" /> <!-- 네이버 -->
|
|
41
|
+
|
|
42
|
+
<!-- 앱카드 -->
|
|
43
|
+
<package android:name="kvp.jjy.MispAndroid320" /> <!-- BC 페이북 -->
|
|
44
|
+
<package android:name="com.kbcard.kbkookmincard" /> <!-- 국민카드 -->
|
|
45
|
+
<package android:name="com.kbcard.cxh.appcard" /> <!-- 국민카드 -->
|
|
46
|
+
<package android:name="com.kbstar.liivbank" /> <!-- 국민 리브 -->
|
|
47
|
+
<package android:name="com.kbstar.reboot" /> <!-- 국민 new 리브 -->
|
|
48
|
+
<package android:name="com.kbstar.kbbank" /> <!-- KB 스타뱅킹 -->
|
|
49
|
+
|
|
50
|
+
<package android:name="com.samsung.android.spay" /> <!-- 삼성페이 -->
|
|
51
|
+
<package android:name="com.samsung.android.spaylite" /> <!-- 삼성페이 미니 -->
|
|
52
|
+
<package android:name="com.lge.lgpay" /> <!-- 엘지페이 -->
|
|
53
|
+
<package android:name="com.hanaskcard.paycla" /> <!-- 하나카드 -->
|
|
54
|
+
<package android:name="kr.co.hanamembers.hmscustomer" /> <!-- 하나카드(멤버스결제) -->
|
|
55
|
+
<package android:name="com.lcacApp" /> <!-- 롯데카드 -->
|
|
56
|
+
<package android:name="kr.co.samsungcard.mpocket" /> <!-- 삼성카드 -->
|
|
57
|
+
<package android:name="com.shcard.smartpay" /> <!-- 신한카드-->
|
|
58
|
+
<package android:name="com.shinhan.smartcaremgr" /> <!-- 신한 쏠-->
|
|
59
|
+
<package android:name="com.shinhancard.smartshinhan" /> <!-- 신한카드 (ARS/일반결제/Smart결제) -->
|
|
60
|
+
<package android:name="com.hyundaicard.appcard" /> <!-- 현대카드 -->
|
|
61
|
+
<package android:name="nh.smart.nhallonepay" /> <!-- 농협카드 -->
|
|
62
|
+
<package android:name="com.wooricard.wpay" /> <!-- 우리카드 -->
|
|
63
|
+
<package android:name="com.wooricard.smartapp" /> <!-- 우리 WON 카드 -->
|
|
64
|
+
<package android:name="com.wooribank.smart.npib" /> <!-- 우리 WON 뱅킹 -->
|
|
65
|
+
<package android:name="kr.co.citibank.citimobile" /> <!-- 씨티카드 -->
|
|
66
|
+
<package android:name="com.mobiletoong.travelwallet" /> <!-- 트레블월렛 -->
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
<!-- 계좌이체 -->
|
|
71
|
+
<package android:name="com.kftc.bankpay.android" /> <!-- 뱅크페이 -->
|
|
72
|
+
<package android:name="com.kbankwith.smartbank" /> <!-- 케이뱅크 -->
|
|
73
|
+
<package android:name="com.knb.psb" /> <!-- BNK 경남은행 모바일뱅킹 -->
|
|
74
|
+
<package android:name="kr.co.kfcc.mobilebank" /> <!-- MG 새마을금고 -->
|
|
75
|
+
<package android:name="com.nh.cashcardapp" /> <!-- NH앱캐시 -->
|
|
76
|
+
|
|
77
|
+
<!-- 공인인증(신용카드) -->
|
|
78
|
+
<package android:name="com.hanaskcard.rocomo.potal" /> <!-- 하나카드 -->
|
|
79
|
+
<package android:name="com.lumensoft.touchenappfree" /> <!-- 현대카드 -->
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
<!-- 보안앱 -->
|
|
83
|
+
<package android:name="com.TouchEn.mVaccine.webs" /> <!-- 신한, 씨티 -->
|
|
84
|
+
<package android:name="kr.co.shiftworks.vguardweb" /> <!-- 삼성 -->
|
|
85
|
+
<package android:name="com.ahnlab.v3mobileplus" /> <!-- 하나, 농협, 우리, 국민 리브 -->
|
|
86
|
+
|
|
87
|
+
<!-- 휴대폰 결제 -->
|
|
88
|
+
<package android:name="com.kt.ktauth" /> <!-- KT 본인인증 -->
|
|
89
|
+
<package android:name="kr.danal.app.damoum" /> <!-- 다모음 -->
|
|
90
|
+
<package android:name="uplus.membership" /> <!-- U+ 멤버스 -->
|
|
91
|
+
<package android:name="com.sktelecom.tauth" /> <!--PASS-->
|
|
92
|
+
<package android:name="com.lguplus.smartotp" /> <!--PASS-->
|
|
93
|
+
|
|
94
|
+
<!--해외결제-->
|
|
95
|
+
<package android:name="com.eg.android.AlipayGphone" />
|
|
96
|
+
</queries>
|
|
13
97
|
</manifest>
|
|
@@ -3,38 +3,63 @@ package kr.co.bootpay.webview;
|
|
|
3
3
|
import android.Manifest;
|
|
4
4
|
import android.annotation.TargetApi;
|
|
5
5
|
import android.app.Activity;
|
|
6
|
+
import android.app.AlertDialog;
|
|
6
7
|
import android.content.pm.PackageManager;
|
|
7
8
|
import android.net.Uri;
|
|
9
|
+
import android.net.http.SslError;
|
|
8
10
|
import android.os.Build;
|
|
9
11
|
import android.os.Message;
|
|
10
12
|
import android.view.Gravity;
|
|
13
|
+
import android.view.KeyEvent;
|
|
11
14
|
import android.view.View;
|
|
12
15
|
import android.view.ViewGroup;
|
|
16
|
+
import android.view.WindowManager;
|
|
17
|
+
|
|
13
18
|
import android.webkit.ConsoleMessage;
|
|
14
19
|
import android.webkit.GeolocationPermissions;
|
|
15
20
|
import android.webkit.PermissionRequest;
|
|
21
|
+
import android.webkit.SslErrorHandler;
|
|
16
22
|
import android.webkit.ValueCallback;
|
|
17
23
|
import android.webkit.WebChromeClient;
|
|
18
24
|
import android.webkit.WebView;
|
|
19
25
|
import android.webkit.WebViewClient;
|
|
20
26
|
import android.widget.FrameLayout;
|
|
27
|
+
|
|
28
|
+
import android.content.Intent;
|
|
29
|
+
import android.annotation.SuppressLint;
|
|
30
|
+
import android.net.http.SslError;
|
|
21
31
|
|
|
22
32
|
import androidx.annotation.RequiresApi;
|
|
23
33
|
import androidx.core.content.ContextCompat;
|
|
24
34
|
|
|
25
35
|
import com.facebook.react.bridge.Arguments;
|
|
26
36
|
import com.facebook.react.bridge.LifecycleEventListener;
|
|
37
|
+
import com.facebook.react.bridge.ReactNoCrashSoftException;
|
|
27
38
|
import com.facebook.react.bridge.WritableMap;
|
|
28
39
|
import com.facebook.react.common.build.ReactBuildConfig;
|
|
29
40
|
import com.facebook.react.modules.core.PermissionAwareActivity;
|
|
30
41
|
import com.facebook.react.modules.core.PermissionListener;
|
|
31
42
|
import com.facebook.react.uimanager.UIManagerHelper;
|
|
43
|
+
import com.facebook.react.uimanager.ThemedReactContext;
|
|
44
|
+
import com.facebook.react.uimanager.UIManagerModule;
|
|
45
|
+
|
|
46
|
+
|
|
32
47
|
import kr.co.bootpay.webview.events.TopLoadingProgressEvent;
|
|
33
48
|
import kr.co.bootpay.webview.events.TopOpenWindowEvent;
|
|
34
49
|
|
|
35
50
|
import java.util.ArrayList;
|
|
36
51
|
import java.util.Collections;
|
|
37
52
|
import java.util.List;
|
|
53
|
+
import android.util.Log;
|
|
54
|
+
|
|
55
|
+
import android.app.Dialog;
|
|
56
|
+
import android.content.Context;
|
|
57
|
+
import android.content.Intent;
|
|
58
|
+
import android.widget.Toast;
|
|
59
|
+
|
|
60
|
+
import org.json.JSONException;
|
|
61
|
+
import org.json.JSONObject;
|
|
62
|
+
import android.content.DialogInterface;
|
|
38
63
|
|
|
39
64
|
public class BPCWebChromeClient extends WebChromeClient implements LifecycleEventListener {
|
|
40
65
|
protected static final FrameLayout.LayoutParams FULLSCREEN_LAYOUT_PARAMS = new FrameLayout.LayoutParams(
|
|
@@ -79,41 +104,162 @@ public class BPCWebChromeClient extends WebChromeClient implements LifecycleEven
|
|
|
79
104
|
protected BPCWebView.ProgressChangedFilter progressChangedFilter = null;
|
|
80
105
|
protected boolean mAllowsProtectedMedia = false;
|
|
81
106
|
|
|
82
|
-
protected boolean mHasOnOpenWindowEvent = false;
|
|
107
|
+
protected boolean mHasOnOpenWindowEvent = false;
|
|
83
108
|
|
|
84
109
|
public BPCWebChromeClient(BPCWebView webView) {
|
|
85
110
|
this.mWebView = webView;
|
|
86
111
|
}
|
|
112
|
+
|
|
87
113
|
|
|
114
|
+
boolean isPopupWebView = false;
|
|
88
115
|
@Override
|
|
89
116
|
public boolean onCreateWindow(WebView view, boolean isDialog, boolean isUserGesture, Message resultMsg) {
|
|
90
117
|
|
|
91
|
-
|
|
118
|
+
ThemedReactContext reactContext = (ThemedReactContext) view.getContext();
|
|
119
|
+
final BPCWebView newWebView = new BPCWebView(reactContext);
|
|
92
120
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
public boolean shouldOverrideUrlLoading (WebView subview, String url) {
|
|
97
|
-
WritableMap event = Arguments.createMap();
|
|
98
|
-
event.putString("targetUrl", url);
|
|
121
|
+
BPCWebChromeClient client = new BPCWebChromeClient(newWebView);
|
|
122
|
+
client.setProgressChangedFilter(progressChangedFilter);
|
|
123
|
+
newWebView.setWebChromeClient(client);
|
|
99
124
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
new TopOpenWindowEvent(BPCWebViewWrapper.getReactTagFromWebView(view), event)
|
|
103
|
-
);
|
|
125
|
+
Log.d("BPCWebChromeClient", "onCreateWindow");
|
|
126
|
+
isPopupWebView = true;
|
|
104
127
|
|
|
128
|
+
setWebSettingCopy(view, newWebView);
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
newWebView.setWebViewClient(new WebViewClient(){
|
|
132
|
+
@Override
|
|
133
|
+
public boolean shouldOverrideUrlLoading (WebView subview, String url) {
|
|
134
|
+
|
|
135
|
+
Log.d("bootpay url", url);
|
|
136
|
+
|
|
137
|
+
// return true;
|
|
138
|
+
if(BootpayUrlHelper.shouldOverrideUrlLoading(view, url)) {
|
|
105
139
|
return true;
|
|
106
140
|
}
|
|
107
|
-
|
|
141
|
+
// return shouldOverrideUrlLoadingRN(view, url);
|
|
142
|
+
WritableMap event = Arguments.createMap();
|
|
143
|
+
event.putString("targetUrl", url);
|
|
144
|
+
|
|
145
|
+
((BPCWebView) view).dispatchEvent(
|
|
146
|
+
view,
|
|
147
|
+
new TopOpenWindowEvent(view.getId(), event)
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
return false;
|
|
108
151
|
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
Dialog popupDialog = new Dialog(view.getContext(), android.R.style.Theme_Black_NoTitleBar_Fullscreen);
|
|
155
|
+
popupDialog.setContentView(newWebView);
|
|
156
|
+
ViewGroup.LayoutParams params = popupDialog.getWindow().getAttributes();
|
|
157
|
+
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
|
|
158
|
+
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
|
|
159
|
+
popupDialog.getWindow().setAttributes((WindowManager.LayoutParams) params);
|
|
160
|
+
popupDialog.setOnDismissListener(dialog -> {
|
|
161
|
+
onCloseWindow(view); //rn에선 딱히 동작하지 않음
|
|
162
|
+
});
|
|
163
|
+
newWebView.setDialog(popupDialog);
|
|
164
|
+
popupDialog.show();
|
|
165
|
+
|
|
109
166
|
|
|
110
167
|
final WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
|
|
111
168
|
transport.setWebView(newWebView);
|
|
112
169
|
resultMsg.sendToTarget();
|
|
113
170
|
|
|
171
|
+
// 🔹 팝업을 위한 FrameLayout을 React Native UI 트리에 추가
|
|
172
|
+
// Activity activity = reactContext.getCurrentActivity();
|
|
173
|
+
// if (activity != null) {
|
|
174
|
+
// activity.runOnUiThread(() -> {
|
|
175
|
+
// FrameLayout popupContainer = new FrameLayout(activity);
|
|
176
|
+
// popupContainer.setLayoutParams(new FrameLayout.LayoutParams(
|
|
177
|
+
// ViewGroup.LayoutParams.MATCH_PARENT,
|
|
178
|
+
// ViewGroup.LayoutParams.MATCH_PARENT
|
|
179
|
+
// ));
|
|
180
|
+
// popupContainer.addView(newWebView);
|
|
181
|
+
// ((ViewGroup) activity.findViewById(android.R.id.content)).addView(popupContainer);
|
|
182
|
+
// });
|
|
183
|
+
// } else {
|
|
184
|
+
// Log.e("BPCWebChromeClient", "Activity is null, cannot add popup WebView.");
|
|
185
|
+
// }
|
|
186
|
+
|
|
187
|
+
|
|
114
188
|
return true;
|
|
115
189
|
}
|
|
116
190
|
|
|
191
|
+
|
|
192
|
+
@Override
|
|
193
|
+
public void onCloseWindow(WebView window) {
|
|
194
|
+
super.onCloseWindow(window);
|
|
195
|
+
((BPCWebView) window).dissmissDialog();
|
|
196
|
+
|
|
197
|
+
Log.d("BPCWebChromeClient", "onCloseWindow");
|
|
198
|
+
|
|
199
|
+
isPopupWebView = false;
|
|
200
|
+
// if(mainView != null) {
|
|
201
|
+
// mainView.removeView(window);
|
|
202
|
+
// }
|
|
203
|
+
// window.setVisibility(View.GONE);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
void setWebSettingCopy(WebView view, WebView newWebView) {
|
|
210
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
|
211
|
+
newWebView.getSettings().setMediaPlaybackRequiresUserGesture( view.getSettings().getMediaPlaybackRequiresUserGesture() );
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
newWebView.getSettings().setBuiltInZoomControls(view.getSettings().getBuiltInZoomControls());
|
|
215
|
+
newWebView.getSettings().setDisplayZoomControls(view.getSettings().getDisplayZoomControls());
|
|
216
|
+
newWebView.getSettings().setAllowFileAccess(view.getSettings().getAllowFileAccess());
|
|
217
|
+
newWebView.getSettings().setAllowContentAccess(view.getSettings().getAllowContentAccess());
|
|
218
|
+
newWebView.getSettings().setLoadWithOverviewMode(view.getSettings().getLoadWithOverviewMode());
|
|
219
|
+
// newWebView.getSettings().setEnableSmoothTransition(view.getSettings().);
|
|
220
|
+
newWebView.getSettings().setSaveFormData(view.getSettings().getSaveFormData());
|
|
221
|
+
newWebView.getSettings().setSavePassword(view.getSettings().getSavePassword());
|
|
222
|
+
newWebView.getSettings().setTextZoom(view.getSettings().getTextZoom());
|
|
223
|
+
|
|
224
|
+
newWebView.getSettings().setUseWideViewPort(view.getSettings().getUseWideViewPort());
|
|
225
|
+
newWebView.getSettings().setSupportMultipleWindows(true);
|
|
226
|
+
newWebView.getSettings().setLayoutAlgorithm(view.getSettings().getLayoutAlgorithm());
|
|
227
|
+
newWebView.getSettings().setStandardFontFamily(view.getSettings().getStandardFontFamily());
|
|
228
|
+
newWebView.getSettings().setFixedFontFamily(view.getSettings().getFixedFontFamily());
|
|
229
|
+
newWebView.getSettings().setSansSerifFontFamily(view.getSettings().getSansSerifFontFamily());
|
|
230
|
+
newWebView.getSettings().setSerifFontFamily(view.getSettings().getSerifFontFamily());
|
|
231
|
+
newWebView.getSettings().setCursiveFontFamily(view.getSettings().getCursiveFontFamily());
|
|
232
|
+
newWebView.getSettings().setFantasyFontFamily(view.getSettings().getFantasyFontFamily());
|
|
233
|
+
newWebView.getSettings().setMinimumFontSize(view.getSettings().getMinimumFontSize());
|
|
234
|
+
newWebView.getSettings().setMinimumLogicalFontSize(view.getSettings().getMinimumLogicalFontSize());
|
|
235
|
+
newWebView.getSettings().setDefaultFontSize(view.getSettings().getDefaultFontSize());
|
|
236
|
+
newWebView.getSettings().setDefaultFixedFontSize(view.getSettings().getDefaultFixedFontSize());
|
|
237
|
+
newWebView.getSettings().setLoadsImagesAutomatically(view.getSettings().getLoadsImagesAutomatically());
|
|
238
|
+
newWebView.getSettings().setBlockNetworkImage(view.getSettings().getBlockNetworkImage());
|
|
239
|
+
newWebView.getSettings().setJavaScriptEnabled(view.getSettings().getJavaScriptEnabled());
|
|
240
|
+
newWebView.getSettings().setDatabaseEnabled(view.getSettings().getDatabaseEnabled());
|
|
241
|
+
newWebView.getSettings().setDomStorageEnabled(view.getSettings().getDomStorageEnabled());
|
|
242
|
+
|
|
243
|
+
newWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(view.getSettings().getJavaScriptCanOpenWindowsAutomatically());
|
|
244
|
+
newWebView.getSettings().setDefaultTextEncodingName(view.getSettings().getDefaultTextEncodingName());
|
|
245
|
+
newWebView.getSettings().setUserAgentString(view.getSettings().getUserAgentString());
|
|
246
|
+
newWebView.getSettings().setCacheMode(view.getSettings().getCacheMode());
|
|
247
|
+
|
|
248
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
249
|
+
newWebView.getSettings().setMixedContentMode(view.getSettings().getMixedContentMode());
|
|
250
|
+
}
|
|
251
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
252
|
+
newWebView.getSettings().setSafeBrowsingEnabled(view.getSettings().getSafeBrowsingEnabled());
|
|
253
|
+
}
|
|
254
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
255
|
+
newWebView.getSettings().setForceDark(view.getSettings().getForceDark());
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
|
259
|
+
newWebView.getSettings().setDisabledActionModeMenuItems(view.getSettings().getDisabledActionModeMenuItems());
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
117
263
|
@Override
|
|
118
264
|
public boolean onConsoleMessage(ConsoleMessage message) {
|
|
119
265
|
if (ReactBuildConfig.DEBUG) {
|
|
@@ -130,6 +276,19 @@ public class BPCWebChromeClient extends WebChromeClient implements LifecycleEven
|
|
|
130
276
|
if (progressChangedFilter.isWaitingForCommandLoadUrl()) {
|
|
131
277
|
return;
|
|
132
278
|
}
|
|
279
|
+
|
|
280
|
+
if(isPopupWebView) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
Log.e("BPCWebChromeClient", "" + isPopupWebView);
|
|
285
|
+
// if(this.mWebView == null || this.mWebView.getThemedReactContext() == null) return;
|
|
286
|
+
// UIManagerModule uiManager = (this.mWebView.getThemedReactContext()).getNativeModule(UIManagerModule.class);
|
|
287
|
+
// if (uiManager == null) {
|
|
288
|
+
// Log.e("BPCWebChromeClient", "UIManagerModule is null, skipping event dispatch.");
|
|
289
|
+
// return;
|
|
290
|
+
// }
|
|
291
|
+
|
|
133
292
|
int reactTag = BPCWebViewWrapper.getReactTagFromWebView(webView);
|
|
134
293
|
WritableMap event = Arguments.createMap();
|
|
135
294
|
event.putDouble("target", reactTag);
|
|
@@ -139,7 +298,8 @@ public class BPCWebChromeClient extends WebChromeClient implements LifecycleEven
|
|
|
139
298
|
event.putBoolean("canGoForward", webView.canGoForward());
|
|
140
299
|
event.putDouble("progress", (float) newProgress / 100);
|
|
141
300
|
|
|
142
|
-
|
|
301
|
+
UIManagerHelper.getEventDispatcherForReactTag(this.mWebView.getThemedReactContext(), reactTag).dispatchEvent(new TopLoadingProgressEvent(reactTag, event));
|
|
302
|
+
|
|
143
303
|
}
|
|
144
304
|
|
|
145
305
|
@Override
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
package kr.co.bootpay.webview;
|
|
2
2
|
|
|
3
|
+
import android.app.Dialog;
|
|
4
|
+
|
|
3
5
|
import android.annotation.SuppressLint;
|
|
4
6
|
import android.graphics.Rect;
|
|
5
7
|
import android.net.Uri;
|
|
@@ -53,12 +55,28 @@ public class BPCWebView extends WebView implements LifecycleEventListener {
|
|
|
53
55
|
String injectedJS;
|
|
54
56
|
protected @Nullable
|
|
55
57
|
String injectedJSBeforeContentLoaded;
|
|
56
|
-
|
|
58
|
+
|
|
57
59
|
protected @Nullable
|
|
58
60
|
BPCWebViewBridge fallbackBridge;
|
|
59
61
|
protected @Nullable
|
|
60
62
|
WebViewCompat.WebMessageListener bridgeListener = null;
|
|
61
63
|
|
|
64
|
+
/** bootpay added start ***/
|
|
65
|
+
protected static final String JAVASCRIPT_INTERFACE = "BootpayRNWebView";
|
|
66
|
+
|
|
67
|
+
// protected static final String JAVASCRIPT_INTERFACE = "ReactNativeWebView";
|
|
68
|
+
|
|
69
|
+
Dialog dialog; //popup dialog
|
|
70
|
+
public void setDialog(Dialog dialog) {
|
|
71
|
+
this.dialog = dialog;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public void dissmissDialog() {
|
|
75
|
+
if(this.dialog != null) this.dialog.dismiss();
|
|
76
|
+
this.dialog = null;
|
|
77
|
+
}
|
|
78
|
+
/** bootpay added end ***/
|
|
79
|
+
|
|
62
80
|
/**
|
|
63
81
|
* android.webkit.WebChromeClient fundamentally does not support JS injection into frames other
|
|
64
82
|
* than the main frame, so these two properties are mostly here just for parity with iOS & macOS.
|
|
@@ -273,6 +291,12 @@ public class BPCWebView extends WebView implements LifecycleEventListener {
|
|
|
273
291
|
addJavascriptInterface(fallbackBridge, JAVASCRIPT_INTERFACE);
|
|
274
292
|
}
|
|
275
293
|
}
|
|
294
|
+
|
|
295
|
+
// if (fallbackBridge == null) {
|
|
296
|
+
// fallbackBridge = new BPCWebViewBridge(webView);
|
|
297
|
+
// addJavascriptInterface(fallbackBridge, JAVASCRIPT_INTERFACE);
|
|
298
|
+
// }
|
|
299
|
+
|
|
276
300
|
injectJavascriptObject();
|
|
277
301
|
}
|
|
278
302
|
|
|
@@ -36,6 +36,12 @@ import android.webkit.CookieSyncManager;
|
|
|
36
36
|
|
|
37
37
|
import java.util.concurrent.atomic.AtomicReference;
|
|
38
38
|
|
|
39
|
+
import android.app.AlertDialog;
|
|
40
|
+
import android.content.DialogInterface;
|
|
41
|
+
import android.content.Intent;
|
|
42
|
+
import android.widget.Toast;
|
|
43
|
+
import android.util.Log;
|
|
44
|
+
|
|
39
45
|
public class BPCWebViewClient extends WebViewClient {
|
|
40
46
|
private static String TAG = "BPCWebViewClient";
|
|
41
47
|
protected static final int SHOULD_OVERRIDE_URL_LOADING_TIMEOUT = 250;
|
|
@@ -96,6 +102,18 @@ public class BPCWebViewClient extends WebViewClient {
|
|
|
96
102
|
|
|
97
103
|
@Override
|
|
98
104
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
|
105
|
+
|
|
106
|
+
// Log.i("bootpay url", url);
|
|
107
|
+
if(BootpayUrlHelper.shouldOverrideUrlLoading(view, url)) {
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
// return false;
|
|
111
|
+
return shouldOverrideUrlLoadingRN(view, url);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
public boolean shouldOverrideUrlLoadingRN(WebView view, String url) {
|
|
99
117
|
final BPCWebView BPCWebView = (BPCWebView) view;
|
|
100
118
|
final boolean isJsDebugging = BPCWebView.getReactApplicationContext().getJavaScriptContextHolder().get() == 0;
|
|
101
119
|
|
|
@@ -218,6 +236,36 @@ public class BPCWebViewClient extends WebViewClient {
|
|
|
218
236
|
);
|
|
219
237
|
}
|
|
220
238
|
|
|
239
|
+
void alertSSLError(WebView view, SslErrorHandler handler, SslError error) {
|
|
240
|
+
// for SSLErrorHandler
|
|
241
|
+
AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext());
|
|
242
|
+
builder.setTitle("SSL Connection Error");
|
|
243
|
+
builder.setMessage("Your device's Android version is outdated and may not securely connect to our service. To continue using the app securely, please update your device's operating system. If you choose to proceed without updating, it may expose you to security vulnerabilities.");
|
|
244
|
+
builder.setPositiveButton("Update", new DialogInterface.OnClickListener() {
|
|
245
|
+
@Override
|
|
246
|
+
public void onClick(DialogInterface dialog, int which) {
|
|
247
|
+
// Redirect the user to the system update settings
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
Intent intent = new Intent("android.settings.SYSTEM_UPDATE_SETTINGS");
|
|
251
|
+
if (intent.resolveActivity(view.getContext().getPackageManager()) != null) {
|
|
252
|
+
view.getContext().startActivity(intent);
|
|
253
|
+
} else {
|
|
254
|
+
// If the device does not support system update settings intent
|
|
255
|
+
Toast.makeText(view.getContext(), "System update option not available. Please check your device settings manually.", Toast.LENGTH_LONG).show();
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
builder.setNeutralButton("Cancel", new DialogInterface.OnClickListener() {
|
|
260
|
+
@Override
|
|
261
|
+
public void onClick(DialogInterface dialog, int which) {
|
|
262
|
+
handler.cancel();
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
AlertDialog dialog = builder.create();
|
|
266
|
+
dialog.show();
|
|
267
|
+
}
|
|
268
|
+
|
|
221
269
|
@Override
|
|
222
270
|
public void onReceivedError(
|
|
223
271
|
WebView webView,
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
package kr.co.bootpay.webview;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.content.Intent;
|
|
5
|
+
import android.content.pm.PackageManager;
|
|
6
|
+
import android.net.Uri;
|
|
7
|
+
import android.webkit.WebView;
|
|
8
|
+
import android.util.Log;
|
|
9
|
+
|
|
10
|
+
import java.net.URISyntaxException;
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
public class BootpayUrlHelper {
|
|
14
|
+
public static boolean shouldOverrideUrlLoading(WebView view, String url) {
|
|
15
|
+
Intent intent = getIntentWithPackage(url);
|
|
16
|
+
Context context = view.getContext();
|
|
17
|
+
|
|
18
|
+
Log.i("bootpay", "doDeepLinkIfPayUrl: " + url);
|
|
19
|
+
|
|
20
|
+
if(isIntent(url)) {
|
|
21
|
+
Log.i("isIntent", "isInstallApp called");
|
|
22
|
+
if(isInstallApp(intent, context)) return startApp(intent, context);
|
|
23
|
+
else return startGooglePlay(intent, context);
|
|
24
|
+
} else if(isMarket(url)) {
|
|
25
|
+
if(isInstallApp(intent, context)) return startApp(intent, context);
|
|
26
|
+
else return startGooglePlay(intent, context);
|
|
27
|
+
} else if(isSpecialCase(url)) {
|
|
28
|
+
if(isInstallApp(intent, context)) return startApp(intent, context);
|
|
29
|
+
else return startGooglePlay(intent, context);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// return url.contains("vguardend");
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public static Boolean isSpecialCase(String url) {
|
|
37
|
+
return url.matches("^shinhan\\S+$")
|
|
38
|
+
|| url.startsWith("kftc-bankpay://")
|
|
39
|
+
|| url.startsWith("v3mobileplusweb://")
|
|
40
|
+
|| url.startsWith("hdcardappcardansimclick://")
|
|
41
|
+
|| url.startsWith("nidlogin://")
|
|
42
|
+
|| url.startsWith("mpocket.online.ansimclick://")
|
|
43
|
+
|| url.startsWith("wooripay://")
|
|
44
|
+
|| url.startsWith("ispmobile://")
|
|
45
|
+
|| url.startsWith("kakaotalk://");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public static Boolean isIntent(String url) {
|
|
49
|
+
Log.d(
|
|
50
|
+
"bootpay",
|
|
51
|
+
String.format("url %s: %s.", url, url.startsWith("intent:"))
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
return url.startsWith("intent:");
|
|
56
|
+
}
|
|
57
|
+
public static Boolean isMarket(String url) {
|
|
58
|
+
return url.startsWith("market://");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
public static Intent getIntentWithPackage(String url) {
|
|
63
|
+
try {
|
|
64
|
+
Intent intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
|
|
65
|
+
if(intent.getPackage() == null) {
|
|
66
|
+
if (url == null) return intent;
|
|
67
|
+
if (url.startsWith("shinhan-sr-ansimclick")) intent.setPackage("com.shcard.smartpay");
|
|
68
|
+
else if (url.startsWith("kftc-bankpay")) intent.setPackage("com.kftc.bankpay.android");
|
|
69
|
+
else if (url.startsWith("ispmobile")) intent.setPackage("kvp.jjy.MispAndroid320");
|
|
70
|
+
else if (url.startsWith("hdcardappcardansimclick")) intent.setPackage("com.hyundaicard.appcard");
|
|
71
|
+
else if (url.startsWith("kb-acp")) intent.setPackage("com.kbcard.kbkookmincard");
|
|
72
|
+
else if (url.startsWith("mpocket.online.ansimclick")) intent.setPackage("kr.co.samsungcard.mpocket");
|
|
73
|
+
else if (url.startsWith("lotteappcard")) intent.setPackage("com.lcacApp");
|
|
74
|
+
else if (url.startsWith("cloudpay")) intent.setPackage("com.hanaskcard.paycla");
|
|
75
|
+
else if (url.startsWith("nhappvardansimclick")) intent.setPackage("nh.smart.nhallonepay");
|
|
76
|
+
else if (url.startsWith("citispay")) intent.setPackage("kr.co.citibank.citimobile");
|
|
77
|
+
else if (url.startsWith("kakaotalk")) intent.setPackage("com.kakao.talk");
|
|
78
|
+
// kvp.jjy.MispAndroid320
|
|
79
|
+
}
|
|
80
|
+
return intent;
|
|
81
|
+
} catch (URISyntaxException e) {
|
|
82
|
+
e.printStackTrace();
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
public static boolean isInstallApp(Intent intent, Context context) {
|
|
88
|
+
if (intent == null) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
String packageName = intent.getPackage();
|
|
92
|
+
if (packageName == null) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
PackageManager packageManager = context.getPackageManager();
|
|
97
|
+
Intent launchIntent = packageManager.getLaunchIntentForPackage(packageName);
|
|
98
|
+
boolean isInstalled = launchIntent != null;
|
|
99
|
+
return isInstalled;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
public static boolean startApp(Intent intent, Context context) {
|
|
106
|
+
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
107
|
+
context.startActivity(intent);
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
public static boolean startGooglePlay(Intent intent, Context context) {
|
|
112
|
+
final String appPackageName = intent.getPackage();
|
|
113
|
+
|
|
114
|
+
if(appPackageName == null) {
|
|
115
|
+
Uri dataUri = intent.getData();
|
|
116
|
+
|
|
117
|
+
try {
|
|
118
|
+
Intent addIntent = new Intent(Intent.ACTION_VIEW, intent.getData());
|
|
119
|
+
context.startActivity(addIntent);
|
|
120
|
+
} catch (Exception e) {
|
|
121
|
+
String packageName = "com.nhn.android.search"; //appPackageName이 비어있으면 네이버로 보내기(네이버 로그인)
|
|
122
|
+
if(dataUri != null && dataUri.toString().startsWith("wooripay://")) packageName = "com.wooricard.wpay"; //우리카드 예외처리
|
|
123
|
+
|
|
124
|
+
Intent addIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + packageName));
|
|
125
|
+
context.startActivity(addIntent);
|
|
126
|
+
}
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
Intent addIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName));
|
|
131
|
+
context.startActivity(addIntent);
|
|
132
|
+
} catch (android.content.ActivityNotFoundException anfe) {
|
|
133
|
+
Intent addIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName));
|
|
134
|
+
context.startActivity(addIntent);
|
|
135
|
+
}
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
}
|
package/index.d.ts
CHANGED
|
@@ -2,64 +2,70 @@ import { Component } from 'react';
|
|
|
2
2
|
// eslint-disable-next-line
|
|
3
3
|
import { IOSWebViewProps, AndroidWebViewProps, WindowsWebViewProps } from './lib/WebViewTypes';
|
|
4
4
|
|
|
5
|
-
export {
|
|
5
|
+
export {
|
|
6
|
+
FileDownload,
|
|
7
|
+
WebViewMessageEvent,
|
|
8
|
+
WebViewNavigation,
|
|
9
|
+
} from './lib/WebViewTypes';
|
|
6
10
|
|
|
7
|
-
export type WebViewProps = IOSWebViewProps &
|
|
11
|
+
export type WebViewProps = IOSWebViewProps &
|
|
12
|
+
AndroidWebViewProps &
|
|
13
|
+
WindowsWebViewProps;
|
|
8
14
|
|
|
9
15
|
declare class WebView<P = {}> extends Component<WebViewProps & P> {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Go back one page in the webview's history.
|
|
18
|
+
*/
|
|
19
|
+
goBack: () => void;
|
|
14
20
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Go forward one page in the webview's history.
|
|
23
|
+
*/
|
|
24
|
+
goForward: () => void;
|
|
19
25
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Reloads the current page.
|
|
28
|
+
*/
|
|
29
|
+
reload: () => void;
|
|
24
30
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Stop loading the current page.
|
|
33
|
+
*/
|
|
34
|
+
stopLoading(): void;
|
|
29
35
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Executes the JavaScript string.
|
|
38
|
+
*/
|
|
39
|
+
injectJavaScript: (script: string) => void;
|
|
34
40
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Posts a message to WebView.
|
|
42
|
-
*/
|
|
43
|
-
postMessage: (message: string) => void;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* (Android only)
|
|
47
|
-
* Removes the autocomplete popup from the currently focused form field, if present.
|
|
48
|
-
*/
|
|
49
|
-
clearFormData?: () => void;
|
|
41
|
+
/**
|
|
42
|
+
* Focuses on WebView redered page.
|
|
43
|
+
*/
|
|
44
|
+
requestFocus: () => void;
|
|
50
45
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
clearCache?: (clear: boolean) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Posts a message to WebView.
|
|
48
|
+
*/
|
|
49
|
+
postMessage: (message: string) => void;
|
|
56
50
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
51
|
+
/**
|
|
52
|
+
* (Android only)
|
|
53
|
+
* Removes the autocomplete popup from the currently focused form field, if present.
|
|
54
|
+
*/
|
|
55
|
+
clearFormData?: () => void;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* (Android only)
|
|
59
|
+
* Clears the resource cache. Note that the cache is per-application, so this will clear the cache for all WebViews used.
|
|
60
|
+
*/
|
|
61
|
+
clearCache?: (clear: boolean) => void;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* (Android only)
|
|
65
|
+
* Tells this WebView to clear its internal back/forward list.
|
|
66
|
+
*/
|
|
67
|
+
clearHistory?: () => void;
|
|
62
68
|
}
|
|
63
69
|
|
|
64
|
-
export {WebView};
|
|
70
|
+
export { WebView };
|
|
65
71
|
export default WebView;
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>SchemeUserState</key>
|
|
6
|
+
<dict>
|
|
7
|
+
<key>RNCWebView.xcscheme_^#shared#^_</key>
|
|
8
|
+
<dict>
|
|
9
|
+
<key>orderHint</key>
|
|
10
|
+
<integer>0</integer>
|
|
11
|
+
</dict>
|
|
12
|
+
</dict>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|
|
@@ -4,5 +4,5 @@ export interface Spec extends TurboModule {
|
|
|
4
4
|
isFileUploadSupported(): Promise<boolean>;
|
|
5
5
|
shouldStartLoadWithLockIdentifier(shouldStart: boolean, lockIdentifier: Double): void;
|
|
6
6
|
}
|
|
7
|
-
declare const
|
|
8
|
-
export default
|
|
7
|
+
declare const _default: Spec;
|
|
8
|
+
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _reactNative=require("react-native");var _default=exports.default=_reactNative.TurboModuleRegistry.getEnforcing('BPCWebViewModule');
|
package/lib/WebView.android.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _BatchedBridge=_interopRequireDefault(require("react-native/Libraries/BatchedBridge/BatchedBridge"));var _EventEmitter=_interopRequireDefault(require("react-native/Libraries/vendor/emitter/EventEmitter"));var _invariant=_interopRequireDefault(require("invariant"));var _BPCWebViewNativeComponent=_interopRequireWildcard(require("./BPCWebViewNativeComponent"));var _NativeBPCWebViewModule=_interopRequireDefault(require("./NativeBPCWebViewModule"));var _WebViewShared=require("./WebViewShared");var _WebView=_interopRequireDefault(require("./WebView.styles"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["overScrollMode","javaScriptEnabled","thirdPartyCookiesEnabled","scalesPageToFit","allowsFullscreenVideo","allowFileAccess","saveFormDataDisabled","cacheEnabled","androidLayerType","originWhitelist","setSupportMultipleWindows","setBuiltInZoomControls","setDisplayZoomControls","nestedScrollEnabled","startInLoadingState","onNavigationStateChange","onLoadStart","onError","onLoad","onLoadEnd","onLoadProgress","onHttpError","onRenderProcessGone","onMessage","onOpenWindow","renderLoading","renderError","style","containerStyle","source","nativeConfig","onShouldStartLoadWithRequest","injectedJavaScriptObject"],_excluded2=["messagingModuleName"],_excluded3=["messagingModuleName"];var _require$registerCall,_this=this,_jsxFileName="/Users/taesupyoon/bootpay/client/react-native/react-native-webview-250313/src/WebView.android.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var resolveAssetSource=_reactNative.Image.resolveAssetSource;var directEventEmitter=new _EventEmitter.default();var registerCallableModule=(_require$registerCall=require('react-native').registerCallableModule)!=null?_require$registerCall:_BatchedBridge.default.registerCallableModule.bind(_BatchedBridge.default);registerCallableModule('BPCWebViewMessagingModule',{onShouldStartLoadWithRequest:function onShouldStartLoadWithRequest(event){directEventEmitter.emit('onShouldStartLoadWithRequest',event);},onMessage:function onMessage(event){directEventEmitter.emit('onMessage',event);}});var uniqueRef=0;var WebViewComponent=(0,_react.forwardRef)(function(_ref,ref){var _ref$overScrollMode=_ref.overScrollMode,overScrollMode=_ref$overScrollMode===void 0?'always':_ref$overScrollMode,_ref$javaScriptEnable=_ref.javaScriptEnabled,javaScriptEnabled=_ref$javaScriptEnable===void 0?true:_ref$javaScriptEnable,_ref$thirdPartyCookie=_ref.thirdPartyCookiesEnabled,thirdPartyCookiesEnabled=_ref$thirdPartyCookie===void 0?true:_ref$thirdPartyCookie,_ref$scalesPageToFit=_ref.scalesPageToFit,scalesPageToFit=_ref$scalesPageToFit===void 0?true:_ref$scalesPageToFit,_ref$allowsFullscreen=_ref.allowsFullscreenVideo,allowsFullscreenVideo=_ref$allowsFullscreen===void 0?false:_ref$allowsFullscreen,_ref$allowFileAccess=_ref.allowFileAccess,allowFileAccess=_ref$allowFileAccess===void 0?false:_ref$allowFileAccess,_ref$saveFormDataDisa=_ref.saveFormDataDisabled,saveFormDataDisabled=_ref$saveFormDataDisa===void 0?false:_ref$saveFormDataDisa,_ref$cacheEnabled=_ref.cacheEnabled,cacheEnabled=_ref$cacheEnabled===void 0?true:_ref$cacheEnabled,_ref$androidLayerType=_ref.androidLayerType,androidLayerType=_ref$androidLayerType===void 0?'none':_ref$androidLayerType,_ref$originWhitelist=_ref.originWhitelist,originWhitelist=_ref$originWhitelist===void 0?_WebViewShared.defaultOriginWhitelist:_ref$originWhitelist,_ref$setSupportMultip=_ref.setSupportMultipleWindows,setSupportMultipleWindows=_ref$setSupportMultip===void 0?true:_ref$setSupportMultip,_ref$setBuiltInZoomCo=_ref.setBuiltInZoomControls,setBuiltInZoomControls=_ref$setBuiltInZoomCo===void 0?true:_ref$setBuiltInZoomCo,_ref$setDisplayZoomCo=_ref.setDisplayZoomControls,setDisplayZoomControls=_ref$setDisplayZoomCo===void 0?false:_ref$setDisplayZoomCo,_ref$nestedScrollEnab=_ref.nestedScrollEnabled,nestedScrollEnabled=_ref$nestedScrollEnab===void 0?false:_ref$nestedScrollEnab,startInLoadingState=_ref.startInLoadingState,onNavigationStateChange=_ref.onNavigationStateChange,onLoadStart=_ref.onLoadStart,onError=_ref.onError,onLoad=_ref.onLoad,onLoadEnd=_ref.onLoadEnd,onLoadProgress=_ref.onLoadProgress,onHttpErrorProp=_ref.onHttpError,onRenderProcessGoneProp=_ref.onRenderProcessGone,onMessageProp=_ref.onMessage,onOpenWindowProp=_ref.onOpenWindow,renderLoading=_ref.renderLoading,renderError=_ref.renderError,style=_ref.style,containerStyle=_ref.containerStyle,source=_ref.source,nativeConfig=_ref.nativeConfig,onShouldStartLoadWithRequestProp=_ref.onShouldStartLoadWithRequest,injectedJavaScriptObject=_ref.injectedJavaScriptObject,otherProps=(0,_objectWithoutProperties2.default)(_ref,_excluded);var messagingModuleName=(0,_react.useRef)(`WebViewMessageHandler${uniqueRef+=1}`).current;var webViewRef=(0,_react.useRef)(null);var onShouldStartLoadWithRequestCallback=(0,_react.useCallback)(function(shouldStart,url,lockIdentifier){if(lockIdentifier){_NativeBPCWebViewModule.default.shouldStartLoadWithLockIdentifier(shouldStart,lockIdentifier);}else if(shouldStart&&webViewRef.current){_BPCWebViewNativeComponent.Commands.loadUrl(webViewRef.current,url);}},[]);var _useWebViewLogic=(0,_WebViewShared.useWebViewLogic)({onNavigationStateChange:onNavigationStateChange,onLoad:onLoad,onError:onError,onHttpErrorProp:onHttpErrorProp,onLoadEnd:onLoadEnd,onLoadProgress:onLoadProgress,onLoadStart:onLoadStart,onRenderProcessGoneProp:onRenderProcessGoneProp,onMessageProp:onMessageProp,onOpenWindowProp:onOpenWindowProp,startInLoadingState:startInLoadingState,originWhitelist:originWhitelist,onShouldStartLoadWithRequestProp:onShouldStartLoadWithRequestProp,onShouldStartLoadWithRequestCallback:onShouldStartLoadWithRequestCallback}),onLoadingStart=_useWebViewLogic.onLoadingStart,onShouldStartLoadWithRequest=_useWebViewLogic.onShouldStartLoadWithRequest,onMessage=_useWebViewLogic.onMessage,viewState=_useWebViewLogic.viewState,setViewState=_useWebViewLogic.setViewState,lastErrorEvent=_useWebViewLogic.lastErrorEvent,onHttpError=_useWebViewLogic.onHttpError,onLoadingError=_useWebViewLogic.onLoadingError,onLoadingFinish=_useWebViewLogic.onLoadingFinish,onLoadingProgress=_useWebViewLogic.onLoadingProgress,onOpenWindow=_useWebViewLogic.onOpenWindow,onRenderProcessGone=_useWebViewLogic.onRenderProcessGone;(0,_react.useImperativeHandle)(ref,function(){return{goForward:function goForward(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.goForward(webViewRef.current);},goBack:function goBack(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.goBack(webViewRef.current);},reload:function reload(){setViewState('LOADING');if(webViewRef.current){_BPCWebViewNativeComponent.Commands.reload(webViewRef.current);}},stopLoading:function stopLoading(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.stopLoading(webViewRef.current);},postMessage:function postMessage(data){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.postMessage(webViewRef.current,data);},injectJavaScript:function injectJavaScript(data){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.injectJavaScript(webViewRef.current,data);},requestFocus:function requestFocus(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.requestFocus(webViewRef.current);},clearFormData:function clearFormData(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.clearFormData(webViewRef.current);},clearCache:function clearCache(includeDiskFiles){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.clearCache(webViewRef.current,includeDiskFiles);},clearHistory:function clearHistory(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.clearHistory(webViewRef.current);}};},[setViewState,webViewRef]);(0,_react.useEffect)(function(){var onShouldStartLoadWithRequestSubscription=directEventEmitter.addListener('onShouldStartLoadWithRequest',function(event){if(event.messagingModuleName===messagingModuleName){var _=event.messagingModuleName,rest=(0,_objectWithoutProperties2.default)(event,_excluded2);onShouldStartLoadWithRequest(rest);}});var onMessageSubscription=directEventEmitter.addListener('onMessage',function(event){if(event.messagingModuleName===messagingModuleName){var _=event.messagingModuleName,rest=(0,_objectWithoutProperties2.default)(event,_excluded3);onMessage(rest);}});return function(){onShouldStartLoadWithRequestSubscription.remove();onMessageSubscription.remove();};},[messagingModuleName,onMessage,onShouldStartLoadWithRequest]);var otherView;if(viewState==='LOADING'){otherView=(renderLoading||_WebViewShared.defaultRenderLoading)();}else if(viewState==='ERROR'){(0,_invariant.default)(lastErrorEvent!=null,'lastErrorEvent expected to be non-null');if(lastErrorEvent){otherView=(renderError||_WebViewShared.defaultRenderError)(lastErrorEvent.domain,lastErrorEvent.code,lastErrorEvent.description);}}else if(viewState!=='IDLE'){console.error(`BPCWebView invalid state encountered: ${viewState}`);}var webViewStyles=[_WebView.default.container,_WebView.default.webView,style];var webViewContainerStyle=[_WebView.default.container,containerStyle];if(typeof source!=='number'&&source&&'method'in source){if(source.method==='POST'&&source.headers){console.warn('WebView: `source.headers` is not supported when using POST.');}else if(source.method==='GET'&&source.body){console.warn('WebView: `source.body` is not supported when using GET.');}}var NativeWebView=(nativeConfig==null?void 0:nativeConfig.component)||_BPCWebViewNativeComponent.default;var sourceResolved=resolveAssetSource(source);var newSource=typeof sourceResolved==='object'?Object.entries(sourceResolved).reduce(function(prev,_ref2){var _ref3=(0,_slicedToArray2.default)(_ref2,2),currKey=_ref3[0],currValue=_ref3[1];return Object.assign({},prev,(0,_defineProperty2.default)({},currKey,currKey==='headers'&&currValue&&typeof currValue==='object'?Object.entries(currValue).map(function(_ref4){var _ref5=(0,_slicedToArray2.default)(_ref4,2),key=_ref5[0],value=_ref5[1];return{name:key,value:value};}):currValue));},{}):sourceResolved;var webView=(0,_jsxRuntime.jsx)(NativeWebView,Object.assign({},otherProps,{messagingEnabled:typeof onMessageProp==='function',messagingModuleName:messagingModuleName,hasOnScroll:!!otherProps.onScroll,onLoadingError:onLoadingError,onLoadingFinish:onLoadingFinish,onLoadingProgress:onLoadingProgress,onLoadingStart:onLoadingStart,onHttpError:onHttpError,onRenderProcessGone:onRenderProcessGone,onMessage:onMessage,onOpenWindow:onOpenWindow,hasOnOpenWindowEvent:onOpenWindowProp!==undefined,onShouldStartLoadWithRequest:onShouldStartLoadWithRequest,ref:webViewRef,source:sourceResolved,newSource:newSource,style:webViewStyles,overScrollMode:overScrollMode,javaScriptEnabled:javaScriptEnabled,thirdPartyCookiesEnabled:thirdPartyCookiesEnabled,scalesPageToFit:scalesPageToFit,allowsFullscreenVideo:allowsFullscreenVideo,allowFileAccess:allowFileAccess,saveFormDataDisabled:saveFormDataDisabled,cacheEnabled:cacheEnabled,androidLayerType:androidLayerType,setSupportMultipleWindows:setSupportMultipleWindows,setBuiltInZoomControls:setBuiltInZoomControls,setDisplayZoomControls:setDisplayZoomControls,nestedScrollEnabled:nestedScrollEnabled,injectedJavaScriptObject:JSON.stringify(injectedJavaScriptObject)},nativeConfig==null?void 0:nativeConfig.props),"webViewKey");return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:webViewContainerStyle,children:[webView,otherView]});});var isFileUploadSupported=_NativeBPCWebViewModule.default.isFileUploadSupported;var WebView=Object.assign(WebViewComponent,{isFileUploadSupported:isFileUploadSupported});var _default=exports.default=WebView;
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _BatchedBridge=_interopRequireDefault(require("react-native/Libraries/BatchedBridge/BatchedBridge"));var _EventEmitter=_interopRequireDefault(require("react-native/Libraries/vendor/emitter/EventEmitter"));var _invariant=_interopRequireDefault(require("invariant"));var _BPCWebViewNativeComponent=_interopRequireWildcard(require("./BPCWebViewNativeComponent"));var _NativeBPCWebViewModule=_interopRequireDefault(require("./NativeBPCWebViewModule"));var _WebViewShared=require("./WebViewShared");var _WebView=_interopRequireDefault(require("./WebView.styles"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["overScrollMode","javaScriptEnabled","thirdPartyCookiesEnabled","scalesPageToFit","allowsFullscreenVideo","allowFileAccess","saveFormDataDisabled","cacheEnabled","androidLayerType","originWhitelist","setSupportMultipleWindows","setBuiltInZoomControls","setDisplayZoomControls","nestedScrollEnabled","startInLoadingState","onNavigationStateChange","onLoadStart","onError","onLoad","onLoadEnd","onLoadProgress","onHttpError","onRenderProcessGone","onMessage","onOpenWindow","renderLoading","renderError","style","containerStyle","source","nativeConfig","onShouldStartLoadWithRequest","injectedJavaScriptObject"],_excluded2=["messagingModuleName"],_excluded3=["messagingModuleName"];var _require$registerCall,_this=this,_jsxFileName="/Users/taesupyoon/bootpay/client/react-native/react-native-webview-250312/src/WebView.android.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var resolveAssetSource=_reactNative.Image.resolveAssetSource;var directEventEmitter=new _EventEmitter.default();var registerCallableModule=(_require$registerCall=require('react-native').registerCallableModule)!=null?_require$registerCall:_BatchedBridge.default.registerCallableModule.bind(_BatchedBridge.default);registerCallableModule('BPCWebViewMessagingModule',{onShouldStartLoadWithRequest:function onShouldStartLoadWithRequest(event){directEventEmitter.emit('onShouldStartLoadWithRequest',event);},onMessage:function onMessage(event){directEventEmitter.emit('onMessage',event);}});var uniqueRef=0;var WebViewComponent=(0,_react.forwardRef)(function(_ref,ref){var _ref$overScrollMode=_ref.overScrollMode,overScrollMode=_ref$overScrollMode===void 0?'always':_ref$overScrollMode,_ref$javaScriptEnable=_ref.javaScriptEnabled,javaScriptEnabled=_ref$javaScriptEnable===void 0?true:_ref$javaScriptEnable,_ref$thirdPartyCookie=_ref.thirdPartyCookiesEnabled,thirdPartyCookiesEnabled=_ref$thirdPartyCookie===void 0?true:_ref$thirdPartyCookie,_ref$scalesPageToFit=_ref.scalesPageToFit,scalesPageToFit=_ref$scalesPageToFit===void 0?true:_ref$scalesPageToFit,_ref$allowsFullscreen=_ref.allowsFullscreenVideo,allowsFullscreenVideo=_ref$allowsFullscreen===void 0?false:_ref$allowsFullscreen,_ref$allowFileAccess=_ref.allowFileAccess,allowFileAccess=_ref$allowFileAccess===void 0?false:_ref$allowFileAccess,_ref$saveFormDataDisa=_ref.saveFormDataDisabled,saveFormDataDisabled=_ref$saveFormDataDisa===void 0?false:_ref$saveFormDataDisa,_ref$cacheEnabled=_ref.cacheEnabled,cacheEnabled=_ref$cacheEnabled===void 0?true:_ref$cacheEnabled,_ref$androidLayerType=_ref.androidLayerType,androidLayerType=_ref$androidLayerType===void 0?'none':_ref$androidLayerType,_ref$originWhitelist=_ref.originWhitelist,originWhitelist=_ref$originWhitelist===void 0?_WebViewShared.defaultOriginWhitelist:_ref$originWhitelist,_ref$setSupportMultip=_ref.setSupportMultipleWindows,setSupportMultipleWindows=_ref$setSupportMultip===void 0?true:_ref$setSupportMultip,_ref$setBuiltInZoomCo=_ref.setBuiltInZoomControls,setBuiltInZoomControls=_ref$setBuiltInZoomCo===void 0?true:_ref$setBuiltInZoomCo,_ref$setDisplayZoomCo=_ref.setDisplayZoomControls,setDisplayZoomControls=_ref$setDisplayZoomCo===void 0?false:_ref$setDisplayZoomCo,_ref$nestedScrollEnab=_ref.nestedScrollEnabled,nestedScrollEnabled=_ref$nestedScrollEnab===void 0?false:_ref$nestedScrollEnab,startInLoadingState=_ref.startInLoadingState,onNavigationStateChange=_ref.onNavigationStateChange,onLoadStart=_ref.onLoadStart,onError=_ref.onError,onLoad=_ref.onLoad,onLoadEnd=_ref.onLoadEnd,onLoadProgress=_ref.onLoadProgress,onHttpErrorProp=_ref.onHttpError,onRenderProcessGoneProp=_ref.onRenderProcessGone,onMessageProp=_ref.onMessage,onOpenWindowProp=_ref.onOpenWindow,renderLoading=_ref.renderLoading,renderError=_ref.renderError,style=_ref.style,containerStyle=_ref.containerStyle,source=_ref.source,nativeConfig=_ref.nativeConfig,onShouldStartLoadWithRequestProp=_ref.onShouldStartLoadWithRequest,injectedJavaScriptObject=_ref.injectedJavaScriptObject,otherProps=(0,_objectWithoutProperties2.default)(_ref,_excluded);var messagingModuleName=(0,_react.useRef)(`WebViewMessageHandler${uniqueRef+=1}`).current;var webViewRef=(0,_react.useRef)(null);var onShouldStartLoadWithRequestCallback=(0,_react.useCallback)(function(shouldStart,url,lockIdentifier){if(lockIdentifier){_NativeBPCWebViewModule.default.shouldStartLoadWithLockIdentifier(shouldStart,lockIdentifier);}else if(shouldStart&&webViewRef.current){_BPCWebViewNativeComponent.Commands.loadUrl(webViewRef.current,url);}},[]);var _useWebViewLogic=(0,_WebViewShared.useWebViewLogic)({onNavigationStateChange:onNavigationStateChange,onLoad:onLoad,onError:onError,onHttpErrorProp:onHttpErrorProp,onLoadEnd:onLoadEnd,onLoadProgress:onLoadProgress,onLoadStart:onLoadStart,onRenderProcessGoneProp:onRenderProcessGoneProp,onMessageProp:onMessageProp,onOpenWindowProp:onOpenWindowProp,startInLoadingState:startInLoadingState,originWhitelist:originWhitelist,onShouldStartLoadWithRequestProp:onShouldStartLoadWithRequestProp,onShouldStartLoadWithRequestCallback:onShouldStartLoadWithRequestCallback}),onLoadingStart=_useWebViewLogic.onLoadingStart,onShouldStartLoadWithRequest=_useWebViewLogic.onShouldStartLoadWithRequest,onMessage=_useWebViewLogic.onMessage,viewState=_useWebViewLogic.viewState,setViewState=_useWebViewLogic.setViewState,lastErrorEvent=_useWebViewLogic.lastErrorEvent,onHttpError=_useWebViewLogic.onHttpError,onLoadingError=_useWebViewLogic.onLoadingError,onLoadingFinish=_useWebViewLogic.onLoadingFinish,onLoadingProgress=_useWebViewLogic.onLoadingProgress,onOpenWindow=_useWebViewLogic.onOpenWindow,onRenderProcessGone=_useWebViewLogic.onRenderProcessGone;(0,_react.useImperativeHandle)(ref,function(){return{goForward:function goForward(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.goForward(webViewRef.current);},goBack:function goBack(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.goBack(webViewRef.current);},reload:function reload(){setViewState('LOADING');if(webViewRef.current){_BPCWebViewNativeComponent.Commands.reload(webViewRef.current);}},stopLoading:function stopLoading(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.stopLoading(webViewRef.current);},postMessage:function postMessage(data){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.postMessage(webViewRef.current,data);},injectJavaScript:function injectJavaScript(data){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.injectJavaScript(webViewRef.current,data);},requestFocus:function requestFocus(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.requestFocus(webViewRef.current);},clearFormData:function clearFormData(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.clearFormData(webViewRef.current);},clearCache:function clearCache(includeDiskFiles){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.clearCache(webViewRef.current,includeDiskFiles);},clearHistory:function clearHistory(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.clearHistory(webViewRef.current);}};},[setViewState,webViewRef]);(0,_react.useEffect)(function(){var onShouldStartLoadWithRequestSubscription=directEventEmitter.addListener('onShouldStartLoadWithRequest',function(event){if(event.messagingModuleName===messagingModuleName){var _=event.messagingModuleName,rest=(0,_objectWithoutProperties2.default)(event,_excluded2);onShouldStartLoadWithRequest(rest);}});var onMessageSubscription=directEventEmitter.addListener('onMessage',function(event){if(event.messagingModuleName===messagingModuleName){var _=event.messagingModuleName,rest=(0,_objectWithoutProperties2.default)(event,_excluded3);onMessage(rest);}});return function(){onShouldStartLoadWithRequestSubscription.remove();onMessageSubscription.remove();};},[messagingModuleName,onMessage,onShouldStartLoadWithRequest]);var otherView;if(viewState==='LOADING'){otherView=(renderLoading||_WebViewShared.defaultRenderLoading)();}else if(viewState==='ERROR'){(0,_invariant.default)(lastErrorEvent!=null,'lastErrorEvent expected to be non-null');if(lastErrorEvent){otherView=(renderError||_WebViewShared.defaultRenderError)(lastErrorEvent.domain,lastErrorEvent.code,lastErrorEvent.description);}}else if(viewState!=='IDLE'){console.error(`BPCWebView invalid state encountered: ${viewState}`);}var webViewStyles=[_WebView.default.container,_WebView.default.webView,style];var webViewContainerStyle=[_WebView.default.container,containerStyle];if(typeof source!=='number'&&source&&'method'in source){if(source.method==='POST'&&source.headers){console.warn('WebView: `source.headers` is not supported when using POST.');}else if(source.method==='GET'&&source.body){console.warn('WebView: `source.body` is not supported when using GET.');}}var NativeWebView=(nativeConfig==null?void 0:nativeConfig.component)||_BPCWebViewNativeComponent.default;var sourceResolved=resolveAssetSource(source);var newSource=typeof sourceResolved==='object'?Object.entries(sourceResolved).reduce(function(prev,_ref2){var _ref3=(0,_slicedToArray2.default)(_ref2,2),currKey=_ref3[0],currValue=_ref3[1];return Object.assign({},prev,(0,_defineProperty2.default)({},currKey,currKey==='headers'&&currValue&&typeof currValue==='object'?Object.entries(currValue).map(function(_ref4){var _ref5=(0,_slicedToArray2.default)(_ref4,2),key=_ref5[0],value=_ref5[1];return{name:key,value:value};}):currValue));},{}):sourceResolved;var webView=(0,_jsxRuntime.jsx)(NativeWebView,Object.assign({},otherProps,{messagingEnabled:typeof onMessageProp==='function',messagingModuleName:messagingModuleName,hasOnScroll:!!otherProps.onScroll,onLoadingError:onLoadingError,onLoadingFinish:onLoadingFinish,onLoadingProgress:onLoadingProgress,onLoadingStart:onLoadingStart,onHttpError:onHttpError,onRenderProcessGone:onRenderProcessGone,onMessage:onMessage,onOpenWindow:onOpenWindow,hasOnOpenWindowEvent:onOpenWindowProp!==undefined,onShouldStartLoadWithRequest:onShouldStartLoadWithRequest,ref:webViewRef,source:sourceResolved,newSource:newSource,style:webViewStyles,overScrollMode:overScrollMode,javaScriptEnabled:javaScriptEnabled,thirdPartyCookiesEnabled:thirdPartyCookiesEnabled,scalesPageToFit:scalesPageToFit,allowsFullscreenVideo:allowsFullscreenVideo,allowFileAccess:allowFileAccess,saveFormDataDisabled:saveFormDataDisabled,cacheEnabled:cacheEnabled,androidLayerType:androidLayerType,setSupportMultipleWindows:setSupportMultipleWindows,setBuiltInZoomControls:setBuiltInZoomControls,setDisplayZoomControls:setDisplayZoomControls,nestedScrollEnabled:nestedScrollEnabled,injectedJavaScriptObject:JSON.stringify(injectedJavaScriptObject)},nativeConfig==null?void 0:nativeConfig.props),"webViewKey");return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:webViewContainerStyle,children:[webView,otherView]});});var isFileUploadSupported=_NativeBPCWebViewModule.default.isFileUploadSupported;var WebView=Object.assign(WebViewComponent,{isFileUploadSupported:isFileUploadSupported});var _default=exports.default=WebView;
|
package/lib/WebView.ios.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _invariant=_interopRequireDefault(require("invariant"));var _BPCWebViewNativeComponent=_interopRequireWildcard(require("./BPCWebViewNativeComponent"));var _NativeBPCWebViewModule=_interopRequireDefault(require("./NativeBPCWebViewModule"));var _WebViewShared=require("./WebViewShared");var _WebView=_interopRequireDefault(require("./WebView.styles"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["fraudulentWebsiteWarningEnabled","javaScriptEnabled","cacheEnabled","originWhitelist","useSharedProcessPool","textInteractionEnabled","injectedJavaScript","injectedJavaScriptBeforeContentLoaded","injectedJavaScriptForMainFrameOnly","injectedJavaScriptBeforeContentLoadedForMainFrameOnly","injectedJavaScriptObject","startInLoadingState","onNavigationStateChange","onLoadStart","onError","onLoad","onLoadEnd","onLoadProgress","onContentProcessDidTerminate","onFileDownload","onHttpError","onMessage","onOpenWindow","renderLoading","renderError","style","containerStyle","source","nativeConfig","allowsInlineMediaPlayback","allowsPictureInPictureMediaPlayback","allowsAirPlayForMediaPlayback","mediaPlaybackRequiresUserAction","dataDetectorTypes","incognito","decelerationRate","onShouldStartLoadWithRequest"];var _this=this,_jsxFileName="/Users/taesupyoon/bootpay/client/react-native/react-native-webview-250313/src/WebView.ios.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var resolveAssetSource=_reactNative.Image.resolveAssetSource;var processDecelerationRate=function processDecelerationRate(decelerationRate){var newDecelerationRate=decelerationRate;if(newDecelerationRate==='normal'){newDecelerationRate=0.998;}else if(newDecelerationRate==='fast'){newDecelerationRate=0.99;}return newDecelerationRate;};var useWarnIfChanges=function useWarnIfChanges(value,name){var ref=(0,_react.useRef)(value);if(ref.current!==value){console.warn(`Changes to property ${name} do nothing after the initial render.`);ref.current=value;}};var WebViewComponent=(0,_react.forwardRef)(function(_ref,ref){var _ref$fraudulentWebsit=_ref.fraudulentWebsiteWarningEnabled,fraudulentWebsiteWarningEnabled=_ref$fraudulentWebsit===void 0?true:_ref$fraudulentWebsit,_ref$javaScriptEnable=_ref.javaScriptEnabled,javaScriptEnabled=_ref$javaScriptEnable===void 0?true:_ref$javaScriptEnable,_ref$cacheEnabled=_ref.cacheEnabled,cacheEnabled=_ref$cacheEnabled===void 0?true:_ref$cacheEnabled,_ref$originWhitelist=_ref.originWhitelist,originWhitelist=_ref$originWhitelist===void 0?_WebViewShared.defaultOriginWhitelist:_ref$originWhitelist,_ref$useSharedProcess=_ref.useSharedProcessPool,useSharedProcessPool=_ref$useSharedProcess===void 0?true:_ref$useSharedProcess,_ref$textInteractionE=_ref.textInteractionEnabled,textInteractionEnabled=_ref$textInteractionE===void 0?true:_ref$textInteractionE,injectedJavaScript=_ref.injectedJavaScript,injectedJavaScriptBeforeContentLoaded=_ref.injectedJavaScriptBeforeContentLoaded,_ref$injectedJavaScri=_ref.injectedJavaScriptForMainFrameOnly,injectedJavaScriptForMainFrameOnly=_ref$injectedJavaScri===void 0?true:_ref$injectedJavaScri,_ref$injectedJavaScri2=_ref.injectedJavaScriptBeforeContentLoadedForMainFrameOnly,injectedJavaScriptBeforeContentLoadedForMainFrameOnly=_ref$injectedJavaScri2===void 0?true:_ref$injectedJavaScri2,injectedJavaScriptObject=_ref.injectedJavaScriptObject,startInLoadingState=_ref.startInLoadingState,onNavigationStateChange=_ref.onNavigationStateChange,onLoadStart=_ref.onLoadStart,onError=_ref.onError,onLoad=_ref.onLoad,onLoadEnd=_ref.onLoadEnd,onLoadProgress=_ref.onLoadProgress,onContentProcessDidTerminateProp=_ref.onContentProcessDidTerminate,onFileDownload=_ref.onFileDownload,onHttpErrorProp=_ref.onHttpError,onMessageProp=_ref.onMessage,onOpenWindowProp=_ref.onOpenWindow,renderLoading=_ref.renderLoading,renderError=_ref.renderError,style=_ref.style,containerStyle=_ref.containerStyle,source=_ref.source,nativeConfig=_ref.nativeConfig,allowsInlineMediaPlayback=_ref.allowsInlineMediaPlayback,_ref$allowsPictureInP=_ref.allowsPictureInPictureMediaPlayback,allowsPictureInPictureMediaPlayback=_ref$allowsPictureInP===void 0?true:_ref$allowsPictureInP,allowsAirPlayForMediaPlayback=_ref.allowsAirPlayForMediaPlayback,mediaPlaybackRequiresUserAction=_ref.mediaPlaybackRequiresUserAction,dataDetectorTypes=_ref.dataDetectorTypes,incognito=_ref.incognito,decelerationRateProp=_ref.decelerationRate,onShouldStartLoadWithRequestProp=_ref.onShouldStartLoadWithRequest,otherProps=(0,_objectWithoutProperties2.default)(_ref,_excluded);var webViewRef=(0,_react.useRef)(null);var onShouldStartLoadWithRequestCallback=(0,_react.useCallback)(function(shouldStart,_url){var lockIdentifier=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;_NativeBPCWebViewModule.default.shouldStartLoadWithLockIdentifier(shouldStart,lockIdentifier);},[]);var _useWebViewLogic=(0,_WebViewShared.useWebViewLogic)({onNavigationStateChange:onNavigationStateChange,onLoad:onLoad,onError:onError,onHttpErrorProp:onHttpErrorProp,onLoadEnd:onLoadEnd,onLoadProgress:onLoadProgress,onLoadStart:onLoadStart,onMessageProp:onMessageProp,onOpenWindowProp:onOpenWindowProp,startInLoadingState:startInLoadingState,originWhitelist:originWhitelist,onShouldStartLoadWithRequestProp:onShouldStartLoadWithRequestProp,onShouldStartLoadWithRequestCallback:onShouldStartLoadWithRequestCallback,onContentProcessDidTerminateProp:onContentProcessDidTerminateProp}),onLoadingStart=_useWebViewLogic.onLoadingStart,onShouldStartLoadWithRequest=_useWebViewLogic.onShouldStartLoadWithRequest,onMessage=_useWebViewLogic.onMessage,viewState=_useWebViewLogic.viewState,setViewState=_useWebViewLogic.setViewState,lastErrorEvent=_useWebViewLogic.lastErrorEvent,onHttpError=_useWebViewLogic.onHttpError,onLoadingError=_useWebViewLogic.onLoadingError,onLoadingFinish=_useWebViewLogic.onLoadingFinish,onLoadingProgress=_useWebViewLogic.onLoadingProgress,onOpenWindow=_useWebViewLogic.onOpenWindow,onContentProcessDidTerminate=_useWebViewLogic.onContentProcessDidTerminate;(0,_react.useImperativeHandle)(ref,function(){return{goForward:function goForward(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.goForward(webViewRef.current);},goBack:function goBack(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.goBack(webViewRef.current);},reload:function reload(){setViewState('LOADING');if(webViewRef.current){_BPCWebViewNativeComponent.Commands.reload(webViewRef.current);}},stopLoading:function stopLoading(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.stopLoading(webViewRef.current);},postMessage:function postMessage(data){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.postMessage(webViewRef.current,data);},injectJavaScript:function injectJavaScript(data){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.injectJavaScript(webViewRef.current,data);},requestFocus:function requestFocus(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.requestFocus(webViewRef.current);},clearCache:function clearCache(includeDiskFiles){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.clearCache(webViewRef.current,includeDiskFiles);}};},[setViewState,webViewRef]);useWarnIfChanges(allowsInlineMediaPlayback,'allowsInlineMediaPlayback');useWarnIfChanges(allowsPictureInPictureMediaPlayback,'allowsPictureInPictureMediaPlayback');useWarnIfChanges(allowsAirPlayForMediaPlayback,'allowsAirPlayForMediaPlayback');useWarnIfChanges(incognito,'incognito');useWarnIfChanges(mediaPlaybackRequiresUserAction,'mediaPlaybackRequiresUserAction');useWarnIfChanges(dataDetectorTypes,'dataDetectorTypes');var otherView=null;if(viewState==='LOADING'){otherView=(renderLoading||_WebViewShared.defaultRenderLoading)();}else if(viewState==='ERROR'){var _lastErrorEvent$code,_lastErrorEvent$descr;(0,_invariant.default)(lastErrorEvent!=null,'lastErrorEvent expected to be non-null');otherView=(renderError||_WebViewShared.defaultRenderError)(lastErrorEvent==null?void 0:lastErrorEvent.domain,(_lastErrorEvent$code=lastErrorEvent==null?void 0:lastErrorEvent.code)!=null?_lastErrorEvent$code:0,(_lastErrorEvent$descr=lastErrorEvent==null?void 0:lastErrorEvent.description)!=null?_lastErrorEvent$descr:'');}else if(viewState!=='IDLE'){console.error(`BPCWebView invalid state encountered: ${viewState}`);}var webViewStyles=[_WebView.default.container,_WebView.default.webView,style];var webViewContainerStyle=[_WebView.default.container,containerStyle];var decelerationRate=processDecelerationRate(decelerationRateProp);var NativeWebView=(nativeConfig==null?void 0:nativeConfig.component)||_BPCWebViewNativeComponent.default;var sourceResolved=resolveAssetSource(source);var newSource=typeof sourceResolved==='object'?Object.entries(sourceResolved).reduce(function(prev,_ref2){var _ref3=(0,_slicedToArray2.default)(_ref2,2),currKey=_ref3[0],currValue=_ref3[1];return Object.assign({},prev,(0,_defineProperty2.default)({},currKey,currKey==='headers'&&currValue&&typeof currValue==='object'?Object.entries(currValue).map(function(_ref4){var _ref5=(0,_slicedToArray2.default)(_ref4,2),key=_ref5[0],value=_ref5[1];return{name:key,value:value};}):currValue));},{}):sourceResolved;var webView=(0,_jsxRuntime.jsx)(NativeWebView,Object.assign({},otherProps,{fraudulentWebsiteWarningEnabled:fraudulentWebsiteWarningEnabled,javaScriptEnabled:javaScriptEnabled,cacheEnabled:cacheEnabled,useSharedProcessPool:useSharedProcessPool,textInteractionEnabled:textInteractionEnabled,decelerationRate:decelerationRate,messagingEnabled:typeof onMessageProp==='function',messagingModuleName:"",onLoadingError:onLoadingError,onLoadingFinish:onLoadingFinish,onLoadingProgress:onLoadingProgress,onFileDownload:onFileDownload,onLoadingStart:onLoadingStart,onHttpError:onHttpError,onMessage:onMessage,onOpenWindow:onOpenWindowProp&&onOpenWindow,hasOnOpenWindowEvent:onOpenWindowProp!==undefined,onShouldStartLoadWithRequest:onShouldStartLoadWithRequest,onContentProcessDidTerminate:onContentProcessDidTerminate,injectedJavaScript:injectedJavaScript,injectedJavaScriptBeforeContentLoaded:injectedJavaScriptBeforeContentLoaded,injectedJavaScriptForMainFrameOnly:injectedJavaScriptForMainFrameOnly,injectedJavaScriptBeforeContentLoadedForMainFrameOnly:injectedJavaScriptBeforeContentLoadedForMainFrameOnly,injectedJavaScriptObject:JSON.stringify(injectedJavaScriptObject),dataDetectorTypes:!dataDetectorTypes||Array.isArray(dataDetectorTypes)?dataDetectorTypes:[dataDetectorTypes],allowsAirPlayForMediaPlayback:allowsAirPlayForMediaPlayback,allowsInlineMediaPlayback:allowsInlineMediaPlayback,allowsPictureInPictureMediaPlayback:allowsPictureInPictureMediaPlayback,incognito:incognito,mediaPlaybackRequiresUserAction:mediaPlaybackRequiresUserAction,newSource:newSource,style:webViewStyles,hasOnFileDownload:!!onFileDownload,ref:webViewRef,source:sourceResolved},nativeConfig==null?void 0:nativeConfig.props),"webViewKey");return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:webViewContainerStyle,children:[webView,otherView]});});var isFileUploadSupported=function(){var _ref6=(0,_asyncToGenerator2.default)(function*(){return true;});return function isFileUploadSupported(){return _ref6.apply(this,arguments);};}();var WebView=Object.assign(WebViewComponent,{isFileUploadSupported:isFileUploadSupported});var _default=exports.default=WebView;
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _invariant=_interopRequireDefault(require("invariant"));var _BPCWebViewNativeComponent=_interopRequireWildcard(require("./BPCWebViewNativeComponent"));var _NativeBPCWebViewModule=_interopRequireDefault(require("./NativeBPCWebViewModule"));var _WebViewShared=require("./WebViewShared");var _WebView=_interopRequireDefault(require("./WebView.styles"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["fraudulentWebsiteWarningEnabled","javaScriptEnabled","cacheEnabled","originWhitelist","useSharedProcessPool","textInteractionEnabled","injectedJavaScript","injectedJavaScriptBeforeContentLoaded","injectedJavaScriptForMainFrameOnly","injectedJavaScriptBeforeContentLoadedForMainFrameOnly","injectedJavaScriptObject","startInLoadingState","onNavigationStateChange","onLoadStart","onError","onLoad","onLoadEnd","onLoadProgress","onContentProcessDidTerminate","onFileDownload","onHttpError","onMessage","onOpenWindow","renderLoading","renderError","style","containerStyle","source","nativeConfig","allowsInlineMediaPlayback","allowsPictureInPictureMediaPlayback","allowsAirPlayForMediaPlayback","mediaPlaybackRequiresUserAction","dataDetectorTypes","incognito","decelerationRate","onShouldStartLoadWithRequest"];var _this=this,_jsxFileName="/Users/taesupyoon/bootpay/client/react-native/react-native-webview-250312/src/WebView.ios.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var resolveAssetSource=_reactNative.Image.resolveAssetSource;var processDecelerationRate=function processDecelerationRate(decelerationRate){var newDecelerationRate=decelerationRate;if(newDecelerationRate==='normal'){newDecelerationRate=0.998;}else if(newDecelerationRate==='fast'){newDecelerationRate=0.99;}return newDecelerationRate;};var useWarnIfChanges=function useWarnIfChanges(value,name){var ref=(0,_react.useRef)(value);if(ref.current!==value){console.warn(`Changes to property ${name} do nothing after the initial render.`);ref.current=value;}};var WebViewComponent=(0,_react.forwardRef)(function(_ref,ref){var _ref$fraudulentWebsit=_ref.fraudulentWebsiteWarningEnabled,fraudulentWebsiteWarningEnabled=_ref$fraudulentWebsit===void 0?true:_ref$fraudulentWebsit,_ref$javaScriptEnable=_ref.javaScriptEnabled,javaScriptEnabled=_ref$javaScriptEnable===void 0?true:_ref$javaScriptEnable,_ref$cacheEnabled=_ref.cacheEnabled,cacheEnabled=_ref$cacheEnabled===void 0?true:_ref$cacheEnabled,_ref$originWhitelist=_ref.originWhitelist,originWhitelist=_ref$originWhitelist===void 0?_WebViewShared.defaultOriginWhitelist:_ref$originWhitelist,_ref$useSharedProcess=_ref.useSharedProcessPool,useSharedProcessPool=_ref$useSharedProcess===void 0?true:_ref$useSharedProcess,_ref$textInteractionE=_ref.textInteractionEnabled,textInteractionEnabled=_ref$textInteractionE===void 0?true:_ref$textInteractionE,injectedJavaScript=_ref.injectedJavaScript,injectedJavaScriptBeforeContentLoaded=_ref.injectedJavaScriptBeforeContentLoaded,_ref$injectedJavaScri=_ref.injectedJavaScriptForMainFrameOnly,injectedJavaScriptForMainFrameOnly=_ref$injectedJavaScri===void 0?true:_ref$injectedJavaScri,_ref$injectedJavaScri2=_ref.injectedJavaScriptBeforeContentLoadedForMainFrameOnly,injectedJavaScriptBeforeContentLoadedForMainFrameOnly=_ref$injectedJavaScri2===void 0?true:_ref$injectedJavaScri2,injectedJavaScriptObject=_ref.injectedJavaScriptObject,startInLoadingState=_ref.startInLoadingState,onNavigationStateChange=_ref.onNavigationStateChange,onLoadStart=_ref.onLoadStart,onError=_ref.onError,onLoad=_ref.onLoad,onLoadEnd=_ref.onLoadEnd,onLoadProgress=_ref.onLoadProgress,onContentProcessDidTerminateProp=_ref.onContentProcessDidTerminate,onFileDownload=_ref.onFileDownload,onHttpErrorProp=_ref.onHttpError,onMessageProp=_ref.onMessage,onOpenWindowProp=_ref.onOpenWindow,renderLoading=_ref.renderLoading,renderError=_ref.renderError,style=_ref.style,containerStyle=_ref.containerStyle,source=_ref.source,nativeConfig=_ref.nativeConfig,allowsInlineMediaPlayback=_ref.allowsInlineMediaPlayback,_ref$allowsPictureInP=_ref.allowsPictureInPictureMediaPlayback,allowsPictureInPictureMediaPlayback=_ref$allowsPictureInP===void 0?true:_ref$allowsPictureInP,allowsAirPlayForMediaPlayback=_ref.allowsAirPlayForMediaPlayback,mediaPlaybackRequiresUserAction=_ref.mediaPlaybackRequiresUserAction,dataDetectorTypes=_ref.dataDetectorTypes,incognito=_ref.incognito,decelerationRateProp=_ref.decelerationRate,onShouldStartLoadWithRequestProp=_ref.onShouldStartLoadWithRequest,otherProps=(0,_objectWithoutProperties2.default)(_ref,_excluded);var webViewRef=(0,_react.useRef)(null);var onShouldStartLoadWithRequestCallback=(0,_react.useCallback)(function(shouldStart,_url){var lockIdentifier=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;_NativeBPCWebViewModule.default.shouldStartLoadWithLockIdentifier(shouldStart,lockIdentifier);},[]);var _useWebViewLogic=(0,_WebViewShared.useWebViewLogic)({onNavigationStateChange:onNavigationStateChange,onLoad:onLoad,onError:onError,onHttpErrorProp:onHttpErrorProp,onLoadEnd:onLoadEnd,onLoadProgress:onLoadProgress,onLoadStart:onLoadStart,onMessageProp:onMessageProp,onOpenWindowProp:onOpenWindowProp,startInLoadingState:startInLoadingState,originWhitelist:originWhitelist,onShouldStartLoadWithRequestProp:onShouldStartLoadWithRequestProp,onShouldStartLoadWithRequestCallback:onShouldStartLoadWithRequestCallback,onContentProcessDidTerminateProp:onContentProcessDidTerminateProp}),onLoadingStart=_useWebViewLogic.onLoadingStart,onShouldStartLoadWithRequest=_useWebViewLogic.onShouldStartLoadWithRequest,onMessage=_useWebViewLogic.onMessage,viewState=_useWebViewLogic.viewState,setViewState=_useWebViewLogic.setViewState,lastErrorEvent=_useWebViewLogic.lastErrorEvent,onHttpError=_useWebViewLogic.onHttpError,onLoadingError=_useWebViewLogic.onLoadingError,onLoadingFinish=_useWebViewLogic.onLoadingFinish,onLoadingProgress=_useWebViewLogic.onLoadingProgress,onOpenWindow=_useWebViewLogic.onOpenWindow,onContentProcessDidTerminate=_useWebViewLogic.onContentProcessDidTerminate;(0,_react.useImperativeHandle)(ref,function(){return{goForward:function goForward(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.goForward(webViewRef.current);},goBack:function goBack(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.goBack(webViewRef.current);},reload:function reload(){setViewState('LOADING');if(webViewRef.current){_BPCWebViewNativeComponent.Commands.reload(webViewRef.current);}},stopLoading:function stopLoading(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.stopLoading(webViewRef.current);},postMessage:function postMessage(data){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.postMessage(webViewRef.current,data);},injectJavaScript:function injectJavaScript(data){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.injectJavaScript(webViewRef.current,data);},requestFocus:function requestFocus(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.requestFocus(webViewRef.current);},clearCache:function clearCache(includeDiskFiles){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.clearCache(webViewRef.current,includeDiskFiles);}};},[setViewState,webViewRef]);useWarnIfChanges(allowsInlineMediaPlayback,'allowsInlineMediaPlayback');useWarnIfChanges(allowsPictureInPictureMediaPlayback,'allowsPictureInPictureMediaPlayback');useWarnIfChanges(allowsAirPlayForMediaPlayback,'allowsAirPlayForMediaPlayback');useWarnIfChanges(incognito,'incognito');useWarnIfChanges(mediaPlaybackRequiresUserAction,'mediaPlaybackRequiresUserAction');useWarnIfChanges(dataDetectorTypes,'dataDetectorTypes');var otherView=null;if(viewState==='LOADING'){otherView=(renderLoading||_WebViewShared.defaultRenderLoading)();}else if(viewState==='ERROR'){var _lastErrorEvent$code,_lastErrorEvent$descr;(0,_invariant.default)(lastErrorEvent!=null,'lastErrorEvent expected to be non-null');otherView=(renderError||_WebViewShared.defaultRenderError)(lastErrorEvent==null?void 0:lastErrorEvent.domain,(_lastErrorEvent$code=lastErrorEvent==null?void 0:lastErrorEvent.code)!=null?_lastErrorEvent$code:0,(_lastErrorEvent$descr=lastErrorEvent==null?void 0:lastErrorEvent.description)!=null?_lastErrorEvent$descr:'');}else if(viewState!=='IDLE'){console.error(`BPCWebView invalid state encountered: ${viewState}`);}var webViewStyles=[_WebView.default.container,_WebView.default.webView,style];var webViewContainerStyle=[_WebView.default.container,containerStyle];var decelerationRate=processDecelerationRate(decelerationRateProp);var NativeWebView=(nativeConfig==null?void 0:nativeConfig.component)||_BPCWebViewNativeComponent.default;var sourceResolved=resolveAssetSource(source);var newSource=typeof sourceResolved==='object'?Object.entries(sourceResolved).reduce(function(prev,_ref2){var _ref3=(0,_slicedToArray2.default)(_ref2,2),currKey=_ref3[0],currValue=_ref3[1];return Object.assign({},prev,(0,_defineProperty2.default)({},currKey,currKey==='headers'&&currValue&&typeof currValue==='object'?Object.entries(currValue).map(function(_ref4){var _ref5=(0,_slicedToArray2.default)(_ref4,2),key=_ref5[0],value=_ref5[1];return{name:key,value:value};}):currValue));},{}):sourceResolved;var webView=(0,_jsxRuntime.jsx)(NativeWebView,Object.assign({},otherProps,{fraudulentWebsiteWarningEnabled:fraudulentWebsiteWarningEnabled,javaScriptEnabled:javaScriptEnabled,cacheEnabled:cacheEnabled,useSharedProcessPool:useSharedProcessPool,textInteractionEnabled:textInteractionEnabled,decelerationRate:decelerationRate,messagingEnabled:typeof onMessageProp==='function',messagingModuleName:"",onLoadingError:onLoadingError,onLoadingFinish:onLoadingFinish,onLoadingProgress:onLoadingProgress,onFileDownload:onFileDownload,onLoadingStart:onLoadingStart,onHttpError:onHttpError,onMessage:onMessage,onOpenWindow:onOpenWindowProp&&onOpenWindow,hasOnOpenWindowEvent:onOpenWindowProp!==undefined,onShouldStartLoadWithRequest:onShouldStartLoadWithRequest,onContentProcessDidTerminate:onContentProcessDidTerminate,injectedJavaScript:injectedJavaScript,injectedJavaScriptBeforeContentLoaded:injectedJavaScriptBeforeContentLoaded,injectedJavaScriptForMainFrameOnly:injectedJavaScriptForMainFrameOnly,injectedJavaScriptBeforeContentLoadedForMainFrameOnly:injectedJavaScriptBeforeContentLoadedForMainFrameOnly,injectedJavaScriptObject:JSON.stringify(injectedJavaScriptObject),dataDetectorTypes:!dataDetectorTypes||Array.isArray(dataDetectorTypes)?dataDetectorTypes:[dataDetectorTypes],allowsAirPlayForMediaPlayback:allowsAirPlayForMediaPlayback,allowsInlineMediaPlayback:allowsInlineMediaPlayback,allowsPictureInPictureMediaPlayback:allowsPictureInPictureMediaPlayback,incognito:incognito,mediaPlaybackRequiresUserAction:mediaPlaybackRequiresUserAction,newSource:newSource,style:webViewStyles,hasOnFileDownload:!!onFileDownload,ref:webViewRef,source:sourceResolved},nativeConfig==null?void 0:nativeConfig.props),"webViewKey");return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:webViewContainerStyle,children:[webView,otherView]});});var isFileUploadSupported=function(){var _ref6=(0,_asyncToGenerator2.default)(function*(){return true;});return function isFileUploadSupported(){return _ref6.apply(this,arguments);};}();var WebView=Object.assign(WebViewComponent,{isFileUploadSupported:isFileUploadSupported});var _default=exports.default=WebView;
|
package/lib/WebView.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.WebView=void 0;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _WebView=_interopRequireDefault(require("./WebView.styles"));var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/taesupyoon/bootpay/client/react-native/react-native-webview-
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.WebView=void 0;var _react=_interopRequireDefault(require("react"));var _reactNative=require("react-native");var _WebView=_interopRequireDefault(require("./WebView.styles"));var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/taesupyoon/bootpay/client/react-native/react-native-webview-250312/src/WebView.tsx";var WebView=exports.WebView=function WebView(){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:_WebView.default.flexStart,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_WebView.default.colorRed,children:"React Native WebView does not support this platform."})});};var _default=exports.default=WebView;
|
package/lib/WebView.macos.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _invariant=_interopRequireDefault(require("invariant"));var _BPCWebViewNativeComponent=_interopRequireWildcard(require("./BPCWebViewNativeComponent"));var _NativeBPCWebViewModule=_interopRequireDefault(require("./NativeBPCWebViewModule"));var _WebViewShared=require("./WebViewShared");var _WebView=_interopRequireDefault(require("./WebView.styles"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["javaScriptEnabled","cacheEnabled","originWhitelist","useSharedProcessPool","injectedJavaScript","injectedJavaScriptBeforeContentLoaded","startInLoadingState","onNavigationStateChange","onLoadStart","onError","onLoad","onLoadEnd","onLoadProgress","onHttpError","onMessage","renderLoading","renderError","style","containerStyle","source","nativeConfig","allowsInlineMediaPlayback","allowsPictureInPictureMediaPlayback","allowsAirPlayForMediaPlayback","mediaPlaybackRequiresUserAction","incognito","onShouldStartLoadWithRequest"];var _this=this,_jsxFileName="/Users/taesupyoon/bootpay/client/react-native/react-native-webview-
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _invariant=_interopRequireDefault(require("invariant"));var _BPCWebViewNativeComponent=_interopRequireWildcard(require("./BPCWebViewNativeComponent"));var _NativeBPCWebViewModule=_interopRequireDefault(require("./NativeBPCWebViewModule"));var _WebViewShared=require("./WebViewShared");var _WebView=_interopRequireDefault(require("./WebView.styles"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["javaScriptEnabled","cacheEnabled","originWhitelist","useSharedProcessPool","injectedJavaScript","injectedJavaScriptBeforeContentLoaded","startInLoadingState","onNavigationStateChange","onLoadStart","onError","onLoad","onLoadEnd","onLoadProgress","onHttpError","onMessage","renderLoading","renderError","style","containerStyle","source","nativeConfig","allowsInlineMediaPlayback","allowsPictureInPictureMediaPlayback","allowsAirPlayForMediaPlayback","mediaPlaybackRequiresUserAction","incognito","onShouldStartLoadWithRequest"];var _this=this,_jsxFileName="/Users/taesupyoon/bootpay/client/react-native/react-native-webview-250312/src/WebView.macos.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var resolveAssetSource=_reactNative.Image.resolveAssetSource;var useWarnIfChanges=function useWarnIfChanges(value,name){var ref=(0,_react.useRef)(value);if(ref.current!==value){console.warn(`Changes to property ${name} do nothing after the initial render.`);ref.current=value;}};var WebViewComponent=(0,_react.forwardRef)(function(_ref,ref){var _ref$javaScriptEnable=_ref.javaScriptEnabled,javaScriptEnabled=_ref$javaScriptEnable===void 0?true:_ref$javaScriptEnable,_ref$cacheEnabled=_ref.cacheEnabled,cacheEnabled=_ref$cacheEnabled===void 0?true:_ref$cacheEnabled,_ref$originWhitelist=_ref.originWhitelist,originWhitelist=_ref$originWhitelist===void 0?_WebViewShared.defaultOriginWhitelist:_ref$originWhitelist,_ref$useSharedProcess=_ref.useSharedProcessPool,useSharedProcessPool=_ref$useSharedProcess===void 0?true:_ref$useSharedProcess,injectedJavaScript=_ref.injectedJavaScript,injectedJavaScriptBeforeContentLoaded=_ref.injectedJavaScriptBeforeContentLoaded,startInLoadingState=_ref.startInLoadingState,onNavigationStateChange=_ref.onNavigationStateChange,onLoadStart=_ref.onLoadStart,onError=_ref.onError,onLoad=_ref.onLoad,onLoadEnd=_ref.onLoadEnd,onLoadProgress=_ref.onLoadProgress,onHttpErrorProp=_ref.onHttpError,onMessageProp=_ref.onMessage,renderLoading=_ref.renderLoading,renderError=_ref.renderError,style=_ref.style,containerStyle=_ref.containerStyle,source=_ref.source,nativeConfig=_ref.nativeConfig,allowsInlineMediaPlayback=_ref.allowsInlineMediaPlayback,_ref$allowsPictureInP=_ref.allowsPictureInPictureMediaPlayback,allowsPictureInPictureMediaPlayback=_ref$allowsPictureInP===void 0?true:_ref$allowsPictureInP,allowsAirPlayForMediaPlayback=_ref.allowsAirPlayForMediaPlayback,mediaPlaybackRequiresUserAction=_ref.mediaPlaybackRequiresUserAction,incognito=_ref.incognito,onShouldStartLoadWithRequestProp=_ref.onShouldStartLoadWithRequest,otherProps=(0,_objectWithoutProperties2.default)(_ref,_excluded);var webViewRef=(0,_react.useRef)(null);var onShouldStartLoadWithRequestCallback=(0,_react.useCallback)(function(shouldStart,_url){var lockIdentifier=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;_NativeBPCWebViewModule.default.shouldStartLoadWithLockIdentifier(!!shouldStart,lockIdentifier);},[]);var _useWebViewLogic=(0,_WebViewShared.useWebViewLogic)({onNavigationStateChange:onNavigationStateChange,onLoad:onLoad,onError:onError,onHttpErrorProp:onHttpErrorProp,onLoadEnd:onLoadEnd,onLoadProgress:onLoadProgress,onLoadStart:onLoadStart,onMessageProp:onMessageProp,startInLoadingState:startInLoadingState,originWhitelist:originWhitelist,onShouldStartLoadWithRequestProp:onShouldStartLoadWithRequestProp,onShouldStartLoadWithRequestCallback:onShouldStartLoadWithRequestCallback}),onLoadingStart=_useWebViewLogic.onLoadingStart,onShouldStartLoadWithRequest=_useWebViewLogic.onShouldStartLoadWithRequest,onMessage=_useWebViewLogic.onMessage,viewState=_useWebViewLogic.viewState,setViewState=_useWebViewLogic.setViewState,lastErrorEvent=_useWebViewLogic.lastErrorEvent,onHttpError=_useWebViewLogic.onHttpError,onLoadingError=_useWebViewLogic.onLoadingError,onLoadingFinish=_useWebViewLogic.onLoadingFinish,onLoadingProgress=_useWebViewLogic.onLoadingProgress,onContentProcessDidTerminate=_useWebViewLogic.onContentProcessDidTerminate;(0,_react.useImperativeHandle)(ref,function(){return{goForward:function goForward(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.goForward(webViewRef.current);},goBack:function goBack(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.goBack(webViewRef.current);},reload:function reload(){setViewState('LOADING');if(webViewRef.current){_BPCWebViewNativeComponent.Commands.reload(webViewRef.current);}},stopLoading:function stopLoading(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.stopLoading(webViewRef.current);},postMessage:function postMessage(data){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.postMessage(webViewRef.current,data);},injectJavaScript:function injectJavaScript(data){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.injectJavaScript(webViewRef.current,data);},requestFocus:function requestFocus(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.requestFocus(webViewRef.current);}};},[setViewState,webViewRef]);useWarnIfChanges(allowsInlineMediaPlayback,'allowsInlineMediaPlayback');useWarnIfChanges(allowsPictureInPictureMediaPlayback,'allowsPictureInPictureMediaPlayback');useWarnIfChanges(allowsAirPlayForMediaPlayback,'allowsAirPlayForMediaPlayback');useWarnIfChanges(incognito,'incognito');useWarnIfChanges(mediaPlaybackRequiresUserAction,'mediaPlaybackRequiresUserAction');var otherView=null;if(viewState==='LOADING'){otherView=(renderLoading||_WebViewShared.defaultRenderLoading)();}else if(viewState==='ERROR'){var _lastErrorEvent$descr;(0,_invariant.default)(lastErrorEvent!=null,'lastErrorEvent expected to be non-null');otherView=(renderError||_WebViewShared.defaultRenderError)(lastErrorEvent==null?void 0:lastErrorEvent.domain,(lastErrorEvent==null?void 0:lastErrorEvent.code)||0,(_lastErrorEvent$descr=lastErrorEvent==null?void 0:lastErrorEvent.description)!=null?_lastErrorEvent$descr:'');}else if(viewState!=='IDLE'){console.error(`BPCWebView invalid state encountered: ${viewState}`);}var webViewStyles=[_WebView.default.container,_WebView.default.webView,style];var webViewContainerStyle=[_WebView.default.container,containerStyle];var NativeWebView=(nativeConfig==null?void 0:nativeConfig.component)||_BPCWebViewNativeComponent.default;var sourceResolved=resolveAssetSource(source);var newSource=typeof sourceResolved==='object'?Object.entries(sourceResolved).reduce(function(prev,_ref2){var _ref3=(0,_slicedToArray2.default)(_ref2,2),currKey=_ref3[0],currValue=_ref3[1];return Object.assign({},prev,(0,_defineProperty2.default)({},currKey,currKey==='headers'&&currValue&&typeof currValue==='object'?Object.entries(currValue).map(function(_ref4){var _ref5=(0,_slicedToArray2.default)(_ref4,2),key=_ref5[0],value=_ref5[1];return{name:key,value:value};}):currValue));},{}):sourceResolved;var webView=(0,_jsxRuntime.jsx)(NativeWebView,Object.assign({},otherProps,{javaScriptEnabled:javaScriptEnabled,cacheEnabled:cacheEnabled,useSharedProcessPool:useSharedProcessPool,messagingEnabled:typeof onMessageProp==='function',newSource:newSource,onLoadingError:onLoadingError,onLoadingFinish:onLoadingFinish,onLoadingProgress:onLoadingProgress,onLoadingStart:onLoadingStart,onHttpError:onHttpError,onMessage:onMessage,onShouldStartLoadWithRequest:onShouldStartLoadWithRequest,onContentProcessDidTerminate:onContentProcessDidTerminate,injectedJavaScript:injectedJavaScript,injectedJavaScriptBeforeContentLoaded:injectedJavaScriptBeforeContentLoaded,allowsAirPlayForMediaPlayback:allowsAirPlayForMediaPlayback,allowsInlineMediaPlayback:allowsInlineMediaPlayback,allowsPictureInPictureMediaPlayback:allowsPictureInPictureMediaPlayback,incognito:incognito,mediaPlaybackRequiresUserAction:mediaPlaybackRequiresUserAction,ref:webViewRef,source:sourceResolved,style:webViewStyles},nativeConfig==null?void 0:nativeConfig.props),"webViewKey");return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:webViewContainerStyle,children:[webView,otherView]});});var isFileUploadSupported=function(){var _ref6=(0,_asyncToGenerator2.default)(function*(){return true;});return function isFileUploadSupported(){return _ref6.apply(this,arguments);};}();var WebView=Object.assign(WebViewComponent,{isFileUploadSupported:isFileUploadSupported});var _default=exports.default=WebView;
|
package/lib/WebView.windows.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _codegenNativeCommands=_interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeCommands"));var _invariant=_interopRequireDefault(require("invariant"));var _WebViewNativeComponent=require("./WebViewNativeComponent.windows");var _WebViewShared=require("./WebViewShared");var _WebView=_interopRequireDefault(require("./WebView.styles"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["cacheEnabled","originWhitelist","startInLoadingState","onNavigationStateChange","onLoadStart","onError","onLoad","onLoadEnd","onLoadProgress","onOpenWindow","onSourceChanged","onHttpError","onMessage","renderLoading","renderError","style","containerStyle","source","nativeConfig","onShouldStartLoadWithRequest","useWebView2"];var _this=this,_jsxFileName="/Users/taesupyoon/bootpay/client/react-native/react-native-webview-
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _codegenNativeCommands=_interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeCommands"));var _invariant=_interopRequireDefault(require("invariant"));var _WebViewNativeComponent=require("./WebViewNativeComponent.windows");var _WebViewShared=require("./WebViewShared");var _WebView=_interopRequireDefault(require("./WebView.styles"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["cacheEnabled","originWhitelist","startInLoadingState","onNavigationStateChange","onLoadStart","onError","onLoad","onLoadEnd","onLoadProgress","onOpenWindow","onSourceChanged","onHttpError","onMessage","renderLoading","renderError","style","containerStyle","source","nativeConfig","onShouldStartLoadWithRequest","useWebView2"];var _this=this,_jsxFileName="/Users/taesupyoon/bootpay/client/react-native/react-native-webview-250312/src/WebView.windows.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var Commands=(0,_codegenNativeCommands.default)({supportedCommands:['goBack','goForward','reload','stopLoading','injectJavaScript','requestFocus','clearCache','postMessage','loadUrl']});var resolveAssetSource=_reactNative.Image.resolveAssetSource;var WebViewComponent=(0,_react.forwardRef)(function(_ref,ref){var _ref$cacheEnabled=_ref.cacheEnabled,cacheEnabled=_ref$cacheEnabled===void 0?true:_ref$cacheEnabled,_ref$originWhitelist=_ref.originWhitelist,originWhitelist=_ref$originWhitelist===void 0?_WebViewShared.defaultOriginWhitelist:_ref$originWhitelist,startInLoadingState=_ref.startInLoadingState,onNavigationStateChange=_ref.onNavigationStateChange,onLoadStart=_ref.onLoadStart,onError=_ref.onError,onLoad=_ref.onLoad,onLoadEnd=_ref.onLoadEnd,onLoadProgress=_ref.onLoadProgress,onOpenWindowProp=_ref.onOpenWindow,onSourceChanged=_ref.onSourceChanged,onHttpErrorProp=_ref.onHttpError,onMessageProp=_ref.onMessage,renderLoading=_ref.renderLoading,renderError=_ref.renderError,style=_ref.style,containerStyle=_ref.containerStyle,source=_ref.source,nativeConfig=_ref.nativeConfig,onShouldStartLoadWithRequestProp=_ref.onShouldStartLoadWithRequest,useWebView2=_ref.useWebView2,otherProps=(0,_objectWithoutProperties2.default)(_ref,_excluded);var webViewRef=(0,_react.useRef)(null);var RCTWebViewString=useWebView2?'RCTWebView2':'RCTWebView';var onShouldStartLoadWithRequestCallback=(0,_react.useCallback)(function(shouldStart,url,lockIdentifier){if(lockIdentifier){if(RCTWebViewString==='RCTWebView'){_reactNative.NativeModules.RCTWebView.onShouldStartLoadWithRequestCallback(shouldStart,lockIdentifier);}else{_reactNative.NativeModules.RCTWebView2.onShouldStartLoadWithRequestCallback(shouldStart,lockIdentifier);}}else if(shouldStart){Commands.loadUrl(webViewRef,url);}},[RCTWebViewString]);var _useWebViewLogic=(0,_WebViewShared.useWebViewLogic)({onNavigationStateChange:onNavigationStateChange,onLoad:onLoad,onError:onError,onHttpErrorProp:onHttpErrorProp,onLoadEnd:onLoadEnd,onLoadProgress:onLoadProgress,onLoadStart:onLoadStart,onMessageProp:onMessageProp,startInLoadingState:startInLoadingState,originWhitelist:originWhitelist,onShouldStartLoadWithRequestProp:onShouldStartLoadWithRequestProp,onShouldStartLoadWithRequestCallback:onShouldStartLoadWithRequestCallback,onOpenWindowProp:onOpenWindowProp}),onLoadingStart=_useWebViewLogic.onLoadingStart,onShouldStartLoadWithRequest=_useWebViewLogic.onShouldStartLoadWithRequest,onMessage=_useWebViewLogic.onMessage,viewState=_useWebViewLogic.viewState,setViewState=_useWebViewLogic.setViewState,lastErrorEvent=_useWebViewLogic.lastErrorEvent,onHttpError=_useWebViewLogic.onHttpError,onLoadingError=_useWebViewLogic.onLoadingError,onLoadingFinish=_useWebViewLogic.onLoadingFinish,onLoadingProgress=_useWebViewLogic.onLoadingProgress,onOpenWindow=_useWebViewLogic.onOpenWindow;(0,_react.useImperativeHandle)(ref,function(){return{goForward:function goForward(){return Commands.goForward(webViewRef.current);},goBack:function goBack(){return Commands.goBack(webViewRef.current);},reload:function reload(){setViewState('LOADING');Commands.reload(webViewRef.current);},stopLoading:function stopLoading(){return Commands.stopLoading(webViewRef.current);},postMessage:function postMessage(data){return Commands.postMessage(webViewRef.current,data);},injectJavaScript:function injectJavaScript(data){return Commands.injectJavaScript(webViewRef.current,data);},requestFocus:function requestFocus(){return Commands.requestFocus(webViewRef.current);},clearCache:function clearCache(){return Commands.clearCache(webViewRef.current);},loadUrl:function loadUrl(url){return Commands.loadUrl(webViewRef.current,url);}};},[setViewState,webViewRef]);var otherView=null;if(viewState==='LOADING'){otherView=(renderLoading||_WebViewShared.defaultRenderLoading)();}else if(viewState==='ERROR'){(0,_invariant.default)(lastErrorEvent!=null,'lastErrorEvent expected to be non-null');otherView=(renderError||_WebViewShared.defaultRenderError)(lastErrorEvent.domain,lastErrorEvent.code,lastErrorEvent.description);}else if(viewState!=='IDLE'){console.error(`BPCWebView invalid state encountered: ${viewState}`);}var webViewStyles=[_WebView.default.container,_WebView.default.webView,style];var webViewContainerStyle=[_WebView.default.container,containerStyle];var NativeWebView=useWebView2?_WebViewNativeComponent.RCTWebView2:_WebViewNativeComponent.RCTWebView;var webView=(0,_jsxRuntime.jsx)(NativeWebView,Object.assign({},otherProps,{messagingEnabled:typeof onMessageProp==='function',linkHandlingEnabled:typeof onOpenWindowProp==='function',onLoadingError:onLoadingError,onLoadingFinish:onLoadingFinish,onLoadingProgress:onLoadingProgress,onLoadingStart:onLoadingStart,onHttpError:onHttpError,onMessage:onMessage,onShouldStartLoadWithRequest:onShouldStartLoadWithRequest,onOpenWindow:onOpenWindow,onSourceChanged:onSourceChanged,ref:webViewRef,source:resolveAssetSource(source),style:webViewStyles,cacheEnabled:cacheEnabled},nativeConfig==null?void 0:nativeConfig.props),"webViewKey");return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:webViewContainerStyle,children:[webView,otherView]});});var isFileUploadSupported=function(){var _ref2=(0,_asyncToGenerator2.default)(function*(){return false;});return function isFileUploadSupported(){return _ref2.apply(this,arguments);};}();var WebView=Object.assign(WebViewComponent,{isFileUploadSupported:isFileUploadSupported});var _default=exports.default=WebView;
|
package/lib/WebViewShared.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useWebViewLogic=exports.defaultRenderLoading=exports.defaultRenderError=exports.defaultOriginWhitelist=exports.createOnShouldStartLoadWithRequest=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _escapeStringRegexp=_interopRequireDefault(require("escape-string-regexp"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _WebView=_interopRequireDefault(require("./WebView.styles"));var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/taesupyoon/bootpay/client/react-native/react-native-webview-
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useWebViewLogic=exports.defaultRenderLoading=exports.defaultRenderError=exports.defaultOriginWhitelist=exports.createOnShouldStartLoadWithRequest=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _escapeStringRegexp=_interopRequireDefault(require("escape-string-regexp"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _WebView=_interopRequireDefault(require("./WebView.styles"));var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/Users/taesupyoon/bootpay/client/react-native/react-native-webview-250312/src/WebViewShared.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var defaultOriginWhitelist=exports.defaultOriginWhitelist=['http://*','https://*'];var extractOrigin=function extractOrigin(url){var result=/^[A-Za-z][A-Za-z0-9+\-.]+:(\/\/)?[^/]*/.exec(url);return result===null?'':result[0];};var originWhitelistToRegex=function originWhitelistToRegex(originWhitelist){return`^${(0,_escapeStringRegexp.default)(originWhitelist).replace(/\\\*/g,'.*')}`;};var passesWhitelist=function passesWhitelist(compiledWhitelist,url){var origin=extractOrigin(url);return compiledWhitelist.some(function(x){return new RegExp(x).test(origin);});};var compileWhitelist=function compileWhitelist(originWhitelist){return['about:blank'].concat((0,_toConsumableArray2.default)(originWhitelist||[])).map(originWhitelistToRegex);};var createOnShouldStartLoadWithRequest=exports.createOnShouldStartLoadWithRequest=function createOnShouldStartLoadWithRequest(loadRequest,originWhitelist,onShouldStartLoadWithRequest){return function(_ref){var nativeEvent=_ref.nativeEvent;var shouldStart=true;var url=nativeEvent.url,lockIdentifier=nativeEvent.lockIdentifier;if(!passesWhitelist(compileWhitelist(originWhitelist),url)){_reactNative.Linking.canOpenURL(url).then(function(supported){if(supported){return _reactNative.Linking.openURL(url);}console.warn(`Can't open url: ${url}`);return undefined;}).catch(function(e){console.warn('Error opening URL: ',e);});shouldStart=false;}else if(onShouldStartLoadWithRequest){shouldStart=onShouldStartLoadWithRequest(nativeEvent);}loadRequest(shouldStart,url,lockIdentifier);};};var defaultRenderLoading=exports.defaultRenderLoading=function defaultRenderLoading(){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:_WebView.default.loadingOrErrorView,children:(0,_jsxRuntime.jsx)(_reactNative.ActivityIndicator,{})});};var defaultRenderError=exports.defaultRenderError=function defaultRenderError(errorDomain,errorCode,errorDesc){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:_WebView.default.loadingOrErrorView,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_WebView.default.errorTextTitle,children:"Error loading page"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_WebView.default.errorText,children:`Domain: ${errorDomain}`}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_WebView.default.errorText,children:`Error Code: ${errorCode}`}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_WebView.default.errorText,children:`Description: ${errorDesc}`})]});};var useWebViewLogic=exports.useWebViewLogic=function useWebViewLogic(_ref2){var startInLoadingState=_ref2.startInLoadingState,onNavigationStateChange=_ref2.onNavigationStateChange,onLoadStart=_ref2.onLoadStart,onLoad=_ref2.onLoad,onLoadProgress=_ref2.onLoadProgress,onLoadEnd=_ref2.onLoadEnd,onError=_ref2.onError,onHttpErrorProp=_ref2.onHttpErrorProp,onMessageProp=_ref2.onMessageProp,onOpenWindowProp=_ref2.onOpenWindowProp,onRenderProcessGoneProp=_ref2.onRenderProcessGoneProp,onContentProcessDidTerminateProp=_ref2.onContentProcessDidTerminateProp,originWhitelist=_ref2.originWhitelist,onShouldStartLoadWithRequestProp=_ref2.onShouldStartLoadWithRequestProp,onShouldStartLoadWithRequestCallback=_ref2.onShouldStartLoadWithRequestCallback;var _useState=(0,_react.useState)(startInLoadingState?'LOADING':'IDLE'),_useState2=(0,_slicedToArray2.default)(_useState,2),viewState=_useState2[0],setViewState=_useState2[1];var _useState3=(0,_react.useState)(null),_useState4=(0,_slicedToArray2.default)(_useState3,2),lastErrorEvent=_useState4[0],setLastErrorEvent=_useState4[1];var startUrl=(0,_react.useRef)(null);var updateNavigationState=(0,_react.useCallback)(function(event){onNavigationStateChange==null?void 0:onNavigationStateChange(event.nativeEvent);},[onNavigationStateChange]);var onLoadingStart=(0,_react.useCallback)(function(event){startUrl.current=event.nativeEvent.url;onLoadStart==null?void 0:onLoadStart(event);updateNavigationState(event);},[onLoadStart,updateNavigationState]);var onLoadingError=(0,_react.useCallback)(function(event){event.persist();if(onError){onError(event);}else{console.warn('Encountered an error loading page',event.nativeEvent);}onLoadEnd==null?void 0:onLoadEnd(event);if(event.isDefaultPrevented()){return;}setViewState('ERROR');setLastErrorEvent(event.nativeEvent);},[onError,onLoadEnd]);var onHttpError=(0,_react.useCallback)(function(event){onHttpErrorProp==null?void 0:onHttpErrorProp(event);},[onHttpErrorProp]);var onRenderProcessGone=(0,_react.useCallback)(function(event){onRenderProcessGoneProp==null?void 0:onRenderProcessGoneProp(event);},[onRenderProcessGoneProp]);var onContentProcessDidTerminate=(0,_react.useCallback)(function(event){onContentProcessDidTerminateProp==null?void 0:onContentProcessDidTerminateProp(event);},[onContentProcessDidTerminateProp]);var onLoadingFinish=(0,_react.useCallback)(function(event){onLoad==null?void 0:onLoad(event);onLoadEnd==null?void 0:onLoadEnd(event);var url=event.nativeEvent.url;if(_reactNative.Platform.OS!=='android'||url===startUrl.current){setViewState('IDLE');}updateNavigationState(event);},[onLoad,onLoadEnd,updateNavigationState]);var onMessage=(0,_react.useCallback)(function(event){onMessageProp==null?void 0:onMessageProp(event);},[onMessageProp]);var onLoadingProgress=(0,_react.useCallback)(function(event){var progress=event.nativeEvent.progress;if(_reactNative.Platform.OS==='android'&&progress===1){setViewState(function(prevViewState){return prevViewState==='LOADING'?'IDLE':prevViewState;});}onLoadProgress==null?void 0:onLoadProgress(event);},[onLoadProgress]);var onShouldStartLoadWithRequest=(0,_react.useMemo)(function(){return createOnShouldStartLoadWithRequest(onShouldStartLoadWithRequestCallback,originWhitelist,onShouldStartLoadWithRequestProp);},[originWhitelist,onShouldStartLoadWithRequestProp,onShouldStartLoadWithRequestCallback]);var onOpenWindow=(0,_react.useCallback)(function(event){onOpenWindowProp==null?void 0:onOpenWindowProp(event);},[onOpenWindowProp]);return{onShouldStartLoadWithRequest:onShouldStartLoadWithRequest,onLoadingStart:onLoadingStart,onLoadingProgress:onLoadingProgress,onLoadingError:onLoadingError,onLoadingFinish:onLoadingFinish,onHttpError:onHttpError,onRenderProcessGone:onRenderProcessGone,onContentProcessDidTerminate:onContentProcessDidTerminate,onMessage:onMessage,onOpenWindow:onOpenWindow,viewState:viewState,setViewState:setViewState,lastErrorEvent:lastErrorEvent};};
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"Thibault Malbranche <malbranche.thibault@gmail.com>"
|
|
11
11
|
],
|
|
12
12
|
"license": "MIT",
|
|
13
|
-
"version": "13.13.
|
|
13
|
+
"version": "13.13.44",
|
|
14
14
|
"homepage": "https://github.com/react-native-webview/react-native-webview#readme",
|
|
15
15
|
"scripts": {
|
|
16
16
|
"android": "react-native run-android",
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
"@types/invariant": "^2.2.30",
|
|
55
55
|
"@types/jest": "^29.5.12",
|
|
56
56
|
"@types/react": "18.2.61",
|
|
57
|
-
"@types/react-native": "^0.73.0",
|
|
58
57
|
"@types/selenium-webdriver": "4.0.9",
|
|
59
58
|
"appium": "1.17.0",
|
|
60
59
|
"eslint": "8.57.0",
|
|
@@ -87,7 +86,7 @@
|
|
|
87
86
|
"src",
|
|
88
87
|
"index.js",
|
|
89
88
|
"index.d.ts",
|
|
90
|
-
"react-native-webview.podspec",
|
|
89
|
+
"react-native-webview-bootpay.podspec",
|
|
91
90
|
"react-native.config.js"
|
|
92
91
|
],
|
|
93
92
|
"codegenConfig": {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
|
|
4
|
+
ios_platform = new_arch_enabled ? '11.0' : '9.0'
|
|
5
|
+
|
|
6
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
7
|
+
|
|
8
|
+
Pod::Spec.new do |s|
|
|
9
|
+
s.name = package['name']
|
|
10
|
+
s.version = package['version']
|
|
11
|
+
s.summary = package['description']
|
|
12
|
+
s.license = package['license']
|
|
13
|
+
|
|
14
|
+
s.authors = package['author']
|
|
15
|
+
s.homepage = package['homepage']
|
|
16
|
+
s.platforms = { :ios => ios_platform, :osx => "10.13", :visionos => "1.0" }
|
|
17
|
+
|
|
18
|
+
s.source = { :git => "https://github.com/react-native-webview/react-native-webview.git", :tag => "v#{s.version}" }
|
|
19
|
+
|
|
20
|
+
s.source_files = "apple/**/*.{h,m,mm,swift}"
|
|
21
|
+
|
|
22
|
+
if defined?(install_modules_dependencies()) != nil
|
|
23
|
+
install_modules_dependencies(s);
|
|
24
|
+
else
|
|
25
|
+
if new_arch_enabled
|
|
26
|
+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
27
|
+
|
|
28
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
29
|
+
|
|
30
|
+
s.pod_target_xcconfig = {
|
|
31
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
32
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
33
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
s.dependency "React-RCTFabric"
|
|
37
|
+
s.dependency "React-Codegen"
|
|
38
|
+
s.dependency "RCT-Folly"
|
|
39
|
+
s.dependency "RCTRequired"
|
|
40
|
+
s.dependency "RCTTypeSafety"
|
|
41
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
42
|
+
else
|
|
43
|
+
s.dependency "React-Core"
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TurboModule } from 'react-native';
|
|
2
|
-
import { TurboModuleRegistry
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
3
3
|
import { Double } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
4
|
|
|
5
5
|
export interface Spec extends TurboModule {
|
|
@@ -10,23 +10,4 @@ export interface Spec extends TurboModule {
|
|
|
10
10
|
): void;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
let nativeModule: Spec | null = null;
|
|
15
|
-
|
|
16
|
-
try {
|
|
17
|
-
if (TurboModuleRegistry.getEnforcing) {
|
|
18
|
-
nativeModule = TurboModuleRegistry.getEnforcing<Spec>('BPCWebViewModule');
|
|
19
|
-
} else if (NativeModules.BPCWebViewModule) {
|
|
20
|
-
nativeModule = NativeModules.BPCWebViewModule as Spec;
|
|
21
|
-
}
|
|
22
|
-
} catch (error) {
|
|
23
|
-
console.warn('BPCWebViewModule를 찾을 수 없습니다. 더미 구현을 사용합니다.');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// 모듈이 없는 경우 더미 구현 제공
|
|
27
|
-
const BPCWebViewModule: Spec = nativeModule || {
|
|
28
|
-
isFileUploadSupported: async () => Platform.OS !== 'web',
|
|
29
|
-
shouldStartLoadWithLockIdentifier: () => {},
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default BPCWebViewModule;
|
|
13
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('BPCWebViewModule');
|