huangxiaodong пре 1 година
родитељ
комит
72d53361fd

+ 13 - 3
创维盒子/双子星云手机/Class/ComontAlretViewController.h

@@ -11,15 +11,25 @@ NS_ASSUME_NONNULL_BEGIN
 
 @protocol ComontAlretViewControllerDelegate <NSObject>
 
-- (void)okBtnClickPressed;
-- (void)cancelBtnClickPressed;
+- (void)CommonAlertokBtnClickPressed;
+- (void)CommonAlertCancelBtnClickPressed;
 
 @end
 
+/**
+ *  点击确定
+ */
+typedef void (^CommonAlert_ClickOkBtn) (void);
+/**
+ *  点击取消
+ */
+typedef void (^CommonAlert_ClickCancelBtn) (void);
+
 @interface ComontAlretViewController : BaseViewController
 @property (nonatomic,weak)id <ComontAlretViewControllerDelegate> delegate;
 
-- (id)initWithTiTle:(NSString *)title msg:(NSString *)msg cancelTitle:(NSString *)cancelTitle okTitle:(NSString *)okTitle isOkBtnHighlight:(BOOL)okBtnHighlight;
+- (id)initWithTiTle:(NSString *)title msg:(NSString *)msg cancelTitle:(NSString *)cancelTitle okTitle:(NSString *)okTitle isOkBtnHighlight:(BOOL)okBtnHighlight didClickOk:(CommonAlert_ClickOkBtn)ok didClickCancel:(CommonAlert_ClickCancelBtn)Cancel;
+
 
 @end
 

+ 19 - 7
创维盒子/双子星云手机/Class/ComontAlretViewController.m

@@ -14,6 +14,9 @@
     NSString *cancelTitleStr;
     NSString *okTitleStr;
     BOOL isOkBtnHighlight;
+    
+    CommonAlert_ClickOkBtn didClickOkBtn;
+    CommonAlert_ClickCancelBtn didClickCanaelBtn;
 }
 
 @end
@@ -21,7 +24,7 @@
 @implementation ComontAlretViewController
 @synthesize delegate;
 
-- (id)initWithTiTle:(NSString *)title msg:(NSString *)msg cancelTitle:(NSString *)cancelTitle okTitle:(NSString *)okTitle isOkBtnHighlight:(BOOL)okBtnHighlight;{
+- (id)initWithTiTle:(NSString *)title msg:(NSString *)msg cancelTitle:(NSString *)cancelTitle okTitle:(NSString *)okTitle isOkBtnHighlight:(BOOL)okBtnHighlight didClickOk:(CommonAlert_ClickOkBtn)ok didClickCancel:(CommonAlert_ClickCancelBtn)Cancel{
     self = [super init];
     
     titleStr = title;
@@ -29,6 +32,9 @@
     cancelTitleStr = cancelTitle;
     okTitleStr = okTitle;
     isOkBtnHighlight = okBtnHighlight;
+    
+    didClickOkBtn = ok;
+    didClickCanaelBtn = Cancel;
     return  self;
 }
 
@@ -145,8 +151,6 @@
         make.bottom.equalTo(bgView.mas_bottom).offset(-30.f);
         make.height.mas_equalTo(48.f);
     }];
