This commit is contained in:
2025-12-12 14:16:48 +08:00
parent 6a5bda44e6
commit 3813974eae
8 changed files with 78 additions and 43 deletions

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "no_data_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "no_data_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

View File

@@ -174,17 +174,19 @@
[self.homeVM addUserCharacterWithId:cid emoji : emoji
completion:^(BOOL success, NSError * _Nullable error) {
if (!success) {
NSString *msg = error.localizedDescription ?: KBLocalized(@"Network error");
[KBHUD showInfo:msg];
return;
}
// if (!success) {
// NSString *msg = error.localizedDescription ?: KBLocalized(@"Network error");
// [KBHUD showInfo:msg];
// return;
// }
//
character.added = YES;
// UI
[self kb_refreshTopThreeView];
[self.tableView reloadData];
if (success) {
character.added = YES;
// UI
[self kb_refreshTopThreeView];
[self.tableView reloadData];
}
}];
}
@@ -221,21 +223,23 @@
[self.homeVM addUserCharacterWithId:cid emoji : emoji
completion:^(BOOL success, NSError * _Nullable error) {
if (!success) {
NSString *msg = error.localizedDescription ?: KBLocalized(@"Network error");
[KBHUD showInfo:msg];
return;
}
// if (!success) {
// NSString *msg = error.localizedDescription ?: KBLocalized(@"Network error");
// [KBHUD showInfo:msg];
// return;
// }
//
mc.added = YES;
NSMutableArray *m = [self.listCharacters mutableCopy];
[m replaceObjectAtIndex:current.row withObject:mc];
self.listCharacters = [m copy];
[self.tableView reloadRowsAtIndexPaths:@[current] withRowAnimation:UITableViewRowAnimationNone];
if (success) {
mc.added = YES;
NSMutableArray *m = [self.listCharacters mutableCopy];
[m replaceObjectAtIndex:current.row withObject:mc];
self.listCharacters = [m copy];
[self.tableView reloadRowsAtIndexPaths:@[current] withRowAnimation:UITableViewRowAnimationNone];
//
[self kb_refreshTopThreeView];
//
[self kb_refreshTopThreeView];
}
}];
};
return cell;

View File

@@ -134,6 +134,10 @@
KBWeakSelf
__weak typeof(cell) weakCell = cell;
cell.onTapAction = ^{
if (![KBUserSessionManager shared].isLoggedIn) {
[[KBUserSessionManager shared] goLoginVC];
return;
}
__strong typeof(weakSelf) self = weakSelf;
HomeRankCardCell *strongCell = weakCell;
if (!self || !strongCell) { return; }
@@ -153,18 +157,20 @@
[self.homeVM addUserCharacterWithId:cid emoji : emoji
completion:^(BOOL success, NSError * _Nullable error) {
if (!success) {
NSString *msg = error.localizedDescription ?: KBLocalized(@"Network error");
[KBHUD showInfo:msg];
return;
}
// if (!success) {
// NSString *msg = error.localizedDescription ?: KBLocalized(@"Network error");
// [KBHUD showInfo:msg];
// return;
// }
// item
mc.added = YES;
NSMutableArray *m = [self.characters mutableCopy];
[m replaceObjectAtIndex:currentIndexPath.item withObject:mc];
self.characters = [m copy];
[self.collectionView reloadItemsAtIndexPaths:@[currentIndexPath]];
if (success) {
mc.added = YES;
NSMutableArray *m = [self.characters mutableCopy];
[m replaceObjectAtIndex:currentIndexPath.item withObject:mc];
self.characters = [m copy];
[self.collectionView reloadItemsAtIndexPaths:@[currentIndexPath]];
}
}];
};
return cell;

View File

@@ -187,6 +187,7 @@
///
- (void)addUserCharacterWithId:(NSNumber *)characterId emoji:(NSString *)emoji
completion:(KBHomeAddUserCharacterCompletion)completion {
[KBHUD show];
if (!characterId) {
if (completion) {
NSError *e = [NSError errorWithDomain:KBNetworkErrorDomain
@@ -209,7 +210,7 @@
// completion(error == nil, error);
// }
// }];
[[KBNetworkManager shared] POST:API_CHARACTER_ADD_USER_CHARACTER jsonBody:params headers:nil autoShowBusinessError:false completion:^(NSDictionary * _Nullable json, NSURLResponse * _Nullable response, NSError * _Nullable error) {
[[KBNetworkManager shared] POST:API_CHARACTER_ADD_USER_CHARACTER jsonBody:params headers:nil autoShowBusinessError:true completion:^(NSDictionary * _Nullable json, NSURLResponse * _Nullable response, NSError * _Nullable error) {
if (!error) {
[self refreshUserCharacterCacheForKeyboard];
}

View File

@@ -68,9 +68,9 @@
make.bottom.equalTo(self.avatarView.mas_bottom);
}];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.avatarView.mas_right).offset(16);
make.centerY.equalTo(self.avatarView);
}];
make.left.equalTo(self.avatarView.mas_right).offset(10);
make.bottom.equalTo(self.avatarView.mas_centerY).offset(-4);
}];
[self.vipIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.nameLabel);
@@ -81,7 +81,7 @@
}];
[self.vipExpiryLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.nameLabel.mas_bottom).offset(6);
make.top.equalTo(self.avatarView.mas_centerY).offset(4);
make.left.equalTo(self.nameLabel);
make.right.lessThanOrEqualTo(self).offset(-16);
}];

View File

@@ -445,11 +445,12 @@ autoShowBusinessError:YES
// code token error
BOOL handledByAuth = [self kb_handleBizCode:bizCode json:dict response:response];
NSString *msg = KBBizMessageFromJSONObject(dict) ?: KBLocalized(@"Server error");
if (autoShowBusinessError) {
dispatch_async(dispatch_get_main_queue(), ^{
[KBHUD dismiss];
[KBHUD showInfo:msg];
});
if (handledByAuth == false) {
if (autoShowBusinessError) {
dispatch_async(dispatch_get_main_queue(), ^{
[KBHUD showInfo:msg];
});
}
}
NSError *bizErr = [NSError errorWithDomain:KBNetworkErrorDomain
code:KBNetworkErrorBusiness
@@ -457,7 +458,7 @@ autoShowBusinessError:YES
NSLocalizedDescriptionKey : msg,
@"code" : @(bizCode)
}];
if (completion) completion(dict, response, bizErr);
// if (completion) completion(dict, response, bizErr);
return;
}
// code
@@ -536,6 +537,7 @@ autoShowBusinessError:YES
dispatch_async(dispatch_get_main_queue(), ^{
// Keychain +
[[KBUserSessionManager shared] logout];
[[KBUserSessionManager shared] goLoginVC];
//
[KBHUD showInfo:msg];
// 广便 UI