mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2024-11-19 10:39:24 +01:00
Checkin before logging in if needed, force checkin after login
Fixes crash under certain conditions when creating account, might fix Play Store
This commit is contained in:
parent
501866bb7d
commit
2657d740e7
@ -161,14 +161,27 @@ public class LoginActivity extends AssistantActivity {
|
|||||||
NetworkInfo networkInfo = cm.getActiveNetworkInfo();
|
NetworkInfo networkInfo = cm.getActiveNetworkInfo();
|
||||||
if (networkInfo != null && networkInfo.isConnected()) {
|
if (networkInfo != null && networkInfo.isConnected()) {
|
||||||
if (LastCheckinInfo.read(this).androidId == 0) {
|
if (LastCheckinInfo.read(this).androidId == 0) {
|
||||||
try {
|
new Thread(new Runnable() {
|
||||||
CheckinManager.checkin(this, false);
|
@Override
|
||||||
} catch (IOException e) {
|
public void run() {
|
||||||
Log.d(TAG, "Checkin failed", e);
|
Runnable next;
|
||||||
|
next = checkin(false) ? new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
loadLoginPage();
|
||||||
|
}
|
||||||
|
} : new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
showError(R.string.auth_general_error_desc);
|
showError(R.string.auth_general_error_desc);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
LoginActivity.this.runOnUiThread(next);
|
||||||
}
|
}
|
||||||
|
}).start();
|
||||||
|
} else {
|
||||||
loadLoginPage();
|
loadLoginPage();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
showError(R.string.no_network_error_desc);
|
showError(R.string.no_network_error_desc);
|
||||||
}
|
}
|
||||||
@ -267,6 +280,7 @@ public class LoginActivity extends AssistantActivity {
|
|||||||
public void onResponse(AuthResponse response) {
|
public void onResponse(AuthResponse response) {
|
||||||
authManager.storeResponse(response);
|
authManager.storeResponse(response);
|
||||||
PeopleManager.loadUserInfo(LoginActivity.this, account);
|
PeopleManager.loadUserInfo(LoginActivity.this, account);
|
||||||
|
checkin(true);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,6 +291,16 @@ public class LoginActivity extends AssistantActivity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean checkin(boolean force) {
|
||||||
|
try {
|
||||||
|
CheckinManager.checkin(LoginActivity.this, force);
|
||||||
|
return true;
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.w(TAG, "Checkin failed", e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
if ((keyCode == KEYCODE_BACK) && webView.canGoBack() && (webView.getVisibility() == VISIBLE)) {
|
if ((keyCode == KEYCODE_BACK) && webView.canGoBack() && (webView.getVisibility() == VISIBLE)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user