apple 4 years ago
parent
commit
76fc62267a

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"
             filePath = "JianYuIOS/Classes(模块)/JYNewExpViewController.m"
             startingColumnNumber = "9223372036854775807"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "1430"
-            endingLineNumber = "1430"
+            startingLineNumber = "1439"
+            endingLineNumber = "1439"
             landmarkName = "-popWebView:"
             landmarkName = "-popWebView:"
             landmarkType = "7">
             landmarkType = "7">
          </BreakpointContent>
          </BreakpointContent>

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

@@ -306,7 +306,7 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
         }else if ([menuname isEqualToString:@"other"]) {
         }else if ([menuname isEqualToString:@"other"]) {
             [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushLinkUrlMethods object:nil userInfo:user_info];
             [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushLinkUrlMethods object:nil userInfo:user_info];
         }else {
         }else {
-            
+            [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlOtherMethods object:nil userInfo:user_info];
             
             
         }
         }
         
         

+ 1 - 0
ios/JianYuIOS/JianYuIOS/BaseClass1/PrefixHeader.pch

@@ -94,6 +94,7 @@ _Pragma("clang diagnostic pop")\
 
 
 
 
 //刷新通知跳转页面
 //刷新通知跳转页面
+#define OpenPushUrlOtherMethods @"OpenPushUrlOtherMethods"
 #define OpenPushUrlMethodsOne @"OpenPushUrlMethodsOne"
 #define OpenPushUrlMethodsOne @"OpenPushUrlMethodsOne"
 #define OpenPushUrlMethodsTwo @"OpenPushUrlMethodsTwo"
 #define OpenPushUrlMethodsTwo @"OpenPushUrlMethodsTwo"
 #define OpenPushUrlMethodsThree @"OpenPushUrlMethodsThree"
 #define OpenPushUrlMethodsThree @"OpenPushUrlMethodsThree"

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

@@ -178,6 +178,7 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
 
 
 -(void)initNotification {
 -(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(openPushLinkUrlMethods:) name:OpenPushLinkUrlMethods object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(openPushUrlMethodsThree:) name:OpenPushUrlMethodsThree object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(openPushUrlMethodsThree:) name:OpenPushUrlMethodsThree object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jyReceiveNewsRedPoint:) name:JYReceiveNewsRedPoint object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jyReceiveNewsRedPoint:) name:JYReceiveNewsRedPoint object:nil];
@@ -1372,6 +1373,14 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
 
 
 
 
 #pragma mark  **** 通知相关方法
 #pragma mark  **** 通知相关方法
