@@ -35,6 +35,7 @@ import kotlinx.coroutines.flow.asStateFlow
3535import kotlinx.coroutines.flow.launchIn
3636import kotlinx.coroutines.flow.onEach
3737import kotlinx.coroutines.launch
38+ import kotlinx.coroutines.withContext
3839
3940class IconPackConversionViewModel (
4041 savedState : MutableSavedState ,
@@ -197,13 +198,15 @@ class IconPackConversionViewModel(
197198 ),
198199 )
199200
200- vectorSpecOutput.content.writeToKt(
201- outputDir = when {
202- settings.flatPackage -> settings.iconPackDestination
203- else -> " ${settings.iconPackDestination} /${iconPack.currentNestedPack.lowercase()} "
204- },
205- nameWithoutExtension = vectorSpecOutput.name,
206- )
201+ withContext(Dispatchers .IO ) {
202+ vectorSpecOutput.content.writeToKt(
203+ outputDir = when {
204+ settings.flatPackage -> settings.iconPackDestination
205+ else -> " ${settings.iconPackDestination} /${iconPack.currentNestedPack.lowercase()} "
206+ },
207+ nameWithoutExtension = vectorSpecOutput.name,
208+ )
209+ }
207210 }
208211 is IconPack .Single -> {
209212 val vectorSpecOutput = ImageVectorGenerator .convert(
@@ -225,10 +228,12 @@ class IconPackConversionViewModel(
225228 ),
226229 )
227230
228- vectorSpecOutput.content.writeToKt(
229- outputDir = settings.iconPackDestination,
230- nameWithoutExtension = vectorSpecOutput.name,
231- )
231+ withContext(Dispatchers .IO ) {
232+ vectorSpecOutput.content.writeToKt(
233+ outputDir = settings.iconPackDestination,
234+ nameWithoutExtension = vectorSpecOutput.name,
235+ )
236+ }
232237 }
233238 }
234239 }
@@ -316,8 +321,7 @@ class IconPackConversionViewModel(
316321
317322 private fun processText (text : String ) = viewModelScope.launch(Dispatchers .Default ) {
318323 val iconName = " "
319- val output =
320- runCatching { SvgXmlParser .toIrImageVector(parser = ParserType .Jvm , text, iconName) }.getOrNull()
324+ val output = runCatching { SvgXmlParser .toIrImageVector(parser = ParserType .Jvm , text, iconName) }.getOrNull()
321325
322326 val icon = when (output) {
323327 null -> BatchIcon .Broken (
0 commit comments