Hide login with Qrcode and create account for now.
This commit is contained in:
parent
9ec987f993
commit
72050b2a59
3 changed files with 61 additions and 24 deletions
|
|
@ -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
|
||||||
|
}
|
||||||
|
|
@ -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,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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,20 +120,22 @@ private fun OnBoardingButtons(
|
||||||
horizontalAlignment = CenterHorizontally,
|
horizontalAlignment = CenterHorizontally,
|
||||||
verticalArrangement = Arrangement.spacedBy(16.dp)
|
verticalArrangement = Arrangement.spacedBy(16.dp)
|
||||||
) {
|
) {
|
||||||
Button(
|
if (canLoginWithQrCode) {
|
||||||
onClick = {
|
Button(
|
||||||
onSignInWithQrCode()
|
onClick = {
|
||||||
},
|
onSignInWithQrCode()
|
||||||
enabled = true,
|
},
|
||||||
modifier = Modifier
|
enabled = true,
|
||||||
.fillMaxWidth()
|
modifier = Modifier
|
||||||
) {
|
.fillMaxWidth()
|
||||||
Icon(
|
) {
|
||||||
imageVector = Icons.Default.QrCode, contentDescription = null,
|
Icon(
|
||||||
tint = MaterialTheme.colorScheme.onPrimary
|
imageVector = Icons.Default.QrCode, contentDescription = null,
|
||||||
)
|
tint = MaterialTheme.colorScheme.onPrimary
|
||||||
Spacer(Modifier.width(14.dp))
|
)
|
||||||
Text(text = stringResource(id = R.string.screen_onboarding_sign_in_with_qr_code))
|
Spacer(Modifier.width(14.dp))
|
||||||
|
Text(text = stringResource(id = R.string.screen_onboarding_sign_in_with_qr_code))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Button(
|
Button(
|
||||||
onClick = {
|
onClick = {
|
||||||
|
|
@ -140,15 +148,17 @@ 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))
|
||||||
}
|
}
|
||||||
OutlinedButton(
|
if (canCreateAccount) {
|
||||||
onClick = {
|
OutlinedButton(
|
||||||
onCreateAccount()
|
onClick = {
|
||||||
},
|
onCreateAccount()
|
||||||
enabled = true,
|
},
|
||||||
modifier = Modifier
|
enabled = true,
|
||||||
.fillMaxWidth()
|
modifier = Modifier
|
||||||
) {
|
.fillMaxWidth()
|
||||||
Text(text = stringResource(id = R.string.screen_onboarding_sign_up))
|
) {
|
||||||
|
Text(text = stringResource(id = R.string.screen_onboarding_sign_up))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -165,5 +175,8 @@ internal fun OnBoardingScreenDarkPreview() =
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun ContentToPreview() {
|
private fun ContentToPreview() {
|
||||||
OnBoardingScreen()
|
OnBoardingScreen(
|
||||||
|
canLoginWithQrCode = true,
|
||||||
|
canCreateAccount = true,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue