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,101 @@
package com.facebook.appevents.iap;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import com.facebook.FacebookSdk;
import java.util.ArrayList;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class InAppPurchaseActivityLifecycleTracker$initializeIfNotInitialized$2 implements Application.ActivityLifecycleCallbacks {
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityCreated(Activity activity, Bundle bundle) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityDestroyed(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityPaused(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
Intrinsics.checkNotNullParameter(activity, "activity");
Intrinsics.checkNotNullParameter(outState, "outState");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStarted(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityResumed(Activity activity) {
Intrinsics.checkNotNullParameter(activity, "activity");
try {
FacebookSdk.getExecutor().execute(new Runnable() { // from class: com.facebook.appevents.iap.InAppPurchaseActivityLifecycleTracker$initializeIfNotInitialized$2$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
InAppPurchaseActivityLifecycleTracker$initializeIfNotInitialized$2.m496onActivityResumed$lambda0();
}
});
} catch (Exception unused) {
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onActivityResumed$lambda-0, reason: not valid java name */
public static final void m496onActivityResumed$lambda0() {
Object obj;
Object obj2;
Context applicationContext = FacebookSdk.getApplicationContext();
InAppPurchaseEventManager inAppPurchaseEventManager = InAppPurchaseEventManager.INSTANCE;
obj = InAppPurchaseActivityLifecycleTracker.inAppBillingObj;
ArrayList<String> purchasesInapp = InAppPurchaseEventManager.getPurchasesInapp(applicationContext, obj);
InAppPurchaseActivityLifecycleTracker inAppPurchaseActivityLifecycleTracker = InAppPurchaseActivityLifecycleTracker.INSTANCE;
inAppPurchaseActivityLifecycleTracker.logPurchase(applicationContext, purchasesInapp, false);
obj2 = InAppPurchaseActivityLifecycleTracker.inAppBillingObj;
inAppPurchaseActivityLifecycleTracker.logPurchase(applicationContext, InAppPurchaseEventManager.getPurchasesSubs(applicationContext, obj2), true);
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStopped(Activity activity) {
Boolean bool;
Intrinsics.checkNotNullParameter(activity, "activity");
try {
bool = InAppPurchaseActivityLifecycleTracker.hasBillingActivity;
if (Intrinsics.areEqual(bool, Boolean.TRUE) && Intrinsics.areEqual(activity.getLocalClassName(), "com.android.billingclient.api.ProxyBillingActivity")) {
FacebookSdk.getExecutor().execute(new Runnable() { // from class: com.facebook.appevents.iap.InAppPurchaseActivityLifecycleTracker$initializeIfNotInitialized$2$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
InAppPurchaseActivityLifecycleTracker$initializeIfNotInitialized$2.m497onActivityStopped$lambda1();
}
});
}
} catch (Exception unused) {
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onActivityStopped$lambda-1, reason: not valid java name */
public static final void m497onActivityStopped$lambda1() {
Object obj;
Object obj2;
Context applicationContext = FacebookSdk.getApplicationContext();
InAppPurchaseEventManager inAppPurchaseEventManager = InAppPurchaseEventManager.INSTANCE;
obj = InAppPurchaseActivityLifecycleTracker.inAppBillingObj;
ArrayList<String> purchasesInapp = InAppPurchaseEventManager.getPurchasesInapp(applicationContext, obj);
if (purchasesInapp.isEmpty()) {
obj2 = InAppPurchaseActivityLifecycleTracker.inAppBillingObj;
purchasesInapp = InAppPurchaseEventManager.getPurchaseHistoryInapp(applicationContext, obj2);
}
InAppPurchaseActivityLifecycleTracker.INSTANCE.logPurchase(applicationContext, purchasesInapp, false);
}
}

View File

@@ -0,0 +1,137 @@
package com.facebook.appevents.iap;
import android.app.Application;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.util.Log;
import com.facebook.FacebookSdk;
import com.facebook.appevents.internal.AutomaticAnalyticsLogger;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.unity3d.ads.metadata.InAppPurchaseMetaData;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.jvm.internal.Intrinsics;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class InAppPurchaseActivityLifecycleTracker {
private static final String BILLING_ACTIVITY_NAME = "com.android.billingclient.api.ProxyBillingActivity";
private static final String SERVICE_INTERFACE_NAME = "com.android.vending.billing.IInAppBillingService$Stub";
private static Application.ActivityLifecycleCallbacks callbacks;
private static Boolean hasBillingActivity;
private static Boolean hasBillingService;
private static Object inAppBillingObj;
private static Intent intent;
private static ServiceConnection serviceConnection;
public static final InAppPurchaseActivityLifecycleTracker INSTANCE = new InAppPurchaseActivityLifecycleTracker();
private static final String TAG = InAppPurchaseActivityLifecycleTracker.class.getCanonicalName();
private static final AtomicBoolean isTracking = new AtomicBoolean(false);
private InAppPurchaseActivityLifecycleTracker() {
}
public static final void startIapLogging() {
InAppPurchaseActivityLifecycleTracker inAppPurchaseActivityLifecycleTracker = INSTANCE;
inAppPurchaseActivityLifecycleTracker.initializeIfNotInitialized();
if (!Intrinsics.areEqual(hasBillingService, Boolean.FALSE) && AutomaticAnalyticsLogger.isImplicitPurchaseLoggingEnabled()) {
inAppPurchaseActivityLifecycleTracker.startTracking();
}
}
private final void initializeIfNotInitialized() {
if (hasBillingService != null) {
return;
}
Boolean valueOf = Boolean.valueOf(InAppPurchaseUtils.getClass(SERVICE_INTERFACE_NAME) != null);
hasBillingService = valueOf;
if (Intrinsics.areEqual(valueOf, Boolean.FALSE)) {
return;
}
hasBillingActivity = Boolean.valueOf(InAppPurchaseUtils.getClass(BILLING_ACTIVITY_NAME) != null);
InAppPurchaseEventManager.clearSkuDetailsCache();
Intent intent2 = new Intent("com.android.vending.billing.InAppBillingService.BIND").setPackage("com.android.vending");
Intrinsics.checkNotNullExpressionValue(intent2, "Intent(\"com.android.vending.billing.InAppBillingService.BIND\")\n .setPackage(\"com.android.vending\")");
intent = intent2;
serviceConnection = new ServiceConnection() { // from class: com.facebook.appevents.iap.InAppPurchaseActivityLifecycleTracker$initializeIfNotInitialized$1
@Override // android.content.ServiceConnection
public void onServiceDisconnected(ComponentName name) {
Intrinsics.checkNotNullParameter(name, "name");
}
@Override // android.content.ServiceConnection
public void onServiceConnected(ComponentName name, IBinder service) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(service, "service");
InAppPurchaseActivityLifecycleTracker inAppPurchaseActivityLifecycleTracker = InAppPurchaseActivityLifecycleTracker.INSTANCE;
InAppPurchaseEventManager inAppPurchaseEventManager = InAppPurchaseEventManager.INSTANCE;
InAppPurchaseActivityLifecycleTracker.inAppBillingObj = InAppPurchaseEventManager.asInterface(FacebookSdk.getApplicationContext(), service);
}
};
callbacks = new InAppPurchaseActivityLifecycleTracker$initializeIfNotInitialized$2();
}
private final void startTracking() {
if (isTracking.compareAndSet(false, true)) {
Context applicationContext = FacebookSdk.getApplicationContext();
if (applicationContext instanceof Application) {
Application application = (Application) applicationContext;
Application.ActivityLifecycleCallbacks activityLifecycleCallbacks = callbacks;
if (activityLifecycleCallbacks == null) {
Intrinsics.throwUninitializedPropertyAccessException("callbacks");
throw null;
}
application.registerActivityLifecycleCallbacks(activityLifecycleCallbacks);
Intent intent2 = intent;
if (intent2 == null) {
Intrinsics.throwUninitializedPropertyAccessException(SDKConstants.PARAM_INTENT);
throw null;
}
ServiceConnection serviceConnection2 = serviceConnection;
if (serviceConnection2 != null) {
applicationContext.bindService(intent2, serviceConnection2, 1);
} else {
Intrinsics.throwUninitializedPropertyAccessException("serviceConnection");
throw null;
}
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public final void logPurchase(Context context, ArrayList<String> arrayList, boolean z) {
if (arrayList.isEmpty()) {
return;
}
HashMap hashMap = new HashMap();
ArrayList arrayList2 = new ArrayList();
Iterator<String> it = arrayList.iterator();
while (it.hasNext()) {
String purchase = it.next();
try {
String sku = new JSONObject(purchase).getString(InAppPurchaseMetaData.KEY_PRODUCT_ID);
Intrinsics.checkNotNullExpressionValue(sku, "sku");
Intrinsics.checkNotNullExpressionValue(purchase, "purchase");
hashMap.put(sku, purchase);
arrayList2.add(sku);
} catch (JSONException e) {
Log.e(TAG, "Error parsing in-app purchase data.", e);
}
}
InAppPurchaseEventManager inAppPurchaseEventManager = InAppPurchaseEventManager.INSTANCE;
for (Map.Entry<String, String> entry : InAppPurchaseEventManager.getSkuDetails(context, arrayList2, inAppBillingObj, z).entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
String str = (String) hashMap.get(key);
if (str != null) {
AutomaticAnalyticsLogger.logPurchase(str, value, z);
}
}
}
}

View File

@@ -0,0 +1,88 @@
package com.facebook.appevents.iap;
import android.content.Context;
import androidx.annotation.RestrictTo;
import com.facebook.appevents.iap.InAppPurchaseBillingClientWrapper;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class InAppPurchaseAutoLogger {
private static final String BILLING_CLIENT_PURCHASE_NAME = "com.android.billingclient.api.Purchase";
public static final InAppPurchaseAutoLogger INSTANCE = new InAppPurchaseAutoLogger();
private InAppPurchaseAutoLogger() {
}
public static final void startIapLogging(Context context) {
InAppPurchaseBillingClientWrapper.Companion companion;
InAppPurchaseBillingClientWrapper orCreateInstance;
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseAutoLogger.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(context, "context");
if (InAppPurchaseUtils.getClass(BILLING_CLIENT_PURCHASE_NAME) == null || (orCreateInstance = (companion = InAppPurchaseBillingClientWrapper.Companion).getOrCreateInstance(context)) == null || !companion.isServiceConnected().get()) {
return;
}
if (InAppPurchaseLoggerManager.eligibleQueryPurchaseHistory()) {
orCreateInstance.queryPurchaseHistory("inapp", new Runnable() { // from class: com.facebook.appevents.iap.InAppPurchaseAutoLogger$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
InAppPurchaseAutoLogger.m500startIapLogging$lambda0();
}
});
} else {
orCreateInstance.queryPurchase("inapp", new Runnable() { // from class: com.facebook.appevents.iap.InAppPurchaseAutoLogger$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
InAppPurchaseAutoLogger.m501startIapLogging$lambda1();
}
});
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseAutoLogger.class);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: startIapLogging$lambda-0, reason: not valid java name */
public static final void m500startIapLogging$lambda0() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseAutoLogger.class)) {
return;
}
try {
INSTANCE.logPurchase();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseAutoLogger.class);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: startIapLogging$lambda-1, reason: not valid java name */
public static final void m501startIapLogging$lambda1() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseAutoLogger.class)) {
return;
}
try {
INSTANCE.logPurchase();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseAutoLogger.class);
}
}
private final void logPurchase() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
InAppPurchaseLoggerManager inAppPurchaseLoggerManager = InAppPurchaseLoggerManager.INSTANCE;
InAppPurchaseBillingClientWrapper.Companion companion = InAppPurchaseBillingClientWrapper.Companion;
InAppPurchaseLoggerManager.filterPurchaseLogging(companion.getPurchaseDetailsMap(), companion.getSkuDetailsMap());
companion.getPurchaseDetailsMap().clear();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
}

View File

@@ -0,0 +1,683 @@
package com.facebook.appevents.iap;
import android.content.Context;
import androidx.annotation.RestrictTo;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsJVMKt;
import org.json.JSONException;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class InAppPurchaseBillingClientWrapper {
private static final String CLASSNAME_BILLING_CLIENT = "com.android.billingclient.api.BillingClient";
private static final String CLASSNAME_BILLING_CLIENT_BUILDER = "com.android.billingclient.api.BillingClient$Builder";
private static final String CLASSNAME_BILLING_CLIENT_STATE_LISTENER = "com.android.billingclient.api.BillingClientStateListener";
private static final String CLASSNAME_PURCHASE = "com.android.billingclient.api.Purchase";
private static final String CLASSNAME_PURCHASES_RESULT = "com.android.billingclient.api.Purchase$PurchasesResult";
private static final String CLASSNAME_PURCHASE_HISTORY_RECORD = "com.android.billingclient.api.PurchaseHistoryRecord";
private static final String CLASSNAME_PURCHASE_HISTORY_RESPONSE_LISTENER = "com.android.billingclient.api.PurchaseHistoryResponseListener";
private static final String CLASSNAME_PURCHASE_UPDATED_LISTENER = "com.android.billingclient.api.PurchasesUpdatedListener";
private static final String CLASSNAME_SKU_DETAILS = "com.android.billingclient.api.SkuDetails";
private static final String CLASSNAME_SKU_DETAILS_RESPONSE_LISTENER = "com.android.billingclient.api.SkuDetailsResponseListener";
private static final String IN_APP = "inapp";
private static final String METHOD_BUILD = "build";
private static final String METHOD_ENABLE_PENDING_PURCHASES = "enablePendingPurchases";
private static final String METHOD_GET_ORIGINAL_JSON = "getOriginalJson";
private static final String METHOD_GET_PURCHASE_LIST = "getPurchasesList";
private static final String METHOD_NEW_BUILDER = "newBuilder";
private static final String METHOD_ON_BILLING_SERVICE_DISCONNECTED = "onBillingServiceDisconnected";
private static final String METHOD_ON_BILLING_SETUP_FINISHED = "onBillingSetupFinished";
private static final String METHOD_ON_PURCHASE_HISTORY_RESPONSE = "onPurchaseHistoryResponse";
private static final String METHOD_ON_SKU_DETAILS_RESPONSE = "onSkuDetailsResponse";
private static final String METHOD_QUERY_PURCHASES = "queryPurchases";
private static final String METHOD_QUERY_PURCHASE_HISTORY_ASYNC = "queryPurchaseHistoryAsync";
private static final String METHOD_QUERY_SKU_DETAILS_ASYNC = "querySkuDetailsAsync";
private static final String METHOD_SET_LISTENER = "setListener";
private static final String METHOD_START_CONNECTION = "startConnection";
private static final String PACKAGE_NAME = "packageName";
private static final String PRODUCT_ID = "productId";
private static InAppPurchaseBillingClientWrapper instance;
private final Object billingClient;
private final Class<?> billingClientClazz;
private final Context context;
private final Method getOriginalJsonMethod;
private final Method getOriginalJsonPurchaseHistoryMethod;
private final Method getOriginalJsonSkuMethod;
private final Method getPurchaseListMethod;
private final Set<String> historyPurchaseSet;
private final InAppPurchaseSkuDetailsWrapper inAppPurchaseSkuDetailsWrapper;
private final Class<?> purchaseClazz;
private final Class<?> purchaseHistoryRecordClazz;
private final Class<?> purchaseHistoryResponseListenerClazz;
private final Class<?> purchaseResultClazz;
private final Method queryPurchaseHistoryAsyncMethod;
private final Method queryPurchasesMethod;
private final Method querySkuDetailsAsyncMethod;
private final Class<?> skuDetailsClazz;
private final Class<?> skuDetailsResponseListenerClazz;
public static final Companion Companion = new Companion(null);
private static final AtomicBoolean initialized = new AtomicBoolean(false);
private static final AtomicBoolean isServiceConnected = new AtomicBoolean(false);
private static final Map<String, JSONObject> purchaseDetailsMap = new ConcurrentHashMap();
private static final Map<String, JSONObject> skuDetailsMap = new ConcurrentHashMap();
public /* synthetic */ InAppPurchaseBillingClientWrapper(Context context, Object obj, Class cls, Class cls2, Class cls3, Class cls4, Class cls5, Class cls6, Class cls7, Method method, Method method2, Method method3, Method method4, Method method5, Method method6, Method method7, InAppPurchaseSkuDetailsWrapper inAppPurchaseSkuDetailsWrapper, DefaultConstructorMarker defaultConstructorMarker) {
this(context, obj, cls, cls2, cls3, cls4, cls5, cls6, cls7, method, method2, method3, method4, method5, method6, method7, inAppPurchaseSkuDetailsWrapper);
}
public static final synchronized InAppPurchaseBillingClientWrapper getOrCreateInstance(Context context) {
synchronized (InAppPurchaseBillingClientWrapper.class) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return Companion.getOrCreateInstance(context);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
}
private InAppPurchaseBillingClientWrapper(Context context, Object obj, Class<?> cls, Class<?> cls2, Class<?> cls3, Class<?> cls4, Class<?> cls5, Class<?> cls6, Class<?> cls7, Method method, Method method2, Method method3, Method method4, Method method5, Method method6, Method method7, InAppPurchaseSkuDetailsWrapper inAppPurchaseSkuDetailsWrapper) {
this.context = context;
this.billingClient = obj;
this.billingClientClazz = cls;
this.purchaseResultClazz = cls2;
this.purchaseClazz = cls3;
this.skuDetailsClazz = cls4;
this.purchaseHistoryRecordClazz = cls5;
this.skuDetailsResponseListenerClazz = cls6;
this.purchaseHistoryResponseListenerClazz = cls7;
this.queryPurchasesMethod = method;
this.getPurchaseListMethod = method2;
this.getOriginalJsonMethod = method3;
this.getOriginalJsonSkuMethod = method4;
this.getOriginalJsonPurchaseHistoryMethod = method5;
this.querySkuDetailsAsyncMethod = method6;
this.queryPurchaseHistoryAsyncMethod = method7;
this.inAppPurchaseSkuDetailsWrapper = inAppPurchaseSkuDetailsWrapper;
this.historyPurchaseSet = new CopyOnWriteArraySet();
}
public static final /* synthetic */ Context access$getContext$p(InAppPurchaseBillingClientWrapper inAppPurchaseBillingClientWrapper) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return inAppPurchaseBillingClientWrapper.context;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ Method access$getGetOriginalJsonPurchaseHistoryMethod$p(InAppPurchaseBillingClientWrapper inAppPurchaseBillingClientWrapper) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return inAppPurchaseBillingClientWrapper.getOriginalJsonPurchaseHistoryMethod;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ Method access$getGetOriginalJsonSkuMethod$p(InAppPurchaseBillingClientWrapper inAppPurchaseBillingClientWrapper) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return inAppPurchaseBillingClientWrapper.getOriginalJsonSkuMethod;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ Set access$getHistoryPurchaseSet$p(InAppPurchaseBillingClientWrapper inAppPurchaseBillingClientWrapper) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return inAppPurchaseBillingClientWrapper.historyPurchaseSet;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ AtomicBoolean access$getInitialized$cp() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return initialized;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ InAppPurchaseBillingClientWrapper access$getInstance$cp() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return instance;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ Map access$getPurchaseDetailsMap$cp() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return purchaseDetailsMap;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ Class access$getPurchaseHistoryRecordClazz$p(InAppPurchaseBillingClientWrapper inAppPurchaseBillingClientWrapper) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return inAppPurchaseBillingClientWrapper.purchaseHistoryRecordClazz;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ Class access$getSkuDetailsClazz$p(InAppPurchaseBillingClientWrapper inAppPurchaseBillingClientWrapper) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return inAppPurchaseBillingClientWrapper.skuDetailsClazz;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ Map access$getSkuDetailsMap$cp() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return skuDetailsMap;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ AtomicBoolean access$isServiceConnected$cp() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return null;
}
try {
return isServiceConnected;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
return null;
}
}
public static final /* synthetic */ void access$setInstance$cp(InAppPurchaseBillingClientWrapper inAppPurchaseBillingClientWrapper) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return;
}
try {
instance = inAppPurchaseBillingClientWrapper;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
}
}
public static final /* synthetic */ void access$startConnection(InAppPurchaseBillingClientWrapper inAppPurchaseBillingClientWrapper) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return;
}
try {
inAppPurchaseBillingClientWrapper.startConnection();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
}
}
public final void queryPurchaseHistory(String skuType, final Runnable queryPurchaseHistoryRunnable) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(skuType, "skuType");
Intrinsics.checkNotNullParameter(queryPurchaseHistoryRunnable, "queryPurchaseHistoryRunnable");
queryPurchaseHistoryAsync(skuType, new Runnable() { // from class: com.facebook.appevents.iap.InAppPurchaseBillingClientWrapper$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
InAppPurchaseBillingClientWrapper.m503queryPurchaseHistory$lambda0(InAppPurchaseBillingClientWrapper.this, queryPurchaseHistoryRunnable);
}
});
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: queryPurchaseHistory$lambda-0, reason: not valid java name */
public static final void m503queryPurchaseHistory$lambda0(InAppPurchaseBillingClientWrapper this$0, Runnable queryPurchaseHistoryRunnable) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseBillingClientWrapper.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(queryPurchaseHistoryRunnable, "$queryPurchaseHistoryRunnable");
this$0.querySkuDetailsAsync("inapp", new ArrayList(this$0.historyPurchaseSet), queryPurchaseHistoryRunnable);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseBillingClientWrapper.class);
}
}
public final void queryPurchase(String skuType, Runnable querySkuRunnable) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(skuType, "skuType");
Intrinsics.checkNotNullParameter(querySkuRunnable, "querySkuRunnable");
InAppPurchaseUtils inAppPurchaseUtils = InAppPurchaseUtils.INSTANCE;
Object invokeMethod = InAppPurchaseUtils.invokeMethod(this.purchaseResultClazz, this.getPurchaseListMethod, InAppPurchaseUtils.invokeMethod(this.billingClientClazz, this.queryPurchasesMethod, this.billingClient, "inapp"), new Object[0]);
List list = invokeMethod instanceof List ? (List) invokeMethod : null;
if (list == null) {
return;
}
try {
ArrayList arrayList = new ArrayList();
for (Object obj : list) {
InAppPurchaseUtils inAppPurchaseUtils2 = InAppPurchaseUtils.INSTANCE;
Object invokeMethod2 = InAppPurchaseUtils.invokeMethod(this.purchaseClazz, this.getOriginalJsonMethod, obj, new Object[0]);
String str = invokeMethod2 instanceof String ? (String) invokeMethod2 : null;
if (str != null) {
JSONObject jSONObject = new JSONObject(str);
if (jSONObject.has("productId")) {
String skuID = jSONObject.getString("productId");
arrayList.add(skuID);
Map<String, JSONObject> map = purchaseDetailsMap;
Intrinsics.checkNotNullExpressionValue(skuID, "skuID");
map.put(skuID, jSONObject);
}
}
}
querySkuDetailsAsync(skuType, arrayList, querySkuRunnable);
} catch (JSONException unused) {
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final void querySkuDetailsAsync(String str, List<String> list, Runnable runnable) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Object newProxyInstance = Proxy.newProxyInstance(this.skuDetailsResponseListenerClazz.getClassLoader(), new Class[]{this.skuDetailsResponseListenerClazz}, new SkuDetailsResponseListenerWrapper(this, runnable));
Object skuDetailsParams = this.inAppPurchaseSkuDetailsWrapper.getSkuDetailsParams(str, list);
InAppPurchaseUtils inAppPurchaseUtils = InAppPurchaseUtils.INSTANCE;
InAppPurchaseUtils.invokeMethod(this.billingClientClazz, this.querySkuDetailsAsyncMethod, this.billingClient, skuDetailsParams, newProxyInstance);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final void queryPurchaseHistoryAsync(String str, Runnable runnable) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Object newProxyInstance = Proxy.newProxyInstance(this.purchaseHistoryResponseListenerClazz.getClassLoader(), new Class[]{this.purchaseHistoryResponseListenerClazz}, new PurchaseHistoryResponseListenerWrapper(this, runnable));
InAppPurchaseUtils inAppPurchaseUtils = InAppPurchaseUtils.INSTANCE;
InAppPurchaseUtils.invokeMethod(this.billingClientClazz, this.queryPurchaseHistoryAsyncMethod, this.billingClient, str, newProxyInstance);
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final void startConnection() {
Method method;
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Class<?> cls = InAppPurchaseUtils.getClass(CLASSNAME_BILLING_CLIENT_STATE_LISTENER);
if (cls == null || (method = InAppPurchaseUtils.getMethod(this.billingClientClazz, METHOD_START_CONNECTION, cls)) == null) {
return;
}
InAppPurchaseUtils.invokeMethod(this.billingClientClazz, method, this.billingClient, Proxy.newProxyInstance(cls.getClassLoader(), new Class[]{cls}, new BillingClientStateListenerWrapper()));
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public static final class BillingClientStateListenerWrapper implements InvocationHandler {
@Override // java.lang.reflect.InvocationHandler
public Object invoke(Object proxy, Method m, Object[] objArr) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(proxy, "proxy");
Intrinsics.checkNotNullParameter(m, "m");
if (Intrinsics.areEqual(m.getName(), InAppPurchaseBillingClientWrapper.METHOD_ON_BILLING_SETUP_FINISHED)) {
InAppPurchaseBillingClientWrapper.Companion.isServiceConnected().set(true);
} else {
String name = m.getName();
Intrinsics.checkNotNullExpressionValue(name, "m.name");
if (StringsKt__StringsJVMKt.endsWith$default(name, InAppPurchaseBillingClientWrapper.METHOD_ON_BILLING_SERVICE_DISCONNECTED, false, 2, null)) {
InAppPurchaseBillingClientWrapper.Companion.isServiceConnected().set(false);
}
}
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
}
public static final class PurchasesUpdatedListenerWrapper implements InvocationHandler {
@Override // java.lang.reflect.InvocationHandler
public Object invoke(Object proxy, Method m, Object[] objArr) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(proxy, "proxy");
Intrinsics.checkNotNullParameter(m, "m");
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
}
public final class PurchaseHistoryResponseListenerWrapper implements InvocationHandler {
private Runnable runnable;
final /* synthetic */ InAppPurchaseBillingClientWrapper this$0;
public PurchaseHistoryResponseListenerWrapper(InAppPurchaseBillingClientWrapper this$0, Runnable runnable) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(runnable, "runnable");
this.this$0 = this$0;
this.runnable = runnable;
}
public final Runnable getRunnable() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
return this.runnable;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public final void setRunnable(Runnable runnable) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(runnable, "<set-?>");
this.runnable = runnable;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
@Override // java.lang.reflect.InvocationHandler
public Object invoke(Object proxy, Method method, Object[] objArr) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(proxy, "proxy");
Intrinsics.checkNotNullParameter(method, "method");
if (Intrinsics.areEqual(method.getName(), InAppPurchaseBillingClientWrapper.METHOD_ON_PURCHASE_HISTORY_RESPONSE)) {
Object obj = objArr == null ? null : objArr[1];
if (obj != null && (obj instanceof List)) {
getPurchaseHistoryRecord((List) obj);
}
}
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
private final void getPurchaseHistoryRecord(List<?> list) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
for (Object obj : list) {
try {
InAppPurchaseUtils inAppPurchaseUtils = InAppPurchaseUtils.INSTANCE;
Object invokeMethod = InAppPurchaseUtils.invokeMethod(InAppPurchaseBillingClientWrapper.access$getPurchaseHistoryRecordClazz$p(this.this$0), InAppPurchaseBillingClientWrapper.access$getGetOriginalJsonPurchaseHistoryMethod$p(this.this$0), obj, new Object[0]);
String str = invokeMethod instanceof String ? (String) invokeMethod : null;
if (str != null) {
JSONObject jSONObject = new JSONObject(str);
jSONObject.put("packageName", InAppPurchaseBillingClientWrapper.access$getContext$p(this.this$0).getPackageName());
if (jSONObject.has("productId")) {
String skuID = jSONObject.getString("productId");
InAppPurchaseBillingClientWrapper.access$getHistoryPurchaseSet$p(this.this$0).add(skuID);
Map<String, JSONObject> purchaseDetailsMap = InAppPurchaseBillingClientWrapper.Companion.getPurchaseDetailsMap();
Intrinsics.checkNotNullExpressionValue(skuID, "skuID");
purchaseDetailsMap.put(skuID, jSONObject);
}
}
} catch (Exception unused) {
}
}
this.runnable.run();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
}
public final class SkuDetailsResponseListenerWrapper implements InvocationHandler {
private Runnable runnable;
final /* synthetic */ InAppPurchaseBillingClientWrapper this$0;
public SkuDetailsResponseListenerWrapper(InAppPurchaseBillingClientWrapper this$0, Runnable runnable) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(runnable, "runnable");
this.this$0 = this$0;
this.runnable = runnable;
}
public final Runnable getRunnable() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
return this.runnable;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public final void setRunnable(Runnable runnable) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(runnable, "<set-?>");
this.runnable = runnable;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
@Override // java.lang.reflect.InvocationHandler
public Object invoke(Object proxy, Method m, Object[] objArr) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(proxy, "proxy");
Intrinsics.checkNotNullParameter(m, "m");
if (Intrinsics.areEqual(m.getName(), InAppPurchaseBillingClientWrapper.METHOD_ON_SKU_DETAILS_RESPONSE)) {
Object obj = objArr == null ? null : objArr[1];
if (obj != null && (obj instanceof List)) {
parseSkuDetails((List) obj);
}
}
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public final void parseSkuDetails(List<?> skuDetailsObjectList) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
Intrinsics.checkNotNullParameter(skuDetailsObjectList, "skuDetailsObjectList");
for (Object obj : skuDetailsObjectList) {
try {
InAppPurchaseUtils inAppPurchaseUtils = InAppPurchaseUtils.INSTANCE;
Object invokeMethod = InAppPurchaseUtils.invokeMethod(InAppPurchaseBillingClientWrapper.access$getSkuDetailsClazz$p(this.this$0), InAppPurchaseBillingClientWrapper.access$getGetOriginalJsonSkuMethod$p(this.this$0), obj, new Object[0]);
String str = invokeMethod instanceof String ? (String) invokeMethod : null;
if (str != null) {
JSONObject jSONObject = new JSONObject(str);
if (jSONObject.has("productId")) {
String skuID = jSONObject.getString("productId");
Map<String, JSONObject> skuDetailsMap = InAppPurchaseBillingClientWrapper.Companion.getSkuDetailsMap();
Intrinsics.checkNotNullExpressionValue(skuID, "skuID");
skuDetailsMap.put(skuID, jSONObject);
}
}
} catch (Exception unused) {
}
}
this.runnable.run();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final AtomicBoolean isServiceConnected() {
return InAppPurchaseBillingClientWrapper.access$isServiceConnected$cp();
}
public final Map<String, JSONObject> getPurchaseDetailsMap() {
return InAppPurchaseBillingClientWrapper.access$getPurchaseDetailsMap$cp();
}
public final Map<String, JSONObject> getSkuDetailsMap() {
return InAppPurchaseBillingClientWrapper.access$getSkuDetailsMap$cp();
}
public final synchronized InAppPurchaseBillingClientWrapper getOrCreateInstance(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
if (InAppPurchaseBillingClientWrapper.access$getInitialized$cp().get()) {
return InAppPurchaseBillingClientWrapper.access$getInstance$cp();
}
createInstance(context);
InAppPurchaseBillingClientWrapper.access$getInitialized$cp().set(true);
return InAppPurchaseBillingClientWrapper.access$getInstance$cp();
}
private final void createInstance(Context context) {
Object createBillingClient;
InAppPurchaseSkuDetailsWrapper orCreateInstance = InAppPurchaseSkuDetailsWrapper.Companion.getOrCreateInstance();
if (orCreateInstance == null) {
return;
}
Class<?> cls = InAppPurchaseUtils.getClass(InAppPurchaseBillingClientWrapper.CLASSNAME_BILLING_CLIENT);
Class<?> cls2 = InAppPurchaseUtils.getClass(InAppPurchaseBillingClientWrapper.CLASSNAME_PURCHASE);
Class<?> cls3 = InAppPurchaseUtils.getClass(InAppPurchaseBillingClientWrapper.CLASSNAME_PURCHASES_RESULT);
Class<?> cls4 = InAppPurchaseUtils.getClass(InAppPurchaseBillingClientWrapper.CLASSNAME_SKU_DETAILS);
Class<?> cls5 = InAppPurchaseUtils.getClass(InAppPurchaseBillingClientWrapper.CLASSNAME_PURCHASE_HISTORY_RECORD);
Class<?> cls6 = InAppPurchaseUtils.getClass(InAppPurchaseBillingClientWrapper.CLASSNAME_SKU_DETAILS_RESPONSE_LISTENER);
Class<?> cls7 = InAppPurchaseUtils.getClass(InAppPurchaseBillingClientWrapper.CLASSNAME_PURCHASE_HISTORY_RESPONSE_LISTENER);
if (cls == null || cls3 == null || cls2 == null || cls4 == null || cls6 == null || cls5 == null || cls7 == null) {
return;
}
Method method = InAppPurchaseUtils.getMethod(cls, InAppPurchaseBillingClientWrapper.METHOD_QUERY_PURCHASES, String.class);
Method method2 = InAppPurchaseUtils.getMethod(cls3, InAppPurchaseBillingClientWrapper.METHOD_GET_PURCHASE_LIST, new Class[0]);
Method method3 = InAppPurchaseUtils.getMethod(cls2, InAppPurchaseBillingClientWrapper.METHOD_GET_ORIGINAL_JSON, new Class[0]);
Method method4 = InAppPurchaseUtils.getMethod(cls4, InAppPurchaseBillingClientWrapper.METHOD_GET_ORIGINAL_JSON, new Class[0]);
Method method5 = InAppPurchaseUtils.getMethod(cls5, InAppPurchaseBillingClientWrapper.METHOD_GET_ORIGINAL_JSON, new Class[0]);
Method method6 = InAppPurchaseUtils.getMethod(cls, InAppPurchaseBillingClientWrapper.METHOD_QUERY_SKU_DETAILS_ASYNC, orCreateInstance.getSkuDetailsParamsClazz(), cls6);
Method method7 = InAppPurchaseUtils.getMethod(cls, InAppPurchaseBillingClientWrapper.METHOD_QUERY_PURCHASE_HISTORY_ASYNC, String.class, cls7);
if (method == null || method2 == null || method3 == null || method4 == null || method5 == null || method6 == null || method7 == null || (createBillingClient = createBillingClient(context, cls)) == null) {
return;
}
InAppPurchaseBillingClientWrapper.access$setInstance$cp(new InAppPurchaseBillingClientWrapper(context, createBillingClient, cls, cls3, cls2, cls4, cls5, cls6, cls7, method, method2, method3, method4, method5, method6, method7, orCreateInstance, null));
InAppPurchaseBillingClientWrapper access$getInstance$cp = InAppPurchaseBillingClientWrapper.access$getInstance$cp();
if (access$getInstance$cp == null) {
throw new NullPointerException("null cannot be cast to non-null type com.facebook.appevents.iap.InAppPurchaseBillingClientWrapper");
}
InAppPurchaseBillingClientWrapper.access$startConnection(access$getInstance$cp);
}
private final Object createBillingClient(Context context, Class<?> cls) {
Object invokeMethod;
Object invokeMethod2;
Object invokeMethod3;
Class<?> cls2 = InAppPurchaseUtils.getClass(InAppPurchaseBillingClientWrapper.CLASSNAME_BILLING_CLIENT_BUILDER);
Class<?> cls3 = InAppPurchaseUtils.getClass(InAppPurchaseBillingClientWrapper.CLASSNAME_PURCHASE_UPDATED_LISTENER);
if (cls2 == null || cls3 == null) {
return null;
}
Method method = InAppPurchaseUtils.getMethod(cls, InAppPurchaseBillingClientWrapper.METHOD_NEW_BUILDER, Context.class);
Method method2 = InAppPurchaseUtils.getMethod(cls2, InAppPurchaseBillingClientWrapper.METHOD_ENABLE_PENDING_PURCHASES, new Class[0]);
Method method3 = InAppPurchaseUtils.getMethod(cls2, InAppPurchaseBillingClientWrapper.METHOD_SET_LISTENER, cls3);
Method method4 = InAppPurchaseUtils.getMethod(cls2, InAppPurchaseBillingClientWrapper.METHOD_BUILD, new Class[0]);
if (method == null || method2 == null || method3 == null || method4 == null || (invokeMethod = InAppPurchaseUtils.invokeMethod(cls, method, null, context)) == null || (invokeMethod2 = InAppPurchaseUtils.invokeMethod(cls2, method3, invokeMethod, Proxy.newProxyInstance(cls3.getClassLoader(), new Class[]{cls3}, new PurchasesUpdatedListenerWrapper()))) == null || (invokeMethod3 = InAppPurchaseUtils.invokeMethod(cls2, method2, invokeMethod2, new Object[0])) == null) {
return null;
}
return InAppPurchaseUtils.invokeMethod(cls2, method4, invokeMethod3, new Object[0]);
}
}
}

View File

@@ -0,0 +1,559 @@
package com.facebook.appevents.iap;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.IBinder;
import androidx.annotation.RestrictTo;
import com.facebook.FacebookSdk;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import com.unity3d.ads.metadata.InAppPurchaseMetaData;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsKt;
import org.json.JSONException;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class InAppPurchaseEventManager {
private static final String AS_INTERFACE = "asInterface";
private static final int CACHE_CLEAR_TIME_LIMIT_SEC = 604800;
private static final String DETAILS_LIST = "DETAILS_LIST";
private static final String GET_PURCHASES = "getPurchases";
private static final String GET_PURCHASE_HISTORY = "getPurchaseHistory";
private static final String GET_SKU_DETAILS = "getSkuDetails";
private static final String INAPP = "inapp";
private static final String INAPP_CONTINUATION_TOKEN = "INAPP_CONTINUATION_TOKEN";
private static final String INAPP_PURCHASE_DATA_LIST = "INAPP_PURCHASE_DATA_LIST";
private static final String IN_APP_BILLING_SERVICE = "com.android.vending.billing.IInAppBillingService";
private static final String IN_APP_BILLING_SERVICE_STUB = "com.android.vending.billing.IInAppBillingService$Stub";
private static final String IS_BILLING_SUPPORTED = "isBillingSupported";
private static final String ITEM_ID_LIST = "ITEM_ID_LIST";
private static final String LAST_CLEARED_TIME = "LAST_CLEARED_TIME";
private static final int MAX_QUERY_PURCHASE_NUM = 30;
private static final int PURCHASE_EXPIRE_TIME_SEC = 86400;
private static final int PURCHASE_STOP_QUERY_TIME_SEC = 1200;
private static final String RESPONSE_CODE = "RESPONSE_CODE";
private static final int SKU_DETAIL_EXPIRE_TIME_SEC = 43200;
private static final String SUBSCRIPTION = "subs";
public static final InAppPurchaseEventManager INSTANCE = new InAppPurchaseEventManager();
private static final HashMap<String, Method> methodMap = new HashMap<>();
private static final HashMap<String, Class<?>> classMap = new HashMap<>();
private static final String PACKAGE_NAME = FacebookSdk.getApplicationContext().getPackageName();
private static final String SKU_DETAILS_STORE = "com.facebook.internal.SKU_DETAILS";
private static final SharedPreferences skuDetailSharedPrefs = FacebookSdk.getApplicationContext().getSharedPreferences(SKU_DETAILS_STORE, 0);
private static final String PURCHASE_INAPP_STORE = "com.facebook.internal.PURCHASE";
private static final SharedPreferences purchaseInappSharedPrefs = FacebookSdk.getApplicationContext().getSharedPreferences(PURCHASE_INAPP_STORE, 0);
private InAppPurchaseEventManager() {
}
public static final Object asInterface(Context context, IBinder iBinder) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseEventManager.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(context, "context");
return INSTANCE.invokeMethod(context, IN_APP_BILLING_SERVICE_STUB, AS_INTERFACE, null, new Object[]{iBinder});
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseEventManager.class);
return null;
}
}
public static final Map<String, String> getSkuDetails(Context context, ArrayList<String> skuList, Object obj, boolean z) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseEventManager.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(skuList, "skuList");
Map<String, String> readSkuDetailsFromCache = INSTANCE.readSkuDetailsFromCache(skuList);
ArrayList<String> arrayList = new ArrayList<>();
Iterator<String> it = skuList.iterator();
while (it.hasNext()) {
String next = it.next();
if (!readSkuDetailsFromCache.containsKey(next)) {
arrayList.add(next);
}
}
readSkuDetailsFromCache.putAll(INSTANCE.getSkuDetailsFromGoogle(context, arrayList, obj, z));
return readSkuDetailsFromCache;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseEventManager.class);
return null;
}
}
private final Map<String, String> getSkuDetailsFromGoogle(Context context, ArrayList<String> arrayList, Object obj, boolean z) {
int size;
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Map<String, String> linkedHashMap = new LinkedHashMap<>();
if (obj != null && !arrayList.isEmpty()) {
Bundle bundle = new Bundle();
bundle.putStringArrayList("ITEM_ID_LIST", arrayList);
Object[] objArr = new Object[4];
int i = 0;
objArr[0] = 3;
objArr[1] = PACKAGE_NAME;
objArr[2] = z ? "subs" : "inapp";
objArr[3] = bundle;
Object invokeMethod = invokeMethod(context, IN_APP_BILLING_SERVICE, GET_SKU_DETAILS, obj, objArr);
if (invokeMethod != null) {
Bundle bundle2 = (Bundle) invokeMethod;
if (bundle2.getInt("RESPONSE_CODE") == 0) {
ArrayList<String> stringArrayList = bundle2.getStringArrayList("DETAILS_LIST");
if (stringArrayList != null && arrayList.size() == stringArrayList.size() && arrayList.size() - 1 >= 0) {
while (true) {
int i2 = i + 1;
String str = arrayList.get(i);
Intrinsics.checkNotNullExpressionValue(str, "skuList[i]");
String str2 = stringArrayList.get(i);
Intrinsics.checkNotNullExpressionValue(str2, "skuDetailsList[i]");
linkedHashMap.put(str, str2);
if (i2 > size) {
break;
}
i = i2;
}
}
writeSkuDetailsToCache(linkedHashMap);
}
}
}
return linkedHashMap;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
private final Map<String, String> readSkuDetailsFromCache(ArrayList<String> arrayList) {
List split$default;
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
LinkedHashMap linkedHashMap = new LinkedHashMap();
long currentTimeMillis = System.currentTimeMillis() / 1000;
Iterator<String> it = arrayList.iterator();
while (it.hasNext()) {
String sku = it.next();
String string = skuDetailSharedPrefs.getString(sku, null);
if (string != null) {
split$default = StringsKt__StringsKt.split$default((CharSequence) string, new String[]{";"}, false, 2, 2, (Object) null);
if (currentTimeMillis - Long.parseLong((String) split$default.get(0)) < 43200) {
Intrinsics.checkNotNullExpressionValue(sku, "sku");
linkedHashMap.put(sku, split$default.get(1));
}
}
}
return linkedHashMap;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
private final void writeSkuDetailsToCache(Map<String, String> map) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
long currentTimeMillis = System.currentTimeMillis() / 1000;
SharedPreferences.Editor edit = skuDetailSharedPrefs.edit();
for (Map.Entry<String, String> entry : map.entrySet()) {
edit.putString(entry.getKey(), currentTimeMillis + ';' + entry.getValue());
}
edit.apply();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
private final boolean isBillingSupported(Context context, Object obj, String str) {
if (CrashShieldHandler.isObjectCrashing(this) || obj == null) {
return false;
}
try {
Object invokeMethod = invokeMethod(context, IN_APP_BILLING_SERVICE, IS_BILLING_SUPPORTED, obj, new Object[]{3, PACKAGE_NAME, str});
if (invokeMethod != null) {
return ((Integer) invokeMethod).intValue() == 0;
}
return false;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
public static final ArrayList<String> getPurchasesInapp(Context context, Object obj) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseEventManager.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(context, "context");
InAppPurchaseEventManager inAppPurchaseEventManager = INSTANCE;
return inAppPurchaseEventManager.filterPurchases(inAppPurchaseEventManager.getPurchases(context, obj, "inapp"));
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseEventManager.class);
return null;
}
}
public static final ArrayList<String> getPurchasesSubs(Context context, Object obj) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseEventManager.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(context, "context");
InAppPurchaseEventManager inAppPurchaseEventManager = INSTANCE;
return inAppPurchaseEventManager.filterPurchases(inAppPurchaseEventManager.getPurchases(context, obj, "subs"));
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseEventManager.class);
return null;
}
}
/* JADX WARN: Removed duplicated region for block: B:21:0x0062 A[ADDED_TO_REGION] */
/* JADX WARN: Removed duplicated region for block: B:24:0x0064 A[EDGE_INSN: B:24:0x0064->B:28:0x0064 BREAK A[LOOP:0: B:12:0x0019->B:23:?], SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private final java.util.ArrayList<java.lang.String> getPurchases(android.content.Context r13, java.lang.Object r14, java.lang.String r15) {
/*
r12 = this;
boolean r0 = com.facebook.internal.instrument.crashshield.CrashShieldHandler.isObjectCrashing(r12)
r1 = 0
if (r0 == 0) goto L8
return r1
L8:
java.util.ArrayList r0 = new java.util.ArrayList // Catch: java.lang.Throwable -> L5b
r0.<init>() // Catch: java.lang.Throwable -> L5b
if (r14 != 0) goto L10
return r0
L10:
boolean r2 = r12.isBillingSupported(r13, r14, r15) // Catch: java.lang.Throwable -> L5b
if (r2 == 0) goto L64
r2 = 0
r3 = r1
r4 = r2
L19:
r5 = 4
java.lang.Object[] r11 = new java.lang.Object[r5] // Catch: java.lang.Throwable -> L5b
r5 = 3
java.lang.Integer r6 = java.lang.Integer.valueOf(r5) // Catch: java.lang.Throwable -> L5b
r11[r2] = r6 // Catch: java.lang.Throwable -> L5b
java.lang.String r6 = com.facebook.appevents.iap.InAppPurchaseEventManager.PACKAGE_NAME // Catch: java.lang.Throwable -> L5b
r7 = 1
r11[r7] = r6 // Catch: java.lang.Throwable -> L5b
r6 = 2
r11[r6] = r15 // Catch: java.lang.Throwable -> L5b
r11[r5] = r3 // Catch: java.lang.Throwable -> L5b
java.lang.String r8 = "com.android.vending.billing.IInAppBillingService"
java.lang.String r9 = "getPurchases"
r6 = r12
r7 = r13
r10 = r14
java.lang.Object r3 = r6.invokeMethod(r7, r8, r9, r10, r11) // Catch: java.lang.Throwable -> L5b
if (r3 == 0) goto L5d
android.os.Bundle r3 = (android.os.Bundle) r3 // Catch: java.lang.Throwable -> L5b
java.lang.String r5 = "RESPONSE_CODE"
int r5 = r3.getInt(r5) // Catch: java.lang.Throwable -> L5b
if (r5 != 0) goto L5d
java.lang.String r5 = "INAPP_PURCHASE_DATA_LIST"
java.util.ArrayList r5 = r3.getStringArrayList(r5) // Catch: java.lang.Throwable -> L5b
if (r5 == 0) goto L64
int r6 = r5.size() // Catch: java.lang.Throwable -> L5b
int r4 = r4 + r6
r0.addAll(r5) // Catch: java.lang.Throwable -> L5b
java.lang.String r5 = "INAPP_CONTINUATION_TOKEN"
java.lang.String r3 = r3.getString(r5) // Catch: java.lang.Throwable -> L5b
goto L5e
L5b:
r13 = move-exception
goto L65
L5d:
r3 = r1
L5e:
r5 = 30
if (r4 >= r5) goto L64
if (r3 != 0) goto L19
L64:
return r0
L65:
com.facebook.internal.instrument.crashshield.CrashShieldHandler.handleThrowable(r13, r12)
return r1
*/
throw new UnsupportedOperationException("Method not decompiled: com.facebook.appevents.iap.InAppPurchaseEventManager.getPurchases(android.content.Context, java.lang.Object, java.lang.String):java.util.ArrayList");
}
public final boolean hasFreeTrialPeirod(String skuDetail) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
Intrinsics.checkNotNullParameter(skuDetail, "skuDetail");
try {
String optString = new JSONObject(skuDetail).optString("freeTrialPeriod");
if (optString != null) {
return optString.length() > 0;
}
return false;
} catch (JSONException unused) {
return false;
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
public static final ArrayList<String> getPurchaseHistoryInapp(Context context, Object obj) {
InAppPurchaseEventManager inAppPurchaseEventManager;
Class<?> cls;
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseEventManager.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(context, "context");
ArrayList<String> arrayList = new ArrayList<>();
return (obj == null || (cls = (inAppPurchaseEventManager = INSTANCE).getClass(context, IN_APP_BILLING_SERVICE)) == null || inAppPurchaseEventManager.getMethod(cls, GET_PURCHASE_HISTORY) == null) ? arrayList : inAppPurchaseEventManager.filterPurchases(inAppPurchaseEventManager.getPurchaseHistory(context, obj, "inapp"));
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseEventManager.class);
return null;
}
}
private final ArrayList<String> getPurchaseHistory(Context context, Object obj, String str) {
ArrayList<String> stringArrayList;
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
ArrayList<String> arrayList = new ArrayList<>();
if (isBillingSupported(context, obj, str)) {
String str2 = null;
int i = 0;
boolean z = false;
do {
Object invokeMethod = invokeMethod(context, IN_APP_BILLING_SERVICE, GET_PURCHASE_HISTORY, obj, new Object[]{6, PACKAGE_NAME, str, str2, new Bundle()});
if (invokeMethod != null) {
long currentTimeMillis = System.currentTimeMillis() / 1000;
Bundle bundle = (Bundle) invokeMethod;
if (bundle.getInt("RESPONSE_CODE") == 0 && (stringArrayList = bundle.getStringArrayList("INAPP_PURCHASE_DATA_LIST")) != null) {
Iterator<String> it = stringArrayList.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
String next = it.next();
if (currentTimeMillis - (new JSONObject(next).getLong("purchaseTime") / 1000) > 1200) {
z = true;
break;
}
arrayList.add(next);
i++;
}
str2 = bundle.getString("INAPP_CONTINUATION_TOKEN");
if (i < 30 || str2 == null) {
break;
break;
}
}
}
str2 = null;
if (i < 30) {
break;
}
} while (!z);
}
return arrayList;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
private final ArrayList<String> filterPurchases(ArrayList<String> arrayList) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
ArrayList<String> arrayList2 = new ArrayList<>();
SharedPreferences.Editor edit = purchaseInappSharedPrefs.edit();
long currentTimeMillis = System.currentTimeMillis() / 1000;
Iterator<String> it = arrayList.iterator();
while (it.hasNext()) {
String next = it.next();
try {
JSONObject jSONObject = new JSONObject(next);
String string = jSONObject.getString(InAppPurchaseMetaData.KEY_PRODUCT_ID);
long j = jSONObject.getLong("purchaseTime");
String string2 = jSONObject.getString(SDKConstants.PARAM_PURCHASE_TOKEN);
if (currentTimeMillis - (j / 1000) <= 86400 && !Intrinsics.areEqual(purchaseInappSharedPrefs.getString(string, ""), string2)) {
edit.putString(string, string2);
arrayList2.add(next);
}
} catch (JSONException unused) {
}
}
edit.apply();
return arrayList2;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
private final Method getMethod(Class<?> cls, String str) {
Class[] clsArr;
Method declaredMethod$facebook_core_release;
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
HashMap<String, Method> hashMap = methodMap;
Method method = hashMap.get(str);
if (method != null) {
return method;
}
switch (str.hashCode()) {
case -1801122596:
if (str.equals(GET_PURCHASES)) {
Class TYPE = Integer.TYPE;
Intrinsics.checkNotNullExpressionValue(TYPE, "TYPE");
clsArr = new Class[]{TYPE, String.class, String.class, String.class};
break;
}
clsArr = null;
break;
case -1450694211:
if (!str.equals(IS_BILLING_SUPPORTED)) {
clsArr = null;
break;
} else {
Class TYPE2 = Integer.TYPE;
Intrinsics.checkNotNullExpressionValue(TYPE2, "TYPE");
clsArr = new Class[]{TYPE2, String.class, String.class};
break;
}
case -1123215065:
if (!str.equals(AS_INTERFACE)) {
clsArr = null;
break;
} else {
clsArr = new Class[]{IBinder.class};
break;
}
case -594356707:
if (!str.equals(GET_PURCHASE_HISTORY)) {
clsArr = null;
break;
} else {
Class TYPE3 = Integer.TYPE;
Intrinsics.checkNotNullExpressionValue(TYPE3, "TYPE");
clsArr = new Class[]{TYPE3, String.class, String.class, String.class, Bundle.class};
break;
}
case -573310373:
if (!str.equals(GET_SKU_DETAILS)) {
clsArr = null;
break;
} else {
Class TYPE4 = Integer.TYPE;
Intrinsics.checkNotNullExpressionValue(TYPE4, "TYPE");
clsArr = new Class[]{TYPE4, String.class, String.class, Bundle.class};
break;
}
default:
clsArr = null;
break;
}
if (clsArr == null) {
declaredMethod$facebook_core_release = InAppPurchaseUtils.getDeclaredMethod$facebook_core_release(cls, str, null);
} else {
InAppPurchaseUtils inAppPurchaseUtils = InAppPurchaseUtils.INSTANCE;
declaredMethod$facebook_core_release = InAppPurchaseUtils.getDeclaredMethod$facebook_core_release(cls, str, (Class[]) Arrays.copyOf(clsArr, clsArr.length));
}
if (declaredMethod$facebook_core_release != null) {
hashMap.put(str, declaredMethod$facebook_core_release);
}
return declaredMethod$facebook_core_release;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
private final Class<?> getClass(Context context, String str) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
HashMap<String, Class<?>> hashMap = classMap;
Class<?> cls = hashMap.get(str);
if (cls != null) {
return cls;
}
Class<?> classFromContext$facebook_core_release = InAppPurchaseUtils.getClassFromContext$facebook_core_release(context, str);
if (classFromContext$facebook_core_release != null) {
hashMap.put(str, classFromContext$facebook_core_release);
}
return classFromContext$facebook_core_release;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
private final Object invokeMethod(Context context, String str, String str2, Object obj, Object[] objArr) {
Method method;
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Class<?> cls = getClass(context, str);
if (cls == null || (method = getMethod(cls, str2)) == null) {
return null;
}
InAppPurchaseUtils inAppPurchaseUtils = InAppPurchaseUtils.INSTANCE;
return InAppPurchaseUtils.invokeMethod(cls, method, obj, Arrays.copyOf(objArr, objArr.length));
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public static final void clearSkuDetailsCache() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseEventManager.class)) {
return;
}
try {
long currentTimeMillis = System.currentTimeMillis() / 1000;
SharedPreferences sharedPreferences = skuDetailSharedPrefs;
long j = sharedPreferences.getLong(LAST_CLEARED_TIME, 0L);
if (j == 0) {
sharedPreferences.edit().putLong(LAST_CLEARED_TIME, currentTimeMillis).apply();
} else if (currentTimeMillis - j > CACHE_CLEAR_TIME_LIMIT_SEC) {
sharedPreferences.edit().clear().putLong(LAST_CLEARED_TIME, currentTimeMillis).apply();
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseEventManager.class);
}
}
}

