Browse Source

备份-通知详情页

apple 4 years ago
parent
commit
3c9ca38d6f

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


+ 2 - 2
ios/JianYuIOS/JianYuIOS.xcworkspace/xcuserdata/apple.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -26,8 +26,8 @@
             filePath = "JianYuIOS/Classes(模块)/JYNewExpViewController.m"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1473"
-            endingLineNumber = "1473"
+            startingLineNumber = "1493"
+            endingLineNumber = "1493"
             landmarkName = "-popWebView:"
             landmarkType = "7">
          </BreakpointContent>

+ 88 - 19
ios/JianYuIOS/JianYuIOS/AppDelegate.m

@@ -29,6 +29,9 @@
 @property(nonatomic, strong)UIImageView *imgView;
 @property(nonatomic, assign)BOOL wakeUpBool;
 
+@property (nonatomic,weak)NSTimer *timerClick;
+@property (nonatomic,assign)NSInteger timerIndex;
+
 @end
 
 @implementation AppDelegate
@@ -285,40 +288,58 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
         infoDict = [[LXViewControllerManager shareViewControllerManager] dictionaryWithJsonString:userInfo[@"info"]];
     }
     if ([infoDict objectForKey:@"url"]) {//数据正常
-        NSString * urlStr = [LXMD5 dealWithPushUrl:[NSString stringWithFormat:@"%@",infoDict[@"url"]] type:[NSString stringWithFormat:@"%@",infoDict[@"type"]]];
+        NSString * urlStr = [LXMD5 dealWithPushUrl:[NSString stringWithFormat:@"%@",infoDict[@"url"]] type:[NSString stringWithFormat:@"%@",userInfo[@"type"]]];
         NSString * menuname = [NSString stringWithFormat:@"%@",infoDict[@"menuname"]];
         //切换底部栏
         AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
         JYTabBarController *tab = (JYTabBarController *)delegate.window.rootViewController;
         NSDictionary *user_info = @{@"url":urlStr};
         if ([menuname isEqualToString:@"search"]) {
+            [GlobalData shareInstance].isClickNotiStatus = YES;
             tab.selectedIndex = 0;//切换底部栏
-            [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsOne object:nil userInfo:user_info];
+            if ([GlobalData shareInstance].isSearchToLoad) {
+                [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsOne object:nil userInfo:user_info];
+            }else {
+                [self waitingToBeClickNoti:user_info withIndex:@"0"];
+            }
         }else if ([menuname isEqualToString:@"subscribe"]) {
+            [GlobalData shareInstance].isClickNotiStatus = YES;
             tab.selectedIndex = 1;//切换底部栏
-            [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsTwo object:nil userInfo:user_info];
+            if ([GlobalData shareInstance].isSubToLoad) {
+                [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsTwo object:nil userInfo:user_info];
+            }else {
+                [self waitingToBeClickNoti:user_info withIndex:@"1"];
+            }
         }else if ([menuname isEqualToString:@"box"]) {
+            [GlobalData shareInstance].isClickNotiStatus = YES;
             tab.selectedIndex = 2;//切换底部栏
-            [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsThree object:nil userInfo:user_info];
+            if ([GlobalData shareInstance].isBoxToLoad) {
+                [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsThree object:nil userInfo:user_info];
+            }else {
+                [self waitingToBeClickNoti:user_info withIndex:@"2"];
+            }
         }else if ([menuname isEqualToString:@"me"]) {
+            [GlobalData shareInstance].isClickNotiStatus = YES;
             tab.selectedIndex = 3;//切换底部栏
-            [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsFour object:nil userInfo:user_info];
+            if ([GlobalData shareInstance].isMineToLoad) {
+                [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsFour object:nil userInfo:user_info];
+            }else {
+                [self waitingToBeClickNoti:user_info withIndex:@"3"];
+            }
         }else if ([menuname isEqualToString:@"other"]) {
             [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushLinkUrlMethods object:nil userInfo:user_info];
         }else {
             [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlOtherMethods object:nil userInfo:user_info];
-            
         }
         
-        if(self.wakeUpBool) {//刚启动
-            [[NSUserDefaults standardUserDefaults]setObject:userInfo forKey:RemoteNotifications];
-            self.wakeUpBool = NO;
-        }
+    
+//        if(self.wakeUpBool) {//刚启动
+//            [[NSUserDefaults standardUserDefaults]setObject:userInfo forKey:RemoteNotifications];
+//            self.wakeUpBool = NO;
+//        }
         if([userInfo[@"type"] isEqualToString:@"message"]||[userInfo[@"type"] isEqualToString:@"titleMessage"]) {
-            
             NSDictionary * infoDic;
-            if(self.wakeUpBool) {
-                //刚启动
+            if(self.wakeUpBool) {//刚启动
                 infoDic = @{@"url":infoDict[@"url"],
                             @"rectype":@"A",
                             @"openid":infoDict[@"openid"],
@@ -329,12 +350,7 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
                             @"openid":infoDict[@"openid"],
                             };
             }
-            
-            self.wakeUpBool = NO;
-            //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) {
@@ -342,8 +358,62 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
             }];
         }
     }
