Przeglądaj źródła

输入密码页面支持更换设备

huangxiaodong 1 rok temu
rodzic
commit
8f00355b29

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

@@ -53,6 +53,12 @@
 /*忘记密码 设置完成通知*/
 #define forgetPwdDidSetNotification                 @"forgetPwdDidSetNot"
 
+/*扫码切换通知*/
+#define scanChangeDeviceNotification                 @"scanChangeDeviceNot"
+
+/*扫码切换回到原来切面通知*/
+#define scanChangeDeviceBackNotification                 @"scanChangeDeviceBackNot"
+
 /*主动上锁通知*/
 #define lockBypwdNotification                 @"lockBypwdNot"
 

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

@@ -22,6 +22,7 @@
 #import "customLaunchView.h"
 #import "RSATool.h"
 #import "forgetPwdViewController.h"
+#import "TipsQRCodeForChangeDeviceViewController.h"
 
 @interface SceneDelegate ()<SetUsePWDViewControllerDelegate,GuideViewControllerDelegate>
 @property(nonatomic, strong)   CalculatorViewController *calculatorVC;
@@ -56,6 +57,10 @@
         
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(forgetPwdDidSetPwdFun:)  name:forgetPwdDidSetNotification  object:nil];
         
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(scanChangeDeviceFun:)  name:scanChangeDeviceNotification  object:nil];
+        
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(scanChangeDeviceBackFun:)  name:scanChangeDeviceBackNotification  object:nil];
+        
         UIWindowScene *windowScene = (UIWindowScene *)scene;
         self.window = [[UIWindow alloc] initWithWindowScene:windowScene];
         self.window.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
@@ -192,6 +197,7 @@
     
     if(_curPlayerVC){
         [_curPlayerVC disconnectVideoServer];
+        _curPlayerVC = nil;
     }
     
     //每次进入
@@ -625,9 +631,6 @@
 - (void)forgetPwdFun:(NSNotification*)not
 {
     
-    [_curPlayerVC disconnectVideoServer];
-    _preRootPlayerNav = nil;
-    
     /*忘记密码*/
     forgetPwdViewController *forgetPwdVC = [[forgetPwdViewController alloc] init];
     BaseNavigationController *forgetPwdVCNav = [[BaseNavigationController alloc] initWithRootViewController:forgetPwdVC];
@@ -665,4 +668,30 @@
     [connectDeviceManager shareInstance].isFirstInputPwdDone = YES;
 }
 
+
+#pragma mark 扫码切换设备 scanChangeDeviceNotification
+- (void)scanChangeDeviceFun:(NSNotification*)not
+{
+    
+    TipsQRCodeForChangeDeviceViewController *nextVC = [[TipsQRCodeForChangeDeviceViewController alloc] init];
+    nextVC.isRootVCType = YES;
+    BaseNavigationController *nextNav = [[BaseNavigationController alloc] initWithRootViewController:nextVC];
+    self.window.rootViewController = nextNav;
+    
+}
+
+#pragma mark 扫码切换设备点击返回
+- (void)scanChangeDeviceBackFun:(NSNotification*)not
+{
+    if(_preRootPlayerNav)
+    {
+        self.window.rootViewController = _preRootPlayerNav;
+    }
+    else{
+        [self enterMainVCFromScene];
+    }
+    
+    [self showCalculatorVC];
+}
+
 @end

+ 21 - 0
创维盒子/双子星云手机/Assets.xcassets/Guide/saoyisao.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "saoyisao@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
创维盒子/双子星云手机/Assets.xcassets/Guide/saoyisao.imageset/saoyisao@2x.png


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

@@ -10,6 +10,8 @@
 #import "RSATool.h"
 #import "forgetPwdViewController.h"
 #import "SceneDelegate.h"
+#import "TipsQRCodeForChangeDeviceViewController.h"
+#import "BaseNavigationController.h"
 
 @interface inputPWDViewController (){
     NSString *pwd;
@@ -39,6 +41,21 @@
     
     [self.view setBackgroundColor:HWF5F7FAColor];
     
+    //扫一扫 切换设置
+    UIButton *saobut = [[UIButton alloc] init];
+    [saobut setImage:[UIImage imageNamed:@"saoyisao"] forState:UIControlStateNormal];
+    [self.view addSubview:saobut];
+    //saobut.backgroundColor = [UIColor greenColor];
+    
+    [saobut addTarget:self action:@selector(scanToChangeDeviceFun) forControlEvents:UIControlEventTouchUpInside];
+    
+    [saobut mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.width.mas_equalTo(40);
+        make.height.mas_equalTo(40);
+        make.right.mas_equalTo(-20);
+        make.top.mas_equalTo(30.f + safeArea);
+    }];
+    
     /*设置密码标题*/
     UILabel *topLabel = [[UILabel alloc] init];
     [topLabel setFont:[UIFont boldSystemFontOfSize:16.f]];
@@ -585,14 +602,21 @@
     //SceneDelegate *sceneDelegate = (SceneDelegate *)self.window.rootViewController;
 }
 
-/*
-#pragma mark - Navigation
-
-// In a storyboard-based application, you will often want to do a little preparation before navigation
-- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
-    // Get the new view controller using [segue destinationViewController].
-    // Pass the selected object to the new view controller.
+#pragma mark 扫一扫 切换设备
+- (void)scanToChangeDeviceFun
+{
+    
+    TipsQRCodeForChangeDeviceViewController *vc = [[TipsQRCodeForChangeDeviceViewController alloc] init];
+    
+    if(self.navigationController){
+        [self.navigationController pushViewController:vc animated:YES];
+    }
+    else{
+        //发个通知
+        [[NSNotificationCenter defaultCenter] postNotificationName:scanChangeDeviceNotification object:nil];
+        
+        //view 加载在windows上
+        [self.view removeFromSuperview];
+    }
 }
-*/
-
 @end

+ 1 - 1
创维盒子/双子星云手机/Class/Set/ChangeDevice/TipsQRCodeForChangeDeviceViewController.h

@@ -10,7 +10,7 @@
 NS_ASSUME_NONNULL_BEGIN
 
 @interface TipsQRCodeForChangeDeviceViewController : BaseViewController
-
+@property(nonatomic,assign)BOOL isRootVCType;
 @end
 
 NS_ASSUME_NONNULL_END

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

@@ -26,6 +26,15 @@
     [self.navBarBGView setBackgroundColor:[UIColor clearColor]];
 }
 
+- (void)backBtnPressed
+{
+    [super backBtnPressed];
+    
+    if(_isRootVCType){
+        //发个通知
+        [[NSNotificationCenter defaultCenter] postNotificationName:scanChangeDeviceBackNotification object:nil];
+    }
+}
 
 - (void)drawAnyView{
     [self.navigationBar setHidden:YES];

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

@@ -151,6 +151,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 //更换图标
 + (void)lc_setAlternateIconName:(NSString*)iconName;
+
++ (UIViewController *)appRootViewController;
 @end
 
 NS_ASSUME_NONNULL_END

+ 8 - 0
创维盒子/双子星云手机/Helpers/iTools.m

@@ -992,4 +992,12 @@ static const char encodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopq
     }
 }
 
++ (UIViewController *)appRootViewController {
+    UIViewController *appRootVC = [iTools getKeyWindow].rootViewController;
+    UIViewController *topVC = appRootVC;
+    while (topVC.presentedViewController) {
+        topVC = topVC.presentedViewController;
+    }
+    return topVC;
+}
 @end