react-native-webview-bootpay 13.13.421 → 13.13.422

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.
@@ -12,4 +12,88 @@
12
12
  android:resource="@xml/file_provider_paths" />
13
13
  </provider>
14
14
  </application>
15
+
16
+ <!-- android 11 모든 앱 접근 권한 사용 (Google Play 가이드라인 참고 - 2021-02-19 기준 못찾았음) -->
17
+ <!-- <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" tools:ignore="QueryAllPackagesPermission" />-->
18
+ <!-- android 11 Package Visibility 설정 (compileSdkVersion, targetSdkVersion 30 이상 설정시 필수) -->
19
+ <!-- 2021-02-19 -->
20
+ <queries>
21
+ <!-- 다날[신한, BC(페이북), 국민, 현대, 삼성, 하나, 롯데, 농협, 우리, 씨티, 페이코, 삼성페이, 카카오페이, 뱅크페이, SSG페이, 스마일페이, 엘페이] -->
22
+ <!-- KCP [페이코, 현대, BC(페이북), 롯데, 국민, 농협, 삼성, 신한, 우리, 하나, 씨티] -->
23
+ <!-- 이니시스 [카카오페이, 네이버페이, 신한, 하나, 현대, 삼성, 국민, BC(페이북), 농협, 롯데, 씨티, 페이코, 엘페이, SSG페이, 차이, 토스, 삼성페이] -->
24
+ <!-- 나이스페이 [신한, 국민, 삼성, BC(페이북), 롯데, 현대, 하나 농협, 씨티, 우리] -->
25
+ <!-- 토스페이먼츠 [현대, 신한, 페이북, 국민, 삼성, 롯데, 농협, 우리] -->
26
+ <!-- 이지페이 [현대, 하나, 국민, 롯데, 삼성, BC(페이북) 신한, 하나, 농협, 씨티, 우리, 페이코] -->
27
+ <!-- 티페이 [BC(페이북), 국민, 하나, 삼성, 신한, 현대, 롯데, 농협, 씨티, 우리] -->
28
+ <!-- 페이레터 [BC(페이북), 국민, 하나, 삼성, 신한, 현대. 롯데, 농협, 씨티, ] -->
29
+ <!-- 월컴페이먼츠 [카카오스, 엘페이, 현대, BC(페이북), 국민, 삼성, 신한, 롯데, 농협, 하나, 씨티, 하나, 우리] -->
30
+
31
+ <!-- 간편결제 -->
32
+ <package android:name="com.nhnent.payapp" /> <!-- 페이코 -->
33
+ <package android:name="com.lottemembers.android" /> <!-- LPAY -->
34
+ <package android:name="com.ssg.serviceapp.android.egiftcertificate" /> <!-- SSG 페이 -->
35
+ <package android:name="com.inicis.kpay" /> <!-- 이니시스 KPAY -->
36
+ <package android:name="com.tmoney.tmpay" /> <!-- 티머니페이 -->
37
+ <package android:name="viva.republica.toss" /> <!-- 토스페이 -->
38
+ <package android:name="com.kakao.talk" /> <!-- 카카오페이 -->
39
+ <package android:name="com.mysmilepay.app" /> <!-- 스마일 페이 -->
40
+ <package android:name="com.lotte.lpay" /> <!-- 엘페이 -->
41
+ <package android:name="finance.chai.app" /> <!-- 차이 -->
42
+ <package android:name="com.nhn.android.search" /> <!-- 네이버 -->
43
+
44
+ <!-- 앱카드 -->
45
+ <package android:name="kvp.jjy.MispAndroid320" /> <!-- BC 페이북 -->
46
+ <package android:name="com.kbcard.kbkookmincard" /> <!-- 국민카드 -->
47
+ <package android:name="com.kbcard.cxh.appcard" /> <!-- 국민카드 -->
48
+ <package android:name="com.kbstar.liivbank" /> <!-- 국민 리브 -->
49
+ <package android:name="com.kbstar.reboot" /> <!-- 국민 new 리브 -->
50
+ <package android:name="com.kbstar.kbbank" /> <!-- KB 스타뱅킹 -->
51
+
52
+ <package android:name="com.samsung.android.spay" /> <!-- 삼성페이 -->
53
+ <package android:name="com.samsung.android.spaylite" /> <!-- 삼성페이 미니 -->
54
+ <package android:name="com.lge.lgpay" /> <!-- 엘지페이 -->
55
+ <package android:name="com.hanaskcard.paycla" /> <!-- 하나카드 -->
56
+ <package android:name="kr.co.hanamembers.hmscustomer" /> <!-- 하나카드(멤버스결제) -->
57
+ <package android:name="com.lcacApp" /> <!-- 롯데카드 -->
58
+ <package android:name="kr.co.samsungcard.mpocket" /> <!-- 삼성카드 -->
59
+ <package android:name="com.shcard.smartpay" /> <!-- 신한카드-->
60
+ <package android:name="com.shinhan.smartcaremgr" /> <!-- 신한 쏠-->
61
+ <package android:name="com.shinhancard.smartshinhan" /> <!-- 신한카드 (ARS/일반결제/Smart결제) -->
62
+ <package android:name="com.hyundaicard.appcard" /> <!-- 현대카드 -->
63
+ <package android:name="nh.smart.nhallonepay" /> <!-- 농협카드 -->
64
+ <package android:name="com.wooricard.wpay" /> <!-- 우리카드 -->
65
+ <package android:name="com.wooricard.smartapp" /> <!-- 우리 WON 카드 -->
66
+ <package android:name="com.wooribank.smart.npib" /> <!-- 우리 WON 뱅킹 -->
67
+ <package android:name="kr.co.citibank.citimobile" /> <!-- 씨티카드 -->
68
+ <package android:name="com.mobiletoong.travelwallet" /> <!-- 트레블월렛 -->
69
+
70
+
71
+
72
+ <!-- 계좌이체 -->
73
+ <package android:name="com.kftc.bankpay.android" /> <!-- 뱅크페이 -->
74
+ <package android:name="com.kbankwith.smartbank" /> <!-- 케이뱅크 -->
75
+ <package android:name="com.knb.psb" /> <!-- BNK 경남은행 모바일뱅킹 -->
76
+ <package android:name="kr.co.kfcc.mobilebank" /> <!-- MG 새마을금고 -->
77
+ <package android:name="com.nh.cashcardapp" /> <!-- NH앱캐시 -->
78
+
79
+ <!-- 공인인증(신용카드) -->
80
+ <package android:name="com.hanaskcard.rocomo.potal" /> <!-- 하나카드 -->
81
+ <package android:name="com.lumensoft.touchenappfree" /> <!-- 현대카드 -->
82
+
83
+
84
+ <!-- 보안앱 -->
85
+ <package android:name="com.TouchEn.mVaccine.webs" /> <!-- 신한, 씨티 -->
86
+ <package android:name="kr.co.shiftworks.vguardweb" /> <!-- 삼성 -->
87
+ <package android:name="com.ahnlab.v3mobileplus" /> <!-- 하나, 농협, 우리, 국민 리브 -->
88
+
89
+ <!-- 휴대폰 결제 -->
90
+ <package android:name="com.kt.ktauth" /> <!-- KT 본인인증 -->
91
+ <package android:name="kr.danal.app.damoum" /> <!-- 다모음 -->
92
+ <package android:name="uplus.membership" /> <!-- U+ 멤버스 -->
93
+ <package android:name="com.sktelecom.tauth" /> <!--PASS-->
94
+ <package android:name="com.lguplus.smartotp" /> <!--PASS-->
95
+
96
+ <!--해외결제-->
97
+ <package android:name="com.eg.android.AlipayGphone" />
98
+ </queries>
15
99
  </manifest>
