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

@@ -14,7 +14,6 @@ NS_ASSUME_NONNULL_BEGIN
/// 通用入口:优先尝试 primaryURL失败后尝试 fallbackURL /// 通用入口:优先尝试 primaryURL失败后尝试 fallbackURL
/// 均通过 `extensionContext openURL` 发起跳转(避免使用扩展禁用 API/响应链绕行)。 /// 均通过 `extensionContext openURL` 发起跳转(避免使用扩展禁用 API/响应链绕行)。
/// 若开启 `KB_URL_BRIDGE_ENABLE=1`,会在两次 `extensionContext openURL` 均失败时, /// 若开启 `KB_URL_BRIDGE_ENABLE=1`,会在两次 `extensionContext openURL` 均失败时,
/// 再尝试一次“响应链 openURL”兜底上架有风险请谨慎开启
/// - Parameters: /// - Parameters:
/// - primaryURL: 第一优先尝试的 URL可为 Scheme 或 UL /// - primaryURL: 第一优先尝试的 URL可为 Scheme 或 UL
/// - fallbackURL: 失败时的备用 URL可为 nil /// - fallbackURL: 失败时的备用 URL可为 nil

View File

@@ -121,7 +121,6 @@
} }
#if KB_URL_BRIDGE_ENABLE #if KB_URL_BRIDGE_ENABLE
// 宿 App extensionContext openURL
// //
UIResponder *start = (source ?: (UIResponder *)ivc.view ?: (UIResponder *)ivc); UIResponder *start = (source ?: (UIResponder *)ivc.view ?: (UIResponder *)ivc);
[self kb_openURLViaResponderChain:second [self kb_openURLViaResponderChain:second

View File

@@ -34,6 +34,9 @@ static NSString * const kKBJfPayCellId = @"kKBJfPayCellId";
// / // /
@property (nonatomic, strong) UIButton *payButton; // @property (nonatomic, strong) UIButton *payButton; //
@property (nonatomic, strong) UILabel *agreementLabel; // @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; @property (nonatomic, strong) UIButton *agreementButton;
// //
@@ -77,7 +80,10 @@ static NSString * const kKBJfPayCellId = @"kKBJfPayCellId";
[self.listContainerView addSubview:self.collectionView]; [self.listContainerView addSubview:self.collectionView];
[self.view addSubview:self.payButton]; [self.view addSubview:self.payButton];
[self.view addSubview:self.agreementLabel]; [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 // mas
@@ -120,13 +126,24 @@ static NSString * const kKBJfPayCellId = @"kKBJfPayCellId";
make.top.equalTo(self.smallLeftIcon.mas_bottom).offset(19); 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.centerX.equalTo(self.view);
make.bottom.equalTo(self.view).offset(-KB_SAFE_BOTTOM - 15); 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) { [self.agreementLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.view); 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]; [KBWebViewViewController presentLegalDocumentType:KBLegalDocumentTypeMembershipAgreement fromViewController:self];
} }
- (void)privacyButtonAction {
[KBWebViewViewController presentLegalDocumentType:KBLegalDocumentTypePrivacyPolicy fromViewController:self];
}
#pragma mark - Lazy UI #pragma mark - Lazy UI
- (UILabel *)myPointsTitleLabel { - (UILabel *)myPointsTitleLabel {
if (!_myPointsTitleLabel) { if (!_myPointsTitleLabel) {
@@ -464,6 +485,35 @@ static NSString * const kKBJfPayCellId = @"kKBJfPayCellId";
} }
return _agreementLabel; 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 { - (UIButton *)agreementButton {
if (!_agreementButton) { if (!_agreementButton) {
_agreementButton = [UIButton buttonWithType:UIButtonTypeCustom]; _agreementButton = [UIButton buttonWithType:UIButtonTypeCustom];

View File

@@ -50,6 +50,9 @@ static const CGFloat JXheightForHeaderInSection = 39;
@property (nonatomic, strong) UIView *bottomContainer; @property (nonatomic, strong) UIView *bottomContainer;
@property (nonatomic, strong) UIButton *payButton; @property (nonatomic, strong) UIButton *payButton;
@property (nonatomic, strong) UILabel *agreementLabel; @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; @property (nonatomic, strong) UIButton *agreementButton;
/// Deep link pending config ( VIP ) /// Deep link pending config ( VIP )
@@ -214,16 +217,33 @@ static const CGFloat JXheightForHeaderInSection = 39;
[self.view addSubview:self.bottomContainer]; [self.view addSubview:self.bottomContainer];
[self.bottomContainer addSubview:self.payButton]; [self.bottomContainer addSubview:self.payButton];
[self.bottomContainer addSubview:self.agreementLabel]; [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) { [self.bottomContainer mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.equalTo(self.view); 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.centerX.equalTo(self.bottomContainer);
make.bottom.equalTo(self.bottomContainer).offset(-KB_SAFE_BOTTOM - 15); 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) { [self.agreementLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.bottomContainer); make.centerX.equalTo(self.bottomContainer);
@@ -354,6 +374,10 @@ static const CGFloat JXheightForHeaderInSection = 39;
[KBWebViewViewController presentLegalDocumentType:KBLegalDocumentTypeMembershipAgreement fromViewController:self]; [KBWebViewViewController presentLegalDocumentType:KBLegalDocumentTypeMembershipAgreement fromViewController:self];
} }
- (void)onTapPrivacyButton {
[KBWebViewViewController presentLegalDocumentType:KBLegalDocumentTypePrivacyPolicy fromViewController:self];
}
- (void)onTapRestoreButton { - (void)onTapRestoreButton {
[[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_vip_restore_btn" [[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_vip_restore_btn"
pageId:@"vip_pay" pageId:@"vip_pay"
@@ -436,6 +460,34 @@ static const CGFloat JXheightForHeaderInSection = 39;
return _agreementLabel; 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 { - (UIButton *)agreementButton {
if (!_agreementButton) { if (!_agreementButton) {
_agreementButton = [UIButton buttonWithType:UIButtonTypeCustom]; _agreementButton = [UIButton buttonWithType:UIButtonTypeCustom];

View File

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