Skip to content

Commit 2127bda

Browse files
committed
Add style parameter to downloadSvg method in icon use cases, create MaterialSymbolsConfigUseCase with keepAlive option
1 parent 18885ad commit 2127bda

13 files changed

Lines changed: 21 additions & 23 deletions

File tree

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/common/StandardIconViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class StandardIconViewModel(
158158
val currentState = stateRecord.value.safeAs<StandardState.Success>() ?: return@launch
159159

160160
runCatching {
161-
val svgContent = provider.downloadSvg(icon, currentState.settings)
161+
val svgContent = provider.downloadSvg(icon, currentState.settings, currentState.selectedStyle)
162162

163163
_events.send(
164164
StandardIconEvent.IconDownloaded(

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/common/domain/StandardIconProvider.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ interface StandardIconProvider {
3838

3939
suspend fun loadConfig(): StandardIconConfig
4040
suspend fun loadFontBytes(style: IconStyle? = null): FontByteArray
41-
suspend fun downloadSvg(icon: StandardIcon, settings: SizeSettings): String
41+
suspend fun downloadSvg(icon: StandardIcon, settings: SizeSettings, style: IconStyle? = null): String
4242

4343
companion object {
4444
/** Shared no-op StateFlow returned by the default [variableFontConfig] getter. */

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/bootstrap/domain/BootstrapUseCase.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class BootstrapUseCase(
5050
return FontByteArray(repository.loadFontBytes())
5151
}
5252

53-
override suspend fun downloadSvg(icon: StandardIcon, settings: SizeSettings): String {
53+
override suspend fun downloadSvg(icon: StandardIcon, settings: SizeSettings, style: IconStyle?): String {
5454
val rawSvg = repository.downloadSvg(icon.name)
5555
return SvgSizeCustomizer.applySettings(rawSvg, settings)
5656
}

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/boxicons/domain/BoxIconsUseCase.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class BoxIconsUseCase(
5353
return FontByteArray(repository.loadFontBytes())
5454
}
5555

56-
override suspend fun downloadSvg(icon: StandardIcon, settings: SizeSettings): String {
56+
override suspend fun downloadSvg(icon: StandardIcon, settings: SizeSettings, style: IconStyle?): String {
5757
val rawSvg = repository.downloadSvg(icon.name)
5858
return SvgSizeCustomizer.applySettings(rawSvg, settings)
5959
}

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/eva/domain/EvaUseCase.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class EvaUseCase(
4747

4848
override suspend fun loadFontBytes(style: IconStyle?): FontByteArray = FontByteArray(repository.loadFontBytes())
4949

50-
override suspend fun downloadSvg(icon: StandardIcon, settings: SizeSettings): String = repository.downloadSvg(icon.name)
50+
override suspend fun downloadSvg(icon: StandardIcon, settings: SizeSettings, style: IconStyle?): String = repository.downloadSvg(icon.name)
5151
}
5252

5353
internal fun String.toEvaStyle(): IconStyle {

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/feather/domain/FeatherUseCase.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class FeatherUseCase(
3838
return FontByteArray(repository.loadFontBytes())
3939
}
4040

41-
override suspend fun downloadSvg(icon: StandardIcon, settings: SizeSettings): String {
41+
override suspend fun downloadSvg(icon: StandardIcon, settings: SizeSettings, style: IconStyle?): String {
4242
val rawSvg = repository.downloadSvg(icon.name)
4343
return SvgSizeCustomizer.applySettings(rawSvg, settings)
4444
}

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/fontawesome/domain/FontAwesomeUseCase.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class FontAwesomeUseCase(
6767
return FontByteArray(repository.loadFontBytes(styleId = styleId))
6868
}
6969

70-
override suspend fun downloadSvg(icon: StandardIcon, settings: SizeSettings): String {
70+
override suspend fun downloadSvg(icon: StandardIcon, settings: SizeSettings, style: IconStyle?): String {
7171
val styleId = icon.style?.id ?: SOLID_STYLE_ID
7272
val rawSvg = repository.downloadSvg(iconName = icon.name, styleId = styleId)
7373
return SvgSizeCustomizer.applySettings(rawSvg, settings)

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/ionicons/domain/IoniconsUseCase.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class IoniconsUseCase(
3838
return FontByteArray(repository.loadFontBytes())
3939
}
4040

41-
override suspend fun downloadSvg(icon: StandardIcon, settings: SizeSettings): String {
41+
override suspend fun downloadSvg(icon: StandardIcon, settings: SizeSettings, style: IconStyle?): String {
4242
val rawSvg = repository.downloadSvg(icon.name)
4343
return SvgSizeCustomizer.applySettings(rawSvg, settings)
4444
}

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/lucide/domain/LucideUseCase.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class LucideUseCase(
5252
return FontByteArray(repository.loadFontBytes())
5353
}
5454

55-
override suspend fun downloadSvg(icon: StandardIcon, settings: SizeSettings): String {
55+
override suspend fun downloadSvg(icon: StandardIcon, settings: SizeSettings, style: IconStyle?): String {
5656
val rawSvg = repository.downloadSvg(icon.name)
5757
return SvgSizeCustomizer.applySettings(rawSvg, settings)
5858
}

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/standard/materialsymbols/di/MaterialSymbolsModule.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ object MaterialSymbolsModule : Leviathan() {
2121
MaterialFontRepository(httpClient = inject(NetworkModule.httpClient))
2222
}
2323

24-
val materialSymbolsConfigUseCase by instanceOf {
24+
val materialSymbolsConfigUseCase by instanceOf(keepAlive = true) {
2525
MaterialSymbolsConfigUseCase(
2626
configRepository = inject(materialSymbolsConfigRepository),
2727
fontRepository = inject(materialFontRepository),

0 commit comments

Comments
 (0)