View File

@@ -0,0 +1,265 @@
package com.facebook.appevents.iap;
import android.content.SharedPreferences;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import com.facebook.FacebookSdk;
import com.facebook.appevents.internal.AutomaticAnalyticsLogger;
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import kotlin.collections.MapsKt__MapsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsKt;
import org.json.JSONObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class InAppPurchaseLoggerManager {
private static final int CACHE_CLEAR_TIME_LIMIT_SEC = 604800;
private static final String LAST_CLEARED_TIME = "LAST_CLEARED_TIME";
private static final String LAST_QUERY_PURCHASE_HISTORY_TIME = "LAST_QUERY_PURCHASE_HISTORY_TIME";
private static final String PRODUCT_DETAILS_STORE = "com.facebook.internal.iap.PRODUCT_DETAILS";
private static final String PURCHASE_DETAILS_SET = "PURCHASE_DETAILS_SET";
private static final int PURCHASE_IN_CACHE_INTERVAL = 86400;
private static final String PURCHASE_TIME = "purchaseTime";
private static SharedPreferences sharedPreferences;
public static final InAppPurchaseLoggerManager INSTANCE = new InAppPurchaseLoggerManager();
private static final Set<String> cachedPurchaseSet = new CopyOnWriteArraySet();
private static final Map<String, Long> cachedPurchaseMap = new ConcurrentHashMap();
private InAppPurchaseLoggerManager() {
}
/* JADX WARN: Multi-variable type inference failed */
private final void readPurchaseCache() {
List split$default;
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
SharedPreferences sharedPreferences2 = FacebookSdk.getApplicationContext().getSharedPreferences("com.facebook.internal.SKU_DETAILS", 0);
SharedPreferences sharedPreferences3 = FacebookSdk.getApplicationContext().getSharedPreferences("com.facebook.internal.PURCHASE", 0);
if (sharedPreferences2.contains(LAST_CLEARED_TIME)) {
sharedPreferences2.edit().clear().apply();
sharedPreferences3.edit().clear().apply();
}
SharedPreferences sharedPreferences4 = FacebookSdk.getApplicationContext().getSharedPreferences(PRODUCT_DETAILS_STORE, 0);
Intrinsics.checkNotNullExpressionValue(sharedPreferences4, "getApplicationContext().getSharedPreferences(PRODUCT_DETAILS_STORE, Context.MODE_PRIVATE)");
sharedPreferences = sharedPreferences4;
Set<String> set = cachedPurchaseSet;
if (sharedPreferences4 != null) {
Set<String> stringSet = sharedPreferences4.getStringSet(PURCHASE_DETAILS_SET, new HashSet());
if (stringSet == null) {
stringSet = new HashSet<>();
}
set.addAll(stringSet);
Iterator<String> it = set.iterator();
while (it.hasNext()) {
split$default = StringsKt__StringsKt.split$default((CharSequence) it.next(), new String[]{";"}, false, 2, 2, (Object) null);
cachedPurchaseMap.put(split$default.get(0), Long.valueOf(Long.parseLong((String) split$default.get(1))));
}
clearOutdatedProductInfoInCache$facebook_core_release();
return;
}
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
throw null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public static final void filterPurchaseLogging(Map<String, JSONObject> purchaseDetailsMap, Map<String, ? extends JSONObject> skuDetailsMap) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseLoggerManager.class)) {
return;
}
try {
Intrinsics.checkNotNullParameter(purchaseDetailsMap, "purchaseDetailsMap");
Intrinsics.checkNotNullParameter(skuDetailsMap, "skuDetailsMap");
InAppPurchaseLoggerManager inAppPurchaseLoggerManager = INSTANCE;
inAppPurchaseLoggerManager.readPurchaseCache();
inAppPurchaseLoggerManager.logPurchases(inAppPurchaseLoggerManager.constructLoggingReadyMap$facebook_core_release(inAppPurchaseLoggerManager.cacheDeDupPurchase$facebook_core_release(purchaseDetailsMap), skuDetailsMap));
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseLoggerManager.class);
}
}
private final void logPurchases(Map<String, String> map) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (key != null && value != null) {
AutomaticAnalyticsLogger.logPurchase(key, value, false);
}
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
@VisibleForTesting(otherwise = 2)
public final Map<String, JSONObject> cacheDeDupPurchase$facebook_core_release(Map<String, JSONObject> purchaseDetailsMap) {
Map map;
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(purchaseDetailsMap, "purchaseDetailsMap");
long currentTimeMillis = System.currentTimeMillis() / 1000;
map = MapsKt__MapsKt.toMap(purchaseDetailsMap);
for (Map.Entry entry : map.entrySet()) {
String str = (String) entry.getKey();
JSONObject jSONObject = (JSONObject) entry.getValue();
try {
if (jSONObject.has(SDKConstants.PARAM_PURCHASE_TOKEN)) {
String string = jSONObject.getString(SDKConstants.PARAM_PURCHASE_TOKEN);
if (cachedPurchaseMap.containsKey(string)) {
purchaseDetailsMap.remove(str);
} else {
Set<String> set = cachedPurchaseSet;
StringBuilder sb = new StringBuilder();
sb.append((Object) string);
sb.append(';');
sb.append(currentTimeMillis);
set.add(sb.toString());
}
}
} catch (Exception unused) {
}
}
SharedPreferences sharedPreferences2 = sharedPreferences;
if (sharedPreferences2 != null) {
sharedPreferences2.edit().putStringSet(PURCHASE_DETAILS_SET, cachedPurchaseSet).apply();
return new HashMap(purchaseDetailsMap);
}
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
throw null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
@VisibleForTesting(otherwise = 2)
public final void clearOutdatedProductInfoInCache$facebook_core_release() {
Map map;
if (CrashShieldHandler.isObjectCrashing(this)) {
return;
}
try {
long currentTimeMillis = System.currentTimeMillis() / 1000;
SharedPreferences sharedPreferences2 = sharedPreferences;
if (sharedPreferences2 != null) {
long j = sharedPreferences2.getLong(LAST_CLEARED_TIME, 0L);
if (j == 0) {
SharedPreferences sharedPreferences3 = sharedPreferences;
if (sharedPreferences3 != null) {
sharedPreferences3.edit().putLong(LAST_CLEARED_TIME, currentTimeMillis).apply();
return;
} else {
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
throw null;
}
}
if (currentTimeMillis - j > 604800) {
map = MapsKt__MapsKt.toMap(cachedPurchaseMap);
for (Map.Entry entry : map.entrySet()) {
String str = (String) entry.getKey();
long longValue = ((Number) entry.getValue()).longValue();
if (currentTimeMillis - longValue > 86400) {
cachedPurchaseSet.remove(str + ';' + longValue);
cachedPurchaseMap.remove(str);
}
}
SharedPreferences sharedPreferences4 = sharedPreferences;
if (sharedPreferences4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
throw null;
}
sharedPreferences4.edit().putStringSet(PURCHASE_DETAILS_SET, cachedPurchaseSet).putLong(LAST_CLEARED_TIME, currentTimeMillis).apply();
return;
}
return;
}
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
throw null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
}
}
public static final boolean eligibleQueryPurchaseHistory() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseLoggerManager.class)) {
return false;
}
try {
INSTANCE.readPurchaseCache();
long currentTimeMillis = System.currentTimeMillis() / 1000;
SharedPreferences sharedPreferences2 = sharedPreferences;
if (sharedPreferences2 != null) {
long j = sharedPreferences2.getLong(LAST_QUERY_PURCHASE_HISTORY_TIME, 0L);
if (j != 0 && currentTimeMillis - j < PURCHASE_IN_CACHE_INTERVAL) {
return false;
}
SharedPreferences sharedPreferences3 = sharedPreferences;
if (sharedPreferences3 != null) {
sharedPreferences3.edit().putLong(LAST_QUERY_PURCHASE_HISTORY_TIME, currentTimeMillis).apply();
return true;
}
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
throw null;
}
Intrinsics.throwUninitializedPropertyAccessException("sharedPreferences");
throw null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseLoggerManager.class);
return false;
}
}
@VisibleForTesting(otherwise = 2)
public final Map<String, String> constructLoggingReadyMap$facebook_core_release(Map<String, ? extends JSONObject> purchaseDetailsMap, Map<String, ? extends JSONObject> skuDetailsMap) {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(purchaseDetailsMap, "purchaseDetailsMap");
Intrinsics.checkNotNullParameter(skuDetailsMap, "skuDetailsMap");
long currentTimeMillis = System.currentTimeMillis() / 1000;
LinkedHashMap linkedHashMap = new LinkedHashMap();
for (Map.Entry<String, ? extends JSONObject> entry : purchaseDetailsMap.entrySet()) {
String key = entry.getKey();
JSONObject value = entry.getValue();
JSONObject jSONObject = skuDetailsMap.get(key);
if (value != null && value.has(PURCHASE_TIME)) {
try {
if (currentTimeMillis - (value.getLong(PURCHASE_TIME) / 1000) <= 86400 && jSONObject != null) {
String jSONObject2 = value.toString();
Intrinsics.checkNotNullExpressionValue(jSONObject2, "purchaseDetail.toString()");
String jSONObject3 = jSONObject.toString();
Intrinsics.checkNotNullExpressionValue(jSONObject3, "skuDetail.toString()");
linkedHashMap.put(jSONObject2, jSONObject3);
}
} catch (Exception unused) {
}
}
}
return linkedHashMap;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
}

