浏览代码

1.去掉所有跟瑞云相管理的地方

huangxiaodong 1 年之前
父节点
当前提交
b165e772c2

+ 27 - 7
创维盒子/双子星云手机/Class/Guide/GuideViewController.m

@@ -39,10 +39,8 @@
     [self drawAnyView];
     
     
-    if([[connectDeviceManager shareInstance] curConnectDeviceState] == DeviceConnectUnknown){
-        [[connectDeviceManager shareInstance] getThridMsgBySN:sn needReconnect:YES didNetEnd:^(NSInteger didSuc) {
-            
-        }];
+    if(!ksharedAppDelegate.isWebSockLinkOKAginType){
+        [[webRtcManager shareManager] beginToLinkWebRtcFun];
     }
 }
 
@@ -68,15 +66,37 @@
             HLog(@"没有拿到设备信息");
             
             KWeakSelf
-            [[connectDeviceManager shareInstance] getThridMsgBySN:sn needReconnect:YES didNetEnd:^(NSInteger didSuc) {
-                if(didSuc){
-                    
+//            [[connectDeviceManager shareInstance] getThridMsgBySN:sn needReconnect:YES didNetEnd:^(NSInteger didSuc) {
+//                if(didSuc){
+//                    
+//                }
+//                else{
+//                    [[iToast makeText:NSLocalizedString(@"guide_qrcoede_tips_get_SdnID_fail",nil)] show];
+//                }
+//                
+//                [weakSelf startMoveView];
+//            }];
+            
+            [[netWorkManager shareInstance] getThridMsgBySN:sn success:^(id  _Nonnull responseObject) {
+                DeviceThirdIdModel *model = responseObject;
+                if([model isKindOfClass:[DeviceThirdIdModel class]]){
+                  
+                    if(model.status == 0 && model.data){
+                        
+                    }
+                    else{
+                        [[iToast makeText:NSLocalizedString(@"guide_qrcoede_tips_get_SdnID_fail",nil)] show];
+                    }
                 }
                 else{
                     [[iToast makeText:NSLocalizedString(@"guide_qrcoede_tips_get_SdnID_fail",nil)] show];
                 }
                 
                 [weakSelf startMoveView];
+                
+            } failure:^(NSError * _Nonnull error) {
+                [[iToast makeText:NSLocalizedString(@"guide_qrcoede_tips_get_SdnID_fail",nil)] show];
+                [weakSelf startMoveView];
             }];
             
             return;

+ 34 - 9
创维盒子/双子星云手机/Class/Guide/SetPWDSecondViewController.m

@@ -255,7 +255,7 @@
                 NSString *SNStr = deviceDict[@"Const_Have_Add_Device_SN"];
                 if(SNStr){
                     KWeakSelf
-                    [[connectDeviceManager shareInstance] updateCardInfoBySN:SNStr withPwdStr:pwd didNetEnd:^(NSInteger didSuc) {
+                    [[netWorkManager shareInstance] updateCardInfoBySN:SNStr withPwdStr:pwd didNetEnd:^(NSInteger didSuc) {
                         
                         if(didSuc){
                             [weakSelf getPwdFunBy:SNStr];
@@ -311,22 +311,47 @@
 -(void)getPwdFunBy:(NSString*)SNStr
 {
     KWeakSelf
-    [[connectDeviceManager shareInstance] getThridMsgBySN:SNStr needReconnect:NO  didNetEnd:^(NSInteger didSuc) {
-        
-        if(didSuc){
-            if(self->_isForgetPwdType){
-                [[NSNotificationCenter defaultCenter] postNotificationName:forgetPwdDidSetNotification object:nil];
+//    [[connectDeviceManager shareInstance] getThridMsgBySN:SNStr needReconnect:NO  didNetEnd:^(NSInteger didSuc) {
+//        
+//        if(didSuc){
+//            if(self->_isForgetPwdType){
+//                [[NSNotificationCenter defaultCenter] postNotificationName:forgetPwdDidSetNotification object:nil];
+//            }
+//            else{
+////                [[NSNotificationCenter defaultCenter] postNotificationName:GuideOkNotification object:nil];
+//                [weakSelf gotoPrivacyModeTipVCFun];
+//            }
+//            
+//        }
+//        else{
+//            [[iToast makeText:NSLocalizedString(@"log_login_system_busy",nil)] show];
+//        }
+//        
+//    }];
+    
+    [[netWorkManager shareInstance] getThridMsgBySN:SNStr success:^(id  _Nonnull responseObject) {
+        DeviceThirdIdModel *model = responseObject;
+        if([model isKindOfClass:[DeviceThirdIdModel class]]){
+          
+            if(model.status == 0 && model.data){
+                if(self->_isForgetPwdType){
+                    [[NSNotificationCenter defaultCenter] postNotificationName:forgetPwdDidSetNotification object:nil];
+                }
+                else{
+    //                [[NSNotificationCenter defaultCenter] postNotificationName:GuideOkNotification object:nil];
+                    [weakSelf gotoPrivacyModeTipVCFun];
+                }
             }
             else{
-//                [[NSNotificationCenter defaultCenter] postNotificationName:GuideOkNotification object:nil];
-                [weakSelf gotoPrivacyModeTipVCFun];
+                [[iToast makeText:NSLocalizedString(@"log_login_system_busy",nil)] show];
             }
-            
         }
         else{
             [[iToast makeText:NSLocalizedString(@"log_login_system_busy",nil)] show];
         }
         
+    } failure:^(NSError * _Nonnull error) {
+        [[iToast makeText:NSLocalizedString(@"log_login_system_busy",nil)] show];
     }];
 }
 

+ 149 - 36
创维盒子/双子星云手机/Class/Set/ChangeDevice/QRCodeScanForChangeDeviceViewController.m

@@ -342,28 +342,115 @@ bool isDownType22 = YES;
         //移除扫描层layer
         [self.layer removeFromSuperlayer];
         
+        //webrtc方案
+        [self getScanSnMsgBy:resStr withDict:deviceDict];
+        
+        //瑞云方案
+//        [self showNewIndicatorHaveStrWithCanBack:NO canTouch:NO showText:NSLocalizedString(@"guide_qrcoede_tips_ok",nil)];
+//        [[connectDeviceManager shareInstance] getThridMsgBySN:resStr needReconnect:YES didNetEnd:^(NSInteger didSuc) {
+//            
+//            [self removeNewIndicatorHaveStr];
+//            
+//            if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
+//            {
+//                [[iToast makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)] show];
+//                [self.navigationController popViewControllerAnimated:YES];
+//                return;
+//            }
+//            
+//            
+//            if(didSuc == 1){
+//                
+//                //数据埋点
+//                [[netWorkManager shareInstance] DataEmbeddingPointBy:2 withEventValue:@"Change_device"];
+//                
+//                NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithDictionary:deviceDict];
+//                [dict setObject:resStr forKey:Const_Have_Add_Device_SN];
+//                [HWDataManager setObjectWithKey:Const_Have_Add_Device value:dict];
+//                
+//                BOOL didSetBackWork = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_didSet_working_background)];
+//                if(!didSetBackWork){
+//                    [HWDataManager setBoolWithKey:stringKeyAddSn(Const_file_Transfe_didSet_working_background) value:YES];
+//                    [HWDataManager setBoolWithKey:stringKeyAddSn(Const_file_Transfe_working_background) value:YES];
+//                }
+//                
+//                [webRtcManager shareManager].isChangeBoxType = YES;
+//                [[webRtcManager shareManager] closeLinkWebRtcFun];
+//                
+//                //尝试修复偶现扫码切换云机 已经扫码到 要输新SN密码 但是云机显示是旧SN的 延时一秒跳转
+//                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+//                    
+//                    //清除原来设置的数据
+//                    ksharedAppDelegate.isWebSockLinkOKAginType = NO;
+//                    ksharedAppDelegate.cloudPhoneExtraFileListMod = nil;
+//                    ksharedAppDelegate.DisabledFileTransferType = NO;
+//                    ksharedAppDelegate.isImageNewFor130 = NO;
+//                    ksharedAppDelegate.isNeedShowImageNewType = NO;
+//                    ksharedAppDelegate.TvStatusMod = nil;
+//                    ksharedAppDelegate.NASMsgMod = nil;
+//                    ksharedAppDelegate.isDidShowPwdType = NO;
+//                    ksharedAppDelegate.isDidShowPwdType = NO;
+//                    ksharedAppDelegate.NASFileByBoxService = nil;
+//                    ksharedAppDelegate.NASShareFileService = nil;
+//                    HLog(@"isWebSockLinkOKAginType NO")
+//                    
+//                    [[webRtcManager shareManager] beginToLinkWebRtcFun];
+//                    [[NSNotificationCenter defaultCenter] postNotificationName:GuideOkNotification object:nil];
+//                });
+//                
+//                
+//            }else{
+//                
+//                [webRtcManager shareManager].isChangeBoxType = NO;
+//                
+////                if(didSuc == 2){
+////                    [[iToast makeText:NSLocalizedString(@"scan_sn_data_error_tip",nil)] show];
+////                }
+////                else{
+////                    [[iToast makeText:NSLocalizedString(@"guide_qrcoede_tips_get_SdnID_fail",nil)] show];
+////                }
+//                
+//                if(self->_didScanErrorFun){
+//                    self->_didScanErrorFun(didSuc);
+//                }
+//                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+//                    mainBlock(^{
+//                        [self.navigationController popViewControllerAnimated:YES];
+//                    });
+//                });
+//                
+//            }
+//        }];
+    }
+    else{
+        [[iToast makeText:NSLocalizedString(@"guide_qrcoede_tips_error",nil)] show];
+    }
+}
 
+#pragma mark 根据扫码得到的SN 重新获取信息
+- (void)getScanSnMsgBy:(NSString*)snStr withDict:(NSMutableDictionary*)deviceDict
+{
+    if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
+    {
+        [[iToast makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)] show];
+        [self.navigationController popViewControllerAnimated:YES];
+        return;
+    }
+    
+    [self showNewIndicatorHaveStrWithCanBack:NO canTouch:NO showText:NSLocalizedString(@"guide_qrcoede_tips_ok",nil)];
+    
+    [[netWorkManager shareInstance] getThridMsgBySN:snStr success:^(id  _Nonnull responseObject) {
+        [self removeNewIndicatorHaveStr];
         
-        [self showNewIndicatorHaveStrWithCanBack:NO canTouch:NO showText:NSLocalizedString(@"guide_qrcoede_tips_ok",nil)];
-        [[connectDeviceManager shareInstance] getThridMsgBySN:resStr needReconnect:YES didNetEnd:^(NSInteger didSuc) {
-            
-            [self removeNewIndicatorHaveStr];
-            
-            if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
-            {
-                [[iToast makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)] show];
-                [self.navigationController popViewControllerAnimated:YES];
-                return;
-            }
-            
-            
-            if(didSuc == 1){
-                
+        DeviceThirdIdModel *model = responseObject;
+        if([model isKindOfClass:[DeviceThirdIdModel class]]){
+          
+            if(model.status == 0 && model.data){
                 //数据埋点
                 [[netWorkManager shareInstance] DataEmbeddingPointBy:2 withEventValue:@"Change_device"];
                 
                 NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithDictionary:deviceDict];
-                [dict setObject:resStr forKey:Const_Have_Add_Device_SN];
+                [dict setObject:snStr forKey:Const_Have_Add_Device_SN];
                 [HWDataManager setObjectWithKey:Const_Have_Add_Device value:dict];
                 
                 BOOL didSetBackWork = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_didSet_working_background)];
@@ -397,32 +484,58 @@ bool isDownType22 = YES;
                 });
                 
                 
-            }else{
-                
-                [webRtcManager shareManager].isChangeBoxType = NO;
-                
-//                if(didSuc == 2){
-//                    [[iToast makeText:NSLocalizedString(@"scan_sn_data_error_tip",nil)] show];
-//                }
-//                else{
-//                    [[iToast makeText:NSLocalizedString(@"guide_qrcoede_tips_get_SdnID_fail",nil)] show];
-//                }
+            }
+            else{
+                NSInteger state = 2;
+                if (model.status == 201 || model.status == 202) {
+                    state = model.status;
+                }
                 
                 if(self->_didScanErrorFun){
-                    self->_didScanErrorFun(didSuc);
+                    self->_didScanErrorFun(state);
                 }
                 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-                    mainBlock(^{
-                        [self.navigationController popViewControllerAnimated:YES];
-                    });
+                    [self.navigationController popViewControllerAnimated:YES];
                 });
-                
             }
-        }];
-    }
-    else{
-        [[iToast makeText:NSLocalizedString(@"guide_qrcoede_tips_error",nil)] show];
-    }
+        }
+        else{
+            
+            [webRtcManager shareManager].isChangeBoxType = NO;
+            
+            NSInteger didSuc =2;
+            if(model.status == 201 ||model.status == 202){
+                didSuc = model.status;
+            }
+            
+            if(self->_didScanErrorFun){
+                self->_didScanErrorFun(didSuc);
+            }
+            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+                mainBlock(^{
+                    [self.navigationController popViewControllerAnimated:YES];
+                });
+            });
+            
+        }
+        
+    } failure:^(NSError * _Nonnull error) {
+        [self removeNewIndicatorHaveStr];
+        
+        [webRtcManager shareManager].isChangeBoxType = NO;
+        
+        NSInteger didSuc = 0;
+        
+        if(self->_didScanErrorFun){
+            self->_didScanErrorFun(didSuc);
+        }
+        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+            mainBlock(^{
+                [self.navigationController popViewControllerAnimated:YES];
+            });
+        });
+    }];
+    
 }
 
 //光感传感器代理

