From f338a54e41b88fd753a2769bfb98796e8edfed52 Mon Sep 17 00:00:00 2001 From: CodeST <694468528@qq.com> Date: Thu, 11 Dec 2025 16:59:14 +0800 Subject: [PATCH] 3 --- Shared/KBSkinManager.m | 8 ++++++-- keyBoard/Class/Shop/VC/KBSkinDetailVC.m | 22 ++++++++++------------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Shared/KBSkinManager.m b/Shared/KBSkinManager.m index 9d5adbe..73293c3 100644 --- a/Shared/KBSkinManager.m +++ b/Shared/KBSkinManager.m @@ -45,8 +45,12 @@ static NSString * const kKBSkinThemeStoreKey = @"KBSkinThemeCurrent"; _accentColor = [coder decodeObjectOfClass:UIColor.class forKey:@"accentColor"] ?: [UIColor colorWithRed:0.77 green:0.93 blue:0.82 alpha:1.0]; _backgroundImageData = [coder decodeObjectOfClass:NSData.class forKey:@"backgroundImageData"]; // 这两个字段是新增的,旧数据没有也没关系 - _hiddenKeyTextIdentifiers = [coder decodeObjectOfClass:NSArray.class forKey:@"hiddenKeyTextIdentifiers"]; - _keyIconMap = [coder decodeObjectOfClass:NSDictionary.class forKey:@"keyIconMap"]; + // iOS 17 开始需要显式声明容器里元素的类型,否则会提示 validateAllowedClass 警告 + NSSet *arrayClasses = [NSSet setWithObjects:NSArray.class, NSString.class, nil]; + _hiddenKeyTextIdentifiers = [coder decodeObjectOfClasses:arrayClasses forKey:@"hiddenKeyTextIdentifiers"]; + + NSSet *dictClasses = [NSSet setWithObjects:NSDictionary.class, NSString.class, NSNumber.class, nil]; + _keyIconMap = [coder decodeObjectOfClasses:dictClasses forKey:@"keyIconMap"]; } return self; } diff --git a/keyBoard/Class/Shop/VC/KBSkinDetailVC.m b/keyBoard/Class/Shop/VC/KBSkinDetailVC.m index 889e98a..fb12dd0 100644 --- a/keyBoard/Class/Shop/VC/KBSkinDetailVC.m +++ b/keyBoard/Class/Shop/VC/KBSkinDetailVC.m @@ -36,7 +36,7 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) { @property (nonatomic, copy) NSArray *gridData; // 底部网格数据 @property (nonatomic, strong) KBShopVM *shopVM; @property (nonatomic, strong, nullable) KBShopThemeDetailModel *detailModel; -@property (nonatomic, assign) BOOL isProcessingAction; +//@property (nonatomic, assign) BOOL isProcessingAction; @end @implementation KBSkinDetailVC @@ -212,7 +212,7 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) { #pragma mark - Actions - (void)handleDownloadAction { - if (self.isProcessingAction) { return; } +// if (self.isProcessingAction) { return; } if (self.themeId.length == 0) { [KBHUD showInfo:KBLocalized(@"主题信息缺失")]; return; @@ -229,13 +229,13 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) { } - (void)purchaseCurrentTheme { - if (self.isProcessingAction) { return; } - self.isProcessingAction = YES; +// if (self.isProcessingAction) { return; } +// self.isProcessingAction = YES; [KBHUD show]; __weak typeof(self) weakSelf = self; [self.shopVM purchaseThemeWithId:self.themeId completion:^(BOOL success, NSError * _Nullable error) { dispatch_async(dispatch_get_main_queue(), ^{ - weakSelf.isProcessingAction = NO; +// weakSelf.isProcessingAction = NO; [KBHUD dismiss]; if (error || !success) { NSString *msg = error.localizedDescription ?: KBLocalized(@"购买失败"); @@ -250,8 +250,8 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) { } - (void)requestDownload { - if (self.isProcessingAction) { return; } - self.isProcessingAction = YES; +// if (self.isProcessingAction) { return; } +// self.isProcessingAction = YES; [KBHUD show]; NSMutableDictionary *skin = [NSMutableDictionary dictionary]; if (!skin[@"id"] && self.detailModel.themeId) { @@ -260,11 +260,9 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) { if (!skin[@"name"] && self.detailModel.themeName) { skin[@"name"] = self.detailModel.themeName; } - if (!skin[@"themeDownloadUrl"]) { - [KBHUD showInfo:KBLocalized(@"缺少下载地址")]; - return; - } - skin[@"themeDownloadUrl"] = self.detailModel.themeDownloadUrl; + + + skin[@"zip_url"] = self.detailModel.themeDownloadUrl ? self.detailModel.themeDownloadUrl : @""; [[KBSkinService shared] applySkinWithJSON:skin fromViewController:self