Class RegistrationPresenter<T extends RegistrationView>
- java.lang.Object
-
- com.cheetahdigital.uikit.architecture.mvp.MvpNullObjectBasePresenter<V>
-
- com.cheetahdigital.authentication.ui.login.LoginPresenter<T>
-
- com.cheetahdigital.authentication.ui.registration.RegistrationPresenter<T>
-
- All Implemented Interfaces:
com.cheetahdigital.uikit.architecture.mvp.MvpPresenter<T>
public class RegistrationPresenter<T extends RegistrationView> extends LoginPresenter<T>
TheMvpPresenterclass forRegistrationActivityThis extends theLoginPresenterclass so as to inherit the other login methodsIt communicates to the Cheetah Loyalty API using the
AuthenticationAPI. This communicates back the the API return to the view,RegistrationViewusing a default listener
-
-
Field Summary
-
Fields inherited from class com.cheetahdigital.authentication.ui.login.LoginPresenter
APPLE, ASSERTION_VALUE, FACEBOOK, GOOGLE, INSTAGRAM, MEMBER_ATTRIBUTE, PASSWORD_VALUE, TWITTER
-
-
Constructor Summary
Constructors Constructor Description RegistrationPresenter()Default ConstructorRegistrationPresenter(com.cheetahdigital.corekit.authentication.core.api.AuthenticationFieldParams loginFieldParams)Create the presenter with givenAuthenticationFieldParamsmake sure that CLient ID and Client secret is set on the parameters
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.cheetahdigital.corekit.authentication.core.api.AuthenticationAPIgetAuthenticationAPI()Get current instance ofAuthenticationAPIprotected com.cheetahdigital.corekit.models.module.Listener<com.cheetahdigital.corekit.models.responses.SuccessResponse>getRegistrationListener(java.lang.String username, java.lang.String password, boolean isMobilePhoneEnabled)Create a listener forAuthenticationAPIprotected voidonRegistrationFailed(java.lang.String error)Called after a failed registration requestprotected voidonRegistrationSuccess(com.cheetahdigital.corekit.models.responses.SuccessResponse data, java.lang.String username, java.lang.String password, boolean isMobilePhoneEnabled)Called after a success registration requestvoidsignup(com.cheetahdigital.corekit.authentication.core.api.AuthenticationFieldParams registrationFieldParams, boolean loginViaMobilePhone)Sign up a user with the following parameters-
Methods inherited from class com.cheetahdigital.authentication.ui.login.LoginPresenter
getInfo, getInfoAPI, getInfoReceivedListener, getLoginListener, login, logout, onInfoReceivedFailed, onInfoReceivedSuccess, onLoginFailed, onLoginSuccess
-
-
-
-
Constructor Detail
-
RegistrationPresenter
public RegistrationPresenter()
Default Constructor
-
RegistrationPresenter
public RegistrationPresenter(com.cheetahdigital.corekit.authentication.core.api.AuthenticationFieldParams loginFieldParams)
Create the presenter with givenAuthenticationFieldParamsmake sure that CLient ID and Client secret is set on the parameters- Parameters:
loginFieldParams- - login field parameters,must contain client id and client secret
-
-
Method Detail
-
getRegistrationListener
protected com.cheetahdigital.corekit.models.module.Listener<com.cheetahdigital.corekit.models.responses.SuccessResponse> getRegistrationListener(java.lang.String username, java.lang.String password, boolean isMobilePhoneEnabled)Create a listener forAuthenticationAPI- Parameters:
username- value for usernamepassword- value for passwordisMobilePhoneEnabled-trueif mobile phone is enabled, elsefalse- Returns:
- listener to handle
AuthenticationAPIrequests
-
getAuthenticationAPI
protected com.cheetahdigital.corekit.authentication.core.api.AuthenticationAPI getAuthenticationAPI()
Get current instance ofAuthenticationAPI- Overrides:
getAuthenticationAPIin classLoginPresenter<T extends RegistrationView>- Returns:
AuthenticationAPIused on this presenter
-
signup
public void signup(com.cheetahdigital.corekit.authentication.core.api.AuthenticationFieldParams registrationFieldParams, boolean loginViaMobilePhone)Sign up a user with the following parameters- Parameters:
registrationFieldParams- field parametersloginViaMobilePhone- true username is mobile phone, otherwise, false is username is email.
-
onRegistrationFailed
protected void onRegistrationFailed(java.lang.String error)
Called after a failed registration request- Parameters:
error- contains the details of the error
-
onRegistrationSuccess
protected void onRegistrationSuccess(com.cheetahdigital.corekit.models.responses.SuccessResponse data, java.lang.String username, java.lang.String password, boolean isMobilePhoneEnabled)Called after a success registration request- Parameters:
data- response inSuccessResponseformatusername- username used for the registrationpassword- password used for the registrationisMobilePhoneEnabled-trueif mobile phone is enabled, elsefalse
-
-