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 getSourcesWithNonLibraryManga: GetSourcesWithNonLibraryManga = Injekt.get()
|
||||||
private val database: Database = 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) {
|
fun toggle(setter: (BackupOptions, Boolean) -> BackupOptions, enabled: Boolean) {
|
||||||
mutableState.update {
|
mutableState.update {
|
||||||
|
|||||||
+1
-1
@@ -173,7 +173,7 @@ class RestoreBackupScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class RestoreBackupViewModel(
|
class RestoreBackupViewModel(
|
||||||
private val context: Context,
|
private val context: Context,
|
||||||
private val uri: String,
|
private val uri: String,
|
||||||
) : StateViewModel<RestoreBackupViewModel.State>(State()) {
|
) : StateViewModel<RestoreBackupViewModel.State>(State()) {
|
||||||
|
|||||||
+1
-1
@@ -120,7 +120,7 @@ class WorkerInfoScreen : Screen() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private class WorkerInfoViewModel(
|
class WorkerInfoViewModel(
|
||||||
context: Context,
|
context: Context,
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class MangaNotesScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Model(
|
class Model(
|
||||||
private val manga: Manga,
|
private val manga: Manga,
|
||||||
private val updateMangaNotes: UpdateMangaNotes = Injekt.get(),
|
private val updateMangaNotes: UpdateMangaNotes = Injekt.get(),
|
||||||
) : StateViewModel<State>(State(manga, manga.notes)) {
|
) : StateViewModel<State>(State(manga, manga.notes)) {
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ data class TrackInfoDialogHomeScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Model(
|
class Model(
|
||||||
private val mangaId: Long,
|
private val mangaId: Long,
|
||||||
private val sourceId: Long,
|
private val sourceId: Long,
|
||||||
private val getTracks: GetTracks = Injekt.get(),
|
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 track: Track,
|
||||||
private val tracker: Tracker,
|
private val tracker: Tracker,
|
||||||
) : StateViewModel<Model.State>(State(track.status)) {
|
) : 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 track: Track,
|
||||||
private val tracker: Tracker,
|
private val tracker: Tracker,
|
||||||
) : StateViewModel<Model.State>(State(track.lastChapterRead.toInt())) {
|
) : 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 track: Track,
|
||||||
private val tracker: Tracker,
|
private val tracker: Tracker,
|
||||||
) : StateViewModel<Model.State>(State(tracker.displayScore(track))) {
|
) : 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 track: Track,
|
||||||
private val tracker: Tracker,
|
private val tracker: Tracker,
|
||||||
private val start: Boolean,
|
private val start: Boolean,
|
||||||
@@ -707,7 +707,7 @@ private data class TrackDateRemoverScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Model(
|
class Model(
|
||||||
private val track: Track,
|
private val track: Track,
|
||||||
private val tracker: Tracker,
|
private val tracker: Tracker,
|
||||||
private val start: Boolean,
|
private val start: Boolean,
|
||||||
@@ -783,7 +783,7 @@ data class TrackerSearchScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Model(
|
class Model(
|
||||||
private val mangaId: Long,
|
private val mangaId: Long,
|
||||||
private val currentUrl: String?,
|
private val currentUrl: String?,
|
||||||
initialQuery: String,
|
initialQuery: String,
|
||||||
@@ -934,7 +934,7 @@ private data class TrackerRemoveScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Model(
|
class Model(
|
||||||
private val mangaId: Long,
|
private val mangaId: Long,
|
||||||
private val track: Track,
|
private val track: Track,
|
||||||
private val tracker: Tracker,
|
private val tracker: Tracker,
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ data object MoreTab : Tab {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MoreViewModel(
|
class MoreViewModel(
|
||||||
private val downloadManager: DownloadManager = Injekt.get(),
|
private val downloadManager: DownloadManager = Injekt.get(),
|
||||||
preferences: BasePreferences = Injekt.get(),
|
preferences: BasePreferences = Injekt.get(),
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class MigrationConfigScreen(private val mangaIds: Collection<Long>) : Screen() {
|
|||||||
override fun Content() {
|
override fun Content() {
|
||||||
val navigator = LocalNavigator.currentOrThrow
|
val navigator = LocalNavigator.currentOrThrow
|
||||||
|
|
||||||
val viewModel = viewModel<ViewModel>()
|
val viewModel = viewModel<Model>()
|
||||||
val state by viewModel.state.collectAsState()
|
val state by viewModel.state.collectAsState()
|
||||||
|
|
||||||
var migrationSheetOpen by rememberSaveable { mutableStateOf(false) }
|
var migrationSheetOpen by rememberSaveable { mutableStateOf(false) }
|
||||||
@@ -121,20 +121,20 @@ class MigrationConfigScreen(private val mangaIds: Collection<Long>) : Screen() {
|
|||||||
AppBar.Action(
|
AppBar.Action(
|
||||||
title = stringResource(MR.strings.migrationConfigScreen_selectAllLabel),
|
title = stringResource(MR.strings.migrationConfigScreen_selectAllLabel),
|
||||||
icon = Icons.Outlined.SelectAll,
|
icon = Icons.Outlined.SelectAll,
|
||||||
onClick = { viewModel.toggleSelection(ViewModel.SelectionConfig.All) },
|
onClick = { viewModel.toggleSelection(Model.SelectionConfig.All) },
|
||||||
),
|
),
|
||||||
AppBar.Action(
|
AppBar.Action(
|
||||||
title = stringResource(MR.strings.migrationConfigScreen_selectNoneLabel),
|
title = stringResource(MR.strings.migrationConfigScreen_selectNoneLabel),
|
||||||
icon = Icons.Outlined.Deselect,
|
icon = Icons.Outlined.Deselect,
|
||||||
onClick = { viewModel.toggleSelection(ViewModel.SelectionConfig.None) },
|
onClick = { viewModel.toggleSelection(Model.SelectionConfig.None) },
|
||||||
),
|
),
|
||||||
AppBar.OverflowAction(
|
AppBar.OverflowAction(
|
||||||
title = stringResource(MR.strings.migrationConfigScreen_selectEnabledLabel),
|
title = stringResource(MR.strings.migrationConfigScreen_selectEnabledLabel),
|
||||||
onClick = { viewModel.toggleSelection(ViewModel.SelectionConfig.Enabled) },
|
onClick = { viewModel.toggleSelection(Model.SelectionConfig.Enabled) },
|
||||||
),
|
),
|
||||||
AppBar.OverflowAction(
|
AppBar.OverflowAction(
|
||||||
title = stringResource(MR.strings.migrationConfigScreen_selectPinnedLabel),
|
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(),
|
val sourcePreferences: SourcePreferences = Injekt.get(),
|
||||||
private val sourceManager: SourceManager = Injekt.get(),
|
private val sourceManager: SourceManager = Injekt.get(),
|
||||||
) : StateViewModel<ViewModel.State>(State()) {
|
) : StateViewModel<Model.State>(State()) {
|
||||||
|
|
||||||
private val sourcesComparator = { includedSources: List<Long> ->
|
private val sourcesComparator = { includedSources: List<Long> ->
|
||||||
compareBy<MigrationSource>(
|
compareBy<MigrationSource>(
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ internal fun Screen.MigrateMangaDialog(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MigrateDialogViewModel(
|
class MigrateDialogViewModel(
|
||||||
private val sourcePreference: SourcePreferences = Injekt.get(),
|
private val sourcePreference: SourcePreferences = Injekt.get(),
|
||||||
private val coverCache: CoverCache = Injekt.get(),
|
private val coverCache: CoverCache = Injekt.get(),
|
||||||
private val downloadManager: DownloadManager = Injekt.get(),
|
private val downloadManager: DownloadManager = Injekt.get(),
|
||||||
|
|||||||
Reference in New Issue
Block a user