Mark some state data classes as immutable

This commit is contained in:
arkon 2023-07-15 09:54:29 -04:00
parent 22e8050fff
commit 54733e6ceb
3 changed files with 13 additions and 7 deletions

View file

@ -16,6 +16,7 @@ import androidx.compose.material3.MaterialTheme
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.mutableStateListOf
@ -313,6 +314,7 @@ internal class MigrateDialogScreenModel(
)
}
@Immutable
data class State(
val isMigrating: Boolean = false,
)

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

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.reader
import android.app.Application
import android.net.Uri
import androidx.compose.runtime.Immutable
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
@ -790,16 +791,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()
@ -844,6 +841,7 @@ class ReaderViewModel(
}
}
@Immutable
data class State(
val manga: Manga? = null,
val viewerChapters: ViewerChapters? = null,