Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
package com.ea.nimble.mtx;
import com.ea.nimble.Error;
import com.ea.nimble.mtx.NimbleCatalogItem;
import java.util.List;
import java.util.Map;
/* loaded from: classes2.dex */
public interface INimbleMTX {
public static final String NIMBLE_NOTIFICATION_MTX_REFRESH_CATALOG_FINISHED = "nimble.notification.mtx.refreshcatalogfinished";
public static final String NIMBLE_NOTIFICATION_MTX_RESTORE_PURCHASED_TRANSACTIONS_FINISHED = "nimble.notification.mtx.restorepurchasedtransactionsfinished";
public static final String NIMBLE_NOTIFICATION_MTX_TRANSACTIONS_RECOVERED = "nimble.notification.mtx.transactionsrecovered";
public static final String NOTIFICATION_DICTIONARY_KEY_TRANSACTIONID = "TRANSACTION_ID";
public interface FinalizeTransactionCallback {
void finalizeComplete(NimbleMTXTransaction nimbleMTXTransaction);
}
public interface ItemGrantedCallback {
void itemGrantedComplete(NimbleMTXTransaction nimbleMTXTransaction);
}
public interface PurchaseTransactionCallback {
void purchaseComplete(NimbleMTXTransaction nimbleMTXTransaction);
void unverifiedReceiptReceived(NimbleMTXTransaction nimbleMTXTransaction);
}
Error finalizeTransaction(String str, FinalizeTransactionCallback finalizeTransactionCallback);
List<NimbleCatalogItem> getAvailableCatalogItems();
List<NimbleMTXTransaction> getPendingTransactions();
List<NimbleMTXTransaction> getPurchasedTransactions();
List<NimbleMTXTransaction> getRecoveredTransactions();
Error itemGranted(String str, NimbleCatalogItem.ItemType itemType, ItemGrantedCallback itemGrantedCallback);
Error purchaseItem(String str, PurchaseTransactionCallback purchaseTransactionCallback, String str2);
void refreshAvailableCatalogItems();
void restorePurchasedTransactions();
Error resumeTransaction(String str, PurchaseTransactionCallback purchaseTransactionCallback, ItemGrantedCallback itemGrantedCallback, FinalizeTransactionCallback finalizeTransactionCallback);
void setPlatformParameters(Map<String, String> map);
}

View File

@@ -0,0 +1,32 @@
package com.ea.nimble.mtx;
import java.util.Map;
/* loaded from: classes2.dex */
public abstract class NimbleCatalogItem {
public enum ItemType {
UNKNOWN,
NONCONSUMABLE,
CONSUMABLE,
SUBSCRIPTION
}
public abstract Map<String, Object> getAdditionalInfo();
public abstract String getDescription();
public abstract ItemType getItemType();
public abstract String getMetaDataUrl();
public abstract float getPriceDecimal();
public abstract String getPriceWithCurrencyAndFormat();
public abstract String getSellId();
public abstract String getSku();
public abstract String getTitle();
}

View File

@@ -0,0 +1,20 @@
package com.ea.nimble.mtx;
import com.ea.nimble.Base;
import com.ea.nimble.Log;
/* loaded from: classes2.dex */
public class NimbleMTX {
public static final String COMPONENT_ID = "com.ea.nimble.mtx";
public static INimbleMTX getComponent() {
Object[] componentList = Base.getComponentList(COMPONENT_ID);
if (componentList == null || componentList.length <= 0) {
return null;
}
if (componentList.length != 1) {
Log.Helper.LOGFS("MTX", "More than one MTX component registered!", new Object[0]);
}
return (INimbleMTX) componentList[0];
}
}

View File

@@ -0,0 +1,57 @@
package com.ea.nimble.mtx;
import com.ea.nimble.Error;
import com.vungle.ads.internal.protos.Sdk;
/* loaded from: classes2.dex */
public class NimbleMTXError extends Error {
public static final String ERROR_DOMAIN = "NimbleMTXError";
private static final long serialVersionUID = 1;
public enum Code {
BILLING_NOT_AVAILABLE(20000),
ITEM_ALREADY_OWNED(Sdk.SDKError.Reason.AD_SERVER_ERROR_VALUE),
ITEM_NOT_OWNED(20002),
USER_CANCELED(20003),
VERIFICATION_ERROR(20004),
GET_NONCE_ERROR(20005),
NON_CRITICAL_INTERRUPTION(20006),
INTERNAL_STATE(20007),
TRANSACTION_PENDING(20008),
TRANSACTION_NOT_RESUMABLE(20009),
UNRECOGNIZED_TRANSACTION_ID(20010),
INVALID_TRANSACTION_STATE(20011),
UNABLE_TO_CONSTRUCT_REQUEST(20012),
PLATFORM_ERROR(20013),
INVALID_SERVER_RESPONSE(20014),
ERROR_GETTING_PREPURCHASE_INFO(20015),
ITEM_UNAVAILABLE(20016),
INVALID_SKU(20017),
TRANSACTION_DEFERRED(20018),
TRANSACTION_SUPERSEDED(20019),
EMPTY_SYNERGY_CATALOG(20020),
EMPTY_BILLING_CATALOG(20021),
ITEM_TYPE_NOT_MATCH(20037);
private int m_value;
public int intValue() {
return this.m_value;
}
Code(int i) {
this.m_value = i;
}
}
public NimbleMTXError() {
}
public NimbleMTXError(Code code, String str, Throwable th) {
super(ERROR_DOMAIN, code.intValue(), str, th);
}
public NimbleMTXError(Code code, String str) {
super(ERROR_DOMAIN, code.intValue(), str, null);
}
}

View File

@@ -0,0 +1,44 @@
package com.ea.nimble.mtx;
import java.util.Date;
import java.util.Map;
/* loaded from: classes2.dex */
public interface NimbleMTXTransaction {
public enum TransactionState {
UNDEFINED,
USER_INITIATED,
WAITING_FOR_PREPURCHASE_INFO,
WAITING_FOR_PLATFORM_RESPONSE,
WAITING_FOR_VERIFICATION,
WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT,
WAITING_FOR_PLATFORM_CONSUMPTION,
COMPLETE
}
public enum TransactionType {
PURCHASE,
RESTORE
}
Map<String, Object> getAdditionalInfo();
Exception getError();
String getItemSellId();
String getItemSku();
float getPriceDecimal();
String getReceipt();
Date getTimeStamp();
String getTransactionId();
TransactionState getTransactionState();
TransactionType getTransactionType();
}

View File

@@ -0,0 +1,7 @@
package com.ea.nimble.mtx;
/* loaded from: classes2.dex */
public final class R {
private R() {
}
}

View File

@@ -0,0 +1,9 @@
package com.ea.nimble.mtx.catalog.synergy;
/* loaded from: classes2.dex */
public class ItemCategory {
public int m_id;
public byte[] m_regularImageData;
public byte[] m_selectedImageData;
public String m_title;
}

View File

