Browse Source

1.链接异常弹框处理

huangxiaodong 1 year ago
parent
commit
cc07c9c81c

+ 12 - 0
创维盒子/双子星云手机.xcodeproj/project.pbxproj

@@ -706,6 +706,10 @@
 		6B9283672C4B62A30098CC75 /* newerGuideView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B9283642C4B62A30098CC75 /* newerGuideView.h */; };
 		6B9283682C4B62A30098CC75 /* newerGuideView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B9283642C4B62A30098CC75 /* newerGuideView.h */; };
 		6B9283692C4B62A30098CC75 /* newerGuideView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B9283652C4B62A30098CC75 /* newerGuideView.m */; };
+		6B92836C2C4B94310098CC75 /* errorAlertTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B92836B2C4B94310098CC75 /* errorAlertTool.m */; };
+		6B92836D2C4B94310098CC75 /* errorAlertTool.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B92836A2C4B94310098CC75 /* errorAlertTool.h */; };
+		6B92836E2C4B94310098CC75 /* errorAlertTool.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B92836A2C4B94310098CC75 /* errorAlertTool.h */; };
+		6B92836F2C4B94310098CC75 /* errorAlertTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B92836B2C4B94310098CC75 /* errorAlertTool.m */; };
 		6B9354882BF2FE8700AA8D31 /* editTypeHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B9354872BF2FE8700AA8D31 /* editTypeHeadView.m */; };
 		6B9354892BF2FE8700AA8D31 /* editTypeHeadView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B9354862BF2FE8700AA8D31 /* editTypeHeadView.h */; };
 		6B93548A2BF2FE8700AA8D31 /* editTypeHeadView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B9354862BF2FE8700AA8D31 /* editTypeHeadView.h */; };
@@ -1860,6 +1864,8 @@
 		6B8FF6C02B05B24D00800981 /* uploadFileRecordCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = uploadFileRecordCell.m; sourceTree = "<group>"; };
 		6B9283642C4B62A30098CC75 /* newerGuideView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = newerGuideView.h; sourceTree = "<group>"; };
 		6B9283652C4B62A30098CC75 /* newerGuideView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = newerGuideView.m; sourceTree = "<group>"; };
+		6B92836A2C4B94310098CC75 /* errorAlertTool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = errorAlertTool.h; sourceTree = "<group>"; };
+		6B92836B2C4B94310098CC75 /* errorAlertTool.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = errorAlertTool.m; sourceTree = "<group>"; };
 		6B9354862BF2FE8700AA8D31 /* editTypeHeadView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = editTypeHeadView.h; sourceTree = "<group>"; };
 		6B9354872BF2FE8700AA8D31 /* editTypeHeadView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = editTypeHeadView.m; sourceTree = "<group>"; };
 		6B93548C2BF30A8C00AA8D31 /* editTypeBottomView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = editTypeBottomView.h; sourceTree = "<group>"; };
@@ -3056,6 +3062,8 @@
 				6B07E0A52C3CD4AF004A3238 /* lastFileTableViewCell.m */,
 				6B9283642C4B62A30098CC75 /* newerGuideView.h */,
 				6B9283652C4B62A30098CC75 /* newerGuideView.m */,
+				6B92836A2C4B94310098CC75 /* errorAlertTool.h */,
+				6B92836B2C4B94310098CC75 /* errorAlertTool.m */,
 			);
 			path = view;
 			sourceTree = "<group>";
@@ -3761,6 +3769,7 @@
 				6B4C0F932C0320710070EF2E /* NSObject+Extensions.h in Headers */,
 				181E84F22A8F0A9B00292B96 /* HelpDownScrollView.h in Headers */,
 				6BD780702C2BF7F10014912F /* customerServiceViewController.h in Headers */,
+				6B92836D2C4B94310098CC75 /* errorAlertTool.h in Headers */,
 				6B6ABEE62BFF49C800480BAC /* receiveDownloadRecordTableView.h in Headers */,
 				6B2170882B1444CC00656670 /* allVersionView.h in Headers */,
 				6B0D004C2BFE104B00F02719 /* queryOneShareModel.h in Headers */,
@@ -4022,6 +4031,7 @@
 				6B4C0F962C0320710070EF2E /* NSObject+Extensions.h in Headers */,
 				6BD506BC2B9576A4006E7CB0 /* HelpDownScrollView.h in Headers */,
 				6BD780722C2BF7F10014912F /* customerServiceViewController.h in Headers */,
