123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- //
- // YMServicePolicyPopupView.m
- // MSYOUPAI
- //
- // Created by YoMi on 2024/2/8.
- // Copyright © 2024 MS. All rights reserved.
- //
- #import "YMServicePolicyPopupView.h"
- @interface YMServicePolicyPopupView ()
- /** 标题标签*/
- @property (nonatomic, strong) UILabel *titleLb;
- /** 容器滚动视图*/
- @property (nonatomic, strong) UIScrollView *contentScrollView;
- /** 容器视图*/
- @property (nonatomic, strong) UIView *contentView;
- /** 提示文本*/
- @property (nonatomic, strong) YYLabel *tipsLb;
- /** 按钮视图*/
- @property (nonatomic, strong) UIView *buttonView;
- /** 取消按钮*/
- @property (nonatomic, strong) UIButton *cancelBtn;
- /** 确认按钮*/
- @property (nonatomic, strong) UIButton *confirmBtn;
- @end
- @implementation YMServicePolicyPopupView
- - (void)ym_setupViews{
-
- self.backgroundColor = HexColorFromRGB(0xFFFFFF);
-
- [self addSubview:self.titleLb];
- [self addSubview:self.contentScrollView];
- [self.contentScrollView addSubview:self.contentView];
- [self.contentView addSubview:self.tipsLb];
- [self addSubview:self.buttonView];
- [self.buttonView addSubview:self.cancelBtn];
- [self.buttonView addSubview:self.confirmBtn];
-
- [self setNeedsUpdateConstraints];
- [self updateConstraintsIfNeeded];
-
- NSString *appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"];
- [self configurationWithTitleStr:@"用户协议和隐私政策" ContentStr:stringFormat(@"欢迎您使用“%@”!%@非常重视保护用户(以下简称“您”)的个人信息和隐私,我们根据监管要求更新了《用户服务协议》和《%@隐私政策》;并希望通过以下《%@隐私政策(摘要)》帮助您直观、简洁地了解我们在必要范围内收集和使用您的个人信息类型和业务场景,以及我们处理您个人信息的基本规则。\n%@隐私政策(摘要)\n一、我们如何收集和使用个人信息\n1.帮助您完成注册、登录及认证\n注册%@账号时,您需要提供手机号码、验证码匹配结果、昵称、头像、生日,如果您使用第三方账号进行登录,需要您提供第三方账号的昵称、头像、性别。在注册、登录或后续的使用过程中,您也可以向我们补充额外信息(如您的性别、星座、所在地、职业、学历、身高、体重、年收入、交友宣言、兴趣爱好、您本人的真实头像),有助于我们提供更好的服务,同时增进您与其他用户之间的互动、了解。如果您不提供这些信息,并不会影响您使用%@的基本功能。依据相关法律法规的规定,或为了满足实名认证的需要,保障用户账号安全,在您使用%@实名认证、身份认证、兑换金币功能时,我们需要对您进行身份验证,并收集您的以下身份认证信息:姓名、身份证号码、电话号码、面部特征值(静态或动态)、与实名认证一致的收款账户以及兑换金币记录信息。如果您拒绝向我们提供上述信息,我们将无法向您提供相关的功能及服务。\n2.为您提供信息发布与互动服务\n在您使用%@进行上传/发布信息以及进行相关行为(即上传发布音视频、图文内容、点赞、评论、关注、收藏、送礼)时,我们将收集您上传、发布及形成的信息并有权展示您的昵称、头像和发布内容。当您使用%@向其他用户打赏、送礼时,我们将收集您的头像、昵称及送礼数据,并向其他用户进行展示。当您使用上传头像、进行真人认证、发布语音个人签名、发布动态(包括图文与视频内容)时,我们还会根据您所发布的内容请求您授权相机、照片、麦克风以及存储权限;请你知悉,权限的开启或授权是您使用上述功能的前提,如您关闭或拒绝授权将无法使用上述功能,但不会影响您使用其他功能与服务。\n请您注意,您在使用我们提供的服务时所提供的所有个人信息,除非您删除或通过系统设置拒绝我们收集,否则将在您使用我们的服务期间持续授权我们使用。在您注销账号时,我们将停止使用并删除您的个人信息,或采取匿名化处理,使其不再与您关联到一起。\n二、我们如何共享您的个人信息\n我们会委托第三方服务提供商处理我们收集的您的个人信息,以便其为我们提供基础设施技术、数据分析、广告投放、营销决策等产品或技术支持,上述委托处理行为受《%@隐私政策》中所声明目的约束,并且我们会以合同方式对上述的第三方进行监督,以确保您的个人信息安全。\n三、您的权利\n在您使用%@期间,您可以通过相应页面提示或《%@隐私政策》载明的方式联系我们,以访问、更正、删除您的个人信息,以及行使改变授权同意的范围与注销账号的权利,我们将及时响应您的请求。如果您需要您的个人信息副本,您可以通过我们提供的方式联系我们,在核实您的身份后,我们将向您提供您在我们服务中的个人信息副本(包括基础资料、身份信息),但法律法规另有规定的或《%@隐私政策》另有约定的除外。\n四、未成年人保护\n我们的产品和范围仅面向18周岁以上的成年人,任何不满18周岁的未成年人不得创建自己的用户账号及/或使用我们的服务。如果我们发现或审核出任何未成年人注册或使用我们的产品,我们将采取注销账号、删除信息等措施禁止、限制未成年人使用。\n五、如何联系我们\n如果您对本隐私政策或个人信息保护有任何问题,您可以将您的书面疑问、意见或建议联系在线客服或发送邮件至:cxhylive@163.com。一般情况下,我们将在十五个工作日内回复。如果您对我们的回复或处理不满意,您还可以向履行个人信息保护职责的部门进行投诉、举报。",appName,appName,appName,appName,appName,appName,appName,appName,appName,appName,appName,appName,appName,appName)];
-
- }
- - (void)updateConstraints{
-
- [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self).offset(adapt(20));
- make.left.equalTo(self).offset(adapt(20));
- make.right.equalTo(self).offset(adapt(-20));
- }];
-
- [self.contentScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.titleLb.mas_bottom).offset(adapt(20));
- make.left.equalTo(self);
- make.right.equalTo(self);
- }];
-
- [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(self.contentScrollView);
- make.width.equalTo(self.contentScrollView.mas_width);
- }];
-
- [self.tipsLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.contentView);
- make.left.equalTo(self.contentView).offset(adapt(20));
- make.right.equalTo(self.contentView).offset(adapt(-20));
- make.bottom.equalTo(self.contentView);
- }];
-
-
- [self.buttonView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.contentScrollView.mas_bottom).offset(adapt(10));
- make.left.equalTo(self);
- make.right.equalTo(self);
- make.bottom.equalTo(self).offset(adapt(-15)).priorityHigh();
- }];
-
- NSArray *btnArr = @[self.cancelBtn,self.confirmBtn];
-
- // 实现masonry水平固定控件宽度方法
- // axisType 横排还是竖排
- // fixedSpacing 两个控件间隔
- // leadSpacing 第一个控件与边缘的间隔
- // tailSpacing 最后一个控件与边缘的间隔
- [btnArr mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:adapt(15) leadSpacing:adapt(20) tailSpacing:adapt(20)];
-
- // 设置array的垂直方向的约束
- [btnArr mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.buttonView).offset(adapt(10));
- make.bottom.equalTo(self.buttonView).offset(adapt(-10));
- make.height.mas_equalTo(adapt(40));
- }];
-
-
-
- [super updateConstraints];
-
- }
- - (void)configurationWithTitleStr:(NSString*)titleStr ContentStr:(NSString *)contentStr{
-
- self.titleLb.text = titleStr;
-
- NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:contentStr];
- attributedString.yy_font = LCFont(14);
- attributedString.yy_color = HexColorFromRGB(0x333333);
- attributedString.yy_lineSpacing = 5;
- attributedString.yy_alignment = NSTextAlignmentLeft;
- NSString *userAgreementHighlightStr = @"《用户服务协议》";
- NSArray *userAgreementArray = [self rangeOfSubString:userAgreementHighlightStr inString:contentStr];
- for (NSInteger i = 0; i < userAgreementArray.count; i++) {
- NSValue *value = userAgreementArray[i];
- //添加下划线
- // YYTextDecoration* deco = [YYTextDecoration decorationWithStyle:(YYTextLineStyleSingle) width:[NSNumber numberWithInt:1] color:HEXCOLOR(0xFF0000)];
- // [attributedString yy_setTextUnderline:deco range:value.rangeValue];
- [attributedString yy_setTextHighlightRange:value.rangeValue
- color:HexColorFromRGB(0x1ACEE2)
- backgroundColor:[UIColor clearColor]
- tapAction:^(UIView *containerView, NSAttributedString *text, NSRange range, CGRect rect){
- if (self.userProtocolBlock) {
- self.userProtocolBlock();
- }
- }];
- }
-
- NSString *privacyAgreementHighlightStr = stringFormat(@"《%@隐私政策》",[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"]);
- NSArray *privacyAgreementArray = [self rangeOfSubString:privacyAgreementHighlightStr inString:contentStr];
- for (NSInteger i = 0; i < privacyAgreementArray.count; i++) {
- NSValue *value = privacyAgreementArray[i];
- //添加下划线
- // YYTextDecoration* deco = [YYTextDecoration decorationWithStyle:(YYTextLineStyleSingle) width:[NSNumber numberWithInt:1] color:HEXCOLOR(0xFF0000)];
- // [attributedString yy_setTextUnderline:deco range:value.rangeValue];
- [attributedString yy_setTextHighlightRange:value.rangeValue
- color:HexColorFromRGB(0x1ACEE2)
- backgroundColor:[UIColor clearColor]
- tapAction:^(UIView *containerView, NSAttributedString *text, NSRange range, CGRect rect){
- // [YoMiRouter openURL:YoMi_NSStringFormat(@"%@%@", ROUTER_URL_PREFIX, ROUTER_AGREEMENT_INFO_ARTICLE_VC) withUserInfo:@{@"articleType":@(privacyPolicyType)} completion:nil];
- if (self.privacyPolicyBlock) {
- self.privacyPolicyBlock();
- }
- }];
- }
-
- self.tipsLb.attributedText = attributedString;
-
- CGSize introSize = CGSizeMake(kFrameWidth*0.88 - 20*2, CGFLOAT_MAX);
- YYTextLayout *layout = [YYTextLayout layoutWithContainerSize:introSize text:attributedString];
- self.tipsLb.textLayout = layout;
- CGFloat attributedHeight = layout.textBoundingSize.height;
- [self.tipsLb mas_updateConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(attributedHeight);
- }];
-
- CGFloat titleLbHeight = [self.titleLb systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;
-
- CGFloat buttonViewHeight = [self.buttonView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;
-
- CGFloat judgeHeight = adapt(300);
-
- CGFloat tipsHeight = attributedHeight > judgeHeight ? judgeHeight : attributedHeight;
-
- self.frame = CGRectMake(0, 0, kFrameWidth*0.88, adapt(20) + titleLbHeight + adapt(20) + tipsHeight + adapt(10) + buttonViewHeight + adapt(20));
- }
- #pragma mark - 获取字符串的所在位置
- //获取一个字符在字符串中出现的所有位置 返回一个被NSValue包装的NSRange数组
- - (NSArray *)rangeOfSubString:(NSString *)subStr inString:(NSString *)string {
- if (subStr == nil && [subStr isEqualToString:@""]) {
- return nil;
- }
- NSMutableArray *rangeArray = [NSMutableArray array];
- NSString *string1 = [string stringByAppendingString:subStr];
- NSString *temp;
- for (int i = 0; i < string.length; i ++) {
- temp = [string1 substringWithRange:NSMakeRange(i, subStr.length)];
- if ([temp isEqualToString:subStr]) {
- NSRange range = {i,subStr.length};
- [rangeArray addObject:[NSValue valueWithRange:range]];
- }
- }
- return rangeArray;
- }
- #pragma mark - lazyload
- - (UILabel *)titleLb{
- if (!_titleLb) {
- _titleLb = [[UILabel alloc]init];
- _titleLb.font = LCFont(18);
- _titleLb.textColor = HexColorFromRGB(0x1B2739);
- _titleLb.textAlignment = NSTextAlignmentCenter;
- _titleLb.text = @"提示";
- }
- return _titleLb;
- }
- - (UIScrollView *)contentScrollView{
- if (!_contentScrollView) {
- _contentScrollView = [[UIScrollView alloc] init];
- _contentScrollView.alwaysBounceVertical = YES;
- _contentScrollView.showsVerticalScrollIndicator = NO;
- _contentScrollView.showsHorizontalScrollIndicator = NO;
- _contentScrollView.backgroundColor = HexColorFromRGB(0xFFFFFF);
- _contentScrollView.keyboardDismissMode = UIScrollViewKeyboardDismissModeOnDrag;
- }
- return _contentScrollView;
- }
- - (UIView *)contentView{
- if (!_contentView) {
- _contentView = [[UIView alloc]init];
- }
- return _contentView;
- }
- - (YYLabel *)tipsLb{
- if (!_tipsLb) {
- _tipsLb = [[YYLabel alloc]init];
- _tipsLb.font = LCFont(14);
- _tipsLb.textAlignment = NSTextAlignmentLeft;
- }
- return _tipsLb;
- }
- - (UIView *)buttonView{
- if (!_buttonView) {
- _buttonView = [[UIView alloc]init];
- }
- return _buttonView;
- }
- - (UIButton *)cancelBtn {
- if(!_cancelBtn){
- _cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _cancelBtn.titleLabel.font = LCFont(15);
- [_cancelBtn setTitle:@"不同意" forState:UIControlStateNormal];
- [_cancelBtn setTitleColor:HexColorFromRGB(0x555555) forState:UIControlStateNormal];
- _cancelBtn.backgroundColor = HexColorFromRGB(0xF5F5F5);
- _cancelBtn.layer.cornerRadius = adapt(10);
- WS(weakSelf)
- [[[_cancelBtn rac_signalForControlEvents:UIControlEventTouchUpInside] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(__kindof UIButton * _Nullable sender) {
- if (weakSelf.buttonBlock) {
- weakSelf.buttonBlock(NO);
- }
- }];
- }
- return _cancelBtn;
- }
- - (UIButton *)confirmBtn {
- if(!_confirmBtn){
- _confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _confirmBtn.titleLabel.font = LCFont(15);
- [_confirmBtn setTitle:@"同意" forState:UIControlStateNormal];
- [_confirmBtn setTitleColor:HexColorFromRGB(0x000000) forState:UIControlStateNormal];
- _confirmBtn.backgroundColor = MAINGRIDColor2;
- _confirmBtn.layer.cornerRadius = adapt(10);
- WS(weakSelf)
- [[[_confirmBtn rac_signalForControlEvents:UIControlEventTouchUpInside] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(__kindof UIButton * _Nullable sender) {
- if (weakSelf.buttonBlock) {
- weakSelf.buttonBlock(YES);
- }
- }];
- }
- return _confirmBtn;
- }
- @end
|