apple 4 năm trước cách đây
mục cha
commit
c858f8a613

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


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

@@ -16,22 +16,6 @@
             stopOnStyle = "0">
          </BreakpointContent>
       </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "99856AA9-BA14-4DD2-813E-89460F4F6BE3"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "JianYuIOS/Classes&#xff08;&#x6a21;&#x5757;&#xff09;/JYNewExpViewController.m"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "725"
-            endingLineNumber = "725"
-            landmarkName = "-jsLoginSuccess:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent

+ 10 - 4
ios/JianYuIOS/JianYuIOS/AppDelegate.m

@@ -9,7 +9,7 @@
 #import "AppDelegate.h"
 // 引入JPush功能所需头文件
 //#import "JPUSHService.h"
-
+#import "JYTabBarController.h"
 
 // iOS10注册APNs所需头文件
 #ifdef NSFoundationVersionNumber_iOS_9_x_Max
@@ -279,7 +279,7 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
 
 #pragma mark  ***** 点击通知 *****
 -(void)clickNotification:(NSDictionary *)userInfo{
-    NSLog(@"%@",userInfo);
+    NSLog(@"点击通知Appdelegate:%@",userInfo);
     NSDictionary *infoDict = userInfo[@"info"];
     if ([infoDict isKindOfClass:[NSString class]]) {
         infoDict = [[LXViewControllerManager shareViewControllerManager] dictionaryWithJsonString:userInfo[@"info"]];
@@ -353,19 +353,26 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
     }
     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 = @"2";
         }else if ([reddot isEqualToString:@"me"]) {
             [GlobalData shareInstance].mineIsRed = YES;
+            index = @"3";
         }else {
             
             
         }
-   
+        
+        [[NSNotificationCenter defaultCenter] postNotificationName:JYReceiveNewsRedPoint object:nil userInfo:@{@"index":index,@"typeMsg":userInfo[@"type"],@"url":infoDict[@"url"]}];
+        
         if([userInfo[@"type"] isEqualToString:@"message"]||[userInfo[@"type"] isEqualToString:@"titleMessage"]) {
             
             NSDictionary * infoDic = @{@"url":infoDict[@"url"],
@@ -381,7 +388,6 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
             }];
             
         }
-        [[NSNotificationCenter defaultCenter] postNotificationName:JYReceiveNewsRedPoint object:nil userInfo:@{@"typeMsg":userInfo[@"type"],@"url":infoDict[@"url"]}];
 
     }
     

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

