Browse Source

1.位置服务修改分辨率功能迁移到客户端

huangxiaodong 6 months ago
parent
commit
96383300a8

+ 3 - 0
创维盒子/双子星云手机/AppDelegate/Config/Const.h

@@ -178,6 +178,9 @@ UIKIT_EXTERN NSString *const Const_file_pre_disk_check;
 /*云手机模式是否 YES:打开  其他关闭*/
 UIKIT_EXTERN NSString *const Const_cloudPhone_Model_Open;
 
+/*云手机设置分辨率 1:720  2:1080 0:未设置*/
+UIKIT_EXTERN NSString *const Const_cloudPhone_cur_resolution;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 3 - 0
创维盒子/双子星云手机/AppDelegate/Config/Const.m

@@ -174,4 +174,7 @@ NSString *const Const_file_pre_disk_check = @"file_pre_disk_check";
 
 /*云手机模式是否 YES:打开  其他关闭*/
 NSString *const Const_cloudPhone_Model_Open = @"cloudPhone_Model_Open";
+
+/*云手机设置分辨率 1:720  2:1080 0:未设置*/
+NSString *const Const_cloudPhone_cur_resolution = @"cloudPhone_cur_resolution";
 @end

+ 188 - 25
创维盒子/双子星云手机/CloudPlayer/View/playerSetView.m

@@ -9,6 +9,14 @@
 #import "SYJUISwitch.h"
 
 @interface playerSetView ()
+@property(nonatomic, strong)UIView* blackBgView;
+
+@property(nonatomic, strong)UIView *bg0View;//1.4.4 新加分辨率
+@property(nonatomic, strong) UIButton *resolution720Button;
+@property(nonatomic, strong) UIButton *resolution1080Button;
+@property(nonatomic,strong) CAGradientLayer *glayer;
+
+@property(nonatomic, strong) UIView *bg1View;
 @property(nonatomic, strong) SYJUISwitch * bottomNavSwitch;//底部导航栏开关
 @property(nonatomic, strong) SYJUISwitch * fullScreenSwitch;//全面屏开关
 @property(nonatomic, strong) UIButton *TVButton;
@@ -51,13 +59,13 @@
         make.bottom.mas_equalTo(0);
     }];
     
-    UIView* blackBgView = [UIView new];
-    blackBgView.layer.cornerRadius = 20;
-    blackBgView.backgroundColor = [UIColor hwColor:@"#202630"];
-    [self addSubview:blackBgView];
+    _blackBgView = [UIView new];
+    _blackBgView.layer.cornerRadius = 20;
+    _blackBgView.backgroundColor = [UIColor hwColor:@"#202630"];
+    [self addSubview:_blackBgView];
     
