This commit is contained in:
2026-03-10 11:25:10 +08:00
parent 0af7428353
commit 72142b0b71
5 changed files with 109 additions and 17 deletions

View File

@@ -34,6 +34,9 @@ static NSString * const kKBJfPayCellId = @"kKBJfPayCellId";
// /
@property (nonatomic, strong) UIButton *payButton; //
@property (nonatomic, strong) UILabel *agreementLabel; //
@property (nonatomic, strong) UIView *documentContainer;
@property (nonatomic, strong) UIButton *privacyButton;
@property (nonatomic, strong) UILabel *documentSeparatorLabel;
@property (nonatomic, strong) UIButton *agreementButton;
//
@@ -77,7 +80,10 @@ static NSString * const kKBJfPayCellId = @"kKBJfPayCellId";
[self.listContainerView addSubview:self.collectionView];
[self.view addSubview:self.payButton];
[self.view addSubview:self.agreementLabel];
[self.view addSubview:self.agreementButton];
[self.view addSubview:self.documentContainer];
[self.documentContainer addSubview:self.privacyButton];
[self.documentContainer addSubview:self.documentSeparatorLabel];
[self.documentContainer addSubview:self.agreementButton];
// mas
@@ -120,13 +126,24 @@ static NSString * const kKBJfPayCellId = @"kKBJfPayCellId";
make.top.equalTo(self.smallLeftIcon.mas_bottom).offset(19);
}];
[self.agreementButton mas_makeConstraints:^(MASConstraintMaker *make) {
[self.documentContainer mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.view);
make.bottom.equalTo(self.view).offset(-KB_SAFE_BOTTOM - 15);
}];
[self.privacyButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.bottom.equalTo(self.documentContainer);
}];
[self.documentSeparatorLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.privacyButton.mas_right).offset(6);
make.centerY.equalTo(self.documentContainer);
}];
[self.agreementButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.documentSeparatorLabel.mas_right).offset(6);
make.top.right.bottom.equalTo(self.documentContainer);
}];
[self.agreementLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.view);
make.bottom.equalTo(self.agreementButton.mas_top).offset(0);
make.bottom.equalTo(self.documentContainer.mas_top).offset(0);
}];
//
@@ -361,6 +378,10 @@ static NSString * const kKBJfPayCellId = @"kKBJfPayCellId";
[KBWebViewViewController presentLegalDocumentType:KBLegalDocumentTypeMembershipAgreement fromViewController:self];
}
- (void)privacyButtonAction {
[KBWebViewViewController presentLegalDocumentType:KBLegalDocumentTypePrivacyPolicy fromViewController:self];
}
#pragma mark - Lazy UI
- (UILabel *)myPointsTitleLabel {
if (!_myPointsTitleLabel) {
@@ -464,6 +485,35 @@ static NSString * const kKBJfPayCellId = @"kKBJfPayCellId";
}
return _agreementLabel;
}
- (UIView *)documentContainer {
if (!_documentContainer) {
_documentContainer = [UIView new];
}
return _documentContainer;
}
- (UIButton *)privacyButton {
if (!_privacyButton) {
_privacyButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_privacyButton setTitle:KBLocalized(@"Privacy Policy") forState:UIControlStateNormal];
[_privacyButton setTitleColor:[UIColor colorWithHex:KBColorValue] forState:UIControlStateNormal];
_privacyButton.titleLabel.font = [KBFont regular:12];
[_privacyButton addTarget:self action:@selector(privacyButtonAction) forControlEvents:UIControlEventTouchUpInside];
}
return _privacyButton;
}
- (UILabel *)documentSeparatorLabel {
if (!_documentSeparatorLabel) {
_documentSeparatorLabel = [UILabel new];
_documentSeparatorLabel.text = @"|";
_documentSeparatorLabel.textColor = [UIColor colorWithWhite:0.45 alpha:1.0];
_documentSeparatorLabel.font = [KBFont regular:12];
}
return _documentSeparatorLabel;
}
- (UIButton *)agreementButton {
if (!_agreementButton) {
_agreementButton = [UIButton buttonWithType:UIButtonTypeCustom];

View File

@@ -50,6 +50,9 @@ static const CGFloat JXheightForHeaderInSection = 39;
@property (nonatomic, strong) UIView *bottomContainer;
@property (nonatomic, strong) UIButton *payButton;
@property (nonatomic, strong) UILabel *agreementLabel;
@property (nonatomic, strong) UIView *documentContainer;
@property (nonatomic, strong) UIButton *privacyButton;
@property (nonatomic, strong) UILabel *documentSeparatorLabel;
@property (nonatomic, strong) UIButton *agreementButton;
/// Deep link pending config ( VIP )
@@ -214,16 +217,33 @@ static const CGFloat JXheightForHeaderInSection = 39;
[self.view addSubview:self.bottomContainer];
[self.bottomContainer addSubview:self.payButton];
[self.bottomContainer addSubview:self.agreementLabel];
[self.bottomContainer addSubview:self.agreementButton];
[self.bottomContainer addSubview:self.documentContainer];
[self.documentContainer addSubview:self.privacyButton];
[self.documentContainer addSubview:self.documentSeparatorLabel];
[self.documentContainer addSubview:self.agreementButton];
[self.bottomContainer mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.equalTo(self.view);
}];
[self.agreementButton mas_makeConstraints:^(MASConstraintMaker *make) {
[self.documentContainer mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.bottomContainer);
make.bottom.equalTo(self.bottomContainer).offset(-KB_SAFE_BOTTOM - 15);
}];
[self.privacyButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.bottom.equalTo(self.documentContainer);
}];
[self.documentSeparatorLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.privacyButton.mas_right).offset(6);
make.centerY.equalTo(self.documentContainer);
}];
[self.agreementButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.documentSeparatorLabel.mas_right).offset(6);
make.top.right.bottom.equalTo(self.documentContainer);
}];
[self.agreementLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.bottomContainer);
@@ -354,6 +374,10 @@ static const CGFloat JXheightForHeaderInSection = 39;
[KBWebViewViewController presentLegalDocumentType:KBLegalDocumentTypeMembershipAgreement fromViewController:self];
}
- (void)onTapPrivacyButton {
[KBWebViewViewController presentLegalDocumentType:KBLegalDocumentTypePrivacyPolicy fromViewController:self];
}
- (void)onTapRestoreButton {
[[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_vip_restore_btn"
pageId:@"vip_pay"
@@ -436,6 +460,34 @@ static const CGFloat JXheightForHeaderInSection = 39;
return _agreementLabel;
}
- (UIView *)documentContainer {
if (!_documentContainer) {
_documentContainer = [UIView new];
}
return _documentContainer;
}
- (UIButton *)privacyButton {
if (!_privacyButton) {
_privacyButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_privacyButton setTitle:KBLocalized(@"Privacy Policy") forState:UIControlStateNormal];
[_privacyButton setTitleColor:[UIColor colorWithHex:KBColorValue] forState:UIControlStateNormal];
_privacyButton.titleLabel.font = [KBFont regular:12];
[_privacyButton addTarget:self action:@selector(onTapPrivacyButton) forControlEvents:UIControlEventTouchUpInside];
}
return _privacyButton;
}
- (UILabel *)documentSeparatorLabel {
if (!_documentSeparatorLabel) {
_documentSeparatorLabel = [UILabel new];
_documentSeparatorLabel.text = @"|";
_documentSeparatorLabel.textColor = [UIColor colorWithHex:KBBlackValue];
_documentSeparatorLabel.font = [KBFont regular:12];
}
return _documentSeparatorLabel;
}
- (UIButton *)agreementButton {
if (!_agreementButton) {
_agreementButton = [UIButton buttonWithType:UIButtonTypeCustom];

View File

@@ -23,7 +23,6 @@
+ (instancetype)legalViewControllerWithType:(KBLegalDocumentType)type {
KBWebViewViewController *vc = [[KBWebViewViewController alloc] init];
vc.pageTitle = [self kb_titleForLegalDocumentType:type];
NSString *remoteURL = [self kb_remoteURLForLegalDocumentType:type];
if (remoteURL.length > 0) {
vc.url = remoteURL;
@@ -72,15 +71,13 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
if (self.pageTitle.length > 0) {
self.title = self.pageTitle;
}
}
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = UIColor.whiteColor;
[self configUI];
self.kb_titleLabel.hidden = true;
}
- (void)configUI {
@@ -128,9 +125,6 @@
// 5.
if (self.htmlString.length > 0) {
[self.webView loadHTMLString:self.htmlString baseURL:nil];
if (self.pageTitle.length > 0) {
self.title = self.pageTitle;
}
return;
}
@@ -191,9 +185,7 @@
//
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
NSLog(@"页面加载成功");
if (self.pageTitle.length > 0) {
self.title = self.pageTitle;
} else if (webView.title.length > 0) {
if (webView.title.length > 0) {
self.title = webView.title;
}
}