public class AccountManager
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static void |
attemptLogin(android.app.Activity context,
User.Credentials credentials,
AsyncDatabaseConnector.OnStartConnectionListener onStart,
Consumer<java.lang.Boolean> onEnd)
Attempt the login.
|
static void |
checkIfEmailExists(android.app.Activity context,
java.lang.String email,
Consumer<java.lang.Boolean> result)
Control if email exists on server.
|
static void |
checkIfUsernameExists(android.app.Activity context,
java.lang.String user,
Consumer<java.lang.Boolean> result)
Control if username exists on server.
|
static void |
deleteAccount(android.app.Activity context,
User user,
Consumer<java.lang.Boolean> callback)
Delete registered user.
|
static void |
deleteCurrentAccount(android.app.Activity context)
Delete the current logged account from the system.
|
static User |
getCurrentLoggedUser()
Get the current logged user if present.
|
static void |
getListUsers(android.app.Activity context,
AsyncDatabaseConnector.OnStartConnectionListener onStartConnectionListener,
AsyncDatabaseConnector.OnEndConnectionListener<User> callback)
Get list of the registered user.
|
static void |
insertUser(android.app.Activity context,
User user,
Consumer<java.lang.Boolean> callback)
Inserts the user into the database.
|
static boolean |
isLogged()
Check if the user is currently logged.
|
static void |
logout(android.app.Activity context)
Logout the current user.
|
static void |
setUsersInTextView(android.app.Activity context,
com.hootsuite.nachos.NachoTextView users)
Get list of the user that a user can review.
|
static void |
userAvgEarnings(android.app.Activity context,
java.lang.String username,
android.widget.TextView t)
Gets the average earnings of a user.
|
public static User getCurrentLoggedUser()
public static void attemptLogin(@NonNull
android.app.Activity context,
@NonNull
User.Credentials credentials,
@Nullable
AsyncDatabaseConnector.OnStartConnectionListener onStart,
@Nullable
Consumer<java.lang.Boolean> onEnd)
credentials - The credentials of the user.onStart - A function to be executed before the login attempt.onEnd - A function to be executed after the login attempt. The boolean value
contains true if login was successful, false otherwise.public static void logout(@NonNull
android.app.Activity context)
public static void deleteCurrentAccount(@NonNull
android.app.Activity context)
public static boolean isLogged()
public static void checkIfUsernameExists(@Nullable
android.app.Activity context,
@NonNull
java.lang.String user,
@NonNull
Consumer<java.lang.Boolean> result)
user - The username to verify.result - A function to be executed after the check.public static void checkIfEmailExists(@Nullable
android.app.Activity context,
@NonNull
java.lang.String email,
@NonNull
Consumer<java.lang.Boolean> result)
email - The email to verify.result - A function to be executed after the check.public static void insertUser(@Nullable
android.app.Activity context,
@NonNull
User user,
@Nullable
Consumer<java.lang.Boolean> callback)
user - User to insert in the database.callback - A function to be executed after the insert attempt.public static void userAvgEarnings(@NonNull
android.app.Activity context,
@NonNull
java.lang.String username,
@NonNull
android.widget.TextView t)
context - The application context.username - The username.t - The TextView to be set with the earnings.public static void setUsersInTextView(@NonNull
android.app.Activity context,
@NonNull
com.hootsuite.nachos.NachoTextView users)
context - The application context.users - The user to be reported.public static void deleteAccount(@Nullable
android.app.Activity context,
User user,
@Nullable
Consumer<java.lang.Boolean> callback)
context - The application context.user - The user to be deleted.callback - A function to be executed after the insert attempt.public static void getListUsers(@Nullable
android.app.Activity context,
@Nullable
AsyncDatabaseConnector.OnStartConnectionListener onStartConnectionListener,
@Nullable
AsyncDatabaseConnector.OnEndConnectionListener<User> callback)
context - The application context.onStartConnectionListener - On start connection callback.callback - A function to be executed after the insert attempt.