+				6B92836E2C4B94310098CC75 /* errorAlertTool.h in Headers */,
 				6B6ABEE82BFF49C800480BAC /* receiveDownloadRecordTableView.h in Headers */,
 				6BD506BD2B9576A4006E7CB0 /* allVersionView.h in Headers */,
 				6B0D004D2BFE104B00F02719 /* queryOneShareModel.h in Headers */,
@@ -4710,6 +4720,7 @@
 				6B679DED2C252A4E00D0DC03 /* NASMySpaceViewController.m in Sources */,
 				6B2C1EA72C070ADE00FDCF82 /* ZFPresentTransition.m in Sources */,
 				6BF2A5AE2C4686C500872525 /* audioPlayDownloadManager.m in Sources */,
+				6B92836F2C4B94310098CC75 /* errorAlertTool.m in Sources */,
 				6BD507512B9576A4006E7CB0 /* TZAssetModel+imageData.m in Sources */,
 				6BD507522B9576A4006E7CB0 /* diskListTableCell.m in Sources */,
 				6B7DDF292C421DA900EBDFDD /* previewVideoLandscapeTopMoreView.m in Sources */,
@@ -5053,6 +5064,7 @@
 				6B679DEB2C252A4E00D0DC03 /* NASMySpaceViewController.m in Sources */,
 				6B2C1EA62C070ADE00FDCF82 /* ZFPresentTransition.m in Sources */,
 				6BF2A5AD2C4686C500872525 /* audioPlayDownloadManager.m in Sources */,
+				6B92836C2C4B94310098CC75 /* errorAlertTool.m in Sources */,
 				6B0582792AFF7C6D00D37290 /* TZAssetModel+imageData.m in Sources */,
 				6B45C5092B5FA2DD007E6911 /* diskListTableCell.m in Sources */,
 				6B7DDF272C421DA900EBDFDD /* previewVideoLandscapeTopMoreView.m in Sources */,

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

@@ -337,6 +337,7 @@ bool isDownType22 = YES;
         [self.layer removeFromSuperlayer];
         
 