@@ -0,0 +1,464 @@
package com.ea.nimble.mtx.catalog.synergy;
import android.util.Base64;
import com.ea.nimble.ApplicationEnvironment;
import com.ea.nimble.Global;
import com.ea.nimble.IApplicationEnvironment;
import com.ea.nimble.IHttpRequest;
import com.ea.nimble.INetwork;
import com.ea.nimble.ISynergyEnvironment;
import com.ea.nimble.ISynergyNetwork;
import com.ea.nimble.Log;
import com.ea.nimble.LogSource;
import com.ea.nimble.Network;
import com.ea.nimble.NetworkConnectionCallback;
import com.ea.nimble.NetworkConnectionHandle;
import com.ea.nimble.SynergyEnvironment;
import com.ea.nimble.SynergyIdManager;
import com.ea.nimble.SynergyNetwork;
import com.ea.nimble.SynergyNetworkConnectionCallback;
import com.ea.nimble.SynergyNetworkConnectionHandle;
import com.ea.nimble.SynergyRequest;
import com.ea.nimble.Utility;
import com.ea.nimble.mtx.NimbleCatalogItem;
import com.ea.nimble.mtx.NimbleMTXError;
import com.ironsource.v8;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import csdk.gluads.Consts;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
/* loaded from: classes2.dex */
public class SynergyCatalog implements LogSource {
public static final String MTX_INFO_KEY_CURRENCY = "localCurrency";
public static final String MTX_INFO_KEY_METADATA = "metadata";
public static final String MTX_INFO_KEY_SELLID = "sellId";
private static final String SYNERGY_API_GET_AVAILABLE_ITEMS = "/product/api/core/getAvailableItems";
private static final String SYNERGY_API_GET_CATEGORIES = "/product/api/core/getMTXGameCategories";
private static final String SYNERGY_API_GET_DOWNLOAD_URL = "/product/api/core/getDownloadItemUrl";
private static final String SYNERGY_API_GET_NONCE = "/drm/api/core/getNonce";
private static final String SYNERGY_API_GET_PURCHASED_ITEMS = "/drm/api/core/getPurchasedItems";
private String m_itemSkuPrefix;
private int m_itemsLoadingBinaryData = 0;
public interface CategoryCallback {
void callback(Set<ItemCategory> set, Exception exc);
}
public interface CompletionCallback {
void callback(Exception exc);
}
public interface DataCallback {
void callback(InputStream inputStream, Exception exc);
}
public interface ItemCallback {
void callback(List<SynergyCatalogItem> list, Exception exc);
}
public interface ItemSkuCallback {
void callback(List<String> list, Exception exc);
}
public enum StoreType {
GOOGLE,
AMAZON
}
public interface StringCallback {
void callback(String str, Exception exc);
}
public String getItemSkuPrefix() {
return this.m_itemSkuPrefix;
}
@Override // com.ea.nimble.LogSource
public String getLogSourceTitle() {
return "SynergyCatalog";
}
public static /* synthetic */ int access$106(SynergyCatalog synergyCatalog) {
int i = synergyCatalog.m_itemsLoadingBinaryData - 1;
synergyCatalog.m_itemsLoadingBinaryData = i;
return i;
}
public SynergyCatalog(StoreType storeType) {
if (storeType != StoreType.AMAZON) {
this.m_itemSkuPrefix = "";
return;
}
this.m_itemSkuPrefix = ApplicationEnvironment.getComponent().getApplicationBundleId() + Consts.STRING_PERIOD;
}
public String getSellIdFromSku(String str) {
if (!this.m_itemSkuPrefix.isEmpty() && str != null && str.startsWith(this.m_itemSkuPrefix)) {
str = str.substring(this.m_itemSkuPrefix.length());
}
if (Utility.isOnlyDecimalCharacters(str)) {
return str;
}
return null;
}
public void getItemCatalog(final ItemCallback itemCallback) {
SynergyRequest.SynergyRequestPreparingCallback synergyRequestPreparingCallback = new SynergyRequest.SynergyRequestPreparingCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.1
@Override // com.ea.nimble.SynergyRequest.SynergyRequestPreparingCallback
public void prepareRequest(SynergyRequest synergyRequest) {
IApplicationEnvironment component = ApplicationEnvironment.getComponent();
ISynergyEnvironment component2 = SynergyEnvironment.getComponent();
if (component2 != null) {
synergyRequest.baseUrl = component2.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_PRODUCT);
HashMap hashMap = new HashMap();
hashMap.put("masterSellId", component2.getSellId());
hashMap.put("typeSubstr", "1");
hashMap.put("apiVer", "1.0.0");
hashMap.put("ver", component.getApplicationVersion());
hashMap.put("uid", Utility.validString(SynergyIdManager.getComponent().getSynergyId()) ? SynergyIdManager.getComponent().getSynergyId() : "0");
hashMap.put("sdkVer", Global.NIMBLE_RELEASE_VERSION);
hashMap.put("langCode", component.getShortApplicationLanguageCode());
hashMap.put("includeOfferType", "true");
synergyRequest.urlParameters = hashMap;
synergyRequest.send();
return;
}
Log.Helper.LOGE(this, "[getItemCatalog prepareRequest callback failed] Synergy environment is null, unable to send request", new Object[0]);
}
};
SynergyNetworkConnectionCallback synergyNetworkConnectionCallback = new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.2
@Override // com.ea.nimble.SynergyNetworkConnectionCallback
public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) {
if (synergyNetworkConnectionHandle.getResponse().getError() == null) {
List list = (List) synergyNetworkConnectionHandle.getResponse().getJsonData().get("productData");
if (list == null || list.size() == 0) {
itemCallback.callback(null, new NimbleMTXError(NimbleMTXError.Code.EMPTY_SYNERGY_CATALOG, "No items retrieved from Synergy"));
return;
}
ArrayList arrayList = new ArrayList(list.size());
Iterator it = list.iterator();
while (it.hasNext()) {
arrayList.add(SynergyCatalog.this.createItemFromMap((Map) it.next()));
}
itemCallback.callback(arrayList, null);
return;
}
itemCallback.callback(null, synergyNetworkConnectionHandle.getResponse().getError());
}
};
SynergyRequest synergyRequest = new SynergyRequest(SYNERGY_API_GET_AVAILABLE_ITEMS, IHttpRequest.Method.GET, synergyRequestPreparingCallback);
ISynergyNetwork component = SynergyNetwork.getComponent();
if (component != null) {
component.sendRequest(synergyRequest, synergyNetworkConnectionCallback);
} else {
Log.Helper.LOGE(this, "[getItemCatalog failed] Synergy Network is null, unable to send request", new Object[0]);
}
}
public void loadBinaryDataForItems(Collection<SynergyCatalogItem> collection, final CompletionCallback completionCallback) {
String metaDataUrl;
if (this.m_itemsLoadingBinaryData != 0) {
Log.Helper.LOGE(this, "Error: items already loading binary data", new Object[0]);
return;
}
for (final SynergyCatalogItem synergyCatalogItem : collection) {
if (synergyCatalogItem.m_additionalInfo.get("binaryData") == null && (metaDataUrl = synergyCatalogItem.getMetaDataUrl()) != null) {
try {
URL url = new URL(metaDataUrl);
this.m_itemsLoadingBinaryData++;
INetwork component = Network.getComponent();
if (component != null) {
component.sendGetRequest(url, null, new NetworkConnectionCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.3
@Override // com.ea.nimble.NetworkConnectionCallback
public void callback(NetworkConnectionHandle networkConnectionHandle) {
InputStream dataStream = networkConnectionHandle.getResponse().getDataStream();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
try {
byte[] bArr = new byte[4096];
while (true) {
int read = dataStream.read(bArr, 0, 4096);
if (read == -1) {
break;
} else {
byteArrayOutputStream.write(bArr, 0, read);
}
}
byteArrayOutputStream.flush();
} catch (IOException unused) {
Log.Helper.LOGE(this, "Error reading binary data", new Object[0]);
}
synergyCatalogItem.getAdditionalInfo().put("binaryData", byteArrayOutputStream.toByteArray());
SynergyCatalog.access$106(SynergyCatalog.this);
if (SynergyCatalog.this.m_itemsLoadingBinaryData == 0) {
completionCallback.callback(null);
}
}
});
} else {
Log.Helper.LOGE(this, "Synergy loadBinaryDataForItems failed! Network component was null, unable to send get request", new Object[0]);
}
} catch (MalformedURLException unused) {
Log.Helper.LOGE(this, "Error: Malformed item url: " + metaDataUrl, new Object[0]);
}
}
}
}
public void getNonce(final StringCallback stringCallback) {
SynergyRequest.SynergyRequestPreparingCallback synergyRequestPreparingCallback = new SynergyRequest.SynergyRequestPreparingCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.4
@Override // com.ea.nimble.SynergyRequest.SynergyRequestPreparingCallback
public void prepareRequest(SynergyRequest synergyRequest) {
ISynergyEnvironment component = SynergyEnvironment.getComponent();
if (component != null) {
synergyRequest.baseUrl = component.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_DRM);
HashMap hashMap = new HashMap();
hashMap.put("apiVer", "1.0.0");
hashMap.put("uid", SynergyIdManager.getComponent().getSynergyId());
hashMap.put("masterSellId", component.getSellId());
synergyRequest.urlParameters = hashMap;
synergyRequest.send();
return;
}
Log.Helper.LOGE(this, "[getNonce failed] Synergy environment is null, unable to send request", new Object[0]);
}
};
SynergyNetworkConnectionCallback synergyNetworkConnectionCallback = new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.5
@Override // com.ea.nimble.SynergyNetworkConnectionCallback
public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) {
if (synergyNetworkConnectionHandle.getResponse().getError() == null) {
Object obj = synergyNetworkConnectionHandle.getResponse().getJsonData().get("nonce");
stringCallback.callback(obj != null ? obj.toString() : "", null);
} else {
stringCallback.callback(null, synergyNetworkConnectionHandle.getResponse().getError());
}
}
};
SynergyRequest synergyRequest = new SynergyRequest(SYNERGY_API_GET_NONCE, IHttpRequest.Method.GET, synergyRequestPreparingCallback);
ISynergyNetwork component = SynergyNetwork.getComponent();
if (component != null) {
component.sendRequest(synergyRequest, synergyNetworkConnectionCallback);
} else {
Log.Helper.LOGE(this, "[getNonce failed] Synergy network is null, unable to send request", new Object[0]);
}
}
public void downloadItem(SynergyCatalogItem synergyCatalogItem, final DataCallback dataCallback) {
getDownloadUrlForItem(synergyCatalogItem, new StringCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.6
@Override // com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.StringCallback
public void callback(String str, Exception exc) {
if (exc == null) {
SynergyCatalog.this.downloadContent(str, dataCallback);
} else {
callback(null, exc);
}
}
});
}
public void getPurchasedItems(final ItemSkuCallback itemSkuCallback) {
SynergyRequest.SynergyRequestPreparingCallback synergyRequestPreparingCallback = new SynergyRequest.SynergyRequestPreparingCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.7
@Override // com.ea.nimble.SynergyRequest.SynergyRequestPreparingCallback
public void prepareRequest(SynergyRequest synergyRequest) {
ISynergyEnvironment component = SynergyEnvironment.getComponent();
if (component != null) {
synergyRequest.baseUrl = component.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_DRM);
HashMap hashMap = new HashMap();
hashMap.put("apiVer", "1.0.0");
hashMap.put("uid", SynergyIdManager.getComponent().getSynergyId());
hashMap.put("masterSellId", component.getSellId());
synergyRequest.urlParameters = hashMap;
synergyRequest.send();
return;
}
Log.Helper.LOGE(this, "[getPurchasedItems prepareRequest callback failed] Synergy environment is null, unable to send request", new Object[0]);
}
};
SynergyNetworkConnectionCallback synergyNetworkConnectionCallback = new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.8
@Override // com.ea.nimble.SynergyNetworkConnectionCallback
public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) {
if (synergyNetworkConnectionHandle.getResponse().getError() == null) {
List list = (List) synergyNetworkConnectionHandle.getResponse().getJsonData().get("sellIds");
ArrayList arrayList = new ArrayList(list.size());
Iterator it = list.iterator();
while (it.hasNext()) {
arrayList.add(SynergyCatalog.this.m_itemSkuPrefix + ((Integer) it.next()));
}
itemSkuCallback.callback(arrayList, null);
return;
}
itemSkuCallback.callback(null, synergyNetworkConnectionHandle.getResponse().getError());
}
};
SynergyRequest synergyRequest = new SynergyRequest(SYNERGY_API_GET_PURCHASED_ITEMS, IHttpRequest.Method.GET, synergyRequestPreparingCallback);
ISynergyNetwork component = SynergyNetwork.getComponent();
if (component != null) {
component.sendRequest(synergyRequest, synergyNetworkConnectionCallback);
} else {
Log.Helper.LOGE(this, "[getPurchasedItems failed] Synergy network is null, unable to send request", new Object[0]);
}
}
public void getCategories(final CategoryCallback categoryCallback) {
SynergyRequest.SynergyRequestPreparingCallback synergyRequestPreparingCallback = new SynergyRequest.SynergyRequestPreparingCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.9
@Override // com.ea.nimble.SynergyRequest.SynergyRequestPreparingCallback
public void prepareRequest(SynergyRequest synergyRequest) {
IApplicationEnvironment component = ApplicationEnvironment.getComponent();
ISynergyEnvironment component2 = SynergyEnvironment.getComponent();
if (component2 != null) {
synergyRequest.baseUrl = component2.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_PRODUCT);
HashMap hashMap = new HashMap();
hashMap.put("apiVer", "1.0.0");
hashMap.put("masterSellId", component2.getSellId());
hashMap.put("langCode", component.getShortApplicationLanguageCode());
synergyRequest.urlParameters = hashMap;
synergyRequest.send();
return;
}
Log.Helper.LOGE(this, "[getCategories prepareRequest callback failed] Synergy environment is null, unable to send request", new Object[0]);
}
};
SynergyNetworkConnectionCallback synergyNetworkConnectionCallback = new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.10
@Override // com.ea.nimble.SynergyNetworkConnectionCallback
public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) {
if (synergyNetworkConnectionHandle.getResponse().getError() == null) {
List<Map> list = (List) synergyNetworkConnectionHandle.getResponse().getJsonData().get("gameCategoryData");
HashSet hashSet = new HashSet();
for (Map map : list) {
ItemCategory itemCategory = new ItemCategory();
itemCategory.m_id = ((Integer) map.get("categoryId")).intValue();
itemCategory.m_title = (String) map.get("title");
itemCategory.m_regularImageData = Base64.decode((String) map.get("imageOff"), 0);
itemCategory.m_selectedImageData = Base64.decode((String) map.get("imageOn"), 0);
hashSet.add(itemCategory);
}
categoryCallback.callback(hashSet, null);
return;
}
categoryCallback.callback(null, synergyNetworkConnectionHandle.getResponse().getError());
}
};
SynergyRequest synergyRequest = new SynergyRequest(SYNERGY_API_GET_CATEGORIES, IHttpRequest.Method.GET, synergyRequestPreparingCallback);
ISynergyNetwork component = SynergyNetwork.getComponent();
if (component != null) {
component.sendRequest(synergyRequest, synergyNetworkConnectionCallback);
} else {
Log.Helper.LOGE(this, "[getCategories failed] Synergy network is null, unable to send request", new Object[0]);
}
}
private void getDownloadUrlForItem(final SynergyCatalogItem synergyCatalogItem, final StringCallback stringCallback) {
SynergyRequest.SynergyRequestPreparingCallback synergyRequestPreparingCallback = new SynergyRequest.SynergyRequestPreparingCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.11
@Override // com.ea.nimble.SynergyRequest.SynergyRequestPreparingCallback
public void prepareRequest(SynergyRequest synergyRequest) {
IApplicationEnvironment component = ApplicationEnvironment.getComponent();
ISynergyEnvironment component2 = SynergyEnvironment.getComponent();
if (component2 != null) {
synergyRequest.baseUrl = component2.getServerUrlWithKey(SynergyEnvironment.SERVER_URL_KEY_SYNERGY_PRODUCT);
HashMap hashMap = new HashMap();
hashMap.put("apiVer", "1.0.0");
hashMap.put("ver", component.getApplicationVersion());
hashMap.put("uid", SynergyIdManager.getComponent().getSynergyId());
hashMap.put("langCode", component.getShortApplicationLanguageCode());
hashMap.put(SynergyCatalog.MTX_INFO_KEY_SELLID, synergyCatalogItem.getSellId());
synergyRequest.urlParameters = hashMap;
synergyRequest.send();
return;
}
Log.Helper.LOGE(this, "[getDownloadUrlForItem prepareRequest callback failed] Synergy environment is null, unable to send request", new Object[0]);
}
};
SynergyNetworkConnectionCallback synergyNetworkConnectionCallback = new SynergyNetworkConnectionCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.12
@Override // com.ea.nimble.SynergyNetworkConnectionCallback
public void callback(SynergyNetworkConnectionHandle synergyNetworkConnectionHandle) {
if (synergyNetworkConnectionHandle.getResponse().getError() == null) {
List list = (List) ((Map) synergyNetworkConnectionHandle.getResponse().getJsonData().get("infoData")).get("fileURL");
if (list.size() > 0) {
stringCallback.callback((String) list.get(0), null);
return;
} else {
stringCallback.callback(null, new Exception("No urls for item"));
return;
}
}
stringCallback.callback(null, synergyNetworkConnectionHandle.getResponse().getError());
}
};
SynergyRequest synergyRequest = new SynergyRequest(SYNERGY_API_GET_DOWNLOAD_URL, IHttpRequest.Method.GET, synergyRequestPreparingCallback);
ISynergyNetwork component = SynergyNetwork.getComponent();
if (component != null) {
component.sendRequest(synergyRequest, synergyNetworkConnectionCallback);
} else {
Log.Helper.LOGE(this, "[getDownloadUrlForItem failed] Synergy network is null, unable to send request", new Object[0]);
}
}
/* JADX INFO: Access modifiers changed from: private */
public void downloadContent(String str, final DataCallback dataCallback) {
try {
URL url = new URL(str);
INetwork component = Network.getComponent();
if (component != null) {
component.sendGetRequest(url, null, new NetworkConnectionCallback() { // from class: com.ea.nimble.mtx.catalog.synergy.SynergyCatalog.13
@Override // com.ea.nimble.NetworkConnectionCallback
public void callback(NetworkConnectionHandle networkConnectionHandle) {
if (networkConnectionHandle.getResponse().getError() == null) {
dataCallback.callback(networkConnectionHandle.getResponse().getDataStream(), null);
} else {
dataCallback.callback(null, networkConnectionHandle.getResponse().getError());
}
}
});
} else {
Log.Helper.LOGE(this, "[downloadContent failed] Network component is null, unable to sendGetRequest to Url", new Object[0]);
}
} catch (MalformedURLException unused) {
Log.Helper.LOGE(this, "Invalid url: " + str, new Object[0]);
}
}
/* JADX INFO: Access modifiers changed from: private */
public SynergyCatalogItem createItemFromMap(Map<String, Object> map) {
SynergyCatalogItem synergyCatalogItem = new SynergyCatalogItem();
String str = "" + map.get(MTX_INFO_KEY_SELLID);
String str2 = "skuAlias_" + str + v8.i.b;
String str3 = (String) map.get("desc2");
if (str3 != null && str3.contains(str2)) {
String substring = str3.substring(str3.indexOf(str2) + str2.length());
int indexOf = substring.indexOf(59);
if (indexOf > 0) {
substring = substring.substring(0, indexOf);
}
synergyCatalogItem.m_sku = substring;
Log.Helper.LOGV(this, "[Sku Mapping] SellID=" + str + " | SKU=" + synergyCatalogItem.m_sku, new Object[0]);
} else {
synergyCatalogItem.m_sku = this.m_itemSkuPrefix + str;
}
synergyCatalogItem.m_title = (String) map.get("title");
if (Utility.safeString((String) map.get("offerType")).equals("Subscription")) {
synergyCatalogItem.m_type = NimbleCatalogItem.ItemType.SUBSCRIPTION;
} else {
synergyCatalogItem.m_type = ((Boolean) map.get("consumable")).booleanValue() ? NimbleCatalogItem.ItemType.CONSUMABLE : NimbleCatalogItem.ItemType.NONCONSUMABLE;
}
synergyCatalogItem.m_description = (String) map.get(CampaignEx.JSON_KEY_DESC);
synergyCatalogItem.m_metaDataUrl = (String) map.get("packUrl");
synergyCatalogItem.m_isFree = ((Boolean) map.get("free")).booleanValue();
synergyCatalogItem.m_additionalInfo.putAll(map);
String str4 = (String) map.get("binaryPack");
if (Utility.validString(str4)) {
synergyCatalogItem.m_additionalInfo.put("binaryData", Base64.decode(str4, 0));
}
return synergyCatalogItem;
}
}

