首页加载默认皮肤

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

@@ -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