首页加载默认皮肤
This commit is contained in:
@@ -74,6 +74,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface KBKeyboardLayout : NSObject
|
||||
@property (nonatomic, strong, nullable) NSArray<KBKeyboardRowConfig *> *rows;
|
||||
@property (nonatomic, strong, nullable) NSArray<KBKeyboardRowConfig *> *shiftRows;
|
||||
@end
|
||||
|
||||
@interface KBKeyboardLayoutConfig : NSObject
|
||||
|
||||
@@ -82,7 +82,7 @@ static NSString * const kKBKeyboardLayoutI18nFileName = @"kb_keyboard_layouts_i1
|
||||
@implementation KBKeyboardLayout
|
||||
|
||||
+ (NSDictionary *)mj_objectClassInArray {
|
||||
return @{ @"rows": [KBKeyboardRowConfig class] };
|
||||
return @{ @"rows": [KBKeyboardRowConfig class], @"shiftRows": [KBKeyboardRowConfig class] };
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -127,7 +127,14 @@ static const CGFloat kKBLettersRow2EdgeSpacerMultiplier = 0.5;
|
||||
}
|
||||
|
||||
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) {
|
||||
[self kb_buildLegacyLayout];
|
||||
return;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#import "KBUserSessionManager.h"
|
||||
#import "KBLoginVC.h"
|
||||
#import "KBConfig.h"
|
||||
#import "KBSkinInstallBridge.h"
|
||||
|
||||
static NSTimeInterval const kKBSubscriptionPrefillTTL = 10 * 60.0;
|
||||
|
||||
@@ -63,11 +64,9 @@ static NSTimeInterval const kKBSubscriptionPrefillTTL = 10 * 60.0;
|
||||
[KBNetworkManager shared].enabled = YES;
|
||||
/// 获取网络权限
|
||||
[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
|
||||
/// Bugly
|
||||
@@ -453,4 +452,37 @@ static NSTimeInterval const kKBSubscriptionPrefillTTL = 10 * 60.0;
|
||||
[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
|
||||
|
||||
Reference in New Issue
Block a user