@@ -10,4 +10,88 @@
10
10
  android:resource="@xml/file_provider_paths" />
11
11
  </provider>
12
12
  </application>
13
+
14
+ <!-- android 11 모든 앱 접근 권한 사용 (Google Play 가이드라인 참고 - 2021-02-19 기준 못찾았음) -->
15
+ <!-- <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" tools:ignore="QueryAllPackagesPermission" />-->
16
+ <!-- android 11 Package Visibility 설정 (compileSdkVersion, targetSdkVersion 30 이상 설정시 필수) -->
17
+ <!-- 2021-02-19 -->
18
+ <queries>
19
+ <!-- 다날[신한, BC(페이북), 국민, 현대, 삼성, 하나, 롯데, 농협, 우리, 씨티, 페이코, 삼성페이, 카카오페이, 뱅크페이, SSG페이, 스마일페이, 엘페이] -->
20
+ <!-- KCP [페이코, 현대, BC(페이북), 롯데, 국민, 농협, 삼성, 신한, 우리, 하나, 씨티] -->
21
+ <!-- 이니시스 [카카오페이, 네이버페이, 신한, 하나, 현대, 삼성, 국민, BC(페이북), 농협, 롯데, 씨티, 페이코, 엘페이, SSG페이, 차이, 토스, 삼성페이] -->
22
+ <!-- 나이스페이 [신한, 국민, 삼성, BC(페이북), 롯데, 현대, 하나 농협, 씨티, 우리] -->
23
+ <!-- 토스페이먼츠 [현대, 신한, 페이북, 국민, 삼성, 롯데, 농협, 우리] -->
24
+ <!-- 이지페이 [현대, 하나, 국민, 롯데, 삼성, BC(페이북) 신한, 하나, 농협, 씨티, 우리, 페이코] -->
25
+ <!-- 티페이 [BC(페이북), 국민, 하나, 삼성, 신한, 현대, 롯데, 농협, 씨티, 우리] -->
26
+ <!-- 페이레터 [BC(페이북), 국민, 하나, 삼성, 신한, 현대. 롯데, 농협, 씨티, ] -->
27
+ <!-- 월컴페이먼츠 [카카오스, 엘페이, 현대, BC(페이북), 국민, 삼성, 신한, 롯데, 농협, 하나, 씨티, 하나, 우리] -->
28
+
29
+ <!-- 간편결제 -->
30
+ <package android:name="com.nhnent.payapp" /> <!-- 페이코 -->
31
+ <package android:name="com.lottemembers.android" /> <!-- LPAY -->
32
+ <package android:name="com.ssg.serviceapp.android.egiftcertificate" /> <!-- SSG 페이 -->
33
+ <package android:name="com.inicis.kpay" /> <!-- 이니시스 KPAY -->
34
+ <package android:name="com.tmoney.tmpay" /> <!-- 티머니페이 -->
35
+ <package android:name="viva.republica.toss" /> <!-- 토스페이 -->
36
+ <package android:name="com.kakao.talk" /> <!-- 카카오페이 -->
37
+ <package android:name="com.mysmilepay.app" /> <!-- 스마일 페이 -->
38
+ <package android:name="com.lotte.lpay" /> <!-- 엘페이 -->
39
+ <package android:name="finance.chai.app" /> <!-- 차이 -->
40
+ <package android:name="com.nhn.android.search" /> <!-- 네이버 -->
41
+
42
+ <!-- 앱카드 -->
43
+ <package android:name="kvp.jjy.MispAndroid320" /> <!-- BC 페이북 -->
44
+ <package android:name="com.kbcard.kbkookmincard" /> <!-- 국민카드 -->
45
+ <package android:name="com.kbcard.cxh.appcard" /> <!-- 국민카드 -->
46
+ <package android:name="com.kbstar.liivbank" /> <!-- 국민 리브 -->
47
+ <package android:name="com.kbstar.reboot" /> <!-- 국민 new 리브 -->
48
+ <package android:name="com.kbstar.kbbank" /> <!-- KB 스타뱅킹 -->
49
+
50
+ <package android:name="com.samsung.android.spay" /> <!-- 삼성페이 -->
51
+ <package android:name="com.samsung.android.spaylite" /> <!-- 삼성페이 미니 -->
52
+ <package android:name="com.lge.lgpay" /> <!-- 엘지페이 -->
53
+ <package android:name="com.hanaskcard.paycla" /> <!-- 하나카드 -->
54
+ <package android:name="kr.co.hanamembers.hmscustomer" /> <!-- 하나카드(멤버스결제) -->
55
+ <package android:name="com.lcacApp" /> <!-- 롯데카드 -->
56
+ <package android:name="kr.co.samsungcard.mpocket" /> <!-- 삼성카드 -->
57
+ <package android:name="com.shcard.smartpay" /> <!-- 신한카드-->
58
+ <package android:name="com.shinhan.smartcaremgr" /> <!-- 신한 쏠-->
59
+ <package android:name="com.shinhancard.smartshinhan" /> <!-- 신한카드 (ARS/일반결제/Smart결제) -->
60
+ <package android:name="com.hyundaicard.appcard" /> <!-- 현대카드 -->
61
+ <package android:name="nh.smart.nhallonepay" /> <!-- 농협카드 -->
62
+ <package android:name="com.wooricard.wpay" /> <!-- 우리카드 -->
63
+ <package android:name="com.wooricard.smartapp" /> <!-- 우리 WON 카드 -->
64
+ <package android:name="com.wooribank.smart.npib" /> <!-- 우리 WON 뱅킹 -->
65
+ <package android:name="kr.co.citibank.citimobile" /> <!-- 씨티카드 -->
66
+ <package android:name="com.mobiletoong.travelwallet" /> <!-- 트레블월렛 -->
67
+
68
+
69
+
70
+ <!-- 계좌이체 -->
71
+ <package android:name="com.kftc.bankpay.android" /> <!-- 뱅크페이 -->
72
+ <package android:name="com.kbankwith.smartbank" /> <!-- 케이뱅크 -->
73
+ <package android:name="com.knb.psb" /> <!-- BNK 경남은행 모바일뱅킹 -->
74
+ <package android:name="kr.co.kfcc.mobilebank" /> <!-- MG 새마을금고 -->
75
+ <package android:name="com.nh.cashcardapp" /> <!-- NH앱캐시 -->
76
+
77
+ <!-- 공인인증(신용카드) -->
78
+ <package android:name="com.hanaskcard.rocomo.potal" /> <!-- 하나카드 -->
79
+ <package android:name="com.lumensoft.touchenappfree" /> <!-- 현대카드 -->
80
+
81
+
82
+ <!-- 보안앱 -->
83
+ <package android:name="com.TouchEn.mVaccine.webs" /> <!-- 신한, 씨티 -->
84
+ <package android:name="kr.co.shiftworks.vguardweb" /> <!-- 삼성 -->
85
+ <package android:name="com.ahnlab.v3mobileplus" /> <!-- 하나, 농협, 우리, 국민 리브 -->
86
+
87
+ <!-- 휴대폰 결제 -->
88
+ <package android:name="com.kt.ktauth" /> <!-- KT 본인인증 -->
89
+ <package android:name="kr.danal.app.damoum" /> <!-- 다모음 -->
90
+ <package android:name="uplus.membership" /> <!-- U+ 멤버스 -->
91
+ <package android:name="com.sktelecom.tauth" /> <!--PASS-->
92
+ <package android:name="com.lguplus.smartotp" /> <!--PASS-->
93
+
94
+ <!--해외결제-->
95
+ <package android:name="com.eg.android.AlipayGphone" />
96
+ </queries>
13
97
  </manifest>
