From 76fdac8afc760b46247053d5aa53087382e969ab Mon Sep 17 00:00:00 2001 From: Thodoris1999 Date: Wed, 17 Oct 2018 12:49:24 +0300 Subject: [PATCH] drawer upgrade --- app/build.gradle | 2 +- .../thmmy/mthmmy/session/SessionManager.java | 20 +++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 11baff14..a239de87 100644 --- a/app/build.gradle +++ b/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' diff --git a/app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java b/app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java index 4811195d..560c7089 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java +++ b/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 {