Class RegistrationPresenter<T extends RegistrationView>

  • All Implemented Interfaces:
    com.cheetahdigital.uikit.architecture.mvp.MvpPresenter<T>

    public class RegistrationPresenter<T extends RegistrationView>
    extends LoginPresenter<T>
    The MvpPresenter class for RegistrationActivity This extends the LoginPresenter class so as to inherit the other login methods

    It communicates to the Cheetah Loyalty API using the AuthenticationAPI. This communicates back the the API return to the view, RegistrationView using a default listener

    • Constructor Summary

      Constructors 
      Constructor Description
      RegistrationPresenter()
      Default Constructor
      RegistrationPresenter​(com.cheetahdigital.corekit.authentication.core.api.AuthenticationFieldParams loginFieldParams)
      Create the presenter with given AuthenticationFieldParams make 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.AuthenticationAPI getAuthenticationAPI()
      Get current instance of AuthenticationAPI
      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 for AuthenticationAPI
      protected void onRegistrationFailed​(java.lang.String error)
      Called after a failed registration request
      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
      void signup​(com.cheetahdigital.corekit.authentication.core.api.AuthenticationFieldParams registrationFieldParams, boolean loginViaMobilePhone)
      Sign up a user with the following parameters
      • Methods inherited from class com.cheetahdigital.uikit.architecture.mvp.MvpNullObjectBasePresenter

        attachView, detachView, getView
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RegistrationPresenter

        public RegistrationPresenter()
        Default Constructor
      • RegistrationPresenter

        public RegistrationPresenter​(com.cheetahdigital.corekit.authentication.core.api.AuthenticationFieldParams loginFieldParams)
        Create the presenter with given AuthenticationFieldParams make 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 for AuthenticationAPI
        Parameters:
        username - value for username
        password - value for password
        isMobilePhoneEnabled - true if mobile phone is enabled, else false
        Returns:
        listener to handle AuthenticationAPI requests
      • getAuthenticationAPI

        protected com.cheetahdigital.corekit.authentication.core.api.AuthenticationAPI getAuthenticationAPI()
        Get current instance of AuthenticationAPI
        Overrides:
        getAuthenticationAPI in class LoginPresenter<T extends RegistrationView>
        Returns:
        AuthenticationAPI used 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 parameters
        loginViaMobilePhone - 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 in SuccessResponse format
        username - username used for the registration
        password - password used for the registration
        isMobilePhoneEnabled - true if mobile phone is enabled, else false