@@ -3,38 +3,63 @@ package kr.co.bootpay.webview;
3
3
  import android.Manifest;
4
4
  import android.annotation.TargetApi;
5
5
  import android.app.Activity;
6
+ import android.app.AlertDialog;
6
7
  import android.content.pm.PackageManager;
7
8
  import android.net.Uri;
9
+ import android.net.http.SslError;
8
10
  import android.os.Build;
9
11
  import android.os.Message;
10
12
  import android.view.Gravity;
13
+ import android.view.KeyEvent;
11
14
  import android.view.View;
12
15
  import android.view.ViewGroup;
16
+ import android.view.WindowManager;
17
+
13
18
  import android.webkit.ConsoleMessage;
14
19
  import android.webkit.GeolocationPermissions;
15
20
  import android.webkit.PermissionRequest;
21
+ import android.webkit.SslErrorHandler;
16
22
  import android.webkit.ValueCallback;
17
23
  import android.webkit.WebChromeClient;
18
24
  import android.webkit.WebView;
19
25
  import android.webkit.WebViewClient;
20
26
  import android.widget.FrameLayout;
27
+
28
+ import android.content.Intent;
29
+ import android.annotation.SuppressLint;
30
+ import android.net.http.SslError;
21
31
 
22
32
  import androidx.annotation.RequiresApi;