+ 1 - 1
创维盒子/双子星云手机/Class/Set/ModifyPWD/ModifyPWDSecondViewController.m

@@ -272,7 +272,7 @@
                 if(SNStr){
                     KWeakSelf
                     [self showNewIndicatorWithCanBack:YES canTouch:NO];
-                    [[connectDeviceManager shareInstance] updateCardInfoBySN:SNStr withPwdStr:pwd didNetEnd:^(NSInteger didSuc) {
+                    [[netWorkManager shareInstance] updateCardInfoBySN:SNStr withPwdStr:pwd didNetEnd:^(NSInteger didSuc) {
                         
                         [weakSelf removeNewIndicator];
                         

+ 5 - 1
创维盒子/双子星云手机/Class/Set/view/allVersionView.m

@@ -281,6 +281,10 @@
         return;
     }
     
-    [self.tableView reloadData];
+    KWeakSelf
+    mainBlock(^{
+        [weakSelf.tableView reloadData];
+    });
+    
 }
 @end

+ 14 - 9
创维盒子/双子星云手机/NAS/view/errorAlertTool.m

@@ -205,15 +205,20 @@ static errorAlertTool *shareInstance = nil;
     linkFailAlretVC = nil;
     linkFailAlretType2VC = nil;
     
-    if([[connectDeviceManager shareInstance] curConnectDeviceState] <= 3)
-    {
-        //瑞云发起重连
-        NSString *snStr = ksharedAppDelegate.DeviceThirdIdMod.data.changeSn;
-        if(snStr){
-            //_checkThridConnectNum = 1;
-            [[connectDeviceManager shareInstance] getThridMsgBySN:snStr needReconnect:YES didNetEnd:^(NSInteger didSuc) {
-            }];
-        }
+//    if([[connectDeviceManager shareInstance] curConnectDeviceState] <= 3)
+//    {
+//        //瑞云发起重连
+//        NSString *snStr = ksharedAppDelegate.DeviceThirdIdMod.data.changeSn;
+//        if(snStr){
+//            //_checkThridConnectNum = 1;
+//            [[connectDeviceManager shareInstance] getThridMsgBySN:snStr needReconnect:YES didNetEnd:^(NSInteger didSuc) {
+//            }];
+//        }
+//        return;
+//    }
+    
+    if(!ksharedAppDelegate.isWebSockLinkOKAginType){
+        [[webRtcManager shareManager] beginToLinkWebRtcFun];
         return;
     }
     

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

@@ -528,7 +528,7 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
         [paraDict setValue:enPwdStr forKey:@"password"];
     }
     
-    KWeakSelf
+    //KWeakSelf
     [[netWorkManager shareInstance] CommonPostCallBackCode:updateCardInfo Parameters:paraDict success:^(id  _Nonnull responseObject) {
         
         

+ 2 - 0
创维盒子/双子星云手机/netWork/netWorkManager.h

@@ -53,6 +53,8 @@ typedef void (^netWork_Faild) (NSError *error);
 #pragma mark 根据SN 获取设备信息
 - (void)getThridMsgBySN:(NSString*)snStr success:(netWork_Success)success failure:(netWork_Faild)failure;
 -(void)RefreshThridMsg;
+#pragma mark 修改隐私模式密码
+-(void)updateCardInfoBySN:(NSString*)snStr withPwdStr:(NSString*)pwd didNetEnd:(netWork_DidEndByOK)didNetEndIsOK;
 @end
 
 NS_ASSUME_NONNULL_END

+ 41 - 0
创维盒子/双子星云手机/netWork/netWorkManager.m

@@ -732,4 +732,45 @@ static netWorkManager *Game_NetWorkShareInstance = nil;
         }];
     }
 }
+
+#pragma mark 修改隐私模式密码
+-(void)updateCardInfoBySN:(NSString*)snStr withPwdStr:(NSString*)pwd didNetEnd:(netWork_DidEndByOK)didNetEndIsOK
+{
+    
+    NSMutableDictionary *paraDict = [NSMutableDictionary new];
+    [paraDict setValue:snStr forKey:@"sn"];
+    
+    NSString* enPwdStr = [RSATool AES128Encrypt:pwd key:AESCODEKEEYY];
+    if(enPwdStr){
+        [paraDict setValue:enPwdStr forKey:@"password"];
+    }
+    
+    //KWeakSelf
+    [[netWorkManager shareInstance] CommonPostCallBackCode:updateCardInfo Parameters:paraDict success:^(id  _Nonnull responseObject) {
+        
+        
+        SuperModel*model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
+
+        if(model && model.status == 0)
+        {
+            didNetEndIsOK(YES);
+            
+            ksharedAppDelegate.DeviceThirdIdMod.data.password = enPwdStr;
+            /*密码保持在本地*/
+            NSDictionary *deviceDict = [HWDataManager getObjectWithKey:Const_Have_Add_Device];
+            NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithDictionary:deviceDict];
+            [dict setObject:pwd forKey:Const_Have_Add_Device_PWD];
+            [HWDataManager setObjectWithKey:Const_Have_Add_Device value:dict];
+            
+        }
+        else{
+            didNetEndIsOK(NO);
+        }
+        
+        
+    } failure:^(NSError * _Nonnull error) {
+        HLog("网络报错");
+        didNetEndIsOK(NO);
+    }];
+}
 @end

+ 5 - 0
创维盒子/双子星云手机/webRtc/webRtcManager/webRtcManager.m

@@ -49,6 +49,11 @@
 #pragma mark 开始链接
 - (void)beginToLinkWebRtcFun
 {
+    if(ksharedAppDelegate.isWebSockLinkOKAginType
+       || !ksharedAppDelegate.DeviceWebRtcMsgMod){
+        return;
+    }
+    
     webRtcMsgModel * _webRtcMsgMod = ksharedAppDelegate.DeviceWebRtcMsgMod;
     
     //链接用