1
This commit is contained in:
@@ -86,6 +86,34 @@ NSString * const KBUserCharacterDeletedNotification = @"KBUserCharacterDeletedNo
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)fetchPurchasedThemesWithCompletion:(KBMyPurchasedThemesCompletion)completion {
|
||||
[[KBNetworkManager shared] GET:API_THEME_PURCHASED
|
||||
parameters:nil
|
||||
headers:nil
|
||||
autoShowBusinessError:NO
|
||||
completion:^(NSDictionary *jsonOrData, NSURLResponse * _Nullable response, NSError * _Nullable error) {
|
||||
if (error) {
|
||||
NSString *msg = KBBizMessageFromJSONObject(jsonOrData) ?: error.localizedDescription ?: KBLocalized(@"Network error");
|
||||
[KBHUD showInfo:msg];
|
||||
if (completion) completion(nil, error);
|
||||
return;
|
||||
}
|
||||
|
||||
id dataObj = jsonOrData[KBData] ?: jsonOrData[@"data"];
|
||||
if (![dataObj isKindOfClass:[NSArray class]]) {
|
||||
NSError *e = [NSError errorWithDomain:KBNetworkErrorDomain
|
||||
code:KBNetworkErrorInvalidResponse
|
||||
userInfo:@{NSLocalizedDescriptionKey: KBLocalized(@"Invalid response")}];
|
||||
[KBHUD showInfo:e.localizedDescription];
|
||||
if (completion) completion(nil, e);
|
||||
return;
|
||||
}
|
||||
|
||||
NSArray<KBMyTheme *> *themes = [KBMyTheme mj_objectArrayWithKeyValuesArray:(NSArray *)dataObj];
|
||||
if (completion) completion(themes, nil);
|
||||
}];
|
||||
}
|
||||
|
||||
/// 更新用户人设排序
|
||||
- (void)updateUserCharacterSortWithSortArray:(NSArray<NSNumber *> *)sortArray
|
||||
completion:(KBUpdateCharacterSortCompletion)completion {
|
||||
|
||||
Reference in New Issue
Block a user