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
|
[self.homeVM addUserCharacterWithId:cid emoji : emoji
|
||||||
completion:^(BOOL success, NSError * _Nullable error) {
|
completion:^(BOOL success, NSError * _Nullable error) {
|
||||||
if (!success) {
|
// if (!success) {
|
||||||
NSString *msg = error.localizedDescription ?: KBLocalized(@"Network error");
|
// NSString *msg = error.localizedDescription ?: KBLocalized(@"Network error");
|
||||||
[KBHUD showInfo:msg];
|
// [KBHUD showInfo:msg];
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 添加成功:更新模型状态
|
// 添加成功:更新模型状态
|
||||||
character.added = YES;
|
if (success) {
|
||||||
// 刷新顶部与列表 UI
|
character.added = YES;
|
||||||
[self kb_refreshTopThreeView];
|
// 刷新顶部与列表 UI
|
||||||
[self.tableView reloadData];
|
[self kb_refreshTopThreeView];
|
||||||
|
[self.tableView reloadData];
|
||||||
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,21 +223,23 @@
|
|||||||
|
|
||||||
[self.homeVM addUserCharacterWithId:cid emoji : emoji
|
[self.homeVM addUserCharacterWithId:cid emoji : emoji
|
||||||
completion:^(BOOL success, NSError * _Nullable error) {
|
completion:^(BOOL success, NSError * _Nullable error) {
|
||||||
if (!success) {
|
// if (!success) {
|
||||||
NSString *msg = error.localizedDescription ?: KBLocalized(@"Network error");
|
// NSString *msg = error.localizedDescription ?: KBLocalized(@"Network error");
|
||||||
[KBHUD showInfo:msg];
|
// [KBHUD showInfo:msg];
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 添加成功:更新模型状态并刷新当前行(按钮变为已添加且不可再点)
|
// 添加成功:更新模型状态并刷新当前行(按钮变为已添加且不可再点)
|
||||||
mc.added = YES;
|
if (success) {
|
||||||
NSMutableArray *m = [self.listCharacters mutableCopy];
|
mc.added = YES;
|
||||||
[m replaceObjectAtIndex:current.row withObject:mc];
|
NSMutableArray *m = [self.listCharacters mutableCopy];
|
||||||
self.listCharacters = [m copy];
|
[m replaceObjectAtIndex:current.row withObject:mc];
|
||||||
[self.tableView reloadRowsAtIndexPaths:@[current] withRowAnimation:UITableViewRowAnimationNone];
|
self.listCharacters = [m copy];
|
||||||
|
[self.tableView reloadRowsAtIndexPaths:@[current] withRowAnimation:UITableViewRowAnimationNone];
|
||||||
|
|
||||||
// 同步更新顶部前三名的展示状态
|
// 同步更新顶部前三名的展示状态
|
||||||
[self kb_refreshTopThreeView];
|
[self kb_refreshTopThreeView];
|
||||||
|
}
|
||||||
}];
|
}];
|
||||||
};
|
};
|
||||||
return cell;
|
return cell;
|
||||||
|
|||||||
@@ -134,6 +134,10 @@
|
|||||||
KBWeakSelf
|
KBWeakSelf
|
||||||
__weak typeof(cell) weakCell = cell;
|
__weak typeof(cell) weakCell = cell;
|
||||||
cell.onTapAction = ^{
|
cell.onTapAction = ^{
|
||||||
|
if (![KBUserSessionManager shared].isLoggedIn) {
|
||||||
|
[[KBUserSessionManager shared] goLoginVC];
|
||||||
|
return;
|
||||||
|
}
|
||||||
__strong typeof(weakSelf) self = weakSelf;
|
__strong typeof(weakSelf) self = weakSelf;
|
||||||
HomeRankCardCell *strongCell = weakCell;
|
HomeRankCardCell *strongCell = weakCell;
|
||||||
if (!self || !strongCell) { return; }
|
if (!self || !strongCell) { return; }
|
||||||
@@ -153,18 +157,20 @@
|
|||||||
|
|
||||||
[self.homeVM addUserCharacterWithId:cid emoji : emoji
|
[self.homeVM addUserCharacterWithId:cid emoji : emoji
|
||||||
completion:^(BOOL success, NSError * _Nullable error) {
|
completion:^(BOOL success, NSError * _Nullable error) {
|
||||||
if (!success) {
|
// if (!success) {
|
||||||
NSString *msg = error.localizedDescription ?: KBLocalized(@"Network error");
|
// NSString *msg = error.localizedDescription ?: KBLocalized(@"Network error");
|
||||||
[KBHUD showInfo:msg];
|
// [KBHUD showInfo:msg];
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 添加成功:更新模型状态并刷新该 item(按钮变为已添加且不可再点)
|
// 添加成功:更新模型状态并刷新该 item(按钮变为已添加且不可再点)
|
||||||
mc.added = YES;
|
if (success) {
|
||||||
NSMutableArray *m = [self.characters mutableCopy];
|
mc.added = YES;
|
||||||
[m replaceObjectAtIndex:currentIndexPath.item withObject:mc];
|
NSMutableArray *m = [self.characters mutableCopy];
|
||||||
self.characters = [m copy];
|
[m replaceObjectAtIndex:currentIndexPath.item withObject:mc];
|
||||||
[self.collectionView reloadItemsAtIndexPaths:@[currentIndexPath]];
|
self.characters = [m copy];
|
||||||
|
[self.collectionView reloadItemsAtIndexPaths:@[currentIndexPath]];
|
||||||
|
}
|
||||||
}];
|
}];
|
||||||
};
|
};
|
||||||
return cell;
|
return cell;
|
||||||
|
|||||||
@@ -187,6 +187,7 @@
|
|||||||
/// 添加用户人设
|
/// 添加用户人设
|
||||||
- (void)addUserCharacterWithId:(NSNumber *)characterId emoji:(NSString *)emoji
|
- (void)addUserCharacterWithId:(NSNumber *)characterId emoji:(NSString *)emoji
|
||||||
completion:(KBHomeAddUserCharacterCompletion)completion {
|
completion:(KBHomeAddUserCharacterCompletion)completion {
|
||||||
|
[KBHUD show];
|
||||||
if (!characterId) {
|
if (!characterId) {
|
||||||
if (completion) {
|
if (completion) {
|
||||||
NSError *e = [NSError errorWithDomain:KBNetworkErrorDomain
|
NSError *e = [NSError errorWithDomain:KBNetworkErrorDomain
|
||||||
@@ -209,7 +210,7 @@
|
|||||||
// completion(error == nil, error);
|
// 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) {
|
if (!error) {
|
||||||
[self refreshUserCharacterCacheForKeyboard];
|
[self refreshUserCharacterCacheForKeyboard];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,9 +68,9 @@
|
|||||||
make.bottom.equalTo(self.avatarView.mas_bottom);
|
make.bottom.equalTo(self.avatarView.mas_bottom);
|
||||||
}];
|
}];
|
||||||
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.left.equalTo(self.avatarView.mas_right).offset(16);
|
make.left.equalTo(self.avatarView.mas_right).offset(10);
|
||||||
make.centerY.equalTo(self.avatarView);
|
make.bottom.equalTo(self.avatarView.mas_centerY).offset(-4);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self.vipIconView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.vipIconView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.centerY.equalTo(self.nameLabel);
|
make.centerY.equalTo(self.nameLabel);
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
}];
|
}];
|
||||||
|
|
||||||
[self.vipExpiryLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
[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.left.equalTo(self.nameLabel);
|
||||||
make.right.lessThanOrEqualTo(self).offset(-16);
|
make.right.lessThanOrEqualTo(self).offset(-16);
|
||||||
}];
|
}];
|
||||||
|
|||||||
@@ -445,11 +445,12 @@ autoShowBusinessError:YES
|
|||||||
// 非成功业务 code:执行通用处理(如 token 失效)并通过 error 方式回调
|
// 非成功业务 code:执行通用处理(如 token 失效)并通过 error 方式回调
|
||||||
BOOL handledByAuth = [self kb_handleBizCode:bizCode json:dict response:response];
|
BOOL handledByAuth = [self kb_handleBizCode:bizCode json:dict response:response];
|
||||||
NSString *msg = KBBizMessageFromJSONObject(dict) ?: KBLocalized(@"Server error");
|
NSString *msg = KBBizMessageFromJSONObject(dict) ?: KBLocalized(@"Server error");
|
||||||
if (autoShowBusinessError) {
|
if (handledByAuth == false) {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
if (autoShowBusinessError) {
|
||||||
[KBHUD dismiss];
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[KBHUD showInfo:msg];
|
[KBHUD showInfo:msg];
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
NSError *bizErr = [NSError errorWithDomain:KBNetworkErrorDomain
|
NSError *bizErr = [NSError errorWithDomain:KBNetworkErrorDomain
|
||||||
code:KBNetworkErrorBusiness
|
code:KBNetworkErrorBusiness
|
||||||
@@ -457,7 +458,7 @@ autoShowBusinessError:YES
|
|||||||
NSLocalizedDescriptionKey : msg,
|
NSLocalizedDescriptionKey : msg,
|
||||||
@"code" : @(bizCode)
|
@"code" : @(bizCode)
|
||||||
}];
|
}];
|
||||||
if (completion) completion(dict, response, bizErr);
|
// if (completion) completion(dict, response, bizErr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// code 缺失或为成功,按正常成功回调
|
// code 缺失或为成功,按正常成功回调
|
||||||
@@ -536,6 +537,7 @@ autoShowBusinessError:YES
|
|||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
// 清理本地用户会话(Keychain + 用户缓存)
|
// 清理本地用户会话(Keychain + 用户缓存)
|
||||||
[[KBUserSessionManager shared] logout];
|
[[KBUserSessionManager shared] logout];
|
||||||
|
[[KBUserSessionManager shared] goLoginVC];
|
||||||
// 友好提示
|
// 友好提示
|
||||||
[KBHUD showInfo:msg];
|
[KBHUD showInfo:msg];
|
||||||
// 广播通知,便于 UI 侧跳转登录页等
|
// 广播通知,便于 UI 侧跳转登录页等
|
||||||
|
|||||||
Reference in New Issue
Block a user