1
This commit is contained in:
22
keyBoard/Assets.xcassets/Ohter/no_data_icon.imageset/Contents.json
vendored
Normal file
22
keyBoard/Assets.xcassets/Ohter/no_data_icon.imageset/Contents.json
vendored
Normal 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
|
||||
}
|
||||
}
|
||||
BIN
keyBoard/Assets.xcassets/Ohter/no_data_icon.imageset/no_data_icon@2x.png
vendored
Normal file
BIN
keyBoard/Assets.xcassets/Ohter/no_data_icon.imageset/no_data_icon@2x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
BIN
keyBoard/Assets.xcassets/Ohter/no_data_icon.imageset/no_data_icon@3x.png
vendored
Normal file
BIN
keyBoard/Assets.xcassets/Ohter/no_data_icon.imageset/no_data_icon@3x.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 100 KiB |
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}];
|
||||
|
||||
@@ -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 侧跳转登录页等
|
||||
|
||||
Reference in New Issue
Block a user