View File

@@ -0,0 +1,80 @@
package com.facebook.appevents.iap;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import androidx.annotation.RestrictTo;
import com.facebook.FacebookSdk;
import com.facebook.internal.FeatureManager;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import csdk.gluads.Consts;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsKt;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class InAppPurchaseManager {
private static final String GOOGLE_BILLINGCLIENT_VERSION = "com.google.android.play.billingclient.version";
public static final InAppPurchaseManager INSTANCE = new InAppPurchaseManager();
private static final AtomicBoolean enabled = new AtomicBoolean(false);
private InAppPurchaseManager() {
}
public static final void enableAutoLogging() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseManager.class)) {
return;
}
try {
enabled.set(true);
startTracking();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseManager.class);
}
}
public static final void startTracking() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseManager.class)) {
return;
}
try {
if (enabled.get()) {
if (INSTANCE.usingBillingLib2Plus()) {
FeatureManager featureManager = FeatureManager.INSTANCE;
if (FeatureManager.isEnabled(FeatureManager.Feature.IapLoggingLib2)) {
InAppPurchaseAutoLogger inAppPurchaseAutoLogger = InAppPurchaseAutoLogger.INSTANCE;
InAppPurchaseAutoLogger.startIapLogging(FacebookSdk.getApplicationContext());
return;
}
}
InAppPurchaseActivityLifecycleTracker.startIapLogging();
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseManager.class);
}
}
private final boolean usingBillingLib2Plus() {
List split$default;
if (CrashShieldHandler.isObjectCrashing(this)) {
return false;
}
try {
Context applicationContext = FacebookSdk.getApplicationContext();
ApplicationInfo applicationInfo = applicationContext.getPackageManager().getApplicationInfo(applicationContext.getPackageName(), 128);
Intrinsics.checkNotNullExpressionValue(applicationInfo, "context.packageManager.getApplicationInfo(\n context.packageName, PackageManager.GET_META_DATA)");
String string = applicationInfo.metaData.getString(GOOGLE_BILLINGCLIENT_VERSION);
if (string == null) {
return false;
}
split$default = StringsKt__StringsKt.split$default((CharSequence) string, new String[]{Consts.STRING_PERIOD}, false, 3, 2, (Object) null);
return Integer.parseInt((String) split$default.get(0)) >= 2;
} catch (Exception unused) {
return false;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return false;
}
}
}