-
-    
     
     
     if (okTitleStr.length > 0){
@@ -191,8 +195,12 @@
 - (void)cancelBtnClick{
     [self dismissViewControllerAnimated:YES completion:^{
         dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-            if ([self->delegate respondsToSelector:@selector(cancelBtnClickPressed)]){
-                [self->delegate cancelBtnClickPressed];
+            if ([self->delegate respondsToSelector:@selector(CommonAlertCancelBtnClickPressed)]){
+                [self->delegate CommonAlertCancelBtnClickPressed];
+            }
+            
+            if(self->didClickCanaelBtn){
+                self->didClickCanaelBtn();
             }
         });
     }];
@@ -201,8 +209,12 @@
 - (void)okBtnClick{
     [self dismissViewControllerAnimated:YES completion:^{
         dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-            if ([self->delegate respondsToSelector:@selector(okBtnClickPressed)]){
-                [self->delegate okBtnClickPressed];
+            if ([self->delegate respondsToSelector:@selector(CommonAlertokBtnClickPressed)]){
+                [self->delegate CommonAlertokBtnClickPressed];
+            }
+            
+            if(self->didClickOkBtn){
+                self->didClickOkBtn();
             }
         });
     }];

+ 2 - 0
创维盒子/双子星云手机/Class/Set/MySetViewController.h

@@ -17,6 +17,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 //重启盒子
 @property (nonatomic,copy) void (^needToReboot)(void);
+//tv投屏
+@property (nonatomic,copy) void (^needToTVP2P)(void);
 @end
 
 NS_ASSUME_NONNULL_END

+ 38 - 4
创维盒子/双子星云手机/Class/Set/MySetViewController.m

@@ -73,8 +73,37 @@
     return bgView;
 }
 
+#pragma mark 点击投屏
 - (void)tvP2PBtnPressed{
-    ;
+    [self showTVP2PFun];
+}
+
+#pragma mark 显示投屏提示语
+- (void)showTVP2PFun{
+    /*弹窗提示TV投屏*/
+    ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_TVP2P_Open_title",nil)
+                                                                                     msg:NSLocalizedString(@"my_set_TVP2P_Open_Subtitle",nil)
+                                                                             cancelTitle:NSLocalizedString(@"my_set_TVP2P_Open_sure",nil)
+                                                                                 okTitle:nil isOkBtnHighlight:NO
+                                                                              didClickOk:^{
+                                                                                  HLog(@"111");
+    } didClickCancel:^{
+        //HLog(@"2222");
+        [self gotoSetTVP2PFun];
+    }];
+    nextVC.modalPresentationStyle = UIModalPresentationCustom;
+    [self presentViewController:nextVC animated:YES completion:^{
+        nextVC.view.superview.backgroundColor = [UIColor clearColor];
+    }];
+}
+
+#pragma mark 确认开始TV投屏
+-(void)gotoSetTVP2PFun
+{
+    if(_needToTVP2P){
+        _needToTVP2P();
+    }
+    [self.navigationController popViewControllerAnimated:YES];
 }
 
 /*
@@ -117,7 +146,7 @@
         }
         
         //TV投屏 阿胡说暂不做
-        //[_tableView setTableFooterView:[self tableFoorView]];
+        [_tableView setTableFooterView:[self tableFoorView]];
     }
     
     return _tableView;
@@ -242,7 +271,12 @@
         ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"my_set_no_restart_phone_tips",nil)
                                                                                          msg:nil
                                                                                  cancelTitle:NSLocalizedString(@"other_cancel",nil)
-                                                                                     okTitle:NSLocalizedString(@"my_set_no_restart_phone_btn_ok",nil) isOkBtnHighlight:NO];
+                                                                                     okTitle:NSLocalizedString(@"my_set_no_restart_phone_btn_ok",nil) isOkBtnHighlight:NO
+                                                                                  didClickOk:^{
+            
+        } didClickCancel:^{
+            
+        }];
         nextVC.modalPresentationStyle = UIModalPresentationCustom;
         nextVC.delegate = self;
         [self presentViewController:nextVC animated:YES completion:^{
@@ -251,7 +285,7 @@
     }
 }
 
-- (void)okBtnClickPressed{
+- (void)CommonAlertokBtnClickPressed{
 //    /*重启云手机*/
 //  通过指令通道发送 {"type":"reboot"}
     if(_needToReboot){

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

@@ -12,8 +12,8 @@ NS_ASSUME_NONNULL_BEGIN
 @interface PlayerViewController (otherDelegate)
 
 //ComontAlretViewControllerDelegate
-- (void)okBtnClickPressed;
-- (void)cancelBtnClickPressed;
+- (void)CommonAlertokBtnClickPressed;
+- (void)CommonAlertCancelBtnClickPressed;
 @end
 
 NS_ASSUME_NONNULL_END

+ 2 - 2
创维盒子/双子星云手机/CloudPlayer/PlayerViewController+otherDelegate.m

@@ -10,14 +10,14 @@
 @implementation PlayerViewController (otherDelegate)
 
 #pragma mark   ComontAlretViewControllerDelegate
-- (void)okBtnClickPressed{
+- (void)CommonAlertokBtnClickPressed{
     //HLog("11111");
     
     self.isLoginAgainType = YES;
     
     [[NSNotificationCenter defaultCenter] postNotificationName:lockBypwdNotification object:nil];
 }
-- (void)cancelBtnClickPressed{
+- (void)CommonAlertCancelBtnClickPressed{
     HLog("强制退出app");
     
     exit(0);/*强制退出app*/

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

@@ -1505,6 +1505,11 @@ NSDate *lastVideoTome;/*上一帧数据时间*/
             [self reconnectDevice];
         });
     };
+    
+    nextVC.needToTVP2P = ^{
+        NSString *commondStr  = @"{\"type\":\"wakeupTV\"}";
+        [self send_data:commondStr];
+    };
 }
 
 #pragma mark 盒子第一次连接成功  给ws发送信息 单点登录 把其他账号挤下去
