what-the-bank/sources/com/google/firebase/analytics/connector/AnalyticsConnectorImpl.java

171 lines
7.4 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.google.firebase.analytics.connector;
import android.content.Context;
import android.os.Bundle;
import com.google.android.gms.common.internal.Preconditions;
import com.google.android.gms.internal.measurement.zzee;
import com.google.android.gms.measurement.AppMeasurement;
import com.google.android.gms.measurement.api.AppMeasurementSdk;
import com.google.firebase.DataCollectionDefaultChange;
import com.google.firebase.FirebaseApp;
import com.google.firebase.analytics.connector.AnalyticsConnector;
import com.google.firebase.analytics.connector.internal.zzc;
import com.google.firebase.analytics.connector.internal.zze;
import com.google.firebase.analytics.connector.internal.zzg;
import com.google.firebase.events.Event;
import com.google.firebase.events.EventHandler;
import com.google.firebase.events.Subscriber;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
/* loaded from: classes2.dex */
public class AnalyticsConnectorImpl implements AnalyticsConnector {
private static volatile AnalyticsConnector zzc;
final AppMeasurementSdk zza;
final Map<String, com.google.firebase.analytics.connector.internal.zza> zzb;
AnalyticsConnectorImpl(AppMeasurementSdk appMeasurementSdk) {
Preconditions.checkNotNull(appMeasurementSdk);
this.zza = appMeasurementSdk;
this.zzb = new ConcurrentHashMap();
}
/* JADX INFO: Access modifiers changed from: package-private */
public static /* synthetic */ void zza(Event event) {
boolean z = ((DataCollectionDefaultChange) event.getPayload()).enabled;
synchronized (AnalyticsConnectorImpl.class) {
((AnalyticsConnectorImpl) Preconditions.checkNotNull(zzc)).zza.zza(z);
}
}
/* JADX INFO: Access modifiers changed from: private */
public final boolean zzc(String str) {
return (str.isEmpty() || !this.zzb.containsKey(str) || this.zzb.get(str) == null) ? false : true;
}
@Override // com.google.firebase.analytics.connector.AnalyticsConnector
public void clearConditionalUserProperty(String str, String str2, Bundle bundle) {
if (str2 == null || zzc.zzj(str2, bundle)) {
this.zza.clearConditionalUserProperty(str, str2, bundle);
}
}
@Override // com.google.firebase.analytics.connector.AnalyticsConnector
public List<AnalyticsConnector.ConditionalUserProperty> getConditionalUserProperties(String str, String str2) {
ArrayList arrayList = new ArrayList();
Iterator<Bundle> it = this.zza.getConditionalUserProperties(str, str2).iterator();
while (it.hasNext()) {
arrayList.add(zzc.zzb(it.next()));
}
return arrayList;
}
@Override // com.google.firebase.analytics.connector.AnalyticsConnector
public int getMaxUserProperties(String str) {
return this.zza.getMaxUserProperties(str);
}
@Override // com.google.firebase.analytics.connector.AnalyticsConnector
public Map<String, Object> getUserProperties(boolean z) {
return this.zza.getUserProperties(null, null, z);
}
@Override // com.google.firebase.analytics.connector.AnalyticsConnector
public void logEvent(String str, String str2, Bundle bundle) {
if (bundle == null) {
bundle = new Bundle();
}
if (zzc.zzl(str) && zzc.zzj(str2, bundle) && zzc.zzh(str, str2, bundle)) {
zzc.zze(str, str2, bundle);
this.zza.logEvent(str, str2, bundle);
}
}
@Override // com.google.firebase.analytics.connector.AnalyticsConnector
public AnalyticsConnector.AnalyticsConnectorHandle registerAnalyticsConnectorListener(String str, AnalyticsConnector.AnalyticsConnectorListener analyticsConnectorListener) {
com.google.firebase.analytics.connector.internal.zza zzgVar;
Preconditions.checkNotNull(analyticsConnectorListener);
if (!zzc.zzl(str) || zzc(str)) {
return null;
}
AppMeasurementSdk appMeasurementSdk = this.zza;
if (AppMeasurement.FIAM_ORIGIN.equals(str)) {
zzgVar = new zze(appMeasurementSdk, analyticsConnectorListener);
} else {
zzgVar = ("crash".equals(str) || "clx".equals(str)) ? new zzg(appMeasurementSdk, analyticsConnectorListener) : null;
}
if (zzgVar == null) {
return null;
}
this.zzb.put(str, zzgVar);
return new AnalyticsConnector.AnalyticsConnectorHandle(this, str) { // from class: com.google.firebase.analytics.connector.AnalyticsConnectorImpl.1
final String zza;
final AnalyticsConnectorImpl zzb;
@Override // com.google.firebase.analytics.connector.AnalyticsConnector.AnalyticsConnectorHandle
public final void unregister() {
if (this.zzb.zzc(this.zza)) {
AnalyticsConnector.AnalyticsConnectorListener zza = this.zzb.zzb.get(this.zza).zza();
if (zza != null) {
zza.onMessageTriggered(0, null);
}
this.zzb.zzb.remove(this.zza);
}
}
{
this.zzb = this;
this.zza = str;
}
};
}
@Override // com.google.firebase.analytics.connector.AnalyticsConnector
public void setConditionalUserProperty(AnalyticsConnector.ConditionalUserProperty conditionalUserProperty) {
if (zzc.zzi(conditionalUserProperty)) {
this.zza.setConditionalUserProperty(zzc.zza(conditionalUserProperty));
}
}
@Override // com.google.firebase.analytics.connector.AnalyticsConnector
public void setUserProperty(String str, String str2, Object obj) {
if (zzc.zzl(str) && zzc.zzm(str, str2)) {
this.zza.setUserProperty(str, str2, obj);
}
}
public static AnalyticsConnector getInstance(FirebaseApp firebaseApp, Context context, Subscriber subscriber) {
Preconditions.checkNotNull(firebaseApp);
Preconditions.checkNotNull(context);
Preconditions.checkNotNull(subscriber);
Preconditions.checkNotNull(context.getApplicationContext());
if (zzc == null) {
synchronized (AnalyticsConnectorImpl.class) {
if (zzc == null) {
Bundle bundle = new Bundle(1);
if (firebaseApp.isDefaultApp()) {
subscriber.subscribe(DataCollectionDefaultChange.class, new Executor() { // from class: com.google.firebase.analytics.connector.zzb
@Override // java.util.concurrent.Executor
public final void execute(Runnable runnable) {
runnable.run();
}
}, new EventHandler() { // from class: com.google.firebase.analytics.connector.zza
@Override // com.google.firebase.events.EventHandler
public final void handle(Event event) {
AnalyticsConnectorImpl.zza(event);
}
});
bundle.putBoolean("dataCollectionDefaultEnabled", firebaseApp.isDataCollectionDefaultEnabled());
}
zzc = new AnalyticsConnectorImpl(zzee.zzg(context, null, null, null, bundle).zzd());
}
}
}
return zzc;
}
}