+        [webSocketManager shareInstance].isChangeBoxType = YES;
         
         [self showNewIndicatorHaveStrWithCanBack:NO canTouch:NO showText:NSLocalizedString(@"guide_qrcoede_tips_ok",nil)];
         [[connectDeviceManager shareInstance] getThridMsgBySN:resStr needReconnect:YES didNetEnd:^(NSInteger didSuc) {
@@ -373,6 +374,8 @@ bool isDownType22 = YES;
                 
             }else{
                 
+                [webSocketManager shareInstance].isChangeBoxType = NO;
+                
 //                if(didSuc == 2){
 //                    [[iToast makeText:NSLocalizedString(@"scan_sn_data_error_tip",nil)] show];
 //                }

+ 1 - 1
创维盒子/双子星云手机/CloudPlayer/PlayerViewController.h

@@ -32,7 +32,7 @@
 #import "ComontAlretType2ViewController.h"
 #import "customDownloadManager.h"
 #import "boxDownloadFileManager.h"
-
+#import "errorAlertTool.h"
 
 @protocol PlayerViewControllerDelegate <NSObject>
 

+ 16 - 141
创维盒子/双子星云手机/CloudPlayer/PlayerViewController.mm

@@ -115,10 +115,6 @@ UIDocumentPickerDelegate>
     
     PhoneTimeInfoDataModel *phoneTimeInfoDataModel;
     
-  
-    /*弹窗提示链接失败 网络或者云机*/
-    ComontAlretViewController *linkFailAlretVC;
-    ComontAlretType2ViewController * linkFailAlretType2VC;
     
     NSTimer *forceStartTimer;//请知重启timer
     
@@ -242,8 +238,10 @@ UIDocumentPickerDelegate>
     _checkThridConnectNum += 1;
     
     if(_checkThridConnectNum >= 30 && [[connectDeviceManager shareInstance] curConnectDeviceState] <= 3 ){
-        [[addLogObject shareInstance] gotoAddLogFun];
-        [self showNetErrorAlertFun:11];
+//hxd del 20240720 流程改变 这个弹框不在这里处理了 改到瑞云链接那边处理 因为要先先ws
+//        [[addLogObject shareInstance] gotoAddLogFun];
+//        [self showNetErrorAlertFun:11];
+        
         _checkThridConnectNum = 0;
 //        [_checkThridConnectTimer invalidate];
 //        return;
@@ -860,14 +858,7 @@ UIDocumentPickerDelegate>
             
             
             //  报链接失败 后面又连接上了
-            if(linkFailAlretVC){
-                mainBlock(^{
-                    [self->linkFailAlretVC dismissViewControllerAnimated:YES completion:^{
-                                        
-                    }];
-                    self->linkFailAlretVC = nil;
-                });
-            }
+            [[errorAlertTool shareInstance] dismissErrorAlertFun];
         }
             break;
         case 3:/*正在渲染*/{
@@ -1431,8 +1422,7 @@ NSDate *lastVideoTome;/*上一帧数据时间*/
 
 - (void)needToRebootFun
 {
-    NSString *commondStr  = @"{\"type\":\"reboot\"}";
-    [self send_data:commondStr];
+    [[webSocketManager shareInstance] needToRebootFun];
     
     [self startForceStartTimerFun];
     
@@ -1471,8 +1461,7 @@ NSDate *lastVideoTome;/*上一帧数据时间*/
 
 - (void)needToResetFun
 {
-    NSString *commondStr  = @"{\"type\":\"reset\"}";
-    [self send_data:commondStr];
+    [[webSocketManager shareInstance] needToResetFun];
     
     //最后一帧 没显示正在重启问题
     //self->_canShowImgAndVoiceType = YES;
@@ -1859,131 +1848,17 @@ NSDate *lastVideoTome;/*上一帧数据时间*/
     
     [cachesFileManager writeLogsWithMsg:[[NSString alloc] initWithFormat:@"showNetErrorAlertFun %ld",type]];
     
-    if(linkFailAlretVC
-       ||[connectDeviceManager shareInstance].isReInitType//瑞云重新init 耗时2-7s 他们说的
-       ||(ksharedAppDelegate.isWebSockLinkOKAginType && type == 2) //重连上了但是延时消息来了
-       ||linkFailAlretType2VC){
-        return;
-    }
-    
-    //重启后重连 出来的
-    if(_isRebootIngType){
-        if(![self isPlayerViewIsTopVCFun]){
-            [[iToast makeText:NSLocalizedString(@"player_link_rebooting_Tips",nil)] show];
-        }
-        return;
-    }
-    
-    if(_isResetingType){
-        if(![self isPlayerViewIsTopVCFun]){
-            [[iToast makeText:NSLocalizedString(@"my_set_no_Restore_Factorying_tips",nil)] show];
-        }
-        return;
-    }
-    
-    if([self isPlayerViewIsTopVCFun]){
-        
-        //等下再发
-        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-            [self showNetErrorAlertFun:type];
-        });
-        return;
-    }
-    
-    //未连接成功过
-    if(_isFirstEnterPhone && type == 5){
-        type = 1;
-    }
-    
-    BOOL isPhoneNetWorkWrongType = NO;
-    NSString *linkErrTip = NSLocalizedString(@"player_link_fail_tip_type11",nil);
-    if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable){
-        linkErrTip = NSLocalizedString(@"netWork_error_tip_content",nil);
-        isPhoneNetWorkWrongType = YES;
-    }
-    
-    if(type == 11 && !isPhoneNetWorkWrongType){
-        NSString* linkErrTitle = NSLocalizedString(@"player_link_fail_title_type11",nil);
-        linkErrTitle = [[NSString alloc] initWithFormat:@"[%ld]%@",type,linkErrTitle];
-        
-        KWeakSelf
-        linkFailAlretType2VC  = [[ComontAlretType2ViewController alloc] initWithTitle:linkErrTitle msg:linkErrTip imageStr:nil cancelTitle:NSLocalizedString(@"single_sign_on_exit",nil) okTitle:NSLocalizedString(@"player_link_fail_tryAgain",nil) otherTitle:NSLocalizedString(@"my_set_no_restart_phone",nil) isOkBtnHighlight:YES didClickOk:^{
+    KWeakSelf
+    [[errorAlertTool shareInstance] showNetErrorAlertFun:type didClickBut:^(NSInteger tag) {
+        if(tag == 1){
             [weakSelf tryAgainInLinkFailFun];
-            [cachesFileManager writeLogsWithMsg:@"click tryAgain"];
-        } didClickCancel:^{
-            exit(0);
-        } didClickOther:^{//硬重启
-            [weakSelf needToRebootFun];
-        }];
-                 
-         
-        linkFailAlretType2VC.modalPresentationStyle = UIModalPresentationCustom;
-         
-         [self presentViewController:linkFailAlretType2VC animated:YES completion:^{
-             self->linkFailAlretType2VC.view.superview.backgroundColor = [UIColor clearColor];
-         }];
-        
-    }
-    else{
-        NSString* linkErrTitle = @"";
-        if(type == 2
-           ||type==5
-           ||type==1
-           ||type==12){
-            linkErrTitle = NSLocalizedString(@"player_link_fail_title_type2",nil);
-            linkErrTip = NSLocalizedString(@"player_link_fail_tip_type2",nil);
-        }
-        else{
-            linkErrTitle = NSLocalizedString(@"player_link_fail_title_type3",nil);
-            linkErrTip = NSLocalizedString(@"player_link_fail_tip_type2",nil);
         }
-        
-        if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable){
-            linkErrTip = NSLocalizedString(@"netWork_error_tip_content",nil);
-        }
-        
-        linkErrTitle = [[NSString alloc] initWithFormat:@"[%ld]%@",type,linkErrTitle];
-        
-        KWeakSelf
-        linkFailAlretVC= [[ComontAlretViewController alloc] initWithTiTle:linkErrTitle
-                                                                                          msg:linkErrTip
-                                                                                     imageStr:nil
-                                                                                  cancelTitle:NSLocalizedString(@"single_sign_on_exit",nil)
-                                                                                      okTitle:NSLocalizedString(@"player_link_fail_tryAgain",nil) isOkBtnHighlight:YES
-                                                                                   didClickOk:^{
-            [weakSelf tryAgainInLinkFailFun];
-            [cachesFileManager writeLogsWithMsg:@"click tryAgain"];
-             
-         } didClickCancel:^{
-             exit(0);
-         }];
-        
-         linkFailAlretVC.modalPresentationStyle = UIModalPresentationCustom;
-         [linkFailAlretVC setMsgTextAlignment:NSTextAlignmentLeft];
-         [self presentViewController:linkFailAlretVC animated:YES completion:^{
-             self->linkFailAlretVC.view.superview.backgroundColor = [UIColor clearColor];
-         }];
-    }
+    }];
     
-    linkFailAlretVC.view.tag = type;
 }
 
 - (void)tryAgainInLinkFailFun
 {
-    linkFailAlretVC = nil;
-    linkFailAlretType2VC = nil;
-    
-    if([[connectDeviceManager shareInstance] curConnectDeviceState] <= 3)
-    {
-        //瑞云发起重连
-        NSString *snStr = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.changeSn;
-        if(snStr){
-            //_checkThridConnectNum = 1;
-            [[connectDeviceManager shareInstance] getThridMsgBySN:snStr needReconnect:YES didNetEnd:^(NSInteger didSuc) {
-            }];
-        }
-        return;
-    }
     
     //[[connectDeviceManager shareInstance] tryReconnectFun];
     [self showNewIndicator];
@@ -2037,11 +1912,11 @@ BOOL inReconnect = NO;
     
     reConnectAccount++;
     
-    mainBlock(^{
-        if(self->linkFailAlretVC && self->linkFailAlretVC.view.tag == 2){
-            [[webSocketManager shareInstance] WebSocketNeedRelinkFun];
-        }
-    });
+//    mainBlock(^{
+//        if(self->linkFailAlretVC && self->linkFailAlretVC.view.tag == 2){
+//            [[webSocketManager shareInstance] WebSocketNeedRelinkFun];
+//        }
+//    });
     
     [cachesFileManager writeLogsWithMsg:@"reconnectDevice"];
     

+ 27 - 0
创维盒子/双子星云手机/NAS/view/errorAlertTool.h

@@ -0,0 +1,27 @@
+//
+//  errorAlertTool.h
+//  双子星云手机
+//
+//  Created by xd h on 2024/7/20.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ *
+ */
+typedef void (^errorAlert_DidClickButFun) (NSInteger tag); // 1 2 3 //表示点击弹框按钮的 index 
+
+@interface errorAlertTool : NSObject
++ (instancetype)shareInstance;
+
+#pragma mark 网络异常弹框
+-(void)showNetErrorAlertFun:(NSInteger)type didClickBut:(errorAlert_DidClickButFun)didClickBut;
+
+#pragma mark 网络异常弹框 消失
+- (void)dismissErrorAlertFun;
+@end
+
+NS_ASSUME_NONNULL_END

+ 281 - 0
创维盒子/双子星云手机/NAS/view/errorAlertTool.m

@@ -0,0 +1,281 @@
+//
+//  errorAlertTool.m
+//  双子星云手机
+//
+//  Created by xd h on 2024/7/20.
+//
+
+#import "errorAlertTool.h"
+#import "ComontAlretViewController.h"
+#import "ComontAlretType2ViewController.h"
+
+static errorAlertTool *shareInstance = nil;
+
+@interface errorAlertTool ()
+{
+    /*弹窗提示链接失败 网络或者云机*/
+    ComontAlretViewController *linkFailAlretVC;
+    ComontAlretType2ViewController * linkFailAlretType2VC;
+    
+    NSTimer *forceStartTimer;//通知服务器重启timer
+    
+    errorAlert_DidClickButFun curDidClickButFun;
+}
+
+@end
+
+@implementation errorAlertTool
+
++ (instancetype)shareInstance {
+    
+    static dispatch_once_t onceToken;
+    
+    dispatch_once(&onceToken, ^{
+        shareInstance = [[errorAlertTool alloc] init];
+        
+    });
+    
+    return shareInstance;
+}
+
+#pragma mark 网络异常弹框 消失
+- (void)dismissErrorAlertFun
+{
+    KWeakSelf
+    mainBlock(^{
+        [weakSelf dismissErrorAlertInMainFun];
+    });
+}
+
+- (void)dismissErrorAlertInMainFun{
+    if(linkFailAlretVC){
+        [self->linkFailAlretVC dismissViewControllerAnimated:YES completion:^{
+            
+        }];
+        self->linkFailAlretVC = nil;
+    }
+}
+
+#pragma mark 网络异常弹框
+-(void)showNetErrorAlertFun:(NSInteger)type didClickBut:(errorAlert_DidClickButFun)didClickBut
+{
+    curDidClickButFun = didClickBut;
+    KWeakSelf
+    mainBlock(^{
+        [weakSelf showNetErrorAlertFunInMain:type];
+    });
+}
+
+-(void)showNetErrorAlertFunInMain:(NSInteger)type
+{
+    
+    [cachesFileManager writeLogsWithMsg:[[NSString alloc] initWithFormat:@"showNetErrorAlertFun %ld",type]];
+    
+    if(linkFailAlretVC
+       ||[connectDeviceManager shareInstance].isReInitType//瑞云重新init 耗时2-7s 他们说的
+       ||(ksharedAppDelegate.isWebSockLinkOKAginType && type == 2) //重连上了但是延时消息来了
+       ||linkFailAlretType2VC){
+        return;
+    }
+    
+    //重启后重连 出来的
+    if([webSocketManager shareInstance].isRebootIngType){
+//        if(![self isPlayerViewIsTopVCFun]){
+//            [[iToast makeText:NSLocalizedString(@"player_link_rebooting_Tips",nil)] show];
+//        }
+        return;
+    }
+    
+    if([webSocketManager shareInstance].isResetingType){
+//        if(![self isPlayerViewIsTopVCFun]){
+//            [[iToast makeText:NSLocalizedString(@"my_set_no_Restore_Factorying_tips",nil)] show];
+//        }
+        return;
+    }
+    
+    //切换盒子 出来的
+    if([webSocketManager shareInstance].isChangeBoxType){
+        return;
+    }
+    
+//    if([self isPlayerViewIsTopVCFun]){
+//        
+//        //等下再发
+//        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+//            [self showNetErrorAlertFun:type];
+//        });
+//        return;
+//    }
+    
+    //未连接成功过
+//    if(_isFirstEnterPhone && type == 5){
+//        type = 1;
+//    }
+    
+    BOOL isPhoneNetWorkWrongType = NO;
+    NSString *linkErrTip = NSLocalizedString(@"player_link_fail_tip_type11",nil);
+    if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable){
+        linkErrTip = NSLocalizedString(@"netWork_error_tip_content",nil);
+        isPhoneNetWorkWrongType = YES;
+    }
+    
+    if(type == 11 && !isPhoneNetWorkWrongType){
+        NSString* linkErrTitle = NSLocalizedString(@"player_link_fail_title_type11",nil);
+        linkErrTitle = [[NSString alloc] initWithFormat:@"[%ld]%@",type,linkErrTitle];
+        
+        KWeakSelf
+        linkFailAlretType2VC  = [[ComontAlretType2ViewController alloc] initWithTitle:linkErrTitle msg:linkErrTip imageStr:@"" cancelTitle:NSLocalizedString(@"single_sign_on_exit",nil) okTitle:NSLocalizedString(@"player_link_fail_tryAgain",nil) otherTitle:NSLocalizedString(@"my_set_no_restart_phone",nil) isOkBtnHighlight:YES didClickOk:^{
+            [weakSelf tryAgainInLinkFailFun];
+            [cachesFileManager writeLogsWithMsg:@"click tryAgain"];
+            
+            if(self->curDidClickButFun){
+                self->curDidClickButFun(1);
+            }
+        } didClickCancel:^{
+            exit(0);
+        } didClickOther:^{//重启云机
+            [weakSelf needToRebootFun];
+            
+            if(self->curDidClickButFun){
+                self->curDidClickButFun(3);
+            }
+        }];
+                 
+         
+        linkFailAlretType2VC.modalPresentationStyle = UIModalPresentationCustom;
+         
+         [ksharedAppDelegate.window.rootViewController presentViewController:linkFailAlretType2VC animated:YES completion:^{
+             self->linkFailAlretType2VC.view.superview.backgroundColor = [UIColor clearColor];
+         }];
+        
+    }
+    else{
+        NSString* linkErrTitle = @"";
+        if(type == 2
+           ||type==5
+           ||type==1
+           ||type==12){
+            linkErrTitle = NSLocalizedString(@"player_link_fail_title_type2",nil);
+            linkErrTip = NSLocalizedString(@"player_link_fail_tip_type2",nil);
+        }
+        else{
+            linkErrTitle = NSLocalizedString(@"player_link_fail_title_type3",nil);
+            linkErrTip = NSLocalizedString(@"player_link_fail_tip_type2",nil);
+        }
+        
+        if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable){
+            linkErrTip = NSLocalizedString(@"netWork_error_tip_content",nil);
+        }
+        
+        linkErrTitle = [[NSString alloc] initWithFormat:@"[%ld]%@",type,linkErrTitle];
+        
+        KWeakSelf
+        linkFailAlretVC= [[ComontAlretViewController alloc] initWithTiTle:linkErrTitle
+                                                                                          msg:linkErrTip
+                                                                                     imageStr:@""
+                                                                                  cancelTitle:NSLocalizedString(@"single_sign_on_exit",nil)
+                                                                                      okTitle:NSLocalizedString(@"player_link_fail_tryAgain",nil) isOkBtnHighlight:YES
+                                                                                   didClickOk:^{
+            [weakSelf tryAgainInLinkFailFun];
+            [cachesFileManager writeLogsWithMsg:@"click tryAgain"];
+            
+            if(self->curDidClickButFun){
+                self->curDidClickButFun(1);
+            }
+         } didClickCancel:^{
+             exit(0);
+         }];
+        
+         linkFailAlretVC.modalPresentationStyle = UIModalPresentationCustom;
+         [linkFailAlretVC setMsgTextAlignment:NSTextAlignmentLeft];
+         [ksharedAppDelegate.window.rootViewController presentViewController:linkFailAlretVC animated:YES completion:^{
+             self->linkFailAlretVC.view.superview.backgroundColor = [UIColor clearColor];
+         }];
+    }
+    
+    linkFailAlretVC.view.tag = type;
+}
+
+- (void)tryAgainInLinkFailFun
+{
+    linkFailAlretVC = nil;
+    linkFailAlretType2VC = nil;
+    
+    if([[connectDeviceManager shareInstance] curConnectDeviceState] <= 3)
+    {
+        //瑞云发起重连
+        NSString *snStr = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.changeSn;
+        if(snStr){
+            //_checkThridConnectNum = 1;
+            [[connectDeviceManager shareInstance] getThridMsgBySN:snStr needReconnect:YES didNetEnd:^(NSInteger didSuc) {
+            }];
+        }
+        return;
+    }
+    
+    //[[connectDeviceManager shareInstance] tryReconnectFun];
+//    [self showNewIndicator];
+//    reConnectAccount = 0;
+//    [self tryAgain];
+    
+}
+
+#pragma mark 重启云机
+- (void)needToRebootFun
+{
+    [[webSocketManager shareInstance] needToRebootFun];
+    
+    [self startForceStartTimerFun];
+}
+
+#pragma mark 启动timer 秒后检查是否软件重启成功
+- (void)startForceStartTimerFun
+{
+    if(forceStartTimer){
+        [forceStartTimer invalidate];
+        forceStartTimer = nil;
+    }
+    
+    forceStartTimer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(gotoUpdateForceStartFun) userInfo:nil repeats:NO];
+    [[NSRunLoop currentRunLoop] addTimer:forceStartTimer forMode:NSRunLoopCommonModes];
+}
+
+- (void)gotoUpdateForceStartFun
+{
+    [self updateForceStartFun];
+    
+    KWeakSelf
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(30 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+        //[weakSelf reconnectDevice];
+        [[webSocketManager shareInstance] WebSocketNeedRelinkFun];
+    });
+}
+
+#pragma mark 需要强制重启
+- (void)updateForceStartFun{
+    
+    NSString* curSn = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.changeSn;
+    
+    NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
+    [paraDict setValue:curSn forKey:@"sn"];
+    [paraDict setValue:[NSNumber numberWithBool:YES] forKey:@"isForceStart"];
+    
+    [[netWorkManager shareInstance] CommonPostCallBackCode:updateForceStart Parameters:paraDict success:^(id  _Nonnull responseObject) {
+        
+      SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
+
+       if (model.status == 0) {
+          
+       }
+       else
+       {
+           
+       }
+
+    } failure:^(NSError * _Nonnull error) {
+       HLog(@"%@", error);
+    }];
+}
+
+
+@end

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

