Browse Source

1.弹框逻辑添加版本验证

huangxiaodong 3 months ago
parent
commit
3096031713

+ 108 - 102
创维盒子/code/AppDelegate/SceneDelegate.m

@@ -1868,112 +1868,118 @@
 #pragma mark 弹框流程 2 APP版本更新弹窗
 - (void)checkVersionFun
 {
-    //[self getVersion];
+    [self getVersion];
     
-    [self getLastNoticeFun];
+    //[self getLastNoticeFun];
 }
 
 #pragma mark- 网络请求
-//- (void)getVersion {
-//    
-//    //密码框界面 拦着 不给弹出
-//    if(!ksharedAppDelegate.isFirstInputPwdDone){
-//        return;
-//    }
-//    
-//    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 && model.status == 0) {
-//
-//           HWVersionModel *model = [HWVersionModel mj_objectWithKeyValues:responseObject[@"data"]];
-//           [self checkVersion:model];
-//       }
-//       else
-//       {
-//           [self checkVersion:nil];
-//       }
-//
-//    } failure:^(NSError * _Nonnull error) {
-//      HLog(@"%@", error);
-//       [self checkVersion:nil];
-//    }];
-//}
-//
-//- (void)checkVersion:(HWVersionModel*)versionModel {
-//    
-//    if(!versionModel){//版本信息错误 检测新手弹框流程
-//        [self showNewerGuideFun];
-//        return;
-//    }
-//    
-////  NSString *currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleVersion"];
-//    NSString *currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"];
-//    NSString *newVersion = [versionModel.versionNumber stringByReplacingOccurrencesOfString:@"v" withString:@""];  //去掉v
-//    newVersion = [newVersion stringByReplacingOccurrencesOfString:@"V" withString:@""];  //去掉v
-//    //HLog(@"%@---%@", newVersion, currentVersion);
-//    if ([currentVersion compare:newVersion options:NSNumericSearch] == NSOrderedSame) { // 本地版本号 == 服务器版本号
-//        [self showNewerGuideFun];
-//    }else if ([currentVersion compare:newVersion options:NSNumericSearch] == NSOrderedDescending) { // 本地版本号 > 服务器版本号 (异常情况)
-//        [HWDataManager setBoolWithKey:Const_haveVersion value:NO];
-//        [self showNewerGuideFun];
-//    }else { // 本地版本号 < 服务器版本号 (有新版本)
-//        [self showNewVersion:versionModel];
-//        [HWDataManager setBoolWithKey:Const_haveVersion value:YES];
-//    };
-//}
-//
-//- (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 showNewerGuideFun];
-//        return;
-//    }
-//    
-//    haveNewVersionView.versionModel = versionModel;
-//    haveNewVersionView.isContinueCheckAlert = NO; // 是否继续走下一步弹窗检测流程
-//    [haveNewVersionView setBackgroundColor:RGBACOLOR(0, 0, 0, 0.5)];
-//    [ksharedAppDelegate.window 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 showNewerGuideFun];
-//    };
-//}
-//
+- (void)getVersion {
+    
+    //密码框界面 拦着 不给弹出
+    if(!ksharedAppDelegate.isFirstInputPwdDone){
+        return;
+    }
+    
+    NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
+    [paraDict setValue:@"ios" forKey:@"type"];
+    [paraDict setValue:@"skyworth" forKey:@"source"];
+    [paraDict setValue:@"iPhone" forKey:@"iosType"];
+    
+    [[netWorkManager shareInstance] CommonGetWithCallBackCode:upgradeNewVersion Parameters:paraDict success:^(id  _Nonnull responseObject) {
+        //HLog(@"%@", responseObject);
+
+      SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
+
+       if (model && model.status == 0) {
+
+           HWVersionModel *model = [HWVersionModel mj_objectWithKeyValues:responseObject[@"data"]];
+           [self checkVersion:model];
+       }
+       else
+       {
+           [self checkVersion:nil];
+       }
+
+    } failure:^(NSError * _Nonnull error) {
+      HLog(@"%@", error);
+       [self checkVersion:nil];
+    }];
+}
+
+- (void)checkVersion:(HWVersionModel*)versionModel {
+    
+    if(!versionModel){//版本信息错误 检测新手弹框流程
+        //[self showNewerGuideFun];
+        [self getLastNoticeFun];
+        return;
+    }
+    
+//  NSString *currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleVersion"];
+    NSString *currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"];
+    NSString *newVersion = [versionModel.versionNumber stringByReplacingOccurrencesOfString:@"v" withString:@""];  //去掉v
+    newVersion = [newVersion stringByReplacingOccurrencesOfString:@"V" withString:@""];  //去掉v
+    //HLog(@"%@---%@", newVersion, currentVersion);
+    if ([currentVersion compare:newVersion options:NSNumericSearch] == NSOrderedSame) { // 本地版本号 == 服务器版本号
+        //[self showNewerGuideFun];
+        [self getLastNoticeFun];
+    }else if ([currentVersion compare:newVersion options:NSNumericSearch] == NSOrderedDescending) { // 本地版本号 > 服务器版本号 (异常情况)
+        [HWDataManager setBoolWithKey:Const_haveVersion value:NO];
+        //[self showNewerGuideFun];
+        [self getLastNoticeFun];
+    }else { // 本地版本号 < 服务器版本号 (有新版本)
+        [self showNewVersion:versionModel];
+        [HWDataManager setBoolWithKey:Const_haveVersion value:YES];
+    };
+}
+
+- (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 showNewerGuideFun];
+        [self getLastNoticeFun];
+        return;
+    }
+    
+    haveNewVersionView.versionModel = versionModel;
+    haveNewVersionView.isContinueCheckAlert = NO; // 是否继续走下一步弹窗检测流程
+    [haveNewVersionView setBackgroundColor:RGBACOLOR(0, 0, 0, 0.5)];
+    [ksharedAppDelegate.window 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 showNewerGuideFun];
+        [weakSelf getLastNoticeFun];
+    };
+}
+
 //#pragma mark 弹框流程 3 新手引导弹窗
 //- (void)showNewerGuideFun
 //{

