Explorar o código

监听底部栏变化

apple %!s(int64=5) %!d(string=hai) anos
pai
achega
4fad286a90

BIN=BIN
ios/JianYuIOS/JianYuIOS.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate


+ 1 - 1
ios/JianYuIOS/JianYuIOS/AppDelegate.m

@@ -60,7 +60,7 @@
     [LXDataBaseManager shareDataBaseManager];//初始化单例
     [LXViewControllerManager shareViewControllerManager];
     [self initJPush:launchOptions];
-//    [self initUM];
+    [self initUM];
     [self registeredPush]; //注册原生推送
 
     if (launchOptions) {

+ 1 - 1
ios/JianYuIOS/JianYuIOS/BaseClass1/NSURLProtocolCustom.m

@@ -39,7 +39,7 @@ static NSString* const protocolKey = @"protocolKey";
     }
     NSString *curStr = [mutableReqeust.URL absoluteString];
     // 替换域名
-    NSString *urlString = [curStr stringByReplacingOccurrencesOfString:@"res://" withString:@"http://"];
+    NSString *urlString = [curStr stringByReplacingOccurrencesOfString:@"res://" withString:@"https://"];
     NSURL *urlll = [NSURL URLWithString:urlString];
     mutableReqeust.URL = urlll;
     return mutableReqeust;

+ 24 - 30
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYNewExpViewController.m

@@ -13,7 +13,6 @@
 
 @interface JYNewExpViewController ()<WKNavigationDelegate,WKUIDelegate,WKScriptMessageHandler,CLLocationManagerDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate>
 {
-    BOOL refreshTabBool;
     CGPoint startTouch;
     BOOL _isMoving;
 }
@@ -388,6 +387,15 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
     UIPanGestureRecognizer *recognizer = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(paningGestureReceive:)];
     [recognizer delaysTouchesBegan];
     [self.view addGestureRecognizer:recognizer];
+    
+    //监听底部栏
+    [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(bottomThreeListening) userInfo:nil repeats:YES];
+}
+-(void)bottomThreeListening {
+    NSLog(@"监听tab-Exp");
+    if(self.tabBarController.selectedIndex == 2) {
+        [self judgeIsHiddenBottom];
+    }
 }
 
 #pragma mark - WKNavigationDelegate
@@ -395,21 +403,7 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
 - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
     NSString *curUrl = [self stringByEvaluatingJavaScriptFromString:@"document.location.href"];
     NSLog(@"-----页面加载完成%@",curUrl);
-
-    if(refreshTabBool){
-        NSLog(@"刷新-刷新-刷新-刷新-")
-        refreshTabBool = NO;
-    }else {
-        //正常的网页加载
-        [self judgeIsHidden];//是否隐藏
-    }
-    
-//    if ([GlobalData shareInstance].isSideslip) {
-//        [GlobalData shareInstance].isSideslip = YES;
-//        [self isExitCallToJS:@"afterClickBack()" withMethodName:@"afterClickBack"];
-//    }
-    
-    
+    [self judgeIsHiddenBottom];//是否隐藏
     [self removeNoNetViews];
     [[LXViewControllerManager shareViewControllerManager] hideHud];
     
@@ -777,18 +771,20 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
 }
 
 #pragma mark   *****其他方法
--(void)judgeIsHidden {
-    NSString *current_url = [self stringByEvaluatingJavaScriptFromString:@"document.location.href"];
-    NSLog(@"判断需要隐藏否:%@",current_url);
-    if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/jylab/index",kHost]]
-    ||[current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/free/login?back=index",kHost]]){
-        NSLog(@"需要展示");
-        [self showTabBar];
-        [self showMethodTabBar];
-    }else {
-        NSLog(@"需要隐藏");
-        [self hideTabBar];
-        [self hiddenMethodTabBar];
+-(void)judgeIsHiddenBottom {
+    if(self.tabBarController.selectedIndex == 2) {
+        NSString *current_url = [self stringByEvaluatingJavaScriptFromString:@"document.location.href"];
+        NSLog(@"判断需要隐藏否:%@",current_url);
+        if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/jylab/index",kHost]]
+        ||[current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/free/login?back=index",kHost]]){
+            NSLog(@"需要展示");
+            [self showTabBar];
+            [self showMethodTabBar];
+        }else {
+            NSLog(@"需要隐藏");
+            [self hideTabBar];
+            [self hiddenMethodTabBar];
+        }
     }
 }
 
@@ -1191,7 +1187,6 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
 //刷新页面相关
 -(void)refreshNonCurVC:(NSNotification *)notificaition{
     if(self.tabBarController.selectedIndex != 2) {
-        refreshTabBool = YES;
         [self webViewFirstRequest];
     }
 }
@@ -1200,7 +1195,6 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
 }
 
 -(void)refreshExpAndMine:(NSNotification *)notificaition{
-    refreshTabBool = YES;
     [self webViewFirstRequest];
 }
 

+ 25 - 33
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYNewMineViewController.m

@@ -23,7 +23,6 @@
 
 @interface JYNewMineViewController ()<WKNavigationDelegate,WKUIDelegate,WKScriptMessageHandler,CLLocationManagerDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate>
 {
-    BOOL refreshTabBool;
     CGPoint startTouch;
     BOOL _isMoving;
 }
@@ -411,36 +410,29 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
     UIPanGestureRecognizer *recognizer = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(paningGestureReceive:)];
     [recognizer delaysTouchesBegan];
     [self.view addGestureRecognizer:recognizer];
+    
+    //监听底部栏
+    [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(bottomFourListening) userInfo:nil repeats:YES];
+}
+
+-(void)bottomFourListening {
+    NSLog(@"监听tab-My");
+    if(self.tabBarController.selectedIndex == 3) {
+        [self judgeIsHiddenBottom];
+    }
 }
 
+
 #pragma mark - WKNavigationDelegate
 /* 页面加载完成 */
 - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
     NSString *curUrl = [self stringByEvaluatingJavaScriptFromString:@"document.location.href"];
     NSLog(@"-----页面加载完成%@",curUrl);
-    if(refreshTabBool){
-        NSLog(@"刷新-刷新-刷新-刷新-")
-        refreshTabBool = NO;
-    }else {
-        //正常的网页加载
-        [self judgeIsHidden];//是否隐藏
-    }
-    
-//    if ([GlobalData shareInstance].isSideslip) {
-//        [GlobalData shareInstance].isSideslip = YES;
-//        [self isExitCallToJS:@"afterClickBack()" withMethodName:@"afterClickBack"];
-//    }
-    
+    [self judgeIsHiddenBottom];
     [self removeNoNetViews];
     [[LXViewControllerManager shareViewControllerManager] hideHud];
-    
-//    [self performSelector:@selector(afterPageClick) withObject:nil afterDelay:2];
-
 }
 
-//-(void)afterPageClick {
-//    [self isExitCallToJS:@"afterPageInit()" withMethodName:@"afterPageInit"];
-//}
 // 页面开始加载时调用
 - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{
     
@@ -800,17 +792,19 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
 }
 
 #pragma mark   *****其他方法
--(void)judgeIsHidden {
-    NSString *current_url = [self stringByEvaluatingJavaScriptFromString:@"document.location.href"];
-    NSLog(@"判断需要隐藏否:%@",current_url);
-    if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/free/me",kHost]]){
-        NSLog(@"需要展示");
-        [self showTabBar];
-        [self showMethodTabBar];
-    }else {
-        NSLog(@"需要隐藏");
-        [self hideTabBar];
-        [self hiddenMethodTabBar];
+-(void)judgeIsHiddenBottom {
+    if(self.tabBarController.selectedIndex == 3) {
+        NSString *current_url = [self stringByEvaluatingJavaScriptFromString:@"document.location.href"];
+        NSLog(@"判断需要隐藏否:%@",current_url);
+        if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/free/me",kHost]]){
+            NSLog(@"需要展示");
+            [self showTabBar];
+            [self showMethodTabBar];
+        }else {
+            NSLog(@"需要隐藏");
+            [self hideTabBar];
+            [self hiddenMethodTabBar];
+        }
     }
 }
 
@@ -1215,7 +1209,6 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
 //刷新页面相关
 -(void)refreshNonCurVC:(NSNotification *)notificaition{
     if(self.tabBarController.selectedIndex != 3) {
-        refreshTabBool = YES;
         [self webViewFirstRequest];
     }
 }