23
33
  import androidx.core.content.ContextCompat;
24
34
 
25
35
  import com.facebook.react.bridge.Arguments;
26
36
  import com.facebook.react.bridge.LifecycleEventListener;
37
+ import com.facebook.react.bridge.ReactNoCrashSoftException;
27
38
  import com.facebook.react.bridge.WritableMap;
28
39
  import com.facebook.react.common.build.ReactBuildConfig;
29
40
  import com.facebook.react.modules.core.PermissionAwareActivity;
30
41
  import com.facebook.react.modules.core.PermissionListener;
31
42
  import com.facebook.react.uimanager.UIManagerHelper;
43
+ import com.facebook.react.uimanager.ThemedReactContext;
44
+ import com.facebook.react.uimanager.UIManagerModule;
45
+
46
+
32
47
  import kr.co.bootpay.webview.events.TopLoadingProgressEvent;
33
48
  import kr.co.bootpay.webview.events.TopOpenWindowEvent;
34
49
 
35
50
  import java.util.ArrayList;
36
51
  import java.util.Collections;
37
52
  import java.util.List;
53
+ import android.util.Log;
54
+
55
+ import android.app.Dialog;
56
+ import android.content.Context;
57
+ import android.content.Intent;
58
+ import android.widget.Toast;
59
+
60
+ import org.json.JSONException;
61
+ import org.json.JSONObject;
62
+ import android.content.DialogInterface;
38
63
 
