NASViewController.m 41 KB

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