- 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
216 lines
9.1 KiB
Java
216 lines
9.1 KiB
Java
package com.glu.plugins.gluanalytics;
|
|
|
|
import android.content.Context;
|
|
import android.os.Bundle;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import com.fyber.inneractive.sdk.external.InneractiveMediationDefs;
|
|
import com.glu.plugins.gluanalytics.util.CollectionUtil;
|
|
import com.glu.plugins.gluanalytics.util.ConfigUtil;
|
|
import com.glu.plugins.gluanalytics.util.IAction;
|
|
import com.glu.plugins.gluanalytics.util.YLogger;
|
|
import com.google.android.gms.tasks.OnCompleteListener;
|
|
import com.google.android.gms.tasks.Task;
|
|
import com.google.firebase.FirebaseApp;
|
|
import com.google.firebase.FirebaseOptions;
|
|
import com.google.firebase.analytics.FirebaseAnalytics;
|
|
import com.google.firebase.messaging.FirebaseMessaging;
|
|
import java.util.ArrayDeque;
|
|
import java.util.Map;
|
|
import java.util.Queue;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class GluFirebase {
|
|
private static boolean FIRAppHasBeenConfigured = false;
|
|
private static final String FIREBASE_PATH_PREFIX = "csdk.gluAnalytics.firebase.";
|
|
private IAnalyticsCallback mAnalyticsCallback;
|
|
private Context mContext;
|
|
private FirebaseAnalytics mFirebaseAnalytics;
|
|
private boolean mSendRevID;
|
|
private final YLogger mLog = YLogger.create(getClass());
|
|
private boolean mFirebaseInitialized = false;
|
|
private boolean mFirebaseEnabled = false;
|
|
private boolean mDisableTrackRevenue = false;
|
|
private boolean mUnderAgeUser = false;
|
|
private final Queue<IAction> mQueue = new ArrayDeque();
|
|
|
|
public void updateUnderAgeUserStatus(boolean z) {
|
|
this.mUnderAgeUser = z;
|
|
}
|
|
|
|
public GluFirebase(Context context) {
|
|
this.mContext = context;
|
|
}
|
|
|
|
public void initialize(@Nullable Map<String, Object> map, IAnalyticsCallback iAnalyticsCallback) {
|
|
this.mAnalyticsCallback = iAnalyticsCallback;
|
|
boolean z = !ConfigUtil.getBoolean(map, "csdk.gluAnalytics.disabled.firebase", false);
|
|
this.mFirebaseEnabled = z;
|
|
this.mLog.i("FirebaseApp", "Enabled", Boolean.valueOf(z));
|
|
boolean z2 = ConfigUtil.getBoolean(map, "csdk.gluAnalytics.firebase.skipInit", true);
|
|
this.mDisableTrackRevenue = ConfigUtil.getBoolean(map, "csdk.gluAnalytics.firebase.disableTrackRevenueEvent", true);
|
|
this.mSendRevID = ConfigUtil.getBoolean(map, "csdk.gluAnalytics.firebase.sendRevID", true);
|
|
if (this.mFirebaseEnabled && z2) {
|
|
try {
|
|
this.mLog.i("FirebaseApp", "initializeApp", FirebaseApp.getInstance().getName(), InneractiveMediationDefs.GENDER_MALE, "Firebase initialized outside GluAnalytics SDK");
|
|
} catch (Throwable th) {
|
|
this.mLog.i("FirebaseApp", "Throwable", th.getMessage());
|
|
}
|
|
}
|
|
if (this.mFirebaseEnabled && !FIRAppHasBeenConfigured && !z2) {
|
|
try {
|
|
FirebaseOptions.Builder builder = new FirebaseOptions.Builder();
|
|
builder.setApplicationId(ConfigUtil.getString(map, "csdk.gluAnalytics.firebase.googleAppID", null));
|
|
builder.setApiKey(ConfigUtil.getString(map, "csdk.gluAnalytics.firebase.APIKey", null));
|
|
builder.setDatabaseUrl(ConfigUtil.getString(map, "csdk.gluAnalytics.firebase.databaseURL", null));
|
|
builder.setStorageBucket(ConfigUtil.getString(map, "csdk.gluAnalytics.firebase.storageBucket", null));
|
|
builder.setGcmSenderId(ConfigUtil.getString(map, "csdk.gluAnalytics.firebase.GCMSenderID", null));
|
|
builder.setProjectId(ConfigUtil.getString(map, "csdk.gluAnalytics.firebase.projectID", null));
|
|
FirebaseApp.initializeApp(this.mContext, builder.build());
|
|
FIRAppHasBeenConfigured = true;
|
|
this.mLog.i("FirebaseApp", "initializeApp", FirebaseApp.getInstance().getName());
|
|
} catch (Throwable th2) {
|
|
this.mLog.i("FirebaseApp", "Throwable", th2.getMessage());
|
|
}
|
|
}
|
|
try {
|
|
this.mFirebaseAnalytics = FirebaseApp.getInstance() != null ? FirebaseAnalytics.getInstance(this.mContext) : null;
|
|
} catch (Throwable th3) {
|
|
this.mLog.i("FirebaseApp", "Throwable", th3.getMessage());
|
|
}
|
|
this.mFirebaseInitialized = true;
|
|
flushCachedQueue();
|
|
if (this.mFirebaseEnabled) {
|
|
fetchDeviceToken();
|
|
}
|
|
}
|
|
|
|
private void flushCachedQueue() {
|
|
IAction peek;
|
|
boolean z = true;
|
|
while (true) {
|
|
synchronized (this) {
|
|
if (!z) {
|
|
try {
|
|
this.mQueue.poll();
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
if (this.mQueue.isEmpty()) {
|
|
return;
|
|
} else {
|
|
peek = this.mQueue.peek();
|
|
}
|
|
}
|
|
peek.apply();
|
|
z = false;
|
|
}
|
|
}
|
|
|
|
private Bundle getEventExtrasSkipKey(Map<String, Object> map, String str) {
|
|
Bundle bundle = new Bundle();
|
|
if (map != null) {
|
|
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
|
String key = entry.getKey();
|
|
if (key != str) {
|
|
Object value = entry.getValue();
|
|
if (value instanceof String) {
|
|
bundle.putString(key, (String) value);
|
|
} else if (value instanceof Long) {
|
|
bundle.putLong(key, ((Long) value).longValue());
|
|
} else if (value instanceof Double) {
|
|
bundle.putDouble(key, ((Double) value).doubleValue());
|
|
} else if (value instanceof Boolean) {
|
|
bundle.putBoolean(key, ((Boolean) value).booleanValue());
|
|
} else {
|
|
this.mLog.e("getEventExtrasSkipKey", "Unknonwn value type.");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return bundle;
|
|
}
|
|
|
|
public void logEvent(final String str, Map<String, Object> map) {
|
|
if (this.mFirebaseInitialized) {
|
|
internal_logEvent(str, map);
|
|
return;
|
|
}
|
|
synchronized (this) {
|
|
final Map shallowClone = CollectionUtil.shallowClone(map);
|
|
this.mQueue.add(new IAction() { // from class: com.glu.plugins.gluanalytics.GluFirebase.1
|
|
@Override // com.glu.plugins.gluanalytics.util.IAction
|
|
public void apply() {
|
|
GluFirebase.this.internal_logEvent(str, shallowClone);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
public void allowPersonalizedAds(final boolean z) {
|
|
if (this.mFirebaseInitialized) {
|
|
internal_allowPersonalizedAds(z);
|
|
} else {
|
|
synchronized (this) {
|
|
this.mQueue.add(new IAction() { // from class: com.glu.plugins.gluanalytics.GluFirebase.2
|
|
@Override // com.glu.plugins.gluanalytics.util.IAction
|
|
public void apply() {
|
|
GluFirebase.this.internal_allowPersonalizedAds(z);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
public void internal_logEvent(String str, Map<String, Object> map) {
|
|
if (!this.mFirebaseEnabled || this.mFirebaseAnalytics == null || this.mUnderAgeUser) {
|
|
return;
|
|
}
|
|
if (this.mDisableTrackRevenue && str.equals("trackRevenue")) {
|
|
return;
|
|
}
|
|
this.mFirebaseAnalytics.logEvent(str, getEventExtrasSkipKey(map, str));
|
|
}
|
|
|
|
public void internal_allowPersonalizedAds(boolean z) {
|
|
FirebaseAnalytics firebaseAnalytics;
|
|
if (!this.mFirebaseEnabled || (firebaseAnalytics = this.mFirebaseAnalytics) == null) {
|
|
return;
|
|
}
|
|
String str = z ? "true" : "false";
|
|
firebaseAnalytics.setUserProperty("allow_personalized_ads", str);
|
|
this.mLog.i("allowPersonalizedAds", "state", str);
|
|
}
|
|
|
|
public void internal_SetRevID(String str) {
|
|
if (this.mFirebaseEnabled && this.mSendRevID) {
|
|
if (!this.mUnderAgeUser) {
|
|
this.mFirebaseAnalytics.setUserId(str);
|
|
this.mLog.i("internalsetrevid", "revid", str);
|
|
} else {
|
|
this.mFirebaseAnalytics.setUserId("");
|
|
}
|
|
}
|
|
}
|
|
|
|
private void fetchDeviceToken() {
|
|
try {
|
|
if (FirebaseApp.getInstance() != null) {
|
|
FirebaseMessaging.getInstance().getToken().addOnCompleteListener(new OnCompleteListener<String>() { // from class: com.glu.plugins.gluanalytics.GluFirebase.3
|
|
@Override // com.google.android.gms.tasks.OnCompleteListener
|
|
public void onComplete(@NonNull Task<String> task) {
|
|
if (!task.isSuccessful()) {
|
|
GluFirebase.this.mLog.i("FirebaseApp", "Fetching FCM registration token failed", task.getException().getMessage());
|
|
} else {
|
|
GluFirebase.this.mAnalyticsCallback.setPushToken(task.getResult());
|
|
}
|
|
}
|
|
});
|
|
}
|
|
} catch (Exception e) {
|
|
this.mLog.i("FirebaseApp", "Throwable", e.getMessage());
|
|
}
|
|
}
|
|
}
|