This commit is contained in:
2025-12-22 19:19:28 +08:00
parent 5cfc76e6c5
commit 4e6fd90668
20 changed files with 679 additions and 3 deletions

View File

@@ -293,7 +293,10 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
mode:KBSkinSourceModeRemoteZip
completion:^(BOOL success) {
if (success) {
// [KBHUD showSuccess:KBLocalized(@"已开始下载")];
NSString *themeId = self.detailModel.themeId;
if (themeId.length > 0) {
[self.shopVM restoreThemeWithId:themeId completion:nil];
}
} else {
[KBHUD showInfo:KBLocalized(@"下载失败")];
}

View File

@@ -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

View File

@@ -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];