Преглед изворни кода

1.多端登录抢占提示,重新登录横屏输入密码乱序。(横屏后台也会)

huangxiaodong пре 8 месеци
родитељ
комит
dd63bf0cc3

+ 1 - 1
创维盒子/双子星云手机/AppDelegate/AppDelegate.m

@@ -150,7 +150,7 @@
     if (orientationMask != ZFInterfaceOrientationMaskUnknow) {
         return (UIInterfaceOrientationMask)orientationMask;
     }
-    
+    HLog(@"处理旋转屏幕:%d",self.supportScreenRotateType)
     if(self.supportScreenRotateType){
         return UIInterfaceOrientationMaskAllButUpsideDown;
     }

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

@@ -49,6 +49,7 @@
 #import "imageDetailsScrollViewController.h"
 #import "videoPlayByAVPlayerViewController.h"
 #import "pingManager.h"
+#import "webRtcPlayerViewController.h"
 
 @interface SceneDelegate ()<SetUsePWDViewControllerDelegate,GuideViewControllerDelegate,UITabBarControllerDelegate>
 @property(nonatomic, strong)   CalculatorViewController *calculatorVC;
@@ -606,24 +607,29 @@
         if(vcArr.count >= 2){
             UIViewController *curVC = vcArr.lastObject;
             if([curVC isKindOfClass:[imageDetailsScrollViewController class]]
-               ||[curVC isKindOfClass:[videoPlayByAVPlayerViewController class]]){
+               ||[curVC isKindOfClass:[videoPlayByAVPlayerViewController class]]
+               ||[curVC isKindOfClass:[webRtcPlayerViewController class]]){
                 //切换到竖屏
+                ksharedAppDelegate.supportScreenRotateType = YES;
                 [curVC hx_rotateToInterfaceOrientation:UIInterfaceOrientationPortrait];
-                ksharedAppDelegate.supportScreenRotateType = NO;
+                //ksharedAppDelegate.supportScreenRotateType = NO;
                 isNeeddelayedType = YES;
+                HLog(@"sceneDidEnterBackground 旋转屏幕为竖屏")
             }
         }
     }
     
+    [self showCalculatorVC];
     
