mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Merge remote-tracking branch 'refs/remotes/commons-app/2.7.x-release' into 2.7.x-release-fork
This commit is contained in:
commit
58cd6151ad
2 changed files with 14 additions and 7 deletions
|
|
@ -19,7 +19,6 @@ import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v7.app.AppCompatDelegate;
|
import android.support.v7.app.AppCompatDelegate;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
@ -28,7 +27,6 @@ import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
@ -160,7 +158,10 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
||||||
WelcomeActivity.startYourself(this);
|
WelcomeActivity.startYourself(this);
|
||||||
prefs.edit().putBoolean("firstrun", false).apply();
|
prefs.edit().putBoolean("firstrun", false).apply();
|
||||||
}
|
}
|
||||||
if (sessionManager.getCurrentAccount() != null) {
|
|
||||||
|
if (sessionManager.getCurrentAccount() != null
|
||||||
|
&& sessionManager.isUserLoggedIn()
|
||||||
|
&& sessionManager.getCachedAuthCookie() != null) {
|
||||||
startMainActivity();
|
startMainActivity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,13 +61,11 @@ public class SessionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAuthCookie() {
|
public String getAuthCookie() {
|
||||||
boolean isLoggedIn = sharedPreferences.getBoolean("isUserLoggedIn", false);
|
if (!isUserLoggedIn()) {
|
||||||
|
|
||||||
if (!isLoggedIn) {
|
|
||||||
Timber.e("User is not logged in");
|
Timber.e("User is not logged in");
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
String authCookie = sharedPreferences.getString("getAuthCookie", null);
|
String authCookie = getCachedAuthCookie();
|
||||||
if (authCookie == null) {
|
if (authCookie == null) {
|
||||||
Timber.e("Auth cookie is null even after login");
|
Timber.e("Auth cookie is null even after login");
|
||||||
}
|
}
|
||||||
|
|
@ -75,6 +73,14 @@ public class SessionManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCachedAuthCookie() {
|
||||||
|
return sharedPreferences.getString("getAuthCookie", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isUserLoggedIn() {
|
||||||
|
return sharedPreferences.getBoolean("isUserLoggedIn", false);
|
||||||
|
}
|
||||||
|
|
||||||
public Completable clearAllAccounts() {
|
public Completable clearAllAccounts() {
|
||||||
AccountManager accountManager = AccountManager.get(context);
|
AccountManager accountManager = AccountManager.get(context);
|
||||||
Account[] allAccounts = accountManager.getAccountsByType(ACCOUNT_TYPE);
|
Account[] allAccounts = accountManager.getAccountsByType(ACCOUNT_TYPE);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue