Fix crash caused by inaccessible view model classes during creation (#3609)
This commit is contained in:
+1
-1
@@ -220,7 +220,7 @@ class ClearDatabaseScreen : Screen() {
|
||||
}
|
||||
}
|
||||
|
||||
private class ClearDatabaseViewModel : StateViewModel<ClearDatabaseViewModel.State>(State.Loading) {
|
||||
class ClearDatabaseViewModel : StateViewModel<ClearDatabaseViewModel.State>(State.Loading) {
|
||||
private val getSourcesWithNonLibraryManga: GetSourcesWithNonLibraryManga = Injekt.get()
|
||||
private val database: Database = Injekt.get()
|
||||
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ class CreateBackupScreen : Screen() {
|
||||
}
|
||||
}
|
||||
|
||||
private class CreateBackupViewModel : StateViewModel<CreateBackupViewModel.State>(State()) {
|
||||
class CreateBackupViewModel : StateViewModel<CreateBackupViewModel.State>(State()) {
|
||||
|
||||
fun toggle(setter: (BackupOptions, Boolean) -> BackupOptions, enabled: Boolean) {
|
||||
mutableState.update {
|
||||
|
||||
+1
-1
@@ -173,7 +173,7 @@ class RestoreBackupScreen(
|
||||
}
|
||||
}
|
||||
|
||||
private class RestoreBackupViewModel(
|
||||
class RestoreBackupViewModel(
|
||||
private val context: Context,
|
||||
private val uri: String,
|
||||
) : StateViewModel<RestoreBackupViewModel.State>(State()) {
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ class WorkerInfoScreen : Screen() {
|
||||
)
|
||||
}
|
||||
|
||||
private class WorkerInfoViewModel(
|
||||
class WorkerInfoViewModel(
|
||||
context: Context,
|
||||
) : ViewModel() {
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class MangaNotesScreen(
|
||||
)
|
||||
}
|
||||
|
||||
private class Model(
|
||||
class Model(
|
||||
private val manga: Manga,
|
||||
private val updateMangaNotes: UpdateMangaNotes = Injekt.get(),
|
||||
) : StateViewModel<State>(State(manga, manga.notes)) {
|
||||
|
||||
@@ -201,7 +201,7 @@ data class TrackInfoDialogHomeScreen(
|
||||
}
|
||||
}
|
||||
|
||||
private class Model(
|
||||
class Model(
|
||||
private val mangaId: Long,
|
||||
private val sourceId: Long,
|
||||
private val getTracks: GetTracks = Injekt.get(),
|
||||
@@ -321,7 +321,7 @@ private data class TrackStatusSelectorScreen(
|
||||
)
|
||||
}
|
||||
|
||||
private class Model(
|
||||
class Model(
|
||||
private val track: Track,
|
||||
private val tracker: Tracker,
|
||||
) : StateViewModel<Model.State>(State(track.status)) {
|
||||
@@ -390,7 +390,7 @@ private data class TrackChapterSelectorScreen(
|
||||
)
|
||||
}
|
||||
|
||||
private class Model(
|
||||
class Model(
|
||||
private val track: Track,
|
||||
private val tracker: Tracker,
|
||||
) : StateViewModel<Model.State>(State(track.lastChapterRead.toInt())) {
|
||||
@@ -464,7 +464,7 @@ private data class TrackScoreSelectorScreen(
|
||||
)
|
||||
}
|
||||
|
||||
private class Model(
|
||||
class Model(
|
||||
private val track: Track,
|
||||
private val tracker: Tracker,
|
||||
) : StateViewModel<Model.State>(State(tracker.displayScore(track))) {
|
||||
@@ -591,7 +591,7 @@ private data class TrackDateSelectorScreen(
|
||||
)
|
||||
}
|
||||
|
||||
private class Model(
|
||||
class Model(
|
||||
private val track: Track,
|
||||
private val tracker: Tracker,
|
||||
private val start: Boolean,
|
||||
@@ -707,7 +707,7 @@ private data class TrackDateRemoverScreen(
|
||||
)
|
||||
}
|
||||
|
||||
private class Model(
|
||||
class Model(
|
||||
private val track: Track,
|
||||
private val tracker: Tracker,
|
||||
private val start: Boolean,
|
||||
@@ -783,7 +783,7 @@ data class TrackerSearchScreen(
|
||||
)
|
||||
}
|
||||
|
||||
private class Model(
|
||||
class Model(
|
||||
private val mangaId: Long,
|
||||
private val currentUrl: String?,
|
||||
initialQuery: String,
|
||||
@@ -934,7 +934,7 @@ private data class TrackerRemoveScreen(
|
||||
)
|
||||
}
|
||||
|
||||
private class Model(
|
||||
class Model(
|
||||
private val mangaId: Long,
|
||||
private val track: Track,
|
||||
private val tracker: Tracker,
|
||||
|
||||
@@ -77,7 +77,7 @@ data object MoreTab : Tab {
|
||||
}
|
||||
}
|
||||
|
||||
private class MoreViewModel(
|
||||
class MoreViewModel(
|
||||
private val downloadManager: DownloadManager = Injekt.get(),
|
||||
preferences: BasePreferences = Injekt.get(),
|
||||
) : ViewModel() {
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user