- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
167 lines
9.0 KiB
Java
167 lines
9.0 KiB
Java
package com.facebook.appevents.internal;
|
|
|
|
import android.app.Application;
|
|
import android.content.Context;
|
|
import android.os.Bundle;
|
|
import android.util.Log;
|
|
import androidx.annotation.RestrictTo;
|
|
import com.facebook.FacebookSdk;
|
|
import com.facebook.appevents.AppEventsConstants;
|
|
import com.facebook.appevents.AppEventsLogger;
|
|
import com.facebook.appevents.InternalAppEventsLogger;
|
|
import com.facebook.appevents.iap.InAppPurchaseEventManager;
|
|
import com.facebook.gamingservices.cloudgaming.internal.SDKConstants;
|
|
import com.facebook.internal.FetchedAppGateKeepersManager;
|
|
import com.facebook.internal.FetchedAppSettings;
|
|
import com.facebook.internal.FetchedAppSettingsManager;
|
|
import com.firemonkeys.cloudcellapi.Consts;
|
|
import com.unity3d.ads.core.domain.HandleInvocationsFromAdViewer;
|
|
import com.unity3d.ads.metadata.InAppPurchaseMetaData;
|
|
import java.math.BigDecimal;
|
|
import java.util.Currency;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
/* loaded from: classes2.dex */
|
|
public final class AutomaticAnalyticsLogger {
|
|
private static final String APP_EVENTS_IF_AUTO_LOG_SUBS = "app_events_if_auto_log_subs";
|
|
public static final AutomaticAnalyticsLogger INSTANCE = new AutomaticAnalyticsLogger();
|
|
private static final String TAG = AutomaticAnalyticsLogger.class.getCanonicalName();
|
|
private static final InternalAppEventsLogger internalAppEventsLogger = new InternalAppEventsLogger(FacebookSdk.getApplicationContext());
|
|
|
|
private AutomaticAnalyticsLogger() {
|
|
}
|
|
|
|
public static final void logActivateAppEvent() {
|
|
Context applicationContext = FacebookSdk.getApplicationContext();
|
|
String applicationId = FacebookSdk.getApplicationId();
|
|
if (FacebookSdk.getAutoLogAppEventsEnabled()) {
|
|
if (applicationContext instanceof Application) {
|
|
AppEventsLogger.Companion.activateApp((Application) applicationContext, applicationId);
|
|
} else {
|
|
Log.w(TAG, "Automatic logging of basic events will not happen, because FacebookSdk.getApplicationContext() returns object that is not instance of android.app.Application. Make sure you call FacebookSdk.sdkInitialize() from Application class and pass application context.");
|
|
}
|
|
}
|
|
}
|
|
|
|
public static final void logActivityTimeSpentEvent(String str, long j) {
|
|
Context applicationContext = FacebookSdk.getApplicationContext();
|
|
FetchedAppSettings queryAppSettings = FetchedAppSettingsManager.queryAppSettings(FacebookSdk.getApplicationId(), false);
|
|
if (queryAppSettings == null || !queryAppSettings.getAutomaticLoggingEnabled() || j <= 0) {
|
|
return;
|
|
}
|
|
InternalAppEventsLogger internalAppEventsLogger2 = new InternalAppEventsLogger(applicationContext);
|
|
Bundle bundle = new Bundle(1);
|
|
bundle.putCharSequence(Constants.AA_TIME_SPENT_SCREEN_PARAMETER_NAME, str);
|
|
internalAppEventsLogger2.logEvent(Constants.AA_TIME_SPENT_EVENT_NAME, j, bundle);
|
|
}
|
|
|
|
public static final void logPurchase(String purchase, String skuDetails, boolean z) {
|
|
PurchaseLoggingParameters purchaseLoggingParameters;
|
|
Intrinsics.checkNotNullParameter(purchase, "purchase");
|
|
Intrinsics.checkNotNullParameter(skuDetails, "skuDetails");
|
|
if (isImplicitPurchaseLoggingEnabled() && (purchaseLoggingParameters = INSTANCE.getPurchaseLoggingParameters(purchase, skuDetails)) != null) {
|
|
if (z) {
|
|
FetchedAppGateKeepersManager fetchedAppGateKeepersManager = FetchedAppGateKeepersManager.INSTANCE;
|
|
if (FetchedAppGateKeepersManager.getGateKeeperForKey(APP_EVENTS_IF_AUTO_LOG_SUBS, FacebookSdk.getApplicationId(), false)) {
|
|
internalAppEventsLogger.logEventImplicitly(InAppPurchaseEventManager.INSTANCE.hasFreeTrialPeirod(skuDetails) ? AppEventsConstants.EVENT_NAME_START_TRIAL : AppEventsConstants.EVENT_NAME_SUBSCRIBE, purchaseLoggingParameters.getPurchaseAmount(), purchaseLoggingParameters.getCurrency(), purchaseLoggingParameters.getParam());
|
|
return;
|
|
}
|
|
}
|
|
internalAppEventsLogger.logPurchaseImplicitly(purchaseLoggingParameters.getPurchaseAmount(), purchaseLoggingParameters.getCurrency(), purchaseLoggingParameters.getParam());
|
|
}
|
|
}
|
|
|
|
public static final boolean isImplicitPurchaseLoggingEnabled() {
|
|
FetchedAppSettings appSettingsWithoutQuery = FetchedAppSettingsManager.getAppSettingsWithoutQuery(FacebookSdk.getApplicationId());
|
|
return appSettingsWithoutQuery != null && FacebookSdk.getAutoLogAppEventsEnabled() && appSettingsWithoutQuery.getIAPAutomaticLoggingEnabled();
|
|
}
|
|
|
|
private final PurchaseLoggingParameters getPurchaseLoggingParameters(String str, String str2) {
|
|
return getPurchaseLoggingParameters(str, str2, new HashMap());
|
|
}
|
|
|
|
private final PurchaseLoggingParameters getPurchaseLoggingParameters(String str, String str2, Map<String, String> map) {
|
|
try {
|
|
JSONObject jSONObject = new JSONObject(str);
|
|
JSONObject jSONObject2 = new JSONObject(str2);
|
|
Bundle bundle = new Bundle(1);
|
|
bundle.putCharSequence(Constants.IAP_PRODUCT_ID, jSONObject.getString(InAppPurchaseMetaData.KEY_PRODUCT_ID));
|
|
bundle.putCharSequence(Constants.IAP_PURCHASE_TIME, jSONObject.getString("purchaseTime"));
|
|
bundle.putCharSequence(Constants.IAP_PURCHASE_TOKEN, jSONObject.getString(SDKConstants.PARAM_PURCHASE_TOKEN));
|
|
bundle.putCharSequence(Constants.IAP_PACKAGE_NAME, jSONObject.optString(HandleInvocationsFromAdViewer.KEY_PACKAGE_NAME));
|
|
bundle.putCharSequence(Constants.IAP_PRODUCT_TITLE, jSONObject2.optString("title"));
|
|
bundle.putCharSequence(Constants.IAP_PRODUCT_DESCRIPTION, jSONObject2.optString("description"));
|
|
String optString = jSONObject2.optString("type");
|
|
bundle.putCharSequence(Constants.IAP_PRODUCT_TYPE, optString);
|
|
if (Intrinsics.areEqual(optString, Consts.ITEM_TYPE_SUBSCRIPTION)) {
|
|
bundle.putCharSequence(Constants.IAP_SUBSCRIPTION_AUTORENEWING, Boolean.toString(jSONObject.optBoolean("autoRenewing", false)));
|
|
bundle.putCharSequence(Constants.IAP_SUBSCRIPTION_PERIOD, jSONObject2.optString("subscriptionPeriod"));
|
|
bundle.putCharSequence(Constants.IAP_FREE_TRIAL_PERIOD, jSONObject2.optString("freeTrialPeriod"));
|
|
String introductoryPriceCycles = jSONObject2.optString("introductoryPriceCycles");
|
|
Intrinsics.checkNotNullExpressionValue(introductoryPriceCycles, "introductoryPriceCycles");
|
|
if (introductoryPriceCycles.length() != 0) {
|
|
bundle.putCharSequence(Constants.IAP_INTRO_PRICE_AMOUNT_MICROS, jSONObject2.optString("introductoryPriceAmountMicros"));
|
|
bundle.putCharSequence(Constants.IAP_INTRO_PRICE_CYCLES, introductoryPriceCycles);
|
|
}
|
|
}
|
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
|
bundle.putCharSequence(entry.getKey(), entry.getValue());
|
|
}
|
|
BigDecimal bigDecimal = new BigDecimal(jSONObject2.getLong("price_amount_micros") / 1000000.0d);
|
|
Currency currency = Currency.getInstance(jSONObject2.getString("price_currency_code"));
|
|
Intrinsics.checkNotNullExpressionValue(currency, "getInstance(skuDetailsJSON.getString(\"price_currency_code\"))");
|
|
return new PurchaseLoggingParameters(bigDecimal, currency, bundle);
|
|
} catch (JSONException e) {
|
|
Log.e(TAG, "Error parsing in-app subscription data.", e);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static final class PurchaseLoggingParameters {
|
|
private Currency currency;
|
|
private Bundle param;
|
|
private BigDecimal purchaseAmount;
|
|
|
|
public final Currency getCurrency() {
|
|
return this.currency;
|
|
}
|
|
|
|
public final Bundle getParam() {
|
|
return this.param;
|
|
}
|
|
|
|
public final BigDecimal getPurchaseAmount() {
|
|
return this.purchaseAmount;
|
|
}
|
|
|
|
public final void setCurrency(Currency currency) {
|
|
Intrinsics.checkNotNullParameter(currency, "<set-?>");
|
|
this.currency = currency;
|
|
}
|
|
|
|
public final void setParam(Bundle bundle) {
|
|
Intrinsics.checkNotNullParameter(bundle, "<set-?>");
|
|
this.param = bundle;
|
|
}
|
|
|
|
public final void setPurchaseAmount(BigDecimal bigDecimal) {
|
|
Intrinsics.checkNotNullParameter(bigDecimal, "<set-?>");
|
|
this.purchaseAmount = bigDecimal;
|
|
}
|
|
|
|
public PurchaseLoggingParameters(BigDecimal purchaseAmount, Currency currency, Bundle param) {
|
|
Intrinsics.checkNotNullParameter(purchaseAmount, "purchaseAmount");
|
|
Intrinsics.checkNotNullParameter(currency, "currency");
|
|
Intrinsics.checkNotNullParameter(param, "param");
|
|
this.purchaseAmount = purchaseAmount;
|
|
this.currency = currency;
|
|
this.param = param;
|
|
}
|
|
}
|
|
}
|