You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
4.8 KiB
98 lines
4.8 KiB
4 years ago
|
//
|
||
|
// TFMemberInstructionsViewCell.m
|
||
|
// TFReader
|
||
|
//
|
||
|
// Created by 谢腾飞 on 2020/12/13.
|
||
|
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import "TFMemberInstructionsViewCell.h"
|
||
|
#import "TFWebViewController.h"
|
||
|
#import "WXYZ_FeedbackSubViewController.h"
|
||
|
#import "AppDelegate.h"
|
||
|
|
||
|
@interface TFMemberInstructionsViewCell ()
|
||
|
{
|
||
|
YYTextView *aboutTextView;
|
||
|
}
|
||
|
@end
|
||
|
|
||
|
@implementation TFMemberInstructionsViewCell
|
||
|
|
||
|
- (void)createSubviews
|
||
|
{
|
||
|
[super createSubviews];
|
||
|
|
||
|
aboutTextView = [[YYTextView alloc] init];
|
||
|
aboutTextView.backgroundColor = [UIColor whiteColor];
|
||
|
aboutTextView.editable = NO;
|
||
|
aboutTextView.scrollEnabled = NO;
|
||
|
aboutTextView.selectable = NO;
|
||
|
[self.contentView addSubview:aboutTextView];
|
||
|
|
||
|
[aboutTextView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.left.mas_equalTo(self.contentView.mas_left).with.offset(kHalfMargin);
|
||
|
make.top.mas_equalTo(self.contentView.mas_top);
|
||
|
make.right.mas_equalTo(self.contentView.mas_right).with.offset(- kHalfMargin);
|
||
|
make.height.mas_equalTo(10);
|
||
|
make.bottom.mas_equalTo(self.contentView.mas_bottom).with.offset(- kHalfMargin).priorityLow();
|
||
|
}];
|
||
|
}
|
||
|
|
||
|
- (void)setAbout:(NSArray<NSString *> *)about
|
||
|
{
|
||
|
_about = about;
|
||
|
|
||
|
if (about.count > 0 && ![[about firstObject] isEqualToString:@""]) {
|
||
|
|
||
|
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] init];
|
||
|
|
||
|
for (NSString *t_str in about) {
|
||
|
[str appendString:[t_str stringByAppendingString:@"\n\n"]];
|
||
|
}
|
||
|
|
||
|
[str setColor:kGrayTextColor];
|
||
|
|
||
|
[str setFont:kFont12];
|
||
|
|
||
|
[str setTextHighlightRange:[str.string localizedStandardRangeOfString:TFLocalizedString(@"《用户协议》")] color:kMainColor backgroundColor:[UIColor whiteColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
|
||
|
TFWebViewController *vc = [[TFWebViewController alloc] init];
|
||
|
vc.navTitle = TFLocalizedString(@"用户协议");
|
||
|
AppDelegate *delegate = (AppDelegate *)kRCodeSync([UIApplication sharedApplication].delegate);
|
||
|
vc.URLString = delegate.checkSettingModel.protocol_list.user ?: [NSString stringWithFormat:@"%@%@?language=%@", APIURL, User_Agreement, TFLanguageManager.serverLocalized];
|
||
|
vc.isPresentState = NO;
|
||
|
[[TFViewHelper getCurrentNavigationController] pushViewController:vc animated:YES];
|
||
|
}];
|
||
|
|
||
|
[str setTextHighlightRange:[str.string localizedStandardRangeOfString:TFLocalizedString(@"《隐私协议》")] color:kMainColor backgroundColor:[UIColor whiteColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
|
||
|
TFWebViewController *vc = [[TFWebViewController alloc] init];
|
||
|
vc.navTitle = TFLocalizedString(@"隐私协议");
|
||
|
AppDelegate *delegate = (AppDelegate *)kRCodeSync([UIApplication sharedApplication].delegate);
|
||
|
vc.URLString = delegate.checkSettingModel.protocol_list.privacy ?: [NSString stringWithFormat:@"%@%@?language=%@", APIURL, Privacy_Policy, TFLanguageManager.serverLocalized];;
|
||
|
vc.isPresentState = NO;
|
||
|
[[TFViewHelper getCurrentNavigationController] pushViewController:vc animated:YES];
|
||
|
}];
|
||
|
|
||
|
[str setTextHighlightRange:[str.string localizedStandardRangeOfString:TFLocalizedString(@"《会员服务协议》")] color:kMainColor backgroundColor:[UIColor whiteColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
|
||
|
TFWebViewController *vc = [[TFWebViewController alloc] init];
|
||
|
vc.navTitle = TFLocalizedString(@"会员服务协议");
|
||
|
vc.URLString = [NSString stringWithFormat:@"%@%@?language=%@", APIURL, Membership_Service, TFLanguageManager.serverLocalized];
|
||
|
vc.isPresentState = NO;
|
||
|
[[TFViewHelper getCurrentNavigationController] pushViewController:vc animated:YES];
|
||
|
}];
|
||
|
|
||
|
[str setTextHighlightRange:[str.string localizedStandardRangeOfString:TFLocalizedString(@"【意见反馈】")] color:kMainColor backgroundColor:[UIColor whiteColor] tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
|
||
|
[[TFViewHelper getWindowRootController] presentViewController:[[WXYZ_FeedbackSubViewController alloc] init] animated:YES completion:nil];
|
||
|
}];
|
||
|
|
||
|
aboutTextView.attributedText = str;
|
||
|
CGFloat footerHeight = [TFViewHelper getDynamicHeightWithLabelFont:kFont12 labelWidth:SCREEN_WIDTH - kMargin labelText:str.string] - 2 * kMargin;
|
||
|
[aboutTextView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||
|
make.height.mas_equalTo(footerHeight);
|
||
|
}];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
@end
|