.. java:import:: android.graphics Bitmap .. java:import:: android.net Uri .. java:import:: android.util Base64 .. java:import:: org.springframework.http HttpEntity .. java:import:: org.springframework.http HttpHeaders .. java:import:: org.springframework.http HttpMethod .. java:import:: org.springframework.http ResponseEntity .. java:import:: org.springframework.http.converter StringHttpMessageConverter .. java:import:: org.springframework.web.client HttpClientErrorException .. java:import:: org.springframework.web.client HttpServerErrorException .. java:import:: org.springframework.web.client ResourceAccessException .. java:import:: org.springframework.web.client RestTemplate .. java:import:: java.io ByteArrayOutputStream .. java:import:: java.io StringWriter .. java:import:: java.util Locale .. java:import:: java.util Map .. java:import:: au.com.bytecode.opencsv CSVWriter UserHandler =========== .. java:package:: ar.uba.fi.drtinder :noindex: .. java:type:: public final class UserHandler Class that handles user specific task such as login or profile update Fields ------ ERROR_TOKEN ^^^^^^^^^^^ .. java:field:: public static final String ERROR_TOKEN :outertype: UserHandler Result Token: Error occurred while fetching FAILED_TOKEN ^^^^^^^^^^^^ .. java:field:: public static final String FAILED_TOKEN :outertype: UserHandler Result Token: Failed to get SIGNUP_FAILED ^^^^^^^^^^^^^ .. java:field:: public static final String SIGNUP_FAILED :outertype: UserHandler Sign up result: Sign up failed SIGNUP_SUCCESS ^^^^^^^^^^^^^^ .. java:field:: public static final String SIGNUP_SUCCESS :outertype: UserHandler Sign up result: Sign up successful SIGNUP_USEREXIST ^^^^^^^^^^^^^^^^ .. java:field:: public static final String SIGNUP_USEREXIST :outertype: UserHandler Sign up result: User already exists Methods ------- deleteProfile ^^^^^^^^^^^^^ .. java:method:: public static boolean deleteProfile(String token) :outertype: UserHandler Deletes user profile of the current logged in user :param token: Session token :return: true if success getLoginToken ^^^^^^^^^^^^^ .. java:method:: static String getLoginToken(String email, String password, String location) :outertype: UserHandler Fetches token from server and returns it :param email: User email :param password: User password :param location: User location :return: Token string. If error, one of the listed error tokens getToken ^^^^^^^^ .. java:method:: public static String getToken() :outertype: UserHandler Get the current session token :return: The current session token. If not possible, one of the listed Error tokens getUserEmail ^^^^^^^^^^^^ .. java:method:: public static String getUserEmail() :outertype: UserHandler Gets logged user email :return: Logged user email getUsername ^^^^^^^^^^^ .. java:method:: public static String getUsername() :outertype: UserHandler Gets logged user username (id) :return: Logged user username getUsernameFrom ^^^^^^^^^^^^^^^ .. java:method:: public static String getUsernameFrom(String email) :outertype: UserHandler Returns the standard username from an email :param email: user Email :return: username isValidEmail ^^^^^^^^^^^^ .. java:method:: public static boolean isValidEmail(String email) :outertype: UserHandler Validates email, with the global rules :param email: Candidate email :return: true if its valid, false otherwise isValidPassword ^^^^^^^^^^^^^^^ .. java:method:: public static boolean isValidPassword(String pass) :outertype: UserHandler Validates password, with the global rules :param pass: Candidate password :return: true if its valid, false otherwise logout ^^^^^^ .. java:method:: public static void logout() :outertype: UserHandler Logouts from the current session sendLike ^^^^^^^^ .. java:method:: public static boolean sendLike(String token, String candidateId, boolean liked) :outertype: UserHandler Sends a like/nope from the active user :param token: session token :param candidateId: candidate id :param liked: true if liked, false if not :return: true if success sendMessage ^^^^^^^^^^^ .. java:method:: public static boolean sendMessage(String token, String receiverId, String message) :outertype: UserHandler Sends a message from the active user :param token: session token :param receiverId: receiver id :param message: message to send :return: true if success signUp ^^^^^^ .. java:method:: public static String signUp(String email, String password, Map userdata) :outertype: UserHandler Creates a new user with the info :param email: User email :param password: User password :param userdata: Map containing userdata as field:value :return: Sign up result (one of the listed results const) updateInfo ^^^^^^^^^^ .. java:method:: public static boolean updateInfo(String token, Map userdata) :outertype: UserHandler Updates user info :param token: Session token :param userdata: Map containing userdata as field:value :return: true if success uploadProfilePicture ^^^^^^^^^^^^^^^^^^^^ .. java:method:: public static void uploadProfilePicture(Bitmap profilePicture, String token) :outertype: UserHandler Uploads a new profile picture for the logged in user :param profilePicture: New picture :param token: Session token