j have a problem with abmaterial autentication, wiht resumbale sub
B4X:
public Sub CheckLogin(login As String, password As String) As Boolean
' check if the login is valid and return true if it does
Dim rs As ResumableSub = LeggiConfig(login, password)
Wait For (rs) Complete (Result As Boolean)
Return Result
End Sub
Sorry for little information , but the error is in the routine
public Sub CheckLogin(login As String, password As String) As Boolean
Error
Main - 72: The return type from Resumable routines must be ResumableSub (or nothing).
but i can't change this routine because is part of ABMaterial ...
thanks
public Sub CheckLogin(login As String, password As String) As Boolean
' check if the login is valid and return true if it does
Dim rs As ResumableSub = LeggiConfig(login, password)
wait For (rs) Complete (Result As Int)
If Result = 1 Then
Return True
Else
Return False
End If
End Sub
i changed to int but the same problem
on line CheckLogin ( Main - 72: The return type from Resumable routines must be ResumableSub (or nothing). )
Hello,
i need to call a API on a remote server , for autentication by login and password,
but i need to wait the finish he call ...
LeggiConfig do that !!!
public Sub CheckLogin(login As String, password As String) As Boolean
' check if the login is valid and return true if it does
Dim rs As ResumableSub = LeggiConfig(login, password)
wait For (rs) Complete (Result As object)
If Result = 1 Then
Return True
Else
Return False
End If
End Sub
And you don't need to convert int to Boolean, if x=True or if x=1 is exactly the same. 1 is true, 0 is false
It has nothing to do with ABMaterial (which is a library), but is normal B4J code. You can change those parts to whatever you need.
You can probably just skip this method all together and just call your LeggiConfig method directly where you are calling CheckLogin:
B4X:
' something like
'if CheckLogin(login,password) then
' replace by
Dim rs As ResumableSub = LeggiConfig(login, password)
wait For (rs) Complete (Result As object)
If Result = 1 Then
' do whatever you need to do if the login is ok
Else
' do whever you want to do if the login is not ok
End If