Ver código fonte

1.链接提示文案

huangxiaodong 1 ano atrás
pai
commit
528b86613a

+ 45 - 3
创维盒子/双子星云手机/AppDelegate/SceneDelegate.m

@@ -23,6 +23,8 @@
 #import "RSATool.h"
 #import "forgetPwdViewController.h"
 #import "TipsQRCodeForChangeDeviceViewController.h"
+#import "AFNetworkReachabilityManager.h"
+#import "ComontAlretViewController.h"
 
 @interface SceneDelegate ()<SetUsePWDViewControllerDelegate,GuideViewControllerDelegate>
 @property(nonatomic, strong)   CalculatorViewController *calculatorVC;
@@ -103,17 +105,22 @@
     }
     
    
-    
+    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:^(bool didSuc) {
-            
+            if(!didSuc){
+                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+                    mainBlock(^{
+                        [weakSelf showNetErrorAlertFun];
+                    });
+                });
+            }
         }];
     }
 
-   
     
     //    GuideViewController
     BOOL haveGuide = [HWDataManager getBoolWithKey:Const_Have_Show_Guide];
@@ -694,4 +701,39 @@
     [self showCalculatorVC];
 }
 
+#pragma mark 网络异常弹框
+-(void)showNetErrorAlertFun
+{
+    NSInteger maskModel = [HWDataManager getIntegerWithKey:Const_Mask_View_Model];
+    
+    if(maskModel !=0){
+        return;
+    }
+    
+    NSString *linkErrTip = NSLocalizedString(@"player_link_fail_couldPhone_Tips",nil);
+    if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable){
+        linkErrTip = NSLocalizedString(@"player_link_fail_phone_Tips",nil);
+    }
+    
+    linkErrTip = [[NSString alloc] initWithFormat:@"[9]%@",linkErrTip];
+    
+    ComontAlretViewController *linkFailAlretVC= [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"player_link_fail_title",nil)
+                                                                                      msg:linkErrTip
+                                                                                 imageStr:nil
+                                                                              cancelTitle:NSLocalizedString(@"single_sign_on_exit",nil)
+                                                                                  okTitle:NSLocalizedString(@"player_link_fail_tryAgain",nil) isOkBtnHighlight:YES
+                                                                               didClickOk:^{
+        
+        //[self enterMainVCFromScene];
+     } didClickCancel:^{
+         exit(0);
+     }];
+    
+     linkFailAlretVC.modalPresentationStyle = UIModalPresentationCustom;
+     
+     [self.window.rootViewController presentViewController:linkFailAlretVC animated:YES completion:^{
+         linkFailAlretVC.view.superview.backgroundColor = [UIColor clearColor];
+     }];
+}
+
 @end

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

@@ -171,7 +171,6 @@ ComontAlretViewControllerDelegate>
     }
     canControl = YES;
     _canShowImgAndVoiceType = NO;
-    
     //[self opencommandChannelManagerrc_openURL];
     //[self openbusinessCommandChannelManagerrc_openURL];
 
@@ -231,7 +230,7 @@ ComontAlretViewControllerDelegate>
     _checkThridConnectNum += 1;
     
     if(_checkThridConnectNum == 30 && [[connectDeviceManager shareInstance] curConnectDeviceState] <= 3 ){
-        [self showNetErrorAlertFun];
+        [self showNetErrorAlertFun:11];
         
 //        [_checkThridConnectTimer invalidate];
 //        return;
@@ -715,7 +714,7 @@ ComontAlretViewControllerDelegate>
             }
             
         } failure:^(NSError *error) {
-            
+            [self showNetErrorAlertFun:2];
         }];
     }
 }
@@ -1886,7 +1885,7 @@ NSDate *lastVideoTome;/*上一帧数据时间*/
                 [self disconnectVideoServer];
 //                }
             
-            [self showNetErrorAlertFun];
+            [self showNetErrorAlertFun:12];
         }
             break;
         case AFNetworkReachabilityStatusReachableViaWWAN:/*流量*/
@@ -1913,7 +1912,7 @@ NSDate *lastVideoTome;/*上一帧数据时间*/
 }
 
 #pragma mark 网络异常弹框
--(void)showNetErrorAlertFun
+-(void)showNetErrorAlertFun:(NSInteger)type
 {
     if(linkFailAlretVC){
         return;
@@ -1938,17 +1937,22 @@ NSDate *lastVideoTome;/*上一帧数据时间*/
         
         //等下再发
         dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-            [self showNetErrorAlertFun];
+            [self showNetErrorAlertFun:type];
         });
         return;
     }
     
+    //未连接成功过
+    if(_isFirstEnterPhone && type == 5){
+        type = 1;
+    }
     
     NSString *linkErrTip = NSLocalizedString(@"player_link_fail_couldPhone_Tips",nil);
     if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable){
         linkErrTip = NSLocalizedString(@"player_link_fail_phone_Tips",nil);
     }
     
+    linkErrTip = [[NSString alloc] initWithFormat:@"[%ld]%@",type,linkErrTip];
     
     linkFailAlretVC= [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"player_link_fail_title",nil)
                                                                                       msg:linkErrTip
@@ -1994,10 +1998,10 @@ BOOL inReconnect = NO;
             //重启后重连 出来的 不显示
             if(!self->_isRebootIngType && !self->_isResetingType && ![self isPlayerViewIsTopVCFun]){
                 /*链接失败*/
-                [[iToast makeText:NSLocalizedString(@"player_link_fail_tip",nil)] show];
+                //[[iToast makeText:NSLocalizedString(@"player_link_fail_tip",nil)] show];
+                [self showNetErrorAlertFun:5];
             }
             
-            [self showNetErrorAlertFun];
         });
         
         return;