TP-56675 update compose bom version to 2024-02-02 (#386)

Co-authored-by: Aparna Vadlamani <aparna.vadlamani@navi.com>
This commit is contained in:
Hitesh Kumar
2024-03-28 19:02:18 +05:30
committed by GitHub
parent 973a03bc3d
commit 67a096ca9a
5 changed files with 29 additions and 10 deletions

View File

@@ -16,7 +16,7 @@ androidx-test-espresso = "3.5.1"
androidx-test-junit = "1.1.5"
androidx-uiautomator = "2.2.0"
coil = "2.5.0"
compose-bom = "2023.10.01"
compose-bom = "2024.02.02"
compose-lib = "1.5.8"
gson = "2.10.1"
firebase-bom = "32.8.0"
@@ -24,7 +24,7 @@ hilt = "2.48"
junit = "4.13.2"
kotlin = "1.9.22"
ksp = "1.9.22-1.0.17"
lottie = "6.1.0"
lottie = "6.4.0"
mvel2 = "2.4.15.Final"
navi-alfred = "1.0.20"
navigation-compose = "2.6.0"

View File

@@ -36,6 +36,7 @@ import com.navi.uitron.UiTronSdkManager
import com.navi.uitron.model.data.*
import com.navi.uitron.model.ui.MultiSectionTextFieldProperty
import com.navi.uitron.modifer.ModifierBuilder
import com.navi.uitron.utils.INVALID_INDEX
import com.navi.uitron.utils.REMOVE_FOCUS_STATE
import com.navi.uitron.utils.ShapeUtil
import com.navi.uitron.utils.alfredMaskSensitiveComposable
@@ -233,6 +234,12 @@ class MultiSectionTextFieldRenderer() : Renderer<MultiSectionTextFieldProperty>
}
)
) {
var currentFocusedIndex by remember { mutableIntStateOf(INVALID_INDEX) }
LaunchedEffect(currentFocusedIndex) {
if (currentFocusedIndex != INVALID_INDEX) {
focusRequesters.getOrNull(currentFocusedIndex)?.requestFocus()
}
}
val maxCharList =
(0 until property.textFieldPropertyList.size).map { index ->
property.textFieldPropertyList.getOrNull(index)?.maxChar
@@ -266,7 +273,7 @@ class MultiSectionTextFieldRenderer() : Renderer<MultiSectionTextFieldProperty>
focusRequesters.getOrNull(index)?.freeFocus() ==
true
) {
focusRequesters.getOrNull(index + 1)?.requestFocus()
currentFocusedIndex = index + 1
}
inputValues[index].value = value
} else {
@@ -290,7 +297,7 @@ class MultiSectionTextFieldRenderer() : Renderer<MultiSectionTextFieldProperty>
}
}
if (focusRequesters.getOrNull(index)?.freeFocus() == true) {
focusRequesters.getOrNull(index + 1)?.requestFocus()
currentFocusedIndex = index + 1
}
}
doOnValueChange(
@@ -324,7 +331,7 @@ class MultiSectionTextFieldRenderer() : Renderer<MultiSectionTextFieldProperty>
event.key == Key.Backspace &&
cellValue.text.isEmpty()
) {
focusRequesters.getOrNull(index - 1)?.requestFocus()
currentFocusedIndex = index - 1
}
}
false

View File

@@ -59,6 +59,7 @@ import com.navi.uitron.model.data.UiTronData
import com.navi.uitron.model.ui.*
import com.navi.uitron.modifer.ModifierBuilder
import com.navi.uitron.utils.EMPTY
import com.navi.uitron.utils.INVALID_INDEX
import com.navi.uitron.utils.ShapeUtil
import com.navi.uitron.utils.alfredMaskSensitiveComposable
import com.navi.uitron.utils.clip
@@ -235,6 +236,13 @@ class OtpBoxRenderer : Renderer<OtpBoxProperty> {
uiTronViewModel.handleActions(otpBoxData?.onDeFocusAction)
}
}
var currentFocusedIndex by remember { mutableIntStateOf(INVALID_INDEX) }
LaunchedEffect(currentFocusedIndex) {
if (currentFocusedIndex != INVALID_INDEX) {
val focusedIndex = getFocusedIndex(otpElementsList)
requesterList[focusedIndex].requestFocus()
}
}
repeat(property.visibleBoxCount ?: DEFAULT_NUMBER_OF_BOXES) { index ->
var borderColor by
remember(otpBoxData?.hasError) {
@@ -270,13 +278,16 @@ class OtpBoxRenderer : Renderer<OtpBoxProperty> {
Modifier.onFocusChanged {
val focusedIndex = getFocusedIndex(otpElementsList)
if (it.isFocused) {
currentFocusedIndex = index
if (focusedIndex == index) {
isViewFocused = true
uiTronViewModel.handleActions(otpBoxData?.onFocusAction)
} else {
requesterList[focusedIndex].requestFocus()
}
} else if (it.isFocused.not()) {
} else if (
it.isFocused.not() &&
(focusedIndex != index ||
otp(otpElementsList).length == otpElementsList.size)
) {
isViewFocused = false
}
}

View File

@@ -46,3 +46,4 @@ const val FLOAT_ANIMATION = "FloatAnimation"
const val COLOR_ANIMATION = "ColorAnimation"
const val INT_ANIMATION = "IntAnimation"
const val OFFSET_ANIMATION = "OffsetAnimation"
const val INVALID_INDEX = -1

View File

@@ -762,7 +762,7 @@ fun String?.toDoubleWithSafe(): Double {
}
}
fun getTextAlignment(textAlignment: String?): TextAlign? {
fun getTextAlignment(textAlignment: String?): TextAlign {
return when (textAlignment) {
TextAlign.Start.toString() -> TextAlign.Start
TextAlign.End.toString() -> TextAlign.End
@@ -770,7 +770,7 @@ fun getTextAlignment(textAlignment: String?): TextAlign? {
TextAlign.Left.toString() -> TextAlign.Left
TextAlign.Right.toString() -> TextAlign.Right
TextAlign.Justify.toString() -> TextAlign.Justify
else -> null
else -> TextAlign.Unspecified
}
}