react-native-webview-bootpay 13.13.42 → 13.13.43-3.alpha.2
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 +0 -84
- package/android/src/main/AndroidManifestNew.xml +0 -84
- package/android/src/main/java/kr/co/bootpay/webview/BPCWebChromeClient.java +14 -174
- package/android/src/main/java/kr/co/bootpay/webview/BPCWebView.java +1 -25
- package/android/src/main/java/kr/co/bootpay/webview/BPCWebViewClient.java +0 -48
- package/apple/BPCWebView.mm +6 -6
- package/apple/BPCWebViewImpl.m +1 -1
- 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 -1
- package/src/NativeBPCWebViewModule.ts +21 -2
- package/android/src/main/java/kr/co/bootpay/webview/BootpayUrlHelper.java +0 -138
- package/ios/RNCWebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/RNCWebView.xcodeproj/project.xcworkspace/xcuserdata/taesupyoon.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/RNCWebView.xcodeproj/xcuserdata/taesupyoon.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
|
@@ -12,88 +12,4 @@
|
|
|
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>
|
|
99
15
|
</manifest>
|
|
@@ -10,88 +10,4 @@
|
|
|
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>
|
|
97
13
|
</manifest>
|
|
@@ -3,63 +3,38 @@ 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;
|
|
7
6
|
import android.content.pm.PackageManager;
|
|
8
7
|
import android.net.Uri;
|
|
9
|
-
import android.net.http.SslError;
|
|
10
8
|
import android.os.Build;
|
|
11
9
|
import android.os.Message;
|
|
12
10
|
import android.view.Gravity;
|
|
13
|
-
import android.view.KeyEvent;
|
|
14
11
|
import android.view.View;
|
|
15
12
|
import android.view.ViewGroup;
|
|
16
|
-
import android.view.WindowManager;
|
|
17
|
-
|
|
18
13
|
import android.webkit.ConsoleMessage;
|
|
19
14
|
import android.webkit.GeolocationPermissions;
|
|
20
15
|
import android.webkit.PermissionRequest;
|
|
21
|
-
import android.webkit.SslErrorHandler;
|
|
22
16
|
import android.webkit.ValueCallback;
|
|
23
17
|
import android.webkit.WebChromeClient;
|
|
24
18
|
import android.webkit.WebView;
|
|
25
19
|
import android.webkit.WebViewClient;
|
|
26
20
|
import android.widget.FrameLayout;
|
|
27
|
-
|
|
28
|
-
import android.content.Intent;
|
|
29
|
-
import android.annotation.SuppressLint;
|
|
30
|
-
import android.net.http.SslError;
|
|
31
21
|
|
|
32
22
|
import androidx.annotation.RequiresApi;
|
|
33
23
|
import androidx.core.content.ContextCompat;
|
|
34
24
|
|
|
35
25
|
import com.facebook.react.bridge.Arguments;
|
|
36
26
|
import com.facebook.react.bridge.LifecycleEventListener;
|
|
37
|
-
import com.facebook.react.bridge.ReactNoCrashSoftException;
|
|
38
27
|
import com.facebook.react.bridge.WritableMap;
|
|
39
28
|
import com.facebook.react.common.build.ReactBuildConfig;
|
|
40
29
|
import com.facebook.react.modules.core.PermissionAwareActivity;
|
|
41
30
|
import com.facebook.react.modules.core.PermissionListener;
|
|
42
31
|
import com.facebook.react.uimanager.UIManagerHelper;
|
|
43
|
-
import com.facebook.react.uimanager.ThemedReactContext;
|
|
44
|
-
import com.facebook.react.uimanager.UIManagerModule;
|
|
45
|
-
|
|
46
|
-
|
|
47
32
|
import kr.co.bootpay.webview.events.TopLoadingProgressEvent;
|
|
48
33
|
import kr.co.bootpay.webview.events.TopOpenWindowEvent;
|
|
49
34
|
|
|
50
35
|
import java.util.ArrayList;
|
|
51
36
|
import java.util.Collections;
|
|
52
37
|
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;
|
|
63
38
|
|
|
64
39
|
public class BPCWebChromeClient extends WebChromeClient implements LifecycleEventListener {
|
|
65
40
|
protected static final FrameLayout.LayoutParams FULLSCREEN_LAYOUT_PARAMS = new FrameLayout.LayoutParams(
|
|
@@ -104,162 +79,41 @@ public class BPCWebChromeClient extends WebChromeClient implements LifecycleEven
|
|
|
104
79
|
protected BPCWebView.ProgressChangedFilter progressChangedFilter = null;
|
|
105
80
|
protected boolean mAllowsProtectedMedia = false;
|
|
106
81
|
|
|
107
|
-
protected boolean mHasOnOpenWindowEvent = false;
|
|
82
|
+
protected boolean mHasOnOpenWindowEvent = false;
|
|
108
83
|
|
|
109
84
|
public BPCWebChromeClient(BPCWebView webView) {
|
|
110
85
|
this.mWebView = webView;
|
|
111
86
|
}
|
|
112
|
-
|
|
113
87
|
|
|
114
|
-
boolean isPopupWebView = false;
|
|
115
88
|
@Override
|
|
116
89
|
public boolean onCreateWindow(WebView view, boolean isDialog, boolean isUserGesture, Message resultMsg) {
|
|
117
90
|
|
|
118
|
-
|
|
119
|
-
final BPCWebView newWebView = new BPCWebView(reactContext);
|
|
91
|
+
final WebView newWebView = new WebView(view.getContext());
|
|
120
92
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
93
|
+
if(mHasOnOpenWindowEvent) {
|
|
94
|
+
newWebView.setWebViewClient(new WebViewClient(){
|
|
95
|
+
@Override
|
|
96
|
+
public boolean shouldOverrideUrlLoading (WebView subview, String url) {
|
|
97
|
+
WritableMap event = Arguments.createMap();
|
|
98
|
+
event.putString("targetUrl", url);
|
|
124
99
|
|
|
125
|
-
|
|
126
|
-
|
|
100
|
+
((BPCWebView) view).dispatchEvent(
|
|
101
|
+
view,
|
|
102
|
+
new TopOpenWindowEvent(BPCWebViewWrapper.getReactTagFromWebView(view), event)
|
|
103
|
+
);
|
|
127
104
|
|
|
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)) {
|
|
139
105
|
return true;
|
|
140
106
|
}
|
|
141
|
-
|
|
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;
|
|
107
|
+
});
|
|
151
108
|
}
|
|
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
|
-
|
|
166
109
|
|
|
167
110
|
final WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
|
|
168
111
|
transport.setWebView(newWebView);
|
|
169
112
|
resultMsg.sendToTarget();
|
|
170
113
|
|
|
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
|
-
|
|
188
114
|
return true;
|
|
189
115
|
}
|
|
190
116
|
|
|
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
|
-
|
|
263
117
|
@Override
|
|
264
118
|
public boolean onConsoleMessage(ConsoleMessage message) {
|
|
265
119
|
if (ReactBuildConfig.DEBUG) {
|
|
@@ -276,19 +130,6 @@ public class BPCWebChromeClient extends WebChromeClient implements LifecycleEven
|
|
|
276
130
|
if (progressChangedFilter.isWaitingForCommandLoadUrl()) {
|
|
277
131
|
return;
|
|
278
132
|
}
|
|
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
|
-
|
|
292
133
|
int reactTag = BPCWebViewWrapper.getReactTagFromWebView(webView);
|
|
293
134
|
WritableMap event = Arguments.createMap();
|
|
294
135
|
event.putDouble("target", reactTag);
|
|
@@ -298,8 +139,7 @@ public class BPCWebChromeClient extends WebChromeClient implements LifecycleEven
|
|
|
298
139
|
event.putBoolean("canGoForward", webView.canGoForward());
|
|
299
140
|
event.putDouble("progress", (float) newProgress / 100);
|
|
300
141
|
|
|
301
|
-
|
|
302
|
-
|
|
142
|
+
UIManagerHelper.getEventDispatcherForReactTag(this.mWebView.getThemedReactContext(), reactTag).dispatchEvent(new TopLoadingProgressEvent(reactTag, event));
|
|
303
143
|
}
|
|
304
144
|
|
|
305
145
|
@Override
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
package kr.co.bootpay.webview;
|
|
2
2
|
|
|
3
|
-
import android.app.Dialog;
|
|
4
|
-
|
|
5
3
|
import android.annotation.SuppressLint;
|
|
6
4
|
import android.graphics.Rect;
|
|
7
5
|
import android.net.Uri;
|
|
@@ -55,28 +53,12 @@ public class BPCWebView extends WebView implements LifecycleEventListener {
|
|
|
55
53
|
String injectedJS;
|
|
56
54
|
protected @Nullable
|
|
57
55
|
String injectedJSBeforeContentLoaded;
|
|
58
|
-
|
|
56
|
+
protected static final String JAVASCRIPT_INTERFACE = "ReactNativeWebView";
|
|
59
57
|
protected @Nullable
|
|
60
58
|
BPCWebViewBridge fallbackBridge;
|
|
61
59
|
protected @Nullable
|
|
62
60
|
WebViewCompat.WebMessageListener bridgeListener = null;
|
|
63
61
|
|
|
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
|
-
|
|
80
62
|
/**
|
|
81
63
|
* android.webkit.WebChromeClient fundamentally does not support JS injection into frames other
|
|
82
64
|
* than the main frame, so these two properties are mostly here just for parity with iOS & macOS.
|
|
@@ -291,12 +273,6 @@ public class BPCWebView extends WebView implements LifecycleEventListener {
|
|
|
291
273
|
addJavascriptInterface(fallbackBridge, JAVASCRIPT_INTERFACE);
|
|
292
274
|
}
|
|
293
275
|
}
|
|
294
|
-
|
|
295
|
-
// if (fallbackBridge == null) {
|
|
296
|
-
// fallbackBridge = new BPCWebViewBridge(webView);
|
|
297
|
-
// addJavascriptInterface(fallbackBridge, JAVASCRIPT_INTERFACE);
|
|
298
|
-
// }
|
|
299
|
-
|
|
300
276
|
injectJavascriptObject();
|
|
301
277
|
}
|
|
302
278
|
|
|
@@ -36,12 +36,6 @@ 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
|
-
|
|
45
39
|
public class BPCWebViewClient extends WebViewClient {
|
|
46
40
|
private static String TAG = "BPCWebViewClient";
|
|
47
41
|
protected static final int SHOULD_OVERRIDE_URL_LOADING_TIMEOUT = 250;
|
|
@@ -102,18 +96,6 @@ public class BPCWebViewClient extends WebViewClient {
|
|
|
102
96
|
|
|
103
97
|
@Override
|
|
104
98
|
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) {
|
|
117
99
|
final BPCWebView BPCWebView = (BPCWebView) view;
|
|
118
100
|
final boolean isJsDebugging = BPCWebView.getReactApplicationContext().getJavaScriptContextHolder().get() == 0;
|
|
119
101
|
|
|
@@ -236,36 +218,6 @@ public class BPCWebViewClient extends WebViewClient {
|
|
|
236
218
|
);
|
|
237
219
|
}
|
|
238
220
|
|
|
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
|
-
|
|
269
221
|
@Override
|
|
270
222
|
public void onReceivedError(
|
|
271
223
|
WebView webView,
|
package/apple/BPCWebView.mm
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
using namespace facebook::react;
|
|
14
14
|
|
|
15
|
-
auto
|
|
15
|
+
auto BPStringToOnShouldStartLoadWithRequestNavigationTypeEnum(std::string value) {
|
|
16
16
|
if (value == "click") return BPCWebViewEventEmitter::OnShouldStartLoadWithRequestNavigationType::Click;
|
|
17
17
|
if (value == "formsubmit") return BPCWebViewEventEmitter::OnShouldStartLoadWithRequestNavigationType::Formsubmit;
|
|
18
18
|
if (value == "backforward") return BPCWebViewEventEmitter::OnShouldStartLoadWithRequestNavigationType::Backforward;
|
|
@@ -21,7 +21,7 @@ auto stringToOnShouldStartLoadWithRequestNavigationTypeEnum(std::string value) {
|
|
|
21
21
|
return BPCWebViewEventEmitter::OnShouldStartLoadWithRequestNavigationType::Other;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
auto
|
|
24
|
+
auto BPStringToOnLoadingStartNavigationTypeEnum(std::string value) {
|
|
25
25
|
if (value == "click") return BPCWebViewEventEmitter::OnLoadingStartNavigationType::Click;
|
|
26
26
|
if (value == "formsubmit") return BPCWebViewEventEmitter::OnLoadingStartNavigationType::Formsubmit;
|
|
27
27
|
if (value == "backforward") return BPCWebViewEventEmitter::OnLoadingStartNavigationType::Backforward;
|
|
@@ -30,7 +30,7 @@ auto stringToOnLoadingStartNavigationTypeEnum(std::string value) {
|
|
|
30
30
|
return BPCWebViewEventEmitter::OnLoadingStartNavigationType::Other;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
auto
|
|
33
|
+
auto BPStringToOnLoadingFinishNavigationTypeEnum(std::string value) {
|
|
34
34
|
if (value == "click") return BPCWebViewEventEmitter::OnLoadingFinishNavigationType::Click;
|
|
35
35
|
if (value == "formsubmit") return BPCWebViewEventEmitter::OnLoadingFinishNavigationType::Formsubmit;
|
|
36
36
|
if (value == "backforward") return BPCWebViewEventEmitter::OnLoadingFinishNavigationType::Backforward;
|
|
@@ -81,7 +81,7 @@ auto stringToOnLoadingFinishNavigationTypeEnum(std::string value) {
|
|
|
81
81
|
.url = std::string([[dictionary valueForKey:@"url"] UTF8String]),
|
|
82
82
|
.lockIdentifier = [[dictionary valueForKey:@"lockIdentifier"] doubleValue],
|
|
83
83
|
.title = std::string([[dictionary valueForKey:@"title"] UTF8String]),
|
|
84
|
-
.navigationType =
|
|
84
|
+
.navigationType = BPStringToOnShouldStartLoadWithRequestNavigationTypeEnum(std::string([[dictionary valueForKey:@"navigationType"] UTF8String])),
|
|
85
85
|
.canGoBack = static_cast<bool>([[dictionary valueForKey:@"canGoBack"] boolValue]),
|
|
86
86
|
.canGoForward = static_cast<bool>([[dictionary valueForKey:@"canGoForward"] boolValue]),
|
|
87
87
|
.isTopFrame = static_cast<bool>([[dictionary valueForKey:@"isTopFrame"] boolValue]),
|
|
@@ -98,7 +98,7 @@ auto stringToOnLoadingFinishNavigationTypeEnum(std::string value) {
|
|
|
98
98
|
.url = std::string([[dictionary valueForKey:@"url"] UTF8String]),
|
|
99
99
|
.lockIdentifier = [[dictionary valueForKey:@"lockIdentifier"] doubleValue],
|
|
100
100
|
.title = std::string([[dictionary valueForKey:@"title"] UTF8String]),
|
|
101
|
-
.navigationType =
|
|
101
|
+
.navigationType = BPStringToOnLoadingStartNavigationTypeEnum(std::string([[dictionary valueForKey:@"navigationType"] UTF8String])),
|
|
102
102
|
.canGoBack = static_cast<bool>([[dictionary valueForKey:@"canGoBack"] boolValue]),
|
|
103
103
|
.canGoForward = static_cast<bool>([[dictionary valueForKey:@"canGoForward"] boolValue]),
|
|
104
104
|
.loading = static_cast<bool>([[dictionary valueForKey:@"loading"] boolValue]),
|
|
@@ -146,7 +146,7 @@ auto stringToOnLoadingFinishNavigationTypeEnum(std::string value) {
|
|
|
146
146
|
.url = std::string([[dictionary valueForKey:@"url"] UTF8String]),
|
|
147
147
|
.lockIdentifier = [[dictionary valueForKey:@"lockIdentifier"] doubleValue],
|
|
148
148
|
.title = std::string([[dictionary valueForKey:@"title"] UTF8String]),
|
|
149
|
-
.navigationType =
|
|
149
|
+
.navigationType = BPStringToOnLoadingFinishNavigationTypeEnum(std::string([[dictionary valueForKey:@"navigationType"] UTF8String], [[dictionary valueForKey:@"navigationType"] lengthOfBytesUsingEncoding:NSUTF8StringEncoding])),
|
|
150
150
|
.canGoBack = static_cast<bool>([[dictionary valueForKey:@"canGoBack"] boolValue]),
|
|
151
151
|
.canGoForward = static_cast<bool>([[dictionary valueForKey:@"canGoForward"] boolValue]),
|
|
152
152
|
.loading = static_cast<bool>([[dictionary valueForKey:@"loading"] boolValue]),
|
package/apple/BPCWebViewImpl.m
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
#import "objc/runtime.h"
|
|
19
19
|
|
|
20
20
|
static NSTimer *keyboardTimer;
|
|
21
|
-
static NSString *const HistoryShimName = @"
|
|
21
|
+
static NSString *const HistoryShimName = @"BPReactNativeHistoryShim";
|
|
22
22
|
static NSString *const MessageHandlerName = @"BootpayRNWebView";
|
|
23
23
|
static NSURLCredential* clientAuthenticationCredential;
|
|
24
24
|
static NSDictionary* customCertificatesForHost;
|
|
@@ -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 BPCWebViewModule: Spec;
|
|
8
|
+
export default BPCWebViewModule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _reactNative=require("react-native");var
|
|
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 _reactNative=require("react-native");var nativeModule=null;try{if(_reactNative.TurboModuleRegistry.getEnforcing){nativeModule=_reactNative.TurboModuleRegistry.getEnforcing('BPCWebViewModule');}else if(_reactNative.NativeModules.BPCWebViewModule){nativeModule=_reactNative.NativeModules.BPCWebViewModule;}}catch(error){console.warn('BPCWebViewModule를 찾을 수 없습니다. 더미 구현을 사용합니다.');}var BPCWebViewModule=nativeModule||{isFileUploadSupported:function(){var _isFileUploadSupported=(0,_asyncToGenerator2.default)(function*(){return _reactNative.Platform.OS!=='web';});function isFileUploadSupported(){return _isFileUploadSupported.apply(this,arguments);}return isFileUploadSupported;}(),shouldStartLoadWithLockIdentifier:function shouldStartLoadWithLockIdentifier(){}};var _default=exports.default=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-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;
|
|
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;
|
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-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;
|
|
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;
|
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-250313/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-250313/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-250313/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-250313/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.433.alpha.2",
|
|
14
14
|
"homepage": "https://github.com/react-native-webview/react-native-webview#readme",
|
|
15
15
|
"scripts": {
|
|
16
16
|
"android": "react-native run-android",
|
|
@@ -54,6 +54,7 @@
|
|
|
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",
|
|
57
58
|
"@types/selenium-webdriver": "4.0.9",
|
|
58
59
|
"appium": "1.17.0",
|
|
59
60
|
"eslint": "8.57.0",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TurboModule } from 'react-native';
|
|
2
|
-
import { TurboModuleRegistry } from 'react-native';
|
|
2
|
+
import { TurboModuleRegistry, NativeModules, Platform } from 'react-native';
|
|
3
3
|
import { Double } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
4
|
|
|
5
5
|
export interface Spec extends TurboModule {
|
|
@@ -10,4 +10,23 @@ export interface Spec extends TurboModule {
|
|
|
10
10
|
): void;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
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;
|
|
@@ -1,138 +0,0 @@
|
|
|
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
|
-
}
|
|
Binary file
|
|
@@ -1,14 +0,0 @@
|
|
|
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>
|