@@ -1373,13 +1373,13 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
 
 #pragma mark  **** 通知相关方法
 -(void)openPushUrlMethodsThree:(NSNotification *)notification{
-    NSDictionary * infoDict = [notification object];
+    NSDictionary *infoDict = notification.userInfo;
     if (!infoDict) {return;}
     NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
     [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]]];
 }
 -(void)openPushLinkUrlMethods:(NSNotification *)notification{
-    NSDictionary * infoDict = [notification object];
+    NSDictionary *infoDict = notification.userInfo;
     if (!infoDict) {return;}
     NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
     if (self.tabBarController.selectedIndex == 2) {

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

@@ -1394,13 +1394,13 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
 
 #pragma mark  **** 通知相关方法
 -(void)openPushUrlMethodsFour:(NSNotification *)notification{
-    NSDictionary * infoDict = [notification object];
+    NSDictionary *infoDict = notification.userInfo;
     if (!infoDict) {return;}
     NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
     [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]]];
 }
 -(void)openPushLinkUrlMethods:(NSNotification *)notification{
-    NSDictionary * infoDict = [notification object];
+    NSDictionary *infoDict = notification.userInfo;
     if (!infoDict) {return;}
     NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
     if (self.tabBarController.selectedIndex == 3) {

+ 9 - 2
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYNewSearchViewController.m

@@ -1922,13 +1922,13 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
 #pragma mark  **** 通知相关方法
 
 -(void)openPushUrlMethodsOne:(NSNotification *)notification{
-    NSDictionary * infoDict = [notification object];
+    NSDictionary *infoDict = notification.userInfo;
     if (!infoDict) {return;}
     NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
     [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]]];
 }
 -(void)openPushLinkUrlMethods:(NSNotification *)notification{
-    NSDictionary * infoDict = [notification object];
+    NSDictionary *infoDict = notification.userInfo;
     if (!infoDict) {return;}
     NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
     if (self.tabBarController.selectedIndex == 0) {
@@ -2019,6 +2019,13 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
 }
 -(void)jyReceiveNewsRedPoint:(NSNotification *)notificaition {
     NSDictionary *dict = notificaition.userInfo;
+    NSLog(@"收到消息处理:%@",dict);
+    if (![dict[@"index"] isEqualToString:@""]) { //展示红点-
+        int index = [dict[@"index"] intValue];
+        kMainQueue(^{
+            [self.tabBarController.tabBar showBadgeOnItemIndex:index];
+        });
+    }
     if(self.tabBarController.selectedIndex == 0) {
         NSString *textJS =  [NSString stringWithFormat:@"afterReceivePushMessage('%@','%@')",dict[@"typeMsg"],dict[@"url"]];
         [self isExitCallToJS:textJS withMethodName:@"afterReceivePushMessage"];

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

@@ -1375,13 +1375,14 @@ NSString *const new_AesKey_2 = @"mGlAgnIBB8bx2nch";
 
 // 点击通知 跳转到通知内url
 -(void)openPushUrlMethodsTwo:(NSNotification *)notification{
-    NSDictionary * infoDict = [notification object];
+    NSDictionary *infoDict = notification.userInfo;
     if (!infoDict) {return;}
+    NSLog(@"点击订阅通知:%@",infoDict);
     NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
     [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]]];
 }
 -(void)openPushLinkUrlMethods:(NSNotification *)notification{
-    NSDictionary * infoDict = [notification object];
+    NSDictionary *infoDict = notification.userInfo;
     if (!infoDict) {return;}
     NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
     if (self.tabBarController.selectedIndex == 1) {

+ 2 - 0
ios/JianYuIOS/JianYuIOS/JYgRPC/JYgRPCClient.h

@@ -26,6 +26,8 @@ NS_ASSUME_NONNULL_BEGIN
 -(void)grpcCallbackServer:(NSDictionary *)dict;
 
 
+-(void)registeredHost;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 33 - 13
ios/JianYuIOS/JianYuIOS/JYgRPC/JYgRPCClient.m

@@ -11,9 +11,14 @@
 #import "Push.pbrpc.h"
 #import "Push.pbobjc.h"
 #import "JYTabBarController.h"
+#import <UIKit/UIKit.h>
 
+@interface JYgRPCClient() {
+    
+    BOOL regStatus;
+}
 
-@interface JYgRPCClient()
+@property (nonatomic,weak)NSTimer *timer;
 
 
 @end
@@ -44,32 +49,49 @@
 
 -(void)initData {
     
+    //不断监听  5秒执行一次 注册
+    self.timer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(timeFireMethod) userInfo:nil repeats:YES];
+}
+
+-(void)timeFireMethod {
+    if (!regStatus) {
+        [self registeredHost];
+    }else {
+        [self.timer invalidate];
+        self.timer = nil;
+    }
+}
+
+
+-(void)registeredHost {
+    
     [GRPCCall useInsecureConnectionsForHost:@"192.168.3.207:5565"];
     
     self.service =  [PushService serviceWithHost:@"192.168.3.207:5565"];
     RegReq *req = [[RegReq alloc]init];
     req.key = @"jy";
     req.uuid = @"111122223333";
+ 
     [self.service registerWithRequest:req handler:^(RegResp * _Nullable response, NSError * _Nullable error) {
-        NSLog(@"注册接收:%@",response.pushId);
-        [[NSUserDefaults standardUserDefaults] setValue:response.pushId forKey:GRPCPushID];
-        [GlobalData shareInstance].rpcPushID =response.pushId;
+        if(error==nil){
+            NSLog(@"注册接收成功:%@",response.pushId);
+            regStatus = YES;
+            [[NSUserDefaults standardUserDefaults] setValue:response.pushId forKey:GRPCPushID];
+            [GlobalData shareInstance].rpcPushID =response.pushId;
+            [self listeningRPC];
+        }
     }];
-    
-    
+}
 
-    
-    //监听 第一次注册的时候  延时处理
-    
+-(void)listeningRPC {
     if (![[GlobalData shareInstance].rpcPushID isEqualToString:@""]) {
-//        NSLog(@"测试:%@",[GlobalData shareInstance].rpcPushID );
         MsgReq *msg = [[MsgReq alloc]init];
         msg.pushId = [GlobalData shareInstance].rpcPushID;
         [self.service pushMsgWithRequest:msg eventHandler:^(BOOL done, MsgResp * _Nullable response, NSError * _Nullable error) {
             if (error==nil) {
                 [self showLocalPushView:[self dealWithPushData:response]];
             }else {
-                NSLog(@"通知接收错误:%@",error);
+                NSLog(@"gprc接收接收错误:%@",error);
             }
         }];
     }
@@ -146,9 +168,7 @@
 
 //推送回调
 -(void)grpcCallbackServer:(NSDictionary *)dict {
-    NSLog(@"dict:%@",dict);
     MsgPushReq *req = [[MsgPushReq alloc]init];
-   
     req.msgId = dict[@"msgid"];
     req.action = [dict[@"type"] intValue];
     req.userId = dict[@"userid"];