View File

@@ -0,0 +1,156 @@
package com.facebook.appevents.iap;
import androidx.annotation.RestrictTo;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.lang.reflect.Method;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes2.dex */
public final class InAppPurchaseSkuDetailsWrapper {
private static final String CLASSNAME_SKU_DETAILS_PARAMS = "com.android.billingclient.api.SkuDetailsParams";
private static final String CLASSNAME_SKU_DETAILS_PARAMS_BUILDER = "com.android.billingclient.api.SkuDetailsParams$Builder";
private static final String METHOD_BUILD = "build";
private static final String METHOD_NEW_BUILDER = "newBuilder";
private static final String METHOD_SET_SKU_LIST = "setSkusList";
private static final String METHOD_SET_TYPE = "setType";
private static InAppPurchaseSkuDetailsWrapper instance;
private final Method buildMethod;
private final Class<?> builderClazz;
private final Method newBuilderMethod;
private final Method setSkusListMethod;
private final Method setTypeMethod;
private final Class<?> skuDetailsParamsClazz;
public static final Companion Companion = new Companion(null);
private static final AtomicBoolean initialized = new AtomicBoolean(false);
public static final InAppPurchaseSkuDetailsWrapper getOrCreateInstance() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseSkuDetailsWrapper.class)) {
return null;
}
try {
return Companion.getOrCreateInstance();
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseSkuDetailsWrapper.class);
return null;
}
}
public InAppPurchaseSkuDetailsWrapper(Class<?> skuDetailsParamsClazz, Class<?> builderClazz, Method newBuilderMethod, Method setTypeMethod, Method setSkusListMethod, Method buildMethod) {
Intrinsics.checkNotNullParameter(skuDetailsParamsClazz, "skuDetailsParamsClazz");
Intrinsics.checkNotNullParameter(builderClazz, "builderClazz");
Intrinsics.checkNotNullParameter(newBuilderMethod, "newBuilderMethod");
Intrinsics.checkNotNullParameter(setTypeMethod, "setTypeMethod");
Intrinsics.checkNotNullParameter(setSkusListMethod, "setSkusListMethod");
Intrinsics.checkNotNullParameter(buildMethod, "buildMethod");
this.skuDetailsParamsClazz = skuDetailsParamsClazz;
this.builderClazz = builderClazz;
this.newBuilderMethod = newBuilderMethod;
this.setTypeMethod = setTypeMethod;
this.setSkusListMethod = setSkusListMethod;
this.buildMethod = buildMethod;
}
public static final /* synthetic */ AtomicBoolean access$getInitialized$cp() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseSkuDetailsWrapper.class)) {
return null;
}
try {
return initialized;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseSkuDetailsWrapper.class);
return null;
}
}
public static final /* synthetic */ InAppPurchaseSkuDetailsWrapper access$getInstance$cp() {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseSkuDetailsWrapper.class)) {
return null;
}
try {
return instance;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseSkuDetailsWrapper.class);
return null;
}
}
public static final /* synthetic */ void access$setInstance$cp(InAppPurchaseSkuDetailsWrapper inAppPurchaseSkuDetailsWrapper) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseSkuDetailsWrapper.class)) {
return;
}
try {
instance = inAppPurchaseSkuDetailsWrapper;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseSkuDetailsWrapper.class);
}
}
public final Class<?> getSkuDetailsParamsClazz() {
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
return this.skuDetailsParamsClazz;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public final Object getSkuDetailsParams(String str, List<String> list) {
Object invokeMethod;
Object invokeMethod2;
if (CrashShieldHandler.isObjectCrashing(this)) {
return null;
}
try {
InAppPurchaseUtils inAppPurchaseUtils = InAppPurchaseUtils.INSTANCE;
Object invokeMethod3 = InAppPurchaseUtils.invokeMethod(this.skuDetailsParamsClazz, this.newBuilderMethod, null, new Object[0]);
if (invokeMethod3 != null && (invokeMethod = InAppPurchaseUtils.invokeMethod(this.builderClazz, this.setTypeMethod, invokeMethod3, str)) != null && (invokeMethod2 = InAppPurchaseUtils.invokeMethod(this.builderClazz, this.setSkusListMethod, invokeMethod, list)) != null) {
return InAppPurchaseUtils.invokeMethod(this.builderClazz, this.buildMethod, invokeMethod2, new Object[0]);
}
return null;
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, this);
return null;
}
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final InAppPurchaseSkuDetailsWrapper getOrCreateInstance() {
if (InAppPurchaseSkuDetailsWrapper.access$getInitialized$cp().get()) {
return InAppPurchaseSkuDetailsWrapper.access$getInstance$cp();
}
createInstance();
InAppPurchaseSkuDetailsWrapper.access$getInitialized$cp().set(true);
return InAppPurchaseSkuDetailsWrapper.access$getInstance$cp();
}
private final void createInstance() {
Class<?> cls = InAppPurchaseUtils.getClass(InAppPurchaseSkuDetailsWrapper.CLASSNAME_SKU_DETAILS_PARAMS);
Class<?> cls2 = InAppPurchaseUtils.getClass(InAppPurchaseSkuDetailsWrapper.CLASSNAME_SKU_DETAILS_PARAMS_BUILDER);
if (cls == null || cls2 == null) {
return;
}
Method method = InAppPurchaseUtils.getMethod(cls, InAppPurchaseSkuDetailsWrapper.METHOD_NEW_BUILDER, new Class[0]);
Method method2 = InAppPurchaseUtils.getMethod(cls2, InAppPurchaseSkuDetailsWrapper.METHOD_SET_TYPE, String.class);
Method method3 = InAppPurchaseUtils.getMethod(cls2, InAppPurchaseSkuDetailsWrapper.METHOD_SET_SKU_LIST, List.class);
Method method4 = InAppPurchaseUtils.getMethod(cls2, InAppPurchaseSkuDetailsWrapper.METHOD_BUILD, new Class[0]);
if (method == null || method2 == null || method3 == null || method4 == null) {
return;
}
InAppPurchaseSkuDetailsWrapper.access$setInstance$cp(new InAppPurchaseSkuDetailsWrapper(cls, cls2, method, method2, method3, method4));
}
}
}

