NASViewController.m 45 KB

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