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.
@@ -0,0 +1,138 @@
1
+ package kr.co.bootpay.webview;
2
+
3
+ import android.content.Context;
4
+ import android.content.Intent;
5
+ import android.content.pm.PackageManager;
6
+ import android.net.Uri;
7
+ import android.webkit.WebView;
8
+ import android.util.Log;
9
+
10
+ import java.net.URISyntaxException;
11
+
12
+
13
+ public class BootpayUrlHelper {
14
+ public static boolean shouldOverrideUrlLoading(WebView view, String url) {
15
+ Intent intent = getIntentWithPackage(url);
16
+ Context context = view.getContext();
17
+
18
+ Log.i("bootpay", "doDeepLinkIfPayUrl: " + url);
19
+
20
+ if(isIntent(url)) {
21
+ Log.i("isIntent", "isInstallApp called");
22
+ if(isInstallApp(intent, context)) return startApp(intent, context);
23
+ else return startGooglePlay(intent, context);
24
+ } else if(isMarket(url)) {
25
+ if(isInstallApp(intent, context)) return startApp(intent, context);
26
+ else return startGooglePlay(intent, context);
27
+ } else if(isSpecialCase(url)) {
28
+ if(isInstallApp(intent, context)) return startApp(intent, context);
29
+ else return startGooglePlay(intent, context);
30
+ }
31
+
32
+ // return url.contains("vguardend");
33
+ return false;
34
+ }
35
+
36
+ public static Boolean isSpecialCase(String url) {
37
+ return url.matches("^shinhan\\S+$")
38
+ || url.startsWith("kftc-bankpay://")
39
+ || url.startsWith("v3mobileplusweb://")
40
+ || url.startsWith("hdcardappcardansimclick://")
41
+ || url.startsWith("nidlogin://")
42
+ || url.startsWith("mpocket.online.ansimclick://")
43
+ || url.startsWith("wooripay://")
44
+ || url.startsWith("ispmobile://")
45
+ || url.startsWith("kakaotalk://");
46
+ }
47
+
48
+ public static Boolean isIntent(String url) {
49
+ Log.d(
50
+ "bootpay",
51
+ String.format("url %s: %s.", url, url.startsWith("intent:"))
52
+ );
53
+
54
+
55
+ return url.startsWith("intent:");
56
+ }
57
+ public static Boolean isMarket(String url) {
58
+ return url.startsWith("market://");
59
+ }
60
+
61
+
62
+ public static Intent getIntentWithPackage(String url) {
63
+ try {
64
+ Intent intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
65
+ if(intent.getPackage() == null) {
66
+ if (url == null) return intent;
67
+ if (url.startsWith("shinhan-sr-ansimclick")) intent.setPackage("com.shcard.smartpay");
68
+ else if (url.startsWith("kftc-bankpay")) intent.setPackage("com.kftc.bankpay.android");
69
+ else if (url.startsWith("ispmobile")) intent.setPackage("kvp.jjy.MispAndroid320");
70
+ else if (url.startsWith("hdcardappcardansimclick")) intent.setPackage("com.hyundaicard.appcard");
71
+ else if (url.startsWith("kb-acp")) intent.setPackage("com.kbcard.kbkookmincard");
72
+ else if (url.startsWith("mpocket.online.ansimclick")) intent.setPackage("kr.co.samsungcard.mpocket");
73
+ else if (url.startsWith("lotteappcard")) intent.setPackage("com.lcacApp");
74
+ else if (url.startsWith("cloudpay")) intent.setPackage("com.hanaskcard.paycla");
75
+ else if (url.startsWith("nhappvardansimclick")) intent.setPackage("nh.smart.nhallonepay");
76
+ else if (url.startsWith("citispay")) intent.setPackage("kr.co.citibank.citimobile");
77
+ else if (url.startsWith("kakaotalk")) intent.setPackage("com.kakao.talk");
78
+ // kvp.jjy.MispAndroid320
79
+ }
80
+ return intent;
81
+ } catch (URISyntaxException e) {
82
+ e.printStackTrace();
83
+ return null;
84
+ }
85
+ }
86
+
87
+ public static boolean isInstallApp(Intent intent, Context context) {
88
+ if (intent == null) {
89
+ return false;
90
+ }
91
+ String packageName = intent.getPackage();
92
+ if (packageName == null) {
93
+ return false;
94
+ }
95
+
96
+ PackageManager packageManager = context.getPackageManager();
97
+ Intent launchIntent = packageManager.getLaunchIntentForPackage(packageName);
98
+ boolean isInstalled = launchIntent != null;
99
+ return isInstalled;
100
+ }
101
+
102
+
103
+
104
+
105
+ public static boolean startApp(Intent intent, Context context) {
106
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
107
+ context.startActivity(intent);
108
+ return true;
109
+ }
110
+
111
+ public static boolean startGooglePlay(Intent intent, Context context) {
112
+ final String appPackageName = intent.getPackage();
113
+
114
+ if(appPackageName == null) {
115
+ Uri dataUri = intent.getData();
116
+
117
+ try {
118
+ Intent addIntent = new Intent(Intent.ACTION_VIEW, intent.getData());
119
+ context.startActivity(addIntent);
120
+ } catch (Exception e) {
121
+ String packageName = "com.nhn.android.search"; //appPackageName이 비어있으면 네이버로 보내기(네이버 로그인)
122
+ if(dataUri != null && dataUri.toString().startsWith("wooripay://")) packageName = "com.wooricard.wpay"; //우리카드 예외처리
123
+
124
+ Intent addIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + packageName));
125
+ context.startActivity(addIntent);
126
+ }
127
+ return true;
128
+ }
129
+ try {
130
+ Intent addIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName));
131
+ context.startActivity(addIntent);
132
+ } catch (android.content.ActivityNotFoundException anfe) {
133
+ Intent addIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName));
134
+ context.startActivity(addIntent);
135
+ }
136
+ return true;
137
+ }
138
+ }
@@ -36,7 +36,7 @@ shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
36
36
 
37
37
  @end
38
38
 
39
- @interface RNCWeakScriptMessageDelegate : NSObject<WKScriptMessageHandler>
39
+ @interface BPCWeakScriptMessageDelegate : NSObject<WKScriptMessageHandler>
40
40
 
41
41
  @property (nonatomic, weak, nullable) id<WKScriptMessageHandler> scriptDelegate;
42
42
 
@@ -18,20 +18,20 @@
18
18
  #import "objc/runtime.h"
19
19
 
20
20
  static NSTimer *keyboardTimer;
21
- static NSString *const HistoryShimName = @"ReactNativeHistoryShim";
22
- static NSString *const MessageHandlerName = @"ReactNativeWebView";
21
+ static NSString *const HistoryShimName = @"BPReactNativeHistoryShim";
22
+ static NSString *const MessageHandlerName = @"BootpayRNWebView";
23
23
  static NSURLCredential* clientAuthenticationCredential;
24
24
  static NSDictionary* customCertificatesForHost;
25
25
 
26
- NSString *const CUSTOM_SELECTOR = @"_CUSTOM_SELECTOR_";
26
+ NSString *const BPCUSTOM_SELECTOR = @"_BPCUSTOM_SELECTOR_";
27
27
 
28
28
  #if TARGET_OS_IOS
29
29
  // runtime trick to remove WKWebView keyboard default toolbar
