mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2024-11-19 02:29:25 +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();
|
||||
if (networkInfo != null && networkInfo.isConnected()) {
|
||||
if (LastCheckinInfo.read(this).androidId == 0) {
|
||||
try {
|
||||
CheckinManager.checkin(this, false);
|
||||
} catch (IOException e) {
|
||||
Log.d(TAG, "Checkin failed", e);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
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);
|
||||
}
|
||||
};
|
||||
LoginActivity.this.runOnUiThread(next);
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
loadLoginPage();
|
||||
}
|
||||
} else {
|
||||
showError(R.string.no_network_error_desc);
|
||||
}
|
||||
@ -267,6 +280,7 @@ public class LoginActivity extends AssistantActivity {
|
||||
public void onResponse(AuthResponse response) {
|
||||
authManager.storeResponse(response);
|
||||
PeopleManager.loadUserInfo(LoginActivity.this, account);
|
||||
checkin(true);
|
||||
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
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if ((keyCode == KEYCODE_BACK) && webView.canGoBack() && (webView.getVisibility() == VISIBLE)) {
|
||||
|
Loading…
Reference in New Issue
Block a user