2
This commit is contained in:
@@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
// 以 375 宽设计稿为基准的键盘总高度
|
// 以 375 宽设计稿为基准的键盘总高度
|
||||||
static const CGFloat kKBKeyboardBaseHeight = 250.0f;
|
static const CGFloat kKBKeyboardBaseHeight = 250.0f;
|
||||||
|
static NSString * const kKBDefaultSkinId = @"normal_them";
|
||||||
|
static NSString * const kKBDefaultSkinZipName = @"normal_them";
|
||||||
|
|
||||||
static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
|
static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
|
||||||
void *observer,
|
void *observer,
|
||||||
@@ -97,6 +99,7 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
|
|||||||
NULL,
|
NULL,
|
||||||
CFNotificationSuspensionBehaviorDeliverImmediately);
|
CFNotificationSuspensionBehaviorDeliverImmediately);
|
||||||
[self kb_consumePendingShopSkin];
|
[self kb_consumePendingShopSkin];
|
||||||
|
[self kb_applyDefaultSkinIfNeeded];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -763,6 +766,38 @@ static void KBSkinInstallNotificationCallback(CFNotificationCenterRef center,
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - Default Skin
|
||||||
|
|
||||||
|
- (void)kb_applyDefaultSkinIfNeeded {
|
||||||
|
NSDictionary *pending = [KBSkinInstallBridge pendingRequestPayload];
|
||||||
|
if (pending.count > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *currentId = [KBSkinManager shared].current.skinId ?: @"";
|
||||||
|
BOOL isDefault = (currentId.length == 0 || [currentId isEqualToString:@"default"]);
|
||||||
|
if (!isDefault && ![currentId isEqualToString:kKBDefaultSkinId]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ([currentId isEqualToString:kKBDefaultSkinId]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSError *applyError = nil;
|
||||||
|
if ([KBSkinInstallBridge applyInstalledSkinWithId:kKBDefaultSkinId error:&applyError]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
[KBSkinInstallBridge publishBundleSkinRequestWithId:kKBDefaultSkinId
|
||||||
|
name:kKBDefaultSkinId
|
||||||
|
zipName:kKBDefaultSkinZipName
|
||||||
|
iconShortNames:nil];
|
||||||
|
[KBSkinInstallBridge consumePendingRequestFromBundle:NSBundle.mainBundle
|
||||||
|
completion:^(__unused BOOL success, __unused NSError * _Nullable error) {
|
||||||
|
// 已通过通知触发主题刷新,这里无需额外处理
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - Layout Helpers
|
#pragma mark - Layout Helpers
|
||||||
|
|
||||||
- (CGFloat)kb_portraitWidth {
|
- (CGFloat)kb_portraitWidth {
|
||||||
|
|||||||
@@ -26,10 +26,8 @@
|
|||||||
[NSLayoutConstraint activateConstraints:@[
|
[NSLayoutConstraint activateConstraints:@[
|
||||||
[self.normalImageView.topAnchor constraintEqualToAnchor:self.topAnchor],
|
[self.normalImageView.topAnchor constraintEqualToAnchor:self.topAnchor],
|
||||||
[self.normalImageView.bottomAnchor constraintEqualToAnchor:self.bottomAnchor],
|
[self.normalImageView.bottomAnchor constraintEqualToAnchor:self.bottomAnchor],
|
||||||
// [self.normalImageView.leadingAnchor constraintEqualToAnchor:self.leadingAnchor constant:2],
|
[self.normalImageView.leadingAnchor constraintEqualToAnchor:self.leadingAnchor],
|
||||||
// [self.normalImageView.trailingAnchor constraintEqualToAnchor:self.trailingAnchor constant:-2],
|
[self.normalImageView.trailingAnchor constraintEqualToAnchor:self.trailingAnchor],
|
||||||
[self.normalImageView.leadingAnchor constraintEqualToAnchor:self.leadingAnchor constant:0],
|
|
||||||
[self.normalImageView.trailingAnchor constraintEqualToAnchor:self.trailingAnchor constant:-0],
|
|
||||||
]];
|
]];
|
||||||
[self applyDefaultStyle];
|
[self applyDefaultStyle];
|
||||||
}
|
}
|
||||||
@@ -66,8 +64,8 @@
|
|||||||
[NSLayoutConstraint activateConstraints:@[
|
[NSLayoutConstraint activateConstraints:@[
|
||||||
[iv.topAnchor constraintEqualToAnchor:self.topAnchor],
|
[iv.topAnchor constraintEqualToAnchor:self.topAnchor],
|
||||||
[iv.bottomAnchor constraintEqualToAnchor:self.bottomAnchor],
|
[iv.bottomAnchor constraintEqualToAnchor:self.bottomAnchor],
|
||||||
[iv.leadingAnchor constraintEqualToAnchor:self.leadingAnchor constant:2],
|
[iv.leadingAnchor constraintEqualToAnchor:self.leadingAnchor],
|
||||||
[iv.trailingAnchor constraintEqualToAnchor:self.trailingAnchor constant:-2],
|
[iv.trailingAnchor constraintEqualToAnchor:self.trailingAnchor],
|
||||||
]];
|
]];
|
||||||
self.iconView = iv;
|
self.iconView = iv;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user