瀏覽代碼

推送逻辑更新 , 授权页网络波动调整

zhengkun 1 年之前
父節點
當前提交
d8ab8a3e8e

二進制
ios/JianYuIOS/JianYuIOS.xcworkspace/xcuserdata/zhengkun.xcuserdatad/UserInterfaceState.xcuserstate


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

@@ -60,7 +60,7 @@
     [self initUM];
     [self registeredPush]; //注册原生推送
     [self registeredATAuth];//
-    
+        
     if (launchOptions) {
         [GlobalData shareInstance].isWakeUpStatus = YES;//唤醒启动
         // 不是空 就是推送点击
@@ -282,7 +282,11 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
                 [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushLinkUrlMethods object:nil userInfo:user_info];
             }
         }else {
-            [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlOtherMethods object:nil userInfo:user_info];
+            if (![GlobalData shareInstance].isSearchToLoad) {
+                [self waitingToBeClickNoti:user_info isOpenLinke:NO];
+            }else {
+                [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlOtherMethods object:nil userInfo:user_info];
+            }
         }
         if([userInfo[@"type"] isEqualToString:@"message"]||[userInfo[@"type"] isEqualToString:@"titleMessage"]) {
             NSDictionary * infoDic;
@@ -325,12 +329,14 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
     BOOL isLinks = [infoDict[@"links"] integerValue]==0?NO:YES;
     NSDictionary *userInfo = infoDict[@"userInfo"];
     if ([LXUserDefaults isExistToken]) {//登录正常状态
-        if (isLinks) {
-            [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushLinkUrlMethods object:nil userInfo:userInfo];
-        }else {
-            [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlOtherMethods object:nil userInfo:userInfo];
+        if ([GlobalData shareInstance].isSearchToLoad) {
+            if (isLinks) {
+                [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushLinkUrlMethods object:nil userInfo:userInfo];
+            }else {
+                [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlOtherMethods object:nil userInfo:userInfo];
+            }
+            [self clearTimer];
         }
-        [self clearTimer];
     }else { //未登录异常状态
         NSLog(@"未登录状态-等待:%@",infoDict[@"index"]);
         [[NSNotificationCenter defaultCenter] postNotificationName:LoginIndexTabBar object:nil userInfo:@{@"item_index":infoDict[@"index"]}];
@@ -340,51 +346,23 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
         [self clearTimer];
     }
 }
-
 -(void)clearTimer {
     self.timerIndex = 0;
     [self.timerClick invalidate];
     self.timerClick = nil;
 }
-
-
-
 -(void)receiveNotification:(NSDictionary *)userInfo {
-    
     NSDictionary *infoDict = userInfo[@"info"];
     if ([infoDict isKindOfClass:[NSString class]]) {
         infoDict = [[LXViewControllerManager shareViewControllerManager] dictionaryWithJsonString:userInfo[@"info"]];
     }
     if ([infoDict objectForKey:@"url"]) {//数据正常
-        NSString * reddot = [NSString stringWithFormat:@"%@",infoDict[@"reddot"]];
-        NSString *index = @"";
-        if ([reddot isEqualToString:@"search"]) {
-            [GlobalData shareInstance].searchIsRed = YES;
-            index = @"0";
-        }else if ([reddot isEqualToString:@"subscribe"]) {
-            [GlobalData shareInstance].subIsRed = YES;
-            index = @"1";
-        }else if ([reddot isEqualToString:@"box"]) {
-            [GlobalData shareInstance].boxIsRed = YES;
-            index = @"3";
-        }else if ([reddot isEqualToString:@"me"]) {
-            [GlobalData shareInstance].mineIsRed = YES;
-            index = @"4";
-        }else if ([reddot isEqualToString:@"message"]) {
-            [GlobalData shareInstance].messIsRed = YES;
-            index = @"2";
-            
-        }else {
-            
-        }
-        
-        [[NSNotificationCenter defaultCenter] postNotificationName:JYReceiveNewsRedPoint object:nil userInfo:@{@"index":index,@"typeMsg":userInfo[@"type"],@"url":infoDict[@"url"]}];
-        
+        [[NSNotificationCenter defaultCenter] postNotificationName:JYReceiveNewsRedPoint object:nil userInfo:@{@"typeMsg":userInfo[@"type"],@"url":infoDict[@"url"]}];
         if([userInfo[@"type"] isEqualToString:@"message"]||[userInfo[@"type"] isEqualToString:@"titleMessage"]) {
-            
-            NSDictionary * infoDic = @{@"url":infoDict[@"url"],
-                                       @"rectype":@"D",
-                                       @"openid":infoDict[@"openid"],
+            NSDictionary * infoDic =@{
+                @"url":infoDict[@"url"],
+                @"rectype":@"D",
+                @"openid":infoDict[@"openid"],
             };
             [[LXNetworkManager shareLXNetworkManager]postWithURLStr:[NSString stringWithFormat:@"%@jyapp/free/message/receive",kHost] parameters:infoDic progress:^(NSProgress *progress) {
             } success:^(id responseObject) {
@@ -392,14 +370,11 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
             } failure:^(NSError *error) {
                 NSLog(@"error=%@",error);
             }];
-            
         }
-
     }
 }
 // NOTE: 9.0以后使用新API接口
-- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
-{
+- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{
     BOOL result = [[UMSocialManager defaultManager] handleOpenURL:url];
     if (!result) {
         // 其他如支付等SDK的回调

+ 7 - 12
ios/JianYuIOS/JianYuIOS/Classes(新模块)/JYBaseViewController.m

@@ -53,15 +53,6 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
 {
     [super viewWillAppear:animated];
     [self.navigationController setNavigationBarHidden:YES animated:animated];
-    if ([GlobalData shareInstance].isClickNotiStatus) {
-        [GlobalData shareInstance].searchIsRed = NO;
-        [GlobalData shareInstance].isClickNotiStatus = NO;
-    }else {
-        if([GlobalData shareInstance].searchIsRed) {
-            [GlobalData shareInstance].searchIsRed = NO;
-            [self webViewFirstRequest];
-        }
-    }
 }
 
 //弹框
@@ -211,8 +202,7 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
     //加载通知
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(openPushUrlOtherMethods:) name:OpenPushUrlOtherMethods object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(openPushLinkUrlMethods:) name:OpenPushLinkUrlMethods object:nil];
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jyReceiveNewsRedPoint:) name:JYReceiveNewsRedPoint object:nil];
-    
+
     //支付状态通知
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(alipayWXpayStatus:) name:AlipayWXpayStatus object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notNetReloadWebVIew:) name:NotNetReloadWebVIew object:nil];
@@ -596,7 +586,9 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
 /* 页面加载完成 */
 - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
     NSLog(@"-----页面加载完成%@",webView.URL.absoluteString);
