1
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#import "KBPayProductModel.h"
|
||||
#import "KBBizCode.h"
|
||||
#import "KBShopVM.h"
|
||||
#import "IAPVerifyTransactionObj.h"
|
||||
static NSString * const kKBJfPayCellId = @"kKBJfPayCellId";
|
||||
|
||||
@interface KBJfPay () <UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
|
||||
@@ -52,6 +53,10 @@ static NSString * const kKBJfPayCellId = @"kKBJfPayCellId";
|
||||
self.filter = [[FGIAPProductsFilter alloc] init];
|
||||
self.payVM = [PayVM new];
|
||||
self.shopVM = [KBShopVM new];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(handleIAPPurchaseSuccess)
|
||||
name:KBIAPDidCompletePurchaseNotification
|
||||
object:nil];
|
||||
self.data = @[];
|
||||
self.selectedIndex = NSNotFound;
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"my_bg_icon"]];
|
||||
@@ -151,6 +156,10 @@ static NSString * const kKBJfPayCellId = @"kKBJfPayCellId";
|
||||
[self selectItemAtCurrentIndexAnimated:NO];
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
#pragma mark - UICollectionView Delegate (ensure first show)
|
||||
- (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (![cell isKindOfClass:KBJfPayCell.class]) { return; }
|
||||
@@ -242,6 +251,10 @@ static NSString * const kKBJfPayCellId = @"kKBJfPayCellId";
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)handleIAPPurchaseSuccess {
|
||||
[self fetchWalletBalance];
|
||||
}
|
||||
|
||||
- (void)fetchInAppProductList {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[self.payVM fetchInAppProductsNeedShow:YES completion:^(NSInteger sta, NSString * _Nullable msg, NSArray<KBPayProductModel *> * _Nullable products) {
|
||||
|
||||
Reference in New Issue
Block a user