feat: "try new login experience" button in login screen for those who know
Signed-off-by: Infi <infi@infi.sh>
This commit is contained in:
parent
6c20dee6c9
commit
214fadeaaa
|
|
@ -1,8 +1,10 @@
|
||||||
package chat.revolt.screens.login
|
package chat.revolt.screens.login
|
||||||
|
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.combinedClickable
|
||||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
|
@ -19,10 +21,12 @@ import androidx.compose.material3.LocalContentColor
|
||||||
import androidx.compose.material3.LocalTextStyle
|
import androidx.compose.material3.LocalTextStyle
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableIntStateOf
|
import androidx.compose.runtime.mutableIntStateOf
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
|
|
@ -45,10 +49,12 @@ import chat.revolt.components.generic.AnyLink
|
||||||
import chat.revolt.components.generic.Weblink
|
import chat.revolt.components.generic.Weblink
|
||||||
import com.chuckerteam.chucker.api.Chucker
|
import com.chuckerteam.chucker.api.Chucker
|
||||||
|
|
||||||
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun LoginGreetingScreen(navController: NavController) {
|
fun LoginGreetingScreen(navController: NavController) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
var catTaps by remember { mutableIntStateOf(0) }
|
var catTaps by remember { mutableIntStateOf(0) }
|
||||||
|
var showBoringButton by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|
@ -72,23 +78,27 @@ fun LoginGreetingScreen(navController: NavController) {
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.height(55.dp)
|
.height(55.dp)
|
||||||
.padding(bottom = 10.dp)
|
.padding(bottom = 10.dp)
|
||||||
.clickable(
|
.combinedClickable(
|
||||||
interactionSource = remember(::MutableInteractionSource),
|
interactionSource = remember(::MutableInteractionSource),
|
||||||
indication = null
|
indication = null,
|
||||||
) {
|
onClick = {
|
||||||
if (catTaps < 9) {
|
if (catTaps < 9) {
|
||||||
catTaps++
|
catTaps++
|
||||||
} else {
|
} else {
|
||||||
Toast
|
Toast
|
||||||
.makeText(
|
.makeText(
|
||||||
context,
|
context,
|
||||||
"🐈",
|
"🐈",
|
||||||
Toast.LENGTH_SHORT
|
Toast.LENGTH_SHORT
|
||||||
)
|
)
|
||||||
.show()
|
.show()
|
||||||
catTaps = 0
|
catTaps = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLongClick = {
|
||||||
|
showBoringButton = !showBoringButton
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
|
|
@ -145,6 +155,27 @@ fun LoginGreetingScreen(navController: NavController) {
|
||||||
Text(text = stringResource(R.string.signup))
|
Text(text = stringResource(R.string.signup))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AnimatedVisibility(showBoringButton) {
|
||||||
|
Spacer(modifier = Modifier.height(10.dp))
|
||||||
|
|
||||||
|
TextButton(
|
||||||
|
onClick = { navController.navigate("login2/init") },
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
|
Text(text = "Try new login experience", textAlign = TextAlign.Center)
|
||||||
|
Text(
|
||||||
|
text = "(beta)",
|
||||||
|
color = LocalContentColor.current.copy(alpha = 0.5f),
|
||||||
|
fontSize = 12.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
textAlign = TextAlign.Center
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(40.dp))
|
Spacer(modifier = Modifier.height(40.dp))
|
||||||
|
|
||||||
CompositionLocalProvider(
|
CompositionLocalProvider(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue