|
@@ -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
|
|
|
//{
|