@@ -288,23 +288,7 @@ class ConfiguratorGetResourcesCommand extends Command<int> {
288288 // _logger.err('✗ Failed to write $notificationLogoPath with $notificationLogo');
289289 // }
290290
291- final widgetsConfigDTO = await _datasource.getWidgetConfigByThemeVariant (
292- applicationId: applicationId, themeId: theme.id! , variant: 'light' );
293- final themeWidgetConfig = ThemeWidgetConfig .fromJson (widgetsConfigDTO.config);
294-
295- final metadataPrimaryOnboardingLogoUrl = themeWidgetConfig.imageAssets.primaryOnboardingLogo.imageSource? .uri;
296- await _downloadAndSave (
297- url: metadataPrimaryOnboardingLogoUrl,
298- relativePath: assetImagePrimaryOnboardingLogoPath,
299- assetLabel: 'primary onboarding logo' ,
300- );
301-
302- final metadataSecondaryOnboardingLogoUrl = themeWidgetConfig.imageAssets.secondaryOnboardingLogo.imageSource? .uri;
303- await _downloadAndSave (
304- url: metadataSecondaryOnboardingLogoUrl,
305- relativePath: assetImageSecondaryOnboardingLogoPath,
306- assetLabel: 'secondary onboarding logo' ,
307- );
291+ // Widget config and onboarding logos are handled in _writeWidgetsLightConfig to avoid duplicate requests.
308292
309293 try {
310294 await _configureTheme (applicationId, theme.id! );
@@ -472,9 +456,27 @@ class ConfiguratorGetResourcesCommand extends Command<int> {
472456 /// Writes widgets config for light (and temporary dark copy).
473457 Future <void > _writeWidgetsLightConfig (String applicationId, String themeId) async {
474458 final widgetsConfigDTO = await _datasource.getWidgetConfigByThemeVariant (
475- applicationId: applicationId, themeId: themeId, variant: 'light' );
459+ applicationId: applicationId,
460+ themeId: themeId,
461+ variant: 'light' ,
462+ );
476463 final themeWidgetConfig = ThemeWidgetConfig .fromJson (widgetsConfigDTO.config);
477464
465+ // Download onboarding logos once here to avoid duplicate API calls.
466+ final primaryLogoUrl = themeWidgetConfig.imageAssets.primaryOnboardingLogo.imageSource? .uri;
467+ await _downloadAndSave (
468+ url: primaryLogoUrl,
469+ relativePath: assetImagePrimaryOnboardingLogoPath,
470+ assetLabel: 'primary onboarding logo' ,
471+ );
472+
473+ final secondaryLogoUrl = themeWidgetConfig.imageAssets.secondaryOnboardingLogo.imageSource? .uri;
474+ await _downloadAndSave (
475+ url: secondaryLogoUrl,
476+ relativePath: assetImageSecondaryOnboardingLogoPath,
477+ assetLabel: 'secondary onboarding logo' ,
478+ );
479+
478480 final assetConfig = _patchOnboardingLogoUris (themeWidgetConfig);
479481 await _writeJsonToFile (_workingDirectory (assetWidgetsLightConfig), assetConfig.toJson ());
480482 // TODO(Serdun): Change scheme to dark when it will be implemented
0 commit comments