@@ -1224,7 +1217,6 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
 }
 
 -(void)refreshExpAndMine:(NSNotification *)notificaition{
-    refreshTabBool = YES;
     [self webViewFirstRequest];
 }
 

+ 25 - 53
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYNewSearchViewController.m

@@ -18,7 +18,6 @@
     NSInteger _time;
     NSInteger pushIndex;//第几个模块过来的
     BOOL notiFinish;
-    BOOL refreshTabBool; //实验室-百宝箱 是否刷新
     BOOL isLoadRedDot;
     CGPoint startTouch;
     BOOL _isMoving;
@@ -480,8 +479,18 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
     
     
     //定时器-检测错误数据是否超过10个  发送
-   [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(errorLogListening) userInfo:nil repeats:YES];
+    [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(errorLogListening) userInfo:nil repeats:YES];
+    //监听底部栏
+    [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(bottomOneListening) userInfo:nil repeats:YES];
     
+    
+}
+
+-(void)bottomOneListening {
+    NSLog(@"监听tab-Sea");
+    if(self.tabBarController.selectedIndex == 0) {
+        [self judgeIsHiddenBottom];
+    }
 }
 
 - (BOOL)isTheCurrentPeriod{
@@ -614,30 +623,11 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
     if(!notiFinish) {
         notiFinish = YES;
     }
-    if(refreshTabBool){
-        NSLog(@"刷新-刷新-刷新-刷新-")
-        refreshTabBool = NO;
-    }else {
-        //正常的网页加载
-        [self judgeIsHidden];//是否隐藏
-    }
-
-    
-//    if ([GlobalData shareInstance].isSideslip) {
-//        [GlobalData shareInstance].isSideslip = YES;
-//        [self isExitCallToJS:@"afterClickBack()" withMethodName:@"afterClickBack"];
-//    }
-    
+    [self judgeIsHiddenBottom];//是否隐藏
     [self removeNoNetViews];
     [[LXViewControllerManager shareViewControllerManager] hideHud];
-    //延迟测试
-//    [self performSelector:@selector(afterPageClick) withObject:nil afterDelay:2];
-
 }
 
-//-(void)afterPageClick {
-//    [self isExitCallToJS:@"afterPageInit()" withMethodName:@"afterPageInit"];
-//}
 // 页面开始加载时调用
 - (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{
     
@@ -1022,37 +1012,20 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
     return self.webView.canGoBack ? 1:0;
 }
 
-//-(void)jsJudgeIsHidden:(NSDictionary *)dict {
-//    if([dict objectForKey:@"referer"]) {
-//        NSString *current_url = [NSString stringWithFormat:@"%@",dict[@"referer"]];
-//        if (![current_url isEqualToString:@""]) {
-//            NSLog(@"判断是否需要隐藏:%@",current_url);
-//            if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/jylab/mainSearch",kHost]]){
-//                NSLog(@"需要展示");
-//                [self showTabBar];
-//                [self showMethodTabBar];
-//            }else {
-//                NSLog(@"需要隐藏");
-//                [self hideTabBar];
-//                [self hiddenMethodTabBar];
-//            }
-//        }
-//    }
-//}
-
-
 #pragma mark   *****其他方法
--(void)judgeIsHidden {
-    NSString *current_url = [self stringByEvaluatingJavaScriptFromString:@"document.location.href"];
-    NSLog(@"判断需要隐藏否:%@",current_url);
-    if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/jylab/mainSearch",kHost]]){
-        NSLog(@"需要展示");
-        [self showTabBar];
-        [self showMethodTabBar];
-    }else {
-        NSLog(@"需要隐藏");
-        [self hideTabBar];
-        [self hiddenMethodTabBar];
+-(void)judgeIsHiddenBottom {
+    if(self.tabBarController.selectedIndex == 0) {
+        NSString *current_url = [self stringByEvaluatingJavaScriptFromString:@"document.location.href"];
+        NSLog(@"判断需要隐藏否:%@",current_url);
+        if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/jylab/mainSearch",kHost]]){
+            NSLog(@"需要展示");
+            [self showTabBar];
+            [self showMethodTabBar];
+        }else {
+            NSLog(@"需要隐藏");
+            [self hideTabBar];
+            [self hiddenMethodTabBar];
+        }
     }
 }
 
@@ -1584,7 +1557,6 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
 //刷新页面相关
 -(void)refreshNonCurVC:(NSNotification *)notificaition{
     if(self.tabBarController.selectedIndex != 0) {
-        refreshTabBool = YES;
         [self webViewFirstRequest];
     }
 }

+ 25 - 30
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYNewSubViewController.m

@@ -13,7 +13,6 @@
 
 @interface JYNewSubViewController ()<WKNavigationDelegate,WKUIDelegate,WKScriptMessageHandler,CLLocationManagerDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate>
 {
-    BOOL refreshTabBool; 
     CGPoint startTouch;
     BOOL _isMoving;
 }
@@ -396,6 +395,15 @@ NSString *const new_AesKey_2 = @"mGlAgnIBB8bx2nch";
     UIPanGestureRecognizer *recognizer = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(paningGestureReceive:)];
     [recognizer delaysTouchesBegan];
     [self.view addGestureRecognizer:recognizer];