View File

@@ -0,0 +1,97 @@
package com.ea.nimble.mtx.catalog.synergy;
import com.ea.nimble.mtx.NimbleCatalogItem;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes2.dex */
public class SynergyCatalogItem extends NimbleCatalogItem implements Serializable {
private static final long serialVersionUID = 1;
Map<String, Object> m_additionalInfo;
String m_description;
String m_formattedPrice;
boolean m_isFree;
String m_metaDataUrl;
float m_price;
String m_sku;
String m_title;
NimbleCatalogItem.ItemType m_type;
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public Map<String, Object> getAdditionalInfo() {
return this.m_additionalInfo;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public String getDescription() {
return this.m_description;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public NimbleCatalogItem.ItemType getItemType() {
return this.m_type;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public String getMetaDataUrl() {
return this.m_metaDataUrl;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public float getPriceDecimal() {
return this.m_price;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public String getPriceWithCurrencyAndFormat() {
return this.m_formattedPrice;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public String getSku() {
return this.m_sku;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public String getTitle() {
return this.m_title;
}
public boolean isFree() {
return this.m_isFree;
}
public void setDescription(String str) {
this.m_description = str;
}
public void setPriceDecimal(float f) {
this.m_price = f;
}
public void setPriceWithCurrencyAndFormat(String str) {
this.m_formattedPrice = str;
}
public void setTitle(String str) {
this.m_title = str;
}
public SynergyCatalogItem() {
this.m_additionalInfo = new HashMap();
}
public SynergyCatalogItem(String str) {
this();
this.m_sku = str;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public String getSellId() {
if (this.m_additionalInfo.containsKey(SynergyCatalog.MTX_INFO_KEY_SELLID)) {
return this.m_additionalInfo.get(SynergyCatalog.MTX_INFO_KEY_SELLID).toString();
}
return null;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,142 @@
package com.ea.nimble.mtx.googleplay;
import com.ea.nimble.Log;
import com.ea.nimble.mtx.NimbleCatalogItem;
import com.ea.nimble.mtx.catalog.synergy.SynergyCatalog;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes2.dex */
public class GooglePlayCatalogItem extends NimbleCatalogItem implements Externalizable {
Map<String, Object> mAdditionalInfo;
String mDescription;
boolean mIsFree;
NimbleCatalogItem.ItemType mItemType;
float mPriceDecimal;
String mPriceWithCurrencyAndFormat;
String mSku;
String mTitle;
String mUrl;
public GooglePlayCatalogItem() {
Log.Helper.LOGPUBLICFUNC(this);
this.mSku = "";
this.mTitle = "";
this.mDescription = "";
this.mPriceDecimal = 0.0f;
this.mPriceWithCurrencyAndFormat = "";
this.mItemType = NimbleCatalogItem.ItemType.UNKNOWN;
this.mUrl = "";
this.mIsFree = false;
this.mAdditionalInfo = new HashMap();
}
public GooglePlayCatalogItem(GooglePlayCatalogItem googlePlayCatalogItem) {
this.mSku = googlePlayCatalogItem.mSku;
this.mTitle = googlePlayCatalogItem.mTitle;
this.mDescription = googlePlayCatalogItem.mDescription;
this.mPriceDecimal = googlePlayCatalogItem.mPriceDecimal;
this.mPriceWithCurrencyAndFormat = googlePlayCatalogItem.mPriceWithCurrencyAndFormat;
this.mItemType = googlePlayCatalogItem.mItemType;
this.mUrl = googlePlayCatalogItem.mUrl;
this.mIsFree = googlePlayCatalogItem.mIsFree;
this.mAdditionalInfo = new HashMap(googlePlayCatalogItem.mAdditionalInfo);
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public String getSku() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mSku;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public String getSellId() {
Log.Helper.LOGPUBLICFUNC(this);
if (this.mAdditionalInfo.containsKey(SynergyCatalog.MTX_INFO_KEY_SELLID)) {
return this.mAdditionalInfo.get(SynergyCatalog.MTX_INFO_KEY_SELLID).toString();
}
return null;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public String getTitle() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mTitle;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public String getDescription() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mDescription;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public float getPriceDecimal() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mPriceDecimal;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public String getPriceWithCurrencyAndFormat() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mPriceWithCurrencyAndFormat;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public NimbleCatalogItem.ItemType getItemType() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mItemType;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public String getMetaDataUrl() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mUrl;
}
public boolean isFree() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mIsFree;
}
@Override // com.ea.nimble.mtx.NimbleCatalogItem
public Map<String, Object> getAdditionalInfo() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mAdditionalInfo;
}
public String toString() {
Log.Helper.LOGPUBLICFUNC(this);
return "SKU(" + this.mSku + ") Title(" + this.mTitle + ") Price(" + this.mPriceDecimal + ") Currency(" + this.mAdditionalInfo.get(SynergyCatalog.MTX_INFO_KEY_CURRENCY) + ") PriceStr(" + this.mPriceWithCurrencyAndFormat + ") ItemType(" + this.mItemType + ")";
}
@Override // java.io.Externalizable
public void writeExternal(ObjectOutput objectOutput) throws IOException {
Log.Helper.LOGPUBLICFUNC(this);
objectOutput.writeUTF(this.mSku);
objectOutput.writeUTF(this.mTitle);
objectOutput.writeUTF(this.mDescription);
objectOutput.writeFloat(this.mPriceDecimal);
objectOutput.writeUTF(this.mPriceWithCurrencyAndFormat);
objectOutput.writeObject(this.mItemType);
objectOutput.writeBoolean(this.mIsFree);
objectOutput.writeObject(this.mAdditionalInfo);
}
@Override // java.io.Externalizable
public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException {
Log.Helper.LOGPUBLICFUNC(this);
this.mSku = objectInput.readUTF();
this.mTitle = objectInput.readUTF();
this.mDescription = objectInput.readUTF();
this.mPriceDecimal = objectInput.readFloat();
this.mPriceWithCurrencyAndFormat = objectInput.readUTF();
this.mItemType = (NimbleCatalogItem.ItemType) objectInput.readObject();
this.mIsFree = objectInput.readBoolean();
this.mAdditionalInfo = (Map) objectInput.readObject();
}
}

View File

@@ -0,0 +1,46 @@
package com.ea.nimble.mtx.googleplay;
import com.ea.nimble.Error;
/* loaded from: classes2.dex */
class GooglePlayError extends Error {
public static final String ERROR_DOMAIN = "GooglePlayError";
private static final long serialVersionUID = 1;
public enum Code {
BILLING_RESPONSE_RESULT_OK(0),
BILLING_RESPONSE_RESULT_USER_CANCELED(1),
BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE(3),
BILLING_RESPONSE_RESULT_ITEM_UNAVAILABLE(4),
BILLING_RESPONSE_RESULT_DEVELOPER_ERROR(5),
BILLING_RESPONSE_RESULT_ERROR(6),
BILLING_RESPONSE_RESULT_FEATURE_NOT_SUPPORTED(-2),
BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED(7),
BILLING_RESPONSE_RESULT_ITEM_NOT_OWNED(8),
BILLING_RESPONSE_RESULT_SERVICE_DISCONNECTED(-1),
BILLING_RESPONSE_RESULT_SERVICE_UNAVAILABLE(2),
BILLING_RESPONSE_RESULT_NETWORK_ERROR(12),
UNKNOWN(10003);
private int m_value;
public int intValue() {
return this.m_value;
}
Code(int i) {
this.m_value = i;
}
}
public GooglePlayError() {
}
public GooglePlayError(Code code, String str, Throwable th) {
super(ERROR_DOMAIN, code.intValue(), str, th);
}
public GooglePlayError(Code code, String str) {
super(ERROR_DOMAIN, code.intValue(), str);
}
}

View File

@@ -0,0 +1,20 @@
package com.ea.nimble.mtx.googleplay;
import com.ea.nimble.NetworkConnectionCallback;
import com.ea.nimble.NetworkConnectionHandle;
/* loaded from: classes2.dex */
public abstract class GooglePlayNetworkConnectionCallback implements NetworkConnectionCallback {
String mParameter;
GooglePlay mParentGooglePlay;
String mTransactionId;
@Override // com.ea.nimble.NetworkConnectionCallback
public abstract void callback(NetworkConnectionHandle networkConnectionHandle);
public GooglePlayNetworkConnectionCallback(GooglePlay googlePlay, String str, String str2) {
this.mParentGooglePlay = googlePlay;
this.mTransactionId = str;
this.mParameter = str2;
}
}

View File

@@ -0,0 +1,243 @@
package com.ea.nimble.mtx.googleplay;
import com.ea.nimble.Error;
import com.ea.nimble.Log;
import com.ea.nimble.Utility;
import com.ea.nimble.mtx.INimbleMTX;
import com.ea.nimble.mtx.NimbleCatalogItem;
import com.ea.nimble.mtx.NimbleMTX;
import com.ea.nimble.mtx.NimbleMTXTransaction;
import com.ea.nimble.mtx.catalog.synergy.SynergyCatalog;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/* loaded from: classes2.dex */
public class GooglePlayTransaction implements NimbleMTXTransaction, Externalizable {
String mTransactionId = "";
String mReceipt = "";
String mItemSku = "";
float mPriceDecimal = 0.0f;
Date mTimeStamp = null;
String mNonce = "";
Exception mError = null;
GooglePlayCatalogItem mCatalogItem = null;
GooglePlayTransactionState mGooglePlayTransactionState = GooglePlayTransactionState.UNDEFINED;
GooglePlayTransactionState mFailedState = null;
INimbleMTX.PurchaseTransactionCallback mPurchaseCallback = null;
INimbleMTX.FinalizeTransactionCallback mFinalizeCallback = null;
INimbleMTX.ItemGrantedCallback mItemGrantedCallback = null;
NimbleMTXTransaction.TransactionType mTransactionType = NimbleMTXTransaction.TransactionType.PURCHASE;
String mDeveloperPayload = "";
boolean mIsRecorded = false;
Map<String, Serializable> mAdditionalInfo = new HashMap();
public enum GooglePlayTransactionState {
UNDEFINED,
WAITING_FOR_PREPURCHASE_INFO,
WAITING_FOR_NONCE,
WAITING_FOR_GOOGLEPLAY_ACTIVITY_RESPONSE,
WAITING_FOR_SYNERGY_VERIFICATION,
WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT,
WAITING_FOR_GOOGLEPLAY_CONSUMPTION,
COMPLETE
}
@Override // com.ea.nimble.mtx.NimbleMTXTransaction
public String getTransactionId() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mTransactionId;
}
@Override // com.ea.nimble.mtx.NimbleMTXTransaction
public String getItemSku() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mItemSku;
}
/* renamed from: com.ea.nimble.mtx.googleplay.GooglePlayTransaction$1, reason: invalid class name */
public static /* synthetic */ class AnonymousClass1 {
static final /* synthetic */ int[] $SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState;
static {
int[] iArr = new int[GooglePlayTransactionState.values().length];
$SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState = iArr;
try {
iArr[GooglePlayTransactionState.WAITING_FOR_PREPURCHASE_INFO.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[GooglePlayTransactionState.WAITING_FOR_GOOGLEPLAY_ACTIVITY_RESPONSE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[GooglePlayTransactionState.WAITING_FOR_NONCE.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[GooglePlayTransactionState.WAITING_FOR_SYNERGY_VERIFICATION.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[GooglePlayTransactionState.WAITING_FOR_GAME_TO_CONFIRM_ITEM_GRANT.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[GooglePlayTransactionState.WAITING_FOR_GOOGLEPLAY_CONSUMPTION.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
$SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[GooglePlayTransactionState.COMPLETE.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
$SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[GooglePlayTransactionState.UNDEFINED.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
}
}
@Override // com.ea.nimble.mtx.NimbleMTXTransaction
public NimbleMTXTransaction.TransactionState getTransactionState() {
Log.Helper.LOGPUBLICFUNC(this);
switch (AnonymousClass1.$SwitchMap$com$ea$nimble$mtx$googleplay$GooglePlayTransaction$GooglePlayTransactionState[this.mGooglePlayTransactionState.ordinal()]) {
}
return NimbleMTXTransaction.TransactionState.UNDEFINED;
}
@Override // com.ea.nimble.mtx.NimbleMTXTransaction
public NimbleMTXTransaction.TransactionType getTransactionType() {
Log.Helper.LOGPUBLICFUNC(this);
NimbleMTXTransaction.TransactionType transactionType = this.mTransactionType;
return transactionType == null ? NimbleMTXTransaction.TransactionType.PURCHASE : transactionType;
}
@Override // com.ea.nimble.mtx.NimbleMTXTransaction
public float getPriceDecimal() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mPriceDecimal;
}
@Override // com.ea.nimble.mtx.NimbleMTXTransaction
public String getItemSellId() {
Log.Helper.LOGPUBLICFUNC(this);
List<NimbleCatalogItem> availableCatalogItems = NimbleMTX.getComponent().getAvailableCatalogItems();
String itemSku = getItemSku();
if (availableCatalogItems != null) {
for (NimbleCatalogItem nimbleCatalogItem : availableCatalogItems) {
if (nimbleCatalogItem.getSku().equals(itemSku)) {
String sellId = nimbleCatalogItem.getSellId();
if (Utility.validString(sellId)) {
return sellId;
}
}
}
}
if (this.mAdditionalInfo.containsKey(SynergyCatalog.MTX_INFO_KEY_SELLID)) {
return this.mAdditionalInfo.get(SynergyCatalog.MTX_INFO_KEY_SELLID).toString();
}
Log.Helper.LOGW(this, "getItemSellId(): Unable to acquire sell id for transaction with SKU: " + itemSku, new Object[0]);
return "";
}
@Override // com.ea.nimble.mtx.NimbleMTXTransaction
public Date getTimeStamp() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mTimeStamp;
}
@Override // com.ea.nimble.mtx.NimbleMTXTransaction
public String getReceipt() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mReceipt;
}
@Override // com.ea.nimble.mtx.NimbleMTXTransaction
public Map<String, Object> getAdditionalInfo() {
Log.Helper.LOGPUBLICFUNC(this);
return new HashMap(this.mAdditionalInfo);
}
public String getNonce() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mNonce;
}
public String getDeveloperPayload() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mDeveloperPayload;
}
@Override // com.ea.nimble.mtx.NimbleMTXTransaction
public Exception getError() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mError;
}
public GooglePlayCatalogItem getCatalogItem() {
Log.Helper.LOGPUBLICFUNC(this);
return this.mCatalogItem;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("GooglePlayTransaction: SKU(");
sb.append(getItemSku());
sb.append(") State(");
GooglePlayTransactionState googlePlayTransactionState = this.mGooglePlayTransactionState;
sb.append(googlePlayTransactionState == null ? "null" : googlePlayTransactionState.toString());
sb.append(") Receipt(");
sb.append(getReceipt());
sb.append(") TimeStamp(");
sb.append(getTimeStamp());
sb.append(")");
return sb.toString();
}
@Override // java.io.Externalizable
public void writeExternal(ObjectOutput objectOutput) throws IOException {
Log.Helper.LOGPUBLICFUNC(this);
objectOutput.writeUTF(Utility.safeString(this.mTransactionId));
objectOutput.writeUTF(Utility.safeString(this.mItemSku));
objectOutput.writeObject(this.mGooglePlayTransactionState);
objectOutput.writeObject(this.mTransactionType);
objectOutput.writeFloat(this.mPriceDecimal);
objectOutput.writeObject(this.mTimeStamp);
objectOutput.writeUTF(Utility.safeString(this.mReceipt));
objectOutput.writeUTF(Utility.safeString(this.mNonce));
objectOutput.writeObject(this.mError);
objectOutput.writeObject(this.mCatalogItem);
objectOutput.writeObject(this.mAdditionalInfo);
objectOutput.writeUTF(Utility.safeString(this.mDeveloperPayload));
objectOutput.writeObject(this.mFailedState);
objectOutput.writeBoolean(this.mIsRecorded);
}
@Override // java.io.Externalizable
public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException {
Log.Helper.LOGPUBLICFUNC(this);
this.mTransactionId = objectInput.readUTF();
this.mItemSku = objectInput.readUTF();
this.mGooglePlayTransactionState = (GooglePlayTransactionState) objectInput.readObject();
this.mTransactionType = (NimbleMTXTransaction.TransactionType) objectInput.readObject();
this.mPriceDecimal = objectInput.readFloat();
this.mTimeStamp = (Date) objectInput.readObject();
this.mReceipt = objectInput.readUTF();
this.mNonce = objectInput.readUTF();
this.mError = (Error) objectInput.readObject();
this.mCatalogItem = (GooglePlayCatalogItem) objectInput.readObject();
this.mAdditionalInfo = (Map) objectInput.readObject();
this.mDeveloperPayload = objectInput.readUTF();
try {
this.mFailedState = (GooglePlayTransactionState) objectInput.readObject();
this.mIsRecorded = objectInput.readBoolean();
} catch (IOException unused) {
}
}
}

View File

@@ -0,0 +1,7 @@
package com.ea.nimble.mtx.googleplay;
/* loaded from: classes2.dex */
public final class R {
private R() {
}
}

View File

@@ -0,0 +1,177 @@
package com.ea.nimble.mtx.googleplay.billing;
import android.app.Activity;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.android.billingclient.api.AcknowledgePurchaseParams;
import com.android.billingclient.api.AcknowledgePurchaseResponseListener;
import com.android.billingclient.api.BillingClient;
import com.android.billingclient.api.BillingClientStateListener;
import com.android.billingclient.api.BillingFlowParams;
import com.android.billingclient.api.BillingResult;
import com.android.billingclient.api.ConsumeParams;
import com.android.billingclient.api.ConsumeResponseListener;
import com.android.billingclient.api.ProductDetails;
import com.android.billingclient.api.ProductDetailsResponseListener;
import com.android.billingclient.api.Purchase;
import com.android.billingclient.api.PurchasesResponseListener;
import com.android.billingclient.api.PurchasesUpdatedListener;
import com.android.billingclient.api.QueryProductDetailsParams;
import com.android.billingclient.api.QueryPurchasesParams;
import com.ea.nimble.Log;
import com.ea.nimble.LogSource;
import com.firemonkeys.cloudcellapi.Consts;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
/* loaded from: classes2.dex */
public class BillingHelper implements LogSource, PurchasesUpdatedListener, ProductDetailsResponseListener, PurchasesResponseListener {
private String m_base64PublicKey;
private BillingClient m_billingClient;
ProductDetailsResponseListener m_productDetailsClientListener;
PurchasesResponseListener m_purchaseResponseListener;
PurchasesUpdatedListener m_purchasesUpdatedListener;
private int m_catalogQueryRequests = 0;
private int m_purchaseHistoryRequests = 0;
List<ProductDetails> m_CatalogItemsList = new LinkedList();
List<Purchase> m_PurchasesList = new LinkedList();
@Override // com.ea.nimble.LogSource
public String getLogSourceTitle() {
return "MTX Google BillingHelper";
}
public BillingHelper(Context context, String str) {
this.m_billingClient = BillingClient.newBuilder(context).enablePendingPurchases().setListener(this).build();
this.m_base64PublicKey = str;
}
public boolean isBillingAvailable() {
return this.m_billingClient.isReady();
}
public void startSetup(@NonNull BillingClientStateListener billingClientStateListener, @NonNull PurchasesUpdatedListener purchasesUpdatedListener) {
this.m_purchasesUpdatedListener = purchasesUpdatedListener;
Log.Helper.LOGFUNC(this);
if (this.m_billingClient.isReady()) {
throw new IllegalStateException("Billing Client is already setup");
}
Log.Helper.LOGV(this, "Starting Billing Setup", new Object[0]);
this.m_billingClient.startConnection(billingClientStateListener);
}
public void dispose() {
Log.Helper.LOGFUNC(this);
Log.Helper.LOGV(this, "Disposing Billing Client Service", new Object[0]);
BillingClient billingClient = this.m_billingClient;
if (billingClient != null) {
billingClient.endConnection();
this.m_billingClient = null;
}
}
public void queryProductDetailsAsync(@NonNull List<QueryProductDetailsParams.Product> list, @NonNull List<QueryProductDetailsParams.Product> list2, @NonNull ProductDetailsResponseListener productDetailsResponseListener) {
Log.Helper.LOGFUNC(this);
this.m_CatalogItemsList.clear();
if (list.size() == 0 && list2.size() == 0) {
Log.Helper.LOGW(this, "Empty Product List passed to queryProductDetails", new Object[0]);
return;
}
this.m_productDetailsClientListener = productDetailsResponseListener;
this.m_billingClient.queryProductDetailsAsync(QueryProductDetailsParams.newBuilder().setProductList(list).build(), this);
this.m_catalogQueryRequests++;
this.m_billingClient.queryProductDetailsAsync(QueryProductDetailsParams.newBuilder().setProductList(list2).build(), this);
this.m_catalogQueryRequests++;
}
public void queryPurchasesAsync(@NonNull PurchasesResponseListener purchasesResponseListener) {
Log.Helper.LOGFUNC(this);
this.m_PurchasesList.clear();
this.m_purchaseResponseListener = purchasesResponseListener;
if (isBillingAvailable()) {
this.m_billingClient.queryPurchasesAsync(QueryPurchasesParams.newBuilder().setProductType(Consts.ITEM_TYPE_SUBSCRIPTION).build(), this);
this.m_purchaseHistoryRequests++;
this.m_billingClient.queryPurchasesAsync(QueryPurchasesParams.newBuilder().setProductType("inapp").build(), this);
this.m_purchaseHistoryRequests++;
return;
}
Log.Helper.LOGE(this, "Billing not available", new Object[0]);
}
@Override // com.android.billingclient.api.PurchasesResponseListener
public void onQueryPurchasesResponse(@NonNull BillingResult billingResult, @NonNull List<Purchase> list) {
Log.Helper.LOGFUNC(this);
this.m_purchaseHistoryRequests--;
if (billingResult.getResponseCode() == 0) {
for (Purchase purchase : list) {
if (isSignatureValid(purchase)) {
this.m_PurchasesList.add(purchase);
} else {
Log.Helper.LOGW(this, "Purchase signature verification **FAILED**. Not adding item.", new Object[0]);
Log.Helper.LOGD(this, " Purchase data: " + purchase.getOriginalJson(), new Object[0]);
Log.Helper.LOGD(this, " Signature: " + purchase.getSignature(), new Object[0]);
}
}
}
if (billingResult.getResponseCode() != 0 || this.m_purchaseHistoryRequests == 0) {
this.m_purchaseHistoryRequests = 0;
PurchasesResponseListener purchasesResponseListener = this.m_purchaseResponseListener;
if (purchasesResponseListener != null) {
purchasesResponseListener.onQueryPurchasesResponse(billingResult, this.m_PurchasesList);
this.m_purchaseResponseListener = null;
}
}
}
@Override // com.android.billingclient.api.ProductDetailsResponseListener
public void onProductDetailsResponse(@NonNull BillingResult billingResult, @Nullable List<ProductDetails> list) {
Log.Helper.LOGFUNC(this);
this.m_catalogQueryRequests--;
if (billingResult.getResponseCode() == 0) {
for (ProductDetails productDetails : list) {
Log.Helper.LOGV(this, "onProductDetailsResponse: " + productDetails, new Object[0]);
this.m_CatalogItemsList.add(productDetails);
}
}
if (this.m_catalogQueryRequests == 0) {
this.m_productDetailsClientListener.onProductDetailsResponse(billingResult, this.m_CatalogItemsList);
}
}
public void launchPurchaseFlow(@NonNull Activity activity, @NonNull ProductDetails productDetails) {
Log.Helper.LOGFUNC(this);
ArrayList arrayList = new ArrayList();
if (Consts.ITEM_TYPE_SUBSCRIPTION.equals(productDetails.getProductType())) {
arrayList.add(BillingFlowParams.ProductDetailsParams.newBuilder().setProductDetails(productDetails).setOfferToken(((ProductDetails.SubscriptionOfferDetails) productDetails.getSubscriptionOfferDetails().get(0)).getOfferToken()).build());
} else {
arrayList.add(BillingFlowParams.ProductDetailsParams.newBuilder().setProductDetails(productDetails).build());
}
this.m_billingClient.launchBillingFlow(activity, BillingFlowParams.newBuilder().setProductDetailsParamsList(arrayList).build());
}
@Override // com.android.billingclient.api.PurchasesUpdatedListener
public void onPurchasesUpdated(@NonNull BillingResult billingResult, @Nullable List<Purchase> list) {
Log.Helper.LOGFUNC(this);
this.m_purchasesUpdatedListener.onPurchasesUpdated(billingResult, list);
}
public void consumeAsync(@NonNull String str, @NonNull ConsumeResponseListener consumeResponseListener) {
Log.Helper.LOGFUNC(this);
this.m_billingClient.consumeAsync(ConsumeParams.newBuilder().setPurchaseToken(str).build(), consumeResponseListener);
}
public void acknowledgeAsync(@NonNull String str, @NonNull AcknowledgePurchaseResponseListener acknowledgePurchaseResponseListener) {
Log.Helper.LOGFUNC(this);
this.m_billingClient.acknowledgePurchase(AcknowledgePurchaseParams.newBuilder().setPurchaseToken(str).build(), acknowledgePurchaseResponseListener);
}
private boolean isSignatureValid(@NonNull Purchase purchase) {
String str = this.m_base64PublicKey;
if (str != null) {
return Security.verifyPurchase(str, purchase.getOriginalJson(), purchase.getSignature());
}
return true;
}
}

View File

@@ -0,0 +1,73 @@
package com.ea.nimble.mtx.googleplay.billing;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
import java.security.Signature;
import java.security.SignatureException;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.X509EncodedKeySpec;
/* loaded from: classes2.dex */
class Security {
private static final String KEY_FACTORY_ALGORITHM = "RSA";
private static final String SIGNATURE_ALGORITHM = "SHA1withRSA";
private static final String TAG = "IABUtil/Security";
public static boolean verifyPurchase(String str, String str2, String str3) {
if (TextUtils.isEmpty(str2) || TextUtils.isEmpty(str) || TextUtils.isEmpty(str3)) {
Log.w(TAG, "Purchase verification failed: missing data.");
return false;
}
try {
return verify(generatePublicKey(str), str2, str3).booleanValue();
} catch (IOException e) {
Log.e(TAG, "Error generating PublicKey from encoded key: " + e.getMessage());
return false;
}
}
private static PublicKey generatePublicKey(String str) throws IOException {
try {
return KeyFactory.getInstance(KEY_FACTORY_ALGORITHM).generatePublic(new X509EncodedKeySpec(Base64.decode(str, 0)));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (InvalidKeySpecException e2) {
String str2 = "Invalid key specification: " + e2;
Log.w(TAG, str2);
throw new IOException(str2);
}
}
private static Boolean verify(PublicKey publicKey, String str, String str2) {
try {
byte[] decode = Base64.decode(str2, 0);
try {
Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM);
signature.initVerify(publicKey);
signature.update(str.getBytes());
if (signature.verify(decode)) {
return Boolean.TRUE;
}
Log.w(TAG, "Signature verification failed...");
return Boolean.FALSE;
} catch (InvalidKeyException unused) {
Log.e(TAG, "Invalid key specification.");
return Boolean.FALSE;
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (SignatureException unused2) {
Log.e(TAG, "Signature exception.");
return Boolean.FALSE;
}
} catch (IllegalArgumentException unused3) {
Log.w(TAG, "Base64 decoding failed.");
return Boolean.FALSE;
}
}
}