123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- //
- // YOUPAILCAboutVC.m
- // LiveChat
- //
- // Created by 张灿 on 2018/8/25.
- // Copyright © 2018年 caicai. All rights reserved.
- //
- #import "YOUPAILCAboutVC.h"
- #import "YOUPAILCUpdateVersionVC.h"
- #import "UIViewController+TFPresent.h"
- @interface YOUPAILCAboutVC ()
- @property (nonatomic,assign) NSInteger youpaipnumber;
- @end
- @implementation YOUPAILCAboutVC
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.title = @"关于相语欢颜";
- self.view.backgroundColor = [UIColor whiteColor];
- [self youpaifsetupView];
- }
- - (void)youpaifsetupView{
- self.youpaipnumber = 0;
-
- UIScrollView* scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, NavBarHeight+30, KScreenWidth, KScreenHeight-NavBarHeight - 60)];
- scrollView.backgroundColor = [UIColor whiteColor];
- scrollView.contentSize = CGSizeMake(KScreenWidth, KScreenHeight-NavBarHeight-60+1);
- scrollView.bounces = YES;
- scrollView.showsHorizontalScrollIndicator = NO;
- scrollView.showsVerticalScrollIndicator = NO;
- // scrollView.layer.cornerRadius = 8;
- // scrollView.layer.masksToBounds = YES;
- [self.view addSubview:scrollView];
-
- UIImageView* iconLogoView = [[UIImageView alloc]initWithFrame:CGRectMake((KScreenWidth-63)/2, 25.0f,63,63)];
- iconLogoView.image = [UIImage imageNamed:@"vqu_images_appLogo"];
- iconLogoView.contentMode = UIViewContentModeScaleAspectFill;
- iconLogoView.layer.masksToBounds = YES;
- iconLogoView.layer.cornerRadius= 8.0;
- [scrollView addSubview:iconLogoView];
-
-
- UILabel* appNameL = [[UILabel alloc]initWithFrame:CGRectMake((KScreenWidth-200)/2,CGRectGetMaxY(iconLogoView.frame) + 8.0f, 200, 22)];
- appNameL.textColor = LZ273145Color;
- appNameL.font = LCFont(20.0f);
- appNameL.textAlignment = NSTextAlignmentCenter;
- appNameL.text = @"相语欢颜";
- [scrollView addSubview:appNameL];
-
- UILabel* versionLabel = [[UILabel alloc]initWithFrame:CGRectMake((KScreenWidth-200)/2,CGRectGetMaxY(appNameL.frame) + 8.0f, 200, 12)];
- versionLabel.textColor = LZA3AABEColor;
- versionLabel.font = [UIFont systemFontOfSize:10];
- versionLabel.textAlignment = NSTextAlignmentCenter;
- versionLabel.text = [NSString stringWithFormat:@"版本%@",[[UIApplication sharedApplication] appVersion]];
- [scrollView addSubview:versionLabel];
-
-
- UIButton* protocolBtn = [[UIButton alloc]initWithFrame:CGRectMake(0,CGRectGetMaxY(versionLabel.frame) + 17.0f, KScreenWidth,70.0f)];
- protocolBtn.backgroundColor = [UIColor whiteColor];
- [protocolBtn addTarget:self action:@selector(youpaifprotocolClick) forControlEvents:(UIControlEventTouchUpInside)];
- [scrollView addSubview:protocolBtn];
-
- UILabel* btnL1 = [[UILabel alloc]initWithFrame:CGRectMake(14, 0,150, 70.0f)];
- btnL1.textColor = LZ273145Color;
- btnL1.text = @"用户协议";
- btnL1.font = LCBoldFont(14.0f);
- [protocolBtn addSubview:btnL1];
-
- UIImageView* imgV1 = [[UIImageView alloc]initWithFrame:CGRectMake(KScreenWidth-32-14-14+16, (70.0f - 14.0f) / 2.0f, 14, 14)];
- imgV1.image = [UIImage imageNamed:@"vqu_images_H_cell_arrow_gray"];
- imgV1.contentMode = UIViewContentModeScaleAspectFill;
- [protocolBtn addSubview:imgV1];
-
- UIView *line1 = [[UIView alloc] initWithFrame:CGRectMake(14,69.5,KScreenWidth-28,0.5)];
- line1.backgroundColor = LZF5F4F7Color;
- [protocolBtn addSubview:line1];
-
-
-
- UIButton* privacyBtn = [[UIButton alloc]initWithFrame:CGRectMake(0,CGRectGetMaxY(protocolBtn.frame), KScreenWidth,70.0f)];
- privacyBtn.backgroundColor = [UIColor whiteColor];
- [privacyBtn addTarget:self action:@selector(youpaifprivacyClick) forControlEvents:(UIControlEventTouchUpInside)];
- [scrollView addSubview:privacyBtn];
-
- UILabel* btnL2 = [[UILabel alloc]initWithFrame:CGRectMake(14, 0,150, 70.0f)];
- btnL2.textColor = LZ273145Color;
- btnL2.text = @"隐私保护";
- btnL2.font = LCBoldFont(14.0f);
- [privacyBtn addSubview:btnL2];
-
- UIImageView* imgV2 = [[UIImageView alloc]initWithFrame:CGRectMake(KScreenWidth-32-14-14+16, (70.0f - 14.0f) / 2.0f, 14, 14)];
- imgV2.image = [UIImage imageNamed:@"vqu_images_H_cell_arrow_gray"];
- imgV2.contentMode = UIViewContentModeScaleAspectFill;
- [privacyBtn addSubview:imgV2];
-
- UIView *line2 = [[UIView alloc] initWithFrame:CGRectMake(14,69.5,KScreenWidth-28,0.5)];
- line2.backgroundColor = LZF5F4F7Color;
- [privacyBtn addSubview:line2];
-
-
- UIButton* updataBtn = [[UIButton alloc]initWithFrame:CGRectMake(0,CGRectGetMaxY(privacyBtn.frame), KScreenWidth,70.0f)];
- updataBtn.backgroundColor = [UIColor whiteColor];
- [updataBtn addTarget:self action:@selector(youpaifupdateBtnClick:) forControlEvents:(UIControlEventTouchUpInside)];
- [scrollView addSubview:updataBtn];
-
- UILabel* btnL3 = [[UILabel alloc]initWithFrame:CGRectMake(14, 0,150, 70.0f)];
- btnL3.textColor = LZ273145Color;
- btnL3.text = @"检查版本更新";
- btnL3.font = LCBoldFont(14.0f);
- [updataBtn addSubview:btnL3];
-
- UIImageView* imgV3 = [[UIImageView alloc]initWithFrame:CGRectMake(KScreenWidth-32-14-14+16, (70.0f - 14.0f) / 2.0f, 14, 14)];
- imgV3.image = [UIImage imageNamed:@"vqu_images_H_cell_arrow_gray"];
- imgV3.contentMode = UIViewContentModeScaleAspectFill;
- [updataBtn addSubview:imgV3];
-
- // UIView *line3 = [[UIView alloc] initWithFrame:CGRectMake(14,69.5,KScreenWidth-28,0.5)];
- // line3.backgroundColor = HexColorFromRGB(0x28262D);
- // [updataBtn addSubview:line3];
-
- // UILabel* botTipLabel = [[UILabel alloc]initWithFrame:CGRectMake(KScreenWidth/2-100, KScreenHeight-NavBarHeight-40, 200, 15)];
- // botTipLabel.textColor = LCTextGray;
- // botTipLabel.font = [UIFont systemFontOfSize:11];
- // botTipLabel.textAlignment = NSTextAlignmentCenter;
- // botTipLabel.text = @"赤彩科技 版权所有";
- // [scrollView addSubview:botTipLabel];
-
- // UILabel* botTipL = [[UILabel alloc]initWithFrame:CGRectMake(KScreenWidth/2-150, KScreenHeight-NavBarHeight-20, 300, 15)];
- // botTipL.textColor = LCTextGray;
- // botTipL.font = [UIFont systemFontOfSize:11];
- // botTipL.textAlignment = NSTextAlignmentCenter;
- // botTipL.text = @"Copyright © 2018 Red Color ALL Rights Reserved";
- // [scrollView addSubview:botTipL];
-
- // UIButton* protocolBtn = [[UIButton alloc]initWithFrame:CGRectMake(KScreenWidth/2-120, KScreenHeight-NavBarHeight-80, 120, 30)];
- // NSMutableAttributedString* attrStr = [[NSMutableAttributedString alloc]initWithString:@"《流光花舞用户协议》"];
- // [attrStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, attrStr.length)];
- // [attrStr addAttribute:NSForegroundColorAttributeName value:LCBlueColor range:NSMakeRange(0, attrStr.length)];
- // [attrStr addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:0] range:NSMakeRange(0, attrStr.length)];
- // [protocolBtn setAttributedTitle:attrStr forState:(UIControlStateNormal)];
- // [protocolBtn addTarget:self action:@selector(youpaifprotocolClick) forControlEvents:(UIControlEventTouchUpInside)];
- // [scrollView addSubview:protocolBtn];
-
- // UIButton* privacyBtn = [[UIButton alloc]initWithFrame:CGRectMake(KScreenWidth/2, KScreenHeight-NavBarHeight-80, 120, 30)];
- // NSMutableAttributedString* pattrStr = [[NSMutableAttributedString alloc]initWithString:@"《流光花舞隐私保护》"];
- // [pattrStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, pattrStr.length)];
- // [pattrStr addAttribute:NSForegroundColorAttributeName value:LCBlueColor range:NSMakeRange(0, pattrStr.length)];
- // [pattrStr addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:0] range:NSMakeRange(0, attrStr.length)];
- // [privacyBtn setAttributedTitle:pattrStr forState:(UIControlStateNormal)];
- // [privacyBtn addTarget:self action:@selector(youpaifprivacyClick) forControlEvents:(UIControlEventTouchUpInside)];
- // [scrollView addSubview:privacyBtn];
-
- }
- - (void)youpaifupdateBtnClick:(UIButton *)btn{
- [self youpaifcheckAppUpdate:YES];
-
- }
- - (void)youpaifprotocolClick{
- ZCBaseWebVC * vc = [[ZCBaseWebVC alloc]init];
- vc.contentUrl = [NSString stringWithFormat:@"%@%@",[LCSaveData getBaseURL]?[LCSaveData getBaseURL]:BaseURL,UserProtocolH5];
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)youpaifprivacyClick{
- ZCBaseWebVC * vc = [[ZCBaseWebVC alloc]init];
- vc.contentUrl = [NSString stringWithFormat:@"%@%@",[LCSaveData getBaseURL]?[LCSaveData getBaseURL]:BaseURL,UserPrivacyH5];
- [self.navigationController pushViewController:vc animated:YES];
- }
- -(void)youpaifcheckAppUpdate:(BOOL)need
- {
- [ZCHUDHelper showWithStatus:@"请求中..."];
- [LCHttpHelper requestWithURLString:CheckUpdateVersion parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary *dict = (NSDictionary *)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code == 0)
- {
- NSString *newVersion = [[dict objectForKey:@"data"] objectForKey:@"newversion"];
- //NSString *myVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
- NSString *app_build = [[UIApplication sharedApplication] appVersion];
-
- if ([newVersion compare:app_build options:NSCaseInsensitiveSearch] > 0) {
- [ZCHUDHelper dismiss];
-
- YOUPAILCUpdateVersionVC *VC= [[YOUPAILCUpdateVersionVC alloc]init];
- VC.youpaipenforce = [[[dict objectForKey:@"data"] objectForKey:@"enforce"]integerValue];
- VC.youpaipdownLoadUrl = [[dict objectForKey:@"data"] objectForKey:@"downloadurl"];
- VC.youpaipversionStr = [NSString stringWithFormat:@"版本号:%@",newVersion];
- VC.youpaipupdateText = [[dict objectForKey:@"data"] objectForKey:@"upgradetext"];
-
- VC.vWidth = KScreenWidth - 70;
- NSDictionary *attrs = @{NSFontAttributeName : [UIFont systemFontOfSize:14]};
- CGSize maxSize= [VC.youpaipupdateText boundingRectWithSize:CGSizeMake(VC.vWidth-116,66) options:NSStringDrawingUsesLineFragmentOrigin attributes:attrs context:nil].size;
- if(maxSize.height<28)
- {
- maxSize.height = 28;
- }
- else{
- maxSize.height = maxSize.height+20;
- }
- VC.vHeight = VC.vWidth*203/305.0 +86 + maxSize.height + 120;
- VC.isTouchDismiss = YES;
- [self TFPresentVC:VC completion:^{
- }];
-
- }else{
- if (need) {
- // [ZCHUDHelper dismiss];
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)0.5*NSEC_PER_SEC), dispatch_get_main_queue(), ^{
- [ZCHUDHelper showTitle:@"已经是最新版本" showtime:1];
-
- });
-
- }
-
- }
-
- }
- } failure:^(NSError *error) {
- [ZCHUDHelper dismiss];
- }];
- }
- -(void)youpaifcheckVersion
- {
- [LCHttpHelper requestWithURLString:VersionCheck parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code==0) {
- // NSString *version = [dict[@"data"] objectForKey:@"version"];
- NSString *newversion = [dict[@"data"] objectForKey:@"newversion"];
- NSString *downLoadUrl = dict[@"data"][@"downloadurl"];
- NSString *upgradetext = dict[@"data"][@"upgradetext"];
- BOOL enforce = [dict[@"data"][@"enforce"]boolValue];
- if(newversion.floatValue>[[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]floatValue])
- {
- YOUPAILCUpdateVersionVC *VC= [[YOUPAILCUpdateVersionVC alloc]init];
- VC.youpaipenforce = enforce;
- VC.youpaipversionStr = [NSString stringWithFormat:@"版本号:%@",newversion];
- VC.vWidth = KScreenWidth -60;
- VC.vHeight = KScreenWidth -60;
- VC.youpaipdownLoadUrl = downLoadUrl;
- VC.youpaipupdateText = upgradetext;
- VC.isTouchDismiss = YES;
- [self TFPresentVC:VC completion:^{
-
- }];
- }
-
- }
- } failure:^(NSError *error) {
-
- }];
- }
- @end
|