This commit is contained in:
2025-12-04 16:59:59 +08:00
parent f593ef0b4a
commit 8f63741d8c
5 changed files with 94 additions and 6 deletions

View File

@@ -16,6 +16,7 @@
#import "HomeRankDetailPopView.h"
#import "LSTPopView.h"
#import <HWPanModal/HWPanModal.h>
#import "KBMyVM.h" //
@interface HomeHotVC () <UITableViewDataSource, UITableViewDelegate>
@@ -53,9 +54,24 @@
//
self.homeVM = [KBHomeVM new];
[self kb_reloadRankListWithShowHUD:YES];
//
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(kb_onUserCharacterDeleted:)
name:KBUserCharacterDeletedNotification
object:nil];
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
///
- (void)kb_reloadRankListWithShowHUD:(BOOL)needShow {
KBWeakSelf
[self.homeVM fetchRankListWithParams:nil
needShow:YES
needShow:needShow
completion:^(NSArray<KBCharacter *> * _Nullable list, NSError * _Nullable error) {
if (error) {
// VM HUD
@@ -104,6 +120,26 @@
}];
}
/// id
- (void)kb_onUserCharacterDeleted:(NSNotification *)note {
NSNumber *cid = note.userInfo[@"characterId"];
if (!cid) { return; }
NSInteger targetId = cid.integerValue;
if (targetId <= 0) { return; }
BOOL contains = NO;
for (KBCharacter *c in self.allCharacters) {
if (c.characterId.integerValue == targetId) {
contains = YES;
break;
}
}
if (!contains) { return; }
// HUD
[self kb_reloadRankListWithShowHUD:NO];
}
#pragma mark - UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {