NASViewController.m 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193
  1. //
  2. // NASViewController.m
  3. // 双子星云手机
  4. //
  5. // Created by xd h on 2024/6/19.
  6. //
  7. #import "NASViewController.h"
  8. #import "NASMySpaceView.h"
  9. #import "NASCommonUsedView.h"
  10. #import "shareSecretTableViewCell.h"
  11. #import "NASLastFileView.h"
  12. #import "previewImageOrVideoViewController.h"
  13. #import "previewAudioOrDocumentViewController.h"
  14. #import "previewFileAndFolderViewController.h"
  15. #import "shareRecordViewController.h"
  16. #import "backupsOptionViewController.h"
  17. #import "fileTransfeSetViewController.h"
  18. #import "uploadFileRecordViewController.h"
  19. #import "previewToUploadFileView.h"
  20. #import "NASMySpaceViewController.h"
  21. #import "NasPreviewVideoViewController.h"
  22. #import "lastFileManager.h"
  23. #import "lastFileTableViewCell.h"
  24. #import "nasLastFileViewController.h"
  25. #import "audioPlayerViewController.h"
  26. #import "videoPlayByAVPlayerViewController.h"
  27. #import "imageDetailsScrollViewController.h"
  28. #import "queryShareModel.h"
  29. #import "imageVersionRenewTipView.h"
  30. #import "HWVersionModel.h"
  31. #import "HaveNewVersionView.h"
  32. #import "newerGuideView.h"
  33. #import "CustomerWebViewController.h"
  34. #import "noticeModel.h"
  35. #import "HaveNoticeView.h"
  36. #import "audioPlayingView.h"
  37. #import "DFPlayer.h"
  38. #import "queryShareReportMarkModel.h"
  39. #import "UpgradeInfoModel.h"
  40. #import "imageVersionUpdateDoneView.h"
  41. #import "imageVersionUpdateFailView.h"
  42. #import "queryHeartbeatModel.h"
  43. #import "BoxHeartbeatAlertTool.h"
  44. #import "searchBarView.h"
  45. #import "NasPreviewAPPViewController.h"
  46. #import "NasSearchViewController.h"
  47. #import "DocumentPickerManager.h"
  48. @interface NASViewController ()<UITableViewDelegate,UITableViewDataSource>
  49. {
  50. BOOL canShareType;
  51. UIImageView *welcomeImageV;//弃用
  52. UIView* rightRedView;//
  53. BOOL hadUploadTaskType;
  54. BOOL hadDownloadTaskType;
  55. NSInteger tryLinkNum;
  56. NSInteger tryLinkFrpNum;//frp接口连接次数
  57. imageVersionRenewTipView * RenewTipView;
  58. imageVersionUpdateDoneView* imageVersionUpdateDoneV;
  59. imageVersionUpdateFailView* imageVersionUpdateFailV;
  60. UILabel * tableFooterlabel;//
  61. }
  62. @property (nonatomic,strong)UITableView*tableView;
  63. @property (nonatomic, strong) UIView*tableHeadView;
  64. @property (nonatomic, strong) searchBarView* searchBarV;
  65. @property (nonatomic, strong) NASMySpaceView* NASMySpaceV;
  66. @property (nonatomic, strong) NASCommonUsedView* NASCommonUsedV;
  67. @property (nonatomic,strong)NASLastFileView*NASLastFileV;
  68. @property (nonatomic,strong) NSMutableArray *lastFileDataArr;
  69. @property (nonatomic,strong)UpgradeInfoModel*otaUpgradeInfoModel;
  70. @end
  71. @implementation NASViewController
  72. - (void)viewDidLoad {
  73. [super viewDidLoad];
  74. // Do any additional setup after loading the view.
  75. [self.view setBackgroundColor:HWF5F7FAColor];
  76. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getExtraFilesDoneFun:) name:getExtraFilesDoneNotification object:nil];
  77. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil];
  78. //输入密码完成
  79. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didInpuPwdOkFun) name:didInputPWDNotification object:nil];
  80. [self.toolBar setHidden:YES];
  81. [self.navigationBar setHidden:YES];
  82. [self.navBarBGView setHidden:YES];
  83. [self drawAnyView];
  84. // CGFloat second = 0.1;
  85. // BOOL haveOpenMask = [HWDataManager getBoolWithKey:Const_cloudPhone_Model_Open];
  86. // if(haveOpenMask){
  87. // second = 5;
  88. // }
  89. // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(second * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  90. // [self beginShowAlertFun];
  91. // });
  92. //[self beginShowAlertFun];
  93. }
  94. - (void)drawAnyView{
  95. //顶底底部图片
  96. UIImageView *topImageV = [UIImageView new];
  97. topImageV.image = [UIImage imageNamed:@"Nas_top_img"];
  98. [self.view addSubview:topImageV];
  99. [topImageV mas_makeConstraints:^(MASConstraintMaker *make) {
  100. make.top.mas_equalTo(0);
  101. make.left.mas_equalTo(0);
  102. make.right.mas_equalTo(0);
  103. make.height.mas_equalTo(280.0*AUTOSCALE);
  104. }];
  105. // NSString *welcomeImageStr = @"nas_welcome_cs";
  106. // //欢迎
  107. // //en-US 英文 ja-JP 日文
  108. // NSArray *arLanguages = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"];
  109. // NSLog(@"arLanguages:%@",arLanguages);
  110. // ///获取设备当前地区的代码和APP语言环境
  111. // NSString *languageCode = [NSLocale preferredLanguages][0];
  112. //
  113. // //目前支持 中文(简体 繁体) 英文 日语
  114. // if([languageCode rangeOfString:@"zh-Hans"].location != NSNotFound)
  115. // {
  116. // welcomeImageStr = @"nas_welcome_cs";
  117. // }
  118. // else if([languageCode rangeOfString:@"zh-Hant"].location != NSNotFound)
  119. // {
  120. // welcomeImageStr = @"nas_welcome_ct";
  121. // }
  122. // else{
  123. // welcomeImageStr = @"nas_welcome_en";
  124. // }
  125. CGFloat imageTopY = 54.0;
  126. welcomeImageV = [UIImageView new];
  127. welcomeImageV.hidden = YES;
  128. //welcomeImageV.image = [UIImage imageNamed:welcomeImageStr];
  129. [self.view addSubview:welcomeImageV];
  130. [welcomeImageV mas_makeConstraints:^(MASConstraintMaker *make) {
  131. make.top.mas_equalTo(imageTopY);
  132. make.left.mas_equalTo(16);
  133. make.width.mas_equalTo(210);
  134. make.height.mas_equalTo(24);
  135. }];
  136. UILabel *welcomelabel = [[UILabel alloc] init];
  137. welcomelabel.text = NSLocalizedString(@"NAS_top_welcome_title",nil);
  138. welcomelabel.textColor = [UIColor hwColor:@"#0A132B"];
  139. welcomelabel.font = [UIFont boldSystemFontOfSize:18.0];
  140. [self.view addSubview:welcomelabel];
  141. [welcomelabel mas_makeConstraints:^(MASConstraintMaker *make) {
  142. make.top.mas_equalTo(imageTopY);
  143. make.left.mas_equalTo(16);
  144. make.width.mas_equalTo(240);
  145. make.height.mas_equalTo(24);
  146. }];
  147. //添加按钮
  148. UIButton *addButton = [[UIButton alloc] init];
  149. [addButton setImage:[UIImage imageNamed:@"nas_add_icon"] forState:UIControlStateNormal];
  150. addButton.tag = 1;
  151. [addButton addTarget:self action:@selector(didClickHeadButtonFun:) forControlEvents:UIControlEventTouchUpInside];
  152. [self.view addSubview:addButton];
  153. [addButton mas_makeConstraints:^(MASConstraintMaker *make) {
  154. make.centerY.equalTo(welcomeImageV.mas_centerY).offset(0);
  155. make.right.mas_equalTo(-10);
  156. make.width.mas_equalTo(40);
  157. make.height.mas_equalTo(40);
  158. }];
  159. UIButton *rightTransferListButton = [[UIButton alloc] init];
  160. //[rightTransferListButton setImage:[UIImage imageNamed:@"icon_file_transfer"] forState:UIControlStateNormal];
  161. [rightTransferListButton setImage:[UIImage imageNamed:@"icon_file_transfer"] forState:UIControlStateNormal];
  162. rightTransferListButton.tag = 2;
  163. [rightTransferListButton addTarget:self action:@selector(didClickHeadButtonFun:) forControlEvents:UIControlEventTouchUpInside];
  164. [self.view addSubview:rightTransferListButton];
  165. [rightTransferListButton mas_makeConstraints:^(MASConstraintMaker *make) {
  166. //make.top.mas_equalTo(imageTopY);
  167. make.centerY.equalTo(welcomeImageV.mas_centerY).offset(0);
  168. make.right.equalTo(addButton.mas_left).offset(0);
  169. make.width.mas_equalTo(40);
  170. make.height.mas_equalTo(40);
  171. }];
  172. rightRedView = [[UIView alloc] init];
  173. rightRedView.backgroundColor = [UIColor hwColor:@"#DD4E4E" alpha:1.0];
  174. [rightTransferListButton addSubview:rightRedView];
  175. rightRedView.layer.cornerRadius = 7;
  176. rightRedView.hidden = YES;
  177. [rightRedView mas_makeConstraints:^(MASConstraintMaker *make) {
  178. make.width.mas_equalTo(14);
  179. make.height.mas_equalTo(14);
  180. make.right.mas_equalTo(0);
  181. make.top.mas_equalTo(6);
  182. }];
  183. [self.view addSubview:self.tableView];
  184. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  185. make.left.mas_equalTo(0);
  186. make.right.mas_equalTo(0);
  187. make.top.equalTo(welcomeImageV.mas_bottom).offset(20);
  188. make.bottom.mas_equalTo(-TABBARHEIGHT);
  189. }];
  190. self.tableView.userInteractionEnabled = NO;
  191. _tableHeadView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, (42+ 14) + 165+ 15 +120 +54 + 15)];
  192. //_tableHeadView.backgroundColor = [UIColor hwColor:@"#F6F8FA"];
  193. _tableHeadView.backgroundColor = [UIColor clearColor];
  194. self.tableView.tableHeaderView = _tableHeadView;
  195. //1.4.5 新加搜索 (高度 42+14)
  196. _searchBarV = [[searchBarView alloc] init];
  197. [_tableHeadView addSubview:_searchBarV];
  198. [_searchBarV mas_makeConstraints:^(MASConstraintMaker *make) {
  199. //make.top.equalTo(welcomeImageV.mas_bottom).offset(20);
  200. make.top.mas_equalTo(0);
  201. make.left.mas_equalTo(0);
  202. make.right.mas_equalTo(0);
  203. make.height.mas_equalTo(42);
  204. }];
  205. //我的空间
  206. _NASMySpaceV = [[NASMySpaceView alloc] init];
  207. [_tableHeadView addSubview:_NASMySpaceV];
  208. [_NASMySpaceV mas_makeConstraints:^(MASConstraintMaker *make) {
  209. //make.top.equalTo(welcomeImageV.mas_bottom).offset(20);
  210. make.top.equalTo(_searchBarV.mas_bottom).offset(14);
  211. //make.top.mas_equalTo(0);
  212. make.left.mas_equalTo(0);
  213. make.right.mas_equalTo(0);
  214. make.height.mas_equalTo(165);
  215. }];
  216. //常用功能
  217. _NASCommonUsedV = [[NASCommonUsedView alloc] init];
  218. [_tableHeadView addSubview:_NASCommonUsedV];
  219. [_NASCommonUsedV mas_makeConstraints:^(MASConstraintMaker *make) {
  220. make.top.equalTo(_NASMySpaceV.mas_bottom).offset(15);
  221. make.left.mas_equalTo(0);
  222. make.right.mas_equalTo(0);
  223. make.height.mas_equalTo(120);
  224. }];
  225. //最近文件
  226. [_tableHeadView addSubview:self.NASLastFileV];
  227. [self.NASLastFileV mas_makeConstraints:^(MASConstraintMaker *make) {
  228. make.top.equalTo(_NASCommonUsedV.mas_bottom).offset(15);
  229. make.left.mas_equalTo(0);
  230. make.right.mas_equalTo(0);
  231. make.height.mas_equalTo(54);
  232. }];
  233. BOOL isShowLastFileType = [HWDataManager getBoolWithKey:Const_last_file_show];
  234. self.NASLastFileV.eyeButton.selected = !isShowLastFileType;
  235. //tableFooterView
  236. NSString *text = NSLocalizedString(@"NAS_bottom_tip",nil);
  237. UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, 50)];
  238. label.text = [[NSString alloc] initWithFormat:@"- %@ -",text];
  239. label.textColor = [UIColor hwColor:@"#959799"];
  240. label.font = [UIFont systemFontOfSize:12];
  241. label.textAlignment = NSTextAlignmentCenter;
  242. self.tableView.tableFooterView = label;
  243. tableFooterlabel = label;
  244. KWeakSelf
  245. _NASMySpaceV.didClickButtonFun = ^(NSInteger tag) {
  246. [weakSelf didClickMySpaceFunBy:tag];
  247. };
  248. _NASCommonUsedV.didClickButtonFun = ^(NSInteger tag) {
  249. [weakSelf didClickCommonUsedFunBy:tag];
  250. };
  251. self.NASLastFileV.didClickButtonFun = ^(NSInteger tag) {
  252. [weakSelf didClickLastFileFunBy:tag];
  253. };
  254. _searchBarV.didClickBgFun = ^{
  255. [weakSelf gotoSearchVCFun];
  256. };
  257. [self setMySpaceDataFun];
  258. }
  259. #pragma mark - 懒加载
  260. - (UITableView *)tableView{
  261. if (!_tableView) {
  262. _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 0, 0) style:UITableViewStylePlain];
  263. _tableView.delegate = self;
  264. _tableView.dataSource = self;
  265. _tableView.showsVerticalScrollIndicator = NO;
  266. _tableView.showsHorizontalScrollIndicator = NO;
  267. // _tableView.contentInset = UIEdgeInsetsMake(-H_STATE_BAR, 0, 0, 0);
  268. [_tableView setSeparatorStyle:(UITableViewCellSeparatorStyleNone)];
  269. [_tableView setSeparatorColor:[UIColor clearColor]];
  270. //[_tableView setBackgroundColor:[UIColor hwColor:@"#FFFFFF"]];
  271. [_tableView setBackgroundColor:[UIColor clearColor]];
  272. //[_tableView setTableFooterView:[UIView new]];
  273. [_tableView setBounces:YES];
  274. if (@available(iOS 15.0, *)) {
  275. _tableView.sectionHeaderTopPadding = 0;
  276. }
  277. _tableView.layer.cornerRadius = 8;
  278. _tableView.layer.masksToBounds = YES;
  279. }
  280. return _tableView;
  281. }
  282. - (NASLastFileView*)NASLastFileV
  283. {
  284. if(!_NASLastFileV){
  285. _NASLastFileV = [NASLastFileView new];
  286. }
  287. return _NASLastFileV;
  288. }
  289. #pragma mark - 列表委托
  290. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  291. return 1;
  292. }
  293. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  294. if(!_lastFileDataArr){
  295. return 0;
  296. }
  297. return _lastFileDataArr.count;
  298. }
  299. - (lastFileTableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  300. __block NSInteger row = indexPath.row;
  301. static NSString *identifier = @"lastFileTableViewCell";
  302. lastFileTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
  303. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  304. if (!cell){
  305. cell = [[lastFileTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
  306. [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
  307. [cell setBackgroundColor:[UIColor clearColor]];
  308. [cell setAccessoryType:(UITableViewCellAccessoryNone)];
  309. [cell hideCheckButtonBy:YES];
  310. }
  311. if(row < _lastFileDataArr.count){
  312. lastFileModel* dataModel = _lastFileDataArr[row];
  313. cell.curLastFileModel = dataModel;
  314. // KWeakSelf
  315. // cell.didClickSwitch = ^(BOOL SwitchOn) {
  316. // //[weakSelf userCheckFilePreviewByRow:row];
  317. // };
  318. cell.cellBgView.layer.mask = nil;
  319. if(row == _lastFileDataArr.count -1){
  320. /*下圆角*/
  321. UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-32 , 84)
  322. byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight
  323. cornerRadii:CGSizeMake(12, 12)];
  324. CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
  325. maskLayer.frame = cell.cellBgView.bounds;
  326. maskLayer.path = maskPath.CGPath;
  327. cell.cellBgView.layer.mask = maskLayer;
  328. }
  329. }
  330. return cell;
  331. }
  332. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  333. return 84;
  334. }
  335. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  336. {
  337. NSInteger row = indexPath.row;
  338. if(row < _lastFileDataArr.count){
  339. lastFileModel* dataModel = _lastFileDataArr[row];
  340. if([dataModel.type isEqualToString:@"video"]){
  341. videoPlayByAVPlayerViewController *vc = [videoPlayByAVPlayerViewController new];
  342. vc.VideoDataMode = (NASFileAndFolderDataModel*)dataModel;
  343. [self.navigationController pushViewController:vc animated:YES];
  344. }
  345. else if([dataModel.type isEqualToString:@"audio"]){
  346. // NSMutableArray *audioDataArr = [NSMutableArray new];
  347. // NSInteger index = 0;
  348. //
  349. // for (int i=0; i<_lastFileDataArr.count; i++) {
  350. // lastFileModel* audioDataModel = _lastFileDataArr[i];
  351. // if([audioDataModel.type isEqualToString:@"audio"]){
  352. //
  353. // if(i == row){
  354. // index = audioDataArr.count;
  355. // }
  356. //
  357. // [audioDataArr addObject:audioDataModel];
  358. // }
  359. // }
  360. audioPlayerViewController *vc = [audioPlayerViewController new];
  361. vc.isfirstEnterType = YES;
  362. vc.outSideDataModel = (NASFileAudioDataModel *)dataModel;
  363. [self.navigationController pushViewController:vc animated:YES];
  364. KWeakSelf
  365. vc.didNeedDeleteFile = ^(NSString * _Nonnull filePath) {
  366. [weakSelf getLastFileDataFun];
  367. };
  368. }
  369. else if([dataModel.type containsString:@"jpg"]){
  370. NSMutableArray *jpgDataArr = [NSMutableArray new];
  371. NSInteger index = 0;
  372. for (int i=0; i<_lastFileDataArr.count; i++) {
  373. lastFileModel* jpgDataModel = _lastFileDataArr[i];
  374. if([jpgDataModel.type containsString:@"jpg"]){
  375. if(i == row){
  376. index = jpgDataArr.count;
  377. }
  378. [jpgDataArr addObject:jpgDataModel];
  379. }
  380. }
  381. imageDetailsScrollViewController *vc = [imageDetailsScrollViewController new];
  382. vc.index = index;
  383. vc.totalDataArr = jpgDataArr;
  384. [self.navigationController pushViewController:vc animated:YES];
  385. vc.canShareType = canShareType;
  386. }
  387. }
  388. }
  389. #pragma mark 点击头部
  390. - (void)didClickHeadButtonFun:(UIButton*)but
  391. {
  392. if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
  393. {
  394. [[iToast makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)] show];
  395. return;
  396. }
  397. NSInteger tag = but.tag;
  398. switch (tag) {
  399. case 1:
  400. {
  401. if(ksharedAppDelegate.DisabledFileTransferType){
  402. if(ksharedAppDelegate.isImageNewFor130){
  403. [[iToast makeText:NSLocalizedString(@"File_Transfer_Disable_tip",nil)] show];
  404. }
  405. else{
  406. [[iToast makeText:NSLocalizedString(@"File_Transfer_Disable_tip2",nil)] show];
  407. }
  408. return;
  409. }
  410. [self userDidClickUploadViewFun];
  411. }
  412. break;
  413. case 2:
  414. {
  415. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  416. [self pushViewController:vc animated:YES];
  417. }
  418. break;
  419. default:
  420. break;
  421. }
  422. }
  423. #pragma mark 点击我的空间模块
  424. - (void)didClickMySpaceFunBy:(NSInteger)tag
  425. {
  426. // if(tag ==1 ){
  427. // if(!ksharedAppDelegate.cloudPhoneExtraFileListMod){
  428. // //链接了
  429. // tryLinkNum ++;
  430. // [[webSocketManager shareInstance] getExtraFilesListFun];
  431. //
  432. // if(tryLinkNum >= 3){
  433. // tryLinkNum = 0;
  434. // [[iToast makeText:NSLocalizedString(@"box_link_error_show_tip",nil)] show];
  435. // return;
  436. // }
  437. //
  438. // KWeakSelf
  439. // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  440. // [weakSelf didClickMySpaceFunBy:tag];
  441. // });
  442. // return;
  443. // }
  444. // }
  445. if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
  446. {
  447. [[iToast makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)] show];
  448. //return;
  449. }
  450. // if (!ksharedAppDelegate.isWebSockLinkOKAginType) {//未链接
  451. // [[iToast makeText:NSLocalizedString(@"box_link_error_show_tip",nil)] show];
  452. // return;
  453. // }
  454. // if(ksharedAppDelegate.DisabledFileTransferType){
  455. // if(ksharedAppDelegate.isImageNewFor130){
  456. // [[iToast makeText:NSLocalizedString(@"File_Transfer_Disable_tip",nil)] show];
  457. // }
  458. // else{
  459. // [[iToast makeText:NSLocalizedString(@"File_Transfer_Disable_tip2",nil)] show];
  460. // }
  461. // return;
  462. // }
  463. tryLinkNum = 0;
  464. switch (tag)
  465. {
  466. case 1:
  467. {
  468. NASMySpaceViewController *vc = [NASMySpaceViewController new];
  469. [self pushViewController:vc animated:YES];
  470. }
  471. break;
  472. case 9:{
  473. NasPreviewAPPViewController *vc = [NasPreviewAPPViewController new];
  474. [self pushViewController:vc animated:YES];
  475. }
  476. break;
  477. case 10:{
  478. previewImageOrVideoViewController *vc = [previewImageOrVideoViewController new];
  479. vc.isPhotoType = YES;
  480. [self pushViewController:vc animated:YES];
  481. }
  482. break;
  483. case 11:{
  484. // previewImageOrVideoViewController *vc = [previewImageOrVideoViewController new];
  485. // vc.isPhotoType = NO;
  486. // [self pushViewController:vc animated:YES];
  487. NasPreviewVideoViewController *vc = [NasPreviewVideoViewController new];
  488. [self pushViewController:vc animated:YES];
  489. }
  490. break;
  491. case 12:{
  492. previewAudioOrDocumentViewController *vc = [previewAudioOrDocumentViewController new];
  493. vc.isAudioType = YES;
  494. [self pushViewController:vc animated:YES];
  495. }
  496. break;
  497. case 13:{
  498. previewFileAndFolderViewController *vc = [previewFileAndFolderViewController new];
  499. [self pushViewController:vc animated:YES];
  500. }
  501. break;
  502. default:
  503. break;
  504. }
  505. }
  506. #pragma mark 点击常用模块模块
  507. - (void)didClickCommonUsedFunBy:(NSInteger)tag
  508. {
  509. if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
  510. {
  511. [[iToast makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)] show];
  512. return;
  513. }
  514. // if (!ksharedAppDelegate.isWebSockLinkOKAginType) {//未链接
  515. // [[iToast makeText:NSLocalizedString(@"box_link_error_show_tip",nil)] show];
  516. // return;
  517. // }
  518. switch (tag)
  519. {
  520. case 10:{
  521. backupsOptionViewController *vc = [backupsOptionViewController new];
  522. [self pushViewController:vc animated:YES];
  523. }
  524. break;
  525. case 11:
  526. {
  527. // if(!ksharedAppDelegate.isWebSockLinkOKAginType){
  528. // [[iToast makeText:NSLocalizedString(@"check_could_phone_state",nil)] show];
  529. // return;
  530. // }
  531. fileTransfeSetViewController *nextVC = [fileTransfeSetViewController new];
  532. [self pushViewController:nextVC animated:YES];
  533. }
  534. break;
  535. case 12:{
  536. shareRecordViewController *vc = [shareRecordViewController new];
  537. [self pushViewController:vc animated:YES];
  538. [self.NASCommonUsedV setRedPointShow:NO];
  539. [self updateShareBeMarkFun];
  540. }
  541. break;
  542. default:
  543. break;
  544. }
  545. }
  546. #pragma mark 点击最近文件模块
  547. - (void)didClickLastFileFunBy:(NSInteger)tag
  548. {
  549. if(tag == 2){
  550. [self getLastFileDataFun];
  551. }
  552. else if (tag ==1){
  553. nasLastFileViewController *vc = [nasLastFileViewController new];
  554. [self pushViewController:vc animated:YES];
  555. }
  556. }
  557. #pragma mark 用户点击上传文件
  558. - (void)userDidClickUploadViewFun
  559. {
  560. [self hideTabbarFun];
  561. previewToUploadFileView *previewToUploadFileV = [[previewToUploadFileView alloc] init];
  562. [self.view addSubview:previewToUploadFileV];
  563. [previewToUploadFileV mas_makeConstraints:^(MASConstraintMaker *make) {
  564. make.left.mas_equalTo(0);
  565. make.right.mas_equalTo(0);
  566. make.bottom.mas_equalTo(10);
  567. make.top.mas_equalTo(0);
  568. }];
  569. KWeakSelf
  570. previewToUploadFileV.didClickButtonFun = ^(NSInteger tag) {
  571. [weakSelf gotoUploadFileFunWith:tag];
  572. };
  573. previewToUploadFileV.didClickCloseFun = ^{
  574. [weakSelf showTabbarFun];
  575. };
  576. }
  577. #pragma mark 调整文件上传
  578. - (void)gotoUploadFileFunWith:(NSInteger)tag
  579. {
  580. if(tag == 10 || tag == 11){
  581. uploadImageOrVideoViewController *vc = [uploadImageOrVideoViewController new];
  582. if(tag ==10){
  583. vc.isPhotoType = YES;
  584. }
  585. else{
  586. vc.isPhotoType = NO;
  587. }
  588. [self pushViewController:vc animated:YES];
  589. }
  590. else{
  591. KWeakSelf
  592. [[DocumentPickerManager shareManager] openDocumentPickerSuccess:^(NSArray * _Nonnull urls) {
  593. [weakSelf gotoUploadFileRecordByFileAppWithUrls:urls];
  594. }];
  595. }
  596. }
  597. #pragma mark 获取到云机磁盘相关信息
  598. - (void)getExtraFilesDoneFun:(NSNotification*)not
  599. {
  600. // mainBlock(^{
  601. // [self setMySpaceDataFun];
  602. // });
  603. [self getExtraFilesByFrpHttpFun];
  604. }
  605. #pragma mark 走frp方案 获取云机磁盘信息
  606. - (void)getExtraFilesByFrpHttpFun
  607. {
  608. //无网 拿数据缓存
  609. if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
  610. {
  611. //数据缓存
  612. NSString *key = stringKeyAddSn(@"getExtra");
  613. NSDictionary *dataDict = [HWDataManager getObjectWithKey:key];
  614. if (dataDict) {
  615. cloudPhoneExtraFileListModel *model = [[cloudPhoneExtraFileListModel alloc] initWithDictionary:dataDict error:nil];
  616. if(model && model.status == 0){
  617. ksharedAppDelegate.cloudPhoneExtraFileListMod = model;
  618. [self setMySpaceDataFun];
  619. return;
  620. }
  621. }
  622. }
  623. NSMutableDictionary*paraDict = [NSMutableDictionary new];
  624. KWeakSelf
  625. [[netWorkManager shareInstance] cloudPhoneGETCallBackCode:@"getExtra" Parameters:paraDict success:^(id _Nonnull responseObject) {
  626. cloudPhoneExtraFileListModel *model = [[cloudPhoneExtraFileListModel alloc] initWithDictionary:responseObject error:nil];
  627. if(model && model.status == 0){
  628. NSMutableDictionary *IdDataDict = [[NSMutableDictionary alloc] initWithDictionary:responseObject];
  629. for (NSString *key in responseObject) {
  630. id object = IdDataDict[key];
  631. if(!object || [object isKindOfClass:[NSNull class]]){
  632. [IdDataDict removeObjectForKey:key];
  633. }
  634. }
  635. //数据缓存
  636. NSString *key = stringKeyAddSn(@"getExtra");
  637. [HWDataManager setObjectWithKey:key value:IdDataDict];
  638. ksharedAppDelegate.cloudPhoneExtraFileListMod = model;
  639. [weakSelf setMySpaceDataFun];
  640. }
  641. } failure:^(NSError * _Nonnull error) {
  642. [weakSelf setMySpaceDataFun];
  643. }];
  644. }
  645. #pragma mark 设置我的空间信息
  646. - (void)setMySpaceDataFun
  647. {
  648. if(ksharedAppDelegate.cloudPhoneExtraFileListMod){
  649. tryLinkFrpNum = 0;
  650. [_NASMySpaceV setProgressFun];
  651. }
  652. else{
  653. // tryLinkFrpNum ++;
  654. //
  655. // if(tryLinkFrpNum == 3){
  656. // tryLinkFrpNum = 0;
  657. // [self checkBoxHeartbeatFun];
  658. // }
  659. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  660. //[self setMySpaceDataFun];
  661. [self getExtraFilesByFrpHttpFun];
  662. });
  663. }
  664. }
  665. - (void)viewWillAppear:(BOOL)animated{
  666. [super viewWillAppear:animated];
  667. [self getLastFileDataFun];
  668. [self queryShareSwitchFunFun];
  669. [self queryShareBeMarkFun];
  670. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  671. [self checkFileTransferTask];
  672. });
  673. //[self beginShowAlertFun];
  674. [self handelAudioPlayingViewFun];
  675. [self showTabbarFun];
  676. //尝试修复偶现获取不到磁盘空间问题
  677. [self getExtraFilesByFrpHttpFun];
  678. }
  679. - (void)viewWillDisappear:(BOOL)animated{
  680. [super viewWillDisappear:animated];
  681. }
  682. - (void)pushViewController:(UIViewController*)vc animated:(BOOL)animated
  683. {
  684. [self.navigationController pushViewController:vc animated:animated];
  685. //[self hideTabbarFun];
  686. }
  687. - (void)showTabbarFun
  688. {
  689. // 显示 tab bar
  690. self.tabBarController.tabBar.hidden = NO;
  691. }
  692. - (void)hideTabbarFun
  693. {
  694. // 隐藏 tab bar
  695. self.tabBarController.tabBar.hidden = YES;
  696. }
  697. #pragma mark 获取最近文件数据
  698. - (void)getLastFileDataFun
  699. {
  700. _lastFileDataArr = [lastFileManager shareManager].lastFileListArr;
  701. //HLog(@"%@",_lastFileDataArr);
  702. BOOL isShowLastFileType = [HWDataManager getBoolWithKey:Const_last_file_show];
  703. if(!isShowLastFileType){
  704. _tableHeadView.frame = CGRectMake(0, 0, SCREEN_W,(42+ 14) + 165+ 15 +120 +54 + 15);
  705. [self.NASLastFileV mas_remakeConstraints:^(MASConstraintMaker *make) {
  706. make.top.equalTo(_NASCommonUsedV.mas_bottom).offset(15);
  707. make.left.mas_equalTo(0);
  708. make.right.mas_equalTo(0);
  709. make.height.mas_equalTo(54);
  710. }];
  711. self.NASLastFileV.notDataImageV.hidden = YES;
  712. self.NASLastFileV.notDataLabel.hidden = YES;
  713. //全圆角
  714. UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-32 , 54)
  715. byRoundingCorners:UIRectCornerAllCorners
  716. cornerRadii:CGSizeMake(12, 12)];
  717. CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
  718. maskLayer.frame = self.NASLastFileV.bounds;
  719. maskLayer.path = maskPath.CGPath;
  720. self.NASLastFileV.whiteBgView.layer.mask = nil;
  721. self.NASLastFileV.whiteBgView.layer.mask = maskLayer;
  722. _lastFileDataArr = [NSMutableArray new];
  723. }
  724. else if(_lastFileDataArr.count > 0){
  725. _tableHeadView.frame = CGRectMake(0, 0, SCREEN_W,(42+ 14) + 165+ 15 +120 +54 + 15);
  726. [self.NASLastFileV mas_remakeConstraints:^(MASConstraintMaker *make) {
  727. make.top.equalTo(_NASCommonUsedV.mas_bottom).offset(15);
  728. make.left.mas_equalTo(0);
  729. make.right.mas_equalTo(0);
  730. make.height.mas_equalTo(54);
  731. }];
  732. self.NASLastFileV.notDataImageV.hidden = YES;
  733. self.NASLastFileV.notDataLabel.hidden = YES;
  734. /*上圆角*/
  735. UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W- 32 , 54)
  736. byRoundingCorners:UIRectCornerTopLeft|UIRectCornerTopRight
  737. cornerRadii:CGSizeMake(12, 12)];
  738. CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
  739. maskLayer.frame = CGRectMake(0, 0, SCREEN_W -32, 54);
  740. maskLayer.path = maskPath.CGPath;
  741. self.NASLastFileV.whiteBgView.layer.mask = nil;
  742. self.NASLastFileV.whiteBgView.layer.mask = maskLayer;
  743. }
  744. else{
  745. _tableHeadView.frame = CGRectMake(0, 0, SCREEN_W,(42+ 14) + 165+ 15 +120 +254 + 15);
  746. [self.NASLastFileV mas_remakeConstraints:^(MASConstraintMaker *make) {
  747. make.top.equalTo(_NASCommonUsedV.mas_bottom).offset(15);
  748. make.left.mas_equalTo(0);
  749. make.right.mas_equalTo(0);
  750. make.height.mas_equalTo(254);
  751. }];
  752. self.NASLastFileV.notDataImageV.hidden = NO;
  753. self.NASLastFileV.notDataLabel.hidden = NO;
  754. //全圆角
  755. UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-32 , 254)
  756. byRoundingCorners:UIRectCornerAllCorners
  757. cornerRadii:CGSizeMake(12, 12)];
  758. CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
  759. maskLayer.frame = self.NASLastFileV.bounds;
  760. maskLayer.path = maskPath.CGPath;
  761. self.NASLastFileV.whiteBgView.layer.mask = nil;
  762. self.NASLastFileV.whiteBgView.layer.mask = maskLayer;
  763. }
  764. KWeakSelf
  765. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  766. if(weakSelf.lastFileDataArr.count > 0){
  767. weakSelf.tableView.tableFooterView = self->tableFooterlabel;
  768. }
  769. else{
  770. weakSelf.tableView.tableFooterView = nil;
  771. }
  772. [weakSelf.tableView reloadData];
  773. });
  774. }
  775. #pragma mark 获取分享开关
  776. -(void)queryShareSwitchFunFun
  777. {
  778. NSMutableDictionary *paraDict = [NSMutableDictionary new];
  779. [paraDict setValue:@7 forKey:@"type"];
  780. //KWeakSelf
  781. [[netWorkManager shareInstance] CommonGetWithCallBackCode:queryShareSwitchFun Parameters:paraDict success:^(id _Nonnull responseObject){
  782. queryShareModel *queryShareMod = [[queryShareModel alloc] initWithDictionary:responseObject error:nil];
  783. if(queryShareMod){
  784. self->canShareType = queryShareMod.data.configValue;
  785. //[weakSelf.curEditTypeBottomView setCanShaewFunBy:queryShareMod.data.configValue];
  786. }
  787. } failure:^(NSError * _Nonnull error) {
  788. }];
  789. }
  790. - (void)checkFileTransferTask
  791. {//有个偶现的闪退在BGFMDB
  792. [[nasUploadFileManager shareInstance] checkHadUploadTaskWithComplete:^(BOOL isSuccess) {
  793. self->hadUploadTaskType = isSuccess;
  794. [self setRightButtonRedTypeFun];
  795. }];
  796. KWeakSelf
  797. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  798. [[nasDownloadFileManager shareInstance] checkHadDownloadTaskWithComplete:^(BOOL isSuccess) {
  799. self->hadDownloadTaskType = isSuccess;
  800. [weakSelf setRightButtonRedTypeFun];
  801. }];
  802. });
  803. }
  804. - (void)setRightButtonRedTypeFun
  805. {
  806. mainBlock(^{
  807. if(self->hadUploadTaskType || self->hadDownloadTaskType){
  808. self->rightRedView.hidden = NO;
  809. }
  810. else{
  811. self->rightRedView.hidden = YES;
  812. }
  813. });
  814. }
  815. #pragma mark 是否有新的分享被封禁
  816. -(void)queryShareBeMarkFun
  817. {
  818. NSMutableDictionary *paraDict = [NSMutableDictionary new];
  819. KWeakSelf
  820. [[netWorkManager shareInstance] CommonGetWithCallBackCode:queryShareReportMarkFun Parameters:paraDict success:^(id _Nonnull responseObject){
  821. queryShareReportMarkModel *ShareMarkMod = [[queryShareReportMarkModel alloc] initWithDictionary:responseObject error:nil];
  822. if(ShareMarkMod){
  823. [weakSelf.NASCommonUsedV setRedPointShow:ShareMarkMod.data.reportMark];
  824. }
  825. } failure:^(NSError * _Nonnull error) {
  826. }];
  827. }
  828. #pragma mark 修改分享被封禁的mark状态()
  829. -(void)updateShareBeMarkFun
  830. {
  831. NSMutableDictionary *paraDict = [NSMutableDictionary new];
  832. //KWeakSelf
  833. [[netWorkManager shareInstance] CommonPostCallBackCode:updateShareReportMarkFun Parameters:paraDict success:^(id _Nonnull responseObject){
  834. // SuperModel *ShareMarkMod = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  835. // if(ShareMarkMod){
  836. //
  837. // }
  838. } failure:^(NSError * _Nonnull error) {
  839. }];
  840. }
  841. #pragma mark 处理音频播放中的视图状态
  842. - (void)handelAudioPlayingViewFun
  843. {
  844. audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
  845. if([DFPlayer sharedPlayer].state == DFPlayerStateBuffering
  846. ||[DFPlayer sharedPlayer].state == DFPlayerStatePlaying
  847. ||[DFPlayer sharedPlayer].state == DFPlayerStatePause){//播放中
  848. [self showAudioPlayingViewFun];
  849. }
  850. else{
  851. [self hideAudioPlayingViewFun];
  852. }
  853. KWeakSelf
  854. audioPlayingV.didClickButtonFun = ^(NSInteger tag) {
  855. if(tag == 1){
  856. [weakSelf hideAudioPlayingViewFun];
  857. }
  858. else if(tag == 5){
  859. [weakSelf AudioPlayingGotoAudioPlayerVCFun];
  860. }
  861. };
  862. }
  863. - (void)AudioPlayingGotoAudioPlayerVCFun{
  864. audioPlayerViewController *vc = [audioPlayerViewController new];
  865. vc.isfirstEnterType = NO;
  866. [self.navigationController pushViewController:vc animated:YES];
  867. }
  868. #pragma mark 显示音频播放中的视图
  869. - (void)showAudioPlayingViewFun
  870. {
  871. audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
  872. [self.view addSubview:audioPlayingV];
  873. if([DFPlayer sharedPlayer].state == DFPlayerStatePlaying){
  874. [audioPlayingV startRotatingImage];
  875. }
  876. else if ([DFPlayer sharedPlayer].state == DFPlayerStatePause){
  877. [audioPlayingV stopRotatingImage];
  878. }
  879. [audioPlayingV mas_makeConstraints:^(MASConstraintMaker *make) {
  880. make.height.mas_equalTo(49);
  881. make.left.mas_equalTo(0);
  882. make.right.mas_equalTo(0);
  883. make.bottom.mas_equalTo(-TABBARHEIGHT);
  884. }];
  885. [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
  886. make.left.mas_equalTo(0);
  887. make.right.mas_equalTo(0);
  888. make.top.equalTo(welcomeImageV.mas_bottom).offset(20);
  889. make.bottom.mas_equalTo(-TABBARHEIGHT -49);
  890. }];
  891. }
  892. #pragma mark 隐藏音频播放中的视图
  893. - (void)hideAudioPlayingViewFun
  894. {
  895. // audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
  896. // [audioPlayingV removeFromSuperview];
  897. [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
  898. make.left.mas_equalTo(0);
  899. make.right.mas_equalTo(0);
  900. make.top.equalTo(welcomeImageV.mas_bottom).offset(20);
  901. make.bottom.mas_equalTo(-TABBARHEIGHT);
  902. }];
  903. }
  904. - (void)applicationDidBecomeActive:(NSNotification *)notification
  905. {
  906. //[self beginShowAlertFun];
  907. //后台回来点击首页无效问题
  908. self.tableView.userInteractionEnabled = YES;
  909. [self checkBoxHeartbeatFun];
  910. }
  911. #pragma mark 检测盒子的心跳情况
  912. - (void)checkBoxHeartbeatFun
  913. {
  914. //2、点击系统升级弹框确定按钮后30分钟内不弹;
  915. NSNumber *preSecondNum = [HWDataManager getNumberWithKey:stringKeyAddSn(@"disenable_type1_BoxHeartbeat")];
  916. if(preSecondNum){
  917. long seconds = [iTools getNowTimeStamp];
  918. if(seconds - preSecondNum.longValue <= 60*30){
  919. return;
  920. }
  921. }
  922. //3、重启、恢复出厂设备、首次设置密码 3个情况下8分钟之内不弹
  923. NSNumber *preSecondNum2 = [HWDataManager getNumberWithKey:stringKeyAddSn(@"disenable_type2_BoxHeartbeat")];
  924. if(preSecondNum2){
  925. long seconds = [iTools getNowTimeStamp];
  926. if(seconds - preSecondNum2.longValue <= 60*8){
  927. return;
  928. }
  929. }
  930. if(ksharedAppDelegate.didShowBoxHeartbeatAlertType
  931. ||[webRtcManager shareManager].isResetingType
  932. ||[webRtcManager shareManager].isRebootIngType
  933. || [ksharedAppDelegate didShowImageRenewViewFun]){
  934. return;
  935. }
  936. //1.隐私模式密码界面 3秒检测一次是否输入完成密码了
  937. if(ksharedAppDelegate.isDidShowPwdType){
  938. KWeakSelf
  939. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  940. [weakSelf checkBoxHeartbeatFun];
  941. });
  942. return;
  943. }
  944. //test code
  945. // [[BoxHeartbeatAlertTool shareInstance] showBoxHeartbeatAlertFun:2 didClickBut:^(NSInteger tag) {
  946. //
  947. // }];
  948. if(ksharedAppDelegate.isWebSockLinkOKAginType && ksharedAppDelegate.cloudPhoneExtraFileListMod){
  949. return;
  950. }
  951. NSMutableDictionary *paraDict = [NSMutableDictionary new];
  952. KWeakSelf
  953. [[netWorkManager shareInstance] CommonGetWithCallBackCode:queryHeartbeat Parameters:paraDict success:^(id _Nonnull responseObject){
  954. queryHeartbeatModel *heartbeatMod = [[queryHeartbeatModel alloc] initWithDictionary:responseObject error:nil];
  955. if(heartbeatMod && heartbeatMod.data){
  956. [weakSelf checkBoxHeartbeatToShowPopViewFunBy:heartbeatMod];
  957. }
  958. } failure:^(NSError * _Nonnull error) {
  959. }];
  960. }
  961. #pragma mark 根据盒子的心跳情况 显示异常谈了
  962. - (void)checkBoxHeartbeatToShowPopViewFunBy:(queryHeartbeatModel*)heartbeatMod
  963. {
  964. if(!heartbeatMod || !heartbeatMod.data){
  965. return;
  966. }
  967. if (//!heartbeatMod.data.frpStatus&&
  968. !heartbeatMod.data.hostAgentStatus
  969. &&!heartbeatMod.data.containerAgentStatus) {//全部异常
  970. [[BoxHeartbeatAlertTool shareInstance] showBoxHeartbeatAlertFun:1 didClickBut:^(NSInteger tag) {
  971. }];
  972. }
  973. else if (heartbeatMod.data.hostAgentStatus
  974. //&& !heartbeatMod.data.frpStatus
  975. && !heartbeatMod.data.containerAgentStatus) {//frp异常
  976. [[BoxHeartbeatAlertTool shareInstance] showBoxHeartbeatAlertFun:2 didClickBut:^(NSInteger tag) {
  977. }];
  978. }
  979. }
  980. #pragma mark 输入密码完成
  981. - (void)didInpuPwdOkFun
  982. {
  983. KWeakSelf
  984. mainBlock(^{
  985. weakSelf.tableView.userInteractionEnabled = YES;
  986. });
  987. }
  988. #pragma mark 点击了搜索
  989. - (void)gotoSearchVCFun
  990. {
  991. NasSearchViewController *vc = [NasSearchViewController new];
  992. [self pushViewController:vc animated:YES];
  993. }
  994. #pragma mark 文件上传跳转上传记录
  995. - (void)gotoUploadFileRecordByFileAppWithUrls:(NSArray*)urls
  996. {
  997. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  998. [self.navigationController pushViewController:vc animated:YES];
  999. vc.isUploadingType = YES;
  1000. [vc gotoUploadFileByFileApp:urls];
  1001. }
  1002. @end