浏览代码

1.隐私模式 匹配密码逻辑优化

huangxiaodong 2 年之前
父节点
当前提交
840d55f8bd

+ 3 - 0
创维盒子/双子星云手机/AppDelegate/Config/Const.h

@@ -31,6 +31,9 @@ UIKIT_EXTERN NSString *const Const_Mask_View_Open_Web_Tips;
 /*是否有添加设备*/
 UIKIT_EXTERN NSString *const Const_Have_Add_Device;
 
+/*用于存储添加设备的sdnid*/
+UIKIT_EXTERN NSString *const Const_Have_Add_Device_sdnid;
+
 /*用于存储添加设备的SN号*/
 UIKIT_EXTERN NSString *const Const_Have_Add_Device_SN;
 

+ 3 - 0
创维盒子/双子星云手机/AppDelegate/Config/Const.m

@@ -34,6 +34,9 @@ NSString *const Const_Have_Add_Device_SN = @"Const_Have_Add_Device_SN";
 /*用于存储添加设备的密码*/
 NSString *const Const_Have_Add_Device_PWD = @"Const_Have_Add_Device_PWD";
 
+/*用于存储添加设备的sdnid*/
+NSString *const Const_Have_Add_Device_sdnid = @"Const_Have_Add_Device_sdnid";
+
 // 定义一个CloudPhoneType的字符串类型作为枚举类型
 NSString *const Const_NAMEXINGDONG = @"星动";
 NSString *const Const_NAMEXINGYAO = @"星曜";

+ 25 - 11
创维盒子/双子星云手机/Class/Calculator/CalculatorViewController.m

@@ -34,6 +34,8 @@
     if (haveOpenMask == NO){
         [self addGuideView];
     }
+    
+    [[connectDeviceManager shareInstance] RefreshThridMsg];
 }
 
 - (void)addGuideView{
@@ -358,12 +360,24 @@
         NSString *SNStr = deviceDict[@"Const_Have_Add_Device_SN"];
         
         if(SNStr){
-            [[connectDeviceManager shareInstance] getThridMsgBySN:SNStr needReconnect:NO didNetEnd:^(bool didSuc) {
-                
-                if(didSuc){
-                    NSString *curPwd = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.password;
-                    NSString*desPwdStr  = [RSATool AES128Decrypt:curPwd key:AESCODEKEEYY];
+//            [[connectDeviceManager shareInstance] getThridMsgBySN:SNStr needReconnect:NO didNetEnd:^(bool didSuc) {
+//
+//                if(didSuc){
+                    NSString *curPwd = nil;
+                    NSString*desPwdStr = nil;
                     
+                    if([connectDeviceManager shareInstance].DeviceThirdIdMod.data.password
+                       && [connectDeviceManager shareInstance].DeviceThirdIdMod.data.password.length > 0){
+                        curPwd = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.password;
+                        desPwdStr  = [RSATool AES128Decrypt:curPwd key:AESCODEKEEYY];
+                    }
+                    else{
+                        if(deviceDict && [[deviceDict allKeys] containsObject:Const_Have_Add_Device_PWD])
+                        {
+                            desPwdStr = deviceDict[Const_Have_Add_Device_PWD];
+                        }
+                    }
+            
                     if ([desPwdStr isEqualToString:text]){
                         [connectDeviceManager shareInstance].isFirstInputPwdDone = YES;
                         
@@ -372,12 +386,12 @@
                             [[NSNotificationCenter defaultCenter] postNotificationName:ShowImgAndVoiceNotification object:nil];
                         });
                     }
-                }
-                else{
-                    
-                }
-                
-            }];
+//                }
+//                else{
+//
+//                }
+//
+//            }];
         }
     }
     

+ 25 - 11
创维盒子/双子星云手机/Class/Controller/HWWebViewController.m

@@ -50,6 +50,8 @@
        context:nil];
     [self.webView addObserver:self forKeyPath:@"title" options:NSKeyValueObservingOptionNew
        context:nil];
+    
+    [[connectDeviceManager shareInstance] RefreshThridMsg];
 }
 
 - (void)viewDidAppear:(BOOL)animated{
@@ -320,11 +322,23 @@
         NSString *SNStr = deviceDict[@"Const_Have_Add_Device_SN"];
         
         if(SNStr){
-            [[connectDeviceManager shareInstance] getThridMsgBySN:SNStr needReconnect:NO didNetEnd:^(bool didSuc) {
-                
-                if(didSuc){
-                    NSString *curPwd = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.password;
-                    NSString*desPwdStr  = [RSATool AES128Decrypt:curPwd key:AESCODEKEEYY];
+//            [[connectDeviceManager shareInstance] getThridMsgBySN:SNStr needReconnect:NO didNetEnd:^(bool didSuc) {
+//
+//                if(didSuc){
+                    NSString *curPwd = nil;
+                    NSString*desPwdStr = nil;
+                    
+                    if([connectDeviceManager shareInstance].DeviceThirdIdMod.data.password
+                       && [connectDeviceManager shareInstance].DeviceThirdIdMod.data.password.length > 0){
+                        curPwd = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.password;
+                        desPwdStr  = [RSATool AES128Decrypt:curPwd key:AESCODEKEEYY];
+                    }
+                    else{
+                        if(deviceDict && [[deviceDict allKeys] containsObject:Const_Have_Add_Device_PWD])
+                        {
+                            desPwdStr = deviceDict[Const_Have_Add_Device_PWD];
+                        }
+                    }
                     
                     if ([desPwdStr isEqualToString:text]){
                         [connectDeviceManager shareInstance].isFirstInputPwdDone = YES;
@@ -334,12 +348,12 @@
                             [[NSNotificationCenter defaultCenter] postNotificationName:ShowImgAndVoiceNotification object:nil];
                         });
                     }
-                }
-                else{
-                    
-                }
-                
-            }];
+//                }
+//                else{
+//
+//                }
+//
+//            }];
         }
     }
     

+ 28 - 11
创维盒子/双子星云手机/Class/Guide/inputPWDViewController.m

@@ -32,6 +32,9 @@
     // Do any additional setup after loading the view.
     pwd = @"";
     [self drawAnyView];
+    
+    //每次进入刷新密码
+    [[connectDeviceManager shareInstance] RefreshThridMsg];
 }
 
 
@@ -440,11 +443,25 @@
         NSString *SNStr = deviceDict[@"Const_Have_Add_Device_SN"];
         
         if(SNStr){
-            [[connectDeviceManager shareInstance] getThridMsgBySN:SNStr needReconnect:NO  didNetEnd:^(bool didSuc) {
-                
-                if(didSuc){
-                    NSString *curPwd = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.password;
-                    NSString*desPwdStr  = [RSATool AES128Decrypt:curPwd key:AESCODEKEEYY];
+//            [[connectDeviceManager shareInstance] getThridMsgBySN:SNStr needReconnect:NO  didNetEnd:^(bool didSuc) {
+//
+//                if(didSuc){
+                    
+            NSString *curPwd = nil;
+            NSString*desPwdStr = nil;
+            
+            if([connectDeviceManager shareInstance].DeviceThirdIdMod.data.password
+               && [connectDeviceManager shareInstance].DeviceThirdIdMod.data.password.length > 0){
+                curPwd = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.password;
+                desPwdStr  = [RSATool AES128Decrypt:curPwd key:AESCODEKEEYY];
+            }
+            else{
+                if(deviceDict && [[deviceDict allKeys] containsObject:Const_Have_Add_Device_PWD])
+                {
+                    desPwdStr = deviceDict[Const_Have_Add_Device_PWD];
+                }
+            }
+            
                     
                     if ([desPwdStr isEqualToString:text]){
                         [self verifyPwdRightFun];
@@ -453,12 +470,12 @@
                         [self verifyPwdWrongFun:NO];
                     }
                     
-                }
-                else{
-                    [self verifyPwdWrongFun:YES];
-                }
-                
-            }];
+//                }
+//                else{
+//                    [self verifyPwdWrongFun:YES];
+//                }
+//                
+//            }];
         }
     }
     

+ 3 - 0
创维盒子/双子星云手机/connectDeviceManager/connectDeviceManager.h

@@ -37,6 +37,9 @@ typedef void (^netWork_DidEndByOK) (bool didSuc);
 #pragma mark 根据扫码的sn获取第三方信息 是否需要重连
 -(void)getThridMsgBySN:(NSString*)snStr needReconnect:(BOOL)needReconnect didNetEnd:(netWork_DidEndByOK)didNetEndIsOK;
 
+#pragma mark 刷新扫码的sn获取第三方信息 是否需要重连
+-(void)RefreshThridMsg;
+
 #pragma mark 保持卡密码
 -(void)updateCardInfoBySN:(NSString*)snStr withPwdStr:(NSString*)pwd didNetEnd:(netWork_DidEndByOK)didNetEndIsOK;
 @end

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

@@ -89,6 +89,14 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
             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 value:dict];
             
             //
@@ -112,6 +120,23 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
     }];
 }
 
+#pragma mark 刷新扫码的sn获取第三方信息 是否需要重连
+-(void)RefreshThridMsg
+{
+    /*先判断本地有无设备 无设备时需要先扫码添加设备*/
+    NSDictionary *deviceDict = [HWDataManager getObjectWithKey:Const_Have_Add_Device];
+    if (deviceDict && [[deviceDict allKeys] containsObject:Const_Have_Add_Device_SN]){
+        //有设备了先去做链接准备  // 80bec9c5
+        NSString *SNStr = deviceDict[@"Const_Have_Add_Device_SN"];
+        
+        if(SNStr){
+            [[connectDeviceManager shareInstance] getThridMsgBySN:SNStr needReconnect:NO  didNetEnd:^(bool didSuc) {
+                
+            }];
+        }
+    }
+}
+
 #pragma mark 初始化瑞云的SDK等
 - (void)initRuiyunSDKFun{
     HLog(@"initRuiyunSDKFun");
@@ -215,6 +240,15 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
 
     NSString *curSdnId = self.DeviceThirdIdMod.data.sdnId; //@"3dfe7c1f";
     
+    if(!curSdnId){
+        NSDictionary *deviceDict = [HWDataManager getObjectWithKey:Const_Have_Add_Device];
+        
+        if(deviceDict && [[deviceDict allKeys] containsObject:Const_Have_Add_Device_sdnid])
+        {
+            curSdnId = deviceDict[Const_Have_Add_Device_sdnid];
+        }
+    }
+    
     /// 3. 根据对端的 SDN ID 创建连接
     [RaylinkProxy.sharedManager createNewConnection:curSdnId];
     

+ 3 - 3
创维盒子/双子星云手机/zh-Hans.lproj/Localizable.strings

@@ -157,7 +157,7 @@
 "my_set_no_time_top"   = "到期时间:";
 "my_set_no_vip_tips"   = "你当前为非会员,无法享受专属私密手机";
 "my_set_no_vip_open_vip"   = "立即开通";
-"my_set_no_change_logo"   = "更换图标";
+"my_set_no_change_logo"   = "登录伪装";
 "my_set_no_hidden_app"   = "进程隐藏";
 "my_set_no_invite_friend"   = "邀请好友";
 "my_set_no_invite_friend_get_vip"   = "邀请好友送会员";
@@ -285,9 +285,9 @@
 "my_set_about_version_tap_sn"   = "SN号";
 "my_set_about_version_tap_av"   = "AV版本号";
 "my_set_Privacy_Model"   = "隐私模式";
-"my_set_Privacy_Model_tip"   = "隐私模式下,具有设置登录密码、更换图标、翻转退出等保护您个人信息安全的功能";
+"my_set_Privacy_Model_tip"   = "隐私模式下,具有设置登录密码、登录伪装、翻转退出等保护您个人信息安全的功能";
 "my_set_Privacy_Mode_set"   = "隐私模式设置";
-"my_set_Privacy_Mode_tip1"   = "隐私模式下,具有设置登录密码、更换图标、翻转退出等保护您个人信息安全的功能";
+"my_set_Privacy_Mode_tip1"   = "隐私模式下,具有设置登录密码、登录伪装、翻转退出等保护您个人信息安全的功能";
 "my_set_Privacy_Mode_tip2"   = "若未选择开启隐私模式,可到设置中开启";
 "my_set_Privacy_Mode_open"   = "开启隐私模式";
 "my_set_no_change_login"   = "登录伪装";