PlayerViewController+otherDelegate.mm 24 KB

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