+-(void)openPushUrlOtherMethods:(NSNotification *)notification{
+    if(self.tabBarController.selectedIndex == 2) {
+        NSDictionary *infoDict = notification.userInfo;
+        if (!infoDict) {return;}
+        NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
+        [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]]];
+    }
+}
 -(void)openPushUrlMethodsThree:(NSNotification *)notification{
 -(void)openPushUrlMethodsThree:(NSNotification *)notification{
     NSDictionary *infoDict = notification.userInfo;
     NSDictionary *infoDict = notification.userInfo;
     if (!infoDict) {return;}
     if (!infoDict) {return;}

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

@@ -190,6 +190,7 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
 
 
 -(void)initNotification {
 -(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(openPushLinkUrlMethods:) name:OpenPushLinkUrlMethods object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(openPushUrlMethodsFour:) name:OpenPushUrlMethodsFour object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(openPushUrlMethodsFour:) name:OpenPushUrlMethodsFour object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jyReceiveNewsRedPoint:) name:JYReceiveNewsRedPoint object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jyReceiveNewsRedPoint:) name:JYReceiveNewsRedPoint object:nil];
@@ -1393,6 +1394,14 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
 
 
 
 
 #pragma mark  **** 通知相关方法
 #pragma mark  **** 通知相关方法
+-(void)openPushUrlOtherMethods:(NSNotification *)notification{
+    if(self.tabBarController.selectedIndex == 3) {
+        NSDictionary *infoDict = notification.userInfo;
+        if (!infoDict) {return;}
+        NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
+        [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]]];
+    }
+}
 -(void)openPushUrlMethodsFour:(NSNotification *)notification{
 -(void)openPushUrlMethodsFour:(NSNotification *)notification{
     NSDictionary *infoDict = notification.userInfo;
     NSDictionary *infoDict = notification.userInfo;
     if (!infoDict) {return;}
     if (!infoDict) {return;}

+ 11 - 10
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYNewSearchViewController.m

@@ -228,6 +228,8 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
 
 
 -(void)initNotification {
 -(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(openPushLinkUrlMethods:) name:OpenPushLinkUrlMethods object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(openPushUrlMethodsOne:) name:OpenPushUrlMethodsOne object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(openPushUrlMethodsOne:) name:OpenPushUrlMethodsOne object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jyReceiveNewsRedPoint:) name:JYReceiveNewsRedPoint object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jyReceiveNewsRedPoint:) name:JYReceiveNewsRedPoint object:nil];
@@ -1554,8 +1556,7 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
             }else if ([menuname isEqualToString:@"other"]) {
             }else if ([menuname isEqualToString:@"other"]) {
                 [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushLinkUrlMethods object:nil userInfo:user_info];
                 [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushLinkUrlMethods object:nil userInfo:user_info];
             }else {
             }else {
-                
-                
+                [[NSNotificationCenter defaultCenter] postNotificationName:OpenPushUrlOtherMethods object:nil userInfo:user_info];
             }
             }
             [self.timer invalidate];
             [self.timer invalidate];
             self.timer = nil;
             self.timer = nil;
@@ -1912,15 +1913,15 @@ NSString *const new_AesKey_1 = @"mGlAgnIBB8bx2nch";
     }
     }
 }
 }
 
 
-
-
-
-
-
-
-
 #pragma mark  **** 通知相关方法
 #pragma mark  **** 通知相关方法
