Mark some state data classes as immutable

(cherry picked from commit 54733e6ceb541d314687f46f5a01cf2f08dec89e)

# Conflicts:
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateDialog.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt
This commit is contained in:
arkon 2023-07-15 09:54:29 -04:00 committed by Jobobby04
parent c8d2646a34
commit bb4bf27db0
2 changed files with 11 additions and 7 deletions

View File

@ -20,6 +20,7 @@ import androidx.compose.material3.SelectableDates
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
@ -265,6 +266,7 @@ data class TrackInfoDialogHomeScreen(
.filter { (it.service as? EnhancedTrackService)?.accept(source) ?: true }
}
@Immutable
data class State(
val trackItems: List<TrackItem> = emptyList(),
)
@ -314,6 +316,7 @@ private data class TrackStatusSelectorScreen(
}
}
@Immutable
data class State(
val selection: Int,
)
@ -369,6 +372,7 @@ private data class TrackChapterSelectorScreen(
}
}
@Immutable
data class State(
val selection: Int,
)
@ -419,6 +423,7 @@ private data class TrackScoreSelectorScreen(
}
}
@Immutable
data class State(
val selection: String,
)
@ -724,6 +729,7 @@ data class TrackServiceSearchScreen(
mutableState.update { it.copy(selected = selected) }
}
@Immutable
data class State(
val queryResult: Result<List<TrackSearch>>? = null,
val selected: TrackSearch? = null,

View File

@ -4,6 +4,7 @@ import android.app.Application
import android.content.Context
import android.net.Uri
import androidx.annotation.ColorInt
import androidx.compose.runtime.Immutable
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
@ -1069,16 +1070,12 @@ class ReaderViewModel(
}
}
/**
* Results of the set as cover feature.
*/
enum class SetAsCoverResult {
Success, AddToLibraryFirst, Error
Success,
AddToLibraryFirst,
Error,
}
/**
* Results of the save image feature.
*/
sealed class SaveImageResult {
class Success(val uri: Uri) : SaveImageResult()
class Error(val error: Throwable) : SaveImageResult()
@ -1130,6 +1127,7 @@ class ReaderViewModel(
}
}
@Immutable
data class State(
val manga: Manga? = null,
val viewerChapters: ViewerChapters? = null,