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- theMvpViewclass
- All Implemented Interfaces:
MvpPresenter<V>
- Direct Known Subclasses:
RegistrationPresenter
public class LoginPresenter<V extends LoginView> extends MvpNullObjectBasePresenter<V>
TheMvpNullObjectBasePresenterclass forLoginActivity
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringAPPLEstatic java.lang.StringASSERTION_VALUEstatic java.lang.StringFACEBOOKstatic java.lang.StringGOOGLEstatic java.lang.StringINSTAGRAMstatic java.lang.StringMEMBER_ATTRIBUTEstatic java.lang.StringPASSWORD_VALUEstatic java.lang.StringTWITTER
-
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 AuthenticationAPIgetAuthenticationAPI()Get current instance ofAuthenticationAPIprotected voidgetInfo(InfoQueryParams infoQueryParams, java.lang.String clientId, java.lang.String clientSecret)Get the current info needed for configurationprotected InfoAPIgetInfoAPI()Get current instance ofInfoAPIprotected ListenerModel<BaseModel<java.util.Map<java.lang.String,java.lang.Object>>,java.util.Map<java.lang.String,java.lang.Object>>getInfoReceivedListener()Create a listener forInfoAPIprotected Listener<Authentication>getLoginListener()Create a listener forAuthenticationAPIvoidlogin(AuthenticationFieldParams fieldParams)Login with the following parameters and listenervoidlogout()Logouts the current user by clearing all saved informationprotected voidonInfoReceivedFailed(java.lang.String error)Called after a failed request for getting infoprotected voidonInfoReceivedSuccess(java.util.Map<java.lang.String,java.lang.Object> data)Called after a successful request for getting infoprotected voidonLoginFailed(java.lang.String error, int errorCode)Called after a failed login requestprotected voidonLoginSuccess(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
AuthenticationAPIrequests
-
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
InfoAPIrequests
-
getAuthenticationAPI
protected AuthenticationAPI getAuthenticationAPI()
Get current instance ofAuthenticationAPI- Returns:
AuthenticationAPIused on this presenter
-
getInfoAPI
protected InfoAPI getInfoAPI()
Get current instance ofInfoAPI- Returns:
InfoAPIused 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 ofAuthenticationused 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-InfoQueryParamsto useclientId-Stringclient idclientSecret-Stringclient secret
-
-