|
@@ -11,6 +11,9 @@
|
|
|
#import "cachesFileManager.h"
|
|
|
#import "couldphoneSysInfoModel.h"
|
|
|
#import "TvStatusModel.h"
|
|
|
+#import "HWVersionModel.h"
|
|
|
+#import <MJExtension.h>
|
|
|
+#import "HaveNewVersionView.h"
|
|
|
|
|
|
@implementation PlayerViewController (otherDelegate)
|
|
|
|
|
@@ -28,6 +31,89 @@
|
|
|
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);
|
|
|
+ [[iToast makeText:@"网络异常,请稍后重试!"] show];
|
|
|
+ [self removeNewIndicatorHaveStr];
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
+- (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];
|
|
|
+ };
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+- (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];
|