|
@@ -7,11 +7,11 @@
|
|
|
//
|
|
|
|
|
|
#import "JYBaseViewController.h"
|
|
|
-
|
|
|
#import <WebKit/WebKit.h>
|
|
|
#import <CoreLocation/CoreLocation.h>
|
|
|
#import <GRPCClient/GRPCCall+ChannelArg.h>
|
|
|
#import <GRPCClient/GRPCCall+Tests.h>
|
|
|
+#import "MBProgressHUD.h"
|
|
|
|
|
|
@interface JYBaseViewController ()<WKNavigationDelegate,WKUIDelegate,WKScriptMessageHandler,CLLocationManagerDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate,CLLocationManagerDelegate,SKProductsRequestDelegate,SKPaymentTransactionObserver,ZKClipboardViewDelegate,UIDocumentPickerDelegate>
|
|
|
{
|
|
@@ -102,6 +102,8 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
config.preferences.javaScriptEnabled = YES;
|
|
|
config.preferences.javaScriptCanOpenWindowsAutomatically = YES;
|
|
|
//添加消息处理,注意:self指代的是需要遵守WKScriptMessageHandler协议,结束时需要移除
|
|
|
+ NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
|
|
|
+ config.applicationNameForUserAgent = [NSString stringWithFormat:@" jianyuapp %@",version];
|
|
|
config.userContentController = [[WKUserContentController alloc] init];
|
|
|
//声明协议
|
|
|
NSArray *jsArr = @[@"loginByWeixin",
|
|
@@ -130,12 +132,11 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
@"wirteRight",
|
|
|
@"clearRight",
|
|
|
@"savePic",
|
|
|
- @"ocrVerifyService",
|
|
|
- @"faceVerifyService",
|
|
|
@"skipAppointTab",
|
|
|
@"refreshAppointTab",
|
|
|
@"sendMsgCount",
|
|
|
- @"downLoadFile"
|
|
|
+ @"downLoadFile",
|
|
|
+ @"clearHistory"
|
|
|
|
|
|
];
|
|
|
for (NSString*jsName in jsArr) {
|
|
@@ -160,18 +161,9 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
return _webView;
|
|
|
}
|
|
|
|
|
|
--(void)webViewFirstRequest
|
|
|
-{
|
|
|
+-(void)webViewFirstRequest{
|
|
|
//去时间戳-拼接
|
|
|
- NSString *tmpUrl = @"";
|
|
|
- if ([LXUserDefaults isExistToken]) {
|
|
|
- NSString *token = [LXUserDefaults token];
|
|
|
- tmpUrl = [[NSString stringWithFormat:@"%@%@", kHost, @"jyapp/free/login"] stringByAppendingString:[NSString stringWithFormat:@"?sign=%@&url=/jyapp/jylab/mainSearch&from=restart", token]];
|
|
|
- }else {
|
|
|
- tmpUrl = [[NSString stringWithFormat:@"%@%@", kHost, @"jyapp/free/index"] stringByAppendingString:[NSString stringWithFormat:@"?deviceid=%@", [LXUserDefaults getDeviceID]]];
|
|
|
- }
|
|
|
- NSLog(@"111 :第一次加载:%@",tmpUrl);
|
|
|
- tmpUrl = [tmpUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
|
|
+ NSString *tmpUrl = [[NSString stringWithFormat:@"%@%@", kHost, @"jyapp/jylab/mainSearch"] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];;
|
|
|
kMainQueue(^{
|
|
|
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:tmpUrl]]];
|
|
|
})
|
|
@@ -211,17 +203,12 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
|
|
|
-(void)initNotification {
|
|
|
//加载通知
|
|
|
-
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(openPushUrlOtherMethods:) name:OpenPushUrlOtherMethods object:nil];
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(openPushLinkUrlMethods:) name:OpenPushLinkUrlMethods object:nil];
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jyReceiveNewsRedPoint:) name:JYReceiveNewsRedPoint object:nil];
|
|
|
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jyRefreshMenusView:) name:JYRefreshMenusView object:nil];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
//支付状态通知
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(alipayWXpayStatus:) name:AlipayWXpayStatus object:nil];
|
|
|
-
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notNetReloadWebVIew:) name:NotNetReloadWebVIew object:nil];
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(popWebView:) name:PopWebView object:nil];
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginOut:) name:kLoginOut object:nil];
|
|
@@ -230,18 +217,13 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(isLoginTabBar:) name:LoginIndexTabBar object:nil];
|
|
|
//展示底部红的通知
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jyReceiveNewsRedPoint:) name:JYReceiveNewsRedPoint object:nil];
|
|
|
- //接收全新通知
|
|
|
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshNonCurVC:) name:RefreshNonCurVC object:nil];
|
|
|
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshAllVC:) name:RefreshAllVC object:nil];
|
|
|
//粘贴板-
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateClipboard:) name:UpdateClipboard object:nil];
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(openTheClipboard:) name:OpenTheClipboard object:nil];
|
|
|
-
|
|
|
}
|
|
|
|
|
|
#pragma mark – Gesture Recognizer –
|
|
|
--(void)paningGestureReceive:(UIPanGestureRecognizer *)recoginzer
|
|
|
-{
|
|
|
+-(void)paningGestureReceive:(UIPanGestureRecognizer *)recoginzer{
|
|
|
NSString *current_url = [self stringByEvaluatingJavaScriptFromString:@"document.location.href"];
|
|
|
NSLog(@"%@",current_url);
|
|
|
CGRect rect = self.view.bounds;
|
|
@@ -250,7 +232,11 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
NSLog(@"不可返回");
|
|
|
return;
|
|
|
}
|
|
|
- if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/free/me",kHost]]||[current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/jylab/index",kHost]]||[current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/swordfish/historypush",kHost]]||[current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/jylab/mainSearch",kHost]]||[current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/frontPage/messageCenter/sess/index",kHost]]){
|
|
|
+ if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/free/me",kHost]]||
|
|
|
+ [current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/jylab/index",kHost]]||
|
|
|
+ [current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/swordfish/historypush",kHost]]||
|
|
|
+ [current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/jylab/mainSearch",kHost]]||
|
|
|
+ [current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/frontPage/messageCenter/sess/index",kHost]]){
|
|
|
|
|
|
return;
|
|
|
}
|
|
@@ -325,6 +311,14 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
[self JsOpenExternalLink:message.body];
|
|
|
}else if ([message.name isEqualToString:@"alert"]) {
|
|
|
[self jsAlert:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"hiddenBottom"]) {
|
|
|
+// [self jsHiddenBottom:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"checkLab"]) {
|
|
|
+// [self jsCheckLab:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"chooseTab"]) {
|
|
|
+// [self jsChooseTab:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"clearHistory"]) {
|
|
|
+// [self jsClearHistory:message.body];
|
|
|
}else if ([message.name isEqualToString:@"loginSuccess"]) {
|
|
|
[self jsLoginSuccess:message.body];
|
|
|
}else if ([message.name isEqualToString:@"backUrl"]) {
|
|
@@ -332,15 +326,13 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
}else if ([message.name isEqualToString:@"clearPushMessage"]) {
|
|
|
[self jsClearPushMessage:message.body];
|
|
|
}else if ([message.name isEqualToString:@"hideRedSpotOnMenu"]) {
|
|
|
- [self jsHideRedSpotOnMenu:message.body];
|
|
|
+// [self jsHideRedSpotOnMenu:message.body];
|
|
|
}else if ([message.name isEqualToString:@"showRedSpotOnMenu"]) {
|
|
|
- [self jsShowRedSpotOnMenu:message.body];
|
|
|
+// [self jsShowRedSpotOnMenu:message.body];
|
|
|
}else if ([message.name isEqualToString:@"wxPay"]) {
|
|
|
[self jsWxPay:message.body];
|
|
|
}else if ([message.name isEqualToString:@"aliPay"]) {
|
|
|
[self jsAliPay:message.body];
|
|
|
- }else if ([message.name isEqualToString:@"chooseTab"]) {
|
|
|
- [self jsChooseTab:message.body];
|
|
|
}else if ([message.name isEqualToString:@"skipCameraWithParam"]) {
|
|
|
[self jsSkipCameraWithParam:message.body];
|
|
|
}else if ([message.name isEqualToString:@"skipAlbumWithParam"]) {
|
|
@@ -360,18 +352,17 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
}else if ([message.name isEqualToString:@"savePic"]) {
|
|
|
[self jsSavePic:message.body];
|
|
|
}else if ([message.name isEqualToString:@"skipAppointTab"]) {
|
|
|
- [self jsSkipAppointTab:message.body];
|
|
|
+// [self jsSkipAppointTab:message.body];
|
|
|
}else if ([message.name isEqualToString:@"refreshAppointTab"]) {
|
|
|
- [self jsRefreshAppointTab:message.body];
|
|
|
+// [self jsRefreshAppointTab:message.body];
|
|
|
}else if ([message.name isEqualToString:@"sendMsgCount"]) {
|
|
|
- [self jsSendMsgCount:message.body];
|
|
|
+// [self jsSendMsgCount:message.body];
|
|
|
}else if ([message.name isEqualToString:@"downLoadFile"]) {
|
|
|
[self jsDownLoadFile:message.body];
|
|
|
}else {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
#pragma mark - WKUIDelegate
|
|
|
- (void)webView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(nullable NSString *)defaultText initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSString * _Nullable result))completionHandler
|
|
|
{
|
|
@@ -437,23 +428,46 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+-(WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures{
|
|
|
+ //假如是重新打开窗口的话
|
|
|
+ if (!navigationAction.targetFrame.isMainFrame) {
|
|
|
|
|
|
+ [webView loadRequest:navigationAction.request];
|
|
|
+
|
|
|
+ }
|
|
|
+ return nil;
|
|
|
+}
|
|
|
|
|
|
// 在发送请求之前,决定是否跳转
|
|
|
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
|
|
|
//如果当前页面是三级页面-
|
|
|
NSString *curUrl = [webView.URL absoluteString];
|
|
|
-
|
|
|
+ if (navigationAction.targetFrame==nil) {
|
|
|
+ [webView loadRequest:navigationAction.request];
|
|
|
+ }
|
|
|
if ([curUrl containsString:@"jyapp/article/content"]) {
|
|
|
//当前页面是三级页面--判断待跳转页面是否符合内置跳转
|
|
|
NSString *nextUrl = [navigationAction.request.URL absoluteString];
|
|
|
- if ([nextUrl containsString:@"jianyu360.com"]||[nextUrl containsString:@"jianyu360.cn"]||[nextUrl containsString:@"qmx.top"]) {
|
|
|
- // 允许跳转
|
|
|
+ if ([nextUrl containsString:@"jianyu360.com"]||
|
|
|
+ [nextUrl containsString:@"jianyu360.cn"]||
|
|
|
+ [nextUrl containsString:@"qmx.top"]) {//允许跳转
|
|
|
decisionHandler(WKNavigationActionPolicyAllow);
|
|
|
}else {
|
|
|
NSLog(@"不允许内部跳转:-%@",nextUrl);
|
|
|
//筛选拦截-压缩包等格式不允许跳转
|
|
|
- if ([nextUrl hasSuffix:@".rar"]||[nextUrl hasSuffix:@".zip"]||[nextUrl hasSuffix:@".7z"]||[nextUrl hasSuffix:@".CAB"]||[nextUrl hasSuffix:@".ARJ"]||[nextUrl hasSuffix:@".LZH"]||[nextUrl hasSuffix:@".TAR"]||[nextUrl hasSuffix:@".GZ"]||[nextUrl hasSuffix:@".ACE"]||[nextUrl hasSuffix:@".UUE"]||[nextUrl hasSuffix:@".BZ2"]||[nextUrl hasSuffix:@".JAR"]||[nextUrl hasSuffix:@".ISO"]) {
|
|
|
+ if ([nextUrl hasSuffix:@".rar"]||
|
|
|
+ [nextUrl hasSuffix:@".zip"]||
|
|
|
+ [nextUrl hasSuffix:@".7z"]||
|
|
|
+ [nextUrl hasSuffix:@".CAB"]||
|
|
|
+ [nextUrl hasSuffix:@".ARJ"]||
|
|
|
+ [nextUrl hasSuffix:@".LZH"]||
|
|
|
+ [nextUrl hasSuffix:@".TAR"]||
|
|
|
+ [nextUrl hasSuffix:@".GZ"]||
|
|
|
+ [nextUrl hasSuffix:@".ACE"]||
|
|
|
+ [nextUrl hasSuffix:@".UUE"]||
|
|
|
+ [nextUrl hasSuffix:@".BZ2"]||
|
|
|
+ [nextUrl hasSuffix:@".JAR"]||
|
|
|
+ [nextUrl hasSuffix:@".ISO"]) {
|
|
|
// 不允许跳转
|
|
|
decisionHandler(WKNavigationActionPolicyCancel);
|
|
|
}else {
|
|
@@ -474,13 +488,8 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
// 允许跳转
|
|
|
decisionHandler(WKNavigationActionPolicyAllow);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
#pragma mark ****WKUIDelegate
|
|
|
//通过js alert 显示一个警告面板,调用原生会走此方法。
|
|
|
- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler
|
|
@@ -551,32 +560,19 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
[self.recognizer delaysTouchesBegan];
|
|
|
[self.view addGestureRecognizer:self.recognizer];
|
|
|
|
|
|
- //监听购买结果
|
|
|
- [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
|
|
|
|
|
|
+//
|
|
|
|
|
|
-// UIButton *btn = [ZKControl createButtonWithFrame:CGRectMake(100, 100, 100, 100) title:@"点我" imageName:nil bgImageName:nil target:self method:@selector(cccccc)];
|
|
|
-// [self.view addSubview:btn];
|
|
|
+ //监听购买结果
|
|
|
+ [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
|
|
|
|
|
|
}
|
|
|
--(void)cccccc{
|
|
|
- //调用一键登录
|
|
|
- [[TXCommonHandler sharedInstance] getLoginTokenWithTimeout:3.0
|
|
|
- controller:self model:nil complete:^(NSDictionary * _Nonnull resultDic) {
|
|
|
- NSLog(@"一键登录结果:%@", resultDic);
|
|
|
- }];
|
|
|
-
|
|
|
-}
|
|
|
|
|
|
|
|
|
#pragma mark - WKNavigationDelegate
|
|
|
/* 页面加载完成 */
|
|
|
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
|
|
|
NSLog(@"-----页面加载完成%@",webView.URL.absoluteString);
|
|
|
- if (![GlobalData shareInstance].isSearchToLoad) {
|
|
|
- [GlobalData shareInstance].isSearchToLoad = YES;
|
|
|
- }
|
|
|
-
|
|
|
//第一次加载小红点
|
|
|
[self.webView evaluateJavaScript:@"document.documentElement.style.webkitTouchCallout='none';" completionHandler:nil];
|
|
|
[self.webView evaluateJavaScript:@"document.documentElement.style.webkitUserSelect='none';"completionHandler:nil];
|
|
@@ -584,8 +580,6 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
[self removeFailNetViews];
|
|
|
[[LXViewControllerManager shareViewControllerManager] hideHud];
|
|
|
//写数据
|
|
|
-// [self writeWKWebData:webView.URL];
|
|
|
-
|
|
|
if (![GlobalData shareInstance].isOpen) {//第一次打开
|
|
|
[GlobalData shareInstance].isOpen = YES;
|
|
|
[self performSelector:@selector(pasteboard) withObject:nil afterDelay:1.5];
|
|
@@ -824,11 +818,6 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
return nil;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
--(void)jsCheckLab:(NSDictionary *)dict {
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:RefreshNonCurVC object:nil userInfo:nil];
|
|
|
-}
|
|
|
-
|
|
|
//js方法登录成功
|
|
|
-(void)jsLoginSuccess:(NSDictionary *)dict {
|
|
|
NSLog(@"search登录成功提示:%@",dict);
|
|
@@ -869,34 +858,6 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
});
|
|
|
}
|
|
|
|
|
|
--(void)jsHideRedSpotOnMenu:(NSDictionary *)dict {
|
|
|
- NSString *menu = [NSString stringWithFormat:@"%@",dict[@"menu"]];
|
|
|
- if([menu isEqualToString:@"subscribe"]) {
|
|
|
- kMainQueue(^{
|
|
|
- [self.tabBarController.tabBar hideBadgeOnItemIndex:1];
|
|
|
- });
|
|
|
- }
|
|
|
- if([menu isEqualToString:@"my"]) {
|
|
|
- kMainQueue(^{
|
|
|
- [self.tabBarController.tabBar hideBadgeOnItemIndex:4];
|
|
|
- });
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
--(void)jsShowRedSpotOnMenu:(NSDictionary *)dict {
|
|
|
- NSString *menu = [NSString stringWithFormat:@"%@",dict[@"menu"]];
|
|
|
- if([menu isEqualToString:@"subscribe"]) {
|
|
|
- kMainQueue(^{
|
|
|
- [self.tabBarController.tabBar showBadgeOnItemIndex:1];
|
|
|
- });
|
|
|
- }
|
|
|
- if([menu isEqualToString:@"my"]) {
|
|
|
- kMainQueue(^{
|
|
|
- [self.tabBarController.tabBar showBadgeOnItemIndex:4];
|
|
|
- });
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-(void)jsWxPay:(NSDictionary *)dict {
|
|
|
if (![LXUserDefaults isInstallWeiXin]) { [[LXViewControllerManager shareViewControllerManager] showHudOnlyText:@"请先安装微信再进行支付!" delay:1.5];
|
|
|
return;
|
|
@@ -992,19 +953,6 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
return self.placeLli;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
--(void)jsChooseTab:(NSDictionary *)dict {
|
|
|
-// NSInteger indexTab = [dict[@"indexTab"] integerValue];
|
|
|
-// kMainQueue((^{
|
|
|
-// AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
-// JYTabBarController *tab = (JYTabBarController *)delegate.window.rootViewController;
|
|
|
-// tab.selectedIndex = indexTab;
|
|
|
-// pushIndex = indexTab;
|
|
|
-// }));
|
|
|
-}
|
|
|
-
|
|
|
//拍照上传图片
|
|
|
-(void)jsSkipCameraWithParam:(NSDictionary *)dict {
|
|
|
[GlobalData shareInstance].isSkipPath = [NSString stringWithFormat:@"%@",dict[@"type"]];
|
|
@@ -1016,8 +964,6 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
[self presentViewController:picker animated:YES completion:nil];
|
|
|
});
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
//相册选择照片
|
|
|
-(void)jsSkipAlbumWithParam:(NSDictionary *)dict {
|
|
@@ -1031,7 +977,6 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
[self presentViewController:picker animated:YES completion:nil];
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
//统计点击推送
|
|
|
-(void)jsOpenActivityPage:(NSDictionary *)dict {
|
|
|
NSDictionary * infoDic = @{@"url":[NSString stringWithFormat:@"%@",dict[@"url"]],
|
|
@@ -1048,7 +993,6 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
NSLog(@"error=%@",error);
|
|
|
|
|
|
}];
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1120,11 +1064,6 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
[[LXViewControllerManager shareViewControllerManager] showHudOnlyText:msg delay:1];
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
#pragma mark 粘贴板
|
|
|
-(void)jsWirteRight:(NSDictionary *)dict {
|
|
|
NSString *txt = [NSString stringWithFormat:@"%@",dict[@"txt"]];
|
|
@@ -1257,45 +1196,6 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
[[SKPaymentQueue defaultQueue] finishTransaction: transaction];
|
|
|
}
|
|
|
|
|
|
-//切换模块
|
|
|
--(void)jsSkipAppointTab:(NSDictionary *)dict {
|
|
|
-// if(self.tabBarController.selectedIndex == 0) {
|
|
|
-// AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
-// JYTabBarController *tab = (JYTabBarController *)delegate.window.rootViewController;
|
|
|
-// NSString *name = [NSString stringWithFormat:@"%@",dict[@"name"]];
|
|
|
-// if ([name isEqualToString:@"search"]) {
|
|
|
-// tab.selectedIndex = 0;//切换底部栏
|
|
|
-// }else if ([name isEqualToString:@"subscribe"]) {
|
|
|
-// tab.selectedIndex = 1;//切换底部栏
|
|
|
-// }else if ([name isEqualToString:@"message"]) {
|
|
|
-// tab.selectedIndex = 2;//切换底部栏
|
|
|
-// }else if ([name isEqualToString:@"box"]) {
|
|
|
-// tab.selectedIndex = 3;//切换底部栏
|
|
|
-// }else if ([name isEqualToString:@"me"]) {
|
|
|
-// tab.selectedIndex = 4;//切换底部栏
|
|
|
-// }else {
|
|
|
-//
|
|
|
-// }
|
|
|
-// }
|
|
|
-}
|
|
|
-
|
|
|
-//刷新模块页面
|
|
|
--(void)jsRefreshAppointTab:(NSDictionary *)dict {
|
|
|
- if(self.tabBarController.selectedIndex == 0) {
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:JYRefreshMenusView object:nil userInfo:dict];
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-//展示消息模块红点数量
|
|
|
--(void)jsSendMsgCount:(NSDictionary *)dict {
|
|
|
- NSString *count = [NSString stringWithFormat:@"%@",dict[@"num"]];
|
|
|
- if(self.tabBarController.selectedIndex == 0) {
|
|
|
- [self.tabBarController.tabBar showBadgeOnItemIndex:2 withCount:[count intValue]];
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
|
|
|
-(void)jsDownLoadFile:(NSDictionary *)dict {
|
|
|
NSString *filename = [NSString stringWithFormat:@"%@",dict[@"filename"]];
|
|
@@ -1340,7 +1240,7 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
|
|
|
- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script
|
|
|
{
|
|
|
- __block NSString *resultString = nil;
|
|
|
+ __block NSString *resultString = @"";
|
|
|
__block BOOL finished = NO;
|
|
|
|
|
|
[self.webView evaluateJavaScript:script completionHandler:^(id result, NSError *error) {
|
|
@@ -1686,11 +1586,9 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
|
|
|
//前往登录页面
|
|
|
-(void)isLoginTabBar:(NSNotification *)notification{
|
|
|
-
|
|
|
NSString *url = [NSString stringWithFormat:@"%@%@", kHost, @"jyapp/free/login"];
|
|
|
url = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
|
|
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
|
|
|
-
|
|
|
}
|
|
|
-(void)jyReceiveNewsRedPoint:(NSNotification *)notificaition {
|
|
|
NSDictionary *dict = notificaition.userInfo;
|
|
@@ -1698,31 +1596,6 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
|
|
|
[self isExitCallToJS:textJS withMethodName:@"afterReceivePushMessage"];
|
|
|
}
|
|
|
|
|
|
--(void)jyRefreshMenusView:(NSNotification *)notificaition {
|
|
|
- NSDictionary *dict = notificaition.userInfo;
|
|
|
- NSString *name = [NSString stringWithFormat:@"%@",dict[@"name"]];
|
|
|
- NSString *type = [NSString stringWithFormat:@"%@",dict[@"type"]];
|
|
|
- if ([name isEqualToString:@"search"]) {
|
|
|
- if ([type isEqualToString:@"0"]) {
|
|
|
- [self.webView reload];
|
|
|
- }else {
|
|
|
- [self webViewFirstRequest];
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-//刷新页面相关
|
|
|
--(void)refreshNonCurVC:(NSNotification *)notificaition{
|
|
|
- [self webViewFirstRequest];
|
|
|
-}
|
|
|
--(void)refreshAllVC:(NSNotification *)notificaition{
|
|
|
- [self webViewFirstRequest];
|
|
|
-}
|
|
|
-
|
|
|
#pragma mark ****粘贴板相关-梳理
|
|
|
-(void)updateClipboard:(NSNotification *)notificaition{
|
|
|
NSString *current_url = [self stringByEvaluatingJavaScriptFromString:@"document.location.href"];
|