Skip to content

Commit c128930

Browse files
committed
Apply spotless formatting and fix ktlint property-naming violation
Renamed HANDLE_INPUT_DEBOUNCE_TIME to handleInputDebounceTime: ktlint's standard:property-naming rule requires camelCase once it's a mutable var rather than a const val. Also removes the stray _root_ide_package_ IDE artifact and applies spotlessApply's formatting/unused-import cleanup across files touched in this branch.
1 parent 7263212 commit c128930

11 files changed

Lines changed: 40 additions & 66 deletions

File tree

datacapture/src/commonMain/kotlin/dev/ohs/fhir/datacapture/views/components/DateFieldItem.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ internal fun DateFieldItem(
139139
text = formattedText,
140140
selection = TextRange(dateInputFormat.pattern.length),
141141
)
142-
postDelayedNewDateInput(DateInput(formattedText, localDate), HANDLE_INPUT_DEBOUNCE_TIME)
142+
postDelayedNewDateInput(DateInput(formattedText, localDate), handleInputDebounceTime)
143143
}
144144
}
145145
},

datacapture/src/commonMain/kotlin/dev/ohs/fhir/datacapture/views/components/EditTextFieldItem.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ import org.jetbrains.compose.ui.tooling.preview.Preview
5454

5555
internal const val EDIT_TEXT_FIELD_TEST_TAG = "text_input_edit_text"
5656
internal const val UNIT_TEXT_TEST_TAG = "unit_text_view"
57-
internal var HANDLE_INPUT_DEBOUNCE_TIME = 500L
57+
internal var handleInputDebounceTime = 500L
5858

5959
@Composable
6060
internal fun EditTextFieldItem(modifier: Modifier, textFieldState: EditTextFieldState) {
@@ -183,7 +183,7 @@ internal data class EditTextFieldState(
183183
coroutineScope.launch {
184184
snapshotFlow { inputText }
185185
.drop(1) // Drops the initial value emitted by snapshotFlow
186-
.debounce(HANDLE_INPUT_DEBOUNCE_TIME)
186+
.debounce(handleInputDebounceTime)
187187
.collectLatest { handleTextInputChange(it) }
188188
}
189189
}

datacapture/src/commonMain/kotlin/dev/ohs/fhir/datacapture/views/components/OptionDialogSelect.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ import androidx.compose.ui.unit.dp
4949
import androidx.compose.ui.window.Dialog
5050
import androidx.compose.ui.window.DialogProperties
5151
import dev.ohs.fhir.datacapture.extensions.displayString
52-
import dev.ohs.fhir.datacapture.extensions.elementValue
5352
import dev.ohs.fhir.datacapture.extensions.itemAnswerOptionImage
5453
import dev.ohs.fhir.datacapture.extensions.optionExclusive
5554
import dev.ohs.fhir.datacapture.extensions.toAnnotatedString

datacapture/src/commonMain/kotlin/dev/ohs/fhir/datacapture/views/factories/BooleanChoiceViewFactory.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ import dev.ohs.fhir.model.r4.QuestionnaireResponse
4343
import kotlin_fhir_data_capture.datacapture.generated.resources.Res
4444
import kotlin_fhir_data_capture.datacapture.generated.resources.no
4545
import kotlin_fhir_data_capture.datacapture.generated.resources.yes
46-
import kotlinx.coroutines.Dispatchers
4746
import kotlinx.coroutines.launch
4847
import org.jetbrains.compose.resources.stringResource
4948

datacapture/src/commonTest/kotlin/dev/ohs/fhir/datacapture/views/factories/DecimalTextInputFactoryTest.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ import dev.ohs.fhir.datacapture.views.QuestionTextConfiguration
3838
import dev.ohs.fhir.datacapture.views.QuestionnaireViewItem
3939
import dev.ohs.fhir.datacapture.views.components.EDIT_TEXT_FIELD_TEST_TAG
4040
import dev.ohs.fhir.datacapture.views.components.ERROR_TEXT_AT_HEADER_TEST_TAG
41-
import dev.ohs.fhir.datacapture.views.components.HANDLE_INPUT_DEBOUNCE_TIME
4241
import dev.ohs.fhir.datacapture.views.components.QUESTION_HEADER_TAG
4342
import dev.ohs.fhir.datacapture.views.components.UNIT_TEXT_TEST_TAG
43+
import dev.ohs.fhir.datacapture.views.components.handleInputDebounceTime
4444
import dev.ohs.fhir.model.r4.Code
4545
import dev.ohs.fhir.model.r4.Coding
4646
import dev.ohs.fhir.model.r4.Decimal
@@ -60,13 +60,14 @@ class DecimalTextInputFactoryTest {
6060
@BeforeTest
6161
fun setUp() {
6262
// The debounce relies on a real delay(), which runComposeUiTest's virtual clock does not
63-
// resume on non-Android targets (https://github.com/JetBrains/compose-multiplatform/issues/4805).
64-
HANDLE_INPUT_DEBOUNCE_TIME = 0L
63+
// resume on non-Android targets
64+
// (https://github.com/JetBrains/compose-multiplatform/issues/4805).
65+
handleInputDebounceTime = 0L
6566
}
6667

6768
@AfterTest
6869
fun tearDown() {
69-
HANDLE_INPUT_DEBOUNCE_TIME = 500L
70+
handleInputDebounceTime = 500L
7071
}
7172

7273
@Composable

datacapture/src/commonTest/kotlin/dev/ohs/fhir/datacapture/views/factories/IntegerTextInputFactoryTest.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ import dev.ohs.fhir.datacapture.views.QuestionTextConfiguration
3737
import dev.ohs.fhir.datacapture.views.QuestionnaireViewItem
3838
import dev.ohs.fhir.datacapture.views.components.EDIT_TEXT_FIELD_TEST_TAG
3939
import dev.ohs.fhir.datacapture.views.components.ERROR_TEXT_AT_HEADER_TEST_TAG
40-
import dev.ohs.fhir.datacapture.views.components.HANDLE_INPUT_DEBOUNCE_TIME
4140
import dev.ohs.fhir.datacapture.views.components.QUESTION_HEADER_TAG
41+
import dev.ohs.fhir.datacapture.views.components.handleInputDebounceTime
4242
import dev.ohs.fhir.model.r4.Enumeration
4343
import dev.ohs.fhir.model.r4.Extension
4444
import dev.ohs.fhir.model.r4.Integer
@@ -55,13 +55,14 @@ class IntegerTextInputFactoryTest {
5555
@BeforeTest
5656
fun setUp() {
5757
// The debounce relies on a real delay(), which runComposeUiTest's virtual clock does not
58-
// resume on non-Android targets (https://github.com/JetBrains/compose-multiplatform/issues/4805).
59-
HANDLE_INPUT_DEBOUNCE_TIME = 0L
58+
// resume on non-Android targets
59+
// (https://github.com/JetBrains/compose-multiplatform/issues/4805).
60+
handleInputDebounceTime = 0L
6061
}
6162

6263
@AfterTest
6364
fun tearDown() {
64-
HANDLE_INPUT_DEBOUNCE_TIME = 500L
65+
handleInputDebounceTime = 500L
6566
}
6667

6768
@Composable

datacapture/src/commonTest/kotlin/dev/ohs/fhir/datacapture/views/factories/MultiLineTextInputFactoryTest.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ import dev.ohs.fhir.datacapture.views.QuestionTextConfiguration
3737
import dev.ohs.fhir.datacapture.views.QuestionnaireViewItem
3838
import dev.ohs.fhir.datacapture.views.components.EDIT_TEXT_FIELD_TEST_TAG
3939
import dev.ohs.fhir.datacapture.views.components.ERROR_TEXT_AT_HEADER_TEST_TAG
40-
import dev.ohs.fhir.datacapture.views.components.HANDLE_INPUT_DEBOUNCE_TIME
4140
import dev.ohs.fhir.datacapture.views.components.QUESTION_HEADER_TAG
41+
import dev.ohs.fhir.datacapture.views.components.handleInputDebounceTime
4242
import dev.ohs.fhir.model.r4.Enumeration
4343
import dev.ohs.fhir.model.r4.Extension
4444
import dev.ohs.fhir.model.r4.Integer
@@ -56,13 +56,14 @@ class MultiLineTextInputFactoryTest {
5656
@BeforeTest
5757
fun setUp() {
5858
// The debounce relies on a real delay(), which runComposeUiTest's virtual clock does not
59-
// resume on non-Android targets (https://github.com/JetBrains/compose-multiplatform/issues/4805).
60-
HANDLE_INPUT_DEBOUNCE_TIME = 0L
59+
// resume on non-Android targets
60+
// (https://github.com/JetBrains/compose-multiplatform/issues/4805).
61+
handleInputDebounceTime = 0L
6162
}
6263

6364
@AfterTest
6465
fun tearDown() {
65-
HANDLE_INPUT_DEBOUNCE_TIME = 500L
66+
handleInputDebounceTime = 500L
6667
}
6768

6869
@Composable

datacapture/src/commonTest/kotlin/dev/ohs/fhir/datacapture/views/factories/PhoneNumberTextInputFactoryTest.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ import dev.ohs.fhir.datacapture.validation.Invalid
3838
import dev.ohs.fhir.datacapture.validation.NotValidated
3939
import dev.ohs.fhir.datacapture.views.QuestionnaireViewItem
4040
import dev.ohs.fhir.datacapture.views.components.EDIT_TEXT_FIELD_TEST_TAG
41-
import dev.ohs.fhir.datacapture.views.components.HANDLE_INPUT_DEBOUNCE_TIME
4241
import dev.ohs.fhir.datacapture.views.components.QUESTION_HEADER_TAG
42+
import dev.ohs.fhir.datacapture.views.components.handleInputDebounceTime
4343
import dev.ohs.fhir.model.r4.Code
4444
import dev.ohs.fhir.model.r4.CodeableConcept
4545
import dev.ohs.fhir.model.r4.Coding
@@ -60,13 +60,14 @@ class PhoneNumberTextInputFactoryTest {
6060
@BeforeTest
6161
fun setUp() {
6262
// The debounce relies on a real delay(), which runComposeUiTest's virtual clock does not
63-
// resume on non-Android targets (https://github.com/JetBrains/compose-multiplatform/issues/4805).
64-
HANDLE_INPUT_DEBOUNCE_TIME = 0L
63+
// resume on non-Android targets
64+
// (https://github.com/JetBrains/compose-multiplatform/issues/4805).
65+
handleInputDebounceTime = 0L
6566
}
6667

6768
@AfterTest
6869
fun tearDown() {
69-
HANDLE_INPUT_DEBOUNCE_TIME = 500L
70+
handleInputDebounceTime = 500L
7071
}
7172

7273
@Composable

datacapture/src/commonTest/kotlin/dev/ohs/fhir/datacapture/views/factories/QuantityViewFactoryTest.kt

Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,7 @@ class QuantityViewFactoryTest {
117117
QuestionnaireResponse.Item.Answer(
118118
value =
119119
QuestionnaireResponse.Item.Answer.Value.Quantity(
120-
value =
121-
_root_ide_package_.dev.ohs.fhir.datacapture.views.factories.quantity(
122-
value = "5".toBigDecimal()
123-
)
120+
value = quantity(value = "5".toBigDecimal())
124121
)
125122
)
126123
),
@@ -151,10 +148,7 @@ class QuantityViewFactoryTest {
151148
QuestionnaireResponse.Item.Answer(
152149
value =
153150
QuestionnaireResponse.Item.Answer.Value.Quantity(
154-
value =
155-
_root_ide_package_.dev.ohs.fhir.datacapture.views.factories.quantity(
156-
value = "5".toBigDecimal()
157-
)
151+
value = quantity(value = "5".toBigDecimal())
158152
)
159153
)
160154
),
@@ -197,12 +191,7 @@ class QuantityViewFactoryTest {
197191
listOf(
198192
QuestionnaireResponse.Item.Answer(
199193
value =
200-
QuestionnaireResponse.Item.Answer.Value.Quantity(
201-
value =
202-
_root_ide_package_.dev.ohs.fhir.datacapture.views.factories.quantity(
203-
unit = "kg"
204-
)
205-
)
194+
QuestionnaireResponse.Item.Answer.Value.Quantity(value = quantity(unit = "kg"))
206195
)
207196
),
208197
),
@@ -228,11 +217,7 @@ class QuantityViewFactoryTest {
228217
Questionnaire.Item.Initial(
229218
value =
230219
Questionnaire.Item.Initial.Value.Quantity(
231-
value =
232-
_root_ide_package_.dev.ohs.fhir.datacapture.views.factories.quantity(
233-
unit = "kg",
234-
code = "kilo",
235-
)
220+
value = quantity(unit = "kg", code = "kilo")
236221
)
237222
)
238223
),
@@ -262,12 +247,7 @@ class QuantityViewFactoryTest {
262247
listOf(
263248
QuestionnaireResponse.Item.Answer(
264249
value =
265-
QuestionnaireResponse.Item.Answer.Value.Quantity(
266-
value =
267-
_root_ide_package_.dev.ohs.fhir.datacapture.views.factories.quantity(
268-
unit = "kg"
269-
)
270-
)
250+
QuestionnaireResponse.Item.Answer.Value.Quantity(value = quantity(unit = "kg"))
271251
)
272252
),
273253
),
@@ -329,10 +309,7 @@ class QuantityViewFactoryTest {
329309
QuestionnaireResponse.Item.Answer(
330310
value =
331311
QuestionnaireResponse.Item.Answer.Value.Quantity(
332-
value =
333-
_root_ide_package_.dev.ohs.fhir.datacapture.views.factories.quantity(
334-
value = 22.5.toBigDecimal()
335-
)
312+
value = quantity(value = 22.5.toBigDecimal())
336313
)
337314
)
338315
),
@@ -480,7 +457,7 @@ class QuantityViewFactoryTest {
480457

481458
with(answerHolder!!.single().value?.asQuantity()?.value) {
482459
shouldBe(
483-
_root_ide_package_.dev.ohs.fhir.datacapture.views.factories.quantity(
460+
quantity(
484461
value = 22.0.toBigDecimal(),
485462
unit = "centimeter",
486463
code = "cm",
@@ -514,7 +491,7 @@ class QuantityViewFactoryTest {
514491

515492
with(answerHolder!!.single().value?.asQuantity()?.value) {
516493
shouldBe(
517-
_root_ide_package_.dev.ohs.fhir.datacapture.views.factories.quantity(
494+
quantity(
518495
value = 22.0.toBigDecimal(),
519496
unit = "centimeter",
520497
code = "cm",
@@ -658,10 +635,7 @@ class QuantityViewFactoryTest {
658635
QuestionnaireResponse.Item.Answer(
659636
value =
660637
QuestionnaireResponse.Item.Answer.Value.Quantity(
661-
value =
662-
_root_ide_package_.dev.ohs.fhir.datacapture.views.factories.quantity(
663-
value = "5".toBigDecimal()
664-
)
638+
value = quantity(value = "5".toBigDecimal())
665639
)
666640
)
667641
),
@@ -688,10 +662,7 @@ class QuantityViewFactoryTest {
688662
QuestionnaireResponse.Item.Answer(
689663
value =
690664
QuestionnaireResponse.Item.Answer.Value.Quantity(
691-
value =
692-
_root_ide_package_.dev.ohs.fhir.datacapture.views.factories.quantity(
693-
value = "7".toBigDecimal()
694-
)
665+
value = quantity(value = "7".toBigDecimal())
695666
)
696667
)
697668
),

datacapture/src/commonTest/kotlin/dev/ohs/fhir/datacapture/views/factories/SingleLineTextInputFactoryTest.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ import dev.ohs.fhir.datacapture.views.QuestionTextConfiguration
3737
import dev.ohs.fhir.datacapture.views.QuestionnaireViewItem
3838
import dev.ohs.fhir.datacapture.views.components.EDIT_TEXT_FIELD_TEST_TAG
3939
import dev.ohs.fhir.datacapture.views.components.ERROR_TEXT_AT_HEADER_TEST_TAG
40-
import dev.ohs.fhir.datacapture.views.components.HANDLE_INPUT_DEBOUNCE_TIME
4140
import dev.ohs.fhir.datacapture.views.components.QUESTION_HEADER_TAG
41+
import dev.ohs.fhir.datacapture.views.components.handleInputDebounceTime
4242
import dev.ohs.fhir.model.r4.Enumeration
4343
import dev.ohs.fhir.model.r4.Extension
4444
import dev.ohs.fhir.model.r4.Integer
@@ -56,13 +56,14 @@ class SingleLineTextInputFactoryTest {
5656
@BeforeTest
5757
fun setUp() {
5858
// The debounce relies on a real delay(), which runComposeUiTest's virtual clock does not
59-
// resume on non-Android targets (https://github.com/JetBrains/compose-multiplatform/issues/4805).
60-
HANDLE_INPUT_DEBOUNCE_TIME = 0L
59+
// resume on non-Android targets
60+
// (https://github.com/JetBrains/compose-multiplatform/issues/4805).
61+
handleInputDebounceTime = 0L
6162
}
6263

6364
@AfterTest
6465
fun tearDown() {
65-
HANDLE_INPUT_DEBOUNCE_TIME = 500L
66+
handleInputDebounceTime = 500L
6667
}
6768

6869
@Composable

0 commit comments

Comments
 (0)