Quellcode durchsuchen

1.密钥调试OK

huangxiaodong vor 2 Monaten
Ursprung
Commit
1a7840528d

+ 23 - 45
创维盒子/双子星云手机/Class/Guide/QRCodeScanViewController.m

@@ -314,9 +314,9 @@ bool isDownType = YES;
 - (void)nextStep:(NSString *)sn{
     
     //新需求
-//    curScanCode = sn;
-//    [self inputSecretKeyFun];
-//    return;
+    curScanCode = sn;
+    [self inputSecretKeyFun];
+    return;
     
     
     KWeakSelf
@@ -421,9 +421,29 @@ bool isDownType = YES;
             [HWDataManager setObjectWithKey:Const_Have_Add_Device_Privacy_Mode value:[NSNumber numberWithBool:model.data.isPrivacyMode]];
             
             [HWDataManager setObjectWithKey:Const_Have_Add_Device value:dict];
+            
+            [weakSelf gotoGuideViewFunBy:curScanCode];
         }
         else{
             
+            NSInteger state = 2;
+            if (model.status == 201 || model.status == 202) {
+                state = model.status;
+                
+                if(self->_didScanErrorFun){
+                    self->_didScanErrorFun(state);
+                }
+            }
+            else if (model.status == 203 ) {
+                NSString *msg = model.msg;
+                if(msg){
+                    [[iToast makeText:msg] show];
+                }
+            }
+            
+            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+                [self.navigationController popViewControllerAnimated:YES];
+            });
         }
         
         
@@ -433,48 +453,6 @@ bool isDownType = YES;
     }];
 }
 
-//{
-//    KWeakSelf
-//
-//    [[netWorkManager shareInstance] getThridMsgBySN:sn success:^(id  _Nonnull responseObject) {
-//        DeviceThirdIdModel *model = responseObject;
-//        if([model isKindOfClass:[DeviceThirdIdModel class]]){
-//
-//            if(model.status == 0 && model.data){
-//                [weakSelf gotoGuideViewFunBy:sn];
-//            }
-//            else{
-//                NSInteger state = 2;
-//                if (model.status == 201 || model.status == 202) {
-//                    state = model.status;
-//                }
-//
-//                if(self->_didScanErrorFun){
-//                    self->_didScanErrorFun(state);
-//                }
-//                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-//                    [self.navigationController popViewControllerAnimated:YES];
-//                });
-//            }
-//        }
-//        else{
-//            if(self->_didScanErrorFun){
-//                self->_didScanErrorFun(2);
-//            }
-//            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-//                [self.navigationController popViewControllerAnimated:YES];
-//            });
-//        }
-//
-//    } failure:^(NSError * _Nonnull error) {
-//        if(self->_didScanErrorFun){
-//            self->_didScanErrorFun(0);
-//        }
-//        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-//            [self.navigationController popViewControllerAnimated:YES];
-//        });
-//    }];
-//}
 
 #pragma mark GuideViewController
 

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

@@ -11,9 +11,12 @@
 #import "RSATool.h"
 #import <TZImageManager.h>
 #import <TZImagePickerController.h>
+#import "QRCodeInputSecretKeyView.h"
 
 @interface QRCodeScanForChangeDeviceViewController ()<AVCaptureMetadataOutputObjectsDelegate,AVCaptureVideoDataOutputSampleBufferDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate,TZImagePickerControllerDelegate>
-
+{
+    NSString *curScanCode;//当前扫码出来的二维码
+}
 @property(nonatomic,strong)AVCaptureVideoPreviewLayer *layer;
 
 //捕捉会话
@@ -342,6 +345,12 @@ bool isDownType22 = YES;
 #pragma mark 根据扫码得到的SN 重新获取信息
 - (void)getScanSnMsgBy:(NSString*)snStr withDict:(NSMutableDictionary*)deviceDict
 {
+    
+    //新需求
+    curScanCode = snStr;
+    [self inputSecretKeyFunwithDict:deviceDict];
+    return;
+    
     if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
     {
         [[iToast makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)] show];
@@ -455,6 +464,144 @@ bool isDownType22 = YES;
     
 }
 
