Files
rr3-apk/decompiled-reference/com/ea/nimble/SynergyRequest.java
Daniel Elliott d144aec853 Add decompiled reference source files
- Key Java files showing custom server implementation
- Original AndroidManifest.xml for reference
- SynergyEnvironmentImpl.java - Custom server configuration
- HttpRequest.java - HTTP implementation details
- Documentation explaining each file's purpose

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-17 22:06:36 -08:00

145 lines
5.7 KiB
Java

package com.ea.nimble;
import com.ea.nimble.Error;
import com.ea.nimble.IHttpRequest;
import com.ea.nimble.ISynergyRequest;
import com.ea.nimble.Log;
import com.ironsource.nb;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/* loaded from: classes2.dex */
public class SynergyRequest implements ISynergyRequest {
public String api;
public String baseUrl;
public HttpRequest httpRequest;
public ISynergyRequest.IJsonData jsonData;
private SynergyNetworkConnection m_connection = null;
public SynergyRequestPreparingCallback prepareRequestCallback;
public Map<String, String> urlParameters;
public interface SynergyRequestPreparingCallback {
void prepareRequest(SynergyRequest synergyRequest);
}
public SynergyRequest(String str, IHttpRequest.Method method, SynergyRequestPreparingCallback synergyRequestPreparingCallback) {
this.api = str;
HttpRequest httpRequest = new HttpRequest();
this.httpRequest = httpRequest;
this.prepareRequestCallback = synergyRequestPreparingCallback;
this.urlParameters = null;
this.jsonData = null;
httpRequest.method = method;
httpRequest.headers.put("Content-Type", nb.L);
this.httpRequest.headers.put("SDK-VERSION", Global.NIMBLE_RELEASE_VERSION);
this.httpRequest.headers.put("SDK-TYPE", Global.NIMBLE_ID);
String sessionId = ((SynergyNetworkImpl) SynergyNetwork.getComponent()).getSessionId();
if (Utility.validString(sessionId)) {
this.httpRequest.headers.put("EAM-SESSION", sessionId);
} else {
Log.Helper.LOGES("SynergyRequest", "Synergy Network session ID is null", new Object[0]);
}
String synergyId = SynergyIdManager.getComponent().getSynergyId();
if (Utility.validString(synergyId)) {
this.httpRequest.headers.put("EAM-USER-ID", synergyId);
}
String sellId = SynergyEnvironment.getComponent().getSellId();
if (Utility.validString(sellId)) {
this.httpRequest.headers.put("EA-SELL-ID", sellId);
}
}
@Override // com.ea.nimble.ISynergyRequest
public HttpRequest getHttpRequest() {
Log.Helper.LOGPUBLICFUNC(this);
return this.httpRequest;
}
@Override // com.ea.nimble.ISynergyRequest
public String getBaseUrl() {
Log.Helper.LOGPUBLICFUNC(this);
return this.baseUrl;
}
@Override // com.ea.nimble.ISynergyRequest
public String getApi() {
Log.Helper.LOGPUBLICFUNC(this);
return this.api;
}
public IHttpRequest.Method getMethod() {
Log.Helper.LOGPUBLICFUNC(this);
return this.httpRequest.getMethod();
}
public void setMethod(IHttpRequest.Method method) {
Log.Helper.LOGPUBLICFUNC(this);
this.httpRequest.method = method;
}
@Override // com.ea.nimble.ISynergyRequest
public Map<String, String> getUrlParameters() {
Log.Helper.LOGPUBLICFUNC(this);
return this.urlParameters;
}
@Override // com.ea.nimble.ISynergyRequest
public ISynergyRequest.IJsonData getJsonData() {
Log.Helper.LOGPUBLICFUNC(this);
return this.jsonData;
}
public void send() {
Log.Helper.LOGPUBLICFUNC(this);
this.m_connection.send();
}
public void prepare(SynergyNetworkConnection synergyNetworkConnection) {
Log.Helper.LOGFUNC(this);
this.m_connection = synergyNetworkConnection;
SynergyRequestPreparingCallback synergyRequestPreparingCallback = this.prepareRequestCallback;
if (synergyRequestPreparingCallback != null) {
synergyRequestPreparingCallback.prepareRequest(this);
} else {
send();
}
}
public void build() throws Error {
ISynergyRequest.IJsonData iJsonData;
Log.Helper.LOGFUNC(this);
if (!Utility.validString(this.baseUrl) || !Utility.validString(this.api)) {
throw new Error(Error.Code.INVALID_ARGUMENT, String.format("Invalid synergy request parameter (%s, %s) to build http request url", this.baseUrl, this.api));
}
IApplicationEnvironment component = ApplicationEnvironment.getComponent();
HashMap hashMap = new HashMap();
hashMap.put("appVer", component.getApplicationVersion());
hashMap.put("appLang", component.getShortApplicationLanguageCode());
hashMap.put("localization", component.getApplicationLanguageCode());
hashMap.put("deviceLanguage", Locale.getDefault().getLanguage());
hashMap.put(ApplicationEnvironment.NIMBLE_PARAMETER_DEVICE_LOCALE, Locale.getDefault().toString());
String eAHardwareId = SynergyEnvironment.getComponent().getEAHardwareId();
if (Utility.validString(eAHardwareId)) {
hashMap.put("hwId", eAHardwareId);
}
Map<String, String> map = this.urlParameters;
if (map != null) {
hashMap.putAll(map);
}
this.httpRequest.url = Network.generateURL(this.baseUrl + this.api, hashMap);
IHttpRequest.Method method = this.httpRequest.method;
if ((method == IHttpRequest.Method.POST || method == IHttpRequest.Method.PUT) && (iJsonData = this.jsonData) != null && iJsonData.size() > 0) {
String convertObjectToJSONString = Utility.convertObjectToJSONString(this.jsonData.getData());
this.httpRequest.data = new ByteArrayOutputStream();
try {
this.httpRequest.data.write(convertObjectToJSONString.getBytes());
} catch (IOException e) {
throw new Error(Error.Code.INVALID_ARGUMENT, "Error converting jsonData in SynergyRequest to a data stream", e);
}
}
}
}