30
30
  // see: http://stackoverflow.com/questions/19033292/ios-7-uiwebview-keyboard-issue/19042279#19042279
31
- @interface _SwizzleHelperWK : UIView
31
+ @interface _BPSwizzleHelperWK : UIView
32
32
  @property (nonatomic, copy) WKWebView *webView;
33
33
  @end
34
- @implementation _SwizzleHelperWK
34
+ @implementation _BPSwizzleHelperWK
35
35
  -(id)inputAccessoryView
36
36
  {
37
37
  if (_webView == nil) {
@@ -48,13 +48,13 @@ NSString *const CUSTOM_SELECTOR = @"_CUSTOM_SELECTOR_";
48
48
  @end
49
49
  #endif // TARGET_OS_IOS
50
50
 
51
- @interface RNCWKWebView : WKWebView
51
+ @interface BPCWKWebView : WKWebView
52
52
  #if !TARGET_OS_OSX
53
53
  @property (nonatomic, copy) NSArray<NSDictionary *> * _Nullable menuItems;
54
54
  @property (nonatomic, copy) NSArray<NSString *> * _Nullable suppressMenuItems;
55
55
  #endif // !TARGET_OS_OSX
56
56
  @end
57
- @implementation RNCWKWebView
57
+ @implementation BPCWKWebView
58
58
  #if !TARGET_OS_OSX
59
59
  - (NSString *)stringFromAction:(SEL) action {
60
60
  NSString *sel = NSStringFromSelector(action);
@@ -121,7 +121,7 @@ UIGestureRecognizerDelegate,
121
121
  #endif // !TARGET_OS_OSX
122
122
  RCTAutoInsetsProtocol>
123
123
 
124
- @property (nonatomic, copy) RNCWKWebView *webView;
124
+ @property (nonatomic, copy) BPCWKWebView *webView;
125
125
  @property (nonatomic, strong) WKUserScript *postMessageScript;
126
126
  @property (nonatomic, strong) WKUserScript *injectedObjectJsonScript;
127
127
  @property (nonatomic, strong) WKUserScript *atStartScript;
@@ -280,7 +280,7 @@ RCTAutoInsetsProtocol>
280
280
  for(NSDictionary *menuItem in self.menuItems) {
281
281
  NSString *menuItemLabel = [RCTConvert NSString:menuItem[@"label"]];
282
282
  NSString *menuItemKey = [RCTConvert NSString:menuItem[@"key"]];
283
- NSString *sel = [NSString stringWithFormat:@"%@%@", CUSTOM_SELECTOR, menuItemKey];
283
+ NSString *sel = [NSString stringWithFormat:@"%@%@", BPCUSTOM_SELECTOR, menuItemKey];
284
284
  UIMenuItem *item = [[UIMenuItem alloc] initWithTitle: menuItemLabel
285
285
  action: NSSelectorFromString(sel)];
286
286
  [menuControllerItems addObject: item];
@@ -296,7 +296,7 @@ RCTAutoInsetsProtocol>
296
296
  for(NSDictionary *menuItem in self.menuItems) {
297
297
  NSString *menuItemLabel = [RCTConvert NSString:menuItem[@"label"]];
298
298
  NSString *menuItemKey = [RCTConvert NSString:menuItem[@"key"]];
299
- NSString *sel = [NSString stringWithFormat:@"%@%@", CUSTOM_SELECTOR, menuItemKey];
299
+ NSString *sel = [NSString stringWithFormat:@"%@%@", BPCUSTOM_SELECTOR, menuItemKey];
300
300
  UICommand *command = [UICommand commandWithTitle:menuItemLabel
301
301
  image:nil
302
302
  action:NSSelectorFromString(sel)
@@ -357,7 +357,7 @@ RCTAutoInsetsProtocol>
357
357
  - (void)forwardInvocation:(NSInvocation *)invocation
358
358
  {
359
359
  NSString *sel = NSStringFromSelector([invocation selector]);
360
- NSRange match = [sel rangeOfString:CUSTOM_SELECTOR];
360
+ NSRange match = [sel rangeOfString:BPCUSTOM_SELECTOR];
361
361
  if (match.location == 0) {
362
362
  [self tappedMenuItem:[sel substringFromIndex:17]];
363
363
  } else {
@@ -376,7 +376,7 @@ RCTAutoInsetsProtocol>
376
376
  {
377
377
  NSString *sel = NSStringFromSelector(action);
378
378
  // Do any of them have our custom keys?
379
- NSRange match = [sel rangeOfString:CUSTOM_SELECTOR];
379
+ NSRange match = [sel rangeOfString:BPCUSTOM_SELECTOR];
380
380
 
381
381
  if (match.location == 0) {
382
382
  return YES;
@@ -389,20 +389,44 @@ RCTAutoInsetsProtocol>
389
389
  */
390
390
  - (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures
391
391
  {
392
- if (!navigationAction.targetFrame.isMainFrame) {
393
- NSURL *url = navigationAction.request.URL;
394
-
395
- if (_onOpenWindow) {
396
- NSMutableDictionary<NSString *, id> *event = [self baseEvent];
397
- [event addEntriesFromDictionary: @{@"targetUrl": url.absoluteString}];
398
- _onOpenWindow(event);
399
- } else {
400
- [webView loadRequest:navigationAction.request];
392
+ if (!navigationAction.targetFrame.isMainFrame) {
393
+ NSString *url = navigationAction.request.URL.absoluteString;
394
+ if ([url containsString:@"bootpay.co.kr"]) {
395
+ // 팝업(새 창) 뜨는 경우 호출됨 (window.open 또는 target="_blank")
396
+ WKWebView *popupView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height) configuration:configuration];
397
+ [popupView autoresizingMask];
398
+ popupView.navigationDelegate = self;
399
+ popupView.UIDelegate = self;
400
+ [self addSubview:popupView];
401
+ return popupView;
402
+ } else {
403
+ if (_onOpenWindow) {
404
+ NSMutableDictionary<NSString *, id> *event = [self baseEvent];
405
+ [event addEntriesFromDictionary: @{@"targetUrl": url}];
406
+ _onOpenWindow(event);
407
+ } else {
408
+ [webView loadRequest:navigationAction.request];
409
+ }
410
+ }
401
411
  }
402
- }
412
+ // if (!navigationAction.targetFrame.isMainFrame) {
413
+ // NSURL *url = navigationAction.request.URL;
414
+ //
415
+ // if (_onOpenWindow) {
416
+ // NSMutableDictionary<NSString *, id> *event = [self baseEvent];
417
+ // [event addEntriesFromDictionary: @{@"targetUrl": url.absoluteString}];
418
+ // _onOpenWindow(event);
419
+ // } else {
420
+ // [webView loadRequest:navigationAction.request];
421
+ // }
422
+ // }
403
423
  return nil;
404
424
  }
405
425
 
426
+ - (void)webViewDidClose:(WKWebView *)webView {
427
+ [webView removeFromSuperview];
428
+ }
429
+
406
430
  /**
407
431
  * Enables file input on macos, see https://developer.apple.com/documentation/webkit/wkuidelegate/1641952-webview
408
432
  */
@@ -488,7 +512,7 @@ RCTAutoInsetsProtocol>
488
512
  #endif
489
513
 
490
514
  // Shim the HTML5 history API:
491
- [wkWebViewConfig.userContentController addScriptMessageHandler:[[RNCWeakScriptMessageDelegate alloc] initWithDelegate:self]
515
+ [wkWebViewConfig.userContentController addScriptMessageHandler:[[BPCWeakScriptMessageDelegate alloc] initWithDelegate:self]
492
516
  name:HistoryShimName];
493
517
  [self resetupScripts:wkWebViewConfig];
494
518
 
@@ -516,7 +540,7 @@ RCTAutoInsetsProtocol>
516
540
  {
517
541
  if (self.window != nil && _webView == nil) {
518
542
  WKWebViewConfiguration *wkWebViewConfig = [self setUpWkWebViewConfig];
519
- _webView = [[RNCWKWebView alloc] initWithFrame:self.bounds configuration: wkWebViewConfig];
543
+ _webView = [[BPCWKWebView alloc] initWithFrame:self.bounds configuration: wkWebViewConfig];
520
544
  [self setBackgroundColor: _savedBackgroundColor];
521
545
  #if !TARGET_OS_OSX
522
546
  _webView.menuItems = _menuItems;
@@ -979,7 +1003,7 @@ RCTAutoInsetsProtocol>
979
1003
 
980
1004
  if(subview == nil) return;
981
1005
 
982
- NSString* name = [NSString stringWithFormat:@"%@_SwizzleHelperWK", subview.class.superclass];
1006
+ NSString* name = [NSString stringWithFormat:@"%@_BPSwizzleHelperWK", subview.class.superclass];
983
1007
  Class newClass = NSClassFromString(name);
984
1008
 
985
1009
  if(newClass == nil)
@@ -987,7 +1011,7 @@ RCTAutoInsetsProtocol>
987
1011
  newClass = objc_allocateClassPair(subview.class, [name cStringUsingEncoding:NSASCIIStringEncoding], 0);
988
1012
  if(!newClass) return;
989
1013
 
990
- Method method = class_getInstanceMethod([_SwizzleHelperWK class], @selector(inputAccessoryView));
1014
+ Method method = class_getInstanceMethod([_BPSwizzleHelperWK class], @selector(inputAccessoryView));
991
1015
  class_addMethod(newClass, @selector(inputAccessoryView), method_getImplementation(method), method_getTypeEncoding(method));
992
1016
 
993
1017
  objc_registerClassPair(newClass);
@@ -1001,7 +1025,7 @@ RCTAutoInsetsProtocol>
1001
1025
  UIView* subview;
1002
1026
 
1003
1027
  for (UIView* view in _webView.scrollView.subviews) {
1004
- if([[view.class description] hasSuffix:@"_SwizzleHelperWK"])
1028
+ if([[view.class description] hasSuffix:@"_BPSwizzleHelperWK"])
1005
1029
  subview = view;
1006
1030
  }
1007
1031
 
@@ -1306,6 +1330,25 @@ RCTAutoInsetsProtocol>
1306
1330
  - (void) webView:(WKWebView *)webView
1307
1331
  decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction
1308
1332
  decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
1333
+ {
1334
+ NSString *url = navigationAction.request.URL.absoluteString;
1335
+
1336
+ if([self isItunesURL:url]) {
1337
+ [self startAppToApp:[NSURL URLWithString:url]];
1338
+ decisionHandler(WKNavigationActionPolicyCancel);
1339
+ } else if([url hasPrefix:@"about:blank"]) {
1340
+ decisionHandler(WKNavigationActionPolicyAllow);
1341
+ } else if(![url hasPrefix:@"http"]) {
1342
+ [self startAppToApp:[NSURL URLWithString:url]];
1343
+ decisionHandler(WKNavigationActionPolicyCancel);
1344
+ } else {
1345
+ [self webViewRN:webView decidePolicyForNavigationAction:navigationAction decisionHandler:decisionHandler];
1346
+ }
1347
+ }
1348
+
1349
+ - (void) webViewRN:(WKWebView *)webView
1350
+ decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction
1351
+ decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
1309
1352
  {
1310
1353
  static NSDictionary<NSNumber *, NSString *> *navigationTypes;
1311
1354
  static dispatch_once_t onceToken;
@@ -1811,7 +1854,7 @@ didFinishNavigation:(WKNavigation *)navigation
1811
1854
  [wkWebViewConfig.userContentController removeScriptMessageHandlerForName:MessageHandlerName];
1812
1855
  if(self.enableApplePay){
1813
1856
  if (self.postMessageScript){
1814
- [wkWebViewConfig.userContentController addScriptMessageHandler:[[RNCWeakScriptMessageDelegate alloc] initWithDelegate:self]
1857
+ [wkWebViewConfig.userContentController addScriptMessageHandler:[[BPCWeakScriptMessageDelegate alloc] initWithDelegate:self]
1815
1858
  name:MessageHandlerName];
1816
1859
  }
1817
1860
  return;
@@ -1902,7 +1945,7 @@ didFinishNavigation:(WKNavigation *)navigation
1902
1945
 
1903
1946
  if(_messagingEnabled){
1904
1947
  if (self.postMessageScript){
1905
- [wkWebViewConfig.userContentController addScriptMessageHandler:[[RNCWeakScriptMessageDelegate alloc] initWithDelegate:self]
1948
+ [wkWebViewConfig.userContentController addScriptMessageHandler:[[BPCWeakScriptMessageDelegate alloc] initWithDelegate:self]
1906
1949
  name:MessageHandlerName];
1907
1950
  [wkWebViewConfig.userContentController addUserScript:self.postMessageScript];
1908
1951
  }
@@ -1939,9 +1982,140 @@ didFinishNavigation:(WKNavigation *)navigation
1939
1982
  return request;
1940
1983
  }
1941
1984
 
1985
+ #pragma mark - WebView Javascript
1986
+
1987
+ -(void) doJavascript:(NSString*) script {
1988
+ [_webView evaluateJavaScript:script completionHandler:nil];
1989
+ }
1990
+
1991
+ - (void) loadUrl:(NSString*) urlString {
1992
+ NSURL *url = [NSURL URLWithString:urlString];
1993
+ NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
1994
+ [_webView loadRequest:request];
1995
+ }
1996
+
1997
+ - (void) naverLoginBugFix {
1998
+ // if([_beforeUrl hasPrefix:@"naversearchthirdlogin://"]) {
1999
+ // NSString* value = [self getQueryStringParameter:_beforeUrl :@"session"];
2000
+ // if(value != nil && [value length] > 0) {
2001
+ // NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://nid.naver.com/login/scheme.redirect?session=%@", value]];
2002
+ // NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
2003
+ // [_webView loadRequest:request];
2004
+ // }
2005
+ // }
2006
+ }
2007
+
2008
+ - (NSString*) getQueryStringParameter:(NSString*)url :(NSString*)param {
2009
+ NSMutableDictionary *queryStringDictionary = [[NSMutableDictionary alloc] init];
2010
+ NSArray *urlComponents = [url componentsSeparatedByString:@"&"];
2011
+
2012
+ for (NSString *keyValuePair in urlComponents)
2013
+ {
2014
+ NSArray *pairComponents = [keyValuePair componentsSeparatedByString:@"="];
2015
+ NSString *key = [[pairComponents firstObject] stringByRemovingPercentEncoding];
2016
+ NSString *value = [[pairComponents lastObject] stringByRemovingPercentEncoding];
2017
+
2018
+ if([param isEqualToString:key]) {
2019
+ return value;
2020
+ }
2021
+ }
2022
+
2023
+ return @"";
2024
+ }
2025
+
2026
+ - (void) startAppToApp:(NSURL*) url {
2027
+ UIApplication *application = [UIApplication sharedApplication];
2028
+
2029
+ if (@available(iOS 10.0, *)) {
2030
+ [application openURL:url options:@{} completionHandler: ^(BOOL success) {
2031
+ if(success == false) {
2032
+ [self startItunesToInstall:url];
2033
+ }
2034
+ }];
2035
+ } else {
2036
+ [application openURL:url];
2037
+ }
2038
+ }
2039
+
2040
+
2041
+ - (void) startItunesToInstall:(NSURL*) url {
2042
+ NSString *sUrl = url.absoluteString;
2043
+ NSString *itunesUrl = @"";
2044
+
2045
+ if([sUrl hasPrefix: @"kfc-bankpay"]) {
2046
+ itunesUrl = @"https://apps.apple.com/kr/app/%EB%B1%85%ED%81%AC%ED%8E%98%EC%9D%B4-%EA%B8%88%EC%9C%B5%EA%B8%B0%EA%B4%80-%EA%B3%B5%EB%8F%99-%EA%B3%84%EC%A2%8C%EC%9D%B4%EC%B2%B4-%EA%B2%B0%EC%A0%9C-%EC%A0%9C%EB%A1%9C%ED%8E%98%EC%9D%B4/id398456030";
2047
+ } else if([sUrl hasPrefix: @"ispmobile"]) {
2048
+ itunesUrl = @"https://apps.apple.com/kr/app/isp/id369125087";
2049
+ } else if([sUrl hasPrefix: @"hdcardappcardansimclick"] || [sUrl hasPrefix: @"smhyundaiansimclick"]) {
2050
+ itunesUrl = @"https://apps.apple.com/kr/app/%ED%98%84%EB%8C%80%EC%B9%B4%EB%93%9C/id702653088";
2051
+ } else if([sUrl hasPrefix: @"shinhan-sr-ansimclick"] || [sUrl hasPrefix: @"smshinhanansimclick"]) {
2052
+ itunesUrl = @"https://apps.apple.com/kr/app/%EC%8B%A0%ED%95%9C%ED%8E%98%EC%9D%B4%ED%8C%90/id572462317";
2053
+ } else if([sUrl hasPrefix: @"kb-acp"]) {
2054
+ itunesUrl = @"https://apps.apple.com/kr/app/kb-pay/id695436326";
2055
+ } else if([sUrl hasPrefix: @"liivbank"]) {
2056
+ itunesUrl = @"https://apps.apple.com/kr/app/%EB%A6%AC%EB%B8%8C/id1126232922";
2057
+ } else if([sUrl hasPrefix: @"mpocket.online.ansimclick"] || [sUrl hasPrefix: @"ansimclickscard"] || [sUrl hasPrefix: @"ansimclickipcollect"] || [sUrl hasPrefix: @"samsungpay"] || [sUrl hasPrefix: @"scardcertiapp"]) {
2058
+ itunesUrl = @"https://apps.apple.com/kr/app/%EC%82%BC%EC%84%B1%EC%B9%B4%EB%93%9C/id535125356";
2059
+ } else if([sUrl hasPrefix: @"lottesmartpay"]) {
2060
+ itunesUrl = @"https://apps.apple.com/us/app/%EB%A1%AF%EB%8D%B0%EC%B9%B4%EB%93%9C-%EC%95%B1%EC%B9%B4%EB%93%9C/id688047200";
2061
+ } else if([sUrl hasPrefix: @"lotteappcard"]) {
2062
+ itunesUrl = @"https://apps.apple.com/kr/app/%EB%94%94%EC%A7%80%EB%A1%9C%EC%B9%B4-%EB%A1%AF%EB%8D%B0%EC%B9%B4%EB%93%9C/id688047200";
2063
+ } else if([sUrl hasPrefix: @"newsmartpib"]) {
2064
+ itunesUrl = @"https://apps.apple.com/kr/app/%EC%9A%B0%EB%A6%AC-won-%EB%B1%85%ED%82%B9/id1470181651";
2065
+ } else if([sUrl hasPrefix: @"com.wooricard.wcard"]) {
2066
+ itunesUrl = @"https://apps.apple.com/kr/app/%EC%9A%B0%EB%A6%ACwon%EC%B9%B4%EB%93%9C/id1499598869";
2067
+ } else if([sUrl hasPrefix: @"citispay"] || [sUrl hasPrefix: @"citicardappkr"] || [sUrl hasPrefix: @"citimobileapp"]) {
2068
+ itunesUrl = @"https://apps.apple.com/kr/app/%EC%94%A8%ED%8B%B0%EB%AA%A8%EB%B0%94%EC%9D%BC/id1179759666";
2069
+ } else if([sUrl hasPrefix: @"shinsegaeeasypayment"]) {
2070
+ itunesUrl = @"https://apps.apple.com/kr/app/ssgpay/id666237916";
2071
+ } else if([sUrl hasPrefix: @"cloudpay"]) {
2072
+ itunesUrl = @"https://apps.apple.com/kr/app/%ED%95%98%EB%82%98%EC%B9%B4%EB%93%9C-%EC%9B%90%ED%81%90%ED%8E%98%EC%9D%B4/id847268987";
2073
+ } else if([sUrl hasPrefix: @"hanawalletmembers"]) {
2074
+ itunesUrl = @"https://apps.apple.com/kr/app/n-wallet/id492190784";
2075
+ } else if([sUrl hasPrefix: @"nhappvardansimclick"]) {
2076
+ itunesUrl = @"https://apps.apple.com/kr/app/%EC%98%AC%EC%9B%90%ED%8E%98%EC%9D%B4-nh%EC%95%B1%EC%B9%B4%EB%93%9C/id1177889176";
2077
+ } else if([sUrl hasPrefix: @"nhallonepayansimclick"] || [sUrl hasPrefix: @"nhappcardansimclick"] || [sUrl hasPrefix: @"nhallonepayansimclick"] || [sUrl hasPrefix: @"nonghyupcardansimclick"]) {
2078
+ itunesUrl = @"https://apps.apple.com/kr/app/%EC%98%AC%EC%9B%90%ED%8E%98%EC%9D%B4-nh%EC%95%B1%EC%B9%B4%EB%93%9C/id1177889176";
2079
+ } else if([sUrl hasPrefix: @"payco"]) {
2080
+ itunesUrl = @"https://apps.apple.com/kr/app/payco/id924292102";
2081
+ } else if([sUrl hasPrefix: @"lpayapp"] || [sUrl hasPrefix: @"lmslpay"]) {
2082
+ itunesUrl = @"https://apps.apple.com/kr/app/l-point-with-l-pay/id473250588";
2083
+ } else if([sUrl hasPrefix: @"naversearchapp"]) {
2084
+ itunesUrl = @"https://apps.apple.com/kr/app/%EB%84%A4%EC%9D%B4%EB%B2%84-naver/id393499958";
2085
+ } else if([sUrl hasPrefix: @"tauthlink"]) {
2086
+ itunesUrl = @"https://apps.apple.com/kr/app/pass-by-skt/id1141258007";
2087
+ } else if([sUrl hasPrefix: @"uplusauth"] || [sUrl hasPrefix: @"upluscorporation"] ) {
2088
+ itunesUrl = @"https://apps.apple.com/kr/app/pass-by-u/id1147394645";
2089
+ } else if([sUrl hasPrefix: @"ktauthexternalcall"]) {
2090
+ itunesUrl = @"https://apps.apple.com/kr/app/pass-by-kt/id1134371550";
2091
+ } else if([sUrl hasPrefix: @"supertoss"]) {
2092
+ itunesUrl = @"https://apps.apple.com/kr/app/%ED%86%A0%EC%8A%A4/id839333328";
2093
+ } else if([sUrl hasPrefix: @"kakaotalk"]) {
2094
+ itunesUrl = @"https://apps.apple.com/kr/app/kakaotalk/id362057947";
2095
+ } else if([sUrl hasPrefix: @"chaipayment"]) {
2096
+ itunesUrl = @"https://apps.apple.com/kr/app/%EC%B0%A8%EC%9D%B4/id1459979272";
2097
+ } else if([sUrl hasPrefix: @"ukbanksmartbanknonloginpay"]) {
2098
+ itunesUrl = @"https://itunes.apple.com/kr/developer/%EC%BC%80%EC%9D%B4%EB%B1%85%ED%81%AC/id1178872626?mt=8";
2099
+ } else if([sUrl hasPrefix: @"newliiv"]) {
2100
+ itunesUrl = @"https://apps.apple.com/us/app/%EB%A6%AC%EB%B8%8C-next/id1573528126";
2101
+ } else if([sUrl hasPrefix: @"kbbank"]) {
2102
+ itunesUrl = @"https://apps.apple.com/kr/app/kb%EC%8A%A4%ED%83%80%EB%B1%85%ED%82%B9/id373742138";
2103
+ }
2104
+
2105
+ if(itunesUrl.length > 0) {
2106
+ NSURL *appstore = [NSURL URLWithString: itunesUrl];
2107
+ [self startAppToApp: appstore];
2108
+ }
2109
+ }
2110
+
2111
+ - (BOOL) isItunesURL:(NSString*) urlString {
2112
+ NSRange match = [urlString rangeOfString: @"itunes.apple.com"];
2113
+ return match.location != NSNotFound;
2114
+ }
2115
+
1942
2116
  @end
1943
2117
 
1944
- @implementation RNCWeakScriptMessageDelegate
2118
+ @implementation BPCWeakScriptMessageDelegate
1945
2119
 
1946
2120
  - (instancetype)initWithDelegate:(id<WKScriptMessageHandler>)scriptDelegate {
1947
2121
  self = [super init];
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>SchemeUserState</key>
6
+ <dict>
7
+ <key>RNCWebView.xcscheme_^#shared#^_</key>
8
+ <dict>
9
+ <key>orderHint</key>
10
+ <integer>0</integer>
11
+ </dict>
12
+ </dict>
13
+ </dict>
14
+ </plist>
@@ -1 +1 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _BatchedBridge=_interopRequireDefault(require("react-native/Libraries/BatchedBridge/BatchedBridge"));var _EventEmitter=_interopRequireDefault(require("react-native/Libraries/vendor/emitter/EventEmitter"));var _invariant=_interopRequireDefault(require("invariant"));var _BPCWebViewNativeComponent=_interopRequireWildcard(require("./BPCWebViewNativeComponent"));var _NativeBPCWebViewModule=_interopRequireDefault(require("./NativeBPCWebViewModule"));var _WebViewShared=require("./WebViewShared");var _WebView=_interopRequireDefault(require("./WebView.styles"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["overScrollMode","javaScriptEnabled","thirdPartyCookiesEnabled","scalesPageToFit","allowsFullscreenVideo","allowFileAccess","saveFormDataDisabled","cacheEnabled","androidLayerType","originWhitelist","setSupportMultipleWindows","setBuiltInZoomControls","setDisplayZoomControls","nestedScrollEnabled","startInLoadingState","onNavigationStateChange","onLoadStart","onError","onLoad","onLoadEnd","onLoadProgress","onHttpError","onRenderProcessGone","onMessage","onOpenWindow","renderLoading","renderError","style","containerStyle","source","nativeConfig","onShouldStartLoadWithRequest","injectedJavaScriptObject"],_excluded2=["messagingModuleName"],_excluded3=["messagingModuleName"];var _require$registerCall,_this=this,_jsxFileName="/Users/taesupyoon/bootpay/client/react-native/react-native-webview-250313/src/WebView.android.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var resolveAssetSource=_reactNative.Image.resolveAssetSource;var directEventEmitter=new _EventEmitter.default();var registerCallableModule=(_require$registerCall=require('react-native').registerCallableModule)!=null?_require$registerCall:_BatchedBridge.default.registerCallableModule.bind(_BatchedBridge.default);registerCallableModule('BPCWebViewMessagingModule',{onShouldStartLoadWithRequest:function onShouldStartLoadWithRequest(event){directEventEmitter.emit('onShouldStartLoadWithRequest',event);},onMessage:function onMessage(event){directEventEmitter.emit('onMessage',event);}});var uniqueRef=0;var WebViewComponent=(0,_react.forwardRef)(function(_ref,ref){var _ref$overScrollMode=_ref.overScrollMode,overScrollMode=_ref$overScrollMode===void 0?'always':_ref$overScrollMode,_ref$javaScriptEnable=_ref.javaScriptEnabled,javaScriptEnabled=_ref$javaScriptEnable===void 0?true:_ref$javaScriptEnable,_ref$thirdPartyCookie=_ref.thirdPartyCookiesEnabled,thirdPartyCookiesEnabled=_ref$thirdPartyCookie===void 0?true:_ref$thirdPartyCookie,_ref$scalesPageToFit=_ref.scalesPageToFit,scalesPageToFit=_ref$scalesPageToFit===void 0?true:_ref$scalesPageToFit,_ref$allowsFullscreen=_ref.allowsFullscreenVideo,allowsFullscreenVideo=_ref$allowsFullscreen===void 0?false:_ref$allowsFullscreen,_ref$allowFileAccess=_ref.allowFileAccess,allowFileAccess=_ref$allowFileAccess===void 0?false:_ref$allowFileAccess,_ref$saveFormDataDisa=_ref.saveFormDataDisabled,saveFormDataDisabled=_ref$saveFormDataDisa===void 0?false:_ref$saveFormDataDisa,_ref$cacheEnabled=_ref.cacheEnabled,cacheEnabled=_ref$cacheEnabled===void 0?true:_ref$cacheEnabled,_ref$androidLayerType=_ref.androidLayerType,androidLayerType=_ref$androidLayerType===void 0?'none':_ref$androidLayerType,_ref$originWhitelist=_ref.originWhitelist,originWhitelist=_ref$originWhitelist===void 0?_WebViewShared.defaultOriginWhitelist:_ref$originWhitelist,_ref$setSupportMultip=_ref.setSupportMultipleWindows,setSupportMultipleWindows=_ref$setSupportMultip===void 0?true:_ref$setSupportMultip,_ref$setBuiltInZoomCo=_ref.setBuiltInZoomControls,setBuiltInZoomControls=_ref$setBuiltInZoomCo===void 0?true:_ref$setBuiltInZoomCo,_ref$setDisplayZoomCo=_ref.setDisplayZoomControls,setDisplayZoomControls=_ref$setDisplayZoomCo===void 0?false:_ref$setDisplayZoomCo,_ref$nestedScrollEnab=_ref.nestedScrollEnabled,nestedScrollEnabled=_ref$nestedScrollEnab===void 0?false:_ref$nestedScrollEnab,startInLoadingState=_ref.startInLoadingState,onNavigationStateChange=_ref.onNavigationStateChange,onLoadStart=_ref.onLoadStart,onError=_ref.onError,onLoad=_ref.onLoad,onLoadEnd=_ref.onLoadEnd,onLoadProgress=_ref.onLoadProgress,onHttpErrorProp=_ref.onHttpError,onRenderProcessGoneProp=_ref.onRenderProcessGone,onMessageProp=_ref.onMessage,onOpenWindowProp=_ref.onOpenWindow,renderLoading=_ref.renderLoading,renderError=_ref.renderError,style=_ref.style,containerStyle=_ref.containerStyle,source=_ref.source,nativeConfig=_ref.nativeConfig,onShouldStartLoadWithRequestProp=_ref.onShouldStartLoadWithRequest,injectedJavaScriptObject=_ref.injectedJavaScriptObject,otherProps=(0,_objectWithoutProperties2.default)(_ref,_excluded);var messagingModuleName=(0,_react.useRef)(`WebViewMessageHandler${uniqueRef+=1}`).current;var webViewRef=(0,_react.useRef)(null);var onShouldStartLoadWithRequestCallback=(0,_react.useCallback)(function(shouldStart,url,lockIdentifier){if(lockIdentifier){_NativeBPCWebViewModule.default.shouldStartLoadWithLockIdentifier(shouldStart,lockIdentifier);}else if(shouldStart&&webViewRef.current){_BPCWebViewNativeComponent.Commands.loadUrl(webViewRef.current,url);}},[]);var _useWebViewLogic=(0,_WebViewShared.useWebViewLogic)({onNavigationStateChange:onNavigationStateChange,onLoad:onLoad,onError:onError,onHttpErrorProp:onHttpErrorProp,onLoadEnd:onLoadEnd,onLoadProgress:onLoadProgress,onLoadStart:onLoadStart,onRenderProcessGoneProp:onRenderProcessGoneProp,onMessageProp:onMessageProp,onOpenWindowProp:onOpenWindowProp,startInLoadingState:startInLoadingState,originWhitelist:originWhitelist,onShouldStartLoadWithRequestProp:onShouldStartLoadWithRequestProp,onShouldStartLoadWithRequestCallback:onShouldStartLoadWithRequestCallback}),onLoadingStart=_useWebViewLogic.onLoadingStart,onShouldStartLoadWithRequest=_useWebViewLogic.onShouldStartLoadWithRequest,onMessage=_useWebViewLogic.onMessage,viewState=_useWebViewLogic.viewState,setViewState=_useWebViewLogic.setViewState,lastErrorEvent=_useWebViewLogic.lastErrorEvent,onHttpError=_useWebViewLogic.onHttpError,onLoadingError=_useWebViewLogic.onLoadingError,onLoadingFinish=_useWebViewLogic.onLoadingFinish,onLoadingProgress=_useWebViewLogic.onLoadingProgress,onOpenWindow=_useWebViewLogic.onOpenWindow,onRenderProcessGone=_useWebViewLogic.onRenderProcessGone;(0,_react.useImperativeHandle)(ref,function(){return{goForward:function goForward(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.goForward(webViewRef.current);},goBack:function goBack(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.goBack(webViewRef.current);},reload:function reload(){setViewState('LOADING');if(webViewRef.current){_BPCWebViewNativeComponent.Commands.reload(webViewRef.current);}},stopLoading:function stopLoading(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.stopLoading(webViewRef.current);},postMessage:function postMessage(data){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.postMessage(webViewRef.current,data);},injectJavaScript:function injectJavaScript(data){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.injectJavaScript(webViewRef.current,data);},requestFocus:function requestFocus(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.requestFocus(webViewRef.current);},clearFormData:function clearFormData(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.clearFormData(webViewRef.current);},clearCache:function clearCache(includeDiskFiles){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.clearCache(webViewRef.current,includeDiskFiles);},clearHistory:function clearHistory(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.clearHistory(webViewRef.current);}};},[setViewState,webViewRef]);(0,_react.useEffect)(function(){var onShouldStartLoadWithRequestSubscription=directEventEmitter.addListener('onShouldStartLoadWithRequest',function(event){if(event.messagingModuleName===messagingModuleName){var _=event.messagingModuleName,rest=(0,_objectWithoutProperties2.default)(event,_excluded2);onShouldStartLoadWithRequest(rest);}});var onMessageSubscription=directEventEmitter.addListener('onMessage',function(event){if(event.messagingModuleName===messagingModuleName){var _=event.messagingModuleName,rest=(0,_objectWithoutProperties2.default)(event,_excluded3);onMessage(rest);}});return function(){onShouldStartLoadWithRequestSubscription.remove();onMessageSubscription.remove();};},[messagingModuleName,onMessage,onShouldStartLoadWithRequest]);var otherView;if(viewState==='LOADING'){otherView=(renderLoading||_WebViewShared.defaultRenderLoading)();}else if(viewState==='ERROR'){(0,_invariant.default)(lastErrorEvent!=null,'lastErrorEvent expected to be non-null');if(lastErrorEvent){otherView=(renderError||_WebViewShared.defaultRenderError)(lastErrorEvent.domain,lastErrorEvent.code,lastErrorEvent.description);}}else if(viewState!=='IDLE'){console.error(`BPCWebView invalid state encountered: ${viewState}`);}var webViewStyles=[_WebView.default.container,_WebView.default.webView,style];var webViewContainerStyle=[_WebView.default.container,containerStyle];if(typeof source!=='number'&&source&&'method'in source){if(source.method==='POST'&&source.headers){console.warn('WebView: `source.headers` is not supported when using POST.');}else if(source.method==='GET'&&source.body){console.warn('WebView: `source.body` is not supported when using GET.');}}var NativeWebView=(nativeConfig==null?void 0:nativeConfig.component)||_BPCWebViewNativeComponent.default;var sourceResolved=resolveAssetSource(source);var newSource=typeof sourceResolved==='object'?Object.entries(sourceResolved).reduce(function(prev,_ref2){var _ref3=(0,_slicedToArray2.default)(_ref2,2),currKey=_ref3[0],currValue=_ref3[1];return Object.assign({},prev,(0,_defineProperty2.default)({},currKey,currKey==='headers'&&currValue&&typeof currValue==='object'?Object.entries(currValue).map(function(_ref4){var _ref5=(0,_slicedToArray2.default)(_ref4,2),key=_ref5[0],value=_ref5[1];return{name:key,value:value};}):currValue));},{}):sourceResolved;var webView=(0,_jsxRuntime.jsx)(NativeWebView,Object.assign({},otherProps,{messagingEnabled:typeof onMessageProp==='function',messagingModuleName:messagingModuleName,hasOnScroll:!!otherProps.onScroll,onLoadingError:onLoadingError,onLoadingFinish:onLoadingFinish,onLoadingProgress:onLoadingProgress,onLoadingStart:onLoadingStart,onHttpError:onHttpError,onRenderProcessGone:onRenderProcessGone,onMessage:onMessage,onOpenWindow:onOpenWindow,hasOnOpenWindowEvent:onOpenWindowProp!==undefined,onShouldStartLoadWithRequest:onShouldStartLoadWithRequest,ref:webViewRef,source:sourceResolved,newSource:newSource,style:webViewStyles,overScrollMode:overScrollMode,javaScriptEnabled:javaScriptEnabled,thirdPartyCookiesEnabled:thirdPartyCookiesEnabled,scalesPageToFit:scalesPageToFit,allowsFullscreenVideo:allowsFullscreenVideo,allowFileAccess:allowFileAccess,saveFormDataDisabled:saveFormDataDisabled,cacheEnabled:cacheEnabled,androidLayerType:androidLayerType,setSupportMultipleWindows:setSupportMultipleWindows,setBuiltInZoomControls:setBuiltInZoomControls,setDisplayZoomControls:setDisplayZoomControls,nestedScrollEnabled:nestedScrollEnabled,injectedJavaScriptObject:JSON.stringify(injectedJavaScriptObject)},nativeConfig==null?void 0:nativeConfig.props),"webViewKey");return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:webViewContainerStyle,children:[webView,otherView]});});var isFileUploadSupported=_NativeBPCWebViewModule.default.isFileUploadSupported;var WebView=Object.assign(WebViewComponent,{isFileUploadSupported:isFileUploadSupported});var _default=exports.default=WebView;
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _BatchedBridge=_interopRequireDefault(require("react-native/Libraries/BatchedBridge/BatchedBridge"));var _EventEmitter=_interopRequireDefault(require("react-native/Libraries/vendor/emitter/EventEmitter"));var _invariant=_interopRequireDefault(require("invariant"));var _BPCWebViewNativeComponent=_interopRequireWildcard(require("./BPCWebViewNativeComponent"));var _NativeBPCWebViewModule=_interopRequireDefault(require("./NativeBPCWebViewModule"));var _WebViewShared=require("./WebViewShared");var _WebView=_interopRequireDefault(require("./WebView.styles"));var _jsxRuntime=require("react/jsx-runtime");var _excluded=["overScrollMode","javaScriptEnabled","thirdPartyCookiesEnabled","scalesPageToFit","allowsFullscreenVideo","allowFileAccess","saveFormDataDisabled","cacheEnabled","androidLayerType","originWhitelist","setSupportMultipleWindows","setBuiltInZoomControls","setDisplayZoomControls","nestedScrollEnabled","startInLoadingState","onNavigationStateChange","onLoadStart","onError","onLoad","onLoadEnd","onLoadProgress","onHttpError","onRenderProcessGone","onMessage","onOpenWindow","renderLoading","renderError","style","containerStyle","source","nativeConfig","onShouldStartLoadWithRequest","injectedJavaScriptObject"],_excluded2=["messagingModuleName"],_excluded3=["messagingModuleName"];var _require$registerCall,_this=this,_jsxFileName="/Users/taesupyoon/bootpay/client/react-native/react-native-webview-250312/src/WebView.android.tsx";function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap(),t=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(e){return e?t:r;})(e);}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache(r);if(t&&t.has(e))return t.get(e);var n={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var i=a?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(n,u,i):n[u]=e[u];}return n.default=e,t&&t.set(e,n),n;}var resolveAssetSource=_reactNative.Image.resolveAssetSource;var directEventEmitter=new _EventEmitter.default();var registerCallableModule=(_require$registerCall=require('react-native').registerCallableModule)!=null?_require$registerCall:_BatchedBridge.default.registerCallableModule.bind(_BatchedBridge.default);registerCallableModule('BPCWebViewMessagingModule',{onShouldStartLoadWithRequest:function onShouldStartLoadWithRequest(event){directEventEmitter.emit('onShouldStartLoadWithRequest',event);},onMessage:function onMessage(event){directEventEmitter.emit('onMessage',event);}});var uniqueRef=0;var WebViewComponent=(0,_react.forwardRef)(function(_ref,ref){var _ref$overScrollMode=_ref.overScrollMode,overScrollMode=_ref$overScrollMode===void 0?'always':_ref$overScrollMode,_ref$javaScriptEnable=_ref.javaScriptEnabled,javaScriptEnabled=_ref$javaScriptEnable===void 0?true:_ref$javaScriptEnable,_ref$thirdPartyCookie=_ref.thirdPartyCookiesEnabled,thirdPartyCookiesEnabled=_ref$thirdPartyCookie===void 0?true:_ref$thirdPartyCookie,_ref$scalesPageToFit=_ref.scalesPageToFit,scalesPageToFit=_ref$scalesPageToFit===void 0?true:_ref$scalesPageToFit,_ref$allowsFullscreen=_ref.allowsFullscreenVideo,allowsFullscreenVideo=_ref$allowsFullscreen===void 0?false:_ref$allowsFullscreen,_ref$allowFileAccess=_ref.allowFileAccess,allowFileAccess=_ref$allowFileAccess===void 0?false:_ref$allowFileAccess,_ref$saveFormDataDisa=_ref.saveFormDataDisabled,saveFormDataDisabled=_ref$saveFormDataDisa===void 0?false:_ref$saveFormDataDisa,_ref$cacheEnabled=_ref.cacheEnabled,cacheEnabled=_ref$cacheEnabled===void 0?true:_ref$cacheEnabled,_ref$androidLayerType=_ref.androidLayerType,androidLayerType=_ref$androidLayerType===void 0?'none':_ref$androidLayerType,_ref$originWhitelist=_ref.originWhitelist,originWhitelist=_ref$originWhitelist===void 0?_WebViewShared.defaultOriginWhitelist:_ref$originWhitelist,_ref$setSupportMultip=_ref.setSupportMultipleWindows,setSupportMultipleWindows=_ref$setSupportMultip===void 0?true:_ref$setSupportMultip,_ref$setBuiltInZoomCo=_ref.setBuiltInZoomControls,setBuiltInZoomControls=_ref$setBuiltInZoomCo===void 0?true:_ref$setBuiltInZoomCo,_ref$setDisplayZoomCo=_ref.setDisplayZoomControls,setDisplayZoomControls=_ref$setDisplayZoomCo===void 0?false:_ref$setDisplayZoomCo,_ref$nestedScrollEnab=_ref.nestedScrollEnabled,nestedScrollEnabled=_ref$nestedScrollEnab===void 0?false:_ref$nestedScrollEnab,startInLoadingState=_ref.startInLoadingState,onNavigationStateChange=_ref.onNavigationStateChange,onLoadStart=_ref.onLoadStart,onError=_ref.onError,onLoad=_ref.onLoad,onLoadEnd=_ref.onLoadEnd,onLoadProgress=_ref.onLoadProgress,onHttpErrorProp=_ref.onHttpError,onRenderProcessGoneProp=_ref.onRenderProcessGone,onMessageProp=_ref.onMessage,onOpenWindowProp=_ref.onOpenWindow,renderLoading=_ref.renderLoading,renderError=_ref.renderError,style=_ref.style,containerStyle=_ref.containerStyle,source=_ref.source,nativeConfig=_ref.nativeConfig,onShouldStartLoadWithRequestProp=_ref.onShouldStartLoadWithRequest,injectedJavaScriptObject=_ref.injectedJavaScriptObject,otherProps=(0,_objectWithoutProperties2.default)(_ref,_excluded);var messagingModuleName=(0,_react.useRef)(`WebViewMessageHandler${uniqueRef+=1}`).current;var webViewRef=(0,_react.useRef)(null);var onShouldStartLoadWithRequestCallback=(0,_react.useCallback)(function(shouldStart,url,lockIdentifier){if(lockIdentifier){_NativeBPCWebViewModule.default.shouldStartLoadWithLockIdentifier(shouldStart,lockIdentifier);}else if(shouldStart&&webViewRef.current){_BPCWebViewNativeComponent.Commands.loadUrl(webViewRef.current,url);}},[]);var _useWebViewLogic=(0,_WebViewShared.useWebViewLogic)({onNavigationStateChange:onNavigationStateChange,onLoad:onLoad,onError:onError,onHttpErrorProp:onHttpErrorProp,onLoadEnd:onLoadEnd,onLoadProgress:onLoadProgress,onLoadStart:onLoadStart,onRenderProcessGoneProp:onRenderProcessGoneProp,onMessageProp:onMessageProp,onOpenWindowProp:onOpenWindowProp,startInLoadingState:startInLoadingState,originWhitelist:originWhitelist,onShouldStartLoadWithRequestProp:onShouldStartLoadWithRequestProp,onShouldStartLoadWithRequestCallback:onShouldStartLoadWithRequestCallback}),onLoadingStart=_useWebViewLogic.onLoadingStart,onShouldStartLoadWithRequest=_useWebViewLogic.onShouldStartLoadWithRequest,onMessage=_useWebViewLogic.onMessage,viewState=_useWebViewLogic.viewState,setViewState=_useWebViewLogic.setViewState,lastErrorEvent=_useWebViewLogic.lastErrorEvent,onHttpError=_useWebViewLogic.onHttpError,onLoadingError=_useWebViewLogic.onLoadingError,onLoadingFinish=_useWebViewLogic.onLoadingFinish,onLoadingProgress=_useWebViewLogic.onLoadingProgress,onOpenWindow=_useWebViewLogic.onOpenWindow,onRenderProcessGone=_useWebViewLogic.onRenderProcessGone;(0,_react.useImperativeHandle)(ref,function(){return{goForward:function goForward(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.goForward(webViewRef.current);},goBack:function goBack(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.goBack(webViewRef.current);},reload:function reload(){setViewState('LOADING');if(webViewRef.current){_BPCWebViewNativeComponent.Commands.reload(webViewRef.current);}},stopLoading:function stopLoading(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.stopLoading(webViewRef.current);},postMessage:function postMessage(data){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.postMessage(webViewRef.current,data);},injectJavaScript:function injectJavaScript(data){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.injectJavaScript(webViewRef.current,data);},requestFocus:function requestFocus(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.requestFocus(webViewRef.current);},clearFormData:function clearFormData(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.clearFormData(webViewRef.current);},clearCache:function clearCache(includeDiskFiles){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.clearCache(webViewRef.current,includeDiskFiles);},clearHistory:function clearHistory(){return webViewRef.current&&_BPCWebViewNativeComponent.Commands.clearHistory(webViewRef.current);}};},[setViewState,webViewRef]);(0,_react.useEffect)(function(){var onShouldStartLoadWithRequestSubscription=directEventEmitter.addListener('onShouldStartLoadWithRequest',function(event){if(event.messagingModuleName===messagingModuleName){var _=event.messagingModuleName,rest=(0,_objectWithoutProperties2.default)(event,_excluded2);onShouldStartLoadWithRequest(rest);}});var onMessageSubscription=directEventEmitter.addListener('onMessage',function(event){if(event.messagingModuleName===messagingModuleName){var _=event.messagingModuleName,rest=(0,_objectWithoutProperties2.default)(event,_excluded3);onMessage(rest);}});return function(){onShouldStartLoadWithRequestSubscription.remove();onMessageSubscription.remove();};},[messagingModuleName,onMessage,onShouldStartLoadWithRequest]);var otherView;if(viewState==='LOADING'){otherView=(renderLoading||_WebViewShared.defaultRenderLoading)();}else if(viewState==='ERROR'){(0,_invariant.default)(lastErrorEvent!=null,'lastErrorEvent expected to be non-null');if(lastErrorEvent){otherView=(renderError||_WebViewShared.defaultRenderError)(lastErrorEvent.domain,lastErrorEvent.code,lastErrorEvent.description);}}else if(viewState!=='IDLE'){console.error(`BPCWebView invalid state encountered: ${viewState}`);}var webViewStyles=[_WebView.default.container,_WebView.default.webView,style];var webViewContainerStyle=[_WebView.default.container,containerStyle];if(typeof source!=='number'&&source&&'method'in source){if(source.method==='POST'&&source.headers){console.warn('WebView: `source.headers` is not supported when using POST.');}else if(source.method==='GET'&&source.body){console.warn('WebView: `source.body` is not supported when using GET.');}}var NativeWebView=(nativeConfig==null?void 0:nativeConfig.component)||_BPCWebViewNativeComponent.default;var sourceResolved=resolveAssetSource(source);var newSource=typeof sourceResolved==='object'?Object.entries(sourceResolved).reduce(function(prev,_ref2){var _ref3=(0,_slicedToArray2.default)(_ref2,2),currKey=_ref3[0],currValue=_ref3[1];return Object.assign({},prev,(0,_defineProperty2.default)({},currKey,currKey==='headers'&&currValue&&typeof currValue==='object'?Object.entries(currValue).map(function(_ref4){var _ref5=(0,_slicedToArray2.default)(_ref4,2),key=_ref5[0],value=_ref5[1];return{name:key,value:value};}):currValue));},{}):sourceResolved;var webView=(0,_jsxRuntime.jsx)(NativeWebView,Object.assign({},otherProps,{messagingEnabled:typeof onMessageProp==='function',messagingModuleName:messagingModuleName,hasOnScroll:!!otherProps.onScroll,onLoadingError:onLoadingError,onLoadingFinish:onLoadingFinish,onLoadingProgress:onLoadingProgress,onLoadingStart:onLoadingStart,onHttpError:onHttpError,onRenderProcessGone:onRenderProcessGone,onMessage:onMessage,onOpenWindow:onOpenWindow,hasOnOpenWindowEvent:onOpenWindowProp!==undefined,onShouldStartLoadWithRequest:onShouldStartLoadWithRequest,ref:webViewRef,source:sourceResolved,newSource:newSource,style:webViewStyles,overScrollMode:overScrollMode,javaScriptEnabled:javaScriptEnabled,thirdPartyCookiesEnabled:thirdPartyCookiesEnabled,scalesPageToFit:scalesPageToFit,allowsFullscreenVideo:allowsFullscreenVideo,allowFileAccess:allowFileAccess,saveFormDataDisabled:saveFormDataDisabled,cacheEnabled:cacheEnabled,androidLayerType:androidLayerType,setSupportMultipleWindows:setSupportMultipleWindows,setBuiltInZoomControls:setBuiltInZoomControls,setDisplayZoomControls:setDisplayZoomControls,nestedScrollEnabled:nestedScrollEnabled,injectedJavaScriptObject:JSON.stringify(injectedJavaScriptObject)},nativeConfig==null?void 0:nativeConfig.props),"webViewKey");return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:webViewContainerStyle,children:[webView,otherView]});});var isFileUploadSupported=_NativeBPCWebViewModule.default.isFileUploadSupported;var WebView=Object.assign(WebViewComponent,{isFileUploadSupported:isFileUploadSupported});var _default=exports.default=WebView;