Merge pull request #2635 from element-hq/renovate/io.nlopez.compose.rules-detekt-0.x

Update dependency io.nlopez.compose.rules:detekt to v0.4.0
This commit is contained in:
ganfra
2024-05-29 10:06:37 +02:00
committed by GitHub
6 changed files with 42 additions and 34 deletions

View File

@@ -60,7 +60,7 @@ allprojects {
config.from(files("$rootDir/tools/detekt/detekt.yml"))
}
dependencies {
detektPlugins("io.nlopez.compose.rules:detekt:0.3.12")
detektPlugins("io.nlopez.compose.rules:detekt:0.3.13")
}
// KtLint

View File

@@ -141,7 +141,7 @@ fun LoginPasswordView(
// Submit
Box(
modifier = Modifier
.padding(horizontal = 16.dp)
.padding(horizontal = 16.dp)
) {
ButtonColumnMolecule {
Button(
@@ -201,11 +201,14 @@ private fun LoginForm(
.fillMaxWidth()
.onTabOrEnterKeyFocusNext(focusManager)
.testTag(TestTags.loginEmailUsername)
.autofill(autofillTypes = listOf(AutofillType.Username), onFill = {
val sanitized = it.sanitize()
loginFieldState = sanitized
eventSink(LoginPasswordEvents.SetLogin(sanitized))
}),
.autofill(
autofillTypes = listOf(AutofillType.Username),
onFill = {
val sanitized = it.sanitize()
loginFieldState = sanitized
eventSink(LoginPasswordEvents.SetLogin(sanitized))
}
),
placeholder = {
Text(text = stringResource(CommonStrings.common_username))
},
@@ -247,11 +250,14 @@ private fun LoginForm(
.fillMaxWidth()
.onTabOrEnterKeyFocusNext(focusManager)
.testTag(TestTags.loginPassword)
.autofill(autofillTypes = listOf(AutofillType.Password), onFill = {
val sanitized = it.sanitize()
passwordFieldState = sanitized
eventSink(LoginPasswordEvents.SetPassword(sanitized))
}),
.autofill(
autofillTypes = listOf(AutofillType.Password),
onFill = {
val sanitized = it.sanitize()
passwordFieldState = sanitized
eventSink(LoginPasswordEvents.SetPassword(sanitized))
}
),
onValueChange = {
val sanitized = it.sanitize()
passwordFieldState = sanitized

View File

@@ -87,10 +87,13 @@ internal fun RoomListSearchView(
) {
Column(
modifier = modifier
.applyIf(state.isSearchActive, ifTrue = {
// Disable input interaction to underlying views
pointerInput(Unit) {}
})
.applyIf(
condition = state.isSearchActive,
ifTrue = {
// Disable input interaction to underlying views
pointerInput(Unit) {}
}
)
) {
if (state.isSearchActive) {
RoomListSearchContent(

View File

@@ -168,6 +168,7 @@ data class BloomLayer(
* @param bottomSoftEdgeAlpha The alpha value to apply to the bottom soft edge.
* @param alpha The alpha value to apply to the bloom effect.
*/
@SuppressWarnings("ModifierComposed")
fun Modifier.bloom(
hash: String?,
background: Color,
@@ -312,6 +313,7 @@ fun Modifier.bloom(
* @param bottomSoftEdgeAlpha The alpha value to apply to the bottom soft edge.
* @param alpha The alpha value to apply to the bloom effect.
*/
@SuppressWarnings("ModifierComposed")
fun Modifier.avatarBloom(
avatarData: AvatarData,
background: Color,

View File

@@ -16,30 +16,26 @@
package io.element.android.libraries.designsystem.modifiers
import android.annotation.SuppressLint
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
import androidx.compose.ui.platform.debugInspectorInfo
import androidx.compose.ui.platform.inspectable
/**
* Applies the [ifTrue] modifier when the [condition] is true, [ifFalse] otherwise.
*/
@SuppressLint("UnnecessaryComposedModifier") // It's actually necessary due to the `@Composable` lambdas
fun Modifier.applyIf(
condition: Boolean,
ifTrue: @Composable Modifier.() -> Modifier,
ifFalse: @Composable (Modifier.() -> Modifier)? = null
): Modifier =
composed(
inspectorInfo = debugInspectorInfo {
name = "applyIf"
value = condition
}
) {
when {
condition -> then(ifTrue(Modifier))
ifFalse != null -> then(ifFalse(Modifier))
else -> this
}
ifTrue: Modifier.() -> Modifier,
ifFalse: (Modifier.() -> Modifier)? = null
): Modifier = this then inspectable(
inspectorInfo = debugInspectorInfo {
name = "applyIf"
value = condition
}
) {
this then when {
condition -> ifTrue(Modifier)
ifFalse != null -> ifFalse(Modifier)
else -> Modifier
}
}

View File

@@ -213,6 +213,7 @@ private fun TextFieldValueContentToPreview() {
}
}
@Suppress("ModifierComposed")
@OptIn(ExperimentalComposeUiApi::class)
fun Modifier.autofill(autofillTypes: List<AutofillType>, onFill: (String) -> Unit) = composed {
val autofillNode = AutofillNode(autofillTypes, onFill = onFill)