Skip to content

Commit

Permalink
fix detekt issues
Browse files Browse the repository at this point in the history
  • Loading branch information
saleniuk committed May 29, 2024
1 parent 7540dfb commit dc192a6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,3 @@ sealed class RemoveDeviceError {
data object InitError : RemoveDeviceError()
data class GenericError(val coreFailure: CoreFailure) : RemoveDeviceError()
}

Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,20 @@ fun ForgotLockCodeResettingDeviceDialog() {
onDismiss = {},
)
}

@PreviewMultipleThemes
@Composable
fun PreviewForgotLockCodeResetDeviceDialog() {
WireTheme {
ForgotLockCodeResetDeviceDialog(TextFieldState(),"Username", false, true, true, {}, {})
ForgotLockCodeResetDeviceDialog(TextFieldState(), "Username", false, true, true, {}, {})
}
}

@PreviewMultipleThemes
@Composable
fun PreviewForgotLockCodeResetDeviceWithoutPasswordDialog() {
WireTheme {
ForgotLockCodeResetDeviceDialog(TextFieldState(),"Username", true, true, true, {}, {})
ForgotLockCodeResetDeviceDialog(TextFieldState(), "Username", true, true, true, {}, {})
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,19 @@ fun ForgotLockCodeScreen(
onResetDevice = viewModel::onResetDevice,
)
if (dialogState is ForgotLockCodeDialogState.Visible) {
if (dialogState.loading) ForgotLockCodeResettingDeviceDialog()
else ForgotLockCodeResetDeviceDialog(
passwordTextState = viewModel.passwordTextState,
username = dialogState.username,
isPasswordRequired = dialogState.passwordRequired,
isPasswordValid = dialogState.passwordValid,
isResetDeviceEnabled = dialogState.resetDeviceEnabled,
onResetDeviceClicked = viewModel::onResetDeviceConfirmed,
onDialogDismissed = viewModel::onDialogDismissed,
)
if (dialogState.loading) {
ForgotLockCodeResettingDeviceDialog()
} else {
ForgotLockCodeResetDeviceDialog(
passwordTextState = viewModel.passwordTextState,
username = dialogState.username,
isPasswordRequired = dialogState.passwordRequired,
isPasswordValid = dialogState.passwordValid,
isResetDeviceEnabled = dialogState.resetDeviceEnabled,
onResetDeviceClicked = viewModel::onResetDeviceConfirmed,
onDialogDismissed = viewModel::onDialogDismissed,
)
}
}
if (error != null) {
val (title, message) = error.dialogErrorStrings(LocalContext.current.resources)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ fun SetLockCodeScreenContent(
elevation = dimensions().spacing0x,
title = stringResource(id = R.string.settings_set_lock_screen_title)
)
}) { internalPadding ->
}
) { internalPadding ->
Column(
modifier = Modifier
.fillMaxSize()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import org.junit.jupiter.api.extension.ExtendWith
class SetLockScreenViewModelTest {

@Test
fun `given new password input, when valid,then should update state`() {
fun `given new password input, when valid,then should update state`() = runTest {
val (arrangement, viewModel) = Arrangement()
.withValidPassword()
.arrange()
Expand Down

0 comments on commit dc192a6

Please sign in to comment.