Explorar o código

1.tabbar针对SN显示不一样的内容

huangxiaodong hai 1 semana
pai
achega
418e3c1a04

+ 3 - 0
创维盒子/code/AppDelegate/Config/Const.h

@@ -190,6 +190,9 @@ UIKIT_EXTERN NSString *const Const_best_webRtc_IPRoom;
 /*记录当前镜像版本的tokens是否需要新的*/
 UIKIT_EXTERN NSString *const Const_image_version_for_new_token;
 
+/*记录上一个连接成功的SN*/
+UIKIT_EXTERN NSString *const Const_pre_did_link_ok_sn;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 4 - 0
创维盒子/code/AppDelegate/Config/Const.m

@@ -186,4 +186,8 @@ NSString *const Const_best_webRtc_IPRoom = @"best_webRtc_IPRoom";
 
 /*记录当前镜像版本的tokens是否需要新的*/
 NSString *const Const_image_version_for_new_token = @"image_V_token";
+
+/*记录上一个连接成功的SN*/
+NSString *const Const_pre_did_link_ok_sn = @"pre_did_link_ok_sn";
+
 @end

+ 51 - 7
创维盒子/code/AppDelegate/SceneDelegate.m

@@ -63,6 +63,7 @@
 #import "imageVersionUpdateFailView.h"
 #import "privacyModeTipViewController.h"
 #import "LoginType1ViewController.h"
+#import "previewFileAndFolderViewController.h"
 
 @interface SceneDelegate ()<SetUsePWDViewControllerDelegate,GuideViewControllerDelegate,UITabBarControllerDelegate>
 {
@@ -119,6 +120,8 @@
         
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(scanChangeDeviceBackFun:)  name:scanChangeDeviceBackNotification  object:nil];
         
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(firstDidLinkBoxFun)  name:@"firstDidLinkBox"  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);
@@ -552,20 +555,39 @@
     cloudPhoneViewController *cloudVC = [[cloudPhoneViewController alloc] init];
     BaseNavigationController *cloudPhoneNav = [[BaseNavigationController alloc] initWithRootViewController:cloudVC];
 
+    previewFileAndFolderViewController *fileVC = [[previewFileAndFolderViewController alloc] init];
+    BaseNavigationController *fileNav = [[BaseNavigationController alloc] initWithRootViewController:fileVC];
+
     mineViewController *mineVC = [[mineViewController alloc] init];
     BaseNavigationController *mineNav = [[BaseNavigationController alloc] initWithRootViewController:mineVC];
     
-
-    NSArray *viewControllers = @[NasNav, cloudPhoneNav,mineNav]; // 添加更多视图控制器
-    tabBarController.viewControllers = viewControllers;
     
-
     NSString*phoneTitle = NSLocalizedString(@"tabbar_cloud_phone",nil);
     NSString*myTitle = NSLocalizedString(@"tabbar_my_title",nil);
+    NSString*fileTitle = NSLocalizedString(@"my_set_no_file",nil);
+    
+    //NSArray *viewControllers = @[NasNav, cloudPhoneNav,mineNav]; // 添加更多视图控制器
+    NSArray *viewControllers = @[NasNav,fileNav,mineNav]; // 添加更多视图控制器
     
