Hide login with Qrcode and create account for now.

This commit is contained in:
Benoit Marty 2023-06-01 10:14:31 +02:00 committed by Benoit Marty
parent 9ec987f993
commit 72050b2a59
3 changed files with 61 additions and 24 deletions

View file

@ -0,0 +1,22 @@
/*
* Copyright (c) 2023 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.element.android.features.onboarding.impl
object OnBoardingConfig {
const val canLoginWithQrCode = false
const val canCreateAccount = false
}

View file

@ -49,6 +49,8 @@ class OnBoardingNode @AssistedInject constructor(
override fun View(modifier: Modifier) { override fun View(modifier: Modifier) {
OnBoardingScreen( OnBoardingScreen(
modifier = modifier, modifier = modifier,
canLoginWithQrCode = OnBoardingConfig.canLoginWithQrCode,
canCreateAccount = OnBoardingConfig.canCreateAccount,
onSignIn = this::onSignIn, onSignIn = this::onSignIn,
) )
} }

View file

@ -51,6 +51,8 @@ import io.element.android.libraries.testtags.testTag
@Composable @Composable
fun OnBoardingScreen( fun OnBoardingScreen(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
canLoginWithQrCode: Boolean,
canCreateAccount: Boolean,
onSignInWithQrCode: () -> Unit = {}, onSignInWithQrCode: () -> Unit = {},
onSignIn: () -> Unit = {}, onSignIn: () -> Unit = {},
onCreateAccount: () -> Unit = {}, onCreateAccount: () -> Unit = {},
@ -59,6 +61,8 @@ fun OnBoardingScreen(
modifier = modifier, modifier = modifier,
footer = { footer = {
OnBoardingButtons( OnBoardingButtons(
canLoginWithQrCode = canLoginWithQrCode,
canCreateAccount = canCreateAccount,
onSignInWithQrCode = onSignInWithQrCode, onSignInWithQrCode = onSignInWithQrCode,
onSignIn = onSignIn, onSignIn = onSignIn,
onCreateAccount = onCreateAccount, onCreateAccount = onCreateAccount,
@ -103,6 +107,8 @@ private fun ColumnScope.OnBoardingHeader() {
@Composable @Composable
private fun OnBoardingButtons( private fun OnBoardingButtons(
canLoginWithQrCode: Boolean,
canCreateAccount: Boolean,
onSignInWithQrCode: () -> Unit, onSignInWithQrCode: () -> Unit,
onSignIn: () -> Unit, onSignIn: () -> Unit,
onCreateAccount: () -> Unit, onCreateAccount: () -> Unit,
@ -114,6 +120,7 @@ private fun OnBoardingButtons(
horizontalAlignment = CenterHorizontally, horizontalAlignment = CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(16.dp) verticalArrangement = Arrangement.spacedBy(16.dp)
) { ) {
if (canLoginWithQrCode) {
Button( Button(
onClick = { onClick = {
onSignInWithQrCode() onSignInWithQrCode()
@ -129,6 +136,7 @@ private fun OnBoardingButtons(
Spacer(Modifier.width(14.dp)) Spacer(Modifier.width(14.dp))
Text(text = stringResource(id = R.string.screen_onboarding_sign_in_with_qr_code)) Text(text = stringResource(id = R.string.screen_onboarding_sign_in_with_qr_code))
} }
}
Button( Button(
onClick = { onClick = {
onSignIn() onSignIn()
@ -140,6 +148,7 @@ private fun OnBoardingButtons(
) { ) {
Text(text = stringResource(id = R.string.screen_onboarding_sign_in_manually)) Text(text = stringResource(id = R.string.screen_onboarding_sign_in_manually))
} }
if (canCreateAccount) {
OutlinedButton( OutlinedButton(
onClick = { onClick = {
onCreateAccount() onCreateAccount()
@ -152,6 +161,7 @@ private fun OnBoardingButtons(
} }
} }
} }
}
@Preview @Preview
@Composable @Composable
@ -165,5 +175,8 @@ internal fun OnBoardingScreenDarkPreview() =
@Composable @Composable
private fun ContentToPreview() { private fun ContentToPreview() {
OnBoardingScreen() OnBoardingScreen(
canLoginWithQrCode = true,
canCreateAccount = true,
)
} }