react-native-webview-bootpay 13.13.43-3.alpha.1 → 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/apple/BPCWebView.mm +6 -6
- package/apple/BPCWebViewImpl.h +1 -1
- package/apple/BPCWebViewImpl.m +204 -30
- package/package.json +1 -1
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 bootpayStringToOnShouldStartLoadWithRequestNavigationTypeEnum(std::string v
|
|
|
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 bootpayStringToOnLoadingStartNavigationTypeEnum(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 bootpayStringToOnLoadingFinishNavigationTypeEnum(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 bootpayStringToOnLoadingFinishNavigationTypeEnum(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 bootpayStringToOnLoadingFinishNavigationTypeEnum(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.h
CHANGED
|
@@ -36,7 +36,7 @@ shouldStartLoadForRequest:(NSMutableDictionary<NSString *, id> *)request
|
|
|
36
36
|
|
|
37
37
|
@end
|
|
38
38
|
|
|
39
|
-
@interface
|
|
39
|
+
@interface BPCWeakScriptMessageDelegate : NSObject<WKScriptMessageHandler>
|
|
40
40
|
|
|
41
41
|
@property (nonatomic, weak, nullable) id<WKScriptMessageHandler> scriptDelegate;
|
|
42
42
|
|
package/apple/BPCWebViewImpl.m
CHANGED
|
@@ -18,20 +18,20 @@
|
|
|
18
18
|
#import "objc/runtime.h"
|
|
19
19
|
|
|
20
20
|
static NSTimer *keyboardTimer;
|
|
21
|
-
static NSString *const HistoryShimName = @"
|
|
22
|
-
static NSString *const MessageHandlerName = @"
|
|
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
|
|
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
|
|
31
|
+
@interface _BPSwizzleHelperWK : UIView
|
|
32
32
|
@property (nonatomic, copy) WKWebView *webView;
|
|
33
33
|
@end
|
|
34
|
-
@implementation
|
|
34
|
+
@implementation _BPSwizzleHelperWK
|
|
35
35
|
-(id)inputAccessoryView
|
|
36
36
|
{
|
|
37
37
|
if (_webView == nil) {
|
|
@@ -48,13 +48,13 @@ NSString *const CUSTOM_SELECTOR = @"_BPCCUSTOM_SELECTOR_";
|
|
|
48
48
|
@end
|
|
49
49
|
#endif // TARGET_OS_IOS
|
|
50
50
|
|
|
51
|
-
@interface
|
|
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
|
|
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)
|
|
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:@"%@%@",
|
|
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:@"%@%@",
|
|
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:
|
|
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:
|
|
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
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
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:[[
|
|
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 = [[
|
|
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:@"%@
|
|
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([
|
|
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:@"
|
|
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:[[
|
|
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:[[
|
|
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
|
|
2118
|
+
@implementation BPCWeakScriptMessageDelegate
|
|
1945
2119
|
|
|
1946
2120
|
- (instancetype)initWithDelegate:(id<WKScriptMessageHandler>)scriptDelegate {
|
|
1947
2121
|
self = [super init];
|
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.433.alpha.
|
|
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",
|