|
@@ -9,6 +9,7 @@
|
|
#import "DsJsInteractAPI.h"
|
|
#import "DsJsInteractAPI.h"
|
|
#import "TT_ProgressV.h"
|
|
#import "TT_ProgressV.h"
|
|
#import "UIDevice+StateHeight.h"
|
|
#import "UIDevice+StateHeight.h"
|
|
|
|
+#import "NSString+URL.h"
|
|
|
|
|
|
@interface XXX_BaseWebC ()
|
|
@interface XXX_BaseWebC ()
|
|
@property (nonatomic, strong) TT_ProgressV *wkweb_pv;
|
|
@property (nonatomic, strong) TT_ProgressV *wkweb_pv;
|
|
@@ -27,6 +28,8 @@
|
|
if(self.isPayType == YES){
|
|
if(self.isPayType == YES){
|
|
[self present_confignavBarBar];
|
|
[self present_confignavBarBar];
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ [self tt_addSubviews];
|
|
}
|
|
}
|
|
|
|
|
|
- (void)viewWillAppear:(BOOL)animated {
|
|
- (void)viewWillAppear:(BOOL)animated {
|
|
@@ -92,11 +95,57 @@
|
|
/// 页面加载失败时调用
|
|
/// 页面加载失败时调用
|
|
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(null_unspecified WKNavigation *)navigation withError:(NSError *)error {
|
|
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(null_unspecified WKNavigation *)navigation withError:(NSError *)error {
|
|
[self web_pvframeis_Hide:NO];
|
|
[self web_pvframeis_Hide:NO];
|
|
|
|
+
|
|
|
|
+ if (self.isPayType) {
|
|
|
|
+ [self loadEndWithUrl:webView.URL];
|
|
|
|
+ }
|
|
}
|
|
}
|
|
///页面加载完成时调用
|
|
///页面加载完成时调用
|
|
-(void)webView:(WKWebView*)webView didFinishNavigation:(WKNavigation*)navigation{
|
|
-(void)webView:(WKWebView*)webView didFinishNavigation:(WKNavigation*)navigation{
|
|
[self web_pvframeis_Hide:NO];
|
|
[self web_pvframeis_Hide:NO];
|
|
|
|
|
|
|
|
+ if (self.isPayType) {
|
|
|
|
+ [self loadEndWithUrl:webView.URL];
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (void)loadEndWithUrl:(NSURL *)webUrl {
|
|
|
|
+
|
|
|
|
+ NSString *urlStr = [webUrl absoluteString];
|
|
|
|
+
|
|
|
|
+ NSLog(@"urlStrurlStr======%@", urlStr);
|
|
|
|
+ NSLog(@"webUrl.query======%@", webUrl.query);
|
|
|
|
+
|
|
|
|
+ if ([urlStr containsString:@"rest/V1/rewrite/paypal/cancel"]) {
|
|
|
|
+ // 取消paypal支付
|
|
|
|
+
|
|
|
|
+ NSDictionary *cancelDic = @{@"title":@"Cancel Pay"};
|
|
|
|
+
|
|
|
|
+ if (self.WebViewBlock) {
|
|
|
|
+ self.WebViewBlock(0, cancelDic);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ [self tool_PopViewController];
|
|
|
|
+
|
|
|
|
+ } else if ([urlStr containsString:@"rest/V1/rewrite/paypal/return"]){
|
|
|
|
+
|
|
|
|
+ NSDictionary *successDic = [webUrl.query getURLParameters];
|
|
|
|
+
|
|
|
|
+ if (self.WebViewBlock) {
|
|
|
|
+ self.WebViewBlock(1, successDic);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ [self tool_PopViewController];
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+//
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
#pragma mark - **************** wkweb_pv ****************
|
|
#pragma mark - **************** wkweb_pv ****************
|
|
@@ -130,6 +179,31 @@
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+-(void)webJs_onClose{
|
|
|
|
+ @weakify(self)
|
|
|
|
+ [self.dwebview callHandler:@"onClose" completionHandler:^(id _Nullable value) {
|
|
|
|
+ NSLog(@"onClose ---- value:%@",value);///exits
|
|
|
|
+ @strongify(self)
|
|
|
|
+// if(isValid(value)){
|
|
|
|
+// [self tool_closeSaveValue:value];
|
|
|
|
+// }
|
|
|
|
+ [self tool_PopViewController];
|
|
|
|
+ } ];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (void)tool_PopViewController{
|
|
|
|
+ if (self.navigationController) {
|
|
|
|
+ if (self.navigationController.viewControllers.count == 1) {
|
|
|
|
+ if (self.presentingViewController) {
|
|
|
|
+ [self dismissViewControllerAnimated:YES completion:nil];
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ [self.navigationController popViewControllerAnimated:YES];
|
|
|
|
+ }
|
|
|
|
+ } else if(self.presentingViewController) {
|
|
|
|
+ [self dismissViewControllerAnimated:YES completion:nil];
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
|
|
|