@@ -67,6 +67,10 @@ NS_ASSUME_NONNULL_BEGIN
 //下载nas文件用到
 @property (nonatomic, copy) NSString*nasFullPath;
 
+@property(nonatomic,assign)BOOL isRebootIngType;//是否重启中
+@property(nonatomic,assign)BOOL isResetingType;//是否恢复出厂中
+@property(nonatomic,assign)BOOL isChangeBoxType;//是否更换盒子
+
 //链接websocket
 - (void)opencommandChannelManagerrc_openURL;
 - (void)WebSocketNeedRelinkFun;

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

@@ -12,6 +12,7 @@
 #import "webSocketManager+downloadThumbnailImage.h"
 #import "webSocketManager+upLoadFile.h"
 #import "webSocketManager+backupsFile.h"
+#import "errorAlertTool.h"
 
 @interface webSocketManager ()
 {
@@ -329,8 +330,12 @@ static webSocketManager *webSocketManagerInstance = nil;
             
         } failure:^(NSError *error) {
             ksharedAppDelegate.isWebSockLinkOKAginType = NO;
-//            [self showNetErrorAlertFun:2];
-//            [self WebSocketNeedRelinkFun];
+            
+            [[errorAlertTool shareInstance] showNetErrorAlertFun:2 didClickBut:^(NSInteger tag) {
+                
+            }];
+            
+            [self WebSocketNeedRelinkFun];
         }];
     }
 }