+    
+    //监听底部栏
+    [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(bottomTwoListening) userInfo:nil repeats:YES];
+}
+-(void)bottomTwoListening {
+    NSLog(@"监听tab-Sub");
+    if(self.tabBarController.selectedIndex == 1) {
+        [self judgeIsHiddenBottom];
+    }
 }
 
 #pragma mark - WKNavigationDelegate
@@ -403,25 +411,11 @@ NSString *const new_AesKey_2 = @"mGlAgnIBB8bx2nch";
 - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
     NSString *curUrl = [self stringByEvaluatingJavaScriptFromString:@"document.location.href"];
     NSLog(@"-----页面加载完成%@",curUrl);
-
-    if(refreshTabBool){
-        NSLog(@"刷新-刷新-刷新-刷新-")
-        refreshTabBool = NO;
-    }else {
-        //正常的网页加载
-        [self judgeIsHidden];//是否隐藏
-    }
-    
-//    if ([GlobalData shareInstance].isSideslip) {
-//        [GlobalData shareInstance].isSideslip = YES;
-//        [self isExitCallToJS:@"afterClickBack()" withMethodName:@"afterClickBack"];
-//    }
-    
-    
+  
+    //正常的网页加载
+    [self judgeIsHiddenBottom];//是否隐藏
     [self removeNoNetViews];
     [[LXViewControllerManager shareViewControllerManager] hideHud];
-
-//    [self performSelector:@selector(afterPageClick) withObject:nil afterDelay:2];
 }
 
 //-(void)afterPageClick {
@@ -787,17 +781,19 @@ NSString *const new_AesKey_2 = @"mGlAgnIBB8bx2nch";
 
 
 #pragma mark   *****其他方法
--(void)judgeIsHidden {
-    NSString *current_url = [self stringByEvaluatingJavaScriptFromString:@"document.location.href"];
-    NSLog(@"判断需要隐藏否:%@",current_url);
-    if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/swordfish/historypush",kHost]]||[current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/free/login?back=index",kHost]]){
-        NSLog(@"需要展示");
-        [self showTabBar];
-        [self showMethodTabBar];
-    }else {
-        NSLog(@"需要隐藏");
-        [self hideTabBar];
-        [self hiddenMethodTabBar];
+-(void)judgeIsHiddenBottom {
+    if(self.tabBarController.selectedIndex == 1) {
+        NSString *current_url = [self stringByEvaluatingJavaScriptFromString:@"document.location.href"];
+        NSLog(@"判断需要隐藏否:%@",current_url);
+        if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/swordfish/historypush",kHost]]||[current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/free/login?back=index",kHost]]){
+            NSLog(@"需要展示");
+            [self showTabBar];
+            [self showMethodTabBar];
+        }else {
+            NSLog(@"需要隐藏");
+            [self hideTabBar];
+            [self hiddenMethodTabBar];
+        }
     }
 }
 
@@ -1184,7 +1180,6 @@ NSString *const new_AesKey_2 = @"mGlAgnIBB8bx2nch";
 //刷新页面相关
 -(void)refreshNonCurVC:(NSNotification *)notificaition{
     if(self.tabBarController.selectedIndex != 1) {
-        refreshTabBool = YES;
         [self webViewFirstRequest];
     }
 }