39
64
  public class BPCWebChromeClient extends WebChromeClient implements LifecycleEventListener {
40
65
  protected static final FrameLayout.LayoutParams FULLSCREEN_LAYOUT_PARAMS = new FrameLayout.LayoutParams(
@@ -79,41 +104,162 @@ public class BPCWebChromeClient extends WebChromeClient implements LifecycleEven
79
104
  protected BPCWebView.ProgressChangedFilter progressChangedFilter = null;
80
105
  protected boolean mAllowsProtectedMedia = false;
81
106
 
82
- protected boolean mHasOnOpenWindowEvent = false;
107
+ protected boolean mHasOnOpenWindowEvent = false;
83
108
 
84
109
  public BPCWebChromeClient(BPCWebView webView) {
85
110
  this.mWebView = webView;
86
111
  }
112
+
87
113
 
114
+ boolean isPopupWebView = false;
88
115
  @Override
89
116
  public boolean onCreateWindow(WebView view, boolean isDialog, boolean isUserGesture, Message resultMsg) {
90
117
 
91
- final WebView newWebView = new WebView(view.getContext());
118
+ ThemedReactContext reactContext = (ThemedReactContext) view.getContext();
119
+ final BPCWebView newWebView = new BPCWebView(reactContext);
92
120
 
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);
121
+ BPCWebChromeClient client = new BPCWebChromeClient(newWebView);
122
+ client.setProgressChangedFilter(progressChangedFilter);
123
+ newWebView.setWebChromeClient(client);
99
124
 
100
- ((BPCWebView) view).dispatchEvent(
101
- view,
102
- new TopOpenWindowEvent(BPCWebViewWrapper.getReactTagFromWebView(view), event)
103
- );
125
+ Log.d("BPCWebChromeClient", "onCreateWindow");
126
+ isPopupWebView = true;
104
127
 
128
+ setWebSettingCopy(view, newWebView);
129
+
130
+
131
+ newWebView.setWebViewClient(new WebViewClient(){
132
+ @Override
133
+ public boolean shouldOverrideUrlLoading (WebView subview, String url) {
134
+
135
+ Log.d("bootpay url", url);
136
+
137
+ // return true;
138
+ if(BootpayUrlHelper.shouldOverrideUrlLoading(view, url)) {
105
139
  return true;
106
140
  }
107
- });
141
+ // return shouldOverrideUrlLoadingRN(view, url);
142
+ WritableMap event = Arguments.createMap();
143
+ event.putString("targetUrl", url);
144
+
145
+ ((BPCWebView) view).dispatchEvent(
146
+ view,
147
+ new TopOpenWindowEvent(view.getId(), event)
148
+ );
149
+
150
+ return false;
108
151
  }
152
+ });
153
+
154
+ Dialog popupDialog = new Dialog(view.getContext(), android.R.style.Theme_Black_NoTitleBar_Fullscreen);
155
+ popupDialog.setContentView(newWebView);
156
+ ViewGroup.LayoutParams params = popupDialog.getWindow().getAttributes();
157
+ params.width = ViewGroup.LayoutParams.MATCH_PARENT;
158
+ params.height = ViewGroup.LayoutParams.MATCH_PARENT;
159
+ popupDialog.getWindow().setAttributes((WindowManager.LayoutParams) params);
160
+ popupDialog.setOnDismissListener(dialog -> {
161
+ onCloseWindow(view); //rn에선 딱히 동작하지 않음
162
+ });
163
+ newWebView.setDialog(popupDialog);
164
+ popupDialog.show();
165
+
109
166
 
110
167
  final WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