+#pragma mark 需要用户输入秘钥
+- (void)inputSecretKeyFunwithDict:(NSMutableDictionary*)deviceDict
+{
+    QRCodeInputSecretKeyView *view = [[QRCodeInputSecretKeyView alloc] init];
+    [self.view addSubview:view];
+    
+    [view mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(0);
+        make.right.mas_equalTo(0);
+        make.top.mas_equalTo(0);
+        make.bottom.mas_equalTo(0);
+    }];
+    
+    KWeakSelf
+    view.didClickCancelButton = ^{
+        [weakSelf backBtnPressed];
+    };
+    
+    view.didClickOKButton = ^(NSString * _Nonnull codeStr) {
+        [weakSelf checkNewCodeAndSnBy:codeStr withDict:deviceDict];
+    };
+}
+
+#pragma mark 新验证接口
+- (void)checkNewCodeAndSnBy:(NSString*)codeStr withDict:(NSMutableDictionary*)deviceDict
+{
+    NSMutableDictionary *paraDict = [NSMutableDictionary new];
+    if (curScanCode) {
+        [paraDict setValue:curScanCode forKey:@"sn"];
+    }
+    if (codeStr) {
+        [paraDict setValue:codeStr forKey:@"hash"];
+    }
+    
+    KWeakSelf
+    [[netWorkManager shareInstance] CommonGetWithCallBackCode:getClientInfoByHash Parameters:paraDict success:^(id  _Nonnull responseObject) {
+        
+        DeviceThirdIdModel *model = [[DeviceThirdIdModel alloc] initWithDictionary:responseObject error:nil];
+
+        if(model.status == 0
+           && model.data)
+        {//根据SN 获取到正确的信息
+            
+            {//之前封装的流程
+                ksharedAppDelegate.DeviceThirdIdMod = model;
+                
+                NSString*desPwdstr = [RSATool AES128Decrypt:model.data.password key:AESCODEKEEYY];
+                
+                /*密码保持在本地*/
+                NSDictionary *deviceDict = [HWDataManager getObjectWithKey:Const_Have_Add_Device];
+                NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithDictionary:deviceDict];
+                [dict setObject:desPwdstr forKey:Const_Have_Add_Device_PWD];
+                
+                NSString *sdnid = model.data.sdnId;
+                
+                if(sdnid){
+                    [dict setObject:sdnid forKey:Const_Have_Add_Device_sdnid];
+                }
+                
+                [HWDataManager setObjectWithKey:Const_Have_Add_Device_Privacy_Mode value:[NSNumber numberWithBool:model.data.isPrivacyMode]];
+                
+                [HWDataManager setObjectWithKey:Const_Have_Add_Device value:dict];
+            }
+           
+            //原来流程
+            //数据埋点
+            [[netWorkManager shareInstance] DataEmbeddingPointBy:2 withEventValue:@"Change_device"];
+            
+            NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithDictionary:deviceDict];
+            [dict setObject:codeStr 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;
+                ksharedAppDelegate.DeviceWebRtcMsgMod = nil;
+                HLog(@"isWebSockLinkOKAginType NO")
+                
+                [ksharedAppDelegate resetBoxNetUrlFun];
+                
+                //[[webRtcManager shareManager] beginToLinkWebRtcFun];
+                [[NSNotificationCenter defaultCenter] postNotificationName:GuideOkNotification object:nil];
+                //改走http方案
+                [[NSNotificationCenter defaultCenter] postNotificationName:getExtraFilesDoneNotification object:nil];/*发送通知*/
+            });
+            
+        }
+        else{
+            
+            NSInteger state = 2;
+            if (model.status == 201 || model.status == 202) {
+                state = model.status;
+                
+                if(self->_didScanErrorFun){
+                    self->_didScanErrorFun(state);
+                }
+            }
+            else if (model.status == 203 ) {
+                NSString *msg = model.msg;
+                if(msg){
+                    [[iToast makeText:msg] show];
+                }
+            }
+            
+            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+                [self.navigationController popViewControllerAnimated:YES];
+            });
+        }
+        
+        
+    } failure:^(NSError * _Nonnull error) {
+        HLog("网络报错");
+        
+    }];
+}
+
+
 //光感传感器代理
 -(void)captureOutput:(AVCaptureOutput*)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection*)connection{
 

+ 9 - 0
创维盒子/双子星云手机/Info.plist

@@ -106,6 +106,15 @@
 				<key>NSIncludesSubdomains</key>
 				<true/>
 			</dict>
+			<key>129.1.1.129</key>
+			<dict>
+				<key>NSExceptionAllowsInsecureHTTPLoads</key>
+				<true/>
+				<key>NSExceptionRequiresForwardSecrecy</key>
+				<false/>
+				<key>NSIncludesSubdomains</key>
+				<true/>
+			</dict>
 			<key>14.18.190.138</key>
 			<dict>
 				<key>NSExceptionAllowsInsecureHTTPLoads</key>