@@ -1559,7 +1564,12 @@ NSDate *lastVideoTome;/*上一帧数据时间*/
     ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"single_sign_on_Tips_logout",nil)
                                                                                      msg:_LogoutTimerStr
                                                                              cancelTitle:NSLocalizedString(@"single_sign_on_exit",nil)
-                                                                                 okTitle:NSLocalizedString(@"single_sign_on_login_again",nil) isOkBtnHighlight:YES];
+                                                                                 okTitle:NSLocalizedString(@"single_sign_on_login_again",nil) isOkBtnHighlight:YES
+                                                                              didClickOk:^{
+        
+    } didClickCancel:^{
+        
+    }];
     nextVC.modalPresentationStyle = UIModalPresentationCustom;
     nextVC.delegate = self;
     [self presentViewController:nextVC animated:YES completion:^{

+ 4 - 0
创维盒子/双子星云手机/en.lproj/Localizable.strings

@@ -182,6 +182,10 @@
 "my_set_no_reset_pwd_title" = "Set a new password";
 
 
+"my_set_TVP2P_Open_title" = "Screen projection has been turned on";
+"my_set_TVP2P_Open_Subtitle" = "Please check on TV for successful screen casting";
+"my_set_TVP2P_Open_sure" = "sure";
+
 "guide_welcome" = "welcome";
 "guide_set_sys_value" = "We are configuring the system environment for you...";
 "guide_middle_tips_0" = "Main system and Private-X system are completely independent, software runs in isolation, ensuring data privacy.";

+ 3 - 0
创维盒子/双子星云手机/zh-Hans.lproj/Localizable.strings

@@ -184,6 +184,9 @@
 "my_set_no_restart_phone_tips_no_vip" = "当前vip已过期!";
 "my_set_no_reset_pwd_title" = "设置一个新密码";
 
+"my_set_TVP2P_Open_title" = "投屏已开启";
+"my_set_TVP2P_Open_Subtitle" = "请在TV上查看是否成功投屏";
+"my_set_TVP2P_Open_sure" = "确定";
 
 "guide_welcome" = "欢迎使用";
 "guide_set_sys_value" = "我们正在为您配置系统环境...";

+ 3 - 0
创维盒子/双子星云手机/zh-Hant.lproj/Localizable.strings

@@ -184,6 +184,9 @@
 "my_set_no_restart_phone_tips_no_vip" = "當前vip已過期!";
 "my_set_no_reset_pwd_title" = "設置一個新密碼";
 
+"my_set_TVP2P_Open_title" = "投屏已開啟";
+"my_set_TVP2P_Open_Subtitle" = "請在TV上查看是否成功投屏";
+"my_set_TVP2P_Open_sure" = "確定";
 
 "guide_welcome" = "歡迎使用";
 "guide_set_sys_value" = "我們正在為您配置系統環境...";