111
168
  transport.setWebView(newWebView);
112
169
  resultMsg.sendToTarget();
113
170
 
171
+ // 🔹 팝업을 위한 FrameLayout을 React Native UI 트리에 추가
172
+ // Activity activity = reactContext.getCurrentActivity();
173
+ // if (activity != null) {
174
+ // activity.runOnUiThread(() -> {
175
+ // FrameLayout popupContainer = new FrameLayout(activity);
176
+ // popupContainer.setLayoutParams(new FrameLayout.LayoutParams(
177
+ // ViewGroup.LayoutParams.MATCH_PARENT,
178
+ // ViewGroup.LayoutParams.MATCH_PARENT
179
+ // ));
180
+ // popupContainer.addView(newWebView);
181
+ // ((ViewGroup) activity.findViewById(android.R.id.content)).addView(popupContainer);
182
+ // });
183
+ // } else {
184
+ // Log.e("BPCWebChromeClient", "Activity is null, cannot add popup WebView.");
185
+ // }
186
+
187
+
114
188
  return true;
115
189
  }
116
190
 
191
+
192
+ @Override
193
+ public void onCloseWindow(WebView window) {
194
+ super.onCloseWindow(window);
195
+ ((BPCWebView) window).dissmissDialog();
196
+
197
+ Log.d("BPCWebChromeClient", "onCloseWindow");
198
+
199
+ isPopupWebView = false;
200
+ // if(mainView != null) {
201
+ // mainView.removeView(window);
202
+ // }
203
+ // window.setVisibility(View.GONE);
204
+ }
205
+
206
+
207
+
208
+
209
+ void setWebSettingCopy(WebView view, WebView newWebView) {
210
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
211
+ newWebView.getSettings().setMediaPlaybackRequiresUserGesture( view.getSettings().getMediaPlaybackRequiresUserGesture() );
212
+ }
213
+
214
+ newWebView.getSettings().setBuiltInZoomControls(view.getSettings().getBuiltInZoomControls());
215
+ newWebView.getSettings().setDisplayZoomControls(view.getSettings().getDisplayZoomControls());
216
+ newWebView.getSettings().setAllowFileAccess(view.getSettings().getAllowFileAccess());
217
+ newWebView.getSettings().setAllowContentAccess(view.getSettings().getAllowContentAccess());
218
+ newWebView.getSettings().setLoadWithOverviewMode(view.getSettings().getLoadWithOverviewMode());
219
+ // newWebView.getSettings().setEnableSmoothTransition(view.getSettings().);
220
+ newWebView.getSettings().setSaveFormData(view.getSettings().getSaveFormData());
221
+ newWebView.getSettings().setSavePassword(view.getSettings().getSavePassword());
222
+ newWebView.getSettings().setTextZoom(view.getSettings().getTextZoom());
223
+
224
+ newWebView.getSettings().setUseWideViewPort(view.getSettings().getUseWideViewPort());
225
+ newWebView.getSettings().setSupportMultipleWindows(true);
226
+ newWebView.getSettings().setLayoutAlgorithm(view.getSettings().getLayoutAlgorithm());
227
+ newWebView.getSettings().setStandardFontFamily(view.getSettings().getStandardFontFamily());
228
+ newWebView.getSettings().setFixedFontFamily(view.getSettings().getFixedFontFamily());
229
+ newWebView.getSettings().setSansSerifFontFamily(view.getSettings().getSansSerifFontFamily());
230
+ newWebView.getSettings().setSerifFontFamily(view.getSettings().getSerifFontFamily());
231
+ newWebView.getSettings().setCursiveFontFamily(view.getSettings().getCursiveFontFamily());
232
+ newWebView.getSettings().setFantasyFontFamily(view.getSettings().getFantasyFontFamily());
233
+ newWebView.getSettings().setMinimumFontSize(view.getSettings().getMinimumFontSize());
234
+ newWebView.getSettings().setMinimumLogicalFontSize(view.getSettings().getMinimumLogicalFontSize());
235
+ newWebView.getSettings().setDefaultFontSize(view.getSettings().getDefaultFontSize());
236
+ newWebView.getSettings().setDefaultFixedFontSize(view.getSettings().getDefaultFixedFontSize());
237
+ newWebView.getSettings().setLoadsImagesAutomatically(view.getSettings().getLoadsImagesAutomatically());
238
+ newWebView.getSettings().setBlockNetworkImage(view.getSettings().getBlockNetworkImage());
239
+ newWebView.getSettings().setJavaScriptEnabled(view.getSettings().getJavaScriptEnabled());
240
+ newWebView.getSettings().setDatabaseEnabled(view.getSettings().getDatabaseEnabled());
241
+ newWebView.getSettings().setDomStorageEnabled(view.getSettings().getDomStorageEnabled());
242
+
243
+ newWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(view.getSettings().getJavaScriptCanOpenWindowsAutomatically());
244
+ newWebView.getSettings().setDefaultTextEncodingName(view.getSettings().getDefaultTextEncodingName());
245
+ newWebView.getSettings().setUserAgentString(view.getSettings().getUserAgentString());
246
+ newWebView.getSettings().setCacheMode(view.getSettings().getCacheMode());
247
+
248
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
249
+ newWebView.getSettings().setMixedContentMode(view.getSettings().getMixedContentMode());
250
+ }
251
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
252
+ newWebView.getSettings().setSafeBrowsingEnabled(view.getSettings().getSafeBrowsingEnabled());
253
+ }
254
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
255
+ newWebView.getSettings().setForceDark(view.getSettings().getForceDark());
256
+ }
257
+
258
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
259
+ newWebView.getSettings().setDisabledActionModeMenuItems(view.getSettings().getDisabledActionModeMenuItems());
260
+ }
261
+ }
262
+
117
263
  @Override
