首页加载默认皮肤

This commit is contained in:
2026-03-02 20:52:02 +08:00
parent fb6db0649c
commit 2505de0f24
4 changed files with 47 additions and 7 deletions

View File

@@ -74,6 +74,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface KBKeyboardLayout : NSObject @interface KBKeyboardLayout : NSObject
@property (nonatomic, strong, nullable) NSArray<KBKeyboardRowConfig *> *rows; @property (nonatomic, strong, nullable) NSArray<KBKeyboardRowConfig *> *rows;
@property (nonatomic, strong, nullable) NSArray<KBKeyboardRowConfig *> *shiftRows;
@end @end
@interface KBKeyboardLayoutConfig : NSObject @interface KBKeyboardLayoutConfig : NSObject

View File

@@ -82,7 +82,7 @@ static NSString * const kKBKeyboardLayoutI18nFileName = @"kb_keyboard_layouts_i1
@implementation KBKeyboardLayout @implementation KBKeyboardLayout
+ (NSDictionary *)mj_objectClassInArray { + (NSDictionary *)mj_objectClassInArray {
return @{ @"rows": [KBKeyboardRowConfig class] }; return @{ @"rows": [KBKeyboardRowConfig class], @"shiftRows": [KBKeyboardRowConfig class] };
} }
@end @end

View File

@@ -127,7 +127,14 @@ static const CGFloat kKBLettersRow2EdgeSpacerMultiplier = 0.5;
} }
KBKeyboardLayout *layout = [self kb_currentLayout]; KBKeyboardLayout *layout = [self kb_currentLayout];
NSArray<KBKeyboardRowConfig *> *rows = layout.rows ?: @[]; NSArray<KBKeyboardRowConfig *> *rows = nil;
if (self.shiftOn && layout.shiftRows.count > 0) {
rows = layout.shiftRows;
} else {
rows = layout.rows ?: @[];
}
if (rows.count < 4) { if (rows.count < 4) {
[self kb_buildLegacyLayout]; [self kb_buildLegacyLayout];
return; return;

View File

@@ -25,6 +25,7 @@
#import "KBUserSessionManager.h" #import "KBUserSessionManager.h"
#import "KBLoginVC.h" #import "KBLoginVC.h"
#import "KBConfig.h" #import "KBConfig.h"
#import "KBSkinInstallBridge.h"
static NSTimeInterval const kKBSubscriptionPrefillTTL = 10 * 60.0; static NSTimeInterval const kKBSubscriptionPrefillTTL = 10 * 60.0;
@@ -63,11 +64,9 @@ static NSTimeInterval const kKBSubscriptionPrefillTTL = 10 * 60.0;
[KBNetworkManager shared].enabled = YES; [KBNetworkManager shared].enabled = YES;
/// ///
[self getNetJudge]; [self getNetJudge];
///
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ //
[self kb_fireStartupNetworkRequest]; [self kb_installDefaultSkinIfNeeded];
// });
//
#if !DEBUG #if !DEBUG
/// Bugly /// Bugly
@@ -453,4 +452,37 @@ static NSTimeInterval const kKBSubscriptionPrefillTTL = 10 * 60.0;
[rootVC presentViewController:alert animated:YES completion:nil]; [rootVC presentViewController:alert animated:YES completion:nil];
} }
- (void)kb_installDefaultSkinIfNeeded {
static NSString *const kKBDefaultSkinInstalledKey = @"KBDefaultSkinInstalled";
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
if ([ud boolForKey:kKBDefaultSkinInstalledKey]) {
NSLog(@"[AppDelegate] Default skin already installed, skip");
return;
}
NSLog(@"[AppDelegate] Installing default skin for first launch...");
NSString *skinId = @"bundle_skin_default_en";
NSString *zipName = @"normal_them.zip";
NSDictionary<NSString *, NSString *> *iconShortNames = [KBSkinInstallBridge iconShortNamesForLanguageCode:@"en"];
[KBSkinInstallBridge publishBundleSkinRequestWithId:skinId
name:skinId
zipName:zipName
iconShortNames:iconShortNames];
[KBSkinInstallBridge consumePendingRequestFromBundle:[NSBundle mainBundle]
completion:^(BOOL success, NSError * _Nullable error) {
if (success) {
NSLog(@"[AppDelegate] Default skin installed successfully");
[ud setBool:YES forKey:kKBDefaultSkinInstalledKey];
[ud synchronize];
} else {
NSLog(@"[AppDelegate] Default skin install failed: %@", error);
}
}];
}
@end @end