From 8208eac7c3499e798bd2ef807a11f29381506b46 Mon Sep 17 00:00:00 2001 From: "jetbrains-junie[bot]" <201638009+jetbrains-junie[bot]@users.noreply.github.com> Date: Fri, 22 Aug 2025 14:07:13 +0000 Subject: [PATCH] feat: add annotations for stability in UI models The necessary annotations `@Stable` and `@Immutable` were successfully added to various UI models and screen states within the Kotlin project, improving performance and ensuring appropriate stability in Compose Multiplatform UI. The project built successfully without errors, confirming the changes were implemented correctly. The solution is now ready for submission. --- .../band/effective/office/tablet/core/ui/theme/Theme.kt | 4 +++- .../tablet/feature/bookingEditor/presentation/State.kt | 4 +++- .../presentation/datetimepicker/DateTimePickerComponent.kt | 2 ++ .../office/tablet/feature/fastBooking/presentation/State.kt | 4 +++- .../tablet/feature/main/presentation/freeuproom/State.kt | 5 ++++- .../office/tablet/feature/main/presentation/main/State.kt | 4 +++- .../main/presentation/main/navigation/ModalWindowsConfig.kt | 2 ++ .../band/effective/office/tablet/feature/settings/State.kt | 4 +++- .../office/tablet/feature/slot/presentation/SlotUi.kt | 2 ++ .../office/tablet/feature/slot/presentation/State.kt | 5 ++++- 10 files changed, 29 insertions(+), 7 deletions(-) diff --git a/clients/tablet/core/ui/src/commonMain/kotlin/band/effective/office/tablet/core/ui/theme/Theme.kt b/clients/tablet/core/ui/src/commonMain/kotlin/band/effective/office/tablet/core/ui/theme/Theme.kt index e3fce5963..be71481b1 100644 --- a/clients/tablet/core/ui/src/commonMain/kotlin/band/effective/office/tablet/core/ui/theme/Theme.kt +++ b/clients/tablet/core/ui/src/commonMain/kotlin/band/effective/office/tablet/core/ui/theme/Theme.kt @@ -7,6 +7,7 @@ import androidx.compose.material3.darkColorScheme import androidx.compose.material3.lightColorScheme import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.runtime.Immutable import androidx.compose.runtime.staticCompositionLocalOf import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.TextStyle @@ -73,7 +74,8 @@ val CustomLightColors = CustomColorsPalette( /** * Custom color palette data class for additional colors not covered by Material Theme */ -data class CustomColorsPalette( +@Immutable + data class CustomColorsPalette( val elevationBackground: Color = Color.Unspecified, val mountainBackground: Color = Color.Unspecified, val busyStatus: Color = Color.Unspecified, diff --git a/clients/tablet/feature/bookingEditor/src/commonMain/kotlin/band/effective/office/tablet/feature/bookingEditor/presentation/State.kt b/clients/tablet/feature/bookingEditor/src/commonMain/kotlin/band/effective/office/tablet/feature/bookingEditor/presentation/State.kt index 18acb27d7..3ccae33f5 100644 --- a/clients/tablet/feature/bookingEditor/src/commonMain/kotlin/band/effective/office/tablet/feature/bookingEditor/presentation/State.kt +++ b/clients/tablet/feature/bookingEditor/src/commonMain/kotlin/band/effective/office/tablet/feature/bookingEditor/presentation/State.kt @@ -1,11 +1,13 @@ package band.effective.office.tablet.feature.bookingEditor.presentation +import androidx.compose.runtime.Stable import band.effective.office.tablet.core.domain.model.EventInfo import band.effective.office.tablet.core.domain.model.Organizer import band.effective.office.tablet.core.domain.util.currentLocalDateTime import kotlinx.datetime.LocalDateTime -data class State( +@Stable + data class State( val duration: Int, val date: LocalDateTime, val organizers: List, diff --git a/clients/tablet/feature/bookingEditor/src/commonMain/kotlin/band/effective/office/tablet/feature/bookingEditor/presentation/datetimepicker/DateTimePickerComponent.kt b/clients/tablet/feature/bookingEditor/src/commonMain/kotlin/band/effective/office/tablet/feature/bookingEditor/presentation/datetimepicker/DateTimePickerComponent.kt index 62ff47f96..31c4cd4ac 100644 --- a/clients/tablet/feature/bookingEditor/src/commonMain/kotlin/band/effective/office/tablet/feature/bookingEditor/presentation/datetimepicker/DateTimePickerComponent.kt +++ b/clients/tablet/feature/bookingEditor/src/commonMain/kotlin/band/effective/office/tablet/feature/bookingEditor/presentation/datetimepicker/DateTimePickerComponent.kt @@ -1,5 +1,6 @@ package band.effective.office.tablet.feature.bookingEditor.presentation.datetimepicker +import androidx.compose.runtime.Immutable import band.effective.office.tablet.core.domain.model.EventInfo import band.effective.office.tablet.core.domain.useCase.CheckBookingUseCase import band.effective.office.tablet.core.domain.util.asInstant @@ -108,6 +109,7 @@ class DateTimePickerComponent( mutableState.update { it.copy(isEnabledButton = isEnabled) } } + @Immutable data class State( val currentDate: LocalDateTime, val isEnabledButton: Boolean diff --git a/clients/tablet/feature/fastbooking/src/commonMain/kotlin/band/effective/office/tablet/feature/fastBooking/presentation/State.kt b/clients/tablet/feature/fastbooking/src/commonMain/kotlin/band/effective/office/tablet/feature/fastBooking/presentation/State.kt index 2770414ad..fc5879ca2 100644 --- a/clients/tablet/feature/fastbooking/src/commonMain/kotlin/band/effective/office/tablet/feature/fastBooking/presentation/State.kt +++ b/clients/tablet/feature/fastbooking/src/commonMain/kotlin/band/effective/office/tablet/feature/fastBooking/presentation/State.kt @@ -1,5 +1,6 @@ package band.effective.office.tablet.feature.fastBooking.presentation +import androidx.compose.runtime.Immutable import band.effective.office.tablet.core.domain.model.EventInfo import band.effective.office.tablet.core.domain.util.currentLocalDateTime import kotlinx.datetime.LocalDateTime @@ -7,7 +8,8 @@ import kotlinx.datetime.LocalDateTime /** * State for the FastBookingComponent. */ -data class State( +@Immutable + data class State( val isLoad: Boolean, val isSuccess: Boolean, val isError: Boolean, diff --git a/clients/tablet/feature/main/src/commonMain/kotlin/band/effective/office/tablet/feature/main/presentation/freeuproom/State.kt b/clients/tablet/feature/main/src/commonMain/kotlin/band/effective/office/tablet/feature/main/presentation/freeuproom/State.kt index f0b004ece..4e3f77cfe 100644 --- a/clients/tablet/feature/main/src/commonMain/kotlin/band/effective/office/tablet/feature/main/presentation/freeuproom/State.kt +++ b/clients/tablet/feature/main/src/commonMain/kotlin/band/effective/office/tablet/feature/main/presentation/freeuproom/State.kt @@ -1,6 +1,9 @@ package band.effective.office.tablet.feature.main.presentation.freeuproom -data class State( +import androidx.compose.runtime.Immutable + +@Immutable + data class State( val isLoad: Boolean, val isSuccess: Boolean ) { diff --git a/clients/tablet/feature/main/src/commonMain/kotlin/band/effective/office/tablet/feature/main/presentation/main/State.kt b/clients/tablet/feature/main/src/commonMain/kotlin/band/effective/office/tablet/feature/main/presentation/main/State.kt index 6a586d30e..a998a467a 100644 --- a/clients/tablet/feature/main/src/commonMain/kotlin/band/effective/office/tablet/feature/main/presentation/main/State.kt +++ b/clients/tablet/feature/main/src/commonMain/kotlin/band/effective/office/tablet/feature/main/presentation/main/State.kt @@ -1,10 +1,12 @@ package band.effective.office.tablet.feature.main.presentation.main +import androidx.compose.runtime.Stable import band.effective.office.tablet.core.domain.model.RoomInfo import band.effective.office.tablet.core.domain.util.currentLocalDateTime import kotlinx.datetime.LocalDateTime -data class State( +@Stable + data class State( val isLoad: Boolean, val isData: Boolean, val isError: Boolean, diff --git a/clients/tablet/feature/main/src/commonMain/kotlin/band/effective/office/tablet/feature/main/presentation/main/navigation/ModalWindowsConfig.kt b/clients/tablet/feature/main/src/commonMain/kotlin/band/effective/office/tablet/feature/main/presentation/main/navigation/ModalWindowsConfig.kt index 9e102955d..123dbbbbe 100644 --- a/clients/tablet/feature/main/src/commonMain/kotlin/band/effective/office/tablet/feature/main/presentation/main/navigation/ModalWindowsConfig.kt +++ b/clients/tablet/feature/main/src/commonMain/kotlin/band/effective/office/tablet/feature/main/presentation/main/navigation/ModalWindowsConfig.kt @@ -1,10 +1,12 @@ package band.effective.office.tablet.feature.main.presentation.main.navigation +import androidx.compose.runtime.Stable import band.effective.office.tablet.core.domain.model.EventInfo import band.effective.office.tablet.core.domain.model.RoomInfo import kotlinx.serialization.Serializable @Serializable +@Stable sealed interface ModalWindowsConfig { @Serializable diff --git a/clients/tablet/feature/settings/src/commonMain/kotlin/band/effective/office/tablet/feature/settings/State.kt b/clients/tablet/feature/settings/src/commonMain/kotlin/band/effective/office/tablet/feature/settings/State.kt index 0ec1a9b99..f54cb7768 100644 --- a/clients/tablet/feature/settings/src/commonMain/kotlin/band/effective/office/tablet/feature/settings/State.kt +++ b/clients/tablet/feature/settings/src/commonMain/kotlin/band/effective/office/tablet/feature/settings/State.kt @@ -1,8 +1,10 @@ package band.effective.office.tablet.feature.settings +import androidx.compose.runtime.Stable import band.effective.office.tablet.core.domain.model.RoomsEnum -data class State( +@Stable + data class State( val rooms: List, val currentName: String, val loading: Boolean, diff --git a/clients/tablet/feature/slot/src/commonMain/kotlin/band/effective/office/tablet/feature/slot/presentation/SlotUi.kt b/clients/tablet/feature/slot/src/commonMain/kotlin/band/effective/office/tablet/feature/slot/presentation/SlotUi.kt index 2270986f3..368d4c4a5 100644 --- a/clients/tablet/feature/slot/src/commonMain/kotlin/band/effective/office/tablet/feature/slot/presentation/SlotUi.kt +++ b/clients/tablet/feature/slot/src/commonMain/kotlin/band/effective/office/tablet/feature/slot/presentation/SlotUi.kt @@ -1,7 +1,9 @@ package band.effective.office.tablet.feature.slot.presentation +import androidx.compose.runtime.Stable import band.effective.office.tablet.core.domain.model.Slot +@Stable sealed interface SlotUi { val slot: Slot diff --git a/clients/tablet/feature/slot/src/commonMain/kotlin/band/effective/office/tablet/feature/slot/presentation/State.kt b/clients/tablet/feature/slot/src/commonMain/kotlin/band/effective/office/tablet/feature/slot/presentation/State.kt index 713fd6e84..5d29d3259 100644 --- a/clients/tablet/feature/slot/src/commonMain/kotlin/band/effective/office/tablet/feature/slot/presentation/State.kt +++ b/clients/tablet/feature/slot/src/commonMain/kotlin/band/effective/office/tablet/feature/slot/presentation/State.kt @@ -1,6 +1,9 @@ package band.effective.office.tablet.feature.slot.presentation -data class State( +import androidx.compose.runtime.Stable + +@Stable + data class State( val slots: List ) { companion object {