PlayerViewController+otherDelegate.mm 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  1. //
  2. // PlayerViewController+otherDelegate.m
  3. // 隐私保护
  4. //
  5. // Created by xd h on 2023/10/13.
  6. //
  7. #import "PlayerViewController+otherDelegate.h"
  8. #import "RCCommandHelp.h"
  9. #import "couldPhoneBaseInfoModel.h"
  10. #import "cachesFileManager.h"
  11. #import "couldphoneSysInfoModel.h"
  12. #import "TvStatusModel.h"
  13. #import "HWVersionModel.h"
  14. #import <MJExtension.h>
  15. #import "HaveNewVersionView.h"
  16. #import "connectDeviceManager.h"
  17. #import "PlayerViewController+downloadFile.h"
  18. #import "PlayerViewController+downloadThumbnailImage.h"
  19. #import "downloadManager.h"
  20. #import "uploadFileManager.h"
  21. #import "cloudPhoneExtraFileListModel.h"
  22. #import "AppDelegate.h"
  23. #import "cachesFileManager.h"
  24. #import "extraMediaEventModel.h"
  25. #import "USBInsertPopView.h"
  26. #import "commandSendCheckModel.h"
  27. @implementation PlayerViewController (otherDelegate)
  28. #pragma mark ComontAlretViewControllerDelegate
  29. - (void)CommonAlertokBtnClickPressed{
  30. //HLog("11111");
  31. if(self->logoutAlertVC){
  32. self->logoutAlertVC = nil;
  33. }
  34. self.isLoginAgainType = YES;
  35. [[NSNotificationCenter defaultCenter] postNotificationName:lockBypwdNotification object:nil];
  36. }
  37. - (void)CommonAlertCancelBtnClickPressed{
  38. HLog("强制退出app");
  39. exit(0);/*强制退出app*/
  40. }
  41. - (void)checkVersionFun
  42. {
  43. [self getVersion];
  44. }
  45. #pragma mark- 网络请求
  46. - (void)getVersion {
  47. NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
  48. [paraDict setValue:@"ios" forKey:@"type"];
  49. [paraDict setValue:@"skyworth" forKey:@"source"];
  50. [[netWorkManager shareInstance] CommonGetWithCallBackCode:upgradeNewVersion Parameters:paraDict success:^(id _Nonnull responseObject) {
  51. //HLog(@"%@", responseObject);
  52. SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  53. if (model.status == 0) {
  54. HWVersionModel *model = [HWVersionModel mj_objectWithKeyValues:responseObject[@"data"]];
  55. [self checkVersion:model];
  56. }
  57. else
  58. {
  59. //[[iToast makeText:model.msg] show];
  60. }
  61. } failure:^(NSError * _Nonnull error) {
  62. HLog(@"%@", error);
  63. }];
  64. }
  65. - (void)checkVersion:(HWVersionModel*)versionModel {
  66. // NSString *currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleVersion"];
  67. NSString *currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"];
  68. NSString *newVersion = [versionModel.versionNumber stringByReplacingOccurrencesOfString:@"v" withString:@""]; //去掉v
  69. // HLog(@"%@---%@", newVersion, currentVersion);
  70. if ([currentVersion compare:newVersion options:NSNumericSearch] == NSOrderedSame) { // 本地版本号 == 服务器版本号
  71. [self getLastNoticeFun];
  72. }else if ([currentVersion compare:newVersion options:NSNumericSearch] == NSOrderedDescending) { // 本地版本号 > 服务器版本号 (异常情况)
  73. [HWDataManager setBoolWithKey:Const_haveVersion value:NO];
  74. [self getLastNoticeFun];
  75. }else { // 本地版本号 < 服务器版本号 (有新版本)
  76. [self showNewVersion:versionModel];
  77. [HWDataManager setBoolWithKey:Const_haveVersion value:YES];
  78. };
  79. }
  80. #pragma mark 需要强制重启
  81. - (void)updateForceStartFun{
  82. NSString* curSn = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.changeSn;
  83. NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
  84. [paraDict setValue:curSn forKey:@"sn"];
  85. [paraDict setValue:[NSNumber numberWithBool:YES] forKey:@"isForceStart"];
  86. [[netWorkManager shareInstance] CommonPostCallBackCode:updateForceStart Parameters:paraDict success:^(id _Nonnull responseObject) {
  87. SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  88. if (model.status == 0) {
  89. }
  90. else
  91. {
  92. }
  93. } failure:^(NSError * _Nonnull error) {
  94. HLog(@"%@", error);
  95. }];
  96. }
  97. - (void)showNewVersion:(HWVersionModel*)versionModel {
  98. HaveNewVersionView *haveNewVersionView = [HaveNewVersionView shardInstance];
  99. if (haveNewVersionView.isShow) {
  100. return;
  101. }
  102. haveNewVersionView.versionModel = versionModel;
  103. haveNewVersionView.isContinueCheckAlert = NO; // 是否继续走下一步弹窗检测流程
  104. [haveNewVersionView setBackgroundColor:RGBACOLOR(0, 0, 0, 0.5)];
  105. [[iTools getKeyWindow] addSubview:haveNewVersionView];
  106. haveNewVersionView.isShow = YES;
  107. if(!versionModel.necessary){
  108. haveNewVersionView.deleteBtn.hidden = NO;
  109. }
  110. [haveNewVersionView mas_makeConstraints:^(MASConstraintMaker *make) {
  111. make.top.mas_equalTo(0);
  112. make.left.mas_equalTo(0);
  113. make.right.mas_equalTo(0);
  114. make.bottom.mas_equalTo(0);
  115. }];
  116. haveNewVersionView.alpha = 0.0;
  117. [UIView animateWithDuration:0.3 delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^ {
  118. haveNewVersionView.alpha = 1.0;
  119. KyoLog(@"in animate start");
  120. } completion:^(BOOL finished) {
  121. KyoLog(@"in animate completion");
  122. }];
  123. KWeakSelf
  124. haveNewVersionView.closeViewFun = ^{
  125. [weakSelf getLastNoticeFun];
  126. };
  127. }
  128. - (void)getCouldPhoneBaseInfoResponseFun:(NSDictionary *)dataDict
  129. {
  130. couldPhoneBaseInfoModel *model = [[couldPhoneBaseInfoModel alloc] initWithDictionary:dataDict error:nil];
  131. [[NSNotificationCenter defaultCenter] postNotificationName:getCouldPhoneBaseInfoNotification object:model];
  132. }
  133. - (void)getCouldPhoneSysInfoResponseFun:(NSDictionary *)dataDict{
  134. couldphoneSysInfoModel *model = [[couldphoneSysInfoModel alloc] initWithDictionary:dataDict error:nil];
  135. [[NSNotificationCenter defaultCenter] postNotificationName:getCouldPhoneSysInfoNotification object:model];
  136. // NSString * predatestr = [HWDataManager getObjectWithKey:Const_did_show_image_version_date];
  137. //
  138. // NSString *datestr = [iTools getNowDateString];
  139. //
  140. // if(predatestr && [predatestr isEqualToString:datestr]){
  141. // return;
  142. // }
  143. NSString *hostImgVer = model.data.data.hostImgVer;
  144. NSString *MyNewVersion = model.data.data.MyNewVersion;
  145. //test code
  146. // hostImgVer = @"1.2.3";
  147. // MyNewVersion = @"1.2.0";
  148. //判断当前版本号 待更新版本
  149. if (!hostImgVer || hostImgVer.length < 3
  150. ||!MyNewVersion || MyNewVersion.length < 3) {
  151. //[self showImageViewRenewTipViewFun];
  152. return;
  153. }
  154. NSArray *versionArr = [hostImgVer componentsSeparatedByString:@"."];
  155. NSArray *MyNewVersionArr = [MyNewVersion componentsSeparatedByString:@"."];
  156. NSInteger versionArrCount = versionArr.count;
  157. NSInteger MyNewVersionArrCount = MyNewVersionArr.count;
  158. NSInteger maxCount = versionArrCount < MyNewVersionArrCount ? versionArrCount:MyNewVersionArrCount;
  159. BOOL isNeedShowType = NO;
  160. //判断是否要更新镜像框
  161. if(maxCount > 0){
  162. for (int i=0; i<maxCount; i++) {
  163. NSString * numberStr1 = versionArr[i];
  164. NSString * numberStr2 = MyNewVersionArr[i];
  165. if(numberStr2.intValue > numberStr1.intValue){
  166. isNeedShowType =YES;
  167. break;
  168. }
  169. }
  170. }
  171. if(isNeedShowType){
  172. [self showImageViewRenewTipViewFun];
  173. }
  174. //是否禁用文件传输 (1.3以及以上的镜像可以使用文件传输)
  175. if(versionArr.count >= 3)
  176. {
  177. NSString * oneStr = versionArr[0];
  178. NSString * twoStr = versionArr[1];
  179. NSString * threeStr = versionArr[2];
  180. if(oneStr.integerValue <=1 && twoStr.integerValue <=3 && threeStr.integerValue <=0){//禁用
  181. ksharedAppDelegate.DisabledFileTransferType = YES;
  182. if(MyNewVersionArr.count >= 3)
  183. {
  184. NSString * newOneStr = MyNewVersionArr[0];
  185. NSString * newTwoStr = MyNewVersionArr[1];
  186. NSString * newThreeStr = MyNewVersionArr[2];
  187. if(newOneStr.integerValue >=1 && newTwoStr.integerValue >=3 && newThreeStr.integerValue >= 1){
  188. ksharedAppDelegate.isImageNewFor130 = YES;
  189. }
  190. else{
  191. ksharedAppDelegate.isImageNewFor130 = NO;
  192. }
  193. }
  194. }
  195. else{
  196. ksharedAppDelegate.DisabledFileTransferType = NO;
  197. }
  198. }
  199. }
  200. - (void)getCouldPhoneTvStatusResponseFun:(NSDictionary *)dataDict
  201. {
  202. TvStatusModel *model = [[TvStatusModel alloc] initWithDictionary:dataDict error:nil];
  203. [[NSNotificationCenter defaultCenter] postNotificationName:getCouldPhoneTvStatusNotification object:model];
  204. if(![model.msg containsString:@"PushStreamBActivity"])
  205. {
  206. return;
  207. }
  208. UIViewController*topVc = self.navigationController.viewControllers.lastObject;
  209. if([topVc isKindOfClass:[PlayerViewController class]]){
  210. [[iToast makeText:NSLocalizedString(@"tv_p2p_ing",nil)] show];
  211. }
  212. }
  213. - (void)showImageViewRenewTipViewFun
  214. {
  215. imageVersionRenewTipView * RenewTipView = [[imageVersionRenewTipView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H)];
  216. [self.view addSubview:RenewTipView];
  217. [self.view bringSubviewToFront:RenewTipView];
  218. }
  219. - (void)createFolderBeginNotFun:(NSNotification *)notification
  220. {
  221. NSString *folderName = [notification object];
  222. if(folderName && folderName.length >0){
  223. NSString * commandStr = [RCCommandHelp applyForCreateFolderwithFolderName:folderName];
  224. [self.commandChannelManager rc_sendData:commandStr];
  225. }
  226. }
  227. - (void)createFolderResponseFun:(NSDictionary *)dataDict
  228. {
  229. couldPhoneCommonModel *model = [[couldPhoneCommonModel alloc] initWithDictionary:dataDict error:nil];
  230. if(model){
  231. NSNumber *curNum = [NSNumber numberWithInteger:model.status];
  232. [[NSNotificationCenter defaultCenter] postNotificationName:createFolderDoneNotification object:curNum];/*发送通知*/
  233. }
  234. }
  235. - (void)getFolderListBeginNotFun:(NSNotification *)notification
  236. {
  237. NSString * commandStr = [RCCommandHelp getCreateFolderList];
  238. [self.commandChannelManager rc_sendData:commandStr];
  239. }
  240. - (void)getFolderListResponseFun:(NSDictionary *)dataDict
  241. {
  242. [[NSNotificationCenter defaultCenter] postNotificationName:getFolderListDoneNotification object:dataDict];/*发送通知*/
  243. }
  244. - (void)searchFileListBeginFun:(NSNotification *)notification
  245. {
  246. NSMutableDictionary *objectDict = [notification object];
  247. NSNumber *curNum = @1;
  248. if ([[objectDict allKeys] containsObject:@"type"]) {
  249. curNum = [objectDict objectForKey:@"type"];
  250. }
  251. NSString *pathStr = @"";
  252. if ([[objectDict allKeys] containsObject:@"path"]) {
  253. pathStr = [objectDict objectForKey:@"path"];
  254. }
  255. NSString *fileType = @"video";
  256. if(curNum.boolValue)
  257. {
  258. fileType = @"jpg";
  259. }
  260. NSString * commandStr = [RCCommandHelp searchCouldPhoneFilewithType:fileType withPath:pathStr];
  261. [self.commandChannelManager rc_sendData:commandStr];
  262. }
  263. - (void)searchFileListResponseFun:(NSDictionary *)dataDict
  264. {
  265. [[NSNotificationCenter defaultCenter] postNotificationName:searchFileListDoneNotification object:dataDict];/*发送通知*/
  266. }
  267. // NSData转int
  268. - (int)data2Int:(NSData *)data{
  269. Byte *byte = (Byte *)[data bytes];
  270. // 有大小端模式问题?
  271. return (byte[0] << 24) + (byte[1] << 16) + (byte[2] << 8) + (byte[3]);
  272. }
  273. - (void)handleDownloadResponseFunBy:(id)message
  274. {
  275. NSData *curData = (NSData *)message;
  276. // if(curData.length < 20){
  277. // return;
  278. // }
  279. //head
  280. NSData *headData = [curData subdataWithRange:NSMakeRange(0, 1)];
  281. char head = 0;//104;
  282. [headData getBytes:&head length:sizeof(head)];
  283. //HLog(@"head: %d",head);
  284. //msgType 0x11(17)
  285. NSData *msgTypeData = [curData subdataWithRange:NSMakeRange(1, 1)];
  286. char msgType = 0;
  287. [msgTypeData getBytes:&msgType length:sizeof(msgType)];
  288. HLog(@"msgType: %d",msgType);
  289. //taskId 6位字符串
  290. NSData *taskIdData = [curData subdataWithRange:NSMakeRange(2, 6)];
  291. NSString* taskIdStr = [[NSString alloc] initWithData:taskIdData encoding:NSUTF8StringEncoding];;
  292. HLog(@"taskId: %@",taskIdStr);
  293. if(curData.length <= 15){
  294. HLog(@"消息长度不对不处理");
  295. return;
  296. }
  297. //datalen
  298. NSData *datalenData = [curData subdataWithRange:NSMakeRange(8, 4)];
  299. int datalen = [self data2Int:datalenData];
  300. //HLog(@"datalen: %d",datalen);
  301. //curNum
  302. NSData *curNumData = [curData subdataWithRange:NSMakeRange(12, 4)];
  303. int curNum = [self data2Int:curNumData];;
  304. //HLog(@"curNum: %d",curNum);
  305. //totalNum
  306. NSData *totalNumData = [curData subdataWithRange:NSMakeRange(16, 4)];
  307. int totalNum = [self data2Int:totalNumData];
  308. //HLog(@"totalNum: %d",totalNum);
  309. BOOL isDownloadDone = curNum == totalNum ? YES : NO;
  310. HLog(@"taskUid:%@ curNum:%d totalNum: %d datalen:%d isDownloadDone:%d",taskIdStr,curNum,totalNum,datalen -8,isDownloadDone);
  311. if(curData.length <= 23){
  312. //data 的位置 装 成功或者失败
  313. NSData *failTypeData = [curData subdataWithRange:NSMakeRange(20, 1)];
  314. //0xcc (204)失败 0xcd (205)文件不存在 0xdd (221)完成 0xbb 187 完成
  315. __block Byte failType;
  316. [failTypeData getBytes:&failType length:sizeof(failType)];
  317. if(taskIdStr && [taskIdStr isEqualToString:self.downloadFileTaskUid]){
  318. if(failType == 0xcc || failType == 0xcf){
  319. [[downloadManager shareInstance] DownloadFileFailOneFileFun];
  320. }
  321. else if(failType == 0xcd ){
  322. [[downloadManager shareInstance] suspendDownloadFileFun:YES withModel:nil];
  323. NSString *tipStr = NSLocalizedString(@"disk_not_find_tip",nil);
  324. mainBlock(^{
  325. [[iToast makeText:tipStr] show];
  326. });
  327. }
  328. else if(failType == 0xdd || failType == 0xbb){
  329. [self downloadFileFunServiceResponseFun:[NSData new] with:YES];
  330. }
  331. else{
  332. HLog(@"下载数据未知错误");
  333. [[downloadManager shareInstance] DownloadFileFailOneFileFun];
  334. }
  335. }
  336. return;
  337. }
  338. if(curData.length <= (20 + datalen - 8)){
  339. HLog(@"下载数据解析出错了");
  340. return;
  341. }
  342. NSData *fileData = [curData subdataWithRange:NSMakeRange(20, datalen-8)];
  343. if([taskIdStr isEqualToString:self.downloadFileTaskUid]){
  344. [self downloadFileFunServiceResponseFun:fileData with:NO];
  345. }
  346. else if ([taskIdStr isEqualToString:self.downloadThumbnailTaskUid]){
  347. [self downloadThumbnailFileFunServiceResponseFun:fileData with:YES];
  348. }
  349. }
  350. - (void)checkAllTaskFun
  351. {
  352. if([self.commandChannelManager rc_socketStatus] == RCSocketCloudPhoneStatusConnected
  353. ||[self.commandChannelManager rc_socketStatus] == RCSocketCloudPhoneStatusReceived){
  354. HLog(@"WebSocket 链接正常");
  355. }
  356. else{
  357. HLog(@"WebSocket 链接异常:%ld",[self.commandChannelManager rc_socketStatus]);
  358. return;
  359. }
  360. //处理相册备份
  361. [[backupsFileManager shareInstance] checkReBackupsFileFun];
  362. [[uploadFileManager shareInstance] checkReUploadFileFun];
  363. [[downloadManager shareInstance] checkReDownloadFileFun];
  364. [[downloadThumbnailManager shareInstance] checkReDownloadThumbnailFileFun];
  365. [self checkCommandSendTaskFun];
  366. if([AudioSessionObject shareManager].isBackgroundType){
  367. [self checkFileTransfeTaskFun];
  368. }
  369. HLog(@"checkAllTaskFun");
  370. }
  371. //检测是否正在进行的文件传输任务
  372. - (void)checkFileTransfeTaskFun
  373. {
  374. BOOL isBackupsingType = [[backupsFileManager shareInstance] checkBackupsingFun];
  375. BOOL isUploadingType = [[uploadFileManager shareInstance] checkUploadingFun];
  376. BOOL isDownloadingType = [[downloadManager shareInstance] checkDownloadingFun];
  377. BOOL isBackground = [HWDataManager getBoolWithKey:stringKeyAddSn(Const_file_Transfe_working_background)];
  378. if ((isBackupsingType || isUploadingType || isDownloadingType) && isBackground) {
  379. HLog(@"后台保活中");
  380. [cachesFileManager writeLogsWithMsg:@"Background working"];
  381. }
  382. else{
  383. HLog(@"停止后台保活");
  384. [cachesFileManager writeLogsWithMsg:@"stop Background working"];
  385. [[AudioSessionObject shareManager] stopBackgroundActiveFun];
  386. }
  387. }
  388. -(void)addCommandSendTaskFunWithType:(NSString*)type WithCommandStr:(NSString*)commandStr
  389. {
  390. if(!commandSendCheckArr){
  391. commandSendCheckArr = [NSMutableArray new];
  392. }
  393. BOOL didAddType = NO;
  394. for (commandSendCheckModel *model in commandSendCheckArr) {
  395. if([model.type isEqualToString:type]){
  396. didAddType = YES;
  397. model.reSendNum = 0;
  398. model.sendTimerStamp = [iTools getNowTimeStamp];
  399. break;
  400. }
  401. }
  402. if(!didAddType){
  403. commandSendCheckModel *model = [commandSendCheckModel new];
  404. model.commandStr = commandStr;
  405. model.type = type;
  406. model.reSendNum = 0;
  407. model.sendTimerStamp = [iTools getNowTimeStamp];
  408. [commandSendCheckArr addObject:model];
  409. }
  410. }
  411. -(void)checkCommandSendTaskFun
  412. {
  413. if(commandSendCheckArr && commandSendCheckArr.count >0){
  414. for (commandSendCheckModel *model in commandSendCheckArr) {
  415. if(model.reSendNum < 3){
  416. model.reSendNum ++;
  417. if(model.commandStr){
  418. [self send_data:model.commandStr];
  419. HLog(@"\n\n\n任务重发 重发次数:%ld 指令:%@\n\n\n",model.reSendNum,model.commandStr);
  420. }
  421. // if([model.type isEqualToString:@"offline_notification"]){
  422. // model.reSendNum = 1;//只要不收到
  423. // }
  424. }
  425. }
  426. }
  427. }
  428. -(void)deleteCommandSendTaskFunWith:(NSString*)type
  429. {
  430. if(commandSendCheckArr && commandSendCheckArr.count >0){
  431. NSArray *taskArr = [NSArray arrayWithArray:commandSendCheckArr];
  432. for (commandSendCheckModel *model in taskArr) {
  433. if([type isEqualToString:model.type]){
  434. [commandSendCheckArr removeObject:model];
  435. }
  436. }
  437. }
  438. }
  439. - (void)getExtraFilesResponseFun:(NSDictionary *)dataDict
  440. {
  441. cloudPhoneExtraFileListModel *model = [[cloudPhoneExtraFileListModel alloc] initWithDictionary:dataDict error:nil];
  442. ksharedAppDelegate.cloudPhoneExtraFileListMod = model;
  443. }
  444. - (void)saveLastImageFun
  445. {
  446. UIImage *image = [UIImage imageWithCIImage:saveCIImage];
  447. if(image){ //执行返回最后一帧
  448. //[mPlayerView.showImageView setImage:image];
  449. NSString *filePath = kSHPath_cloudPhone_last_image;
  450. NSString *folderPath = [kSHPath_cloudPhone_last_image stringByDeletingLastPathComponent];
  451. [[NSFileManager defaultManager] removeItemAtPath:folderPath error:nil];
  452. [cachesFileManager getCreateFilePath:folderPath];
  453. NSData*imageData = UIImagePNGRepresentation(image);
  454. BOOL ret = [imageData writeToFile:filePath atomically:NO];
  455. if (ret) {
  456. }
  457. }
  458. }
  459. - (void)readLastImageFun
  460. {
  461. NSString *filePath = kSHPath_cloudPhone_last_image;
  462. UIImage *image = [UIImage imageWithContentsOfFile:filePath];
  463. if(image && !saveCIImage){
  464. [mPlayerView.showImageView setImage:image];
  465. }
  466. }
  467. - (void)getExtraMediaEventResponseFun:(NSDictionary *)dataDict
  468. {
  469. extraMediaEventModel *model = [[extraMediaEventModel alloc] initWithDictionary:dataDict error:nil];
  470. NSString *tip = nil;
  471. if(model.data.event == 0){
  472. tip = NSLocalizedString(@"disk_insertion_tip",nil);
  473. [self showInsertPopViewFun:model.data.name];
  474. }
  475. else if(model.data.event == 1){
  476. tip = NSLocalizedString(@"disk_extract_tip",nil);
  477. }
  478. else if(model.data.event == 2){
  479. tip = NSLocalizedString(@"disk_save_extract_tip",nil);
  480. }
  481. NSString *totalTips = [[NSString alloc] initWithFormat:@"%@%@",model.data.name,tip];
  482. mainBlock(^{
  483. [[iToast makeText:totalTips] show];
  484. });
  485. }
  486. #pragma mark 显示插入UI弹框
  487. - (void)showInsertPopViewFun:(NSString*)name
  488. {
  489. if(self->curUSBInsertPopV){
  490. [self->curUSBInsertPopV removeFromSuperview];
  491. self->curUSBInsertPopV = nil;
  492. }
  493. self->curUSBInsertPopV = [[USBInsertPopView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H) withName:name];
  494. UIViewController*lastVC = self.navigationController.viewControllers.lastObject;
  495. //[[iTools getKeyWindow] addSubview:self->curUSBInsertPopV];
  496. [lastVC.view addSubview:self->curUSBInsertPopV];
  497. }
  498. - (void)getLastNoticeFun
  499. {
  500. NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
  501. [paraDict setValue:@"Private-X" forKey:@"productType"];
  502. [paraDict setValue:@"ios" forKey:@"type"];
  503. [[netWorkManager shareInstance] CommonPostCallBackCode:queryOneNotice Parameters:paraDict success:^(id _Nonnull responseObject) {
  504. noticeModel *model = [[noticeModel alloc] initWithDictionary:responseObject error:nil];
  505. //test code
  506. // model.status = 0;
  507. // model.data = [noticeDataModel new];
  508. // model.data.curNoticeId = @"1111";
  509. // model.data.title = @"版本升级通知公告";
  510. // model.data.content = @"1.偶现挤下线问题";
  511. // 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.进入设置页面读取数据偶现闪退!!!!";
  512. if (model.status == 0) {
  513. [self showHaveNoticeViewBy:model];
  514. }
  515. else
  516. {
  517. }
  518. } failure:^(NSError * _Nonnull error) {
  519. HLog(@"%@", error);
  520. }];
  521. }
  522. - (void)showHaveNoticeViewBy:(noticeModel*)model
  523. {
  524. HaveNoticeView * noticeView = [HaveNoticeView shardInstance];
  525. NSString * preShowID = [HWDataManager getStringWithKey:Const_did_show_Notice_ID];
  526. if(noticeView.isShow
  527. || !model
  528. || [preShowID isEqualToString:model.data.curNoticeId]){
  529. return;
  530. }
  531. noticeView.curNoticeModel = model;
  532. //异常处理
  533. if(![iTools getKeyWindow]){
  534. return;
  535. }
  536. [[iTools getKeyWindow] addSubview:noticeView];
  537. [noticeView mas_makeConstraints:^(MASConstraintMaker *make) {
  538. make.top.mas_equalTo(0);
  539. make.left.mas_equalTo(0);
  540. make.right.mas_equalTo(0);
  541. make.bottom.mas_equalTo(0);
  542. }];
  543. noticeView.alpha = 0.0;
  544. [UIView animateWithDuration:0.3 delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^ {
  545. noticeView.alpha = 1.0;
  546. } completion:^(BOOL finished) {
  547. }];
  548. }
  549. @end