1
This commit is contained in:
@@ -152,6 +152,18 @@ static void KBSkinDarwinCallback(CFNotificationCenterRef center, void *observer,
|
||||
if ([icons isKindOfClass:NSDictionary.class]) {
|
||||
t.keyIconMap = icons;
|
||||
}
|
||||
NSUInteger iconCount = [t.keyIconMap isKindOfClass:NSDictionary.class] ? t.keyIconMap.count : 0;
|
||||
NSUInteger hiddenCount = t.hiddenKeyTextIdentifiers.count;
|
||||
NSLog(@"[SkinManager] applyThemeFromJSON id=%@ name=%@ iconMap=%tu hiddenKeys=%tu",
|
||||
t.skinId, t.name, iconCount, hiddenCount);
|
||||
if (iconCount > 0) {
|
||||
NSLog(@"[SkinManager] iconMap sample shift=%@ shift_upper=%@ backspace=%@ mode_123=%@ return=%@",
|
||||
t.keyIconMap[@"shift"],
|
||||
t.keyIconMap[@"shift_upper"],
|
||||
t.keyIconMap[@"backspace"],
|
||||
t.keyIconMap[@"mode_123"],
|
||||
t.keyIconMap[@"return"]);
|
||||
}
|
||||
return [self applyTheme:t];
|
||||
}
|
||||
|
||||
@@ -249,6 +261,19 @@ static void KBSkinDarwinCallback(CFNotificationCenterRef center, void *observer,
|
||||
}
|
||||
|
||||
- (UIImage *)iconImageForKeyIdentifier:(NSString *)identifier caseVariant:(NSInteger)caseVariant {
|
||||
#if DEBUG
|
||||
static NSSet<NSString *> *kb_debugIconIds;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
kb_debugIconIds = [NSSet setWithObjects:
|
||||
@"shift", @"backspace", @"mode_123", @"mode_abc",
|
||||
@"symbols_toggle_more", @"symbols_toggle_123",
|
||||
@"return", @"space", @"emoji_panel", @"letter_q",
|
||||
nil];
|
||||
});
|
||||
BOOL shouldLog = [kb_debugIconIds containsObject:identifier];
|
||||
#endif
|
||||
|
||||
NSDictionary<NSString *, NSString *> *map = self.current.keyIconMap;
|
||||
NSString *value = nil;
|
||||
|
||||
@@ -292,10 +317,23 @@ static void KBSkinDarwinCallback(CFNotificationCenterRef center, void *observer,
|
||||
UIImage *img = [UIImage imageWithContentsOfFile:fullPath];
|
||||
if (img) return img;
|
||||
}
|
||||
#if DEBUG
|
||||
if (shouldLog) {
|
||||
NSLog(@"[SkinManager] icon file missing id=%@ value=%@ skin=%@",
|
||||
identifier, value, self.current.skinId ?: @"");
|
||||
}
|
||||
#endif
|
||||
return nil;
|
||||
}
|
||||
// 否则按本地 Assets 名称加载(兼容旧实现)
|
||||
return [UIImage imageNamed:value];
|
||||
UIImage *img = [UIImage imageNamed:value];
|
||||
#if DEBUG
|
||||
if (!img && shouldLog) {
|
||||
NSLog(@"[SkinManager] icon asset missing id=%@ value=%@ skin=%@",
|
||||
identifier, value, self.current.skinId ?: @"");
|
||||
}
|
||||
#endif
|
||||
return img;
|
||||
}
|
||||
|
||||
// 兜底:若 keyIconMap 中没有该键,则按照约定的命名规则直接从 App Group 读取:
|
||||
@@ -329,6 +367,12 @@ static void KBSkinDarwinCallback(CFNotificationCenterRef center, void *observer,
|
||||
if (img) return img;
|
||||
}
|
||||
}
|
||||
#if DEBUG
|
||||
if (shouldLog) {
|
||||
NSLog(@"[SkinManager] icon fallback missing id=%@ variant=%ld skin=%@",
|
||||
identifier, (long)caseVariant, self.current.skinId ?: @"");
|
||||
}
|
||||
#endif
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user