NASMySpaceViewController~.m 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. //
  2. // NASMySpaceViewController.m
  3. // 双子星云手机
  4. //
  5. // Created by xd h on 2024/6/21.
  6. //
  7. #import "NASMySpaceViewController.h"
  8. #import "NASMySpaceTableViewCell.h"
  9. @interface NASMySpaceViewController ()<UITableViewDelegate,UITableViewDataSource>
  10. @property (nonatomic, strong) UITableView *tableView;
  11. @property (nonatomic, strong) NSArray *allDataArr;
  12. @end
  13. @implementation NASMySpaceViewController
  14. - (void)viewDidLoad {
  15. [super viewDidLoad];
  16. // Do any additional setup after loading the view.
  17. [self.toolBar setHidden:YES];
  18. [self.navigationBar setHidden:YES];
  19. [self.navBarBGView setHidden:NO];
  20. self.navBarBGView.backgroundColor = [UIColor whiteColor];
  21. [self.view setBackgroundColor:[UIColor hwColor:@"#F6F8FA"]];
  22. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getExtraFilesDoneFun:) name:getExtraFilesDoneNotification object:nil];
  23. self.titleLabel.text = NSLocalizedString(@"NAS_mySpace_title",nil);
  24. [self drawAnyView];
  25. //数据埋点
  26. [[netWorkManager shareInstance] DataEmbeddingPointBy:2 withEventValue:@"Storage_details"];
  27. }
  28. - (void)drawAnyView{
  29. [self.view addSubview:self.tableView];
  30. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  31. make.left.mas_equalTo(0);
  32. make.right.mas_equalTo(0);
  33. //make.bottom.mas_equalTo(-(safeArea));
  34. make.bottom.mas_equalTo(0);
  35. make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
  36. }];
  37. }
  38. #pragma mark - 懒加载
  39. - (UITableView *)tableView{
  40. if (!_tableView) {
  41. _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 0, 0) style:UITableViewStylePlain];
  42. _tableView.delegate = self;
  43. _tableView.dataSource = self;
  44. _tableView.showsVerticalScrollIndicator = NO;
  45. _tableView.showsHorizontalScrollIndicator = NO;
  46. // _tableView.contentInset = UIEdgeInsetsMake(-H_STATE_BAR, 0, 0, 0);
  47. [_tableView setSeparatorStyle:(UITableViewCellSeparatorStyleNone)];
  48. [_tableView setSeparatorColor:[UIColor clearColor]];
  49. [_tableView setBackgroundColor:[UIColor clearColor]];
  50. [_tableView setTableFooterView:[UIView new]];
  51. [_tableView setBounces:YES];
  52. if (@available(iOS 15.0, *)) {
  53. _tableView.sectionHeaderTopPadding = 0;
  54. }
  55. }
  56. return _tableView;
  57. }
  58. #pragma mark - 列表委托
  59. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  60. return 1;
  61. }
  62. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  63. return _allDataArr.count;
  64. }
  65. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  66. __block NSInteger row = indexPath.row;
  67. static NSString *identifier = @"NASMySpaceTableViewCell";
  68. NASMySpaceTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
  69. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  70. if (!cell){
  71. cell = [[NASMySpaceTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
  72. [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
  73. [cell setBackgroundColor:[UIColor clearColor]];
  74. }
  75. if(row < _allDataArr.count){
  76. cell.extraFileModel = _allDataArr[row];
  77. }
  78. return cell;
  79. }
  80. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  81. return 112 + 15;
  82. }
  83. #pragma mark 获取到云机基本新
  84. - (void)getExtraFilesDoneFun:(NSNotification*)not
  85. {
  86. // _allDataArr = ksharedAppDelegate.cloudPhoneExtraFileListMod.data;
  87. // [_tableView reloadData];
  88. [self getExtraFilesByFrpHttpFun];
  89. }
  90. #pragma mark 走frp方案 获取云机信息
  91. - (void)getExtraFilesByFrpHttpFun
  92. {
  93. NSMutableDictionary*paraDict = [NSMutableDictionary new];
  94. KWeakSelf
  95. [[netWorkManager shareInstance] cloudPhoneGETCallBackCode:@"getExtra" Parameters:paraDict success:^(id _Nonnull responseObject) {
  96. cloudPhoneExtraFileListModel *model = [[cloudPhoneExtraFileListModel alloc] initWithDictionary:responseObject error:nil];
  97. if(model && model.status == 0){
  98. ksharedAppDelegate.cloudPhoneExtraFileListMod = model;
  99. weakSelf.allDataArr = ksharedAppDelegate.cloudPhoneExtraFileListMod.data;
  100. [weakSelf.tableView reloadData];
  101. }
  102. } failure:^(NSError * _Nonnull error) {
  103. }];
  104. }
  105. - (void)viewWillAppear:(BOOL)animated
  106. {
  107. [super viewWillAppear:animated];
  108. if(!ksharedAppDelegate.cloudPhoneExtraFileListMod.data){
  109. _allDataArr = @[];
  110. //[[webRtcManager shareManager] getExtraFilesListFun];
  111. [self getExtraFilesByFrpHttpFun];
  112. }
  113. else{
  114. _allDataArr = ksharedAppDelegate.cloudPhoneExtraFileListMod.data;
  115. [_tableView reloadData];
  116. }
  117. }
  118. @end