-    NSArray *titleArr = @[@"NAS",phoneTitle,myTitle];
-    NSArray *imageNArr = @[@"tabbar_nas_N", @"tabbar_phone_N",@"tabbar_my_N"];
-    NSArray *imageHArr = @[@"tabbar_nas_H", @"tabbar_phone_H",@"tabbar_my_H"];
+    NSArray *titleArr = @[@"NAS",fileTitle,myTitle];
+    NSArray *imageNArr = @[@"tabbar_nas_N", @"tabbar_file_N",@"tabbar_my_N"];
+    NSArray *imageHArr = @[@"tabbar_nas_H", @"tabbar_file_H",@"tabbar_my_H"];
+    
+    //记录当前连接的SN
+    NSString* preSN = [HWDataManager getStringWithKey:Const_pre_did_link_ok_sn];
+    NSString *curSN = ksharedAppDelegate.DeviceThirdIdMod.data.changeSn;
+    if(![curSN isEqualToString:@"0333933700223110016962"]
+       && ![preSN isEqualToString:@"0333933700223110016962"]
+       && preSN.length > 0){
+        titleArr = @[@"NAS",phoneTitle,myTitle];
+        imageNArr = @[@"tabbar_nas_N", @"my_device_NO",@"tabbar_my_N"];
+        imageHArr = @[@"tabbar_nas_H", @"my_device_ok",@"tabbar_my_H"];
+        
+        viewControllers = @[NasNav,cloudPhoneNav,mineNav];
+    }
+   
+    
+    tabBarController.viewControllers = viewControllers;
     
     for (int i=0; i<viewControllers.count; i++) {
         UITabBarItem * tabBarItem = [UITabBarItem new];
@@ -615,6 +637,28 @@
     });
 }
 
+#pragma mark 第一次连接成功
+- (void)firstDidLinkBoxFun
+{
+    
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+        
+        if (ksharedAppDelegate.mainTabBar) {
+            NSArray *curArr = ksharedAppDelegate.mainTabBar.viewControllers;
+            if (curArr.count >= 3) {
+                BaseNavigationController *Nav = curArr[1];
+                UIViewController *curVC = Nav.viewControllers.firstObject;
+                if (![curVC isKindOfClass:[previewFileAndFolderViewController class]]) {
+                    return;
+                }
+            }
+        }
+        
+        //[self initMainTabbarFun];
+        [self enterMainVCFromScene];
+    });
+}
+
 #pragma mark 处理进来是非隐私模式的情况
 - (void)HandleEnterNotPrivacyModeFun
 {

+ 2 - 2
创维盒子/code/Assets.xcassets/tabbar/tabbar_phone_H.imageset/Contents.json

@@ -5,12 +5,12 @@
       "scale" : "1x"
     },
     {
-      "filename" : "tabbar_phone_H@2x.png",
+      "filename" : "my_device_NO@2x.png",
       "idiom" : "universal",
       "scale" : "2x"
     },
     {
-      "filename" : "tabbar_phone_H@3x.png",
+      "filename" : "my_device_NO@3x.png",
       "idiom" : "universal",
       "scale" : "3x"
     }

创维盒子/code/Assets.xcassets/tabbar/tabbar_phone_N.imageset/tabbar_phone_N@2x.png → 创维盒子/code/Assets.xcassets/Tool/my_device_NO.imageset/my_device_NO@2x.png


创维盒子/code/Assets.xcassets/tabbar/tabbar_phone_N.imageset/tabbar_phone_N@3x.png → 创维盒子/code/Assets.xcassets/Tool/my_device_NO.imageset/my_device_NO@3x.png


+ 2 - 2
创维盒子/code/Assets.xcassets/tabbar/tabbar_phone_N.imageset/Contents.json

@@ -5,12 +5,12 @@
       "scale" : "1x"
     },
     {
-      "filename" : "tabbar_phone_N@2x.png",
+      "filename" : "my_device_ok@2x.png",
       "idiom" : "universal",
       "scale" : "2x"
     },
     {
-      "filename" : "tabbar_phone_N@3x.png",
+      "filename" : "my_device_ok@3x.png",
       "idiom" : "universal",
       "scale" : "3x"
     }

创维盒子/code/Assets.xcassets/tabbar/tabbar_phone_H.imageset/tabbar_phone_H@2x.png → 创维盒子/code/Assets.xcassets/Tool/my_device_ok.imageset/my_device_ok@2x.png


创维盒子/code/Assets.xcassets/tabbar/tabbar_phone_H.imageset/tabbar_phone_H@3x.png → 创维盒子/code/Assets.xcassets/Tool/my_device_ok.imageset/my_device_ok@3x.png


+ 33 - 3
创维盒子/code/Class/Set/previewFile/previewFileAndFolderViewController.m

