Browse Source

drawer upgrade

pull/61/merge
Thodoris1999 6 years ago
parent
commit
76fdac8afc
  1. 2
      app/build.gradle
  2. 20
      app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java

2
app/build.gradle

@ -65,7 +65,7 @@ dependencies {
implementation 'org.jsoup:jsoup:1.10.3' //TODO: Warning: upgrading from 1.10.3 will break stuff!
implementation 'com.github.franmontiel:PersistentCookieJar:v1.0.1'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation("com.mikepenz:materialdrawer:6.0.7@aar") {
implementation("com.mikepenz:materialdrawer:6.1.1@aar") {
transitive = true
}
implementation 'com.mikepenz:fontawesome-typeface:4.7.0.0@aar'

20
app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java

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

Loading…
Cancel
Save