Преглед на файлове

1.云机 界面 恢复出厂设置和重启云机 实现

huangxiaodong преди 1 година
родител
ревизия
325b40eb00

+ 140 - 0
创维盒子/双子星云手机/cloudPhone/cloudPhoneViewController.m

@@ -160,6 +160,16 @@
                 make.top.mas_equalTo(0);
                 make.bottom.mas_equalTo(0);
             }];
+            
+            KWeakSelf
+            _cloudPhoneSetV.didClickButtonFun = ^(NSInteger tag) {
+                if (tag == 10) {//重启
+                    [weakSelf didClickRestartFun];
+                }
+                else if (tag == 11){//恢复出厂
+                    [weakSelf RestoreFactoryingFun];
+                }
+            };
         }
             break;
         case 2:
@@ -174,6 +184,136 @@
     }
 }
 
+#pragma mark 点击了重启空间
+- (void)didClickRestartFun
+{
+    KWeakSelf
+    /*弹窗提示重启*/
+    ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_restart_phone_tips",nil)
+                                                                                     msg:nil
+                                                                                imageStr:nil
+                                                                             cancelTitle:NSLocalizedString(@"other_cancel",nil)
+                                                                                 okTitle:NSLocalizedString(@"my_set_no_restart_phone_btn_ok",nil) isOkBtnHighlight:NO
+                                                                              didClickOk:^{
+        [weakSelf sureToRestartCloudPhoneFun];
+    } didClickCancel:^{
+        
+    }];
+    nextVC.modalPresentationStyle = UIModalPresentationCustom;
+
+    [self presentViewController:nextVC animated:YES completion:^{
+        nextVC.view.superview.backgroundColor = [UIColor clearColor];
+    }];
+}
+
+#pragma mark  确认重启云机
+- (void)sureToRestartCloudPhoneFun{
+//    /*重启云手机*/
+//  通过指令通道发送 {"type":"reboot"}
+    [[webSocketManager shareInstance] needToRebootFun];
+    
+    //提示语
+    [[iToast makeText:NSLocalizedString(@"player_link_rebooting_Tips",nil)] show];
+}
+
+#pragma mark 点击恢复出厂
+- (void)RestoreFactoryAleartFun
+{
+    KWeakSelf
+    /*弹窗提示恢复出厂*/
+    ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_Restore_Factory_tips",nil)
+                                                                                     msg:NSLocalizedString(@"my_set_no_Restore_Factory_msg",nil)
+                                                                                imageStr:@"icon_Restore_Factory_big"
+                                                                             cancelTitle:NSLocalizedString(@"my_set_TVP2P_Open_sure",nil)
+                                                                                 okTitle:NSLocalizedString(@"other_cancel",nil) isOkBtnHighlight:YES
+                                                                              didClickOk:^{
+        
+    } didClickCancel:^{
+        //点击确定
+        [weakSelf gotoResetFun];
+    }];
+    nextVC.modalPresentationStyle = UIModalPresentationCustom;
+    
+    [self presentViewController:nextVC animated:YES completion:^{
+        nextVC.view.superview.backgroundColor = [UIColor clearColor];
+    }];
+}
+
+#pragma mark 点击了恢复出厂
+- (void)gotoResetFun
+{
+    [[webSocketManager shareInstance] needToResetFun];
+    
+    [self RestoreFactoryingFun];
+}
+
+#pragma mark 恢复出厂中
+- (void)RestoreFactoryingFun
+{
+    KWeakSelf
+    /*弹窗提示恢复出厂*/
+    ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_Restore_Factorying_tips",nil)
+                                                                                     msg:NSLocalizedString(@"my_set_no_Restore_Factorying_msg",nil)
+                                                                                imageStr:nil
+                                                                             cancelTitle:NSLocalizedString(@"my_set_no_Restore_Factorying",nil)
+                                                                                 okTitle:nil
+                                                                        isOkBtnHighlight:NO
+                                                                              didClickOk:^{
+        [weakSelf RestoreFactoryCompleteFun];
+    } didClickCancel:^{
+    
+    }];
+    
+    [nextVC setButtonCountdownFun:180];//90
+    
+    nextVC.modalPresentationStyle = UIModalPresentationCustom;
+    
+    [self presentViewController:nextVC animated:YES completion:^{
+        nextVC.view.superview.backgroundColor = [UIColor clearColor];
+    }];
+}
+
+#pragma mark 恢复出厂倒计时结束
+- (void)RestoreFactoryCompleteFun
+{
+    KWeakSelf
+    //瑞云发起重连
+    NSString *snStr = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.changeSn;
+    if(snStr){
+        [[connectDeviceManager shareInstance] getThridMsgBySN:snStr needReconnect:YES didNetEnd:^(NSInteger didSuc) {
+            if(didSuc){
+        
+            }
+            else{
+                [weakSelf RestoreFactoryCompleteFun];
+                return;
+            }
+        }];
+    }
+    
+    
+    /*弹窗提示恢复出厂*/
+    ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_Restore_Factory_ok_tips",nil)
+                                                                                     msg:NSLocalizedString(@"my_set_no_Restore_Factory_ok_msg",nil)
+                                                                                imageStr:nil
+                                                                             cancelTitle:NSLocalizedString(@"my_set_no_Restore_FactoryOK",nil)
+                                                                                 okTitle:nil
+                                                                        isOkBtnHighlight:NO
+                                                                              didClickOk:^{
+        
+    } didClickCancel:^{
+        
+    }];
+    
+    
+    
+    nextVC.modalPresentationStyle = UIModalPresentationCustom;
+    
+    [self presentViewController:nextVC animated:YES completion:^{
+        nextVC.view.superview.backgroundColor = [UIColor clearColor];
+    }];
+}
+
 
 - (void)viewWillAppear:(BOOL)animated{
     [super viewWillAppear:animated];

+ 4 - 0
创维盒子/双子星云手机/cloudPhone/websocket/webSocketManager.h

@@ -71,6 +71,10 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)getBackupFolderListFun;
 - (void)searchFileListBeginFun:(NSMutableDictionary *)dict;
 
+#pragma mark 重启云机
+- (void)needToRebootFun;
+#pragma mark 恢复出厂设置云机
+- (void)needToResetFun;
 #pragma mark 获取云机基本信息
 - (void)getBaseInfoFun;
 #pragma mark 获取云机剩余空间(包含外挂磁盘)

+ 19 - 0
创维盒子/双子星云手机/cloudPhone/websocket/webSocketManager.m

@@ -556,6 +556,25 @@ static webSocketManager *webSocketManagerInstance = nil;
     return [NSString stringWithFormat:@"Etc/GMT%g",offset];
 }
 
+#pragma mark 重启云机
+- (void)needToRebootFun
+{
+    NSString *commondStr  = @"{\"type\":\"reboot\"}";
+    [self send_data:commondStr];
+    
+    //添加到任务监听
+    [self addCommandSendTaskFunWithType:@"reboot" WithCommandStr:commondStr];
+}
+
+- (void)needToResetFun
+{
+    NSString *commondStr  = @"{\"type\":\"reset\"}";
+    [self send_data:commondStr];
+    
+    //添加到任务监听
+    [self addCommandSendTaskFunWithType:@"reset" WithCommandStr:commondStr];
+}
+
 - (void)updateCopydata{
     UIPasteboard* pasteboard = [UIPasteboard generalPasteboard];
     NSString *str = [pasteboard string];