handle api_level returned by login

This commit is contained in:
Andrew Dolgov 2012-09-29 11:59:04 +04:00
parent fb7792125b
commit 695feaf0cd

View File

@ -1264,13 +1264,24 @@ public class OnlineActivity extends CommonActivity {
if (result != null) { if (result != null) {
try { try {
JsonObject content = result.getAsJsonObject(); JsonObject content = result.getAsJsonObject();
if (content != null) { if (content != null) {
setSessionId(content.get("session_id").getAsString()); setSessionId(content.get("session_id").getAsString());
JsonElement apiLevel = content.get("api_level");
GlobalState.getInstance().m_canUseProgress = m_canUseProgress; GlobalState.getInstance().m_canUseProgress = m_canUseProgress;
Log.d(TAG, "Authenticated! canUseProgress=" + m_canUseProgress); Log.d(TAG, "Authenticated! canUseProgress=" + m_canUseProgress);
if (apiLevel != null) {
setApiLevel(apiLevel.getAsInt());
Log.d(TAG, "Received API level: " + getApiLevel());
loginSuccess(m_refreshAfterLogin);
} else {
ApiRequest req = new ApiRequest(m_context) { ApiRequest req = new ApiRequest(m_context) {
protected void onPostExecute(JsonElement result) { protected void onPostExecute(JsonElement result) {
setApiLevel(0); setApiLevel(0);
@ -1308,6 +1319,7 @@ public class OnlineActivity extends CommonActivity {
req.execute(map); req.execute(map);
setLoadingStatus(R.string.loading_message, true); setLoadingStatus(R.string.loading_message, true);
}
return; return;
} }