View File

@@ -0,0 +1,111 @@
package com.facebook.appevents.iap;
import android.content.Context;
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class InAppPurchaseUtils {
public static final InAppPurchaseUtils INSTANCE = new InAppPurchaseUtils();
private InAppPurchaseUtils() {
}
public static final Class<?> getClass(String className) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseUtils.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(className, "className");
try {
return Class.forName(className);
} catch (ClassNotFoundException unused) {
return null;
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseUtils.class);
return null;
}
}
public static final Method getMethod(Class<?> clazz, String methodName, Class<?>... args) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseUtils.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(clazz, "clazz");
Intrinsics.checkNotNullParameter(methodName, "methodName");
Intrinsics.checkNotNullParameter(args, "args");
try {
return clazz.getMethod(methodName, (Class[]) Arrays.copyOf(args, args.length));
} catch (NoSuchMethodException unused) {
return null;
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseUtils.class);
return null;
}
}
public static final Method getDeclaredMethod$facebook_core_release(Class<?> clazz, String methodName, Class<?>... args) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseUtils.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(clazz, "clazz");
Intrinsics.checkNotNullParameter(methodName, "methodName");
Intrinsics.checkNotNullParameter(args, "args");
try {
return clazz.getDeclaredMethod(methodName, (Class[]) Arrays.copyOf(args, args.length));
} catch (NoSuchMethodException unused) {
return null;
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseUtils.class);
return null;
}
}
public static final Object invokeMethod(Class<?> clazz, Method method, Object obj, Object... args) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseUtils.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(clazz, "clazz");
Intrinsics.checkNotNullParameter(method, "method");
Intrinsics.checkNotNullParameter(args, "args");
if (obj != null) {
obj = clazz.cast(obj);
}
try {
return method.invoke(obj, Arrays.copyOf(args, args.length));
} catch (IllegalAccessException | InvocationTargetException unused) {
return null;
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseUtils.class);
return null;
}
}
public static final Class<?> getClassFromContext$facebook_core_release(Context context, String className) {
if (CrashShieldHandler.isObjectCrashing(InAppPurchaseUtils.class)) {
return null;
}
try {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(className, "className");
try {
return context.getClassLoader().loadClass(className);
} catch (ClassNotFoundException unused) {
return null;
}
} catch (Throwable th) {
CrashShieldHandler.handleThrowable(th, InAppPurchaseUtils.class);
return null;
}
}
}