PlayerViewController+otherDelegate.mm 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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. @implementation PlayerViewController (otherDelegate)
  18. #pragma mark ComontAlretViewControllerDelegate
  19. - (void)CommonAlertokBtnClickPressed{
  20. //HLog("11111");
  21. self.isLoginAgainType = YES;
  22. [[NSNotificationCenter defaultCenter] postNotificationName:lockBypwdNotification object:nil];
  23. }
  24. - (void)CommonAlertCancelBtnClickPressed{
  25. HLog("强制退出app");
  26. exit(0);/*强制退出app*/
  27. }
  28. - (void)checkVersionFun
  29. {
  30. [self getVersion];
  31. }
  32. #pragma mark- 网络请求
  33. - (void)getVersion {
  34. NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
  35. [paraDict setValue:@"ios" forKey:@"type"];
  36. [paraDict setValue:@"skyworth" forKey:@"source"];
  37. [[netWorkManager shareInstance] CommonGetWithCallBackCode:upgradeNewVersion Parameters:paraDict success:^(id _Nonnull responseObject) {
  38. //HLog(@"%@", responseObject);
  39. SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  40. if (model.status == 0) {
  41. HWVersionModel *model = [HWVersionModel mj_objectWithKeyValues:responseObject[@"data"]];
  42. [self checkVersion:model];
  43. }
  44. else
  45. {
  46. //[[iToast makeText:model.msg] show];
  47. }
  48. } failure:^(NSError * _Nonnull error) {
  49. HLog(@"%@", error);
  50. }];
  51. }
  52. - (void)checkVersion:(HWVersionModel*)versionModel {
  53. // NSString *currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleVersion"];
  54. NSString *currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"];
  55. NSString *newVersion = [versionModel.versionNumber stringByReplacingOccurrencesOfString:@"v" withString:@""]; //去掉v
  56. // HLog(@"%@---%@", newVersion, currentVersion);
  57. if ([currentVersion compare:newVersion options:NSNumericSearch] == NSOrderedSame) { // 本地版本号 == 服务器版本号
  58. }else if ([currentVersion compare:newVersion options:NSNumericSearch] == NSOrderedDescending) { // 本地版本号 > 服务器版本号 (异常情况)
  59. [HWDataManager setBoolWithKey:Const_haveVersion value:NO];
  60. }else { // 本地版本号 < 服务器版本号 (有新版本)
  61. [self showNewVersion:versionModel];
  62. [HWDataManager setBoolWithKey:Const_haveVersion value:YES];
  63. };
  64. }
  65. #pragma mark 需要强制重启
  66. - (void)updateForceStartFun{
  67. NSString* curSn = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.sn;
  68. NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
  69. [paraDict setValue:curSn forKey:@"sn"];
  70. [paraDict setValue:[NSNumber numberWithBool:YES] forKey:@"isForceStart"];
  71. [[netWorkManager shareInstance] CommonPostCallBackCode:updateForceStart Parameters:paraDict success:^(id _Nonnull responseObject) {
  72. SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  73. if (model.status == 0) {
  74. }
  75. else
  76. {
  77. }
  78. } failure:^(NSError * _Nonnull error) {
  79. HLog(@"%@", error);
  80. }];
  81. }
  82. - (void)showNewVersion:(HWVersionModel*)versionModel {
  83. HaveNewVersionView *haveNewVersionView = [HaveNewVersionView shardInstance];
  84. if (haveNewVersionView.isShow) {
  85. return;
  86. }
  87. haveNewVersionView.versionModel = versionModel;
  88. haveNewVersionView.isContinueCheckAlert = NO; // 是否继续走下一步弹窗检测流程
  89. [haveNewVersionView setBackgroundColor:RGBACOLOR(0, 0, 0, 0.5)];
  90. [[iTools getKeyWindow] addSubview:haveNewVersionView];
  91. haveNewVersionView.isShow = YES;
  92. if(!versionModel.necessary){
  93. haveNewVersionView.deleteBtn.hidden = NO;
  94. }
  95. [haveNewVersionView mas_makeConstraints:^(MASConstraintMaker *make) {
  96. make.top.mas_equalTo(0);
  97. make.left.mas_equalTo(0);
  98. make.right.mas_equalTo(0);
  99. make.bottom.mas_equalTo(0);
  100. }];
  101. haveNewVersionView.alpha = 0.0;
  102. [UIView animateWithDuration:0.3 delay:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^ {
  103. haveNewVersionView.alpha = 1.0;
  104. KyoLog(@"in animate start");
  105. } completion:^(BOOL finished) {
  106. KyoLog(@"in animate completion");
  107. }];
  108. }
  109. - (void)getCouldPhoneBaseInfoResponseFun:(NSDictionary *)dataDict
  110. {
  111. couldPhoneBaseInfoModel *model = [[couldPhoneBaseInfoModel alloc] initWithDictionary:dataDict error:nil];
  112. [[NSNotificationCenter defaultCenter] postNotificationName:getCouldPhoneBaseInfoNotification object:model];
  113. }
  114. - (void)getCouldPhoneSysInfoResponseFun:(NSDictionary *)dataDict{
  115. couldphoneSysInfoModel *model = [[couldphoneSysInfoModel alloc] initWithDictionary:dataDict error:nil];
  116. [[NSNotificationCenter defaultCenter] postNotificationName:getCouldPhoneSysInfoNotification object:model];
  117. NSString * predatestr = [HWDataManager getObjectWithKey:Const_did_show_image_version_date];
  118. NSString *datestr = [iTools getNowDateString];
  119. if(predatestr && [predatestr isEqualToString:datestr]){
  120. return;
  121. }
  122. NSString *hostImgVer = model.data.data.hostImgVer;
  123. if (!hostImgVer || hostImgVer.length < 3) {
  124. //[self showImageViewRenewTipViewFun];
  125. return;
  126. }
  127. NSArray *versionArr = [hostImgVer componentsSeparatedByString:@"."];
  128. if(versionArr.count >= 2)
  129. {
  130. NSString * oneStr = versionArr[0];
  131. NSString * twoStr = versionArr[1];
  132. if(oneStr.integerValue >=1 && twoStr.integerValue >=2){
  133. return;
  134. }
  135. }
  136. [self showImageViewRenewTipViewFun];
  137. }
  138. - (void)getCouldPhoneTvStatusResponseFun:(NSDictionary *)dataDict
  139. {
  140. TvStatusModel *model = [[TvStatusModel alloc] initWithDictionary:dataDict error:nil];
  141. [[NSNotificationCenter defaultCenter] postNotificationName:getCouldPhoneTvStatusNotification object:model];
  142. if(![model.msg containsString:@"PushStreamBActivity"])
  143. {
  144. return;
  145. }
  146. UIViewController*topVc = self.navigationController.viewControllers.lastObject;
  147. if([topVc isKindOfClass:[PlayerViewController class]]){
  148. [[iToast makeText:NSLocalizedString(@"tv_p2p_ing",nil)] show];
  149. }
  150. }
  151. - (void)showImageViewRenewTipViewFun
  152. {
  153. imageVersionRenewTipView * RenewTipView = [[imageVersionRenewTipView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H)];
  154. [self.view addSubview:RenewTipView];
  155. [self.view bringSubviewToFront:RenewTipView];
  156. }
  157. @end