3
This commit is contained in:
@@ -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];
|
_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"];
|
_backgroundImageData = [coder decodeObjectOfClass:NSData.class forKey:@"backgroundImageData"];
|
||||||
// 这两个字段是新增的,旧数据没有也没关系
|
// 这两个字段是新增的,旧数据没有也没关系
|
||||||
_hiddenKeyTextIdentifiers = [coder decodeObjectOfClass:NSArray.class forKey:@"hiddenKeyTextIdentifiers"];
|
// iOS 17 开始需要显式声明容器里元素的类型,否则会提示 validateAllowedClass 警告
|
||||||
_keyIconMap = [coder decodeObjectOfClass:NSDictionary.class forKey:@"keyIconMap"];
|
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;
|
return self;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
|
|||||||
@property (nonatomic, copy) NSArray<NSDictionary *> *gridData; // 底部网格数据
|
@property (nonatomic, copy) NSArray<NSDictionary *> *gridData; // 底部网格数据
|
||||||
@property (nonatomic, strong) KBShopVM *shopVM;
|
@property (nonatomic, strong) KBShopVM *shopVM;
|
||||||
@property (nonatomic, strong, nullable) KBShopThemeDetailModel *detailModel;
|
@property (nonatomic, strong, nullable) KBShopThemeDetailModel *detailModel;
|
||||||
@property (nonatomic, assign) BOOL isProcessingAction;
|
//@property (nonatomic, assign) BOOL isProcessingAction;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation KBSkinDetailVC
|
@implementation KBSkinDetailVC
|
||||||
@@ -212,7 +212,7 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
|
|||||||
|
|
||||||
#pragma mark - Actions
|
#pragma mark - Actions
|
||||||
- (void)handleDownloadAction {
|
- (void)handleDownloadAction {
|
||||||
if (self.isProcessingAction) { return; }
|
// if (self.isProcessingAction) { return; }
|
||||||
if (self.themeId.length == 0) {
|
if (self.themeId.length == 0) {
|
||||||
[KBHUD showInfo:KBLocalized(@"主题信息缺失")];
|
[KBHUD showInfo:KBLocalized(@"主题信息缺失")];
|
||||||
return;
|
return;
|
||||||
@@ -229,13 +229,13 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)purchaseCurrentTheme {
|
- (void)purchaseCurrentTheme {
|
||||||
if (self.isProcessingAction) { return; }
|
// if (self.isProcessingAction) { return; }
|
||||||
self.isProcessingAction = YES;
|
// self.isProcessingAction = YES;
|
||||||
[KBHUD show];
|
[KBHUD show];
|
||||||
__weak typeof(self) weakSelf = self;
|
__weak typeof(self) weakSelf = self;
|
||||||
[self.shopVM purchaseThemeWithId:self.themeId completion:^(BOOL success, NSError * _Nullable error) {
|
[self.shopVM purchaseThemeWithId:self.themeId completion:^(BOOL success, NSError * _Nullable error) {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
weakSelf.isProcessingAction = NO;
|
// weakSelf.isProcessingAction = NO;
|
||||||
[KBHUD dismiss];
|
[KBHUD dismiss];
|
||||||
if (error || !success) {
|
if (error || !success) {
|
||||||
NSString *msg = error.localizedDescription ?: KBLocalized(@"购买失败");
|
NSString *msg = error.localizedDescription ?: KBLocalized(@"购买失败");
|
||||||
@@ -250,8 +250,8 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)requestDownload {
|
- (void)requestDownload {
|
||||||
if (self.isProcessingAction) { return; }
|
// if (self.isProcessingAction) { return; }
|
||||||
self.isProcessingAction = YES;
|
// self.isProcessingAction = YES;
|
||||||
[KBHUD show];
|
[KBHUD show];
|
||||||
NSMutableDictionary *skin = [NSMutableDictionary dictionary];
|
NSMutableDictionary *skin = [NSMutableDictionary dictionary];
|
||||||
if (!skin[@"id"] && self.detailModel.themeId) {
|
if (!skin[@"id"] && self.detailModel.themeId) {
|
||||||
@@ -260,11 +260,9 @@ typedef NS_ENUM(NSInteger, KBSkinDetailSection) {
|
|||||||
if (!skin[@"name"] && self.detailModel.themeName) {
|
if (!skin[@"name"] && self.detailModel.themeName) {
|
||||||
skin[@"name"] = self.detailModel.themeName;
|
skin[@"name"] = self.detailModel.themeName;
|
||||||
}
|
}
|
||||||
if (!skin[@"themeDownloadUrl"]) {
|
|
||||||
[KBHUD showInfo:KBLocalized(@"缺少下载地址")];
|
|
||||||
return;
|
skin[@"zip_url"] = self.detailModel.themeDownloadUrl ? self.detailModel.themeDownloadUrl : @"";
|
||||||
}
|
|
||||||
skin[@"themeDownloadUrl"] = self.detailModel.themeDownloadUrl;
|
|
||||||
|
|
||||||
[[KBSkinService shared] applySkinWithJSON:skin
|
[[KBSkinService shared] applySkinWithJSON:skin
|
||||||
fromViewController:self
|
fromViewController:self
|
||||||
|
|||||||
Reference in New Issue
Block a user