浏览代码

1.更换设备相关--还有问题

huangxiaodong 1 年之前
父节点
当前提交
0b85fe0bc8

+ 8 - 12
创维盒子/双子星云手机/AppDelegate/SceneDelegate.m

@@ -340,18 +340,14 @@
         else{
             [self HandleEnterNotPrivacyModeFun];
 
-            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-                mainBlock(^{
-                        [connectDeviceManager shareInstance].isFirstInputPwdDone = YES;
-                        //playerRootVC.isPwdVCShow = NO;
-                        //[playerRootVC setShowImgAndVoiceTypeFun:YES];
-                        //[weakSelf shareAwakenAppBy:weakSelf.getShareStr];
-
-                        if(self->_session && self->_connectionOptions){
-                            [self scene:self->_session openURLContexts:self->_connectionOptions.URLContexts];
-                        }
-                });
-            });
+            [connectDeviceManager shareInstance].isFirstInputPwdDone = YES;
+            //playerRootVC.isPwdVCShow = NO;
+            //[playerRootVC setShowImgAndVoiceTypeFun:YES];
+            //[weakSelf shareAwakenAppBy:weakSelf.getShareStr];
+
+            if(self->_session && self->_connectionOptions){
+                [self scene:self->_session openURLContexts:self->_connectionOptions.URLContexts];
+            }
         }
 
         //_isQRCodeType = NO;

+ 25 - 17
创维盒子/双子星云手机/cloudPhone/websocket/webSocketManager.m

@@ -63,22 +63,23 @@ static webSocketManager *webSocketManagerInstance = nil;
 {
     if(self.commandChannelManager){
         
-        if([self.commandChannelManager rc_socketStatus] == RCSocketCloudPhoneStatusConnected
-           ||[self.commandChannelManager rc_socketStatus] == RCSocketCloudPhoneStatusReceived){
-            //链接中不处理
-            HLog(@"WebSocket 链接时已经存在并且链接中");
+        RCSocketCloudPhoneStatus status = [self.commandChannelManager rc_socketStatus];
+        //HLog(@"rc_socketStatus:%ld",status)
+        if(status == RCSocketCloudPhoneStatusFailed
+           ||status == RCSocketCloudPhoneStatusClosedByServer
+           ||status == RCSocketCloudPhoneStatusClosedByUser
+           ||!ksharedAppDelegate.isWebSockLinkOKAginType//断开了
+           )
+        {
+            HLog(@"WebSocket 链接时已经存在并且链接失效:%ld",status);
+            [self.commandChannelManager rc_close];
+             self.commandChannelManager = nil;
         }
         else{
-            HLog(@"WebSocket 链接时已经存在并且链接失效");
-            [self.commandChannelManager rc_close];
-
-            self.commandChannelManager = nil;
-            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-                [self opencommandChannelManagerrc_openURL];
-            });
+            HLog(@"WebSocket 链接时已经存在并且链接中:%ld",status);
+            return;
         }
         
-        return;
     }
     
     KWeakSelf
@@ -380,15 +381,22 @@ static webSocketManager *webSocketManagerInstance = nil;
 
 - (void)checkAllTaskFun
 {
-    if([self.commandChannelManager rc_socketStatus] == RCSocketCloudPhoneStatusConnected
-       ||[self.commandChannelManager rc_socketStatus] == RCSocketCloudPhoneStatusReceived){
-        HLog(@"WebSocket 链接正常");
+    RCSocketCloudPhoneStatus status = [self.commandChannelManager rc_socketStatus];
+    //HLog(@"rc_socketStatus:%ld",status)
+    if(status == RCSocketCloudPhoneStatusFailed
+       ||status == RCSocketCloudPhoneStatusClosedByServer
+       ||status == RCSocketCloudPhoneStatusClosedByUser
+       ||!ksharedAppDelegate.isWebSockLinkOKAginType//断开了
+       )
+    {
+        HLog(@"WebSocket 链接异常:%ld",status);
+        return;
     }
     else{
-        HLog(@"WebSocket 链接异常:%ld",[self.commandChannelManager rc_socketStatus]);
-        return;
+        HLog(@"WebSocket 链接正常:%ld",status);
     }
     
+    
     //处理相册备份
     [[backupsFileManager shareInstance] checkReBackupsFileFun];
     

+ 14 - 5
创维盒子/双子星云手机/connectDeviceManager/connectDeviceManager.m

@@ -639,24 +639,33 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
         return;
     }
     
+    HLog(@"WebSocket11111  hxd-1")
     //局域网不通 瑞云还没连接好
     if(!self.isPingOk && !didRuiyunLinkType){
         return;
     }
 
     //切换设备
+    HLog(@"WebSocket11111  hxd0")
     if([webSocketManager shareInstance].commandChannelManager){
         
-        [[webSocketManager shareInstance].commandChannelManager rc_close];
-        [webSocketManager shareInstance].commandChannelManager = nil;
+//        [[webSocketManager shareInstance].commandChannelManager rc_close];
+//        [webSocketManager shareInstance].commandChannelManager = nil;
+        ksharedAppDelegate.isWebSockLinkOKAginType = NO;
         
-        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-            [[webSocketManager shareInstance] opencommandChannelManagerrc_openURL];
+        HLog(@"WebSocket11111  hxd1")
+        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+            HLog(@"WebSocket11111  hxd2")
+            if([connectDeviceManager shareInstance].isFirstInputPwdDone){
+                HLog(@"WebSocket11111  hxd3")
+                [[webSocketManager shareInstance] opencommandChannelManagerrc_openURL];
+            }
         });
     }
     else{//第一次启动
-        
+        HLog(@"WebSocket11111  hxd10")
         if([connectDeviceManager shareInstance].isFirstInputPwdDone){
+            HLog(@"WebSocket11111  hxd11")
             [[webSocketManager shareInstance] opencommandChannelManagerrc_openURL];
         }
     }