|
@@ -1845,182 +1845,184 @@
|
|
|
#pragma mark 弹框流程 2 APP版本更新弹窗
|
|
|
- (void)checkVersionFun
|
|
|
{
|
|
|
- [self getVersion];
|
|
|
-}
|
|
|
-
|
|
|
-#pragma mark- 网络请求
|
|
|
-- (void)getVersion {
|
|
|
-
|
|
|
- //密码框界面 拦着 不给弹出
|
|
|
- if(!ksharedAppDelegate.isFirstInputPwdDone){
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
|
|
|
- [paraDict setValue:@"ios" forKey:@"type"];
|
|
|
- [paraDict setValue:@"skyworth" forKey:@"source"];
|
|
|
+ //[self getVersion];
|
|
|
|
|
|
- [[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];
|
|
|
- };
|
|
|
+ [self getLastNoticeFun];
|
|
|
}
|
|
|
|
|
|
-- (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];
|
|
|
- };
|
|
|
-}
|
|
|
-
|
|
|
-#pragma mark 弹框流程 3 新手引导弹窗
|
|
|
-- (void)showNewerGuideFun
|
|
|
-{
|
|
|
- BOOL didShow = [HWDataManager getBoolWithKey:@"Const_did_show_newer_Guide"];
|
|
|
-
|
|
|
- if(didShow){
|
|
|
- [self getLastNoticeFun];
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- //密码框界面 拦着 不给弹出
|
|
|
- if(ksharedAppDelegate.isDidShowPwdType){
|
|
|
- KWeakSelf
|
|
|
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
- [weakSelf showNewerGuideFun];
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- newerGuideView *guideView = [[newerGuideView alloc] init];
|
|
|
- [ksharedAppDelegate.window addSubview:guideView];
|
|
|
-
|
|
|
- [guideView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.top.mas_equalTo(0);
|
|
|
- make.left.mas_equalTo(0);
|
|
|
- make.right.mas_equalTo(0);
|
|
|
- make.bottom.mas_equalTo(0);
|
|
|
- }];
|
|
|
-
|
|
|
-
|
|
|
- KWeakSelf
|
|
|
- guideView.didClickButtonFun = ^(NSInteger tag) {
|
|
|
- [weakSelf didiClickNewerButtonFunBy:tag];
|
|
|
- };
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-#pragma mark 新手引导点击事件
|
|
|
-- (void)didiClickNewerButtonFunBy:(NSInteger)tag
|
|
|
-{
|
|
|
- [HWDataManager setBoolWithKey:@"Const_did_show_newer_Guide" value:YES];
|
|
|
-
|
|
|
- if(tag ==1){
|
|
|
- [self getLastNoticeFun];
|
|
|
- }
|
|
|
- else if(tag ==2 || tag == 10){
|
|
|
- CustomerWebViewController *vc = [[CustomerWebViewController alloc] init];
|
|
|
- vc.titleStr = NSLocalizedString(@"mine_newuser_title",nil);
|
|
|
-
|
|
|
- NSString *url = [[NSString alloc] initWithFormat:@"%@/warrantyService/index.html#/novice?isNovice=true",CloudService];
|
|
|
- if(tag == 10){
|
|
|
- url = [url stringByReplacingOccurrencesOfString:@"?isNovice=true" withString:@""];
|
|
|
- }
|
|
|
-
|
|
|
- vc.webUrl = url;
|
|
|
- //[self pushViewController:vc animated:YES];
|
|
|
-
|
|
|
- NSArray*curVCArr = ksharedAppDelegate.mainTabBar.viewControllers;
|
|
|
- NSInteger selectedIndex = ksharedAppDelegate.mainTabBar.selectedIndex;
|
|
|
-
|
|
|
- if(selectedIndex < curVCArr.count){
|
|
|
- UIViewController * curVC = curVCArr[selectedIndex];
|
|
|
- [curVC.navigationController pushViewController:curVC animated:YES];
|
|
|
-
|
|
|
- KWeakSelf
|
|
|
- vc.didClickBackFun = ^{
|
|
|
- [weakSelf 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];
|
|
|
+// };
|
|
|
+//}
|
|
|
+//
|
|
|
+//#pragma mark 弹框流程 3 新手引导弹窗
|
|
|
+//- (void)showNewerGuideFun
|
|
|
+//{
|
|
|
+// BOOL didShow = [HWDataManager getBoolWithKey:@"Const_did_show_newer_Guide"];
|
|
|
+//
|
|
|
+// if(didShow){
|
|
|
+// [self getLastNoticeFun];
|
|
|
+// return;
|
|
|
+// }
|
|
|
+//
|
|
|
+// //密码框界面 拦着 不给弹出
|
|
|
+// if(ksharedAppDelegate.isDidShowPwdType){
|
|
|
+// KWeakSelf
|
|
|
+// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
+// [weakSelf showNewerGuideFun];
|
|
|
+// });
|
|
|
+// return;
|
|
|
+// }
|
|
|
+//
|
|
|
+// newerGuideView *guideView = [[newerGuideView alloc] init];
|
|
|
+// [ksharedAppDelegate.window addSubview:guideView];
|
|
|
+//
|
|
|
+// [guideView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+// make.top.mas_equalTo(0);
|
|
|
+// make.left.mas_equalTo(0);
|
|
|
+// make.right.mas_equalTo(0);
|
|
|
+// make.bottom.mas_equalTo(0);
|
|
|
+// }];
|
|
|
+//
|
|
|
+//
|
|
|
+// KWeakSelf
|
|
|
+// guideView.didClickButtonFun = ^(NSInteger tag) {
|
|
|
+// [weakSelf didiClickNewerButtonFunBy:tag];
|
|
|
+// };
|
|
|
+//
|
|
|
+//}
|
|
|
+//
|
|
|
+//#pragma mark 新手引导点击事件
|
|
|
+//- (void)didiClickNewerButtonFunBy:(NSInteger)tag
|
|
|
+//{
|
|
|
+// [HWDataManager setBoolWithKey:@"Const_did_show_newer_Guide" value:YES];
|
|
|
+//
|
|
|
+// if(tag ==1){
|
|
|
+// [self getLastNoticeFun];
|
|
|
+// }
|
|
|
+// else if(tag ==2 || tag == 10){
|
|
|
+// CustomerWebViewController *vc = [[CustomerWebViewController alloc] init];
|
|
|
+// vc.titleStr = NSLocalizedString(@"mine_newuser_title",nil);
|
|
|
+//
|
|
|
+// NSString *url = [[NSString alloc] initWithFormat:@"%@/warrantyService/index.html#/novice?isNovice=true",CloudService];
|
|
|
+// if(tag == 10){
|
|
|
+// url = [url stringByReplacingOccurrencesOfString:@"?isNovice=true" withString:@""];
|
|
|
+// }
|
|
|
+//
|
|
|
+// vc.webUrl = url;
|
|
|
+// //[self pushViewController:vc animated:YES];
|
|
|
+//
|
|
|
+// NSArray*curVCArr = ksharedAppDelegate.mainTabBar.viewControllers;
|
|
|
+// NSInteger selectedIndex = ksharedAppDelegate.mainTabBar.selectedIndex;
|
|
|
+//
|
|
|
+// if(selectedIndex < curVCArr.count){
|
|
|
+// UIViewController * curVC = curVCArr[selectedIndex];
|
|
|
+// [curVC.navigationController pushViewController:curVC animated:YES];
|
|
|
+//
|
|
|
+// KWeakSelf
|
|
|
+// vc.didClickBackFun = ^{
|
|
|
+// [weakSelf getLastNoticeFun];
|
|
|
+// };
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+//}
|
|
|
|
|
|
#pragma mark 弹框流程 4 通知公告弹窗
|
|
|
- (void)getLastNoticeFun
|