Browse Source

1.首页我的空间

huangxiaodong 1 year ago
parent
commit
3d87c3ab36

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

@@ -8,7 +8,9 @@
 #import <UIKit/UIKit.h>
 #import "cloudPhoneExtraFileListModel.h"
 #import "NASMsgModel.h"
-//#import "couldPhoneBaseInfoModel.h"
+#import "couldPhoneBaseInfoModel.h"
+
+
 @interface AppDelegate : UIResponder <UIApplicationDelegate>
 
 @property (nonatomic, strong) UIWindow *window;

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

@@ -94,6 +94,8 @@
 /* 获取文件夹完成通知*/
 #define getFolderListDoneNotification                 @"getFolderListDoneNot"
 
+/* 获取云机以及外挂磁盘*/
+#define getExtraFilesDoneNotification                 @"getExtraFilesDoneNoti"
 
 /* 搜索云机对应文件*/
 #define searchFileListDoneNotification                 @"searchFileListDoneNoti"

+ 19 - 0
创维盒子/双子星云手机/NAS/NASViewController.m

@@ -38,6 +38,8 @@
     
     [self.view setBackgroundColor:HWF5F7FAColor];
     
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getExtraFilesDoneFun:)  name:getExtraFilesDoneNotification  object:nil];
+    
     [self.toolBar setHidden:YES];
     [self.navigationBar setHidden:YES];
     [self.navBarBGView setHidden:YES];
@@ -170,6 +172,8 @@
     self.NASLastFileV.didClickButtonFun = ^(NSInteger tag) {
         [weakSelf didClickLastFileFunBy:tag];
     };
+    
+    [self setMySpaceDataFun];
 }
 
 #pragma mark - 懒加载
@@ -398,6 +402,21 @@
     [self pushViewController:vc animated:YES];
 }
 
+#pragma mark 获取到云机基本新
+- (void)getExtraFilesDoneFun:(NSNotification*)not
+{
+    [self setMySpaceDataFun];
+}
+
+#pragma mark  设置我的空间信息
+- (void)setMySpaceDataFun
+{
+    if(ksharedAppDelegate.cloudPhoneExtraFileListMod){
+        [_NASMySpaceV setProgressFun];
+    }
+}
+
+
 - (void)viewWillAppear:(BOOL)animated{
     [super viewWillAppear:animated];
     

+ 1 - 0
创维盒子/双子星云手机/NAS/view/NASMySpaceView.h

@@ -11,6 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface NASMySpaceView : UIView
 @property (nonatomic,copy) void (^didClickButtonFun)(NSInteger tag);
+- (void)setProgressFun;
 @end
 
 NS_ASSUME_NONNULL_END

+ 33 - 7
创维盒子/双子星云手机/NAS/view/NASMySpaceView.m

@@ -56,7 +56,7 @@
         make.height.mas_equalTo(20);
     }];
     
-    [self setTitleLabelTextFun];
+    [self setTitleLabelTextFunBy:@"--GB/--GB"];
     
     //添加按钮
     UIButton *rightButton = [[UIButton alloc] init];
@@ -98,9 +98,9 @@
     _glayer.locations = @[@(0), @(1.0f)];
     [_progressSelectView.layer addSublayer:_glayer];
     
-    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-        [self setProgressFun];
-    });
+//    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+//        [self setProgressFun];
+//    });
     
     NSArray *titleArr = @[NSLocalizedString(@"my_set_no_image_upload",nil),
                           NSLocalizedString(@"my_set_no_video_upload",nil),
@@ -163,11 +163,11 @@
     
 }
 
-- (void)setTitleLabelTextFun
+- (void)setTitleLabelTextFunBy:(NSString*)datsStr
 {
     NSString*title1 = NSLocalizedString(@"NAS_mySpace_title",nil);
     NSString*title2 = NSLocalizedString(@"NAS_used_Space",nil);
-    NSString*title3 = @"100GB/1T";
+    NSString*title3 = datsStr;
     
     NSString *fullTitle = [[NSString alloc] initWithFormat:@"%@ %@%@",title1,title2,title3];
     
@@ -182,14 +182,40 @@
 
 - (void)setProgressFun
 {
+    if(!ksharedAppDelegate.cloudPhoneExtraFileListMod.data){
+        return;
+    }
+    
+    long  allExtraAvableSize = 0;
+    long  allExtraTotalSize = 0;
+
+    for (cloudPhoneExtraFileModel*model in ksharedAppDelegate.cloudPhoneExtraFileListMod.data) {
+        allExtraAvableSize += model.extraAvableSize;
+        allExtraTotalSize += model.extraTotalSize;
+    }
+    
+    if(allExtraAvableSize == 0 || allExtraTotalSize == 0){
+        return;
+    }
+    
+    CGFloat rate = allExtraAvableSize/(allExtraTotalSize*1.0);
+    
     CGRect frame = _progressBgView.bounds;
-    frame.size.width =  frame.size.width * 0.5;
+    frame.size.width =  frame.size.width * rate;
     
     if (!isnan(frame.size.width))
     {
         _progressSelectView.frame = frame;
         _glayer.frame = frame;
     }
+    
+    
+    // 计算 大小
+    CGFloat extraAvableSizeF = allExtraAvableSize / 1024.0 /1024.0/1024.0;
+    CGFloat extraTotalSizeF = allExtraTotalSize / 1024.0 /1024.0/1024.0;
+    
+    NSString *dataStr  = [[NSString alloc] initWithFormat:@"%.1fGB/%.1fGB",extraAvableSizeF,extraTotalSizeF];
+    [self setTitleLabelTextFunBy:dataStr];
 }
 
 #pragma mark 按钮事件

+ 7 - 2
创维盒子/双子星云手机/cloudPhone/webSocketManager.m

@@ -473,6 +473,8 @@ static webSocketManager *webSocketManagerInstance = nil;
     
     //获取磁盘外挂
     [self getExtraFilesListFun];
+    
+    [self getBaseInfoFun];
 }
 
 #pragma mark 盒子第一次连接成功  给ws发送信息 单点登录 把其他账号挤下去
@@ -576,7 +578,7 @@ static webSocketManager *webSocketManagerInstance = nil;
     
 }
 
-#pragma mark 获取外挂产品
+#pragma mark 获取云机以及外挂磁盘
 - (void)getExtraFilesListFun
 {
     NSString *ExtraCommondStr  = [RCCommandHelp getExtraFilesList];
@@ -761,10 +763,13 @@ static webSocketManager *webSocketManagerInstance = nil;
     [[NSNotificationCenter defaultCenter] postNotificationName:searchFileListDoneNotification object:dataDict];/*发送通知*/
 }
 
+#pragma mark 获取云机已经外挂产品
 - (void)getExtraFilesResponseFun:(NSDictionary *)dataDict
 {
     cloudPhoneExtraFileListModel *model = [[cloudPhoneExtraFileListModel alloc] initWithDictionary:dataDict error:nil];
     ksharedAppDelegate.cloudPhoneExtraFileListMod = model;
+    
+    [[NSNotificationCenter defaultCenter] postNotificationName:getExtraFilesDoneNotification object:dataDict];/*发送通知*/
 }
 
 - (void)getExtraMediaEventResponseFun:(NSDictionary *)dataDict
@@ -849,7 +854,7 @@ static webSocketManager *webSocketManagerInstance = nil;
 }
 
 
-#pragma mark 获取云机剩余空间
+#pragma mark 获取云机基本信息
 - (void)getBaseInfoFun
 {
     NSString *commondStr  = @"{\"type\":\"getBaseInfo\"}";