Skip to content

Update dependency io.nlopez.compose.rules:detekt to v0.4.0 #2635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
// Submit
Box(
modifier = Modifier
.padding(horizontal = 16.dp)
.padding(horizontal = 16.dp)
) {
ButtonColumnMolecule {
Button(
Expand Down Expand Up @@ -201,11 +201,14 @@
.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))

Check warning on line 209 in features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordView.kt

View check run for this annotation

Codecov / codecov/patch

features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordView.kt#L207-L209

Added lines #L207 - L209 were not covered by tests
}
),
placeholder = {
Text(text = stringResource(CommonStrings.common_username))
},
Expand Down Expand Up @@ -247,11 +250,14 @@
.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))

Check warning on line 258 in features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordView.kt

View check run for this annotation

Codecov / codecov/patch

features/login/impl/src/main/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordView.kt#L256-L258

Added lines #L256 - L258 were not covered by tests
}
),
onValueChange = {
val sanitized = it.sanitize()
passwordFieldState = sanitized
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 39 in libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/modifiers/ApplyIf.kt

View check run for this annotation

Codecov / codecov/patch

libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/modifiers/ApplyIf.kt#L39

Added line #L39 was not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading