1
This commit is contained in:
@@ -11,6 +11,11 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// 用户人设发生变更(例如从“我的键盘”中删除)时的进程内通知。
|
||||
/// userInfo:
|
||||
/// @"characterId" : NSNumber(NSInteger) 被删除或变更的人设 id
|
||||
extern NSString * const KBUserCharacterDeletedNotification;
|
||||
|
||||
typedef void(^KBMyUserDetailCompletion)(KBUser *_Nullable user, NSError *_Nullable error);
|
||||
typedef void(^KBCharacterListCompletion)(NSArray<KBCharacter *> *characterArray, NSError *_Nullable error);
|
||||
typedef void(^KBUpLoadAvatarCompletion)(BOOL success, NSError * _Nullable error);
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#import "KBUser.h"
|
||||
#import "KBAPI.h"
|
||||
|
||||
NSString * const KBUserCharacterDeletedNotification = @"KBUserCharacterDeletedNotification";
|
||||
|
||||
@implementation KBMyVM
|
||||
|
||||
- (void)fetchUserDetailWithCompletion:(KBMyUserDetailCompletion)completion {
|
||||
@@ -111,7 +113,6 @@
|
||||
}
|
||||
|
||||
NSDictionary *params = @{@"id": characterId};
|
||||
[KBHUD show];
|
||||
[[KBNetworkManager shared] GET:API_CHARACTER_DEL_USER_CHARACTER
|
||||
parameters:params
|
||||
headers:nil
|
||||
@@ -119,9 +120,20 @@
|
||||
completion:^(NSDictionary *jsonOrData,
|
||||
NSURLResponse * _Nullable response,
|
||||
NSError * _Nullable error) {
|
||||
[KBHUD dismiss];
|
||||
BOOL success = (error == nil);
|
||||
|
||||
if (success) {
|
||||
// 通知 App 内其他页面(如 HomeRankContentVC / HomeHotVC)该人设已被删除
|
||||
NSDictionary *info = @{@"characterId": characterId ?: @0};
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:KBUserCharacterDeletedNotification
|
||||
object:nil
|
||||
userInfo:info];
|
||||
});
|
||||
}
|
||||
|
||||
if (completion) {
|
||||
completion(error == nil, error);
|
||||
completion(success, error);
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user