Skip to content

Commit

Permalink
chore(Sonar): Fix some Sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianDevel committed Dec 17, 2024
1 parent a9a10da commit 48a6b99
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ fun SwissTransferInputChip(modifier: Modifier = Modifier, text: String, onDismis

val focusManager = LocalFocusManager.current

fun handleBackspaceKey() {
when {
isSelected -> onDismiss()
isFocused -> isSelected = true
}
}

fun onKeyEvent(event: KeyEvent): Boolean {
if (event.type != KeyEventType.KeyUp) return false

Expand All @@ -80,10 +87,7 @@ fun SwissTransferInputChip(modifier: Modifier = Modifier, text: String, onDismis
true
}
event.key == Key.Backspace || event.key == Key.Delete -> {
when {
isSelected -> onDismiss()
isFocused -> isSelected = true
}
handleBackspaceKey()
true
}
event.key == Key.NavigateOut -> {
Expand Down Expand Up @@ -143,9 +147,9 @@ private fun ChipLabel(text: String) {
}

private fun isDirectionalKey(key: Key): Boolean {
return key == Key.DirectionLeft || key == Key.DirectionRight || key == Key.DirectionUpLeft || key == Key.DirectionUp
|| key == Key.DirectionDown || key == Key.DirectionCenter || key == Key.DirectionDownLeft || key == Key.DirectionDownRight
|| key == Key.DirectionUpRight
return key == Key.DirectionLeft || key == Key.DirectionCenter || key == Key.DirectionRight
|| key == Key.DirectionUpLeft || key == Key.DirectionUp || key == Key.DirectionUpRight
|| key == Key.DirectionDownLeft || key == Key.DirectionDown || key == Key.DirectionDownRight
|| key == Key.SystemNavigationLeft || key == Key.SystemNavigationRight
|| key == Key.SystemNavigationUp || key == Key.SystemNavigationDown
|| key == Key.NavigatePrevious || key == Key.NavigateNext
Expand Down

0 comments on commit 48a6b99

Please sign in to comment.