public class AccountManager
extends java.lang.Object
implements android.arch.lifecycle.LifecycleObserver
AccountManager class collects all of the APIs related to account management. Account
management includes processes such as registering a user, signing in, signing out, and updating
user information. Each account is tied to a single user. All of these methods will be executed on
a background thread and return the result on the main thread. To receive the result, you are
expected to pass a corresponding SingleCallback or CompleteCallback.| Constructor and Description |
|---|
AccountManager(android.support.v7.app.AppCompatActivity appCompatActivity)
Constructor for an
AccountManager object with the lifecycle set. |
AccountManager(android.support.v4.app.Fragment fragment)
Constructor for an
AccountManager object with the lifecycle set. |
AccountManager(android.arch.lifecycle.Lifecycle lifecycle)
Constructor for an
AccountManager object with the lifecycle set. |
| Modifier and Type | Method and Description |
|---|---|
void |
checkExistence(java.lang.String email,
SingleCallback<java.lang.Boolean> callback)
Returns a boolean that represents whether or not a user account exists in the system.
|
void |
checkExistenceAndGetPhoneNumber(java.lang.String email,
SingleCallback<java.lang.String> callback)
Returns a String that represents a user's masked phone number in the system.
|
void |
deleteAccount(CompleteCallback callback)
Returns a
CompleteCallback after deleting an account. |
void |
disableBiometricsSignIn(CompleteCallback callback)
Returns a
CompleteCallback after disabling biometrics log in for a user account. |
void |
enableBiometricsSignIn(ObservableCallback<FingerprintVerificationResult> callback)
Returns a
FingerprintVerificationResult object after enabling biometric login for a
user account. |
void |
fetch(SingleCallback<UserEntity> callback)
Returns a
UserEntity object, which contains properties related to the user
account that is currently logged in. |
void |
fetchToken(SingleCallback<java.lang.String> callback)
Returns a String of the access token after requesting a new access token to authenticate with
the server.
|
void |
get(SingleCallback<UserEntity> callback)
Returns a
UserEntity object, which contains properties related to the user
account that is currently logged in. |
void |
getAccountPolicyEntity(SingleCallback<AccountPolicyEntity> callback)
Returns an
AccountPolicyEntity object. |
void |
getAppCodeSettings(SingleCallback<AppCodeEntity> callback)
Returns an
AppCodeEntity object for the account that is currently logged in. |
java.lang.String |
getToken()
Returns a String of the access token that is being used to authenticate with the server.
|
boolean |
hasUser()
Returns a boolean that represents whether or not a user has ever signed in, regardless of the
current authentication status.
|
boolean |
isAuthenticated()
Returns a boolean that represents whether or not the user account is currently signed in and
authenticated.
|
boolean |
isBiometricsSignInEnabled()
Returns a boolean that represents whether or not the user account has the option of signing
in via biometrics.
|
boolean |
isBiometricsSignInEnabledBefore()
Returns a boolean that represents whether or not the user account has enabled signing in via biometrics before.
|
void |
isLoggedInWithTemporaryPassword(SingleCallback<java.lang.Boolean> callback)
Returns a boolean that represents whether or not a user is logged in with a temporary
password.
|
boolean |
isStaySignedInEnabled()
Returns a boolean that represents whether or not the user account has the option of staying
signed in between different openings of the app.
|
void |
register(SignUpParam signUpParam,
CompleteCallback callback)
Returns a
CompleteCallback after user account registration. |
void |
registerAndSignIn(SignUpAndSignInParam signUpAndSignInParam,
CompleteCallback callback)
Returns a
CompleteCallback after user account registration and signing in. |
void |
signIn(SignInParam signInParam,
CompleteCallback callback)
Returns a
CompleteCallback after signing into the user account. |
void |
signInWithBiometrics(ObservableCallback<FingerprintVerificationResult> callback)
Returns a
FingerprintVerificationResult object after signing into a user account with
biometrics. |
void |
signOut(CompleteCallback callback)
Returns a
CompleteCallback after signing out of the user account. |
void |
update(AccountParam accountParam,
CompleteCallback callback)
Returns a
CompleteCallback after updating the user account information. |
void |
updateAppCodeSettings(boolean enable,
java.lang.String appCode,
CompleteCallback callback)
Returns a
CompleteCallback after updating the app code settings. |
void |
updatePhone(java.lang.String phoneNumber,
CompleteCallback callback)
Returns a
CompleteCallback after updating the user contact information. |
void |
verifyAppCode(java.lang.String appCode,
boolean useCache,
CompleteCallback callback)
Returns a
CompleteCallback after verifying the user's app code. |
void |
verifyAppCode(java.lang.String appCode,
CompleteCallback callback)
Returns a
CompleteCallback after verifying the user's app code on the server. |
public AccountManager(android.arch.lifecycle.Lifecycle lifecycle)
AccountManager object with the lifecycle set.lifecycle - See Lifecyclepublic AccountManager(android.support.v7.app.AppCompatActivity appCompatActivity)
AccountManager object with the lifecycle set.appCompatActivity - See AppCompatActivitypublic AccountManager(android.support.v4.app.Fragment fragment)
AccountManager object with the lifecycle set.fragment - See Fragmentpublic void checkExistence(java.lang.String email,
SingleCallback<java.lang.Boolean> callback)
email - the email address of the user account to verifycallback - the callback to receive the verification result.
true if the user account exists in the system;
false otherwisepublic void checkExistenceAndGetPhoneNumber(java.lang.String email,
SingleCallback<java.lang.String> callback)
email - the email address of the user account to verify and get masked phone numbercallback - the callback to receive the verification resultpublic void deleteAccount(CompleteCallback callback)
CompleteCallback after deleting an account.callback - the callback to receive the result of deleting an accountpublic void enableBiometricsSignIn(ObservableCallback<FingerprintVerificationResult> callback)
FingerprintVerificationResult object after enabling biometric login for a
user account.callback - the callback to receive the FingerprintVerificationResult object
after enabling biometric login for a user accountpublic void disableBiometricsSignIn(CompleteCallback callback)
CompleteCallback after disabling biometrics log in for a user account.callback - the callback to receive the result of disabling biometrics log inpublic void fetch(SingleCallback<UserEntity> callback)
UserEntity object, which contains properties related to the user
account that is currently logged in. This information is retrieved from the server.callback - the callback to receive the UserEntity objectpublic void fetchToken(SingleCallback<java.lang.String> callback)
callback - the callback to receive the access tokenpublic void get(SingleCallback<UserEntity> callback)
UserEntity object, which contains properties related to the user
account that is currently logged in. This information is retrieved from the local cache.callback - the callback to receive the UserEntity objectpublic void getAccountPolicyEntity(SingleCallback<AccountPolicyEntity> callback)
AccountPolicyEntity object.callback - the callback to receive the AccountPolicyEntity object.public void getAppCodeSettings(SingleCallback<AppCodeEntity> callback)
AppCodeEntity object for the account that is currently logged in.
This information is retrieved from the server.callback - the callback to receive the AppCodeEntity object.@Nullable public java.lang.String getToken()
null if the session is not authenticated.public boolean hasUser()
true if a user has ever signed in, regardless of the current authentication
status;
false otherwise.public boolean isAuthenticated()
true if the user account is currently signed in and authenticated;
false otherwise.public boolean isBiometricsSignInEnabled()
true if the user account has the option of signing in via biometrics;
false otherwise.public boolean isBiometricsSignInEnabledBefore()
true if the user account has enabled signing in via biometrics before;
false otherwise.public void isLoggedInWithTemporaryPassword(SingleCallback<java.lang.Boolean> callback)
callback - the callback to receive the result of checking the login status with a
temporary password:
true if the user is logged in with a temporary password
false otherwisepublic boolean isStaySignedInEnabled()
true if the user account has the option of staying signed in between app
openings;
false otherwise.public void register(SignUpParam signUpParam, CompleteCallback callback)
CompleteCallback after user account registration.signUpParam - the parameters needed for user account registration. See
SignUpParamcallback - the callback to receive the result of user account registrationpublic void registerAndSignIn(SignUpAndSignInParam signUpAndSignInParam, CompleteCallback callback)
CompleteCallback after user account registration and signing in.signUpAndSignInParam - the parameters needed for user account registration and sign in. See
SignUpAndSignInParamcallback - the callback to receive the result of user account registration and
signing inpublic void signIn(SignInParam signInParam, CompleteCallback callback)
CompleteCallback after signing into the user account.signInParam - the parameters needed for user account sign in. See
SignInParamcallback - the callback to receive the result of signing into the user accountpublic void signInWithBiometrics(ObservableCallback<FingerprintVerificationResult> callback)
FingerprintVerificationResult object after signing into a user account with
biometrics.callback - the callback to receive the FingerprintVerificationResult object
after signing into a user account with biometricspublic void signOut(CompleteCallback callback)
CompleteCallback after signing out of the user account.callback - the callback to receive the result of signing out of the user accountpublic void update(AccountParam accountParam, CompleteCallback callback)
CompleteCallback after updating the user account information.accountParam - the updated parameters for the user account. See AccountParamcallback - the callback to receive the result of updating the user account
informationpublic void updateAppCodeSettings(boolean enable,
java.lang.String appCode,
CompleteCallback callback)
CompleteCallback after updating the app code settings.enable - true if the user has enabled the use of the app code; false
otherwiseappCode - the app codecallback - the callback to receive the result of updating the app code settingspublic void updatePhone(java.lang.String phoneNumber,
CompleteCallback callback)
CompleteCallback after updating the user contact information.phoneNumber - the updated phone number for the user account.callback - the callback to receive the result of updating the user contact
informationpublic void verifyAppCode(java.lang.String appCode,
CompleteCallback callback)
CompleteCallback after verifying the user's app code on the server.appCode - the app codecallback - the callback to receive the result of verifying the user's app code on the
serverpublic void verifyAppCode(java.lang.String appCode,
boolean useCache,
CompleteCallback callback)
CompleteCallback after verifying the user's app code. If
useCache is true, the verification will check against the
cache; otherwise, if useCache is false, the verification will
take place on the server. If AppCodeEntity.enabled() is false, it will throw
an error.appCode - the app codeuseCache - true if the verification will check against local cache;
false if the verification should check against the servercallback - the callback to receive the result of verifying the user's app code