123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317 |
- //
- // 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 <MJExtension.h>
- #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
|