-    [blackBgView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.height.mas_equalTo(260);//(256);
+    [_blackBgView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.height.mas_equalTo(260 + 50);//(256);
         make.width.mas_equalTo(320);//(245);
         make.centerX.mas_equalTo(0.f);
         make.centerY.mas_equalTo(0.f);
@@ -75,7 +83,7 @@
     delayedTipLabel.font = [UIFont systemFontOfSize:12.0];
     delayedTipLabel.textColor = [UIColor whiteColor];
     delayedTipLabel.text = NSLocalizedString(@"webrtc_msg_delayed",nil);
-    [blackBgView addSubview:delayedTipLabel];
+    [_blackBgView addSubview:delayedTipLabel];
     //delayedTipLabel.backgroundColor = [UIColor redColor];
     
     [delayedTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -89,7 +97,7 @@
     _delayedLabel.font = [UIFont systemFontOfSize:12.0];
     //_delayedLabel.textColor = [UIColor whiteColor];
     //_delayedLabel.text = NSLocalizedString(@"webrtc_msg_delayed",nil);
-    [blackBgView addSubview:_delayedLabel];
+    [_blackBgView addSubview:_delayedLabel];
     //_delayedLabel.backgroundColor = [UIColor redColor];
     
     [_delayedLabel mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -148,7 +156,7 @@
     _speedLabel.textColor = [UIColor whiteColor];
     _speedLabel.textAlignment = NSTextAlignmentCenter;
     //_speedLabel.text = NSLocalizedString(@"webrtc_msg_delayed",nil);
-    [blackBgView addSubview:_speedLabel];
+    [_blackBgView addSubview:_speedLabel];
     //_speedLabel.backgroundColor = [UIColor redColor];
     
     [_speedLabel mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -179,7 +187,7 @@
     _fpsLabel.font = [UIFont systemFontOfSize:12.0];
     _fpsLabel.textColor = [UIColor whiteColor];
     //_fpsLabel.text = NSLocalizedString(@"webrtc_msg_delayed",nil);
-    [blackBgView addSubview:_fpsLabel];
+    [_blackBgView addSubview:_fpsLabel];
     //_fpsLabel.backgroundColor = [UIColor redColor];
     
     [_fpsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -191,31 +199,103 @@
     
     [self setWebRctMsgBydelayed:0 withPacketLoss:@"-" withSpeed:@"-" withFPS:@"-"];
     
+    /***************************分辨率*******************************************************/
+    
+    _bg0View = [UIView new];
+    _bg0View.layer.cornerRadius = 8;
+    _bg0View.backgroundColor = [UIColor hwColor:@"#29313D"];
+    [_blackBgView addSubview:_bg0View];
+    
+    [_bg0View mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.height.mas_equalTo(36);
+        make.left.mas_equalTo(12);
+        make.right.mas_equalTo(-12);
+        //make.top.mas_equalTo(16.f);
+        make.top.mas_equalTo(62.f);
+    }];
+    
+    //分辨率
+    UILabel *resolutionTipLabel = [[UILabel alloc] init];
+    resolutionTipLabel.text = NSLocalizedString(@"cloudPhone_player_set_resolution",nil);
+    resolutionTipLabel.textColor = [UIColor whiteColor];
+    resolutionTipLabel.font = [UIFont systemFontOfSize:12.0];
+    [_bg0View addSubview:resolutionTipLabel];
+    
+    [resolutionTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(15);
+        make.top.equalTo(_bg0View.mas_top).offset(0);
+        make.bottom.equalTo(_bg0View.mas_bottom).offset(0);
+    }];
+    
+    _resolution720Button = [[UIButton alloc] init];
+    _resolution720Button.layer.cornerRadius = 5;
+    _resolution720Button.backgroundColor = [UIColor hwColor:@"#D8D8D8" alpha:0.09];
+    [_resolution720Button setTitle:@"720*1280" forState:UIControlStateNormal];
+    [_resolution720Button setTitleColor:[UIColor hwColor:@"#FFFFFF"] forState:UIControlStateNormal];
+    _resolution720Button.titleLabel.font = [UIFont systemFontOfSize:12.0];
+    _resolution720Button.layer.masksToBounds = YES;
+    [_resolution720Button addTarget:self action:@selector(didClickResolution720ButFun) forControlEvents:UIControlEventTouchUpInside];
+    [_bg0View addSubview:_resolution720Button];
+    
+    [_resolution720Button mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(80);
+        make.width.mas_equalTo(93);
+        make.height.mas_equalTo(26);
+        make.centerY.mas_equalTo(0);
+    }];
+    
+    _resolution1080Button = [[UIButton alloc] init];
+    _resolution1080Button.layer.cornerRadius = 5;
+    _resolution1080Button.backgroundColor = [UIColor hwColor:@"#D8D8D8" alpha:0.09];
+    [_resolution1080Button setTitle:@"1080*1920" forState:UIControlStateNormal];
+    [_resolution1080Button setTitleColor:[UIColor hwColor:@"#FFFFFF"] forState:UIControlStateNormal];
+    _resolution1080Button.titleLabel.font = [UIFont systemFontOfSize:12.0];
+    _resolution1080Button.layer.masksToBounds = YES;
+    [_resolution1080Button addTarget:self action:@selector(didClickResolution1080ButFun) forControlEvents:UIControlEventTouchUpInside];
+    [_bg0View addSubview:_resolution1080Button];
+    
+    [_resolution1080Button mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.right.mas_equalTo(-12);
+        make.width.mas_equalTo(93);
+        make.height.mas_equalTo(26);
+        make.centerY.mas_equalTo(0);
+    }];
+    
+    // gradient
+    _glayer = [CAGradientLayer layer];
+    _glayer.frame = CGRectMake(0, 0, 93, 26);
+    _glayer.startPoint = CGPointMake(0, 0.5);
+    _glayer.endPoint = CGPointMake(0.97, 0.5);
+    _glayer.colors = @[(__bridge id)[UIColor hwColor:@"#0CDEFD" alpha:1.0].CGColor, (__bridge id)[UIColor hwColor:@"#058DFB" alpha:1.0].CGColor];
+    _glayer.locations = @[@(0), @(1.0f)];
+    
+    [self firstSetResolutionFun];
+    
     /***************************全面屏相关*******************************************************/
-    UIView *bg1View = [UIView new];
+    _bg1View = [UIView new];
 //    bg1View.layer.cornerRadius = 12;
 //    bg1View.backgroundColor = [UIColor hwColor:@"#29313D"];
-    [blackBgView addSubview:bg1View];
+    [_blackBgView addSubview:_bg1View];
     
-    [bg1View mas_makeConstraints:^(MASConstraintMaker *make) {
+    [_bg1View mas_makeConstraints:^(MASConstraintMaker *make) {
         make.height.mas_equalTo(42);
         make.left.mas_equalTo(12);
         make.right.mas_equalTo(-12);
-        //make.top.mas_equalTo(16.f);
-        make.top.mas_equalTo(54.f);
+        make.top.mas_equalTo(112.f);
+        //make.top.mas_equalTo(54.f);
     }];
     
     UIView *bgBottomNavView = [UIView new];
     bgBottomNavView.layer.cornerRadius = 8;
     bgBottomNavView.backgroundColor = [UIColor hwColor:@"#29313D"];
-    [blackBgView addSubview:bgBottomNavView];
+    [_blackBgView addSubview:bgBottomNavView];
     
     [bgBottomNavView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.bottom.mas_equalTo(bg1View.mas_bottom);
+        make.bottom.mas_equalTo(_bg1View.mas_bottom);
         make.left.mas_equalTo(12);
         make.right.equalTo(self.mas_centerX).offset(-6);
         //make.top.mas_equalTo(16.f);
-        make.top.mas_equalTo(bg1View.mas_top);
+        make.top.mas_equalTo(_bg1View.mas_top);
     }];
     
     UILabel *navSwitchTipLabel = [[UILabel alloc] init];
@@ -249,14 +329,14 @@
     UIView *bgFullScreenView = [UIView new];
     bgFullScreenView.layer.cornerRadius = 8;
     bgFullScreenView.backgroundColor = [UIColor hwColor:@"#29313D"];
-    [blackBgView addSubview:bgFullScreenView];
+    [_blackBgView addSubview:bgFullScreenView];
     
     [bgFullScreenView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.bottom.mas_equalTo(bg1View.mas_bottom);
+        make.bottom.mas_equalTo(_bg1View.mas_bottom);
         make.right.mas_equalTo(-12);
         make.left.equalTo(self.mas_centerX).offset(6);
         //make.top.mas_equalTo(16.f);
-        make.top.mas_equalTo(bg1View.mas_top);
+        make.top.mas_equalTo(_bg1View.mas_top);
     }];
     
     UILabel *fullScreenTipLabel = [[UILabel alloc] init];
@@ -296,13 +376,13 @@
     UIView *bg2View = [UIView new];
     bg2View.layer.cornerRadius = 12;
     bg2View.backgroundColor = [UIColor hwColor:@"#29313D"];
-    [blackBgView addSubview:bg2View];
+    [_blackBgView addSubview:bg2View];
     
     [bg2View mas_makeConstraints:^(MASConstraintMaker *make) {
         make.height.mas_equalTo(72);
         make.left.mas_equalTo(15);
         make.right.mas_equalTo(-15);
-        make.top.equalTo(bg1View.mas_bottom).offset(12);
+        make.top.equalTo(_bg1View.mas_bottom).offset(12);
         //make.top.mas_equalTo(52);
     }];
     
@@ -390,7 +470,7 @@
     _exitPhoneButton.layer.cornerRadius = 12;
     [_exitPhoneButton.titleLabel setFont:[UIFont systemFontOfSize:12.f]];
     _exitPhoneButton.backgroundColor = [UIColor hwColor:@"#29313D"];
-    [blackBgView addSubview:_exitPhoneButton];
+    [_blackBgView addSubview:_exitPhoneButton];
    
 //    if(ksharedAppDelegate.TvStatusMod.isTVShowType){
 //        _TVButton.selected = YES;
@@ -402,6 +482,8 @@
         make.right.mas_equalTo(-12);
         make.top.equalTo(bg2View.mas_bottom).offset(12);
     }];
