Login Bugs removed

This commit is contained in:
Caesar2011
2018-12-19 15:46:12 +01:00
parent 4d22613672
commit 8160ef12b1
4 changed files with 13 additions and 7 deletions

View File

@@ -158,14 +158,15 @@ public class MainActivity extends AppCompatActivity
super.onResume();
log.d("onResume", isPaused, isLoggedInBeforePause);
if (isPaused) {
getKVV().account().reset();
getKVV().account().restoreOnlineLogin(isRestored -> {
log.d("onResume", isRestored);
updateNavigation();
if (isRestored && !isLoggedInBeforePause)
changeFragment(getDefaultFragmentAfterLogin());
else if (!isRestored && isLoggedInBeforePause)
changeFragment(getDefaultFragmentAfterLogin());
else if (!isRestored && isLoggedInBeforePause) {
getKVV().account().logout(false);
changeFragment(getDefaultFragmentAfterLogout());
}
});
}
isPaused = false;

View File

@@ -28,6 +28,7 @@ public class Login extends HTTPService {
this.mListener = listener;
}
@Deprecated
public void reset() {
mToken = null;
mLoginPending = false;
@@ -47,7 +48,7 @@ public class Login extends HTTPService {
//}
public void restoreOnlineLogin(BooleanInterface callback) {
if (mLoginPending || mToken != null) {
if (mLoginPending) {
callback.run(false);
return;
}
@@ -131,7 +132,6 @@ public class Login extends HTTPService {
return;
CustomAccountManager manager = mListener.getAccountManager();
manager.doInvalidateToken(AccountGeneral.ACCOUNT_TYPE, AccountGeneral.AUTHTOKEN_TYPE_KVV, ignored -> {
reset();
log.d("try restore", ignored);
restoreOnlineLogin(isRestored -> {
log.d("restore", isRestored, mToken);

View File

@@ -7,6 +7,7 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
import android.app.LoaderManager.LoaderCallbacks;
import android.content.Context;
import android.content.CursorLoader;
import android.content.Intent;
import android.content.Loader;
@@ -19,6 +20,7 @@ import android.provider.ContactsContract;
import android.text.TextUtils;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
@@ -137,6 +139,9 @@ public class FUAuthenticatorActivity extends AccountAuthenticatorActivity implem
* errors are presented and no actual login attempt is made.
*/
private void attemptLogin() {
InputMethodManager inputManager = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
if (inputManager != null && getCurrentFocus() != null)
inputManager.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
if (mAuthTask != null) {
return;
}

View File

@@ -77,8 +77,8 @@ public class CustomAccountManager {
}
public void getTokenByType(String accountType, String authTokenType, @Nullable StringInterface callback) {
Account account = mAccountManager.getAccountsByType(accountType)[0];
mAccountManager.getAuthToken(account, authTokenType, null, true, accountManagerFuture -> {
//Account account = mAccountManager.getAccountsByType(accountType)[0];
mAccountManager.getAuthTokenByFeatures(accountType, authTokenType, null, mActivityInterface.get(), null, null, accountManagerFuture -> {
try {
Bundle bnd = accountManagerFuture.getResult();
final String authtoken = bnd.getString(AccountManager.KEY_AUTHTOKEN);