diff --git a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/auth/ui/LoginActivity.kt b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/auth/ui/LoginActivity.kt index d332dd1f6..999c41270 100644 --- a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/auth/ui/LoginActivity.kt +++ b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/auth/ui/LoginActivity.kt @@ -44,6 +44,10 @@ class LoginActivity : BaseActivity(), LoginView { private var googleSignInClient: GoogleSignInClient? = null private var account: GoogleSignInAccount? = null private var mMifosSavingProductId = 0 + + private var usernameContent: String = "" + private var passwordContent: String = "" + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = ActivityLoginBinding.inflate(layoutInflater) @@ -55,7 +59,9 @@ class LoginActivity : BaseActivity(), LoginView { setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed) setContent { MifosTheme { - LoginScreen({ + LoginScreen({ username, password -> + usernameContent = username + passwordContent = password onLoginClicked() }, { onSignupClicked() @@ -105,17 +111,13 @@ class LoginActivity : BaseActivity(), LoginView { } private fun handleLoginInputChanged() { - val usernameContent = binding.etUsername.text.toString().trim() - val passwordContent = binding.etPassword.text.toString().trim() mPresenter.handleLoginButtonStatus(usernameContent, passwordContent) } fun onLoginClicked() { hideSoftKeyboard(this) showProgressDialog(Constants.LOGGING_IN) - mLoginPresenter.loginUser( - binding.etUsername.text.toString().trim(), binding.etPassword.text.toString().trim() - ) + mLoginPresenter.loginUser(usernameContent, passwordContent) } fun onSignupClicked() { diff --git a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/auth/ui/LoginScreen.kt b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/auth/ui/LoginScreen.kt index 77fd70b97..1da07a778 100644 --- a/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/auth/ui/LoginScreen.kt +++ b/mifospay/src/main/java/org/mifos/mobilewallet/mifospay/auth/ui/LoginScreen.kt @@ -32,7 +32,7 @@ import org.mifos.mobilewallet.mifospay.theme.styleNormal18sp @Composable fun LoginScreen( - login: () -> Unit, + login: (username: String, password: String) -> Unit, signUp: () -> Unit ) { var userName by rememberSaveable { mutableStateOf("") } @@ -83,7 +83,7 @@ fun LoginScreen( colors = ButtonDefaults.buttonColors(backgroundColor = Color.Black), enabled = userName.isNotEmpty() && password.isNotEmpty(), onClick = { - login.invoke() + login.invoke(userName, password) } ) { Text(text = "Login", style = styleMedium16sp.copy(color = Color.White)) @@ -134,5 +134,5 @@ fun LoginScreen( @Preview(showSystemUi = true, device = "id:pixel_5") @Composable fun LoanScreenPreview() { - LoginScreen({}, {}) + LoginScreen({ _, _ -> }, {}) }