- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
70 lines
2.4 KiB
Java
70 lines
2.4 KiB
Java
package com.ea.nimble;
|
|
|
|
import com.ea.nimble.Error;
|
|
import com.ea.nimble.Log;
|
|
import java.util.Map;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class SynergyResponse implements ISynergyResponse {
|
|
public IHttpResponse httpResponse = null;
|
|
public Error error = null;
|
|
public Map<String, Object> jsonData = null;
|
|
|
|
public void parseData() {
|
|
int intValue;
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
if (this.jsonData != null) {
|
|
return;
|
|
}
|
|
IHttpResponse iHttpResponse = this.httpResponse;
|
|
if (iHttpResponse == null || iHttpResponse.getError() != null) {
|
|
this.jsonData = null;
|
|
this.error = null;
|
|
return;
|
|
}
|
|
String str = "<empty>";
|
|
try {
|
|
str = Utility.readStringFromStream(this.httpResponse.getDataStream());
|
|
Map<String, Object> convertJSONObjectToMap = Utility.convertJSONObjectToMap(new JSONObject(str));
|
|
this.jsonData = convertJSONObjectToMap;
|
|
if (!convertJSONObjectToMap.containsKey("resultCode") || (intValue = ((Integer) this.jsonData.get("resultCode")).intValue()) >= 0) {
|
|
return;
|
|
}
|
|
this.error = new SynergyServerError(intValue, (String) this.jsonData.get("message"));
|
|
} catch (Exception e) {
|
|
this.jsonData = null;
|
|
this.error = new Error(Error.Code.NETWORK_INVALID_SERVER_RESPONSE, "Unparseable synergy json response " + str, e);
|
|
}
|
|
}
|
|
|
|
@Override // com.ea.nimble.ISynergyResponse
|
|
public IHttpResponse getHttpResponse() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
return this.httpResponse;
|
|
}
|
|
|
|
@Override // com.ea.nimble.ISynergyResponse
|
|
public boolean isCompleted() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
IHttpResponse iHttpResponse = this.httpResponse;
|
|
if (iHttpResponse == null) {
|
|
return false;
|
|
}
|
|
return iHttpResponse.isCompleted();
|
|
}
|
|
|
|
@Override // com.ea.nimble.ISynergyResponse
|
|
public Exception getError() {
|
|
IHttpResponse iHttpResponse;
|
|
Error error = this.error;
|
|
return (error != null || (iHttpResponse = this.httpResponse) == null) ? error : iHttpResponse.getError();
|
|
}
|
|
|
|
@Override // com.ea.nimble.ISynergyResponse
|
|
public Map<String, Object> getJsonData() {
|
|
Log.Helper.LOGPUBLICFUNC(this);
|
|
return this.jsonData;
|
|
}
|
|
}
|