1
This commit is contained in:
@@ -27,6 +27,8 @@ typedef void(^KBShopPurchaseCompletion)(BOOL success,
|
||||
NSError *_Nullable error);
|
||||
typedef void(^KBShopDownloadInfoCompletion)(NSDictionary *_Nullable info,
|
||||
NSError *_Nullable error);
|
||||
typedef void(^KBShopRestoreCompletion)(BOOL success,
|
||||
NSError *_Nullable error);
|
||||
|
||||
@interface KBShopVM : NSObject
|
||||
@property (nonatomic, copy, readonly, nullable) NSArray<KBShopStyleModel *> *styles;
|
||||
@@ -56,6 +58,10 @@ typedef void(^KBShopDownloadInfoCompletion)(NSDictionary *_Nullable info,
|
||||
/// 推荐主题列表(用于皮肤详情页底部网格)
|
||||
- (void)fetchRecommendedThemesWithCompletion:(KBShopThemesCompletion)completion;
|
||||
|
||||
/// 恢复已删除的主题(/themes/restore)
|
||||
- (void)restoreThemeWithId:(nullable NSString *)themeId
|
||||
completion:(nullable KBShopRestoreCompletion)completion;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -201,6 +201,24 @@
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)restoreThemeWithId:(nullable NSString *)themeId
|
||||
completion:(nullable KBShopRestoreCompletion)completion {
|
||||
if (themeId.length == 0) {
|
||||
if (completion) completion(NO, [self kb_invalidParameterError]);
|
||||
return;
|
||||
}
|
||||
NSDictionary *body = @{@"themeId": [self kb_themeIdParamFromString:themeId]};
|
||||
[[KBNetworkManager shared] POST:API_THEME_RESTORE
|
||||
jsonBody:body
|
||||
headers:nil
|
||||
autoShowBusinessError:NO
|
||||
completion:^(NSDictionary * _Nullable json,
|
||||
NSURLResponse * _Nullable response,
|
||||
NSError * _Nullable error) {
|
||||
if (completion) completion(error == nil, error);
|
||||
}];
|
||||
}
|
||||
|
||||
- (id)kb_themeIdParamFromString:(NSString *)themeId {
|
||||
if (themeId.length == 0) { return @""; }
|
||||
NSNumberFormatter *formatter = [NSNumberFormatter new];
|
||||
|
||||
Reference in New Issue
Block a user