// // PlayerViewController+otherDelegate.m // 隐私保护 // // Created by xd h on 2023/10/13. // #import "PlayerViewController+otherDelegate.h" #import "RCCommandHelp.h" #import "couldPhoneBaseInfoModel.h" #import "cachesFileManager.h" #import "couldphoneSysInfoModel.h" #import "TvStatusModel.h" #import "HWVersionModel.h" #import #import "HaveNewVersionView.h" #import "connectDeviceManager.h" #import "downloadManager.h" #import "uploadFileManager.h" #import "cloudPhoneExtraFileListModel.h" #import "AppDelegate.h" #import "cachesFileManager.h" #import "extraMediaEventModel.h" #import "USBInsertPopView.h" #import "commandSendCheckModel.h" @implementation PlayerViewController (otherDelegate) #pragma mark ComontAlretViewControllerDelegate - (void)CommonAlertokBtnClickPressed{ //HLog("11111"); if(self->logoutAlertVC){ self->logoutAlertVC = nil; } self.isLoginAgainType = YES; [[NSNotificationCenter defaultCenter] postNotificationName:lockBypwdNotification object:nil]; } - (void)CommonAlertCancelBtnClickPressed{ HLog("强制退出app"); exit(0);/*强制退出app*/ } - (void)checkVersionFun { [self getVersion]; } #pragma mark- 网络请求 - (void)getVersion { NSMutableDictionary *paraDict = [NSMutableDictionary dictionary]; [paraDict setValue:@"ios" forKey:@"type"]; [paraDict setValue:@"skyworth" forKey:@"source"]; [[netWorkManager shareInstance] CommonGetWithCallBackCode:upgradeNewVersion Parameters:paraDict success:^(id _Nonnull responseObject) { //HLog(@"%@", responseObject); SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil]; if (model.status == 0) { HWVersionModel *model = [HWVersionModel mj_objectWithKeyValues:responseObject[@"data"]]; [self checkVersion:model]; } else { //[[iToast makeText:model.msg] show]; } } failure:^(NSError * _Nonnull error) { HLog(@"%@", error); }]; } - (void)checkVersion:(HWVersionModel*)versionModel { // NSString *currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleVersion"]; NSString *currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"]; NSString *newVersion = [versionModel.versionNumber stringByReplacingOccurrencesOfString:@"v" withString:@""]; //去掉v // HLog(@"%@---%@", newVersion, currentVersion); if ([currentVersion compare:newVersion options:NSNumericSearch] == NSOrderedSame) { // 本地版本号 == 服务器版本号 [self getLastNoticeFun]; }else if ([currentVersion compare:newVersion options:NSNumericSearch] == NSOrderedDescending) { // 本地版本号 > 服务器版本号 (异常情况) [HWDataManager setBoolWithKey:Const_haveVersion value:NO]; [self getLastNoticeFun]; }else { // 本地版本号 < 服务器版本号 (有新版本) [self showNewVersion:versionModel]; [HWDataManager setBoolWithKey:Const_haveVersion value:YES]; }; } #pragma mark 需要强制重启 - (void)updateForceStartFun{ NSString* curSn = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.changeSn; NSMutableDictionary *paraDict = [NSMutableDictionary dictionary]; [paraDict setValue:curSn forKey:@"sn"]; [paraDict setValue:[NSNumber numberWithBool:YES] forKey:@"isForceStart"]; [[netWorkManager shareInstance] CommonPostCallBackCode:updateForceStart Parameters:paraDict success:^(id _Nonnull responseObject) { SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil]; if (model.status == 0) { } else { } } failure:^(NSError * _Nonnull error) { HLog(@"%@", error); }]; } - (void)showNewVersion:(HWVersionModel*)versionModel { HaveNewVersionView *haveNewVersionView = [HaveNewVersionView shardInstance]; if (haveNewVersionView.isShow) { return; } //此版本点击过稍后再试 NSString *preVersionstr = [HWDataManager getStringWithKey:Const_did_show_version_and_click_wait]; if(preVersionstr && [versionModel.versionNumber isEqualToString:preVersionstr]){ [self getLastNoticeFun]; return; } haveNewVersionView.versionModel = versionModel; haveNewVersionView.isContinueCheckAlert = NO; // 是否继续走下一步弹窗检测流程 [haveNewVersionView setBackgroundColor:RGBACOLOR(0, 0, 0, 0.5)]; [[iTools getKeyWindow] addSubview:haveNewVersionView]; haveNewVersionView.isShow = YES; if(!versionModel.necessary){ haveNewVersionView.deleteBtn.hidden = NO; } [haveNewVersionView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(0); make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.bottom.mas_equalTo(0); }]; haveNewVersionView.alpha = 0.0; [UIView animateWithDuration:0.3 delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^ { haveNewVersionView.alpha = 1.0; KyoLog(@"in animate start"); } completion:^(BOOL finished) { KyoLog(@"in animate completion"); }]; KWeakSelf haveNewVersionView.closeViewFun = ^{ [weakSelf getLastNoticeFun]; }; } - (void)showImageViewRenewTipViewFun { imageVersionRenewTipView * RenewTipView = [[imageVersionRenewTipView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H)]; [self.view addSubview:RenewTipView]; [self.view bringSubviewToFront:RenewTipView]; } #pragma mark 保存截图到相册 - (void)screenShotToPhoneFun { [[webSocketManager shareInstance] screenshotInCloudPhoneFun]; // CIImage *processedImage = saveCIImage; // CIContext *context = [CIContext contextWithOptions:nil]; // CGImageRef cgiimage = [context createCGImage:processedImage fromRect:processedImage.extent]; // UIImage *image = [UIImage imageWithCGImage:cgiimage]; // CGImageRelease(cgiimage); // // if(!image){ // self->needScreenShotType = YES; // return; // } // // [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{ // //写入图片到相册 // PHAssetChangeRequest *req = [PHAssetChangeRequest creationRequestForAssetFromImage:image]; // // } completionHandler:^(BOOL success, NSError * _Nullable error) { // //NSLog(@"success = %d, error = %@", success, error); // if (success) { // HLog(@"已将截图图片保存至相册"); // // mainBlock(^{ // [[iToast makeText:@""] show]; // }); // // } else { // self->needScreenShotType = YES; // HLog(@"未能将截图图片保存至相册"); // } // }]; } - (void)saveLastImageFun { if(!saveCIImage){ return; } //UIImage *image = [UIImage imageWithCIImage:saveCIImage]; CIImage *processedImage = saveCIImage; CIContext *context = [CIContext contextWithOptions:nil]; CGImageRef cgiimage = [context createCGImage:processedImage fromRect:processedImage.extent]; UIImage *image = [UIImage imageWithCGImage:cgiimage]; CGImageRelease(cgiimage); if(image){ //执行返回最后一帧 NSString *filePath = kSHPath_cloudPhone_last_image; NSString *folderPath = [kSHPath_cloudPhone_last_image stringByDeletingLastPathComponent]; [[NSFileManager defaultManager] removeItemAtPath:folderPath error:nil]; [cachesFileManager getCreateFilePath:folderPath]; NSData*imageData = UIImagePNGRepresentation(image); BOOL ret = [imageData writeToFile:filePath atomically:NO]; if (ret) { } } } - (void)readLastImageFun { NSString *filePath = kSHPath_cloudPhone_last_image; UIImage *image = [UIImage imageWithContentsOfFile:filePath]; if(image && !saveCIImage){ [mPlayerView.showImageView setImage:image]; } } - (void)getLastNoticeFun { NSMutableDictionary *paraDict = [NSMutableDictionary dictionary]; [paraDict setValue:@"Private-X" forKey:@"productType"]; [paraDict setValue:@"ios" forKey:@"type"]; [[netWorkManager shareInstance] CommonPostCallBackCode:queryOneNotice Parameters:paraDict success:^(id _Nonnull responseObject) { noticeModel *model = [[noticeModel alloc] initWithDictionary:responseObject error:nil]; //test code // model.status = 0; // model.data = [noticeDataModel new]; // model.data.curNoticeId = @"1111"; // model.data.title = @"版本升级通知公告"; // model.data.content = @"1.偶现挤下线问题"; // 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.进入设置页面读取数据偶现闪退!!!!"; if (model.status == 0) { [self showHaveNoticeViewBy:model]; } else { } } failure:^(NSError * _Nonnull error) { HLog(@"%@", error); }]; } - (void)showHaveNoticeViewBy:(noticeModel*)model { HaveNoticeView * noticeView = [HaveNoticeView shardInstance]; NSString * preShowID = [HWDataManager getStringWithKey:Const_did_show_Notice_ID]; if(noticeView.isShow || !model || [preShowID isEqualToString:model.data.curNoticeId]){ return; } noticeView.curNoticeModel = model; //异常处理 if(![iTools getKeyWindow]){ return; } [[iTools getKeyWindow] addSubview:noticeView]; [noticeView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(0); make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.bottom.mas_equalTo(0); }]; noticeView.alpha = 0.0; [UIView animateWithDuration:0.3 delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^ { noticeView.alpha = 1.0; } completion:^(BOOL finished) { }]; } @end