privacyModeTipViewController.m 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. //
  2. // privacyModeTipViewController.m
  3. // 隐私保护
  4. //
  5. // Created by xd h on 2023/11/28.
  6. //
  7. #import "privacyModeTipViewController.h"
  8. #import "connectDeviceManager.h"
  9. @interface privacyModeTipViewController ()
  10. @end
  11. @implementation privacyModeTipViewController
  12. - (void)viewDidLoad {
  13. [super viewDidLoad];
  14. // Do any additional setup after loading the view.
  15. [self.view setBackgroundColor:[UIColor whiteColor]];
  16. [self.toolBar setHidden:YES];
  17. [self.navigationBar setHidden:YES];
  18. [self.navBarBGView setHidden:YES];
  19. [self initBaseUIFun];
  20. ksharedAppDelegate.isFirstInputPwdDone = YES;
  21. }
  22. - (void)initBaseUIFun
  23. {
  24. UIImageView *topImageV = [[UIImageView alloc] init];
  25. topImageV.image = [UIImage imageNamed:@"privacy_Tip_bg"];
  26. [self.view addSubview:topImageV];
  27. CGFloat height = 320 * AUTOSCALE;
  28. [topImageV mas_makeConstraints:^(MASConstraintMaker *make) {
  29. make.left.mas_equalTo(0);
  30. make.top.mas_equalTo(0);
  31. make.right.mas_equalTo(0);
  32. make.height.mas_equalTo(height);
  33. }];
  34. UIImageView *midImageV = [[UIImageView alloc] init];
  35. midImageV.image = [UIImage imageNamed:@"privacy_Tip_set"];
  36. [self.view addSubview:midImageV];
  37. [midImageV mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.centerX.mas_equalTo(0);
  39. make.top.mas_equalTo(56 + safeArea);
  40. make.width.mas_equalTo(193);
  41. make.height.mas_equalTo(176);
  42. }];
  43. UILabel *topLab = [[UILabel alloc] init];
  44. topLab.text = NSLocalizedString(@"my_set_Privacy_Mode_set",nil);
  45. topLab.font = [UIFont systemFontOfSize:16.0];
  46. topLab.textAlignment = NSTextAlignmentCenter;
  47. [self.view addSubview:topLab];
  48. [topLab mas_makeConstraints:^(MASConstraintMaker *make) {
  49. make.left.mas_equalTo(0);
  50. make.right.mas_equalTo(0);
  51. make.top.mas_equalTo(topImageV.mas_bottom).offset(10);
  52. make.height.mas_equalTo(20);
  53. }];
  54. UILabel *tipLab1 = [[UILabel alloc] init];
  55. tipLab1.text = NSLocalizedString(@"my_set_Privacy_Mode_tip1",nil);
  56. tipLab1.textColor = [UIColor hwColor:@"#6A6A6A" alpha:1.0];
  57. tipLab1.font = [UIFont systemFontOfSize:14.0];
  58. tipLab1.textAlignment = NSTextAlignmentCenter;
  59. tipLab1.numberOfLines = 0;
  60. [self.view addSubview:tipLab1];
  61. [tipLab1 mas_makeConstraints:^(MASConstraintMaker *make) {
  62. make.left.mas_equalTo(30);
  63. make.right.mas_equalTo(-30);
  64. make.top.mas_equalTo(topLab.mas_bottom).offset(15);
  65. make.height.mas_equalTo(60);
  66. }];
  67. UILabel *tipLab2 = [[UILabel alloc] init];
  68. tipLab2.text = NSLocalizedString(@"my_set_Privacy_Mode_tip2",nil);
  69. tipLab2.textColor = [UIColor hwColor:@"#2974DE" alpha:1.0];
  70. tipLab2.font = [UIFont systemFontOfSize:14.0];
  71. tipLab2.textAlignment = NSTextAlignmentCenter;
  72. tipLab2.numberOfLines = 0;
  73. [self.view addSubview:tipLab2];
  74. [tipLab2 mas_makeConstraints:^(MASConstraintMaker *make) {
  75. make.left.mas_equalTo(30);
  76. make.right.mas_equalTo(-30);
  77. make.top.mas_equalTo(tipLab1.mas_bottom).offset(10);
  78. //make.height.mas_equalTo(40);
  79. }];
  80. //跳过
  81. UIButton *skipBtn = [[UIButton alloc] init];
  82. skipBtn.tag = 1;
  83. [skipBtn addTarget:self action:@selector(didClickButFun:) forControlEvents:(UIControlEventTouchUpInside)];
  84. [skipBtn setTitle:NSLocalizedString(@"guide_skip",nil) forState:(UIControlStateNormal)];
  85. [skipBtn setTitleColor:[UIColor hwColor:@"#2974DE" alpha:1.0] forState:(UIControlStateNormal)];
  86. [skipBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
  87. // [skipBtn.layer setCornerRadius:14.f];
  88. // skipBtn.layer.borderColor = [UIColor whiteColor].CGColor;
  89. // skipBtn.layer.borderWidth = 1.0;
  90. // [skipBtn setBackgroundColor:HWE3E8F1Color];
  91. skipBtn.clipsToBounds = YES;
  92. [self.view addSubview:skipBtn];
  93. [skipBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  94. make.centerX.mas_equalTo(0);
  95. make.width.mas_equalTo(100.f);
  96. make.bottom.mas_equalTo(-40);
  97. make.height.mas_equalTo(40);
  98. }];
  99. /*开启隐私模式*/
  100. UIButton* okBtn = [[UIButton alloc] init];
  101. okBtn.tag = 2;
  102. CGFloat okBtn_W= SCREEN_W - 15*2;
  103. // gradient
  104. CAGradientLayer *gl = [CAGradientLayer layer];
  105. gl.frame = CGRectMake(0,0,okBtn_W,48);
  106. gl.startPoint = CGPointMake(0, 0.5);
  107. gl.endPoint = CGPointMake(1, 0.5);
  108. gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
  109. gl.locations = @[@(0), @(1.0f)];
  110. okBtn.layer.cornerRadius = 24;
  111. okBtn.clipsToBounds = YES;
  112. [okBtn.layer addSublayer:gl];
  113. [okBtn setTitle:NSLocalizedString(@"my_set_Privacy_Mode_open",nil) forState:(UIControlStateNormal)];
  114. [okBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
  115. [okBtn addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  116. [self.view addSubview:okBtn];
  117. [okBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  118. //make.top.equalTo(pwdAgainTextField.mas_bottom).offset(16.f);
  119. make.bottom.equalTo(skipBtn.mas_top).offset(-10.f);
  120. make.left.mas_equalTo(15.f);
  121. make.width.mas_equalTo(okBtn_W);
  122. make.height.mas_equalTo(48);
  123. }];
  124. }
  125. -(void)didClickButFun:(UIButton*)but
  126. {
  127. NSInteger tag = but.tag;
  128. if(tag == 1){
  129. [self handleOkFun];
  130. }
  131. else{
  132. [self updatePrivacyModeFun];
  133. }
  134. }
  135. #pragma mark 联网设置隐私模式
  136. - (void)updatePrivacyModeFun{
  137. [self showNewIndicatorWithCanBack:YES canTouch:NO];
  138. BOOL haveOpenMask = YES;
  139. NSString* curSn = ksharedAppDelegate.DeviceThirdIdMod.data.changeSn;
  140. NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
  141. [paraDict setValue:curSn forKey:@"sn"];
  142. [paraDict setValue:[NSNumber numberWithBool:haveOpenMask] forKey:@"isPrivacyMode"];
  143. KWeakSelf
  144. [[netWorkManager shareInstance] CommonPostCallBackCode:updatePrivacyMode Parameters:paraDict success:^(id _Nonnull responseObject) {
  145. HLog(@"%@", responseObject);
  146. [self removeNewIndicator];
  147. SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  148. if (model.status == 0) {
  149. ksharedAppDelegate.DeviceThirdIdMod.data.isPrivacyMode = YES;
  150. [weakSelf handleOkFun];
  151. }
  152. else
  153. {
  154. //[[iToast makeText:model.msg] show];
  155. }
  156. } failure:^(NSError * _Nonnull error) {
  157. HLog(@"%@", error);
  158. [[iToast makeText:NSLocalizedString(@"player_link_fail_tip",nil)] show];
  159. [self removeNewIndicator];
  160. }];
  161. }
  162. -(void)handleOkFun
  163. {
  164. [[NSNotificationCenter defaultCenter] postNotificationName:GuideOkNotification object:nil];
  165. }
  166. @end