@@ -449,6 +454,10 @@ static webSocketManager *webSocketManagerInstance = nil;
 #pragma mark 盒子链接成功后需要处理的各种各样事情
 - (void)handlAllMsgAfterDidLinkFun
 {
+    _isRebootIngType = NO;
+    _isResetingType = NO;
+    _isChangeBoxType = NO;
+    
     ksharedAppDelegate.isWebSockLinkOKAginType = YES;
     
     //获取云机尺寸 兼容 720*1080 &1080*1920 不同分辨率的展示和触控
@@ -470,14 +479,7 @@ static webSocketManager *webSocketManagerInstance = nil;
     [self updateCopydata];
     
     //  报链接失败 后面又连接上了
-//    if(linkFailAlretVC && linkFailAlretVC.view.tag == 2){
-//        mainBlock(^{
-//            [self->linkFailAlretVC dismissViewControllerAnimated:YES completion:^{
-//                                
-//            }];
-//            self->linkFailAlretVC = nil;
-//        });
-//    }
+    [[errorAlertTool shareInstance] dismissErrorAlertFun];
     
     //处理相册备份
     [[backupsFileManager shareInstance] AutohandlePhotosBackupsFun];
@@ -579,6 +581,8 @@ static webSocketManager *webSocketManagerInstance = nil;
     
     //数据埋点
     [[netWorkManager shareInstance] DataEmbeddingPointBy:3 withEventValue:@"Cloud_restart"];
+    
+    _isRebootIngType = YES;
 }
 
 - (void)needToResetFun
