Class LoginPresenter<V extends LoginView>
- java.lang.Object
-
- com.cheetahdigital.uikit.architecture.mvp.MvpNullObjectBasePresenter<V>
-
- com.cheetahdigital.authentication.ui.login.LoginPresenter<V>
-
- Type Parameters:
V
- theMvpView
class
- All Implemented Interfaces:
MvpPresenter<V>
- Direct Known Subclasses:
RegistrationPresenter
public class LoginPresenter<V extends LoginView> extends MvpNullObjectBasePresenter<V>
TheMvpNullObjectBasePresenter
class forLoginActivity
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
APPLE
static java.lang.String
ASSERTION_VALUE
static java.lang.String
FACEBOOK
static java.lang.String
GOOGLE
static java.lang.String
INSTAGRAM
static java.lang.String
MEMBER_ATTRIBUTE
static java.lang.String
PASSWORD_VALUE
static java.lang.String
TWITTER
-
Constructor Summary
Constructors Constructor Description LoginPresenter()
Default ConstructorLoginPresenter(AuthenticationFieldParams fieldParams)
Create the presenter with a giveAuthenticationFieldParams
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected AuthenticationAPI
getAuthenticationAPI()
Get current instance ofAuthenticationAPI
protected void
getInfo(InfoQueryParams infoQueryParams, java.lang.String clientId, java.lang.String clientSecret)
Get the current info needed for configurationprotected InfoAPI
getInfoAPI()
Get current instance ofInfoAPI
protected ListenerModel<BaseModel<java.util.Map<java.lang.String,java.lang.Object>>,java.util.Map<java.lang.String,java.lang.Object>>
getInfoReceivedListener()
Create a listener forInfoAPI
protected Listener<Authentication>
getLoginListener()
Create a listener forAuthenticationAPI
void
login(AuthenticationFieldParams fieldParams)
Login with the following parameters and listenervoid
logout()
Logouts the current user by clearing all saved informationprotected void
onInfoReceivedFailed(java.lang.String error)
Called after a failed request for getting infoprotected void
onInfoReceivedSuccess(java.util.Map<java.lang.String,java.lang.Object> data)
Called after a successful request for getting infoprotected void
onLoginFailed(java.lang.String error, int errorCode)
Called after a failed login requestprotected void
onLoginSuccess(Authentication data)
Called after a successful login request-
Methods inherited from class com.cheetahdigital.uikit.architecture.mvp.MvpNullObjectBasePresenter
attachView, detachView, getView
-
-
-
-
Field Detail
-
FACEBOOK
public static final java.lang.String FACEBOOK
- See Also:
- Constant Field Values
-
INSTAGRAM
public static final java.lang.String INSTAGRAM
- See Also:
- Constant Field Values
-
GOOGLE
public static final java.lang.String GOOGLE
- See Also:
- Constant Field Values
-
APPLE
public static final java.lang.String APPLE
- See Also:
- Constant Field Values
-
TWITTER
public static final java.lang.String TWITTER
- See Also:
- Constant Field Values
-
ASSERTION_VALUE
public static final java.lang.String ASSERTION_VALUE
- See Also:
- Constant Field Values
-
PASSWORD_VALUE
public static final java.lang.String PASSWORD_VALUE
- See Also:
- Constant Field Values
-
MEMBER_ATTRIBUTE
public static final java.lang.String MEMBER_ATTRIBUTE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LoginPresenter
public LoginPresenter()
Default Constructor
-
LoginPresenter
public LoginPresenter(AuthenticationFieldParams fieldParams)
Create the presenter with a giveAuthenticationFieldParams
- Parameters:
fieldParams
- theAuthenticationFieldParams
-
-
Method Detail
-
getLoginListener
protected Listener<Authentication> getLoginListener()
Create a listener forAuthenticationAPI
- Returns:
- listener to handle
AuthenticationAPI
requests
-
getInfoReceivedListener
protected ListenerModel<BaseModel<java.util.Map<java.lang.String,java.lang.Object>>,java.util.Map<java.lang.String,java.lang.Object>> getInfoReceivedListener()
Create a listener forInfoAPI
- Returns:
- listener to handle
InfoAPI
requests
-
getAuthenticationAPI
protected AuthenticationAPI getAuthenticationAPI()
Get current instance ofAuthenticationAPI
- Returns:
AuthenticationAPI
used on this presenter
-
getInfoAPI
protected InfoAPI getInfoAPI()
Get current instance ofInfoAPI
- Returns:
InfoAPI
used on this presenter
-
onInfoReceivedFailed
protected void onInfoReceivedFailed(java.lang.String error)
Called after a failed request for getting info- Parameters:
error
- contains the detail of the error
-
onInfoReceivedSuccess
protected void onInfoReceivedSuccess(java.util.Map<java.lang.String,java.lang.Object> data)
Called after a successful request for getting info- Parameters:
data
- contains a mapped response of the custom info
-
onLoginFailed
protected void onLoginFailed(java.lang.String error, int errorCode)
Called after a failed login request- Parameters:
error
- contains the detail of the errorerrorCode
- code that represents the error
-
onLoginSuccess
protected void onLoginSuccess(Authentication data)
Called after a successful login request- Parameters:
data
- instance ofAuthentication
used for login details
-
login
public void login(AuthenticationFieldParams fieldParams)
Login with the following parameters and listener- Parameters:
fieldParams
-AuthenticationFieldParams
-
logout
public void logout()
Logouts the current user by clearing all saved information
-
getInfo
protected void getInfo(InfoQueryParams infoQueryParams, java.lang.String clientId, java.lang.String clientSecret)
Get the current info needed for configuration- Parameters:
infoQueryParams
-InfoQueryParams
to useclientId
-String
client idclientSecret
-String
client secret
-
-