PlayerViewController+otherDelegate.mm 20 KB

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