Name refactoring

This commit is contained in:
Vitor Pamplona 2024-01-30 13:52:02 -05:00
parent 3ff4db264a
commit 6b60b1434f
3 changed files with 9 additions and 9 deletions

View File

@ -39,11 +39,11 @@ fun LoginOrSignupScreen(
Crossfade(wantsNewUser, label = "LoginOrSignupScreen") { Crossfade(wantsNewUser, label = "LoginOrSignupScreen") {
if (it) { if (it) {
SignUpPage(accountViewModel = accountViewModel) { SignUpPage(accountStateViewModel = accountViewModel) {
wantsNewUser = false wantsNewUser = false
} }
} else { } else {
LoginPage(accountViewModel = accountViewModel, isFirstLogin = isFirstLogin) { LoginPage(accountStateViewModel = accountViewModel, isFirstLogin = isFirstLogin) {
wantsNewUser = true wantsNewUser = true
} }
} }

View File

@ -123,7 +123,7 @@ fun LoginPage() {
@OptIn(ExperimentalComposeUiApi::class) @OptIn(ExperimentalComposeUiApi::class)
@Composable @Composable
fun LoginPage( fun LoginPage(
accountViewModel: AccountStateViewModel, accountStateViewModel: AccountStateViewModel,
isFirstLogin: Boolean, isFirstLogin: Boolean,
onWantsToLogin: () -> Unit, onWantsToLogin: () -> Unit,
) { ) {
@ -209,7 +209,7 @@ fun LoginPage(
} }
if (acceptedTerms.value && key.value.text.isNotBlank()) { if (acceptedTerms.value && key.value.text.isNotBlank()) {
accountViewModel.login( accountStateViewModel.login(
key.value.text, key.value.text,
useProxy.value, useProxy.value,
proxyPort.value.toInt(), proxyPort.value.toInt(),
@ -331,7 +331,7 @@ fun LoginPage(
} }
if (acceptedTerms.value && key.value.text.isNotBlank()) { if (acceptedTerms.value && key.value.text.isNotBlank()) {
accountViewModel.login(key.value.text, useProxy.value, proxyPort.value.toInt()) { accountStateViewModel.login(key.value.text, useProxy.value, proxyPort.value.toInt()) {
errorMessage = context.getString(R.string.invalid_key) errorMessage = context.getString(R.string.invalid_key)
} }
} }
@ -444,7 +444,7 @@ fun LoginPage(
} }
if (acceptedTerms.value && key.value.text.isNotBlank()) { if (acceptedTerms.value && key.value.text.isNotBlank()) {
accountViewModel.login(key.value.text, useProxy.value, proxyPort.value.toInt()) { accountStateViewModel.login(key.value.text, useProxy.value, proxyPort.value.toInt()) {
errorMessage = context.getString(R.string.invalid_key) errorMessage = context.getString(R.string.invalid_key)
} }
} }

View File

@ -94,7 +94,7 @@ fun SignUpPage() {
@Composable @Composable
fun SignUpPage( fun SignUpPage(
accountViewModel: AccountStateViewModel, accountStateViewModel: AccountStateViewModel,
onWantsToLogin: () -> Unit, onWantsToLogin: () -> Unit,
) { ) {
val displayName = remember { mutableStateOf(TextFieldValue("")) } val displayName = remember { mutableStateOf(TextFieldValue("")) }
@ -163,7 +163,7 @@ fun SignUpPage(
} }
if (acceptedTerms.value && displayName.value.text.isNotBlank()) { if (acceptedTerms.value && displayName.value.text.isNotBlank()) {
accountViewModel.login(displayName.value.text, useProxy.value, proxyPort.value.toInt()) { accountStateViewModel.login(displayName.value.text, useProxy.value, proxyPort.value.toInt()) {
errorMessage = context.getString(R.string.invalid_key) errorMessage = context.getString(R.string.invalid_key)
} }
} }
@ -273,7 +273,7 @@ fun SignUpPage(
} }
if (acceptedTerms.value && displayName.value.text.isNotBlank()) { if (acceptedTerms.value && displayName.value.text.isNotBlank()) {
accountViewModel.newKey(useProxy.value, proxyPort.value.toInt(), displayName.value.text) accountStateViewModel.newKey(useProxy.value, proxyPort.value.toInt(), displayName.value.text)
} }
}, },
shape = RoundedCornerShape(Size35dp), shape = RoundedCornerShape(Size35dp),