+    
+    [self handleResolutionUIFun];
 }
 
 - (void)setAllSwitchFun
@@ -444,10 +526,11 @@
             [[netWorkManager shareInstance] DataEmbeddingPointBy:3 withEventValue:@"Cloud_full_screen_off"];
         }
         
+        [self handleResolutionUIFun];
         [[NSNotificationCenter defaultCenter] postNotificationName:setPlayerFullScreenNotification object:nil];
     }
     
-    [self removeFun];
+    //[self removeFun];
 }
 
 #pragma mark 按钮事件
@@ -512,4 +595,84 @@
     _speedLabel.text = [[NSString alloc] initWithFormat:@"%@%@",NSLocalizedString(@"webrtc_msg_speed",nil),speedStr];
     _fpsLabel.text = [[NSString alloc] initWithFormat:@"FPS:%@",fpsStr];
 }
+
+#pragma mark 设置分辨率
+- (void)firstSetResolutionFun
+{
+    NSInteger curResolution = [HWDataManager getIntegerWithKey:Const_cloudPhone_cur_resolution];
+    if(curResolution == 0 || curResolution == 1){
+        _resolution720Button.selected = YES;
+        [_resolution720Button.layer insertSublayer:_glayer atIndex:0];
+    }
+    else{
+        _resolution1080Button.selected = YES;
+        [_resolution1080Button.layer insertSublayer:_glayer atIndex:0];
+    }
+}
+
+#pragma mark 是否要显示设置分辨率(全面屏要隐藏)
+- (void)handleResolutionUIFun
+{
+    BOOL isHide  = [HWDataManager getBoolWithKey:Consn_player_full_screen_show];
+    if (isHide) {
+        [_blackBgView mas_updateConstraints:^(MASConstraintMaker *make) {
+            make.height.mas_equalTo(260);//(256);
+        }];
+        
+        _bg0View.hidden = YES;
+         
+        [_bg1View mas_updateConstraints:^(MASConstraintMaker *make) {
+            make.top.mas_equalTo(62);
+        }];
+
+    }
+    else{
+        
+        [_blackBgView mas_updateConstraints:^(MASConstraintMaker *make) {
+            make.height.mas_equalTo(260 + 50);//(256);
+        }];
+        
+        _bg0View.hidden = NO;
+        
+        [_bg1View mas_updateConstraints:^(MASConstraintMaker *make) {
+            make.top.mas_equalTo(112);
+        }];
+    }
+}
+
+#pragma mark 点击了分辨率720
+- (void)didClickResolution720ButFun
+{
+    if(_resolution720Button.selected){
+        return;
+    }
+    
+    _resolution1080Button.selected = NO;
+    _resolution720Button.selected = YES;
+    [_resolution720Button.layer insertSublayer:_glayer atIndex:0];
+    
+    if(_didClickButtonFun){
+        _didClickButtonFun(1);
+    }
+    
+    [HWDataManager setIntegerWithKey:Const_cloudPhone_cur_resolution value:1];
+}
+
+#pragma mark 点击了分辨率1080
+- (void)didClickResolution1080ButFun
+{
+    if(_resolution1080Button.selected){
+        return;
+    }
+    _resolution720Button.selected = NO;
+    _resolution1080Button.selected = YES;
+    [_resolution1080Button.layer insertSublayer:_glayer atIndex:0];
+    
+    if(_didClickButtonFun){
+        _didClickButtonFun(2);
+    }
+    
+    [HWDataManager setIntegerWithKey:Const_cloudPhone_cur_resolution value:2];
+}
+
 @end

