123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- //
- // privacyModeTipViewController.m
- // 隐私保护
- //
- // Created by xd h on 2023/11/28.
- //
- #import "privacyModeTipViewController.h"
- #import "connectDeviceManager.h"
- @interface privacyModeTipViewController ()
- @end
- @implementation privacyModeTipViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
-
- [self.view setBackgroundColor:[UIColor whiteColor]];
- [self.toolBar setHidden:YES];
- [self.navigationBar setHidden:YES];
- [self.navBarBGView setHidden:YES];
-
- [self initBaseUIFun];
-
- ksharedAppDelegate.isFirstInputPwdDone = YES;
- }
- - (void)initBaseUIFun
- {
- UIImageView *topImageV = [[UIImageView alloc] init];
- topImageV.image = [UIImage imageNamed:@"privacy_Tip_bg"];
- [self.view addSubview:topImageV];
-
- CGFloat height = 320 * AUTOSCALE;
- [topImageV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.top.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.height.mas_equalTo(height);
- }];
-
- UIImageView *midImageV = [[UIImageView alloc] init];
- midImageV.image = [UIImage imageNamed:@"privacy_Tip_set"];
- [self.view addSubview:midImageV];
- [midImageV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.mas_equalTo(0);
- make.top.mas_equalTo(56 + safeArea);
- make.width.mas_equalTo(193);
- make.height.mas_equalTo(176);
- }];
-
- UILabel *topLab = [[UILabel alloc] init];
- topLab.text = NSLocalizedString(@"my_set_Privacy_Mode_set",nil);
- topLab.font = [UIFont systemFontOfSize:16.0];
- topLab.textAlignment = NSTextAlignmentCenter;
- [self.view addSubview:topLab];
-
- [topLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.top.mas_equalTo(topImageV.mas_bottom).offset(10);
- make.height.mas_equalTo(20);
- }];
-
- UILabel *tipLab1 = [[UILabel alloc] init];
- tipLab1.text = NSLocalizedString(@"my_set_Privacy_Mode_tip1",nil);
- tipLab1.textColor = [UIColor hwColor:@"#6A6A6A" alpha:1.0];
- tipLab1.font = [UIFont systemFontOfSize:14.0];
- tipLab1.textAlignment = NSTextAlignmentCenter;
- tipLab1.numberOfLines = 0;
- [self.view addSubview:tipLab1];
-
- [tipLab1 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(30);
- make.right.mas_equalTo(-30);
- make.top.mas_equalTo(topLab.mas_bottom).offset(15);
- make.height.mas_equalTo(40);
- }];
-
-
- UILabel *tipLab2 = [[UILabel alloc] init];
- tipLab2.text = NSLocalizedString(@"my_set_Privacy_Mode_tip2",nil);
- tipLab2.textColor = [UIColor hwColor:@"#2974DE" alpha:1.0];
- tipLab2.font = [UIFont systemFontOfSize:14.0];
- tipLab2.textAlignment = NSTextAlignmentCenter;
- tipLab2.numberOfLines = 0;
- [self.view addSubview:tipLab2];
-
- [tipLab2 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(30);
- make.right.mas_equalTo(-30);
- make.top.mas_equalTo(tipLab1.mas_bottom).offset(10);
- make.height.mas_equalTo(40);
- }];
-
- //跳过
- UIButton *skipBtn = [[UIButton alloc] init];
- skipBtn.tag = 1;
- [skipBtn addTarget:self action:@selector(didClickButFun:) forControlEvents:(UIControlEventTouchUpInside)];
- [skipBtn setTitle:NSLocalizedString(@"guide_skip",nil) forState:(UIControlStateNormal)];
- [skipBtn setTitleColor:[UIColor hwColor:@"#2974DE" alpha:1.0] forState:(UIControlStateNormal)];
- [skipBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
- // [skipBtn.layer setCornerRadius:14.f];
- // skipBtn.layer.borderColor = [UIColor whiteColor].CGColor;
- // skipBtn.layer.borderWidth = 1.0;
- // [skipBtn setBackgroundColor:HWE3E8F1Color];
- skipBtn.clipsToBounds = YES;
- [self.view addSubview:skipBtn];
- [skipBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.mas_equalTo(0);
- make.width.mas_equalTo(100.f);
- make.bottom.mas_equalTo(-40);
- make.height.mas_equalTo(40);
- }];
-
-
- /*开启隐私模式*/
- UIButton* okBtn = [[UIButton alloc] init];
- okBtn.tag = 2;
- CGFloat okBtn_W= SCREEN_W - 15*2;
- // gradient
- CAGradientLayer *gl = [CAGradientLayer layer];
- gl.frame = CGRectMake(0,0,okBtn_W,48);
- gl.startPoint = CGPointMake(0, 0.5);
- gl.endPoint = CGPointMake(1, 0.5);
- gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
- gl.locations = @[@(0), @(1.0f)];
- okBtn.layer.cornerRadius = 24;
- okBtn.clipsToBounds = YES;
- [okBtn.layer addSublayer:gl];
- [okBtn setTitle:NSLocalizedString(@"my_set_Privacy_Mode_open",nil) forState:(UIControlStateNormal)];
- [okBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
- [okBtn addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
-
- [self.view addSubview:okBtn];
- [okBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- //make.top.equalTo(pwdAgainTextField.mas_bottom).offset(16.f);
- make.bottom.equalTo(skipBtn.mas_top).offset(-10.f);
- make.left.mas_equalTo(15.f);
- make.width.mas_equalTo(okBtn_W);
- make.height.mas_equalTo(48);
- }];
- }
- -(void)didClickButFun:(UIButton*)but
- {
- NSInteger tag = but.tag;
-
- if(tag == 1){
- [self handleOkFun];
- }
- else{
- [self updatePrivacyModeFun];
- }
- }
- #pragma mark 联网设置隐私模式
- - (void)updatePrivacyModeFun{
-
- [self showNewIndicatorWithCanBack:YES canTouch:NO];
- BOOL haveOpenMask = YES;
- NSString* curSn = ksharedAppDelegate.DeviceThirdIdMod.data.changeSn;
-
- NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
- [paraDict setValue:curSn forKey:@"sn"];
- [paraDict setValue:[NSNumber numberWithBool:haveOpenMask] forKey:@"isPrivacyMode"];
-
- KWeakSelf
- [[netWorkManager shareInstance] CommonPostCallBackCode:updatePrivacyMode Parameters:paraDict success:^(id _Nonnull responseObject) {
- HLog(@"%@", responseObject);
- [self removeNewIndicator];
- SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
- if (model.status == 0) {
- ksharedAppDelegate.DeviceThirdIdMod.data.isPrivacyMode = YES;
- [weakSelf handleOkFun];
- }
- else
- {
- //[[iToast makeText:model.msg] show];
- }
- } failure:^(NSError * _Nonnull error) {
- HLog(@"%@", error);
- [[iToast makeText:NSLocalizedString(@"player_link_fail_tip",nil)] show];
- [self removeNewIndicator];
- }];
- }
- -(void)handleOkFun
- {
- [[NSNotificationCenter defaultCenter] postNotificationName:GuideOkNotification object:nil];
- }
- @end
|