@@ -40,6 +40,7 @@
     BOOL hadDownloadTaskType;
     
     BOOL canShareType;
+    BOOL isFirstPageType;//是否为第一页
 }
 @property (nonatomic, strong) UITableView *tableView;
 
@@ -64,13 +65,25 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view.
+    NSArray *vcArr = self.navigationController.viewControllers;
     
+    if(vcArr.count == 1){
+        isFirstPageType = YES;
+    }
+    else{
+        isFirstPageType = NO;
+    }
+
     [self.toolBar setHidden:YES];
     [self.navigationBar setHidden:YES];
     [self.navBarBGView setHidden:NO];
     self.navBarBGView.backgroundColor = [UIColor whiteColor];
     [self.view setBackgroundColor:[UIColor whiteColor]];
     
+    if(isFirstPageType){
+        self.backBtn.hidden = YES;
+    }
+
     [self drawAnyView];
     
     _didSelectListArr = [NSMutableArray new];
@@ -148,12 +161,21 @@
     };
 
     
+    CGFloat tableViewAdjust = 0.0;
+    CGFloat bigAddbuttonAdjust = 0.0;
+    
+    if(isFirstPageType){
+        tableViewAdjust = TABBARHEIGHT;
+        bigAddbuttonAdjust = TABBARHEIGHT;
+    }
+
+    
     [self.view addSubview:self.tableView];
     [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.mas_equalTo(0);
         make.right.mas_equalTo(0);
         //make.bottom.mas_equalTo(-(safeArea));
-        make.bottom.mas_equalTo(0);
+        make.bottom.mas_equalTo(-tableViewAdjust);
         //make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
         make.top.equalTo(self.searchBarThridTypeV.mas_bottom).offset(10.f);
     }];
@@ -164,16 +186,22 @@
     [_uploadFileButton addTarget:self action:@selector(userDidClickUploadViewFun) forControlEvents:UIControlEventTouchUpInside];
     [self.view addSubview:_uploadFileButton];
     [_uploadFileButton mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.right.mas_equalTo(-65);
+        make.right.mas_equalTo(-15);
         make.width.mas_equalTo(52);
         make.height.mas_equalTo(52);
-        make.bottom.mas_equalTo(-30 - AdaptTabHeight);
+        make.bottom.mas_equalTo(-30 - AdaptTabHeight - bigAddbuttonAdjust);
     }];
     
     // 添加拖拽手势
    UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
    [_uploadFileButton addGestureRecognizer:panGesture];
     
+    [self customDefaultDiskPathFun];
+}
+
+//设置默认磁盘
+- (void)customDefaultDiskPathFun
+{
     NSMutableArray *arr = [NSMutableArray new];
     NSArray *diskList = ksharedAppDelegate.cloudPhoneExtraFileListMod.data;
     if(diskList && [diskList isKindOfClass:[NSArray class]]){
@@ -215,8 +243,10 @@
     }
     _diskListArr = arr;
     [self setTitleAfterGetdiskFun];
+    
 }
 
+
 - (void)initNavHeadUIFun
 {
     //title

+ 13 - 0
创维盒子/code/webRtc/webRtcManager/webRtcManager.m

@@ -260,6 +260,19 @@
         
         NSString *commondStr2  = @"{\"type\":\"TvStatus\"}";
         [self send_data:commondStr2];
+        
+        //记录当前连接的SN
+        NSString* preSN = [HWDataManager getStringWithKey:Const_pre_did_link_ok_sn];
+        NSString *curSN = ksharedAppDelegate.DeviceThirdIdMod.data.changeSn;
+        if (!preSN || ![preSN isEqualToString:curSN]) {
+            if (curSN) {
+                [HWDataManager setStringWithKey:Const_pre_did_link_ok_sn value:curSN];
+                
+                if(![curSN isEqualToString:@"0333933700223110016962"]){
+                    [[NSNotificationCenter defaultCenter] postNotificationName:@"firstDidLinkBox" object:nil];
+                }
+            }
+        }
     }
 }