Skip to content

Commit

Permalink
Limit length of custom port input to 5
Browse files Browse the repository at this point in the history
  • Loading branch information
Pururun committed Aug 31, 2023
1 parent a0fa23f commit bb15532
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import net.mullvad.mullvadvpn.R
import net.mullvad.mullvadvpn.compose.button.ActionButton
import net.mullvad.mullvadvpn.compose.test.CUSTOM_PORT_DIALOG_INPUT_TEST_TAG
import net.mullvad.mullvadvpn.compose.textfield.CustomPortTextField
import net.mullvad.mullvadvpn.lib.theme.AlphaDescription
import net.mullvad.mullvadvpn.lib.theme.AlphaDisabled
Expand Down Expand Up @@ -119,7 +118,7 @@ fun CustomPortDialog(
isValidValue =
port.value.isNotEmpty() &&
allowedPortRanges.isPortInValidRanges(port.value.toIntOrNull() ?: 0),
modifier = Modifier.testTag(CUSTOM_PORT_DIALOG_INPUT_TEST_TAG)
maxCharLength = 5
)
Spacer(modifier = Modifier.height(Dimens.smallPadding))
Text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ fun CustomPortTextField(
modifier: Modifier = Modifier,
onSubmit: (String) -> Unit,
onValueChanged: (String) -> Unit,
isValidValue: Boolean
isValidValue: Boolean,
maxCharLength: Int
) {
CustomTextField(
value = value,
Expand All @@ -24,6 +25,7 @@ fun CustomPortTextField(
onSubmit = onSubmit,
isDigitsOnlyAllowed = true,
isEnabled = true,
isValidValue = isValidValue
isValidValue = isValidValue,
maxCharLength = maxCharLength
)
}

0 comments on commit bb15532

Please sign in to comment.