Skip to content

Commit e464438

Browse files
SERDUNclaude
andcommitted
feat: add logging for resolved theme mode and variants
Log the detected themeMode, which variants will be fetched, and whether single-variant mode is active (writing one config to both output files). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0fc8819 commit e464438

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

lib/src/commands/app_resources/processors/theme_config_processor.dart

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,31 @@ class ThemeConfigProcessor {
4141
await writeJsonToFile(resolvePath(assetAppConfigEmbeddedsPath), embedsList, logger: logger);
4242

4343
// 2. Resolve which theme variants to fetch based on themeMode
44-
final variants = _resolveVariants(featureDto.config);
45-
logger.detail('Resolved theme variants: $variants');
44+
final appConfig = AppConfig.fromJson(featureDto.config);
45+
final themeMode = appConfig.supported.whereType<SupportedThemeMode>().firstOrNull;
46+
final variants = _resolveVariants(themeMode);
47+
48+
logger
49+
..info('Theme mode: ${themeMode?.mode.name ?? 'not set (defaulting to light)'}')
50+
..info('Variants to fetch: ${variants.join(', ')}');
51+
if (variants.length == 1) {
52+
logger.info('Single variant mode — ${variants.first} config will be written to both light and dark files');
53+
}
4654

4755
// 3. Write theme configs fetching only needed variants
4856
await _writeColorScheme(applicationId, themeId, resolvePath, variants);
4957
await _writePageConfig(applicationId, themeId, resolvePath, variants);
5058
await _writeWidgetConfig(applicationId, themeId, resolvePath, variants);
5159
}
5260

53-
/// Determines which theme variants (light/dark) to fetch from the backend.
54-
///
55-
/// Deserialises [config] into [AppConfig] from `webtrit_appearance_theme`
56-
/// and looks for [SupportedFeature.themeMode] in [AppConfig.supported].
57-
/// The [ThemeModeConfig] enum (`system`, `light`, `dark`) drives the result.
61+
/// Determines which theme variants (light/dark) to fetch from the backend
62+
/// based on [SupportedThemeMode] from [AppConfig.supported].
5863
///
5964
/// Returns:
6065
/// - `["light", "dark"]` when mode is [ThemeModeConfig.system].
6166
/// - `["dark"]` when mode is [ThemeModeConfig.dark] — only dark exists on the backend.
62-
/// - `["light"]` when mode is [ThemeModeConfig.light] or no themeMode entry found.
63-
List<String> _resolveVariants(Map<String, dynamic> config) {
64-
final appConfig = AppConfig.fromJson(config);
65-
final themeMode = appConfig.supported.whereType<SupportedThemeMode>().firstOrNull;
67+
/// - `["light"]` when mode is [ThemeModeConfig.light] or [themeMode] is null.
68+
List<String> _resolveVariants(SupportedThemeMode? themeMode) {
6669
if (themeMode == null) return ['light'];
6770
return switch (themeMode.mode) {
6871
ThemeModeConfig.system => ['light', 'dark'],

0 commit comments

Comments
 (0)