// // NASMySpaceViewController.m // 双子星云手机 // // Created by xd h on 2024/6/21. // #import "NASMySpaceViewController.h" #import "NASMySpaceTableViewCell.h" @interface NASMySpaceViewController () @property (nonatomic, strong) UITableView *tableView; @property (nonatomic, strong) NSArray *allDataArr; @end @implementation NASMySpaceViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. [self.toolBar setHidden:YES]; [self.navigationBar setHidden:YES]; [self.navBarBGView setHidden:NO]; self.navBarBGView.backgroundColor = [UIColor whiteColor]; [self.view setBackgroundColor:[UIColor hwColor:@"#F6F8FA"]]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getExtraFilesDoneFun:) name:getExtraFilesDoneNotification object:nil]; self.titleLabel.text = NSLocalizedString(@"NAS_mySpace_title",nil); [self drawAnyView]; //数据埋点 [[netWorkManager shareInstance] DataEmbeddingPointBy:2 withEventValue:@"Storage_details"]; } - (void)drawAnyView{ [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.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f); }]; } #pragma mark - 懒加载 - (UITableView *)tableView{ if (!_tableView) { _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 0, 0) style:UITableViewStylePlain]; _tableView.delegate = self; _tableView.dataSource = self; _tableView.showsVerticalScrollIndicator = NO; _tableView.showsHorizontalScrollIndicator = NO; // _tableView.contentInset = UIEdgeInsetsMake(-H_STATE_BAR, 0, 0, 0); [_tableView setSeparatorStyle:(UITableViewCellSeparatorStyleNone)]; [_tableView setSeparatorColor:[UIColor clearColor]]; [_tableView setBackgroundColor:[UIColor clearColor]]; [_tableView setTableFooterView:[UIView new]]; [_tableView setBounces:YES]; if (@available(iOS 15.0, *)) { _tableView.sectionHeaderTopPadding = 0; } } return _tableView; } #pragma mark - 列表委托 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return _allDataArr.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ __block NSInteger row = indexPath.row; static NSString *identifier = @"NASMySpaceTableViewCell"; NASMySpaceTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier]; cell.selectionStyle = UITableViewCellSelectionStyleNone; if (!cell){ cell = [[NASMySpaceTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier]; [cell setSelectionStyle:UITableViewCellSelectionStyleNone]; [cell setBackgroundColor:[UIColor clearColor]]; } if(row < _allDataArr.count){ cell.extraFileModel = _allDataArr[row]; } return cell; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return 112 + 15; } #pragma mark 获取到云机基本新 - (void)getExtraFilesDoneFun:(NSNotification*)not { // _allDataArr = ksharedAppDelegate.cloudPhoneExtraFileListMod.data; // [_tableView reloadData]; [self getExtraFilesByFrpHttpFun]; } #pragma mark 走frp方案 获取云机信息 - (void)getExtraFilesByFrpHttpFun { NSMutableDictionary*paraDict = [NSMutableDictionary new]; KWeakSelf [[netWorkManager shareInstance] cloudPhoneGETCallBackCode:@"getExtra" Parameters:paraDict success:^(id _Nonnull responseObject) { cloudPhoneExtraFileListModel *model = [[cloudPhoneExtraFileListModel alloc] initWithDictionary:responseObject error:nil]; if(model && model.status == 0){ ksharedAppDelegate.cloudPhoneExtraFileListMod = model; weakSelf.allDataArr = ksharedAppDelegate.cloudPhoneExtraFileListMod.data; [weakSelf.tableView reloadData]; } } failure:^(NSError * _Nonnull error) { }]; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; if(!ksharedAppDelegate.cloudPhoneExtraFileListMod.data){ _allDataArr = @[]; //[[webRtcManager shareManager] getExtraFilesListFun]; [self getExtraFilesByFrpHttpFun]; } else{ _allDataArr = ksharedAppDelegate.cloudPhoneExtraFileListMod.data; [_tableView reloadData]; } } @end