NASViewController.m 44 KB

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