Skip to content

Commit 0654c04

Browse files
committed
[BOOK-481] refactor: record.stability unstable -> stable
1 parent cbc36d7 commit 0654c04

3 files changed

Lines changed: 24 additions & 134 deletions

File tree

feature/record/src/main/kotlin/com/ninecraft/booket/feature/record/register/RecordRegisterPresenter.kt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import dev.zacsweers.metro.Assisted
3232
import dev.zacsweers.metro.AssistedFactory
3333
import dev.zacsweers.metro.AssistedInject
3434
import kotlinx.collections.immutable.ImmutableList
35+
import kotlinx.collections.immutable.PersistentMap
3536
import kotlinx.collections.immutable.persistentListOf
3637
import kotlinx.collections.immutable.persistentMapOf
3738
import kotlinx.collections.immutable.toPersistentList
@@ -96,9 +97,9 @@ class RecordRegisterPresenter(
9697
val emotions by rememberRetained { mutableStateOf(Emotion.entries.toPersistentList()) }
9798
var emotionDetails by rememberRetained { mutableStateOf(persistentListOf<String>()) }
9899
var selectedEmotion by rememberRetained { mutableStateOf<Emotion?>(null) }
99-
var selectedEmotionDetails by rememberRetained { mutableStateOf<Map<Emotion, ImmutableList<String>>>(emptyMap()) }
100+
var selectedEmotionDetails by rememberRetained { mutableStateOf<PersistentMap<Emotion, ImmutableList<String>>>(persistentMapOf()) }
100101
var committedEmotion by rememberRetained { mutableStateOf<Emotion?>(null) }
101-
var committedEmotionDetails by rememberRetained { mutableStateOf<Map<Emotion, ImmutableList<String>>>(emptyMap()) }
102+
var committedEmotionDetails by rememberRetained { mutableStateOf<PersistentMap<Emotion, ImmutableList<String>>>(persistentMapOf()) }
102103
var isEmotionDetailBottomSheetVisible by rememberRetained { mutableStateOf(false) }
103104
var savedRecordId by rememberRetained { mutableStateOf("") }
104105
var isExitDialogVisible by rememberRetained { mutableStateOf(false) }
@@ -243,16 +244,16 @@ class RecordRegisterPresenter(
243244
currentDetails + event.detail
244245
}
245246

246-
selectedEmotionDetails = selectedEmotionDetails + (emotionKey to updatedDetails.toPersistentList())
247+
selectedEmotionDetails = selectedEmotionDetails.put(emotionKey, updatedDetails.toPersistentList())
247248
}
248249

249250
is RecordRegisterUiEvent.OnEmotionDetailRemoved -> {
250251
val emotionKey = selectedEmotion ?: return
251252
val currentDetails = committedEmotionDetails[selectedEmotion].orEmpty()
252253
val updatedDetails = currentDetails - event.detail
253254

254-
committedEmotionDetails = committedEmotionDetails + (emotionKey to updatedDetails.toPersistentList())
255-
selectedEmotionDetails = selectedEmotionDetails + (emotionKey to updatedDetails.toPersistentList())
255+
committedEmotionDetails = committedEmotionDetails.put(emotionKey, updatedDetails.toPersistentList())
256+
selectedEmotionDetails = selectedEmotionDetails.put(emotionKey, updatedDetails.toPersistentList())
256257
}
257258

