|
|
@@ -87,9 +87,9 @@
|
|
|
|
|
|
/** 主界面 - 内部使用 */
|
|
|
- (void)enterMainVCFromScene {
|
|
|
-// ConnectTestViewController *qrCodeVCNav = [[ConnectTestViewController alloc] init];
|
|
|
-// self.window.rootViewController = qrCodeVCNav;
|
|
|
-// return;/*临时测试*/
|
|
|
+ // ConnectTestViewController *qrCodeVCNav = [[ConnectTestViewController alloc] init];
|
|
|
+ // self.window.rootViewController = qrCodeVCNav;
|
|
|
+ // return;/*临时测试*/
|
|
|
|
|
|
/*先判断本地有无设备 无设备时需要先扫码添加设备*/
|
|
|
NSDictionary *deviceDict = [HWDataManager getObjectWithKey:Const_Have_Add_Device];
|
|
|
@@ -103,13 +103,32 @@
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ [self getDeviceMsgInMainVCWith:deviceDict];
|
|
|
+
|
|
|
+ NSString *SNStr = deviceDict[@"Const_Have_Add_Device_SN"];
|
|
|
+ // GuideViewController
|
|
|
+ BOOL haveGuide = [HWDataManager getBoolWithKey:Const_Have_Show_Guide];
|
|
|
+ if (haveGuide) {
|
|
|
+ ;
|
|
|
+ }else {
|
|
|
+ GuideViewController *guiDeVC = [[GuideViewController alloc] init];
|
|
|
+ guiDeVC.delegate = self;
|
|
|
+ guiDeVC.sn = SNStr;
|
|
|
+ self.window.rootViewController = guiDeVC;
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+- (void)getDeviceMsgInMainVCWith:(NSDictionary*)deviceDict
|
|
|
+{
|
|
|
KWeakSelf
|
|
|
//有设备了先去做链接准备 // 80bec9c5
|
|
|
NSString *SNStr = deviceDict[@"Const_Have_Add_Device_SN"];
|
|
|
NSString *sdnId = [connectDeviceManager shareInstance].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(^{
|
|
|
@@ -117,37 +136,23 @@
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
+ [weakSelf enterMainVCFromSceneSecondStepFun];
|
|
|
}];
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- // GuideViewController
|
|
|
- BOOL haveGuide = [HWDataManager getBoolWithKey:Const_Have_Show_Guide];
|
|
|
- if (haveGuide) {
|
|
|
- ;
|
|
|
- }else {
|
|
|
- GuideViewController *guiDeVC = [[GuideViewController alloc] init];
|
|
|
- guiDeVC.delegate = self;
|
|
|
- guiDeVC.sn = SNStr;
|
|
|
- self.window.rootViewController = guiDeVC;
|
|
|
-
|
|
|
- return;
|
|
|
+ else{
|
|
|
+ [self enterMainVCFromSceneSecondStepFun];
|
|
|
}
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
-// if (![[deviceDict allKeys] containsObject:Const_Have_Add_Device_PWD]){
|
|
|
-// /*没有设置密码*/
|
|
|
-// SetPWDFirstViewController *qrCodeVC = [[SetPWDFirstViewController alloc] init];
|
|
|
-// BaseNavigationController *qrCodeVCNav = [[BaseNavigationController alloc] initWithRootViewController:qrCodeVC];
|
|
|
-// self.window.rootViewController = qrCodeVCNav;
|
|
|
-//
|
|
|
-// return;
|
|
|
-// }
|
|
|
+- (void)enterMainVCFromSceneSecondStepFun
|
|
|
+{
|
|
|
|
|
|
//确保通过SN号拿到密码了
|
|
|
//非扫码进入 进入到这里很可能还没联网拿到设备最新信息
|
|
|
if(![connectDeviceManager shareInstance].DeviceThirdIdMod){
|
|
|
|
|
|
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
mainBlock(^{
|
|
|
[self enterMainVCFromScene];
|
|
|
});
|
|
|
@@ -172,11 +177,11 @@
|
|
|
|
|
|
//是否已经有密码了 有就是输入密码 没有就是设置密码
|
|
|
NSString *curPwd = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.password;
|
|
|
- sdnId = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.sdnId;
|
|
|
+ NSString *sdnId = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.sdnId;
|
|
|
if(!sdnId){
|
|
|
HLog(@"没有拿到sdnId");
|
|
|
|
|
|
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
mainBlock(^{
|
|
|
[self enterMainVCFromScene];
|
|
|
});
|