-    if(isNeeddelayedType){
-        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-            [self showCalculatorVC];
-        });
-    }
-    else{
-        [self showCalculatorVC];
-    }
+//    if(isNeeddelayedType){
+//        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+//            ksharedAppDelegate.supportScreenRotateType = NO;
+//            [self showCalculatorVC];
+//        });
+//    }
+//    else{
+//        [self showCalculatorVC];
+//    }
 }
 
 - (void)scene:(UIScene *)scene continueUserActivity:(NSUserActivity *)userActivity {
@@ -746,6 +752,18 @@
 #pragma mark 计算器伪装视图
 /*CalculatorViewController*/
 - (void)showCalculatorVC{
+    HLog(@"showCalculatorVC 处理密码框弹出")
+    
+    if(SCREEN_W > SCREEN_H){
+        HLog(@"showCalculatorVC 屏幕还是横屏状态")
+        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+            [self showCalculatorVC];
+        });
+        return;
+    }
+    
+    ksharedAppDelegate.supportScreenRotateType = NO;
+    
     
     if(ksharedAppDelegate.getSystemPermissType){
         HLog(@"检测到获取系统全进入后台");

+ 4 - 0
创维盒子/双子星云手机/Class/Guide/inputPWDViewController.m

@@ -15,6 +15,7 @@
 
 #import "QRCodeScanForChangeDeviceViewController.h"
 #import "customToastVew.h"
+#import "UIInterface+HXRotation.h"
 
 @interface inputPWDViewController (){
     NSString *pwd;
@@ -33,6 +34,9 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view.
+    HLog(@"showCalculatorVC %f  -- %f",self.view.frame.size.width,self.view.frame.size.height)
+    [self hx_rotateToInterfaceOrientation:UIInterfaceOrientationPortrait];
+    
     pwd = @"";
     [self drawAnyView];
     

+ 25 - 0
创维盒子/双子星云手机/webRtc/webRtcPlayerViewController+AppDelegate.m

@@ -18,6 +18,7 @@
 - (void)applicationDidEnterBackground:(NSNotification *)notification {
     //  app进入后台时
     [self pauseStream];
+    [self checkLanAndPrivacyModeTypeFun];
 }
 
 - (void)applicationDidBecomeActive:(NSNotification *)notification
@@ -47,9 +48,33 @@
 }
 
 
+#pragma mark 检测是否为横屏而且 隐私模式 (密码界面只有竖屏 UI会乱)
+- (void)checkLanAndPrivacyModeTypeFun
+{
+    if(!self->isLan){
+        return;
+    }
+    
+    if(!ksharedAppDelegate.DeviceThirdIdMod.data.isPrivacyMode){
+        return;
+    }
+    
+    self->isLan = YES;
+    self->isLanAndPrivacyEnterBackground = YES;
+    //旋转屏幕为竖屏 (已经在sceneDelegate 处理旋转)
+    HLog(@"旋转屏幕为竖屏 (已经在sceneDelegate 处理旋转)")
+}
+
 #pragma mark 输入密码完成
 - (void)didInpuPwdOkFun
 {
     [self resumeStream];
+    
+    if(self->isLanAndPrivacyEnterBackground){
+        self->isLanAndPrivacyEnterBackground = NO;
+        ksharedAppDelegate.supportScreenRotateType = YES;
+        [self hx_rotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight];
+        HLog(@"旋转屏幕为横屏")
+    }
 }
 @end

+ 2 - 0
创维盒子/双子星云手机/webRtc/webRtcPlayerViewController.h

@@ -13,6 +13,7 @@
 #import "webRtcPlayerBottomContrView.h"
 #import "RcGameWQKeyChain.h"
 #import "ComontAlretViewController.h"
+#import "UIInterface+HXRotation.h"
 
 NS_ASSUME_NONNULL_BEGIN
 
@@ -21,6 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
      CGRect startFrame;//悬浮标拖拽用
     CGFloat lastVideoWHRate;//上传的流宽高比
     BOOL isLan;//是否是横屏状态
+    BOOL isLanAndPrivacyEnterBackground;//是否是横屏状态进入后台
     BOOL didAdjusBtnType;//是否设置过悬浮图标靠边了
     
     ComontAlretViewController *logoutAlertVC;

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

@@ -9,8 +9,6 @@
 #import "webRtcPlayerViewController+AdjustBtnFrame.h"
 #import "webRtcPlayerViewController+AdjustPlayerViewFrame.h"
 #import "webRtcPlayerViewController+AppDelegate.h"
-
-#import "UIInterface+HXRotation.h"
 #import "playerSetView.h"
 
 @interface webRtcPlayerViewController ()<MediaStreamClientEventsDelegate>
@@ -82,7 +80,7 @@
     
     [self enablePanRightBack];
     [self removeKVOObserverFun];
-    ksharedAppDelegate.supportScreenRotateType = NO;
+    //ksharedAppDelegate.supportScreenRotateType = NO;
     
     [self removeNewIndicator];
     [_playerSecondTimer invalidate];
@@ -454,7 +452,12 @@
         [[DFPlayer sharedPlayer] df_play];
     }
     
+    if(isLan){//保证竖屏
+        [self hx_rotateToInterfaceOrientation:UIInterfaceOrientationPortrait];
+    }
+    
     [self.navigationController popViewControllerAnimated:YES];
+    ksharedAppDelegate.supportScreenRotateType = NO;
 }
 
 #pragma mark 显示关闭投屏提示语
@@ -583,6 +586,10 @@
     //被挤下线 停止拉流
     [self pauseStream];
     
+    if(isLan){//保证竖屏
+        [self hx_rotateToInterfaceOrientation:UIInterfaceOrientationPortrait];
+    }
+    
     //退出推流页
     [self.navigationController popViewControllerAnimated:NO];
     //与安卓保存一致 tabbar 退倒nas页