258259
is RecordRegisterUiEvent.OnEmotionDetailSkipped -> {
@@ -268,8 +269,8 @@ class RecordRegisterPresenter(
268269
val details = selectedEmotionDetails[emotionKey] ?: persistentListOf()
269270

270271
committedEmotion = emotionKey
271-
committedEmotionDetails = mapOf(emotionKey to details)
272-
selectedEmotionDetails = mapOf(emotionKey to details)
272+
committedEmotionDetails = persistentMapOf(emotionKey to details)
273+
selectedEmotionDetails = persistentMapOf(emotionKey to details)
273274
isEmotionDetailBottomSheetVisible = false
274275
}
275276

feature/record/src/main/kotlin/com/ninecraft/booket/feature/record/register/RecordRegisterUiState.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import com.ninecraft.booket.core.model.Emotion
77
import com.slack.circuit.runtime.CircuitUiEvent
88
import com.slack.circuit.runtime.CircuitUiState
99
import kotlinx.collections.immutable.ImmutableList
10+
import kotlinx.collections.immutable.PersistentMap
1011
import kotlinx.collections.immutable.persistentListOf
12+
import kotlinx.collections.immutable.persistentMapOf
1113
import java.util.UUID
1214

1315
data class RecordRegisterUiState(
@@ -20,9 +22,9 @@ data class RecordRegisterUiState(
2022
val emotions: ImmutableList<Emotion> = persistentListOf(),
2123
val emotionDetails: ImmutableList<String> = persistentListOf(),
2224
val selectedEmotion: Emotion? = null,
23-
val selectedEmotionDetails: Map<Emotion, ImmutableList<String>> = emptyMap(),
25+
val selectedEmotionDetails: PersistentMap<Emotion, ImmutableList<String>> = persistentMapOf(),
2426
val committedEmotion: Emotion? = null,
25-
val committedEmotionDetails: Map<Emotion, ImmutableList<String>> = emptyMap(),
27+
val committedEmotionDetails: PersistentMap<Emotion, ImmutableList<String>> = persistentMapOf(),
2628
val isEmotionDetailBottomSheetVisible: Boolean = false,
2729
val impressionState: TextFieldState = TextFieldState(),
2830
val impressionGuideList: ImmutableList<String> = persistentListOf(),

feature/record/stability/record.stability

Lines changed: 12 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -5,97 +5,11 @@
55
// ./gradlew :record:stabilityDump
66

77
@Composable
8-
internal fun com.ninecraft.booket.feature.record.component.CustomTooltipBox(messageResId: kotlin.Int): kotlin.Unit
9-
skippable: true
10-
restartable: true
11-
params:
12-
- messageResId: STABLE (primitive type)
13-
14-
@Composable
15-
public fun com.ninecraft.booket.feature.record.component.ImpressionGuideBottomSheet(onDismissRequest: kotlin.Function0<kotlin.Unit>, sheetState: androidx.compose.material3.SheetState, impressionState: androidx.compose.foundation.text.input.TextFieldState, impressionGuideList: kotlinx.collections.immutable.ImmutableList<kotlin.String>, beforeSelectedImpressionGuide: kotlin.String, selectedImpressionGuide: kotlin.String, onGuideClick: kotlin.Function1<kotlin.Int, kotlin.Unit>, onCloseButtonClick: kotlin.Function0<kotlin.Unit>, onSelectionConfirmButtonClick: kotlin.Function0<kotlin.Unit>): kotlin.Unit
16-
skippable: true
17-
restartable: true
18-
params:
19-
- onDismissRequest: STABLE (function type)
20-
- sheetState: STABLE (marked @Stable or @Immutable)
21-
- impressionState: STABLE (marked @Stable or @Immutable)
22-
- impressionGuideList: STABLE (known stable type)
23-
- beforeSelectedImpressionGuide: STABLE (String is immutable)
24-
- selectedImpressionGuide: STABLE (String is immutable)
25-
- onGuideClick: STABLE (function type)
26-
- onCloseButtonClick: STABLE (function type)
27-
- onSelectionConfirmButtonClick: STABLE (function type)
28-
29-
@Composable
30-
public fun com.ninecraft.booket.feature.record.component.ImpressionGuideBox(onClick: kotlin.Function0<kotlin.Unit>, impressionText: kotlin.String, modifier: androidx.compose.ui.Modifier, isSelected: kotlin.Boolean): kotlin.Unit
31-
skippable: true
32-
restartable: true
33-
params:
34-
- onClick: STABLE (function type)
35-
- impressionText: STABLE (String is immutable)
36-
- modifier: STABLE (marked @Stable or @Immutable)
37-
- isSelected: STABLE (primitive type)
38-
39-
@Composable
40-
private fun com.ninecraft.booket.feature.record.ocr.CameraPreview(state: com.ninecraft.booket.feature.record.ocr.OcrUiState, modifier: androidx.compose.ui.Modifier): kotlin.Unit
41-
skippable: true
42-
restartable: true
43-
params:
44-
- state: STABLE (class with no mutable properties)
45-
- modifier: STABLE (marked @Stable or @Immutable)
46-
47-
@Composable
48-
internal fun com.ninecraft.booket.feature.record.ocr.HandleOcrSideEffects(state: com.ninecraft.booket.feature.record.ocr.OcrUiState): kotlin.Unit
49-
skippable: true
50-
restartable: true
51-
params:
52-
- state: STABLE (class with no mutable properties)
53-
54-
@Composable
55-
public fun com.ninecraft.booket.feature.record.ocr.OcrPresenter.present(): com.ninecraft.booket.feature.record.ocr.OcrUiState
56-
skippable: true
57-
restartable: true
58-
params:
59-
60-
@Composable
61-
internal fun com.ninecraft.booket.feature.record.ocr.OcrUi(state: com.ninecraft.booket.feature.record.ocr.OcrUiState, modifier: androidx.compose.ui.Modifier): kotlin.Unit
62-
skippable: true
63-
restartable: true
64-
params:
65-
- state: STABLE (class with no mutable properties)
66-
- modifier: STABLE (marked @Stable or @Immutable)
67-
68-
@Composable
69-
private fun com.ninecraft.booket.feature.record.ocr.TextScanResult(state: com.ninecraft.booket.feature.record.ocr.OcrUiState, modifier: androidx.compose.ui.Modifier): kotlin.Unit
8+
internal fun com.ninecraft.booket.feature.record.register.HandleRecordRegisterSideEffects(state: com.ninecraft.booket.feature.record.register.RecordRegisterUiState): kotlin.Unit
709
skippable: true
7110
restartable: true
7211
params:
7312
- state: STABLE (class with no mutable properties)
74-
- modifier: STABLE (marked @Stable or @Immutable)
75-
76-
@Composable
77-
public fun com.ninecraft.booket.feature.record.ocr.component.CameraFrame(modifier: androidx.compose.ui.Modifier): kotlin.Unit
78-
skippable: true
79-
restartable: true
80-
params:
81-
- modifier: STABLE (marked @Stable or @Immutable)
82-
83-
@Composable
84-
public fun com.ninecraft.booket.feature.record.ocr.component.SentenceBox(onClick: kotlin.Function0<kotlin.Unit>, sentence: kotlin.String, modifier: androidx.compose.ui.Modifier, isSelected: kotlin.Boolean): kotlin.Unit
85-
skippable: true
86-
restartable: true
87-
params:
88-
- onClick: STABLE (function type)
89-
- sentence: STABLE (String is immutable)
90-
- modifier: STABLE (marked @Stable or @Immutable)
91-
- isSelected: STABLE (primitive type)
92-
93-
@Composable
94-
internal fun com.ninecraft.booket.feature.record.register.HandleRecordRegisterSideEffects(state: com.ninecraft.booket.feature.record.register.RecordRegisterUiState): kotlin.Unit
95-
skippable: false
96-
restartable: true
97-
params:
98-
- state: RUNTIME (requires runtime check)
9913

10014
@Composable
10115
public fun com.ninecraft.booket.feature.record.register.RecordRegisterPresenter.present(): com.ninecraft.booket.feature.record.register.RecordRegisterUiState
@@ -105,10 +19,10 @@ public fun com.ninecraft.booket.feature.record.register.RecordRegisterPresenter.
10519

10620
@Composable
10721
internal fun com.ninecraft.booket.feature.record.register.RecordRegisterUi(state: com.ninecraft.booket.feature.record.register.RecordRegisterUiState, modifier: androidx.compose.ui.Modifier): kotlin.Unit
108-
skippable: false
22+
skippable: true
10923
restartable: true
11024
params:
111-
- state: RUNTIME (requires runtime check)
25+
- state: STABLE (class with no mutable properties)
11226
- modifier: STABLE (marked @Stable or @Immutable)
11327

11428
@Composable
@@ -123,68 +37,41 @@ private fun com.ninecraft.booket.feature.record.step.EmotionItem(emotion: com.ni
12337

12438
@Composable
12539
public fun com.ninecraft.booket.feature.record.step.EmotionStep(state: com.ninecraft.booket.feature.record.register.RecordRegisterUiState, modifier: androidx.compose.ui.Modifier): kotlin.Unit
126-
skippable: false
40+
skippable: true
12741
restartable: true
12842
params:
129-
- state: RUNTIME (requires runtime check)
43+
- state: STABLE (class with no mutable properties)
13044
- modifier: STABLE (marked @Stable or @Immutable)
13145

13246
@Composable
13347
public fun com.ninecraft.booket.feature.record.step.ImpressionStep(state: com.ninecraft.booket.feature.record.register.RecordRegisterUiState, modifier: androidx.compose.ui.Modifier): kotlin.Unit
134-
skippable: false
48+
skippable: true
13549
restartable: true
13650
params:
137-
- state: RUNTIME (requires runtime check)
51+
- state: STABLE (class with no mutable properties)
13852
- modifier: STABLE (marked @Stable or @Immutable)
13953

14054
@Composable
14155
internal fun com.ninecraft.booket.feature.record.step.QuoteStep(state: com.ninecraft.booket.feature.record.register.RecordRegisterUiState, modifier: androidx.compose.ui.Modifier): kotlin.Unit
142-
skippable: false
143-
restartable: true
144-
params:
145-
- state: RUNTIME (requires runtime check)
146-
- modifier: STABLE (marked @Stable or @Immutable)
147-
148-
@Composable
149-
internal fun com.ninecraft.booket.feature.record.step_v2.EmotionDetailBottomSheet(emotion: com.ninecraft.booket.core.model.Emotion, emotionDetails: kotlinx.collections.immutable.ImmutableList<kotlin.String>, selectedEmotionDetail: kotlinx.collections.immutable.ImmutableList<kotlin.String>, onDismissRequest: kotlin.Function0<kotlin.Unit>, sheetState: androidx.compose.material3.SheetState, onCloseButtonClick: kotlin.Function0<kotlin.Unit>, onEmotionDetailToggled: kotlin.Function1<kotlin.String, kotlin.Unit>, onSkipButtonClick: kotlin.Function0<kotlin.Unit>, onConfirmButtonClick: kotlin.Function0<kotlin.Unit>): kotlin.Unit
150-
skippable: true
151-
restartable: true
152-
params:
153-
- emotion: STABLE (class with no mutable properties)
154-
- emotionDetails: STABLE (known stable type)
155-
- selectedEmotionDetail: STABLE (known stable type)
156-
- onDismissRequest: STABLE (function type)
157-
- sheetState: STABLE (marked @Stable or @Immutable)
158-
- onCloseButtonClick: STABLE (function type)
159-
- onEmotionDetailToggled: STABLE (function type)
160-
- onSkipButtonClick: STABLE (function type)
161-
- onConfirmButtonClick: STABLE (function type)
162-
163-
@Composable
164-
internal fun com.ninecraft.booket.feature.record.step_v2.EmotionItem(emotion: com.ninecraft.booket.core.model.Emotion, selectedEmotionDetails: kotlinx.collections.immutable.ImmutableList<kotlin.String>, onClick: kotlin.Function0<kotlin.Unit>, isSelected: kotlin.Boolean, onEmotionDetailRemove: kotlin.Function1<kotlin.String, kotlin.Unit>, modifier: androidx.compose.ui.Modifier): kotlin.Unit
16556
skippable: true
16657
restartable: true
16758
params:
168-
- emotion: STABLE (class with no mutable properties)
169-
- selectedEmotionDetails: STABLE (known stable type)
170-
- onClick: STABLE (function type)
171-
- isSelected: STABLE (primitive type)
172-
- onEmotionDetailRemove: STABLE (function type)
59+
- state: STABLE (class with no mutable properties)
17360
- modifier: STABLE (marked @Stable or @Immutable)
17461

17562
@Composable
17663
internal fun com.ninecraft.booket.feature.record.step_v2.EmotionStepV2(state: com.ninecraft.booket.feature.record.register.RecordRegisterUiState, modifier: androidx.compose.ui.Modifier): kotlin.Unit
177-
skippable: false
64+
skippable: true
17865
restartable: true
17966
params:
180-
- state: RUNTIME (requires runtime check)
67+
- state: STABLE (class with no mutable properties)
18168
- modifier: STABLE (marked @Stable or @Immutable)
18269

18370
@Composable
18471
internal fun com.ninecraft.booket.feature.record.step_v2.QuoteStepV2(state: com.ninecraft.booket.feature.record.register.RecordRegisterUiState, modifier: androidx.compose.ui.Modifier): kotlin.Unit
185-
skippable: false
72+
skippable: true
18673
restartable: true
18774
params:
188-
- state: RUNTIME (requires runtime check)
75+
- state: STABLE (class with no mutable properties)
18976
- modifier: STABLE (marked @Stable or @Immutable)
19077

0 commit comments

Comments
 (0)