-    //第一次加载小红点
+    if (![GlobalData shareInstance].isSearchToLoad) {
+        [GlobalData shareInstance].isSearchToLoad = YES;
+    }
     [self.webView evaluateJavaScript:@"document.documentElement.style.webkitTouchCallout='none';" completionHandler:nil];
     [self.webView evaluateJavaScript:@"document.documentElement.style.webkitUserSelect='none';"completionHandler:nil];
     [self removeNoNetViews];
@@ -1366,6 +1358,9 @@ NSString *const new_AesKey = @"mGlAgnIBB8bx2nch";
         } else {
             NSLog(@"获取登录Token失败");
             [self isExitCallToJS:[NSString stringWithFormat:@"getLoginCallback('%@')",[self convertToJsonData:resultDic]] withMethodName:@"getLoginCallback"];
+            dispatch_async(dispatch_get_main_queue(), ^{
+                [[TXCommonHandler sharedInstance] cancelLoginVCAnimated:YES complete:nil];
+            });
         }
     }];
 }

二進制
ios/JianYuIOS/JianYuIOS/Image/arrowLeft@2x.png


二進制
ios/JianYuIOS/JianYuIOS/Image/back_normal@2x.png


二進制
ios/JianYuIOS/JianYuIOS/Image/message.gif


二進制
ios/JianYuIOS/JianYuIOS/Image/noNet@2x.png


二進制
ios/JianYuIOS/JianYuIOS/Image/pyq@2x.png


二進制
ios/JianYuIOS/JianYuIOS/Image/qidongye@2x.png


二進制
ios/JianYuIOS/JianYuIOS/Image/qq@2x.png


二進制
ios/JianYuIOS/JianYuIOS/Image/wx@2x.png