@@ -591,6 +595,7 @@ static webSocketManager *webSocketManagerInstance = nil;
     
     //数据埋点
     [[netWorkManager shareInstance] DataEmbeddingPointBy:3 withEventValue:@"Cloud_restore_factory"];
+    _isResetingType = YES;
 }
 
 - (void)updateCopydata{

+ 27 - 8
创维盒子/双子星云手机/connectDeviceManager/connectDeviceManager.m

@@ -13,6 +13,7 @@
 
 #import "WHPingTester.h"
 #import "RSATool.h"
+#import "errorAlertTool.h"
 
 @interface connectDeviceManager ()<
 GCDAsyncSocketDelegate,
@@ -30,9 +31,12 @@ WHPingDelegate
     
     BOOL didPingType;//是否ping过
     BOOL didRuiyunLinkType;//是否瑞云链接通过
+    NSInteger RuiyunLinkSecond;//瑞云链接描述
 }
 
-@property (nonatomic, strong) NSTimer *connectCheckTimer;
+@property (nonatomic, strong) NSTimer *connectCheckTimer;//这个应该是检查初始化是否完成的
+
+@property (nonatomic, strong) NSTimer *customCheckTimer;//hxd 20240720 add to做业务检测的:主要判断 瑞云(x)秒内是否链接通过
 
 //@property (nonatomic, strong) GCDAsyncSocket *socket;
 //
