SPSBPrivacyViewController.m 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. //
  2. // SPSBPrivacyViewController.m
  3. // 我的社保
  4. //
  5. // Created by shanp on 2021/4/29.
  6. //
  7. #import "SPSBPrivacyViewController.h"
  8. #import "SPSBUIGeneralHeader.h"
  9. #import "SPSBKeyProfile.h"
  10. #import <JXHClickTextView.h>
  11. #import "SPSBHtmlViewController.h"
  12. #import "SPSBURLApiProfile.h"
  13. #import "SPSBNavigationController.h"
  14. @interface SPSBPrivacyViewController ()
  15. @end
  16. @implementation SPSBPrivacyViewController
  17. - (void)viewDidLoad {
  18. [super viewDidLoad];
  19. [self setupUI];
  20. [jxh_userDefaults() setObject:@(true) forKey:SPSBPersonalPrivacy];
  21. [jxh_userDefaults() synchronize];
  22. }
  23. #pragma mark - Action
  24. - (void)privacyAction {
  25. [self hideAnimation:^(BOOL finished) {
  26. [self dismissViewControllerAnimated:false completion:nil];
  27. }];
  28. }
  29. - (void)intoProtocolAction {
  30. SPSBHtmlViewController *vc = [[SPSBHtmlViewController alloc] init];
  31. vc.spsb_url = SPSBSocialSecurityServiceAgreementLink;
  32. SPSBNavigationController *nav = [[SPSBNavigationController alloc] initWithRootViewController:vc];
  33. [self presentViewController:nav animated:true completion:nil];
  34. }
  35. - (void)intoPrivacyAction {
  36. SPSBHtmlViewController *vc = [[SPSBHtmlViewController alloc] init];
  37. vc.spsb_url = SPSBSocialSecurityPrivacyLink;
  38. SPSBNavigationController *nav = [[SPSBNavigationController alloc] initWithRootViewController:vc];
  39. [self presentViewController:nav animated:true completion:nil];
  40. }
  41. #pragma mark - Network Action
  42. #pragma mark - UI
  43. - (void)setupUI {
  44. self.view.backgroundColor = spsb_000000_color(SPSBPopupViewBackgroundAlpha);
  45. [self addPrivacy];
  46. }
  47. #define spsb_privacyWidth 313
  48. - (void)addPrivacy {
  49. UIView *privacyBG = [[UIView alloc] init];
  50. privacyBG.backgroundColor = spsb_FFFFFF_color(1.f);
  51. [privacyBG setLayerCornerRadius:14 clipToBounds:false];
  52. UILabel *title = [UILabel convenienceWithFont:spsb_semiboldFont(18) text:[NSString stringWithFormat:@"%@网用户隐私政策", SPSBAppName] textColor:spsb_333333_color() textAlignment:NSTextAlignmentCenter];
  53. [privacyBG addSubview:title];
  54. [title makeConstraints:^(JXHConstraintMaker *make) {
  55. make.top.equalTo(24);
  56. make.centerX.equalTo(privacyBG);
  57. }];
  58. UIScrollView *contentView = [[UIScrollView alloc] init];
  59. contentView.showsVerticalScrollIndicator = false;
  60. [privacyBG addSubview:contentView];
  61. [contentView makeConstraints:^(JXHConstraintMaker *make) {
  62. make.top.equalTo(60);
  63. make.bottom.equalTo(-80);
  64. make.left.and.right.equalTo(0);
  65. }];
  66. JXHClickTextView *clickView = [[JXHClickTextView alloc] initWithFont:spsb_font(14) titleColor:spsb_333333_color() tag:0 textAlignment:NSTextAlignmentLeft lineSpacing:3 width:spsb_privacyWidth - 50 numberOfLines:0];
  67. @weakify(self)
  68. [clickView setText:@"欢迎使用我的社保!我们深知个人信息安全的重要性,请仔细阅读《我的社保网隐私政策》和《我的社保服务协议》,我们致力于维持您对我们的信任,恪守权责一致、目的明确、选择同意、最少够用等原则,保护您的个人信息。" newFonts:@[spsb_semiboldFont(14), spsb_semiboldFont(14)] clickRanges:@[[NSValue valueWithRange:NSMakeRange(30, 9)], [NSValue valueWithRange:NSMakeRange(42, 8)]] color:spsb_3296FB_color() highlightColor:spsb_3296FB_color() clickCoverColor:spsb_FFFFFF_color(1.f) clickBlock:^(NSString *clickText, JXHClickTextView *clickTextView, NSUInteger clickActionTag) {
  69. @strongify(self)
  70. if (clickActionTag == 0) {
  71. [self intoPrivacyAction];
  72. } else {
  73. [self intoProtocolAction];
  74. }
  75. }];
  76. [clickView setSubstringByRange:NSMakeRange(24, 6) color:spsb_333333_color() newFont:spsb_semiboldFont(14)];
  77. [clickView setSubstringByRange:NSMakeRange(39, 3) color:spsb_333333_color() newFont:spsb_semiboldFont(14)];
  78. [clickView setSubstringByRange:NSMakeRange(50, 1) color:spsb_333333_color() newFont:spsb_semiboldFont(14)];
  79. [contentView addSubview:clickView];
  80. [clickView makeConstraints:^(JXHConstraintMaker *make) {
  81. make.top.equalTo(0);
  82. make.left.equalTo(25);
  83. make.right.equalTo(-25);
  84. make.width.equalTo(spsb_privacyWidth - 50);
  85. make.height.equalTo(clickView.jxh_height);
  86. }];
  87. UILabel *label = [UILabel convenienceWithFont:spsb_semiboldFont(14) textColor:spsb_333333_color() limitWidth:spsb_privacyWidth - 50];
  88. [label setAttributedStringWithText:@"为保证您可以使用我的社保全部功能,请点击“同意并进入”开始使用我们的产品和服务,我们将按业界成熟的安全标准,采取严格的安全保护措施,尽全力保护您的个人信息。" lineSpacing:3];
  89. [contentView addSubview:label];
  90. [label makeConstraints:^(JXHConstraintMaker *make) {
  91. make.top.equalTo(138);
  92. make.left.equalTo(25);
  93. make.right.equalTo(-25);
  94. }];
  95. label = [UILabel convenienceWithFont:spsb_font(14) textColor:spsb_333333_color() limitWidth:spsb_privacyWidth - 50];
  96. [label setAttributedStringWithText:@"如果使用“仅浏览”模式,我们会限制部分功能的使用,但为了方便我们解决用户使用时遇到的问题,我们可能会收集设备名称、型号、操作系统等软硬件信息。" lineSpacing:3];
  97. [contentView addSubview:label];
  98. [label makeConstraints:^(JXHConstraintMaker *make) {
  99. make.top.equalTo(253);
  100. make.left.equalTo(25);
  101. make.right.equalTo(-25);
  102. make.bottom.equalTo(0);
  103. }];
  104. UIButton *button = [UIButton convenienceWithFont:spsb_font(16) target:self action:@selector(privacyAction)];
  105. [button setTitle:@"仅浏览" titleColor:spsb_999999_color() state:JXHButtonControlStateNormal];
  106. [button setLayerCornerRadius:20 clipToBounds:true];
  107. [button setLayerBorderWidth:1 borderColor:spsb_CCCCCC_color()];
  108. [privacyBG addSubview:button];
  109. [button makeConstraints:^(JXHConstraintMaker *make) {
  110. make.bottom.equalTo(-21);
  111. make.left.equalTo(25);
  112. make.size.equalTo(CGSizeMake(103, 40));
  113. }];
  114. button = [UIButton convenienceWithFont:spsb_font(16) target:self action:@selector(privacyAction)];
  115. [button setTitle:@"同意并进入" titleColor:spsb_FFFFFF_color(1.f) state:JXHButtonControlStateNormal];
  116. [button setBackgroundColor:spsb_3296FB_color()];
  117. [button setLayerCornerRadius:20 clipToBounds:true];
  118. [privacyBG addSubview:button];
  119. [button makeConstraints:^(JXHConstraintMaker *make) {
  120. make.bottom.equalTo(-21);
  121. make.right.equalTo(-25);
  122. make.size.equalTo(CGSizeMake(147, 40));
  123. }];
  124. [self.view addSubview:privacyBG];
  125. [privacyBG makeConstraints:^(JXHConstraintMaker *make) {
  126. make.size.equalTo(CGSizeMake(spsb_privacyWidth, 396));
  127. make.center.equalTo(privacyBG.superview);
  128. }];
  129. }
  130. #undef spsb_privacyWidth
  131. @end