-
+-(void)openPushUrlOtherMethods:(NSNotification *)notification{
+    if(self.tabBarController.selectedIndex == 0) {
+        NSDictionary *infoDict = notification.userInfo;
+        if (!infoDict) {return;}
+        NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
+        [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]]];
+    }
+}
 -(void)openPushUrlMethodsOne:(NSNotification *)notification{
 -(void)openPushUrlMethodsOne:(NSNotification *)notification{
     NSDictionary *infoDict = notification.userInfo;
     NSDictionary *infoDict = notification.userInfo;
     if (!infoDict) {return;}
     if (!infoDict) {return;}

+ 9 - 1
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYNewSubViewController.m

@@ -184,6 +184,7 @@ NSString *const new_AesKey_2 = @"mGlAgnIBB8bx2nch";
 
 
 -(void)initNotification {
 -(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(openPushLinkUrlMethods:) name:OpenPushLinkUrlMethods object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(openPushUrlMethodsTwo:) name:OpenPushUrlMethodsTwo 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(jyReceiveNewsRedPoint:) name:JYReceiveNewsRedPoint object:nil];
@@ -1372,8 +1373,15 @@ NSString *const new_AesKey_2 = @"mGlAgnIBB8bx2nch";
 
 
 
 
 #pragma mark  **** 通知相关方法
 #pragma mark  **** 通知相关方法
-
 // 点击通知 跳转到通知内url
 // 点击通知 跳转到通知内url
+-(void)openPushUrlOtherMethods:(NSNotification *)notification{
+    if(self.tabBarController.selectedIndex == 1) {
+        NSDictionary *infoDict = notification.userInfo;
+        if (!infoDict) {return;}
+        NSString * urlStr = [NSString stringWithFormat:@"%@",infoDict[@"url"]];
+        [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]]];
+    }
+}
 -(void)openPushUrlMethodsTwo:(NSNotification *)notification{
 -(void)openPushUrlMethodsTwo:(NSNotification *)notification{
     NSDictionary *infoDict = notification.userInfo;
     NSDictionary *infoDict = notification.userInfo;
     if (!infoDict) {return;}
     if (!infoDict) {return;}

+ 32 - 14
ios/JianYuIOS/JianYuIOS/JYgRPC/JYgRPCClient.m

@@ -11,14 +11,14 @@
 #import "Push.pbrpc.h"
 #import "Push.pbrpc.h"
 #import "Push.pbobjc.h"
 #import "Push.pbobjc.h"
 #import "JYTabBarController.h"
 #import "JYTabBarController.h"
-#import <UIKit/UIKit.h>
+
 
 
 @interface JYgRPCClient() {
 @interface JYgRPCClient() {
     
     
     BOOL regStatus;
     BOOL regStatus;
 }
 }
 
 
-@property (nonatomic,weak)NSTimer *timer;
+@property (nonatomic,weak)NSTimer *hostTimer;
 
 
 
 
 @end
 @end
@@ -36,6 +36,10 @@
     return manager;
     return manager;
 }
 }
 
 
+-(NSString *)getUID{
+    return [UIDevice currentDevice].identifierForVendor.UUIDString;;
+}
+
 - (instancetype)init
 - (instancetype)init
 {
 {
     if (self = [super init])
     if (self = [super init])
@@ -49,28 +53,42 @@
 
 
 -(void)initData {
 -(void)initData {
     
     
-    //不断监听  5秒执行一次 注册
-    self.timer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(timeFireMethod) userInfo:nil repeats:YES];
+    //不断监听  10秒执行一次 注册
+    self.hostTimer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(hostTimerFireMethod) userInfo:nil repeats:YES];
+    
 }
 }
 
 
--(void)timeFireMethod {
+-(void)hostTimerFireMethod {
+    NSLog(@"执行一次请求获取host");
     if (!regStatus) {
     if (!regStatus) {
-        [self registeredHost];
+        [self getHost];
     }else {
     }else {
-        [self.timer invalidate];
-        self.timer = nil;
+        [self.hostTimer invalidate];
+        self.hostTimer = nil;
     }
     }
 }
 }
 
 
 
 
--(void)registeredHost {
-    
-    [GRPCCall useInsecureConnectionsForHost:@"192.168.3.207:5565"];
-    
-    self.service =  [PushService serviceWithHost:@"192.168.3.207:5565"];
+-(void)getHost {
+    //请求
+    [[LXNetworkManager shareLXNetworkManager]postWithURLStr:[NSString stringWithFormat:@"%@jyapp/free/config",kHost] parameters:nil progress:^(NSProgress *progress) {
+    } success:^(id responseObject) {
+        if ([responseObject valueForKey:@"pushGrpcServer"]) {
+            NSString *pushGrpcServer = [NSString stringWithFormat:@"%@",responseObject[@"pushGrpcServer"]];
+            [self registeredHost:pushGrpcServer];
+        }
+    } failure:^(NSError *error) {
+        NSLog(@"error=%@",error);
+    }];
+}
+
+-(void)registeredHost:(NSString *)host {
+    [GRPCCall useInsecureConnectionsForHost:host];
+    self.service =  [PushService serviceWithHost:host];
+    NSString *uidStr = [self getUID];
     RegReq *req = [[RegReq alloc]init];
     RegReq *req = [[RegReq alloc]init];
     req.key = @"jy";
     req.key = @"jy";
-    req.uuid = @"111122223333";
+    req.uuid = uidStr;
  
  
     [self.service registerWithRequest:req handler:^(RegResp * _Nullable response, NSError * _Nullable error) {
     [self.service registerWithRequest:req handler:^(RegResp * _Nullable response, NSError * _Nullable error) {
         if(error==nil){
         if(error==nil){