This commit is contained in:
2025-12-11 14:03:13 +08:00
parent 2b4123741a
commit 94269209e0
8 changed files with 68 additions and 7 deletions

View File

@@ -70,6 +70,7 @@ static const CGFloat JXheightForHeaderInSection = 50;
}];
[self fetchShopStylesWithHUD:YES];
[self fetchWalletBalanceWithHUD:NO];
}
// Base VC
@@ -137,6 +138,7 @@ static const CGFloat JXheightForHeaderInSection = 50;
__weak typeof(self)weakSelf = self;
self.pagerView.mainTableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
[weakSelf fetchShopStylesWithHUD:NO];
[weakSelf fetchWalletBalanceWithHUD:NO];
}];
self.pagerView.pinSectionHeaderVerticalOffset = KB_NAV_TOTAL_HEIGHT;
@@ -272,6 +274,28 @@ static const CGFloat JXheightForHeaderInSection = 50;
return _shopVM;
}
- (void)fetchWalletBalanceWithHUD:(BOOL)showHUD {
if (showHUD) {
[KBHUD show];
}
__weak typeof(self) weakSelf = self;
[self.shopVM fetchWalletBalanceWithCompletion:^(NSNumber * _Nullable balance, NSError * _Nullable error) {
dispatch_async(dispatch_get_main_queue(), ^{
if (showHUD) {
[KBHUD dismiss];
}
if (error) {
NSString *msg = error.localizedDescription ?: KBLocalized(@"Network error");
[KBHUD showInfo:msg];
return;
}
double amountValue = balance.doubleValue;
NSString *amountString = [NSString stringWithFormat:@"%.2f", amountValue];
[weakSelf.userHeaderView updatePoints:amountString];
});
}];
}
- (void)fetchShopStylesWithHUD:(BOOL)showHUD {
if (showHUD) {
[KBHUD show];