+ 6 - 3
创维盒子/code/Class/Set/appUpdate/AboutViewController.m

@@ -146,8 +146,9 @@
     _msgTitleArr = @[NSLocalizedString(@"app_update_use_deal",nil)
                           ,NSLocalizedString(@"app_update_private",nil)
                           ,NSLocalizedString(@"app_version_current",nil)
-                          ,NSLocalizedString(@"system_version_current",nil)
-                          ,NSLocalizedString(@"asystem_version_wait_update",nil)];
+                          //,NSLocalizedString(@"system_version_current",nil)
+                          //,NSLocalizedString(@"asystem_version_wait_update",nil)
+    ];
     
  
     [self.view addSubview:self.tableView];
@@ -157,7 +158,8 @@
         make.right.mas_equalTo(-15.f);
         //make.top.equalTo(_checUpdatekBtn.mas_bottom).offset(25.f);
         make.top.equalTo(_checUpdatekBtn.mas_top).offset(15.f);
-        make.height.mas_equalTo(240.f);
+        //make.height.mas_equalTo(240.f);
+        make.height.mas_equalTo(160.f);
     }];
     
 //    UIButton *privateBtn = [UIButton buttonWithType:UIButtonTypeCustom];
@@ -336,6 +338,7 @@
     NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
     [paraDict setValue:@"ios" forKey:@"type"];
     [paraDict setValue:@"skyworth" forKey:@"source"];
+    [paraDict setValue:@"iPhone" forKey:@"iosType"];
     
     [[netWorkManager shareInstance] CommonGetWithCallBackCode:upgradeNewVersion Parameters:paraDict success:^(id  _Nonnull responseObject) {
         HLog(@"%@", responseObject);

+ 2 - 2
创维盒子/双子星云手机.xcodeproj/project.pbxproj

@@ -6133,7 +6133,7 @@
 					"$(PROJECT_DIR)/code/Vendor/UDP/RayProxy",
 					"$(PROJECT_DIR)/RayProxy",
 				);
-				MARKETING_VERSION = 1.4.4;
+				MARKETING_VERSION = 1.0.0;
 				PRODUCT_BUNDLE_IDENTIFIER = com.armcloud.privacy.x.box;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";
@@ -6212,7 +6212,7 @@
 					"$(PROJECT_DIR)/code/Vendor/UDP/RayProxy",
 					"$(PROJECT_DIR)/RayProxy",
 				);
-				MARKETING_VERSION = 1.4.4;
+				MARKETING_VERSION = 1.0.0;
 				PRODUCT_BUNDLE_IDENTIFIER = com.armcloud.privacy.x.box;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";