NASViewController.m 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249
  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. [audioPlayingV mas_makeConstraints:^(MASConstraintMaker *make) {
  1012. make.height.mas_equalTo(49);
  1013. make.left.mas_equalTo(0);
  1014. make.right.mas_equalTo(0);
  1015. make.bottom.mas_equalTo(-TABBARHEIGHT);
  1016. }];
  1017. [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
  1018. make.left.mas_equalTo(0);
  1019. make.right.mas_equalTo(0);
  1020. make.top.equalTo(welcomeImageV.mas_bottom).offset(20);
  1021. make.bottom.mas_equalTo(-TABBARHEIGHT -49);
  1022. }];
  1023. }
  1024. #pragma mark 隐藏音频播放中的视图
  1025. - (void)hideAudioPlayingViewFun
  1026. {
  1027. // audioPlayingView * audioPlayingV = [audioPlayingView sharedInstance];
  1028. // [audioPlayingV removeFromSuperview];
  1029. [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
  1030. make.left.mas_equalTo(0);
  1031. make.right.mas_equalTo(0);
  1032. make.top.equalTo(welcomeImageV.mas_bottom).offset(20);
  1033. make.bottom.mas_equalTo(-TABBARHEIGHT);
  1034. }];
  1035. }
  1036. @end