Код: Выделить всё
Button(
onClick={
coroutineScope.launch {
var defloginstatus= async{sendLoginDataToDataBase(phoneNumber = initialInput1,password=initialInput2)}
loginstatus= runBlocking { defloginstatus.await() }
Log.d("MyTag",loginstatus.toString())
}
}
)
Код: Выделить всё
var loginstatus=0
/*
* 0 is the default
* -1 means phone Number not found
* 1 means login success
* -2 means login failure
* -3 means error in data fetching
*/
val database =Firebase.database(/*My DataBase URL*/)
var myRef:DatabaseReference
myRef=database.getReference("Users")
myRef.child(phoneNumber).get().addOnSuccessListener {
val keys=it.value
val setPassword=""
Log.d("MyTag","$keys")
if(keys==null){
loginstatus=-1
}
else{
if(setPassword==password){
loginstatus=1
Log.d("MyTag","Logged in")
}
else {
loginstatus=-2
}
}
}
.addOnFailureListener{
loginstatus=-3
}
Log.d("MyTag","Completed Execution")
return loginstatus
Здесь есть какие-нибудь направления? Я застрял...
Подробнее здесь: https://stackoverflow.com/questions/784 ... app-made-w
Мобильная версия