|
@@ -1,23 +1,1641 @@
|
|
|
//
|
|
|
-// JYNewMessViewController.m
|
|
|
+// JYNewSearchViewController.m
|
|
|
// JianYuIOS
|
|
|
//
|
|
|
-// Created by 郑坤 on 2021/10/28.
|
|
|
-// Copyright © 2021 lixianglan. All rights reserved.
|
|
|
+// Created by apple on 2020/6/5.
|
|
|
+// Copyright © 2020 lixianglan. All rights reserved.
|
|
|
//
|
|
|
|
|
|
#import "JYNewMessViewController.h"
|
|
|
+#import <WebKit/WebKit.h>
|
|
|
+#import "JYTabBarController.h"
|
|
|
+#import <CoreLocation/CoreLocation.h>
|
|
|
|
|
|
-@interface JYNewMessViewController ()
|
|
|
+@interface JYNewMessViewController ()<WKNavigationDelegate,WKUIDelegate,WKScriptMessageHandler,CLLocationManagerDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate,SKProductsRequestDelegate,ZKClipboardViewDelegate,WBFaceVerifyCustomerServiceDelegate>
|
|
|
+{
|
|
|
+ CGPoint startTouch;
|
|
|
+ BOOL _isMoving;
|
|
|
+ BOOL isExistNoNewWork;
|
|
|
+}
|
|
|
+
|
|
|
+@property (nonatomic, strong) UIProgressView *progressView;
|
|
|
+@property (nonatomic, strong) WKWebView *webView;
|
|
|
+@property(nonatomic, strong)NoNetView *noNetView;
|
|
|
+@property(nonatomic, strong)NoNetView *failNetView;
|
|
|
+@property(nonatomic, strong)ZKClipboardView *clipboardView;
|
|
|
+@property(nonatomic, strong)ZKFaceVerifyMsgView *verifyMsgView;
|
|
|
+@property(nonatomic, strong)UIPanGestureRecognizer *recognizer;
|
|
|
+
|
|
|
+
|
|
|
+//进度条是否加载中
|
|
|
+@property(nonatomic, assign)BOOL isRuningLoad;
|
|
|
|
|
|
@end
|
|
|
|
|
|
+
|
|
|
+NSString *const new_kInitVector_5 = @"1389461544135476";
|
|
|
+size_t const new_kKeySize_5 = kCCKeySizeAES128;
|
|
|
+NSString *const new_AesKey_5 = @"mGlAgnIBB8bx2nch";
|
|
|
+
|
|
|
@implementation JYNewMessViewController
|
|
|
|
|
|
+-(void)viewWillAppear:(BOOL)animated
|
|
|
+{
|
|
|
+ [super viewWillAppear:animated];
|
|
|
+ [self.navigationController setNavigationBarHidden:YES animated:animated];
|
|
|
+ if([GlobalData shareInstance].isReLogin) {
|
|
|
+ [GlobalData shareInstance].isReLogin = NO;
|
|
|
+ [self webViewFirstRequest];
|
|
|
+ }else {
|
|
|
+ if ([GlobalData shareInstance].isClickNotiStatus) {
|
|
|
+ [GlobalData shareInstance].messIsRed = NO;
|
|
|
+ [GlobalData shareInstance].isClickNotiStatus = NO;
|
|
|
+ }else {
|
|
|
+ if([GlobalData shareInstance].messIsRed) {
|
|
|
+ [GlobalData shareInstance].messIsRed = NO;
|
|
|
+ [self webViewFirstRequest];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//弹框
|
|
|
+-(ZKFaceVerifyMsgView *)verifyMsgView
|
|
|
+{
|
|
|
+ if(!_verifyMsgView) {
|
|
|
+ _verifyMsgView = [[ZKFaceVerifyMsgView alloc]initWithFrame:CGRectMake(0, 0, WIDTH*0.8, 150)];
|
|
|
+ _verifyMsgView.titleName = @"温馨提示";
|
|
|
+ }
|
|
|
+ return _verifyMsgView;
|
|
|
+}
|
|
|
+
|
|
|
+//进度条
|
|
|
+- (UIProgressView *)progressView
|
|
|
+{
|
|
|
+ if (_progressView == nil) {
|
|
|
+ _progressView = [[UIProgressView alloc] initWithFrame:CGRectMake(0,STATUS_BAR_HEIGHT - 2,WIDTH,2)];
|
|
|
+ _progressView.tintColor = [UIColor blueColor];
|
|
|
+ _progressView.trackTintColor = [UIColor whiteColor];
|
|
|
+ }
|
|
|
+ return _progressView;
|
|
|
+}
|
|
|
+//弹框
|
|
|
+-(ZKClipboardView *)clipboardView{
|
|
|
+ if(!_clipboardView) {
|
|
|
+ _clipboardView = [[ZKClipboardView alloc]initWithFrame:CGRectMake(0, 0, WIDTH*0.8, 180+90)];
|
|
|
+ _clipboardView.delegate = self;
|
|
|
+ }
|
|
|
+ return _clipboardView;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+//懒加载
|
|
|
+- (WKWebView *)webView
|
|
|
+{
|
|
|
+ if(_webView == nil) {
|
|
|
+ WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
|
|
|
+ config.preferences = [[WKPreferences alloc] init];
|
|
|
+ config.preferences.minimumFontSize = 0;
|
|
|
+ config.allowsInlineMediaPlayback = YES;
|
|
|
+ config.preferences.javaScriptEnabled = YES;
|
|
|
+ config.preferences.javaScriptCanOpenWindowsAutomatically = YES;
|
|
|
+ //添加消息处理,注意:self指代的是需要遵守WKScriptMessageHandler协议,结束时需要移除
|
|
|
+ config.userContentController = [[WKUserContentController alloc] init];
|
|
|
+ //声明协议
|
|
|
+ NSArray *jsArr = @[@"loginByWeixin",
|
|
|
+ @"share",
|
|
|
+ @"saveUserToken",
|
|
|
+ @"removeUserToken",
|
|
|
+ @"openSystemNotification",
|
|
|
+ @"openExternalLink",
|
|
|
+ @"alert",
|
|
|
+ @"hiddenBottom",
|
|
|
+ @"checkLab",
|
|
|
+ @"loginSuccess",
|
|
|
+ @"backUrl",
|
|
|
+ @"clearPushMessage",
|
|
|
+ @"hideRedSpotOnMenu",
|
|
|
+ @"showRedSpotOnMenu",
|
|
|
+ @"wxPay",
|
|
|
+ @"aliPay",
|
|
|
+ @"skipCameraWithParam",
|
|
|
+ @"skipAlbumWithParam",
|
|
|
+ @"openActivityPage",
|
|
|
+ @"callPhone",
|
|
|
+ @"openOtherAppLinks",
|
|
|
+ @"inPurchasingVip",
|
|
|
+ @"wirteRight",
|
|
|
+ @"clearRight",
|
|
|
+ @"savePic",
|
|
|
+ @"ocrVerifyService",
|
|
|
+ @"faceVerifyService",
|
|
|
+ @"skipAppointTab",
|
|
|
+ @"refreshAppointTab",
|
|
|
+ ];
|
|
|
+ for (NSString*jsName in jsArr) {
|
|
|
+ [config.userContentController addScriptMessageHandler:self name:jsName];
|
|
|
+ }
|
|
|
+
|
|
|
+ //高端的自定义配置创建WKWebView
|
|
|
+ if (iPhoneX) {
|
|
|
+ _webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT-TAB_BAR_HEIGHT) configuration:config];
|
|
|
+ if (@available(iOS 11.0, *)) {
|
|
|
+ _webView.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ _webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, -STATUS_BAR_HEIGHT, WIDTH, HEIGHT-TAB_BAR_HEIGHT+STATUS_BAR_HEIGHT) configuration:config];
|
|
|
+ }
|
|
|
+ _webView.scrollView.bounces = NO;
|
|
|
+ _webView.UIDelegate = self;
|
|
|
+ _webView.navigationDelegate = self;
|
|
|
+ _webView.userInteractionEnabled = YES;
|
|
|
+ [_webView addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionNew context:nil];
|
|
|
+ }
|
|
|
+ return _webView;
|
|
|
+}
|
|
|
+
|
|
|
+-(void)webViewFirstRequest
|
|
|
+{
|
|
|
+ NSString *url = [NSString stringWithFormat:@"%@%@", kHost, @"jyapp/swordfish/historypush"];
|
|
|
+ url = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
|
|
+ NSLog(@"222 :第一次加载:%@",url);
|
|
|
+ kMainQueue(^{
|
|
|
+ [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - event response
|
|
|
+// 计算wkWebView进度条
|
|
|
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
|
|
|
+ if (!self.isRuningLoad) {
|
|
|
+ self.isRuningLoad = YES;
|
|
|
+ }
|
|
|
+ if (object == self.webView && [keyPath isEqualToString:@"estimatedProgress"]) {
|
|
|
+ CGFloat newprogress = [[change objectForKey:NSKeyValueChangeNewKey] doubleValue];
|
|
|
+ self.progressView.alpha = 1.0f;
|
|
|
+ [self.progressView setProgress:newprogress animated:YES];
|
|
|
+ if (newprogress >= 1.0f) {
|
|
|
+ NSLog(@"进度条加载完毕...");
|
|
|
+ self.isRuningLoad = NO;
|
|
|
+ self.recognizer.enabled = YES;
|
|
|
+ [UIView animateWithDuration:0.3f
|
|
|
+ delay:0.3f
|
|
|
+ options:UIViewAnimationOptionCurveEaseOut
|
|
|
+ animations:^{
|
|
|
+ self.progressView.alpha = 0.0f;
|
|
|
+ }
|
|
|
+ completion:^(BOOL finished) {
|
|
|
+ [self.progressView setProgress:0 animated:NO];
|
|
|
+ }];
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+-(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(openPushUrlMethodsTwo:) name:OpenPushUrlMethodsTwo 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];
|
|
|
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(netReachChanged:) name:AFNetworkingReachabilityDidChangeNotification object:nil];
|
|
|
+
|
|
|
+
|
|
|
+ //接收全新通知
|
|
|
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshNonCurVC:) name:RefreshNonCurVC object:nil];
|
|
|
+
|
|
|
+ //监听购买结果
|
|
|
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiptData:) name:@"receiptData" 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
|
|
|
+{
|
|
|
+ NSString *current_url = [self stringByEvaluatingJavaScriptFromString:@"document.location.href"];
|
|
|
+ NSLog(@"当前页面:%@",current_url);
|
|
|
+ CGRect rect = self.view.bounds;
|
|
|
+ CGFloat width = CGRectGetWidth(rect);
|
|
|
+ if (![self.webView canGoBack]||[current_url containsString:@"jyapp/free/login"]) {
|
|
|
+ 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]]){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CGPoint touchPoint = [recoginzer locationInView:[UIApplication sharedApplication].keyWindow];
|
|
|
+ if (recoginzer.state==UIGestureRecognizerStateBegan) {
|
|
|
+ _isMoving = YES;
|
|
|
+ startTouch = touchPoint;
|
|
|
+ } else if (recoginzer.state==UIGestureRecognizerStateEnded||(recoginzer.state==UIGestureRecognizerStatePossible)){
|
|
|
+ if (touchPoint.x - startTouch.x > width*0.125) {
|
|
|
+ [UIView animateWithDuration:0.3 animations:^{
|
|
|
+ if (recoginzer.state==UIGestureRecognizerStateEnded) {
|
|
|
+ [self moveViewWithX:width];
|
|
|
+ [self.webView goBack];
|
|
|
+ }
|
|
|
+ } completion:^(BOOL finished) {
|
|
|
+ _isMoving = NO;
|
|
|
+ [self moveViewWithX:0];
|
|
|
+ }];
|
|
|
+ } else {
|
|
|
+ [UIView animateWithDuration:0.3 animations:^{
|
|
|
+ [self moveViewWithX:0];
|
|
|
+ } completion:^(BOOL finished) {
|
|
|
+ _isMoving = NO;
|
|
|
+ }];
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ } else if (recoginzer.state==UIGestureRecognizerStateCancelled){
|
|
|
+ [UIView animateWithDuration:0.3 animations:^{
|
|
|
+ [self moveViewWithX:0];
|
|
|
+ } completion:^(BOOL finished) {
|
|
|
+ _isMoving = NO;
|
|
|
+ }];
|
|
|
+ return;
|
|
|
+ }else {
|
|
|
+
|
|
|
+ }
|
|
|
+ if (_isMoving) {
|
|
|
+ [self moveViewWithX:touchPoint.x - startTouch.x];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+-(void)moveViewWithX:(float)x
|
|
|
+{
|
|
|
+ CGRect rect = self.view.bounds;
|
|
|
+ CGFloat width = CGRectGetWidth(rect);
|
|
|
+ x = x>width?width:x;
|
|
|
+ x = x<0?0:x;
|
|
|
+ CGRect frame = self.webView.frame;
|
|
|
+ frame.origin.x = x;
|
|
|
+ self.webView.frame = frame;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message{
|
|
|
+ // message.body -- Allowed types are NSNumber, NSString, NSDate, NSArray,NSDictionary, and NSNull.
|
|
|
+// NSLog(@"原生收到了js发送过来的消息message.name = %@ message.body = %@",message.name,message.body);
|
|
|
+ if ([message.name isEqualToString:@"loginByWeixin"]) {
|
|
|
+ [self jsLoginByWeixin:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"share"]) {
|
|
|
+ [self jsShare:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"saveUserToken"]) {
|
|
|
+ [self jsSaveUserToken:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"removeUserToken"]) {
|
|
|
+ [self jsRemoveUserToken:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"openSystemNotification"]) {
|
|
|
+ [self jsOpenSystemNotification:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"openExternalLink"]) {
|
|
|
+ [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:@"loginSuccess"]) {
|
|
|
+ [self jsLoginSuccess:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"backUrl"]) {
|
|
|
+ [self jsBackUrl:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"clearPushMessage"]) {
|
|
|
+ [self jsClearPushMessage:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"hideRedSpotOnMenu"]) {
|
|
|
+ [self jsHideRedSpotOnMenu:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"showRedSpotOnMenu"]) {
|
|
|
+ [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:@"skipCameraWithParam"]) {
|
|
|
+ [self jsSkipCameraWithParam:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"skipAlbumWithParam"]) {
|
|
|
+ [self jsSkipAlbumWithParam:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"openActivityPage"]) {
|
|
|
+ [self jsOpenActivityPage:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"callPhone"]) {
|
|
|
+ [self jsCallPhone:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"openOtherAppLinks"]) {
|
|
|
+ [self jsOpenOtherAppLinks:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"inPurchasingVip"]) {
|
|
|
+ [self jsInPurchasingVip:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"wirteRight"]) {
|
|
|
+ [self jsWirteRight:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"clearRight"]) {
|
|
|
+ [self jsClearRight:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"savePic"]) {
|
|
|
+ [self jsSavePic:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"ocrVerifyService"]) {
|
|
|
+ [self jsOcrVerifyService:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"faceVerifyService"]) {
|
|
|
+ [self jsFaceVerifyService:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"skipAppointTab"]) {
|
|
|
+ [self jsSkipAppointTab:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"refreshAppointTab"]) {
|
|
|
+ [self jsRefreshAppointTab: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
|
|
|
+{
|
|
|
+ NSError *err = nil;
|
|
|
+ NSData *dataFromString = [prompt dataUsingEncoding:NSUTF8StringEncoding];
|
|
|
+ NSDictionary *paramdict = [NSJSONSerialization JSONObjectWithData:dataFromString options:NSJSONReadingMutableContainers error:&err];
|
|
|
+ if (!err){
|
|
|
+ NSString *type = [paramdict objectForKey:@"jsName"];
|
|
|
+ if (type && [type isEqualToString:@"getUserToken"]) {
|
|
|
+ NSDictionary *dict = @{@"type":@"string",
|
|
|
+ @"value":[self jsGetUserToken:paramdict]};
|
|
|
+ completionHandler([self convertToJsonData:dict]);
|
|
|
+ }else if (type && [type isEqualToString:@"getVersion"]) {
|
|
|
+ NSDictionary *dict = @{@"type":@"string",
|
|
|
+ @"value":[self jsGetVersion:paramdict]};
|
|
|
+ completionHandler([self convertToJsonData:dict]);
|
|
|
+ }else if (type && [type isEqualToString:@"checkNoticePermission"]) {
|
|
|
+ NSDictionary *dict = @{@"type":@"int",
|
|
|
+ @"value":[NSString stringWithFormat:@"%d",[self jsCheckNoticePermission:paramdict]]};
|
|
|
+ completionHandler([self convertToJsonData:dict]);
|
|
|
+ }else if (type && [type isEqualToString:@"getPushRid"]) {
|
|
|
+ NSDictionary *dict = @{@"type":@"string",@"value":[self jsGetPushRid:paramdict]};
|
|
|
+ completionHandler([self convertToJsonData:dict]);
|
|
|
+ }else if (type && [type isEqualToString:@"isInstallWeixin"]) {
|
|
|
+ NSDictionary *dict = @{@"type":@"int",
|
|
|
+ @"value":[NSString stringWithFormat:@"%d",[self jsIsInstallWeixin:paramdict]]};
|
|
|
+ completionHandler([self convertToJsonData:dict]);
|
|
|
+ }else if (type && [type isEqualToString:@"getCipherText"]) {
|
|
|
+ NSDictionary *dict = @{@"type":@"string",
|
|
|
+ @"value":[self jsGetCipherText:paramdict]};
|
|
|
+ completionHandler([self convertToJsonData:dict]);
|
|
|
+ }
|
|
|
+ else if (type && [type isEqualToString:@"getOtherPushRid"]) {
|
|
|
+ NSDictionary *dict = @{@"type":@"string",@"value":[self jsGetOtherPushRid:paramdict]};
|
|
|
+ completionHandler([self convertToJsonData:dict]);
|
|
|
+ }else if (type && [type isEqualToString:@"getPhoneBrand"]) {
|
|
|
+ NSDictionary *dict = @{@"type":@"string",
|
|
|
+ @"value":[self jsGetPhoneBrand:paramdict]};
|
|
|
+ completionHandler([self convertToJsonData:dict]);
|
|
|
+ }else if (type && [type isEqualToString:@"readRight"]) {
|
|
|
+ NSDictionary *dict = @{@"type":@"string",
|
|
|
+ @"value":[self jsReadRight:paramdict]};
|
|
|
+ completionHandler([self convertToJsonData:dict]);
|
|
|
+ }else if (type && [type isEqualToString:@"checkLocationPermission"]) {
|
|
|
+ NSDictionary *dict = @{@"type":@"int",
|
|
|
+ @"value":[NSString stringWithFormat:@"%d",[self jsCheckLocationPermission:paramdict]]
|
|
|
+ };
|
|
|
+ completionHandler([self convertToJsonData:dict]);
|
|
|
+ }else {
|
|
|
+ completionHandler(@"");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//通过js alert 显示一个警告面板,调用原生会走此方法。
|
|
|
+- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler
|
|
|
+{
|
|
|
+// NSLog(@"显示一个JavaScript警告面板, message = %@",message);
|
|
|
+ UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"温馨提示" message:message preferredStyle:UIAlertControllerStyleAlert];
|
|
|
+ [alertController addAction:[UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+ completionHandler();
|
|
|
+ }]];
|
|
|
+ [self presentViewController:alertController animated:YES completion:nil];
|
|
|
+}
|
|
|
+//通过 js confirm 显示一个确认面板,调用原生会走此方法。
|
|
|
+- (void)webView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL result))completionHandler
|
|
|
+{
|
|
|
+// NSLog(@"运行JavaScript确认面板, message = %@", message);
|
|
|
+ UIAlertController *action = [UIAlertController alertControllerWithTitle:@"温馨提示" message:message preferredStyle:UIAlertControllerStyleAlert];
|
|
|
+ [action addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+ completionHandler(NO);
|
|
|
+ }] ];
|
|
|
+ [action addAction:[UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+ completionHandler(YES);
|
|
|
+ }]];
|
|
|
+ [self presentViewController:action animated:YES completion:nil];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - OC调JS交互
|
|
|
+-(void)isExitCallToJS:(NSString *)jsStr withMethodName:(NSString *)name{
|
|
|
+ NSString *jsName = [NSString stringWithFormat:@"function exist(){return !window['%@']};exist()",name];
|
|
|
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.15 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
+ WeakSelf;
|
|
|
+ [_webView evaluateJavaScript:jsName completionHandler:^(id _Nullable result, NSError * _Nullable error) {
|
|
|
+// NSLog(@"是否存在 result:%@,error:%@",result,error);
|
|
|
+ if ([result intValue]==0) {
|
|
|
+ [weakSelf executeCallJS:jsStr];
|
|
|
+ }else {
|
|
|
+ NSLog(@"不存在-不存在-不存在-%@",jsStr);
|
|
|
+ }
|
|
|
+ }];
|
|
|
+ });
|
|
|
+}
|
|
|
+-(void)executeCallJS:(NSString *)jsStr {
|
|
|
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.15 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
+ [_webView evaluateJavaScript:jsStr completionHandler:^(id _Nullable result, NSError * _Nullable error) {
|
|
|
+ if (error!=nil) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }];
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
- (void)viewDidLoad {
|
|
|
[super viewDidLoad];
|
|
|
// Do any additional setup after loading the view.
|
|
|
+ NSLog(@"订阅初始化");
|
|
|
+
|
|
|
+
|
|
|
+ self.view.backgroundColor = [UIColor whiteColor];
|
|
|
+ [self.view addSubview:self.webView];
|
|
|
+ [self.view addSubview:self.progressView];
|
|
|
+ [self webViewFirstRequest];
|
|
|
+ [[AFNetworkReachabilityManager sharedManager] startMonitoring];
|
|
|
+ [self initNotification];
|
|
|
+
|
|
|
+ self.recognizer = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(paningGestureReceive:)];
|
|
|
+ [self.recognizer delaysTouchesBegan];
|
|
|
+ [self.view addGestureRecognizer:self.recognizer];
|
|
|
+
|
|
|
+ //监听底部栏
|
|
|
+ [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(bottomTwoListening) userInfo:nil repeats:YES];
|
|
|
+
|
|
|
+
|
|
|
+ [GlobalData shareInstance].isSubToLoad = YES;
|
|
|
+}
|
|
|
+-(void)bottomTwoListening {
|
|
|
+ if(self.tabBarController.selectedIndex == 2) {
|
|
|
+ [self judgeIsHiddenBottom];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - WKNavigationDelegate
|
|
|
+/* 页面加载完成 */
|
|
|
+- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
|
|
|
+
|
|
|
+ NSLog(@"-----页面加载完成%@",webView.URL.absoluteString);
|
|
|
+ //正常的网页加载
|
|
|
+ if (![GlobalData shareInstance].isSubToLoad) {
|
|
|
+ [GlobalData shareInstance].isSubToLoad = YES;
|
|
|
+ }
|
|
|
+ [self judgeIsHiddenBottom];//是否隐藏
|
|
|
+ [self removeNoNetViews];
|
|
|
+ [self removeFailNetViews];
|
|
|
+ [[LXViewControllerManager shareViewControllerManager] hideHud];
|
|
|
+ [self.webView evaluateJavaScript:@"document.documentElement.style.webkitTouchCallout='none';" completionHandler:nil];
|
|
|
+ [self.webView evaluateJavaScript:@"document.documentElement.style.webkitUserSelect='none';"completionHandler:nil];
|
|
|
+
|
|
|
+ //写数据
|
|
|
+// [self writeWKWebData:webView.URL];
|
|
|
+}
|
|
|
+
|
|
|
+-(void)writeWKWebData:(NSURL *)url {
|
|
|
+ //得到NSData 数据
|
|
|
+ NSData *dataContent = [NSData dataWithContentsOfURL:url];
|
|
|
+ //NSURLCache 实例化
|
|
|
+ NSURLCache *cache = [NSURLCache sharedURLCache];
|
|
|
+ //得到相应
|
|
|
+ NSURLResponse *response = [[NSURLResponse alloc]initWithURL:url MIMEType:@"text/html" expectedContentLength:0 textEncodingName:@"UTF-8"];
|
|
|
+ //得到CacheURLResponse
|
|
|
+ NSCachedURLResponse *cacheResponse = [[NSCachedURLResponse alloc]initWithResponse:response data:dataContent];
|
|
|
+ //进行存储
|
|
|
+ [cache storeCachedResponse:cacheResponse forRequest:[NSURLRequest requestWithURL:url]];
|
|
|
+}
|
|
|
+
|
|
|
+// 页面开始加载时调用
|
|
|
+- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{
|
|
|
+ self.recognizer.enabled = NO;
|
|
|
+}
|
|
|
+// 当内容开始返回时调用
|
|
|
+- (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation{
|
|
|
+}
|
|
|
+
|
|
|
+// 页面加载失败时调用
|
|
|
+- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(nonnull NSError *)error{
|
|
|
+
|
|
|
+
|
|
|
+ //加载失败 有网络-弹出页面 , 无网络-记录标记
|
|
|
+ if ([ZKMethod judegeNetworkIsAvailable]) {
|
|
|
+ //弹出页面
|
|
|
+ NSLog(@"页面加载失败-有网络");
|
|
|
+ if (!self.isRuningLoad) {
|
|
|
+ [self addFailNetViews];
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //记录标记
|
|
|
+ NSLog(@"页面加载失败-无网络");
|
|
|
+ isExistNoNewWork = YES;
|
|
|
+ }
|
|
|
+
|
|
|
+ self.recognizer.enabled = YES;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+#pragma mark *****JS与OC交互
|
|
|
+#pragma mark - WKScriptMessageHandler JS调OC交互
|
|
|
+-(void)jsLoginByWeixin:(NSDictionary *)dict {
|
|
|
+ if ([LXUserDefaults isInstallWeiXin] != 1) { // 没有安装微信 不走友盟
|
|
|
+ [[LXViewControllerManager shareViewControllerManager] showHudOnlyText:@"微信登录失败,没有安装微信" delay:1.5];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ [[UMSocialManager defaultManager] getUserInfoWithPlatform:UMSocialPlatformType_WechatSession currentViewController:self completion:^(id result, NSError *error) {
|
|
|
+ UMSocialUserInfoResponse *resp = result;
|
|
|
+ [self dealWXDic:(NSDictionary *)resp.originalResponse];
|
|
|
+ [[LXViewControllerManager shareViewControllerManager] hideHud];
|
|
|
+ }];
|
|
|
+}
|
|
|
+// 处理微信登录获取到的数据
|
|
|
+-(void)dealWXDic:(NSDictionary *)dictionary{
|
|
|
+ [[LXViewControllerManager shareViewControllerManager] showHudText:nil];
|
|
|
+ //如果获取到用户信息,即用户点击了“登录”,则进行用户信息获取
|
|
|
+ if (dictionary.count > 0) {
|
|
|
+ NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithDictionary:dictionary];
|
|
|
+ if (dic) {
|
|
|
+ [dic removeObjectForKey:@"privilege"];
|
|
|
+ [dic removeObjectForKey:@"language"];
|
|
|
+ double currDouble = [[NSDate date] timeIntervalSince1970];
|
|
|
+ [dic setObject:[NSNumber numberWithLong:(long)currDouble] forKey:@"createtime"];
|
|
|
+ // 拼接标志位
|
|
|
+ NSString *sign = [NSString stringWithFormat:@"city=%@&country=%@&createtime=%@&headimgurl=%@&nickname=%@&openid=%@&province=%@&sex=%@&unionid=%@", dic[@"city"], dic[@"country"], dic[@"createtime"], dic[@"headimgurl"], dic[@"nickname"], dic[@"openid"], dic[@"province"],dic[@"sex"],dic[@"unionid"]];
|
|
|
+ sign = [LXMD5 md532BitLower:sign];
|
|
|
+ [dic setObject:sign forKey:@"sign"];
|
|
|
+ NSString *endStr = [[LXViewControllerManager shareViewControllerManager] getJsonStr:dic];
|
|
|
+ NSData *data = [endStr dataUsingEncoding:NSUTF8StringEncoding];
|
|
|
+ endStr = [data base64EncodedStringWithOptions:0];
|
|
|
+ [self isExitCallToJS:[NSString stringWithFormat:@"loginByWeixinCallBack('%@')", endStr] withMethodName:@"loginByWeixinCallBack"];
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+-(void)jsShare:(NSDictionary *)dict {
|
|
|
+ NSString *type = [NSString stringWithFormat:@"%@",dict[@"type"]];
|
|
|
+ NSString *title = [NSString stringWithFormat:@"%@",dict[@"title"]];
|
|
|
+ NSString *content = [NSString stringWithFormat:@"%@",dict[@"content"]];
|
|
|
+ NSString *link = [NSString stringWithFormat:@"%@",dict[@"link"]];
|
|
|
+ UMSocialPlatformType shareType;
|
|
|
+ if ([type intValue] == 1) { // 微信好友
|
|
|
+ shareType = UMSocialPlatformType_WechatSession;
|
|
|
+ }else if ([type intValue] == 2){ /// qq好友
|
|
|
+ shareType = UMSocialPlatformType_QQ;
|
|
|
+ }else if ([type intValue] == 3){ // 朋友圈
|
|
|
+ shareType = UMSocialPlatformType_WechatTimeLine;
|
|
|
+ }else{
|
|
|
+ shareType = UMSocialPlatformType_WechatSession;
|
|
|
+ }
|
|
|
+ if ([type intValue] == 1 || [type intValue] == 3) {
|
|
|
+ if ([LXUserDefaults isInstallWeiXin] != 1) {
|
|
|
+ [[LXViewControllerManager shareViewControllerManager] showHudOnlyText:@"没有安装微信" delay:1.5];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ([type intValue] == 2) {
|
|
|
+ if (![[UMSocialManager defaultManager] isInstall:UMSocialPlatformType_QQ]) {
|
|
|
+ [[LXViewControllerManager shareViewControllerManager] showHudOnlyText:@"没有安装QQ" delay:1.5];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //创建分享消息对象
|
|
|
+ UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
|
|
|
+ //创建网页内容对象
|
|
|
+ UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:title descr:content thumImage:[UIImage imageNamed:@"logo"]];
|
|
|
+ //设置网页地址
|
|
|
+ shareObject.webpageUrl = link;
|
|
|
+ messageObject.shareObject = shareObject;
|
|
|
+ //调用分享接口
|
|
|
+ [[UMSocialManager defaultManager] shareToPlatform:shareType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {
|
|
|
+ if (error) {
|
|
|
+ if (error.userInfo[@"message"] && [error.userInfo[@"message"] containsString:@"Operation is cancel"]) {
|
|
|
+ [[LXViewControllerManager shareViewControllerManager] showHudOnlyText:@"取消分享" delay:1];
|
|
|
+ }else{
|
|
|
+ [[LXViewControllerManager shareViewControllerManager] showHudOnlyText:error.userInfo[@"message"] delay:1];
|
|
|
+ }
|
|
|
+ [self isExitCallToJS:[NSString stringWithFormat:@"shareCallBack('%@','%@')",type,@"0"] withMethodName:@"shareCallBack"];
|
|
|
+ }else{
|
|
|
+ if ([data isKindOfClass:[UMSocialShareResponse class]]) {
|
|
|
+ [self isExitCallToJS:[NSString stringWithFormat:@"shareCallBack('%@','%@')",type,@"1"] withMethodName:@"shareCallBack"];
|
|
|
+ }else{
|
|
|
+ UMSocialLogInfo(@"response data is %@",data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
+-(void)jsSaveUserToken:(NSDictionary *)dict{
|
|
|
+ [[LXViewControllerManager shareViewControllerManager] hideHud];
|
|
|
+ [LXUserDefaults saveToken:[NSString stringWithFormat:@"%@",dict[@"token"]]];
|
|
|
+}
|
|
|
+-(NSString *)jsGetUserToken:(NSDictionary *)dict{
|
|
|
+ return [LXUserDefaults token];
|
|
|
+}
|
|
|
+-(void)jsRemoveUserToken:(NSDictionary *)dict{
|
|
|
+ [LXUserDefaults clearAll];
|
|
|
+}
|
|
|
+-(int)jsCheckNoticePermission:(NSDictionary *)dict{
|
|
|
+ if ([[UIApplication sharedApplication] currentUserNotificationSettings].types != UIUserNotificationTypeNone) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+// 跳转到系统设置
|
|
|
+-(void)jsOpenSystemNotification:(NSDictionary *)dict{
|
|
|
+ kMainQueue(^{
|
|
|
+ [[UIApplication sharedApplication]openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
|
|
|
+ });
|
|
|
+}
|
|
|
+// 获取推送id
|
|
|
+-(NSString *)jsGetPushRid:(NSDictionary *)dict{
|
|
|
+ return [LXUserDefaults grpcPushID];
|
|
|
+}
|
|
|
+// 打开新页面 加载新web
|
|
|
+-(void)JsOpenExternalLink:(NSDictionary *)dict{
|
|
|
+ NSString *url = [NSString stringWithFormat:@"%@",dict[@"url"]];
|
|
|
+ NSString *title = [NSString stringWithFormat:@"%@",dict[@"title"]];
|
|
|
+ if (url) {
|
|
|
+ if ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable || [AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusUnknown) {
|
|
|
+ }
|
|
|
+ JYWKNewWebController *ctr = [[JYWKNewWebController alloc] init];
|
|
|
+ ctr.url = url;
|
|
|
+ if (!title || [title isEqualToString:@""] || [title isEqualToString:@"undefined"]) {
|
|
|
+ ctr.titleShow = nil;
|
|
|
+ }else{
|
|
|
+ ctr.titleShow = title;
|
|
|
+ }
|
|
|
+ kMainQueue(^{
|
|
|
+ [self presentViewController:ctr animated:NO completion:nil];
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 获取当前版本号
|
|
|
+-(NSString *)jsGetVersion:(NSDictionary *)dict{
|
|
|
+ return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
|
|
|
+}
|
|
|
+-(void)jsAlert:(NSDictionary *)dict{
|
|
|
+ [[LXViewControllerManager shareViewControllerManager] showAlertViewWithMessage:[NSString stringWithFormat:@"%@",dict[@"content"]]];
|
|
|
+}
|
|
|
+-(int)jsIsInstallWeixin:(NSDictionary *)dict{
|
|
|
+ return [LXUserDefaults isInstallWeiXin];
|
|
|
+}
|
|
|
+-(NSString *)jsGetCipherText:(NSDictionary *)dict{
|
|
|
+ NSDictionary *objDict = [NSDictionary dictionaryWithDictionary:dict[@"arguments"]];
|
|
|
+ NSString *phone = [NSString stringWithFormat:@"%@",objDict[@"phone"]];
|
|
|
+ NSDate *date=[NSDate date];
|
|
|
+ NSDateFormatter *format1=[[NSDateFormatter alloc] init];
|
|
|
+ [format1 setDateFormat:@"yyyyMMddhhmmss"];
|
|
|
+ NSString *dateStr;
|
|
|
+ dateStr=[format1 stringFromDate:date];
|
|
|
+ NSLog(@"%@",dateStr);
|
|
|
+
|
|
|
+ NSString *content = [[NSString stringWithFormat:@"%@_%@",phone,dateStr] stringByAppendingString:[NSString stringWithFormat:@"_%@",[LXMD5 md532BitLower:[NSString stringWithFormat:@"%@&%@",phone,dateStr]]]];
|
|
|
+ NSData *contentData = [content dataUsingEncoding:NSUTF8StringEncoding];
|
|
|
+ NSUInteger dataLength = contentData.length;
|
|
|
+ // 为结束符'\\0' +1
|
|
|
+ char keyPtr[new_kKeySize_5 + 1];
|
|
|
+ memset(keyPtr, 0, sizeof(keyPtr));
|
|
|
+ [new_AesKey_5 getCString:keyPtr maxLength:sizeof(keyPtr) encoding:NSUTF8StringEncoding];
|
|
|
+ // 密文长度 <= 明文长度 + BlockSize
|
|
|
+ size_t encryptSize = dataLength + kCCBlockSizeAES128;
|
|
|
+ void *encryptedBytes = malloc(encryptSize);
|
|
|
+ size_t actualOutSize = 0;
|
|
|
+ NSData *initVector = [new_kInitVector_5 dataUsingEncoding:NSUTF8StringEncoding];
|
|
|
+ CCCryptorStatus cryptStatus = CCCrypt(kCCEncrypt,
|
|
|
+ kCCAlgorithmAES,
|
|
|
+ kCCOptionPKCS7Padding, // 系统默认使用 CBC,然后指明使用 PKCS7Padding
|
|
|
+ keyPtr,
|
|
|
+ new_kKeySize_5,
|
|
|
+ initVector.bytes,
|
|
|
+ contentData.bytes,
|
|
|
+ dataLength,
|
|
|
+ encryptedBytes,
|
|
|
+ encryptSize,
|
|
|
+ &actualOutSize);
|
|
|
+ if (cryptStatus == kCCSuccess) {
|
|
|
+ // 对加密后的数据进行 base64 编码
|
|
|
+ return [[NSData dataWithBytesNoCopy:encryptedBytes length:actualOutSize] base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed];
|
|
|
+ }
|
|
|
+ free(encryptedBytes);
|
|
|
+ return nil;
|
|
|
+}
|
|
|
+
|
|
|
+-(void)jsHiddenBottom:(NSDictionary *)dict{
|
|
|
+ if(self.tabBarController.selectedIndex == 2) {
|
|
|
+ if([[NSString stringWithFormat:@"%@",dict[@"hidden"]] integerValue]==0) {
|
|
|
+ [self hideTabBar];
|
|
|
+ [self hiddenMethodTabBar];
|
|
|
+ }else {
|
|
|
+ [self showTabBar];
|
|
|
+ [self showMethodTabBar];
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+-(void)jsCheckLab:(NSDictionary *)dict {
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:RefreshNonCurVC object:nil userInfo:nil];
|
|
|
+}
|
|
|
+
|
|
|
+//js方法登录成功
|
|
|
+-(void)jsLoginSuccess:(NSDictionary *)dict {
|
|
|
+ NSLog(@"sub登录成功提示");
|
|
|
+ NSString *status = [NSString stringWithFormat:@"%@",dict[@"status"]];
|
|
|
+ [GlobalData shareInstance].isReLogin = YES;
|
|
|
+ if([status isEqualToString:@"S"]) {
|
|
|
+ kMainQueue(^{
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:RefreshAllVC object:nil userInfo:nil];
|
|
|
+ AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
+ JYTabBarController *tab = (JYTabBarController *)delegate.window.rootViewController;
|
|
|
+ tab.selectedIndex = 0;
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //弹出页面
|
|
|
+ if ([GlobalData shareInstance].isPasteLogin) {
|
|
|
+ [GlobalData shareInstance].isPasteLogin = NO;
|
|
|
+ NSString *content = [UIPasteboard generalPasteboard].string;
|
|
|
+ [self popPasteVIew:content];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+-(void)jsBackUrl:(NSDictionary *)dict {
|
|
|
+ NSString *status = [NSString stringWithFormat:@"%@",dict[@"status"]];
|
|
|
+ NSLog(@"sub返回");
|
|
|
+ if([status isEqualToString:@"H"]) {
|
|
|
+ //测试返回首页
|
|
|
+ kMainQueue(^{
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:RefreshAllVC object:nil userInfo:nil];
|
|
|
+ AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
+ JYTabBarController *tab = (JYTabBarController *)delegate.window.rootViewController;
|
|
|
+ tab.selectedIndex = 0;
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+-(void)jsClearPushMessage:(NSDictionary *)dict {
|
|
|
+ kMainQueue(^{
|
|
|
+ [[UIApplication sharedApplication] setApplicationIconBadgeNumber:1];
|
|
|
+ [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+-(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:3];
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+-(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:3];
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+-(void)jsWxPay:(NSDictionary *)dict {
|
|
|
+ if (![LXUserDefaults isInstallWeiXin]) { [[LXViewControllerManager shareViewControllerManager] showHudOnlyText:@"请先安装微信再进行支付!" delay:1.5];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ NSString *jsonString = [NSString stringWithFormat:@"%@",dict[@"order"]];
|
|
|
+
|
|
|
+ NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
|
|
|
+ NSError *err;
|
|
|
+ NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&err];
|
|
|
+ if(err) {
|
|
|
+ NSLog(@"json解析失败:%@",err);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //吊起微信
|
|
|
+ PayReq *request = [[PayReq alloc] init] ;
|
|
|
+ request.openID = dic[@"Appid"];
|
|
|
+ request.partnerId = dic[@"Partnerid"];
|
|
|
+ request.prepayId= dic[@"Prepayid"];
|
|
|
+ request.package = @"Sign=WXPay";
|
|
|
+ request.nonceStr= dic[@"Noncestr"];
|
|
|
+ request.timeStamp= [dic[@"Timestamp"] intValue];
|
|
|
+ request.sign= dic[@"Sign"];
|
|
|
+
|
|
|
+ kMainQueue(^{
|
|
|
+ [WXApi sendReq:request completion:^(BOOL success) {
|
|
|
+
|
|
|
+ }];
|
|
|
+ });
|
|
|
+}
|
|
|
+-(void)jsAliPay:(NSDictionary *)dict {
|
|
|
+ if (![LXUserDefaults isInstallAli]) {
|
|
|
+ [[LXViewControllerManager shareViewControllerManager] showHudOnlyText:@"请先安装支付宝再进行支付!" delay:1.5];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ NSString *order = [NSString stringWithFormat:@"%@",dict[@"order"]];
|
|
|
+ kMainQueue(^{
|
|
|
+ [[AlipaySDK defaultService] payOrder:order fromScheme:@"jianyuiosapp" callback:nil];
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+-(NSString *)jsGetOtherPushRid:(NSDictionary *)dict {
|
|
|
+ return [LXUserDefaults deviceToken];
|
|
|
+}
|
|
|
+-(NSString *)jsGetPhoneBrand:(NSDictionary *)dict {
|
|
|
+ UIDevice *device = [UIDevice currentDevice];
|
|
|
+ return device.platformString;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+//拍照上传图片
|
|
|
+-(void)jsSkipCameraWithParam:(NSDictionary *)dict {
|
|
|
+ [GlobalData shareInstance].isSkipPath = [NSString stringWithFormat:@"%@",dict[@"type"]];
|
|
|
+
|
|
|
+ UIImagePickerController *picker = [[UIImagePickerController alloc] init];
|
|
|
+ picker.delegate = self;
|
|
|
+ picker.allowsEditing = YES;
|
|
|
+ picker.sourceType = UIImagePickerControllerSourceTypeCamera;
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [self presentViewController:picker animated:YES completion:nil];
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+//相册选择照片
|
|
|
+-(void)jsSkipAlbumWithParam:(NSDictionary *)dict {
|
|
|
+ [GlobalData shareInstance].isSkipPath = [NSString stringWithFormat:@"%@",dict[@"type"]];
|
|
|
+
|
|
|
+ UIImagePickerController *picker = [[UIImagePickerController alloc] init];
|
|
|
+ picker.delegate = self;
|
|
|
+ picker.allowsEditing = YES;
|
|
|
+ picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [self presentViewController:picker animated:YES completion:nil];
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+-(void)jsOpenActivityPage:(NSDictionary *)dict {
|
|
|
+ NSDictionary * infoDic = @{@"url":[NSString stringWithFormat:@"%@",dict[@"url"]],
|
|
|
+ @"rectype":[NSString stringWithFormat:@"%@",dict[@"rectype"]],
|
|
|
+ @"openid":[NSString stringWithFormat:@"%@",dict[@"openid"]],
|
|
|
+ };
|
|
|
+ //post请求
|
|
|
+ NSLog(@"%@",[NSString stringWithFormat:@"%@jyapp/free/message/receive",kHost]);
|
|
|
+ [[LXNetworkManager shareLXNetworkManager]postWithURLStr:[NSString stringWithFormat:@"%@jyapp/free/message/receive",kHost] parameters:infoDic progress:^(NSProgress *progress) {
|
|
|
+ NSLog(@"成功:%@",progress);
|
|
|
+ } success:^(id responseObject) {
|
|
|
+ NSLog(@"responseObject=%@",responseObject);
|
|
|
+ } failure:^(NSError *error) {
|
|
|
+ NSLog(@"error=%@",error);
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+//拨打电话
|
|
|
+-(void)jsCallPhone:(NSDictionary *)dict {
|
|
|
+ NSString *phone = [NSString stringWithFormat:@"%@",dict[@"phone"]];
|
|
|
+ NSMutableString *tel = [[NSMutableString alloc]initWithFormat:@"telprompt://%@",phone];
|
|
|
+ if (@available(iOS 10.0, *)) {
|
|
|
+ [[UIApplication sharedApplication] openURL:[NSURL URLWithString:tel] options:@{} completionHandler:^(BOOL success) {
|
|
|
+ }];
|
|
|
+ } else {
|
|
|
+ // Fallback on earlier versions
|
|
|
+ [[UIApplication sharedApplication] openURL:[NSURL URLWithString:tel]];
|
|
|
+ }
|
|
|
+}
|
|
|
+//打开其他app 抖音+快手
|
|
|
+-(void)jsOpenOtherAppLinks:(NSDictionary *)dict {
|
|
|
+ //测试跳转抖音--快手 @"gifshow://" @"snssdk1128://"
|
|
|
+ NSString *appLink = [NSString stringWithFormat:@"%@",dict[@"appLink"]];
|
|
|
+ NSString *appName = [NSString stringWithFormat:@"%@",dict[@"appName"]];
|
|
|
+ NSLog(@"appName:%@",appName);
|
|
|
+ NSURL *url = [NSURL URLWithString:appLink];
|
|
|
+ if ([[UIApplication sharedApplication] canOpenURL:url]) {
|
|
|
+ if ([[UIApplication sharedApplication] respondsToSelector:@selector(openURL:options:completionHandler:)]) {
|
|
|
+ //iOS 10.0+
|
|
|
+ NSLog(@"iOS 10+");
|
|
|
+ if (@available(iOS 10.0, *)) {
|
|
|
+ [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) {
|
|
|
+ if (!success) {
|
|
|
+ [[LXViewControllerManager shareViewControllerManager] showHudOnlyText:appName delay:2];
|
|
|
+ }
|
|
|
+ }];
|
|
|
+ } else {
|
|
|
+ // Fallback on earlier versions
|
|
|
+ [[UIApplication sharedApplication] openURL:url];
|
|
|
+ }
|
|
|
+
|
|
|
+ }else{
|
|
|
+ NSLog(@"iOS 2~10");
|
|
|
+ //iOS 2~10
|
|
|
+ [[UIApplication sharedApplication] openURL:url];
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ //一般是没有安装
|
|
|
+ NSLog(@"跳转下载app链接");
|
|
|
+ [[LXViewControllerManager shareViewControllerManager] showHudOnlyText:appName delay:2];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark *****人脸核身
|
|
|
+//ocr验证
|
|
|
+-(void)jsOcrVerifyService:(NSDictionary *)dict{
|
|
|
+ NSLog(@"ocr:%@",dict);
|
|
|
+ NSString *orderNo = [NSString stringWithFormat:@"%@",dict[@"orderNo"]];
|
|
|
+ NSString *nonce = [NSString stringWithFormat:@"%@",dict[@"nonce"]];
|
|
|
+ NSString *userId = [NSString stringWithFormat:@"%@",dict[@"userId"]];
|
|
|
+ NSString *sign = [NSString stringWithFormat:@"%@",dict[@"sign"]];
|
|
|
+ kMainQueue((^{
|
|
|
+ WBOCRConfig *config = [WBOCRConfig sharedConfig];
|
|
|
+ config.needRecordVideo = NO;
|
|
|
+ config.SDKType = WBOCRSDKTypeIDCardNormal; // 身份证两面识别
|
|
|
+ [[WBOCRService sharedService] startOCRServiceWithConfig:config version:@"1.0.0" appId:OCRAPPID nonce:nonce userId:userId sign:sign orderNo:orderNo startSucceed:^{
|
|
|
+ /** SDK服务拉起成功回调 */
|
|
|
+ NSLog(@"启动SDK成功!!!");
|
|
|
+ } recognizeSucceed:^(id _Nonnull resultModel, id _Nullable extension) {
|
|
|
+ /** SDK本次识别成功回调 */
|
|
|
+ NSLog(@"SDK识别成功!!!");
|
|
|
+ //调用js - 告知成功
|
|
|
+ NSString *textJS = [NSString stringWithFormat:@"ocrVerifyResult('%@')",orderNo];
|
|
|
+ [self isExitCallToJS:textJS withMethodName:@"ocrVerifyResult"];
|
|
|
+ } failed:^(NSError * _Nonnull error, id _Nullable extension) {
|
|
|
+ /** SDK异常回调 */
|
|
|
+ NSLog(@"识别出错!!!"); //200101 用户取消操作
|
|
|
+ //弹出页面
|
|
|
+ if (error.code == 200101) {
|
|
|
+ self.verifyMsgView.descTitle = @"您取消了身份验证";
|
|
|
+ }else {
|
|
|
+ self.verifyMsgView.descTitle = @"身份验证失败";
|
|
|
+ }
|
|
|
+ [self.verifyMsgView show];
|
|
|
+
|
|
|
+ NSString *textJS = [NSString stringWithFormat:@"ocrVerifyResult('%@')",@""];
|
|
|
+ [self isExitCallToJS:textJS withMethodName:@"ocrVerifyResult"];
|
|
|
+
|
|
|
+ }];
|
|
|
+ }));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
+//人脸核身
|
|
|
+-(void)jsFaceVerifyService:(NSDictionary *)dict {
|
|
|
+ NSLog(@"face:%@",dict);
|
|
|
+ NSString *orderNo = [NSString stringWithFormat:@"%@",dict[@"orderNo"]];
|
|
|
+ NSString *nonce = [NSString stringWithFormat:@"%@",dict[@"nonce"]];
|
|
|
+ NSString *userId = [NSString stringWithFormat:@"%@",dict[@"userId"]];
|
|
|
+ NSString *sign = [NSString stringWithFormat:@"%@",dict[@"sign"]];
|
|
|
+ NSString *faceId = [NSString stringWithFormat:@"%@",dict[@"faceId"]];
|
|
|
+ kMainQueue((^{
|
|
|
+ [WBFaceVerifyCustomerService sharedInstance].delegate = self;
|
|
|
+ WBFaceVerifySDKConfig *config = [WBFaceVerifySDKConfig sdkConfig];
|
|
|
+ config.recordVideo = NO;
|
|
|
+ config.theme = WBFaceVerifyThemeDarkness;
|
|
|
+ [[WBFaceVerifyCustomerService sharedInstance] loginInLiveCheckAndCompareWithSourceImageService:userId nonce:nonce sign:sign appid:OCRAPPID orderNo:orderNo apiVersion:@"1.0.0" licence:LICENCE faceType:WBFaceVerifyLivingType_Action faceId:faceId sdkConfig:config success:^{
|
|
|
+
|
|
|
+ } failure:^(WBFaceError * _Nonnull error) {
|
|
|
+
|
|
|
+ }];
|
|
|
+ }));
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - WBFaceVerifyCustomerServiceDelegate
|
|
|
+-(void)wbfaceVerifyCustomerServiceDidFinishedWithFaceVerifyResult:(WBFaceVerifyResult *)faceVerifyResult{
|
|
|
+ if (faceVerifyResult.isSuccess) {
|
|
|
+ NSLog(@"活体检测成功:%@",faceVerifyResult.orderNo);
|
|
|
+ NSString *textJS = [NSString stringWithFormat:@"faceVerifyResult('%@')",faceVerifyResult.orderNo];
|
|
|
+ [self isExitCallToJS:textJS withMethodName:@"faceVerifyResult"];
|
|
|
+ self.verifyMsgView.descTitle = @"活体检测成功";
|
|
|
+ [self.verifyMsgView show];
|
|
|
+ }else {
|
|
|
+ NSLog(@"活体检测失败");
|
|
|
+ self.verifyMsgView.descTitle = @"活体检测失败";
|
|
|
+ [self.verifyMsgView show];
|
|
|
+
|
|
|
+ NSString *textJS = [NSString stringWithFormat:@"faceVerifyResult('%@')",@""];
|
|
|
+ [self isExitCallToJS:textJS withMethodName:@"faceVerifyResult"];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+//保存图片到相册
|
|
|
+#pragma mark 保存图片
|
|
|
+-(void)jsSavePic:(NSDictionary *)dict {
|
|
|
+ NSString *base64ImgData = [NSString stringWithFormat:@"%@",dict[@"imgbase64"]];
|
|
|
+ base64ImgData = [base64ImgData stringByReplacingOccurrencesOfString:@"data:image/png;base64," withString:@""];
|
|
|
+ NSData *data = [[NSData alloc]initWithBase64EncodedString:base64ImgData options:NSDataBase64DecodingIgnoreUnknownCharacters];
|
|
|
+ UIImage *saveImg = [UIImage imageWithData:data];
|
|
|
+ UIImageWriteToSavedPhotosAlbum(saveImg, self, @selector(image:didFinishSavingWithError:contextInfo:), NULL);
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 系统的完成保存图片的方法
|
|
|
+- (void)image: (UIImage *) image didFinishSavingWithError: (NSError *) error contextInfo: (void *) contextInfo
|
|
|
+{
|
|
|
+ NSString *msg = nil ;
|
|
|
+ if (error != NULL) {
|
|
|
+ msg = @"保存图片失败" ;
|
|
|
+ } else {
|
|
|
+ msg = @"保存图片成功" ;
|
|
|
+ }
|
|
|
+ [[LXViewControllerManager shareViewControllerManager] showHudOnlyText:msg delay:1];
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+#pragma mark 粘贴板
|
|
|
+-(void)jsWirteRight:(NSDictionary *)dict {
|
|
|
+ NSString *txt = [NSString stringWithFormat:@"%@",dict[@"txt"]];
|
|
|
+ [[UIPasteboard generalPasteboard]setString:txt];
|
|
|
+}
|
|
|
+-(void)jsClearRight:(NSDictionary *)dict {
|
|
|
+ //清粘贴板数据
|
|
|
+ [[UIPasteboard generalPasteboard]setString:@""];
|
|
|
+}
|
|
|
+-(NSString *)jsReadRight:(NSDictionary *)dict {
|
|
|
+ NSString *content = [UIPasteboard generalPasteboard].string;
|
|
|
+ return content;
|
|
|
+}
|
|
|
+
|
|
|
+//返回定位可用信息
|
|
|
+-(int)jsCheckLocationPermission:(NSDictionary *)dict {
|
|
|
+ if ([CLLocationManager locationServicesEnabled]) {
|
|
|
+ if ([CLLocationManager authorizationStatus]!= kCLAuthorizationStatusDenied) {
|
|
|
+ if ([CLLocationManager authorizationStatus]==kCLAuthorizationStatusNotDetermined) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+//内购VIP
|
|
|
+-(void)jsInPurchasingVip:(NSDictionary *)dict {
|
|
|
+ NSString *productid = [NSString stringWithFormat:@"%@",dict[@"productid"]];
|
|
|
+ //产品id
|
|
|
+ if ([productid isEqualToString:@""]) {
|
|
|
+ NSLog(@"订单号 有问题");
|
|
|
+ [[LXViewControllerManager shareViewControllerManager] showHudOnlyText:@"订单号异常,请重试" delay:1];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ [[LXViewControllerManager shareViewControllerManager] showHudText:@"苹果验证中,请稍候"];
|
|
|
+ if([SKPaymentQueue canMakePayments]){
|
|
|
+ [self requestProductData:productid];
|
|
|
+ }else{
|
|
|
+// [[LXViewControllerManager shareViewControllerManager]showHudOnlyText:@"不允许程序内付费" delay:1];
|
|
|
+ [[LXViewControllerManager shareViewControllerManager] hideHud];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//去苹果服务器请求商品
|
|
|
+- (void)requestProductData:(NSString *)type {
|
|
|
+ NSArray *product = [[NSArray alloc] initWithObjects:type,nil];
|
|
|
+ NSSet *nsset = [NSSet setWithArray:product];
|
|
|
+ SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers:nsset];
|
|
|
+ request.delegate = self;
|
|
|
+ [request start];
|
|
|
+}
|
|
|
+- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
|
|
|
+ NSArray *myProduct = response.products;
|
|
|
+ if (myProduct.count == 0) {
|
|
|
+ NSLog(@"无法获取产品信息,购买失败。");
|
|
|
+ [[LXViewControllerManager shareViewControllerManager]showHudOnlyText:@"暂时未获取到产品信息,请重试" delay:1];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ SKPayment * payment = [SKPayment paymentWithProduct:myProduct[0]];
|
|
|
+ [[SKPaymentQueue defaultQueue] addPayment:payment];
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+//切换模块
|
|
|
+-(void)jsSkipAppointTab:(NSDictionary *)dict {
|
|
|
+ if(self.tabBarController.selectedIndex == 2) {
|
|
|
+ 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:@"box"]) {
|
|
|
+ tab.selectedIndex = 2;//切换底部栏
|
|
|
+ }else if ([name isEqualToString:@"me"]) {
|
|
|
+ tab.selectedIndex = 3;//切换底部栏
|
|
|
+ }else {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//刷新模块页面
|
|
|
+-(void)jsRefreshAppointTab:(NSDictionary *)dict {
|
|
|
+ if(self.tabBarController.selectedIndex == 2) {
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:JYRefreshMenusView object:nil userInfo:dict];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+#pragma mark *****其他方法
|
|
|
+-(void)judgeIsHiddenBottom {
|
|
|
+ if(self.tabBarController.selectedIndex == 2) {
|
|
|
+ NSString *current_url = [self stringByEvaluatingJavaScriptFromString:@"document.location.href"];
|
|
|
+
|
|
|
+ if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/swordfish/historypush",kHost]]||[current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/free/login?back=index",kHost]]){
|
|
|
+ [self showTabBar];
|
|
|
+ [self showMethodTabBar];
|
|
|
+ }else {
|
|
|
+ [self hideTabBar];
|
|
|
+ [self hiddenMethodTabBar];
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+- (void)hideTabBar {
|
|
|
+ kMainQueue(^{
|
|
|
+ if (self.tabBarController.tabBar.hidden == YES) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ UIView *contentView;
|
|
|
+ if ( [[self.tabBarController.view.subviews objectAtIndex:0] isKindOfClass:[UITabBar class]] )
|
|
|
+ contentView = [self.tabBarController.view.subviews objectAtIndex:1];
|
|
|
+ else
|
|
|
+ contentView = [self.tabBarController.view.subviews objectAtIndex:0];
|
|
|
+ contentView.frame = CGRectMake(contentView.bounds.origin.x, contentView.bounds.origin.y, contentView.bounds.size.width, contentView.bounds.size.height + self.tabBarController.tabBar.frame.size.height);
|
|
|
+ self.tabBarController.tabBar.hidden = YES;
|
|
|
+ });
|
|
|
+}
|
|
|
+- (void)showTabBar{
|
|
|
+ kMainQueue(^{
|
|
|
+ if (self.tabBarController.tabBar.hidden == NO)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ UIView *contentView;
|
|
|
+ if ([[self.tabBarController.view.subviews objectAtIndex:0] isKindOfClass:[UITabBar class]])
|
|
|
+
|
|
|
+ contentView = [self.tabBarController.view.subviews objectAtIndex:1];
|
|
|
+
|
|
|
+ else
|
|
|
+
|
|
|
+ contentView = [self.tabBarController.view.subviews objectAtIndex:0];
|
|
|
+ contentView.frame = CGRectMake(contentView.bounds.origin.x, contentView.bounds.origin.y, contentView.bounds.size.width, contentView.bounds.size.height - self.tabBarController.tabBar.frame.size.height);
|
|
|
+ self.tabBarController.tabBar.hidden = NO;
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script
|
|
|
+{
|
|
|
+ __block NSString *resultString = nil;
|
|
|
+ __block BOOL finished = NO;
|
|
|
+
|
|
|
+ [self.webView evaluateJavaScript:script completionHandler:^(id result, NSError *error) {
|
|
|
+ if (error == nil) {
|
|
|
+ if (result != nil) {
|
|
|
+ resultString = [NSString stringWithFormat:@"%@", result];
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ NSLog(@"evaluateJavaScript error : %@", error.localizedDescription);
|
|
|
+ }
|
|
|
+ finished = YES;
|
|
|
+ }];
|
|
|
+
|
|
|
+ while (!finished) {
|
|
|
+ [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
|
|
|
+ }
|
|
|
+ return resultString;
|
|
|
+}
|
|
|
+
|
|
|
+-(void)hiddenMethodTabBar
|
|
|
+{
|
|
|
+ kMainQueue(^{
|
|
|
+ if (iPhoneX) {
|
|
|
+ if (@available(iOS 11.0, *)) {
|
|
|
+ self.webView.frame = CGRectMake(0, 0, WIDTH, HEIGHT);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ self.webView.frame = CGRectMake(0, -STATUS_BAR_HEIGHT, WIDTH, HEIGHT+STATUS_BAR_HEIGHT);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+-(void)showMethodTabBar
|
|
|
+{
|
|
|
+ kMainQueue(^{
|
|
|
+ if (iPhoneX) {
|
|
|
+ if (@available(iOS 11.0, *)) {
|
|
|
+ self.webView.frame = CGRectMake(0, 0, WIDTH, HEIGHT-TAB_BAR_HEIGHT);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ self.webView.frame = CGRectMake(0, -STATUS_BAR_HEIGHT, WIDTH, HEIGHT-TAB_BAR_HEIGHT+STATUS_BAR_HEIGHT);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+//取消获取照片
|
|
|
+- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
|
|
|
+{
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [picker dismissViewControllerAnimated:YES completion:^{
|
|
|
+ [self uploadUrl:@""];
|
|
|
+ }];
|
|
|
+ });
|
|
|
+}
|
|
|
+//上传图片
|
|
|
+-(void)uploadPic:(NSData *)data
|
|
|
+{
|
|
|
+ NSString *isPath = @"courseFile";
|
|
|
+ if (![[GlobalData shareInstance].isSkipPath isEqualToString:@""]) {
|
|
|
+ isPath = [GlobalData shareInstance].isSkipPath;
|
|
|
+ }
|
|
|
+ NSDictionary * body = @{@"type":isPath};
|
|
|
+ AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
|
|
|
+ //ContentType设置
|
|
|
+ manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/html",@"image/jpeg",@"image/png",@"application/octet-stream",@"text/json",@"text/plain",nil];
|
|
|
+ manager.responseSerializer= [AFHTTPResponseSerializer serializer];
|
|
|
+ manager.requestSerializer = [AFHTTPRequestSerializer serializer];
|
|
|
+ manager.requestSerializer.timeoutInterval = 15.0f;
|
|
|
+ [manager POST:[NSString stringWithFormat:@"%@jyapp/filemanage/upload",kHost] parameters:body constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
|
|
|
+ //上传的参数(上传图片,以文件流的格式)
|
|
|
+ [formData appendPartWithFileData:data
|
|
|
+ name:isPath
|
|
|
+ fileName:[isPath stringByAppendingFormat:@".jpeg"]
|
|
|
+ mimeType:@"image/jpeg"];
|
|
|
+ } progress:^(NSProgress * _Nonnull uploadProgress) {
|
|
|
+
|
|
|
+ CGFloat progress = 100.0 * uploadProgress.completedUnitCount / uploadProgress.totalUnitCount;
|
|
|
+ NSLog(@"%.2lf%%", progress);
|
|
|
+ } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
|
+ //请求成功的block回调
|
|
|
+
|
|
|
+ NSDictionary * dic = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil];
|
|
|
+ NSLog(@"上传成功%@",dic);
|
|
|
+
|
|
|
+ if ([dic[@"msg"] isEqualToString:@"ssss"]) {
|
|
|
+ [self uploadUrl:dic[@"url"]];
|
|
|
+ }else{
|
|
|
+ [self uploadUrl:@""];
|
|
|
+ }
|
|
|
+
|
|
|
+ } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
|
|
+
|
|
|
+ NSLog(@"上传失败%@",error);
|
|
|
+ [self uploadUrl:@""];
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+-(void)uploadUrl:(NSString *)url {
|
|
|
+ NSString *textJS = [NSString new];
|
|
|
+ NSString *methodJS = [NSString new];
|
|
|
+
|
|
|
+ if ([url isEqualToString:@""]) {
|
|
|
+ textJS = @"hiddenLoading()";
|
|
|
+ methodJS =@"hiddenLoading";
|
|
|
+ }else{
|
|
|
+ textJS = [NSString stringWithFormat:@"uploadImg('%@')",url];
|
|
|
+ methodJS = @"uploadImg";
|
|
|
+ }
|
|
|
+ if ([url isEqualToString:@""]||[textJS isEqualToString:@""]) {
|
|
|
+ NSLog(@"空的情况");
|
|
|
+ textJS = @"hiddenLoading()";
|
|
|
+ methodJS = @"hiddenLoading";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ NSDictionary *dict = @{@"jsStr":textJS,@"name":methodJS};
|
|
|
+ [self performSelector:@selector(uploadJS:) withObject:dict afterDelay:1];
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+//获取到图片
|
|
|
+- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
|
|
|
+{
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [picker dismissViewControllerAnimated:YES completion:^{
|
|
|
+ UIImage * img=[info objectForKey:UIImagePickerControllerEditedImage];
|
|
|
+ NSData *data = UIImageJPEGRepresentation(img, 0.5);
|
|
|
+ if (data!=nil) {
|
|
|
+ [self uploadPic:data];
|
|
|
+ }else{
|
|
|
+ NSLog(@"data == nil");
|
|
|
+ [self uploadUrl:@""];
|
|
|
+ }
|
|
|
+ }];
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+-(void)uploadJS:(NSDictionary *)dict {
|
|
|
+ [self isExitCallToJS:dict[@"jsStr"] withMethodName:dict[@"name"]];
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+-(NSString *)convertToJsonData:(NSDictionary *)dict {
|
|
|
+ NSError *error;
|
|
|
+ NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:&error];
|
|
|
+ NSString *jsonString;
|
|
|
+ if (!jsonData) {
|
|
|
+ NSLog(@"%@",error);
|
|
|
+ }else{
|
|
|
+ jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
|
|
|
+ }
|
|
|
+
|
|
|
+ NSMutableString *mutStr = [NSMutableString stringWithString:jsonString];
|
|
|
+
|
|
|
+ NSRange range = {0,jsonString.length};
|
|
|
+
|
|
|
+ //去掉字符串中的空格
|
|
|
+
|
|
|
+ [mutStr replaceOccurrencesOfString:@" " withString:@"" options:NSLiteralSearch range:range];
|
|
|
+
|
|
|
+ NSRange range2 = {0,mutStr.length};
|
|
|
+
|
|
|
+ //去掉字符串中的换行符
|
|
|
+
|
|
|
+ [mutStr replaceOccurrencesOfString:@"\n" withString:@"" options:NSLiteralSearch range:range2];
|
|
|
+
|
|
|
+ return mutStr;
|
|
|
+}
|
|
|
+
|
|
|
+-(void)addNoNetViews{
|
|
|
+ kMainQueue(^{
|
|
|
+ self.recognizer.enabled = NO;
|
|
|
+ [self removeNoNetViews];
|
|
|
+ //about:blank
|
|
|
+ self.noNetView = [NoNetView shareView];
|
|
|
+ [self.view addSubview:self.noNetView];
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+-(void)removeNoNetViews{
|
|
|
+ if (self.noNetView ) {
|
|
|
+ self.recognizer.enabled = YES;
|
|
|
+ [self.noNetView removeFromSuperview];
|
|
|
+ self.noNetView = nil;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+-(void)addFailNetViews{
|
|
|
+ kMainQueue(^{
|
|
|
+ self.recognizer.enabled = NO;
|
|
|
+ [self removeFailNetViews];
|
|
|
+ self.failNetView = [NoNetView shareView];
|
|
|
+ [self.view addSubview:self.failNetView];
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+-(void)removeFailNetViews{
|
|
|
+ if (self.failNetView ) {
|
|
|
+ self.recognizer.enabled = YES;
|
|
|
+ [self.failNetView removeFromSuperview];
|
|
|
+ self.failNetView = nil;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+#pragma mark **** 通知相关方法
|
|
|
+// 点击通知 跳转到通知内url
|
|
|
+-(void)openPushUrlOtherMethods:(NSNotification *)notification{
|
|
|
+ if(self.tabBarController.selectedIndex == 2) {
|
|
|
+ NSDictionary *infoDict = notification.userInfo;
|
|
|
+ NSLog(@"%@",infoDict);
|
|
|
+ if (!infoDict) {return;}
|
|
|
+ NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
|
|
|
+ if ([urlStr isEqualToString:kHost]) {return;}
|
|
|
+ [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]]];
|
|
|
+ }
|
|
|
+}
|
|
|
+-(void)openPushUrlMethodsTwo:(NSNotification *)notification{
|
|
|
+ NSDictionary *infoDict = notification.userInfo;
|
|
|
+ NSLog(@"%@",infoDict);
|
|
|
+ if (!infoDict) {return;}
|
|
|
+ NSLog(@"点击订阅通知:%@",infoDict);
|
|
|
+ NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
|
|
|
+ if ([urlStr isEqualToString:kHost]||![LXUserDefaults token]) {return;}
|
|
|
+ [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]]];
|
|
|
+}
|
|
|
+-(void)openPushLinkUrlMethods:(NSNotification *)notification{
|
|
|
+ NSDictionary *infoDict = notification.userInfo;
|
|
|
+ NSLog(@"%@",infoDict);
|
|
|
+ if (!infoDict) {return;}
|
|
|
+ NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
|
|
|
+ if ([urlStr isEqualToString:kHost]) {return;}
|
|
|
+ if (self.tabBarController.selectedIndex == 2) {
|
|
|
+ [self JsOpenExternalLink:@{@"url":urlStr,@"title":@"消息通知"}];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+-(void)alipayWXpayStatus:(NSNotification *)notification{
|
|
|
+ if(self.tabBarController.selectedIndex == 2) {
|
|
|
+ NSString * status = [notification object];
|
|
|
+ [self performSelector:@selector(payStatus:) withObject:status afterDelay:2];
|
|
|
+ }
|
|
|
+}
|
|
|
+-(void)payStatus:(NSString *)status
|
|
|
+{
|
|
|
+ //目前延时两秒
|
|
|
+ NSLog(@"支付状态:%@",status);
|
|
|
+ if(self.tabBarController.selectedIndex == 2) {
|
|
|
+ [self isExitCallToJS:[NSString stringWithFormat:@"payCallBack('%@')", status] withMethodName:@"payCallBack"];
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// 再次加载页面
|
|
|
+-(void)notNetReloadWebVIew:(NSNotification *)notification{
|
|
|
+ if(self.tabBarController.selectedIndex == 2) {
|
|
|
+ if (![self.webView canGoBack]) {
|
|
|
+ [self webViewFirstRequest];
|
|
|
+ }else{
|
|
|
+ [self.webView reload];
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 返回上一页面- 防止
|
|
|
+-(void)popWebView:(NSNotification *)notification{
|
|
|
+ if(self.tabBarController.selectedIndex == 2) {
|
|
|
+ if ([self.webView canGoBack]) {
|
|
|
+ [self.webView goBack];
|
|
|
+ }
|
|
|
+ [self removeNoNetViews];
|
|
|
+ [self removeFailNetViews];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+// 收到退出登录消息
|
|
|
+-(void)loginOut:(NSNotification *)notification{
|
|
|
+ if([notification.userInfo[@"item_index"] integerValue]!=1) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ NSString *url = [NSString stringWithFormat:@"%@%@", kHost, @"jyapp/free/login?back=index&isios=t&flag=kicked"];
|
|
|
+ url = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
|
|
+ [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+// 监控网络状态变化
|
|
|
+-(void)netReachChanged:(NSNotification *)notificaition{
|
|
|
+ NSDictionary *userInfo = notificaition.userInfo;
|
|
|
+ if ([userInfo[@"AFNetworkingReachabilityNotificationStatusItem"] intValue] == 0 || [userInfo[@"AFNetworkingReachabilityNotificationStatusItem"] intValue] == -1) {
|
|
|
+ [self addNoNetViews];
|
|
|
+ }else{
|
|
|
+ [self removeNoNetViews];
|
|
|
+ if (isExistNoNewWork) {
|
|
|
+ isExistNoNewWork = NO;
|
|
|
+ [self notNetReloadWebVIew:nil];
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+-(void)jyReceiveNewsRedPoint:(NSNotification *)notificaition {
|
|
|
+ NSDictionary *dict = notificaition.userInfo;
|
|
|
+ if(self.tabBarController.selectedIndex == 2) {
|
|
|
+ NSString *textJS = [NSString stringWithFormat:@"afterReceivePushMessage('%@','%@')",dict[@"typeMsg"],dict[@"url"]];
|
|
|
+ [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:@"subscribe"]) {
|
|
|
+ if ([type isEqualToString:@"0"]) {
|
|
|
+ [self.webView reload];
|
|
|
+ }else {
|
|
|
+ [self webViewFirstRequest];
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+//刷新页面相关
|
|
|
+-(void)refreshNonCurVC:(NSNotification *)notificaition{
|
|
|
+ if(self.tabBarController.selectedIndex != 2) {
|
|
|
+ [self webViewFirstRequest];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//内购相关
|
|
|
+-(void)receiptData:(NSNotification *)notificaition{
|
|
|
+ if(self.tabBarController.selectedIndex == 2) {
|
|
|
+ NSDictionary *infoDict = notificaition.userInfo;
|
|
|
+ if (infoDict) {
|
|
|
+ NSString *receipt = [NSString stringWithFormat:@"%@", infoDict[@"receipt"]];
|
|
|
+ [self isExitCallToJS:[NSString stringWithFormat:@"getReceipt('%@')", receipt] withMethodName:@"getReceipt"];
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+#pragma mark ****粘贴板相关-梳理
|
|
|
+-(void)updateClipboard:(NSNotification *)notificaition{
|
|
|
+ if(self.tabBarController.selectedIndex == 2) {
|
|
|
+ NSString *current_url = [self stringByEvaluatingJavaScriptFromString:@"document.location.href"];
|
|
|
+ NSDictionary *dict = notificaition.userInfo;
|
|
|
+ NSString *content = [NSString stringWithFormat:@"%@",dict[@"content"]];
|
|
|
+ if ([current_url containsString:@"jyapp/free/login"]) {
|
|
|
+ [GlobalData shareInstance].isPasteLogin = YES;
|
|
|
+ }else {
|
|
|
+ [self popPasteVIew:content];
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+-(void)openTheClipboard:(NSNotification *)notificaition{
|
|
|
+ if(self.tabBarController.selectedIndex == 2) {
|
|
|
+ NSLog(@"菜单二打开指定粘贴板url");
|
|
|
+ NSDictionary *dict = notificaition.userInfo;
|
|
|
+ NSString *tmpUrl = [NSString stringWithFormat:@"%@%@", kHost, dict[@"url"]];
|
|
|
+ tmpUrl = [tmpUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
|
|
+ kMainQueue(^{
|
|
|
+ [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:tmpUrl]]];
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+//弹出粘贴板框
|
|
|
+-(void)popPasteVIew:(NSString *)content {
|
|
|
+ [[LXNetworkManager shareLXNetworkManager]postWithURLStr:[NSString stringWithFormat:@"%@distribution/share/getWordInfo",kHost] parameters:@{@"copyTxt":content} progress:^(NSProgress *progress) {
|
|
|
+ NSLog(@"%@",progress);
|
|
|
+ } success:^(id responseObject) {
|
|
|
+ NSLog(@"responseObject=%@",responseObject);
|
|
|
+ if ([responseObject objectForKey:@"data"]) {
|
|
|
+ NSDictionary *dict = [[NSDictionary alloc]initWithDictionary:responseObject[@"data"]];
|
|
|
+ if ([dict objectForKey:@"title"]) {
|
|
|
+ self.clipboardView.title =dict[@"title"];
|
|
|
+ self.clipboardView.subTitle =dict[@"subTitle"];
|
|
|
+ self.clipboardView.imgUrl =dict[@"imgUrl"];
|
|
|
+ self.clipboardView.appUrl =dict[@"appUrl"];
|
|
|
+ self.clipboardView.butTxt =dict[@"butTxt"];
|
|
|
+ self.clipboardView.bottomTxt =dict[@"bottomTxt"];
|
|
|
+ [self.clipboardView show];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } failure:^(NSError *error) {
|
|
|
+ NSLog(@"error=%@",error);
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark **** 代理方法
|
|
|
+-(void)clipboardClick:(NSString *)url {
|
|
|
+ //发送通知打开粘贴板-url
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:OpenTheClipboard object:nil userInfo:@{@"url":url}];
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/*
|
|
|
#pragma mark - Navigation
|