123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- //
- // 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"
- @implementation PlayerViewController (otherDelegate)
- #pragma mark ComontAlretViewControllerDelegate
- - (void)CommonAlertokBtnClickPressed{
- //HLog("11111");
-
- 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) { // 本地版本号 == 服务器版本号
- }else if ([currentVersion compare:newVersion options:NSNumericSearch] == NSOrderedDescending) { // 本地版本号 > 服务器版本号 (异常情况)
- [HWDataManager setBoolWithKey:Const_haveVersion value:NO];
- }else { // 本地版本号 < 服务器版本号 (有新版本)
- [self showNewVersion:versionModel];
- [HWDataManager setBoolWithKey:Const_haveVersion value:YES];
- };
- }
- #pragma mark 需要强制重启
- - (void)updateForceStartFun{
-
-
- NSString* curSn = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.sn;
-
- 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;
- }
- 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");
- }];
- }
- - (void)getCouldPhoneBaseInfoResponseFun:(NSDictionary *)dataDict
- {
- couldPhoneBaseInfoModel *model = [[couldPhoneBaseInfoModel alloc] initWithDictionary:dataDict error:nil];
- [[NSNotificationCenter defaultCenter] postNotificationName:getCouldPhoneBaseInfoNotification object:model];
- }
- - (void)getCouldPhoneSysInfoResponseFun:(NSDictionary *)dataDict{
- couldphoneSysInfoModel *model = [[couldphoneSysInfoModel alloc] initWithDictionary:dataDict error:nil];
- [[NSNotificationCenter defaultCenter] postNotificationName:getCouldPhoneSysInfoNotification object:model];
-
- NSString * predatestr = [HWDataManager getObjectWithKey:Const_did_show_image_version_date];
-
- NSString *datestr = [iTools getNowDateString];
-
- if(predatestr && [predatestr isEqualToString:datestr]){
- return;
- }
-
- NSString *hostImgVer = model.data.data.hostImgVer;
-
- if (!hostImgVer || hostImgVer.length < 3) {
- //[self showImageViewRenewTipViewFun];
- return;
- }
-
- NSArray *versionArr = [hostImgVer componentsSeparatedByString:@"."];
-
- if(versionArr.count >= 2)
- {
- NSString * oneStr = versionArr[0];
- NSString * twoStr = versionArr[1];
-
- if(oneStr.integerValue >=1 && twoStr.integerValue >=2){
- return;
- }
- }
-
-
- [self showImageViewRenewTipViewFun];
- }
- - (void)getCouldPhoneTvStatusResponseFun:(NSDictionary *)dataDict
- {
- TvStatusModel *model = [[TvStatusModel alloc] initWithDictionary:dataDict error:nil];
- [[NSNotificationCenter defaultCenter] postNotificationName:getCouldPhoneTvStatusNotification object:model];
-
- if(![model.msg containsString:@"PushStreamBActivity"])
- {
- return;
- }
-
- UIViewController*topVc = self.navigationController.viewControllers.lastObject;
- if([topVc isKindOfClass:[PlayerViewController class]]){
- [[iToast makeText:NSLocalizedString(@"tv_p2p_ing",nil)] show];
- }
- }
- - (void)showImageViewRenewTipViewFun
- {
- imageVersionRenewTipView * RenewTipView = [[imageVersionRenewTipView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H)];
- [self.view addSubview:RenewTipView];
- [self.view bringSubviewToFront:RenewTipView];
- }
- @end
|