118
264
  public boolean onConsoleMessage(ConsoleMessage message) {
119
265
  if (ReactBuildConfig.DEBUG) {
@@ -130,6 +276,19 @@ public class BPCWebChromeClient extends WebChromeClient implements LifecycleEven
130
276
  if (progressChangedFilter.isWaitingForCommandLoadUrl()) {
131
277
  return;
132
278
  }
279
+
280
+ if(isPopupWebView) {
281
+ return;
282
+ }
283
+
284
+ Log.e("BPCWebChromeClient", "" + isPopupWebView);
285
+ // if(this.mWebView == null || this.mWebView.getThemedReactContext() == null) return;
286
+ // UIManagerModule uiManager = (this.mWebView.getThemedReactContext()).getNativeModule(UIManagerModule.class);
287
+ // if (uiManager == null) {
288
+ // Log.e("BPCWebChromeClient", "UIManagerModule is null, skipping event dispatch.");
289
+ // return;
290
+ // }
291
+
133
292
  int reactTag = BPCWebViewWrapper.getReactTagFromWebView(webView);
134
293
  WritableMap event = Arguments.createMap();
135
294
  event.putDouble("target", reactTag);
@@ -139,7 +298,8 @@ public class BPCWebChromeClient extends WebChromeClient implements LifecycleEven
139
298
  event.putBoolean("canGoForward", webView.canGoForward());
140
299
  event.putDouble("progress", (float) newProgress / 100);
141
300
 
142
- UIManagerHelper.getEventDispatcherForReactTag(this.mWebView.getThemedReactContext(), reactTag).dispatchEvent(new TopLoadingProgressEvent(reactTag, event));
301
+ UIManagerHelper.getEventDispatcherForReactTag(this.mWebView.getThemedReactContext(), reactTag).dispatchEvent(new TopLoadingProgressEvent(reactTag, event));
302
+
143
303
  }
144
304
 
145
305
  @Override
@@ -1,5 +1,7 @@
1
1
  package kr.co.bootpay.webview;
2
2
 
3
+ import android.app.Dialog;
4
+
3
5
  import android.annotation.SuppressLint;
4
6
  import android.graphics.Rect;
5
7
  import android.net.Uri;
@@ -53,12 +55,28 @@ public class BPCWebView extends WebView implements LifecycleEventListener {
53
55
  String injectedJS;
54
56
  protected @Nullable
55
57
  String injectedJSBeforeContentLoaded;
56
- protected static final String JAVASCRIPT_INTERFACE = "ReactNativeWebView";
58
+
57
59
  protected @Nullable
58
60
  BPCWebViewBridge fallbackBridge;
59
61
  protected @Nullable
60
62
  WebViewCompat.WebMessageListener bridgeListener = null;
61
63
 
64
+ /** bootpay added start ***/
65
+ protected static final String JAVASCRIPT_INTERFACE = "BootpayRNWebView";
66
+
67
+ // protected static final String JAVASCRIPT_INTERFACE = "ReactNativeWebView";
68
+
69
+ Dialog dialog; //popup dialog
70
+ public void setDialog(Dialog dialog) {
71
+ this.dialog = dialog;
72
+ }
73
+
74
+ public void dissmissDialog() {
75
+ if(this.dialog != null) this.dialog.dismiss();
76
+ this.dialog = null;
77
+ }
78
+ /** bootpay added end ***/
79
+
62
80
  /**
63
81
  * android.webkit.WebChromeClient fundamentally does not support JS injection into frames other
64
82
  * than the main frame, so these two properties are mostly here just for parity with iOS & macOS.
@@ -273,6 +291,12 @@ public class BPCWebView extends WebView implements LifecycleEventListener {
273
291
  addJavascriptInterface(fallbackBridge, JAVASCRIPT_INTERFACE);
274
292
  }
275
293
  }
294
+
295
+ // if (fallbackBridge == null) {
296
+ // fallbackBridge = new BPCWebViewBridge(webView);
297
+ // addJavascriptInterface(fallbackBridge, JAVASCRIPT_INTERFACE);
298
+ // }
299
+
276
300
  injectJavascriptObject();
277
301
  }
278
302
 
@@ -36,6 +36,12 @@ import android.webkit.CookieSyncManager;
36
36
 
37
37
  import java.util.concurrent.atomic.AtomicReference;
38
38
 
39
+ import android.app.AlertDialog;
40
+ import android.content.DialogInterface;
41
+ import android.content.Intent;
42
+ import android.widget.Toast;
43
+ import android.util.Log;
44
+
39
45
  public class BPCWebViewClient extends WebViewClient {
40
46
  private static String TAG = "BPCWebViewClient";
41
47
  protected static final int SHOULD_OVERRIDE_URL_LOADING_TIMEOUT = 250;
@@ -96,6 +102,18 @@ public class BPCWebViewClient extends WebViewClient {
96
102
 
97
103
  @Override
98
104
  public boolean shouldOverrideUrlLoading(WebView view, String url) {
105
+
106
+ // Log.i("bootpay url", url);
107
+ if(BootpayUrlHelper.shouldOverrideUrlLoading(view, url)) {
108
+ return true;
109
+ }
110
+ // return false;
111
+ return shouldOverrideUrlLoadingRN(view, url);
112
+ }
113
+
114
+
115
+
116
+ public boolean shouldOverrideUrlLoadingRN(WebView view, String url) {
99
117
  final BPCWebView BPCWebView = (BPCWebView) view;
100
118
  final boolean isJsDebugging = BPCWebView.getReactApplicationContext().getJavaScriptContextHolder().get() == 0;
101
119
 
@@ -218,6 +236,36 @@ public class BPCWebViewClient extends WebViewClient {
218
236
  );
219
237
  }
220
238
 
239
+ void alertSSLError(WebView view, SslErrorHandler handler, SslError error) {
240
+ // for SSLErrorHandler
241
+ AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext());
242
+ builder.setTitle("SSL Connection Error");
243
+ builder.setMessage("Your device's Android version is outdated and may not securely connect to our service. To continue using the app securely, please update your device's operating system. If you choose to proceed without updating, it may expose you to security vulnerabilities.");
244
+ builder.setPositiveButton("Update", new DialogInterface.OnClickListener() {
245
+ @Override
246
+ public void onClick(DialogInterface dialog, int which) {
247
+ // Redirect the user to the system update settings
248
+
249
+
250
+ Intent intent = new Intent("android.settings.SYSTEM_UPDATE_SETTINGS");
251
+ if (intent.resolveActivity(view.getContext().getPackageManager()) != null) {
252
+ view.getContext().startActivity(intent);
253
+ } else {
254
+ // If the device does not support system update settings intent
255
+ Toast.makeText(view.getContext(), "System update option not available. Please check your device settings manually.", Toast.LENGTH_LONG).show();
256
+ }
257
+ }
258
+ });
259
+ builder.setNeutralButton("Cancel", new DialogInterface.OnClickListener() {
260
+ @Override
261
+ public void onClick(DialogInterface dialog, int which) {
262
+ handler.cancel();
263
+ }
264
+ });
265
+ AlertDialog dialog = builder.create();
266
+ dialog.show();
267
+ }
268
+
221
269
  @Override
222
270
  public void onReceivedError(
223
271
  WebView webView,