|
@ -117,19 +117,17 @@ public class SessionManager { |
|
|
setPersistentCookieSession(); //Store cookies
|
|
|
setPersistentCookieSession(); //Store cookies
|
|
|
|
|
|
|
|
|
//Edit SharedPreferences, save session's data
|
|
|
//Edit SharedPreferences, save session's data
|
|
|
|
|
|
SharedPreferences.Editor editor = sharedPrefs.edit(); |
|
|
setLoginScreenAsDefault(false); |
|
|
setLoginScreenAsDefault(false); |
|
|
sharedPrefs.edit().putBoolean(LOGGED_IN, true).apply(); |
|
|
editor.putBoolean(LOGGED_IN, true); |
|
|
sharedPrefs.edit().putString(USERNAME, extractUserName(document)).apply(); |
|
|
editor.putString(USERNAME, extractUserName(document)); |
|
|
sharedPrefs.edit().putInt(USER_ID, extractUserId(document)).apply(); |
|
|
editor.putInt(USER_ID, extractUserId(document)); |
|
|
String avatar = extractAvatarLink(document); |
|
|
String avatar = extractAvatarLink(document); |
|
|
if (avatar != null) { |
|
|
if (avatar != null) |
|
|
sharedPrefs.edit().putBoolean(HAS_AVATAR, true).apply(); |
|
|
editor.putString(AVATAR_LINK, avatar); |
|
|
sharedPrefs.edit().putString(AVATAR_LINK, extractAvatarLink(document)).apply(); |
|
|
editor.putBoolean(HAS_AVATAR, avatar != null); |
|
|
} else |
|
|
editor.putString(LOGOUT_LINK, extractLogoutLink(document)); |
|
|
sharedPrefs.edit().putBoolean(HAS_AVATAR, false).apply(); |
|
|
editor.apply(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sharedPrefs.edit().putString(LOGOUT_LINK, extractLogoutLink(document)).apply(); |
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS; |
|
|
return SUCCESS; |
|
|
} else { |
|
|
} else { |
|
|