Fix crash caused by inaccessible view model classes during creation (#3609)

This commit is contained in:
AntsyLich
2026-07-19 20:06:01 +06:00
committed by GitHub
parent 5ce7d00eb8
commit 98705910e7
9 changed files with 22 additions and 22 deletions
@@ -77,7 +77,7 @@ class MigrationConfigScreen(private val mangaIds: Collection<Long>) : Screen() {
override fun Content() {
val navigator = LocalNavigator.currentOrThrow
val viewModel = viewModel<ViewModel>()
val viewModel = viewModel<Model>()
val state by viewModel.state.collectAsState()
var migrationSheetOpen by rememberSaveable { mutableStateOf(false) }
@@ -121,20 +121,20 @@ class MigrationConfigScreen(private val mangaIds: Collection<Long>) : Screen() {
AppBar.Action(
title = stringResource(MR.strings.migrationConfigScreen_selectAllLabel),
icon = Icons.Outlined.SelectAll,
onClick = { viewModel.toggleSelection(ViewModel.SelectionConfig.All) },
onClick = { viewModel.toggleSelection(Model.SelectionConfig.All) },
),
AppBar.Action(
title = stringResource(MR.strings.migrationConfigScreen_selectNoneLabel),
icon = Icons.Outlined.Deselect,
onClick = { viewModel.toggleSelection(ViewModel.SelectionConfig.None) },
onClick = { viewModel.toggleSelection(Model.SelectionConfig.None) },
),
AppBar.OverflowAction(
title = stringResource(MR.strings.migrationConfigScreen_selectEnabledLabel),
onClick = { viewModel.toggleSelection(ViewModel.SelectionConfig.Enabled) },
onClick = { viewModel.toggleSelection(Model.SelectionConfig.Enabled) },
),
AppBar.OverflowAction(
title = stringResource(MR.strings.migrationConfigScreen_selectPinnedLabel),
onClick = { viewModel.toggleSelection(ViewModel.SelectionConfig.Pinned) },
onClick = { viewModel.toggleSelection(Model.SelectionConfig.Pinned) },
),
),
)
@@ -306,10 +306,10 @@ class MigrationConfigScreen(private val mangaIds: Collection<Long>) : Screen() {
}
}
private class ViewModel(
class Model(
val sourcePreferences: SourcePreferences = Injekt.get(),
private val sourceManager: SourceManager = Injekt.get(),
) : StateViewModel<ViewModel.State>(State()) {
) : StateViewModel<Model.State>(State()) {
private val sourcesComparator = { includedSources: List<Long> ->
compareBy<MigrationSource>(
@@ -123,7 +123,7 @@ internal fun Screen.MigrateMangaDialog(
)
}
private class MigrateDialogViewModel(
class MigrateDialogViewModel(
private val sourcePreference: SourcePreferences = Injekt.get(),
private val coverCache: CoverCache = Injekt.get(),
private val downloadManager: DownloadManager = Injekt.get(),