+    //刚启动-置空
+    self.wakeUpBool = NO;
 }
 
+-(void)waitingToBeClickNoti:(NSDictionary *)userInfo withIndex:(NSString *)index {
+    NSLog(@"点击通知-延迟监听处理");
+    NSDictionary *dict = @{
+        @"userInfo":userInfo,
+        @"index":index,
+    };
+    self.timerClick = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timerClickMethod:) userInfo:dict repeats:YES];
+    [self.timerClick fire];
+}
+
+-(void)timerClickMethod:(NSTimer *)timer {
+    self.timerIndex++;
+    NSDictionary *infoDict = [timer userInfo];
+    NSInteger index = [infoDict[@"index"] integerValue];
+    NSDictionary *userInfo = infoDict[@"userInfo"];
+//    NSLog(@"执行一次:%@~%ld",userInfo,(long)index);
+    if (index==0) {
+        if ([GlobalData shareInstance].isSearchToLoad) {
+            [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsOne object:nil userInfo:userInfo];
+            [self clearTimer];
+        }
+    }else if (index==1) {
+        if ([GlobalData shareInstance].isSubToLoad) {
+            [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsTwo object:nil userInfo:userInfo];
+            [self clearTimer];
+        }
+    }else if (index==2) {
+        if ([GlobalData shareInstance].isBoxToLoad) {
+            [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsThree object:nil userInfo:userInfo];
+            [self clearTimer];
+        }
+    }else if (index==3) {
+        if ([GlobalData shareInstance].isMineToLoad) {
+            [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsFour object:nil userInfo:userInfo];
+            [self clearTimer];
+        }
+    }else {
+       
+    }
+    
+    if (self.timerIndex>10) {
+        [self clearTimer];
+    }
+}
+
+-(void)clearTimer {
+    self.timerIndex = 0;
+    [self.timerClick invalidate];
+    self.timerClick = nil;
+}
+
+
 
 -(void)receiveNotification:(NSDictionary *)userInfo {
     
@@ -380,7 +450,6 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
                                        @"openid":infoDict[@"openid"],
             };
             [[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) {

+ 7 - 1
ios/JianYuIOS/JianYuIOS/BaseClass1/GlobalData.h

@@ -15,8 +15,14 @@
 @property (nonatomic,assign)BOOL searchIsRed;
 @property (nonatomic,assign)BOOL subIsRed;
 @property (nonatomic,assign)BOOL boxIsRed;
-@property (nonatomic,assign)BOOL mineIsRed;//红点
+@property (nonatomic,assign)BOOL mineIsRed;//红点-切换底部栏需要刷新
 
+@property (nonatomic,assign)BOOL isClickNotiStatus;
+
+@property (nonatomic,assign)BOOL isSearchToLoad;
+@property (nonatomic,assign)BOOL isSubToLoad;
+@property (nonatomic,assign)BOOL isBoxToLoad;
+@property (nonatomic,assign)BOOL isMineToLoad;//模块是否加载完毕
 
 @property (nonatomic,assign)BOOL isReLogin;//是否重新登录
 @property (nonatomic,assign)BOOL isOpen;//是否打开-启动

+ 8 - 0
ios/JianYuIOS/JianYuIOS/BaseClass1/GlobalData.m

@@ -61,6 +61,14 @@
     self.subIsRed = NO;
     self.boxIsRed = NO;
     self.mineIsRed = NO;
+    
+    self.isClickNotiStatus = NO;
+
+    self.isSearchToLoad= NO;
+    self.isSubToLoad= NO;
+    self.isBoxToLoad= NO;
+    self.isMineToLoad = NO;
+    
     self.isReLogin = NO;
     self.isOpen = NO;
     self.isPasteLogin = NO;

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

@@ -80,7 +80,7 @@
     }else {
         urlStr = [kHost stringByAppendingString:urlStr];
     }
-    if([type isEqualToString:@"message"]) {
+    if([type isEqualToString:@"message"]||[type isEqualToString:@"titleMessage"]) {
         NSArray * array = [urlStr componentsSeparatedByString:@"=="];
         urlStr =  [array.firstObject stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
     }else {

+ 22 - 2
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYNewExpViewController.m

@@ -40,10 +40,17 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
 {
     [super viewWillAppear:animated];
     [self.navigationController setNavigationBarHidden:YES animated:animated];
-    if([GlobalData shareInstance].boxIsRed) {
+    
+    if ([GlobalData shareInstance].isClickNotiStatus) {
         [GlobalData shareInstance].boxIsRed = NO;
-        [self webViewFirstRequest];
+        [GlobalData shareInstance].isClickNotiStatus = NO;
+    }else {
+        if([GlobalData shareInstance].boxIsRed) {
+            [GlobalData shareInstance].boxIsRed = NO;
+            [self webViewFirstRequest];
+        }
     }
+    
 }
 
 //弹框
@@ -462,7 +469,14 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
     
     //监听底部栏
     [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(bottomThreeListening) userInfo:nil repeats:YES];
+    
+    
+    [GlobalData shareInstance].isBoxToLoad = YES;
+    
+    
 }
+
+
 -(void)bottomThreeListening {
     if(self.tabBarController.selectedIndex == 2) {
         [self judgeIsHiddenBottom];
@@ -473,6 +487,9 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
 /* 页面加载完成 */
 - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
     NSLog(@"-----页面加载完成%@",webView.URL.absoluteString);
+    if (![GlobalData shareInstance].isBoxToLoad) {
+        [GlobalData shareInstance].isBoxToLoad = YES;
+    }
     [self judgeIsHiddenBottom];//是否隐藏
     [self removeNoNetViews];
     [self removeFailNetViews];
@@ -1410,6 +1427,7 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
 -(void)openPushUrlOtherMethods:(NSNotification *)notification{
     if(self.tabBarController.selectedIndex == 2) {
         NSDictionary *infoDict = notification.userInfo;
+        NSLog(@"%@",infoDict);
         if (!infoDict) {return;}
         NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
         [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]]];
@@ -1417,12 +1435,14 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
 }
 -(void)openPushUrlMethodsThree:(NSNotification *)notification{
     NSDictionary *infoDict = notification.userInfo;
+    NSLog(@"%@",infoDict);
     if (!infoDict) {return;}
     NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
     [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 (self.tabBarController.selectedIndex == 2) {

+ 17 - 3
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYNewMineViewController.m

@@ -50,10 +50,18 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
 {
     [super viewWillAppear:animated];
     [self.navigationController setNavigationBarHidden:YES animated:animated];
-    if([GlobalData shareInstance].mineIsRed) {
+    
+    
+    if ([GlobalData shareInstance].isClickNotiStatus) {
         [GlobalData shareInstance].mineIsRed = NO;
-        [self webViewFirstRequest];
+        [GlobalData shareInstance].isClickNotiStatus = NO;
+    }else {
+        if([GlobalData shareInstance].mineIsRed) {
+            [GlobalData shareInstance].mineIsRed = NO;
+            [self webViewFirstRequest];
+        }
     }
+
 }
 
 //弹框
@@ -474,7 +482,7 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
     
     //监听底部栏
     [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(bottomFourListening) userInfo:nil repeats:YES];
- 
+
 }
 
 -(void)bottomFourListening {
@@ -488,6 +496,9 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
 /* 页面加载完成 */
 - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
     NSLog(@"-----页面加载完成%@",webView.URL.absoluteString);
+    if (![GlobalData shareInstance].isMineToLoad) {
+        [GlobalData shareInstance].isMineToLoad = YES;
+    }
     [self judgeIsHiddenBottom];
     [self removeNoNetViews];
     [self removeFailNetViews];
@@ -1428,6 +1439,7 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
 -(void)openPushUrlOtherMethods:(NSNotification *)notification{
     if(self.tabBarController.selectedIndex == 3) {
         NSDictionary *infoDict = notification.userInfo;
+        NSLog(@"%@",infoDict);
         if (!infoDict) {return;}
         NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
         [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]]];
@@ -1435,12 +1447,14 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
 }
 -(void)openPushUrlMethodsFour:(NSNotification *)notification{
     NSDictionary *infoDict = notification.userInfo;
+    NSLog(@"%@",infoDict);
     if (!infoDict) {return;}
     NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
     [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 (self.tabBarController.selectedIndex == 3) {

+ 16 - 108
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYNewSearchViewController.m

@@ -22,10 +22,7 @@ static NSString * const kHostAddress = @"localhost:50051";
 
 @interface JYNewSearchViewController ()<WKNavigationDelegate,WKUIDelegate,WKScriptMessageHandler,CLLocationManagerDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate,CLLocationManagerDelegate,SKProductsRequestDelegate,SKPaymentTransactionObserver,ZKClipboardViewDelegate,WBFaceVerifyCustomerServiceDelegate,UIDocumentPickerDelegate>
 {
-    NSInteger _timeTick;
-    NSInteger _time;
     NSInteger pushIndex;//第几个模块过来的
-    BOOL notiFinish;
     BOOL isLoadRedDot;
     CGPoint startTouch;
     BOOL _isMoving;
@@ -35,9 +32,6 @@ static NSString * const kHostAddress = @"localhost:50051";
 @property (nonatomic, strong) UIProgressView *progressView;
 @property (nonatomic, strong) WKWebView *webView;
 
-@property (nonatomic, strong)NSMutableDictionary *notiDict;
-@property (nonatomic,weak)NSTimer *timer;
-
 @property(nonatomic, assign)BOOL updateNotify;
 
 @property(nonatomic,strong)CLLocationManager *locaationManager;
@@ -54,6 +48,7 @@ static NSString * const kHostAddress = @"localhost:50051";
 
 
 
+
 @end
 
 
@@ -63,27 +58,18 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
 
 @implementation JYNewSearchViewController
 
-
-
--(void)initGRPC{
-    NSString * const kHostAddress = @"111.202.46.21:18053";
-    [GRPCCall useInsecureConnectionsForHost:kHostAddress];
-    
-//    ProtoRPC *call = [client RPCToUnaryCallWithRequest:request handler:^(AUTHResponse *response, NSError *error) {
-//          ...
-//        }];
-    
-   
- 
-}
-
 -(void)viewWillAppear:(BOOL)animated
 {
     [super viewWillAppear:animated];
     [self.navigationController setNavigationBarHidden:YES animated:animated];
-    if([GlobalData shareInstance].searchIsRed) {
+    if ([GlobalData shareInstance].isClickNotiStatus) {
         [GlobalData shareInstance].searchIsRed = NO;
-        [self webViewFirstRequest];
+        [GlobalData shareInstance].isClickNotiStatus = NO;
+    }else {
+        if([GlobalData shareInstance].searchIsRed) {
+            [GlobalData shareInstance].searchIsRed = NO;
+            [self webViewFirstRequest];
+        }
     }
 }
 
@@ -552,20 +538,6 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
     // Do any additional setup after loading the view.
     NSLog(@"首页初始化");
     
-
-    [self initGRPC];
-    
-
-
-    
-    
-    
-    
-    
-    
-    
-    
-
     self.view.backgroundColor = [UIColor whiteColor];
 
 
@@ -574,7 +546,6 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
     [self webViewFirstRequest];
     [[AFNetworkReachabilityManager sharedManager] startMonitoring];
     [self initNotification];
-    [self initApnsTimer];
     self.recognizer = [[UIPanGestureRecognizer alloc]initWithTarget:self action:@selector(paningGestureReceive:)];
     [self.recognizer delaysTouchesBegan];
     [self.view addGestureRecognizer:self.recognizer];
@@ -591,9 +562,6 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
     //监听购买结果
     [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
     
-    
-//    UIButton *btn1 = [ZKControl createButtonWithFrame:CGRectMake(100, 100, 100, 100) title:@"测试上传" imageName:nil bgImageName:nil target:self method:@selector(btn1click)];
-//    [self.view addSubview:btn1];
 
     
 }
@@ -701,18 +669,6 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
        
     }
 }
-
-
-
--(void)initApnsTimer {
-    //定时器
-    if([LXUserDefaults isExistToken]) {
-        self.notiDict = [[NSMutableDictionary alloc]initWithDictionary:[[NSUserDefaults standardUserDefaults] objectForKey:RemoteNotifications]];
-        if(self.notiDict.count) {
-            self.timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timeFireMethod) userInfo:nil repeats:YES];
-        }
-    }
-}
 -(void)haveRedPoint
 {
     NSLog(@"http请求-------小红点");
@@ -763,14 +719,15 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
 /* 页面加载完成 */
 - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
     NSLog(@"-----页面加载完成%@",webView.URL.absoluteString);
+    if (![GlobalData shareInstance].isSearchToLoad) {
+        [GlobalData shareInstance].isSearchToLoad = YES;
+    }
+    
     //第一次加载小红点
     if(!isLoadRedDot) {
         isLoadRedDot = true;
         [self haveRedPoint];
     }
-    if(!notiFinish) {
-        notiFinish = YES;
-    }
     [self.webView evaluateJavaScript:@"document.documentElement.style.webkitTouchCallout='none';" completionHandler:nil];
     [self.webView evaluateJavaScript:@"document.documentElement.style.webkitUserSelect='none';"completionHandler:nil];
     [self judgeIsHiddenBottom];//是否隐藏
@@ -1564,57 +1521,6 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
     }
 }
 
--(void)timeFireMethod{
-    _timeTick++;
-    if(self.webView&&notiFinish) { //点击通知启动
-        NSDictionary *infoDict = self.notiDict[@"info"];
-        if ([infoDict isKindOfClass:[NSString class]]) {
-            infoDict = [[LXViewControllerManager shareViewControllerManager] dictionaryWithJsonString:self.notiDict[@"info"]];
-        }
-        if ([infoDict objectForKey:@"url"]) {//数据正常
-            NSString * urlStr = [LXMD5 dealWithPushUrl:[NSString stringWithFormat:@"%@",infoDict[@"url"]] type:[NSString stringWithFormat:@"%@",infoDict[@"type"]]];
-            NSString * menuname = [NSString stringWithFormat:@"%@",infoDict[@"menuname"]];
-            //切换底部栏
-            AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-            JYTabBarController *tab = (JYTabBarController *)delegate.window.rootViewController;
-            NSDictionary *user_info = @{@"url":urlStr};
-            if ([menuname isEqualToString:@"search"]) {
-                tab.selectedIndex = 0;//切换底部栏
-                [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsOne object:nil userInfo:user_info];
-            }else if ([menuname isEqualToString:@"subscribe"]) {
-                tab.selectedIndex = 1;//切换底部栏
-                [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsTwo object:nil userInfo:user_info];
-            }else if ([menuname isEqualToString:@"box"]) {
-                tab.selectedIndex = 2;//切换底部栏
-                [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsThree object:nil userInfo:user_info];
-            }else if ([menuname isEqualToString:@"me"]) {
-                tab.selectedIndex = 3;//切换底部栏
-                [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlMethodsFour object:nil userInfo:user_info];
-            }else if ([menuname isEqualToString:@"other"]) {
-                [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushLinkUrlMethods object:nil userInfo:user_info];
-            }else {
-                [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlOtherMethods object:nil userInfo:user_info];
-            }
-            [self.timer invalidate];
-            self.timer = nil;
-            _timeTick = 0;
-            [[NSUserDefaults standardUserDefaults] removeObjectForKey:RemoteNotifications];
-            return;
-           
-        }
- 
-        
-    }
-    if (_timeTick == 60) {
-        [self.timer invalidate];
-        self.timer = nil;
-        _timeTick = 0;
-        [[NSUserDefaults standardUserDefaults] removeObjectForKey:RemoteNotifications];
-    }
-}
-
-
-
 - (void)hideTabBar {
     kMainQueue(^{
         if (self.tabBarController.tabBar.hidden == YES) {
@@ -1631,8 +1537,7 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
 }
 - (void)showTabBar{
     kMainQueue(^{
-        if (self.tabBarController.tabBar.hidden == NO)
-        {
+        if (self.tabBarController.tabBar.hidden == NO){
             return;
         }
         UIView *contentView;
@@ -1961,12 +1866,15 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
 }
 -(void)openPushUrlMethodsOne:(NSNotification *)notification{
     NSDictionary *infoDict = notification.userInfo;
+    NSLog(@"%@",infoDict);
     if (!infoDict) {return;}
     NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
     [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 (self.tabBarController.selectedIndex == 0) {

+ 16 - 3
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYNewSubViewController.m

@@ -44,10 +44,15 @@ NSString *const new_AesKey_2 = @"mGlAgnIBB8bx2nch";
         [GlobalData shareInstance].isReLogin = NO;
         [self webViewFirstRequest];
     }else {
-        if([GlobalData shareInstance].subIsRed) {
+        if ([GlobalData shareInstance].isClickNotiStatus) {
             [GlobalData shareInstance].subIsRed = NO;
-            [self webViewFirstRequest];
-        }
+            [GlobalData shareInstance].isClickNotiStatus = NO;
+        }else {
+            if([GlobalData shareInstance].subIsRed) {
+                [GlobalData shareInstance].subIsRed = NO;
+                [self webViewFirstRequest];
+            }
+        }  
     }
 }
 
@@ -461,6 +466,8 @@ NSString *const new_AesKey_2 = @"mGlAgnIBB8bx2nch";
     //监听底部栏
     [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(bottomTwoListening) userInfo:nil repeats:YES];
 
+    
+    [GlobalData shareInstance].isSubToLoad = YES;
 }
 -(void)bottomTwoListening {
     if(self.tabBarController.selectedIndex == 1) {
@@ -474,6 +481,9 @@ NSString *const new_AesKey_2 = @"mGlAgnIBB8bx2nch";
    
     NSLog(@"-----页面加载完成%@",webView.URL.absoluteString);
     //正常的网页加载
+    if (![GlobalData shareInstance].isSubToLoad) {
+        [GlobalData shareInstance].isSubToLoad = YES;
+    }
     [self judgeIsHiddenBottom];//是否隐藏
     [self removeNoNetViews];
     [self removeFailNetViews];
@@ -1405,6 +1415,7 @@ NSString *const new_AesKey_2 = @"mGlAgnIBB8bx2nch";
 -(void)openPushUrlOtherMethods:(NSNotification *)notification{
     if(self.tabBarController.selectedIndex == 1) {
         NSDictionary *infoDict = notification.userInfo;
+        NSLog(@"%@",infoDict);
         if (!infoDict) {return;}
         NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
         [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]]];
@@ -1412,6 +1423,7 @@ NSString *const new_AesKey_2 = @"mGlAgnIBB8bx2nch";
 }
 -(void)openPushUrlMethodsTwo:(NSNotification *)notification{
     NSDictionary *infoDict = notification.userInfo;
+    NSLog(@"%@",infoDict);
     if (!infoDict) {return;}
     NSLog(@"点击订阅通知:%@",infoDict);
     NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
@@ -1419,6 +1431,7 @@ NSString *const new_AesKey_2 = @"mGlAgnIBB8bx2nch";
 }
 -(void)openPushLinkUrlMethods:(NSNotification *)notification{
     NSDictionary *infoDict = notification.userInfo;
+    NSLog(@"%@",infoDict);
     if (!infoDict) {return;}
     NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
     if (self.tabBarController.selectedIndex == 1) {

+ 16 - 7
ios/JianYuIOS/JianYuIOS/JYgRPC/JYgRPCClient.m

@@ -52,10 +52,10 @@
 
 
 -(void)initData {
-    
+    regStatus = NO;
     //不断监听  10秒执行一次 注册
-    self.hostTimer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(hostTimerFireMethod) userInfo:nil repeats:YES];
-    
+    self.hostTimer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(hostTimerFireMethod) userInfo:nil repeats:YES];
+    [self.hostTimer fire];
 }
 
 -(void)hostTimerFireMethod {
@@ -67,7 +67,11 @@
         self.hostTimer = nil;
     }
 }
-
+-(void)clearTimer {
+    regStatus = YES;
+    [self.hostTimer invalidate];
+    self.hostTimer = nil;
+}
 
 -(void)getHost {
     //请求
@@ -83,6 +87,7 @@
 }
 
 -(void)registeredHost:(NSString *)host {
+//    host = @"192.168.3.207:5565";
     [GRPCCall useInsecureConnectionsForHost:host];
     self.service =  [PushService serviceWithHost:host];
     NSString *uidStr = [self getUID];
@@ -93,10 +98,12 @@
     [self.service registerWithRequest:req handler:^(RegResp * _Nullable response, NSError * _Nullable error) {
         if(error==nil){
             NSLog(@"注册接收成功:%@",response.pushId);
-            regStatus = YES;
+            [self clearTimer];
             [[NSUserDefaults standardUserDefaults] setValue:response.pushId forKey:GRPCPushID];
             [GlobalData shareInstance].rpcPushID =response.pushId;
             [self listeningRPC];
+        }else {
+            NSLog(@"注册失败:%@",error);
         }
     }];
 }
@@ -110,6 +117,8 @@
                 [self showLocalPushView:[self dealWithPushData:response]];
             }else {
                 NSLog(@"gprc接收接收错误:%@",error);
+                NSLog(@"尝试重连");
+                [self initData];
             }
         }];
     }
@@ -159,7 +168,7 @@
             content.userInfo = pushDict;
             content.sound = [UNNotificationSound defaultSound];
             content.badge = @1;
-            NSTimeInterval time = [[NSDate dateWithTimeIntervalSinceNow:2] timeIntervalSinceNow];
+            NSTimeInterval time = [[NSDate dateWithTimeIntervalSinceNow:0.1] timeIntervalSinceNow];
             // repeats,是否重复,如果重复的话时间必须大于60s,要不会报错
             UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:time repeats:NO];
             // 添加通知的标识符,可以用于移除,更新等操作
@@ -171,7 +180,7 @@
             }];
         }else {
             UILocalNotification *notif = [[UILocalNotification alloc] init];
-            notif.fireDate = [NSDate dateWithTimeIntervalSinceNow:2];
+            notif.fireDate = [NSDate dateWithTimeIntervalSinceNow:0.1];
             notif.alertBody = [NSString stringWithFormat:@"%@",pushDict[@"info"][@"descript"]];
             notif.userInfo = pushDict;
             notif.applicationIconBadgeNumber = 1;