+ 1 - 1
创维盒子/双子星云手机/NAS/view/NASMySpaceTableViewCell.m

@@ -190,7 +190,7 @@
     }
     
     // 计算 大小
-    CGFloat extraAvableSizeF = allExtraAvableSize / 1024.0 /1024.0/1024.0;
+    //CGFloat extraAvableSizeF = allExtraAvableSize / 1024.0 /1024.0/1024.0;
     CGFloat extraTotalSizeF = allExtraTotalSize / 1024.0 /1024.0/1024.0;
     CGFloat extraUsedSizeF = (allExtraTotalSize-allExtraAvableSize) / 1024.0 /1024.0/1024.0;
     

+ 95 - 7
创维盒子/双子星云手机/webRtc/webRtcPlayerViewController.m

@@ -140,11 +140,24 @@
     
     //判断是否是全屏
     BOOL fullscreenType = [HWDataManager getBoolWithKey:Consn_player_full_screen_show];
-    CGSize  phoneSize = CGSizeMake(720.0, 1280.0);
-    //云机分辨率被改成 720.0, 1280.0
-    if(ksharedAppDelegate.couldPhone_W_PHONE == 720 && ksharedAppDelegate.couldPhone_H_PHONE == 1280) {//云机可能存在的分辨率
-        phoneSize = CGSizeMake(720.0, 1280.0);
+    
+    NSInteger curResolution = [HWDataManager getIntegerWithKey:Const_cloudPhone_cur_resolution];
+    CGFloat curWidth = 720.0;
+    CGFloat curHeight = 1280.0;
+    if(curResolution == 0 || curResolution == 1){
+        curWidth = 720.0;
+        curHeight = 1280.0;
     }
+    else{
+        curWidth = 1080.0;
+        curHeight = 1920.0;
+    }
+    
+    CGSize  phoneSize = CGSizeMake(curWidth, curHeight);
+    //云机分辨率被改成 720.0, 1280.0
+//    if(ksharedAppDelegate.couldPhone_W_PHONE == 720 && ksharedAppDelegate.couldPhone_H_PHONE == 1280) {//云机可能存在的分辨率
+//        phoneSize = CGSizeMake(720.0, 1280.0);
+//    }
     
     if(fullscreenType){
         phoneSize = [RCCommandHelp commondToSetFullScreenPhoneSizeBySize];
@@ -245,9 +258,21 @@
     mainBlock(^{
         [weakSelf showNewIndicatorWithCanBack:YES canTouch:NO];
         
+        NSInteger curResolution = [HWDataManager getIntegerWithKey:Const_cloudPhone_cur_resolution];
+        CGFloat curWidth = 720.0;
+        CGFloat curHeight = 1280.0;
+        if(curResolution == 0 || curResolution == 1){
+            curWidth = 720.0;
+            curHeight = 1280.0;
+        }
+        else{
+            curWidth = 1080.0;
+            curHeight = 1920.0;
+        }
+        
         //判断是否是全屏
         BOOL fullscreenType = [HWDataManager getBoolWithKey:Consn_player_full_screen_show];
-        CGSize  phoneSize = CGSizeMake(720.0, 1280.0);
+        CGSize  phoneSize = CGSizeMake(curWidth, curHeight);
         if(fullscreenType){
             phoneSize = [RCCommandHelp commondToSetFullScreenPhoneSizeBySize];
         }
@@ -414,6 +439,16 @@
     
     _playerSetV.didClickButtonFun = ^(NSInteger tag) {
         switch (tag) {
+            case 1:
+                {//设置分辨率 720
+                   [weakSelf didClickSetResolution720Fun];
+                }
+                break;
+            case 2:
+                {//设置分辨率 1080
+                   [weakSelf didClickSetResolution1080Fun];
+                }
+                break;
             case 200:
                 {//截图
                    [weakSelf didClickshortCatFun];
@@ -457,6 +492,47 @@
     };
 }
 
+#pragma mark 设置分辨率 720*1280
+- (void)didClickSetResolution720Fun
+{
+    CGFloat tempRate = 0.0;
+    NSInteger cardDensity = 320;//480;
+    CGSize size = CGSizeMake(720.0, 1280.0);
+    if(isLan){
+        size = CGSizeMake(1280.0, 720.0);
+    }
+    [self setCardSize:(NSInteger)size.width cardHeight:(NSInteger)size.height cardDensity:cardDensity];
+    
+    tempRate = size.width/size.height;
+
+    if (tempRate > 1) {/*横屏*/
+        [self setLanMas_makeWithImageRate:tempRate];
+    }else{/*竖屏*/
+        [self setPoMas_makeWithImageRate:tempRate];
+    }
+
+}
+
+#pragma mark 设置分辨率 1080*1920
+- (void)didClickSetResolution1080Fun
+{
+    CGFloat tempRate = 0.0;
+    NSInteger cardDensity = 320;//480;
+    CGSize size = CGSizeMake(1080.0, 1920.0);
+    if(isLan){
+        size = CGSizeMake(1920.0, 1080.0);
+    }
+    [self setCardSize:(NSInteger)size.width cardHeight:(NSInteger)size.height cardDensity:cardDensity];
+    
+    tempRate = size.width/size.height;
+
+    if (tempRate > 1) {/*横屏*/
+        [self setLanMas_makeWithImageRate:tempRate];
+    }else{/*竖屏*/
+        [self setPoMas_makeWithImageRate:tempRate];
+    }
+}
+
 #pragma mark 点击了截图
 - (void)didClickshortCatFun
 {
@@ -801,9 +877,21 @@
         tempRate = (size.width *1.0)/(size.height *1.0);
     }
     else{
-        CGSize size = CGSizeMake(720.0, 1280.0);
+        NSInteger curResolution = [HWDataManager getIntegerWithKey:Const_cloudPhone_cur_resolution];
+        CGFloat curWidth = 720.0;
+        CGFloat curHeight = 1280.0;
+        if(curResolution == 0 || curResolution == 1){
+            curWidth = 720.0;
+            curHeight = 1280.0;
+        }
+        else{
+            curWidth = 1080.0;
+            curHeight = 1920.0;
+        }
+        
+        CGSize size = CGSizeMake(curWidth, curHeight);
         if(isLan){
-            size = CGSizeMake(1280.0, 720.0);
+            size = CGSizeMake(curHeight, curWidth);
         }
         [self setCardSize:(NSInteger)size.width cardHeight:(NSInteger)size.height cardDensity:cardDensity];
         

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

@@ -637,3 +637,6 @@
 "go_setting_title" = "去设置>";
 "cloudPhone_Model_open_tip"   = "云手机模式已开启,下次启动APP直接进入云手机";
 "cloudPhone_Model_close_tip"   = "云手机模式已关闭,下次启动APP直接进入NAS";
+
+//1.4.4
+"cloudPhone_player_set_resolution"   = "分辨率";