PlayerViewController+otherDelegate.mm 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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 "downloadManager.h"
  18. #import "uploadFileManager.h"
  19. #import "cloudPhoneExtraFileListModel.h"
  20. #import "AppDelegate.h"
  21. #import "cachesFileManager.h"
  22. #import "extraMediaEventModel.h"
  23. #import "USBInsertPopView.h"
  24. #import "commandSendCheckModel.h"
  25. @implementation PlayerViewController (otherDelegate)
  26. #pragma mark ComontAlretViewControllerDelegate
  27. - (void)CommonAlertokBtnClickPressed{
  28. //HLog("11111");
  29. // if(self->logoutAlertVC){
  30. // self->logoutAlertVC = nil;
  31. // }
  32. self.isLoginAgainType = YES;
  33. [[NSNotificationCenter defaultCenter] postNotificationName:lockBypwdNotification object:nil];
  34. }
  35. - (void)CommonAlertCancelBtnClickPressed{
  36. HLog("强制退出app");
  37. exit(0);/*强制退出app*/
  38. }
  39. - (void)checkVersionFun
  40. {
  41. [self getVersion];
  42. }
  43. #pragma mark- 网络请求
  44. - (void)getVersion {
  45. NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
  46. [paraDict setValue:@"ios" forKey:@"type"];
  47. [paraDict setValue:@"skyworth" forKey:@"source"];
  48. [[netWorkManager shareInstance] CommonGetWithCallBackCode:upgradeNewVersion Parameters:paraDict success:^(id _Nonnull responseObject) {
  49. //HLog(@"%@", responseObject);
  50. SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  51. if (model.status == 0) {
  52. HWVersionModel *model = [HWVersionModel mj_objectWithKeyValues:responseObject[@"data"]];
  53. [self checkVersion:model];
  54. }
  55. else
  56. {
  57. //[[iToast makeText:model.msg] show];
  58. }
  59. } failure:^(NSError * _Nonnull error) {
  60. HLog(@"%@", error);
  61. }];
  62. }
  63. - (void)checkVersion:(HWVersionModel*)versionModel {
  64. // NSString *currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleVersion"];
  65. NSString *currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"];
  66. NSString *newVersion = [versionModel.versionNumber stringByReplacingOccurrencesOfString:@"v" withString:@""]; //去掉v
  67. // HLog(@"%@---%@", newVersion, currentVersion);
  68. if ([currentVersion compare:newVersion options:NSNumericSearch] == NSOrderedSame) { // 本地版本号 == 服务器版本号
  69. [self getLastNoticeFun];
  70. }else if ([currentVersion compare:newVersion options:NSNumericSearch] == NSOrderedDescending) { // 本地版本号 > 服务器版本号 (异常情况)
  71. [HWDataManager setBoolWithKey:Const_haveVersion value:NO];
  72. [self getLastNoticeFun];
  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. //此版本点击过稍后再试
  101. NSString *preVersionstr = [HWDataManager getStringWithKey:Const_did_show_version_and_click_wait];
  102. if(preVersionstr && [versionModel.versionNumber isEqualToString:preVersionstr]){
  103. [self getLastNoticeFun];
  104. return;
  105. }
  106. haveNewVersionView.versionModel = versionModel;
  107. haveNewVersionView.isContinueCheckAlert = NO; // 是否继续走下一步弹窗检测流程
  108. [haveNewVersionView setBackgroundColor:RGBACOLOR(0, 0, 0, 0.5)];
  109. [[iTools getKeyWindow] addSubview:haveNewVersionView];
  110. haveNewVersionView.isShow = YES;
  111. if(!versionModel.necessary){
  112. haveNewVersionView.deleteBtn.hidden = NO;
  113. }
  114. [haveNewVersionView mas_makeConstraints:^(MASConstraintMaker *make) {
  115. make.top.mas_equalTo(0);
  116. make.left.mas_equalTo(0);
  117. make.right.mas_equalTo(0);
  118. make.bottom.mas_equalTo(0);
  119. }];
  120. haveNewVersionView.alpha = 0.0;
  121. [UIView animateWithDuration:0.3 delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^ {
  122. haveNewVersionView.alpha = 1.0;
  123. KyoLog(@"in animate start");
  124. } completion:^(BOOL finished) {
  125. KyoLog(@"in animate completion");
  126. }];
  127. KWeakSelf
  128. haveNewVersionView.closeViewFun = ^{
  129. [weakSelf getLastNoticeFun];
  130. };
  131. }
  132. - (void)showImageViewRenewTipViewFun
  133. {
  134. imageVersionRenewTipView * RenewTipView = [[imageVersionRenewTipView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H)];
  135. [self.view addSubview:RenewTipView];
  136. [self.view bringSubviewToFront:RenewTipView];
  137. }
  138. #pragma mark 保存截图到相册
  139. - (void)screenShotToPhoneFun
  140. {
  141. [[webSocketManager shareInstance] screenshotInCloudPhoneFun];
  142. // CIImage *processedImage = saveCIImage;
  143. // CIContext *context = [CIContext contextWithOptions:nil];
  144. // CGImageRef cgiimage = [context createCGImage:processedImage fromRect:processedImage.extent];
  145. // UIImage *image = [UIImage imageWithCGImage:cgiimage];
  146. // CGImageRelease(cgiimage);
  147. //
  148. // if(!image){
  149. // self->needScreenShotType = YES;
  150. // return;
  151. // }
  152. //
  153. // [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
  154. // //写入图片到相册
  155. // PHAssetChangeRequest *req = [PHAssetChangeRequest creationRequestForAssetFromImage:image];
  156. //
  157. // } completionHandler:^(BOOL success, NSError * _Nullable error) {
  158. // //NSLog(@"success = %d, error = %@", success, error);
  159. // if (success) {
  160. // HLog(@"已将截图图片保存至相册");
  161. //
  162. // mainBlock(^{
  163. // [[iToast makeText:@""] show];
  164. // });
  165. //
  166. // } else {
  167. // self->needScreenShotType = YES;
  168. // HLog(@"未能将截图图片保存至相册");
  169. // }
  170. // }];
  171. }
  172. - (void)saveLastImageFun
  173. {
  174. if(!saveCIImage){
  175. return;
  176. }
  177. //UIImage *image = [UIImage imageWithCIImage:saveCIImage];
  178. CIImage *processedImage = saveCIImage;
  179. CIContext *context = [CIContext contextWithOptions:nil];
  180. CGImageRef cgiimage = [context createCGImage:processedImage fromRect:processedImage.extent];
  181. UIImage *image = [UIImage imageWithCGImage:cgiimage];
  182. CGImageRelease(cgiimage);
  183. if(image){ //执行返回最后一帧
  184. NSString *filePath = kSHPath_cloudPhone_last_image;
  185. NSString *folderPath = [kSHPath_cloudPhone_last_image stringByDeletingLastPathComponent];
  186. [[NSFileManager defaultManager] removeItemAtPath:folderPath error:nil];
  187. [cachesFileManager getCreateFilePath:folderPath];
  188. NSData*imageData = UIImagePNGRepresentation(image);
  189. BOOL ret = [imageData writeToFile:filePath atomically:NO];
  190. if (ret) {
  191. }
  192. }
  193. }
  194. - (void)readLastImageFun
  195. {
  196. NSString *filePath = kSHPath_cloudPhone_last_image;
  197. UIImage *image = [UIImage imageWithContentsOfFile:filePath];
  198. if(image && !saveCIImage){
  199. [mPlayerView.showImageView setImage:image];
  200. }
  201. }
  202. - (void)getLastNoticeFun
  203. {
  204. NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
  205. [paraDict setValue:@"Private-X" forKey:@"productType"];
  206. [paraDict setValue:@"ios" forKey:@"type"];
  207. [[netWorkManager shareInstance] CommonPostCallBackCode:queryOneNotice Parameters:paraDict success:^(id _Nonnull responseObject) {
  208. noticeModel *model = [[noticeModel alloc] initWithDictionary:responseObject error:nil];
  209. //test code
  210. // model.status = 0;
  211. // model.data = [noticeDataModel new];
  212. // model.data.curNoticeId = @"1111";
  213. // model.data.title = @"版本升级通知公告";
  214. // model.data.content = @"1.偶现挤下线问题";
  215. // 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.进入设置页面读取数据偶现闪退!!!!";
  216. if (model.status == 0) {
  217. [self showHaveNoticeViewBy:model];
  218. }
  219. else
  220. {
  221. }
  222. } failure:^(NSError * _Nonnull error) {
  223. HLog(@"%@", error);
  224. }];
  225. }
  226. - (void)showHaveNoticeViewBy:(noticeModel*)model
  227. {
  228. HaveNoticeView * noticeView = [HaveNoticeView shardInstance];
  229. NSString * preShowID = [HWDataManager getStringWithKey:Const_did_show_Notice_ID];
  230. if(noticeView.isShow
  231. || !model
  232. || [preShowID isEqualToString:model.data.curNoticeId]){
  233. return;
  234. }
  235. noticeView.curNoticeModel = model;
  236. //异常处理
  237. if(![iTools getKeyWindow]){
  238. return;
  239. }
  240. [[iTools getKeyWindow] addSubview:noticeView];
  241. [noticeView mas_makeConstraints:^(MASConstraintMaker *make) {
  242. make.top.mas_equalTo(0);
  243. make.left.mas_equalTo(0);
  244. make.right.mas_equalTo(0);
  245. make.bottom.mas_equalTo(0);
  246. }];
  247. noticeView.alpha = 0.0;
  248. [UIView animateWithDuration:0.3 delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^ {
  249. noticeView.alpha = 1.0;
  250. } completion:^(BOOL finished) {
  251. }];
  252. }
  253. @end