Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: login #1418

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -55,7 +59,9 @@ class LoginActivity : BaseActivity(), LoginView {
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
setContent {
MifosTheme {
LoginScreen({
LoginScreen({ username, password ->
usernameContent = username
passwordContent = password
onLoginClicked()
}, {
onSignupClicked()
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("") }
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -134,5 +134,5 @@ fun LoginScreen(
@Preview(showSystemUi = true, device = "id:pixel_5")
@Composable
fun LoanScreenPreview() {
LoginScreen({}, {})
LoginScreen({ _, _ -> }, {})
}