瀏覽代碼

1.缓存设备信息,在无网络情况下可以进入云机(未飞行模式听歌做准备工作)

huangxiaodong 3 月之前
父節點
當前提交
4185102a47

+ 23 - 26
创维盒子/code/AppDelegate/SceneDelegate.m

@@ -227,7 +227,7 @@
                 customToastVew *toastview = [customToastVew makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)];
                 [toastview show];
                 [self->_customLaunchV addSubview:toastview];
-                return;
+                //return;
             }
             
             [self getDeviceMsgInMainVCWith:deviceDict];
@@ -255,12 +255,23 @@
 - (void)getDeviceMsgInMainVCWith:(NSDictionary*)deviceDict
 {
 
+    //有设备了先去做链接准备  // 80bec9c5
+    NSString *SNStr = deviceDict[@"Const_Have_Add_Device_SN"];
+    
     if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
     {
+        
+        NSString *key = [[NSString alloc] initWithFormat:@"%@_%@",@"ThirdIdBySn",SNStr];
+        NSDictionary*preResponseObject =  [HWDataManager getObjectWithKey:key];
+        if(preResponseObject){
+            DeviceThirdIdModel *model = [[DeviceThirdIdModel alloc] initWithDictionary:preResponseObject error:nil];
+            ksharedAppDelegate.DeviceThirdIdMod = model;
+        }
+        
         BOOL isPrivacyMode = [HWDataManager getBoolWithKey:Const_Have_Add_Device_Privacy_Mode];
         NSInteger maskModel =  [HWDataManager getIntegerWithKey:Const_Mask_View_Model];
         if(!isPrivacyMode && maskModel == 0){
-            return;
+            //return;
         }
         
         [self initMainTabbarFun];
@@ -269,32 +280,10 @@
     }
     
     KWeakSelf
-    //有设备了先去做链接准备  // 80bec9c5
-    NSString *SNStr = deviceDict[@"Const_Have_Add_Device_SN"];
+   
     NSString *sdnId = ksharedAppDelegate.DeviceThirdIdMod.data.sdnId;
     if(SNStr && !sdnId){
-        //瑞云方案
-//        [[connectDeviceManager shareInstance] getThridMsgBySN:SNStr needReconnect:YES didNetEnd:^(NSInteger didSuc) {
-//            
-//            if(didSuc == 0){
-//                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-//                    mainBlock(^{
-//                        [weakSelf showNetErrorAlertFun];
-//                        [weakSelf enterMainVCFromSceneSecondStepFun];
-//                    });
-//                });
-//            }
-//            else if(didSuc == 2
-//                    ||didSuc == 201
-//                    ||didSuc == 202){
-//                [weakSelf gotoScanAginByThridMsgErrorFun:didSuc];
-//            }
-//            else{
-//                [weakSelf enterMainVCFromSceneSecondStepFun];
-//            }
-//            
-//        }];
-        
+       
         //webrtc方案
         NSMutableDictionary *paraDict = [NSMutableDictionary new];
         [paraDict setValue:SNStr forKey:@"sn"];
@@ -306,8 +295,16 @@
             if(model.status == 0
                && model.data)
             {//根据SN 获取到正确的信息
+                
                 ksharedAppDelegate.DeviceThirdIdMod = model;
                 
+                NSMutableDictionary *IdDataDict = [[NSMutableDictionary alloc] initWithDictionary:responseObject];
+                [IdDataDict removeObjectForKey:@"retCode"];
+                
+                //数据缓存
+                NSString *key = stringKeyAddSn(@"ThirdIdBySn");
+                [HWDataManager setObjectWithKey:key value:IdDataDict];
+                
                 NSString*desPwdstr = [RSATool AES128Decrypt:model.data.password key:AESCODEKEEYY];
                 
                 /*密码保持在本地*/

+ 1 - 1
创维盒子/code/Class/Calculator/CalculatorViewController.m

@@ -414,7 +414,7 @@
                         [view show];
                         [self.view addSubview:view];
                         
-                        return;
+                        //return;
                     }
                     
                     ksharedAppDelegate.isFirstInputPwdDone = YES;

+ 1 - 1
创维盒子/code/Class/Controller/HWWebViewController.m

@@ -358,7 +358,7 @@
                             [view show];
                             [self.view addSubview:view];
                             
-                            return;
+                            //return;
                         }
                         
                         ksharedAppDelegate.isFirstInputPwdDone = YES;

+ 1 - 1
创维盒子/code/Class/Guide/inputPWDViewController.m

@@ -530,7 +530,7 @@
         [view show];
         [self.view addSubview:view];
         
-        return;
+        //return;
     }
     
     ksharedAppDelegate.isFirstInputPwdDone = YES;