@@ -264,6 +268,7 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
         //return;
     }
     
+    RuiyunLinkSecond = 0;
     _curConnectDeviceState = DeviceConnectDeciceing;
 
     NSString *curSdnId = self.DeviceThirdIdMod.data.sdnId; //@"3dfe7c1f";
@@ -280,17 +285,31 @@ static connectDeviceManager *connectDeviceManagerInstance = nil;
     /// 3. 根据对端的 SDN ID 创建连接
     [RaylinkProxy.sharedManager createNewConnection:curSdnId];
     
-
-    
     //self.socket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()];
-    
-
-   
-    
     //[self.connectBtn setEnabled:NO];
-    
     //[self.connectBtn setTitle:@"连接中..." forState:UIControlStateDisabled];
     
+    self.customCheckTimer = [NSTimer scheduledTimerWithTimeInterval:1 repeats:YES block:^(NSTimer * _Nonnull timer){
+    
+        if(self->didRuiyunLinkType){
+            [timer invalidate];
+        }
+        else{
+            self->RuiyunLinkSecond++;
+            
+            if(self->RuiyunLinkSecond >= 30){
+                [timer invalidate];
+                //弹框瑞云链接失败
+                [[errorAlertTool shareInstance] showNetErrorAlertFun:11 didClickBut:^(NSInteger tag) {
+                    
+                }];
+            }
+        }
+        
+    }];
+    
+    [[NSRunLoop currentRunLoop] addTimer:self.customCheckTimer forMode:NSRunLoopCommonModes];
+    [[NSRunLoop currentRunLoop] run];
 }
 
 - (void)disconnect {

+ 5 - 2
创维盒子/双子星云手机/mine/mineViewController.m

@@ -455,8 +455,11 @@
         NetButText = NSLocalizedString(@"mine_net_WAN",nil);
     }
     
-    if([webSocketManager shareInstance].commandChannelManager.rc_socketStatus != RCSocketCloudPhoneStatusConnected
-       || [webSocketManager shareInstance].commandChannelManager.rc_socketStatus != RCSocketCloudPhoneStatusReceived)
+    RCSocketCloudPhoneStatus status = [[webSocketManager shareInstance].commandChannelManager rc_socketStatus];
+    HLog(@"rc_socketStatus:%ld",status)
+    if(status == RCSocketCloudPhoneStatusFailed
+       ||status == RCSocketCloudPhoneStatusClosedByServer
+       ||status == RCSocketCloudPhoneStatusClosedByUser)
     {
         NetButText = NSLocalizedString(@"mine_net_unLink",nil);
     }