1
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#import "JXPagerView.h"
|
||||
#import "PagingViewTableHeaderView.h"
|
||||
#import "JXCategoryTitleView.h"
|
||||
#import "keyBoard-Swift.h"
|
||||
|
||||
static const CGFloat JXTableHeaderViewHeight = 224;
|
||||
static const CGFloat JXheightForHeaderInSection = 39;
|
||||
@@ -31,6 +32,7 @@ static const CGFloat JXheightForHeaderInSection = 39;
|
||||
@property (nonatomic, strong) JXPagerView *pagerView;
|
||||
@property (nonatomic, strong) PagingViewTableHeaderView *userHeaderView;
|
||||
//@property (nonatomic, strong, readonly) JXCategoryTitleView *categoryView;
|
||||
@property (nonatomic, strong) UIView *categoryContainer; // categoryView 容器
|
||||
@property (nonatomic, strong) JXCategoryImageView *myCategoryView;
|
||||
|
||||
@property (nonatomic, assign) BOOL isNeedFooter;
|
||||
@@ -41,6 +43,7 @@ static const CGFloat JXheightForHeaderInSection = 39;
|
||||
|
||||
@property (nonatomic, strong) UIView *naviBGView;
|
||||
@property (nonatomic, strong) UIButton *closeButton; // 当前选中的方案索引
|
||||
@property (nonatomic, strong) UIButton *restoreButton;
|
||||
|
||||
@end
|
||||
|
||||
@@ -56,8 +59,23 @@ static const CGFloat JXheightForHeaderInSection = 39;
|
||||
NSArray *selectedImageNames = @[@"VIP_Selected_icon", @"SVIP_Selected_icon"];
|
||||
|
||||
_userHeaderView = [[PagingViewTableHeaderView alloc] init];
|
||||
self.myCategoryView = [[JXCategoryImageView alloc] initWithFrame:CGRectMake(24, 0, KB_SCREEN_WIDTH - 48, JXheightForHeaderInSection)];
|
||||
self.myCategoryView.backgroundColor = [UIColor redColor];
|
||||
|
||||
// 创建容器视图
|
||||
self.categoryContainer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KB_SCREEN_WIDTH, JXheightForHeaderInSection)];
|
||||
self.categoryContainer.backgroundColor = [UIColor clearColor];
|
||||
|
||||
// categoryView 放在容器内
|
||||
self.myCategoryView = [[JXCategoryImageView alloc] init];
|
||||
self.myCategoryView.backgroundColor = [UIColor whiteColor];
|
||||
self.myCategoryView.layer.cornerRadius = JXheightForHeaderInSection * 0.5;
|
||||
self.myCategoryView.layer.masksToBounds = true;
|
||||
[self.categoryContainer addSubview:self.myCategoryView];
|
||||
[self.myCategoryView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.categoryContainer).offset(KBFit(24));
|
||||
make.right.equalTo(self.categoryContainer).offset(-KBFit(24));
|
||||
make.top.bottom.equalTo(self.categoryContainer);
|
||||
}];
|
||||
|
||||
self.myCategoryView.imageInfoArray = self.imageNames;
|
||||
self.myCategoryView.selectedImageInfoArray = selectedImageNames;
|
||||
self.myCategoryView.loadImageBlock = ^(UIImageView *imageView, id info) {
|
||||
@@ -66,6 +84,10 @@ static const CGFloat JXheightForHeaderInSection = 39;
|
||||
};
|
||||
// self.myCategoryView.imageZoomEnabled = YES;
|
||||
self.myCategoryView.imageCornerRadius = 0;
|
||||
self.myCategoryView.contentEdgeInsetLeft = 0;
|
||||
self.myCategoryView.contentEdgeInsetRight = 0;
|
||||
self.myCategoryView.cellSpacing = 4;
|
||||
|
||||
self.myCategoryView.imageSize = CGSizeMake(160, JXheightForHeaderInSection);
|
||||
// JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init];
|
||||
// lineView.indicatorWidth = 20;
|
||||
@@ -84,7 +106,7 @@ static const CGFloat JXheightForHeaderInSection = 39;
|
||||
|
||||
self.automaticallyAdjustsScrollViewInsets = NO;
|
||||
CGFloat naviHeight = KB_NAV_TOTAL_HEIGHT;
|
||||
self.pagerView.pinSectionHeaderVerticalOffset = naviHeight;
|
||||
self.pagerView.pinSectionHeaderVerticalOffset = naviHeight + 16;
|
||||
|
||||
self.naviBGView = [[UIView alloc] init];
|
||||
self.naviBGView.alpha = 0;
|
||||
@@ -93,7 +115,7 @@ static const CGFloat JXheightForHeaderInSection = 39;
|
||||
[self.view addSubview:self.naviBGView];
|
||||
|
||||
UILabel *naviTitleLabel = [[UILabel alloc] init];
|
||||
naviTitleLabel.text = @"导航栏隐藏";
|
||||
naviTitleLabel.text = KBLocalized(@"Member recharge");
|
||||
naviTitleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
naviTitleLabel.frame = CGRectMake(0, KB_STATUSBAR_HEIGHT, self.view.bounds.size.width, 44);
|
||||
[self.naviBGView addSubview:naviTitleLabel];
|
||||
@@ -101,12 +123,22 @@ static const CGFloat JXheightForHeaderInSection = 39;
|
||||
|
||||
[self.view addSubview:self.closeButton];
|
||||
[self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.view).offset(KB_NAV_TOTAL_HEIGHT - 30);
|
||||
make.top.equalTo(self.view).offset(KB_NAV_TOTAL_HEIGHT - 40);
|
||||
make.left.equalTo(self.view).offset(15);
|
||||
make.width.height.mas_equalTo(36);
|
||||
}];
|
||||
|
||||
[self.view addSubview:self.restoreButton];
|
||||
[self.restoreButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.equalTo(self.closeButton);
|
||||
make.right.equalTo(self.view).offset(-15);
|
||||
make.width.mas_equalTo(90);
|
||||
make.height.mas_equalTo(32);
|
||||
}];
|
||||
|
||||
|
||||
self.pagerView.mainTableView.backgroundColor = [UIColor colorWithHex:0xF6F7FB];
|
||||
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
@@ -146,7 +178,7 @@ static const CGFloat JXheightForHeaderInSection = 39;
|
||||
}
|
||||
|
||||
- (UIView *)viewForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
|
||||
return self.myCategoryView;
|
||||
return self.categoryContainer;
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfListsInPagerView:(JXPagerView *)pagerView {
|
||||
@@ -199,6 +231,25 @@ static const CGFloat JXheightForHeaderInSection = 39;
|
||||
[self.navigationController popViewControllerAnimated:true];
|
||||
}
|
||||
|
||||
- (void)onTapRestoreButton {
|
||||
[[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_vip_restore_btn"
|
||||
pageId:@"vip_pay"
|
||||
elementId:@"restore_btn"
|
||||
extra:nil
|
||||
completion:nil];
|
||||
[KBHUD show];
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[[KBStoreKitBridge shared] restorePurchasesWithCompletion:^(BOOL success, NSString * _Nullable message) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
__strong typeof(weakSelf) self = weakSelf;
|
||||
(void)self;
|
||||
[KBHUD dismiss];
|
||||
NSString *tip = message.length ? message : (success ? KBLocalized(@"Success") : KBLocalized(@"Failed"));
|
||||
[KBHUD showInfo:tip];
|
||||
});
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - lazy
|
||||
- (UIButton *)closeButton {
|
||||
if (!_closeButton) {
|
||||
@@ -208,4 +259,22 @@ static const CGFloat JXheightForHeaderInSection = 39;
|
||||
}
|
||||
return _closeButton;
|
||||
}
|
||||
- (UIButton *)restoreButton {
|
||||
if (!_restoreButton) {
|
||||
_restoreButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
_restoreButton.backgroundColor = [[UIColor colorWithHex:0xF6F7FB] colorWithAlphaComponent:0.72];
|
||||
_restoreButton.layer.cornerRadius = 8;
|
||||
_restoreButton.layer.masksToBounds = YES;
|
||||
UIImage *icon = [UIImage imageNamed:@"pay_resh_icon"];
|
||||
[_restoreButton setImage:icon forState:UIControlStateNormal];
|
||||
[_restoreButton setTitle:KBLocalized(@"Resume Purchase") forState:UIControlStateNormal];
|
||||
[_restoreButton setTitleColor:[UIColor colorWithHex:0x02BEAC] forState:UIControlStateNormal];
|
||||
_restoreButton.titleLabel.font = [KBFont medium:10];
|
||||
_restoreButton.contentEdgeInsets = UIEdgeInsetsMake(0, 12, 0, 12);
|
||||
_restoreButton.imageEdgeInsets = UIEdgeInsetsMake(0, -4, 0, 4);
|
||||
_restoreButton.titleEdgeInsets = UIEdgeInsetsMake(0, 6, 0, -6);
|
||||
[_restoreButton addTarget:self action:@selector(onTapRestoreButton) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _restoreButton;
|
||||
}
|
||||
@end
|
||||
|
||||
@@ -92,14 +92,14 @@ static NSString * const kKBSvipBenefitHeaderId = @"kKBSvipBenefitHeaderId";
|
||||
|
||||
// 权益列表数据(使用现有图标资源)
|
||||
self.benefits = @[
|
||||
@{@"icon": @"pay_ai_icon", @"title": KBLocalized(@"Wireless Sub-ai Dialogue")},
|
||||
@{@"icon": @"pay_keyboard_icon", @"title": KBLocalized(@"Personalized Keyboard")},
|
||||
@{@"icon": @"pay_chat_icon", @"title": KBLocalized(@"Chat Persona")},
|
||||
@{@"icon": @"pay_emotion_icon", @"title": KBLocalized(@"Emotional Counseling")},
|
||||
@{@"icon": @"pay_chat_icon", @"title": KBLocalized(@"Longer Chat History")},
|
||||
@{@"icon": @"pay_chat_icon", @"title": KBLocalized(@"Unlimited Chatting")},
|
||||
@{@"icon": @"pay_ai_icon", @"title": KBLocalized(@"Chat Without Speed Limits")},
|
||||
@{@"icon": @"pay_vip_icon", @"title": KBLocalized(@"Coming Soon")},
|
||||
@{@"icon": @"pay_ais_icon", @"title": KBLocalized(@"Wireless Sub-ai Dialogue")},
|
||||
@{@"icon": @"pay_keyboards_icon", @"title": KBLocalized(@"Personalized Keyboard")},
|
||||
@{@"icon": @"pay_person_icon", @"title": KBLocalized(@"Chat Persona")},
|
||||
@{@"icon": @"pay_phone_icon", @"title": KBLocalized(@"Emotional Counseling")},
|
||||
@{@"icon": @"pay_history_icon", @"title": KBLocalized(@"Longer Chat History")},
|
||||
@{@"icon": @"pay_chats_icon", @"title": KBLocalized(@"Unlimited Chatting")},
|
||||
@{@"icon": @"pay_speed_icon", @"title": KBLocalized(@"Chat Without Speed Limits")},
|
||||
@{@"icon": @"pay_soon_icon", @"title": KBLocalized(@"Coming Soon")},
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ static NSString * const kKBVipReviewListCellId = @"kKBVipReviewListCellId";
|
||||
@property (nonatomic, strong) UICollectionView *collectionView; // 主列表(竖向滚动)
|
||||
@property (nonatomic, strong) NSArray<KBPayProductModel *> *plans; // 订阅方案数组
|
||||
@property (nonatomic, assign) NSInteger selectedIndex; // 当前选中的方案索引
|
||||
@property (nonatomic, strong) UIButton *restoreButton;
|
||||
@property (nonatomic, strong) UIImageView *bgImageView; // 全屏背景图
|
||||
// Header 自适应测量
|
||||
@property (nonatomic, strong) KBVipPayHeaderView *sizingHeader;
|
||||
@@ -92,12 +91,6 @@ static NSString * const kKBVipReviewListCellId = @"kKBVipReviewListCellId";
|
||||
make.bottom.equalTo(self.payButton.mas_top).offset(-16);
|
||||
}];
|
||||
|
||||
[self.view addSubview:self.restoreButton];
|
||||
[self.restoreButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.view).offset(KB_NAV_TOTAL_HEIGHT - 30); make.right.equalTo(self.view).offset(-15);
|
||||
make.width.mas_equalTo(123);
|
||||
make.height.mas_equalTo(32);
|
||||
}];
|
||||
|
||||
// 预计算 Header 高度(由内部约束决定)
|
||||
self.headerHeight = [self kb_calcHeaderHeightForWidth:KB_SCREEN_WIDTH];
|
||||
@@ -334,24 +327,7 @@ static NSString * const kKBVipReviewListCellId = @"kKBVipReviewListCellId";
|
||||
[KBHUD showInfo:KBLocalized(@"Open agreement")];
|
||||
}
|
||||
|
||||
- (void)onTapRestoreButton {
|
||||
[[KBMaiPointReporter sharedReporter] reportClickWithEventName:@"click_vip_restore_btn"
|
||||
pageId:@"vip_pay"
|
||||
elementId:@"restore_btn"
|
||||
extra:nil
|
||||
completion:nil];
|
||||
[KBHUD show];
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[[KBStoreKitBridge shared] restorePurchasesWithCompletion:^(BOOL success, NSString * _Nullable message) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
__strong typeof(weakSelf) self = weakSelf;
|
||||
(void)self;
|
||||
[KBHUD dismiss];
|
||||
NSString *tip = message.length ? message : (success ? KBLocalized(@"Success") : KBLocalized(@"Failed"));
|
||||
[KBHUD showInfo:tip];
|
||||
});
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UICollectionView DataSource
|
||||
|
||||
@@ -492,24 +468,7 @@ static NSString * const kKBVipReviewListCellId = @"kKBVipReviewListCellId";
|
||||
|
||||
|
||||
|
||||
- (UIButton *)restoreButton {
|
||||
if (!_restoreButton) {
|
||||
_restoreButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
_restoreButton.backgroundColor = [[UIColor colorWithHex:0xF6F7FB] colorWithAlphaComponent:0.72];
|
||||
_restoreButton.layer.cornerRadius = 8;
|
||||
_restoreButton.layer.masksToBounds = YES;
|
||||
UIImage *icon = [UIImage imageNamed:@"pay_resh_icon"];
|
||||
[_restoreButton setImage:icon forState:UIControlStateNormal];
|
||||
[_restoreButton setTitle:KBLocalized(@"Resume Purchase") forState:UIControlStateNormal];
|
||||
[_restoreButton setTitleColor:[UIColor colorWithHex:0x02BEAC] forState:UIControlStateNormal];
|
||||
_restoreButton.titleLabel.font = [KBFont medium:10];
|
||||
_restoreButton.contentEdgeInsets = UIEdgeInsetsMake(0, 12, 0, 12);
|
||||
_restoreButton.imageEdgeInsets = UIEdgeInsetsMake(0, -4, 0, 4);
|
||||
_restoreButton.titleEdgeInsets = UIEdgeInsetsMake(0, 6, 0, -6);
|
||||
[_restoreButton addTarget:self action:@selector(onTapRestoreButton) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _restoreButton;
|
||||
}
|
||||
|
||||
|
||||
- (UIButton *)payButton {
|
||||
if (!_payButton) {
|
||||
|
||||
Reference in New Issue
Block a user