From 248d0bad83a444de4d9aaa2315b91c9db89bb0aa Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 8 Jun 2023 10:32:24 +0200 Subject: [PATCH] Moar fixes --- .../ChangeAccountProviderView.kt | 2 +- .../impl/loginpassword/LoginPasswordView.kt | 41 +++++++------------ 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/ChangeAccountProviderView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/ChangeAccountProviderView.kt index f0adfd101b..4c7dab1961 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/ChangeAccountProviderView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/ChangeAccountProviderView.kt @@ -56,7 +56,7 @@ import io.element.android.libraries.designsystem.theme.components.TopAppBar fun ChangeAccountProviderView( state: ChangeAccountProviderState, modifier: Modifier = Modifier, - onBackPressed: () -> Unit, + onBackPressed: () -> Unit = {}, onAccountProviderClicked: (AccountProvider) -> Unit = {}, onOtherProviderClicked: () -> Unit = {}, ) { diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/loginpassword/LoginPasswordView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/loginpassword/LoginPasswordView.kt index 958ab94ae3..d52843ea5e 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/loginpassword/LoginPasswordView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/loginpassword/LoginPasswordView.kt @@ -133,11 +133,22 @@ fun LoginPasswordView( subTitle = stringResource(id = R.string.screen_login_form_header) ) Spacer(Modifier.height(32.dp)) - ServerDetailForm( - state = state, + LoginForm(state = state, isLoading = isLoading, - submit = ::submit + onSubmit = ::submit ) + Spacer(Modifier.height(28.dp)) + // Submit + ButtonWithProgress( + text = stringResource(R.string.screen_login_submit), + showProgress = isLoading, + onClick = ::submit, + enabled = state.submitEnabled, + modifier = Modifier + .fillMaxWidth() + .testTag(TestTags.loginContinue) + ) + Spacer(modifier = Modifier.height(32.dp)) } if (state.loginAction is Async.Failure) { @@ -149,30 +160,6 @@ fun LoginPasswordView( } } -@Composable -fun ServerDetailForm( - state: LoginPasswordState, - isLoading: Boolean, - submit: () -> Unit, - modifier: Modifier = Modifier, -) { - LoginForm(state = state, isLoading = isLoading, onSubmit = submit, modifier = modifier) - - Spacer(Modifier.height(28.dp)) - - // Submit - ButtonWithProgress( - text = stringResource(R.string.screen_login_submit), - showProgress = isLoading, - onClick = submit, - enabled = state.submitEnabled, - modifier = Modifier - .fillMaxWidth() - .testTag(TestTags.loginContinue) - ) - Spacer(modifier = Modifier.height(32.dp)) -} - @OptIn(ExperimentalComposeUiApi::class) @Composable internal fun LoginForm(