Files
rr3-apk/decompiled/sources/com/facebook/appevents/cloudbridge/AppEventsConversionsAPITransformer.java
Daniel Elliott f9d20bb3fc 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>
2026-02-18 14:52:23 -08:00

604 lines
36 KiB
Java

package com.facebook.appevents.cloudbridge;
import com.facebook.FacebookSdk;
import com.facebook.LoggingBehavior;
import com.facebook.appevents.AppEventsConstants;
import com.facebook.appevents.cloudbridge.AppEventType;
import com.facebook.internal.Logger;
import com.facebook.internal.Utility;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.ExceptionsKt__ExceptionsKt;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Pair;
import kotlin.TuplesKt;
import kotlin.Unit;
import kotlin.collections.CollectionsKt__CollectionsJVMKt;
import kotlin.collections.MapsKt__MapsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringNumberConversionsKt;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class AppEventsConversionsAPITransformer {
public static final AppEventsConversionsAPITransformer INSTANCE = new AppEventsConversionsAPITransformer();
public static final String TAG = "AppEventsConversionsAPITransformer";
public static final Map<CustomEventField, SectionCustomEventFieldMapping> customEventTransformations;
public static final Map<String, ConversionsAPIEventName> standardEventTransformations;
private static final Map<AppEventUserAndAppDataField, SectionFieldMapping> topLevelTransformations;
public /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
public static final /* synthetic */ int[] $EnumSwitchMapping$1;
public static final /* synthetic */ int[] $EnumSwitchMapping$2;
static {
int[] iArr = new int[ValueTransformationType.valuesCustom().length];
iArr[ValueTransformationType.ARRAY.ordinal()] = 1;
iArr[ValueTransformationType.BOOL.ordinal()] = 2;
iArr[ValueTransformationType.INT.ordinal()] = 3;
$EnumSwitchMapping$0 = iArr;
int[] iArr2 = new int[ConversionsAPISection.valuesCustom().length];
iArr2[ConversionsAPISection.APP_DATA.ordinal()] = 1;
iArr2[ConversionsAPISection.USER_DATA.ordinal()] = 2;
$EnumSwitchMapping$1 = iArr2;
int[] iArr3 = new int[AppEventType.valuesCustom().length];
iArr3[AppEventType.MOBILE_APP_INSTALL.ordinal()] = 1;
iArr3[AppEventType.CUSTOM.ordinal()] = 2;
$EnumSwitchMapping$2 = iArr3;
}
}
private AppEventsConversionsAPITransformer() {
}
public static final class SectionFieldMapping {
private ConversionsAPIUserAndAppDataField field;
private ConversionsAPISection section;
public static /* synthetic */ SectionFieldMapping copy$default(SectionFieldMapping sectionFieldMapping, ConversionsAPISection conversionsAPISection, ConversionsAPIUserAndAppDataField conversionsAPIUserAndAppDataField, int i, Object obj) {
if ((i & 1) != 0) {
conversionsAPISection = sectionFieldMapping.section;
}
if ((i & 2) != 0) {
conversionsAPIUserAndAppDataField = sectionFieldMapping.field;
}
return sectionFieldMapping.copy(conversionsAPISection, conversionsAPIUserAndAppDataField);
}
public final ConversionsAPISection component1() {
return this.section;
}
public final ConversionsAPIUserAndAppDataField component2() {
return this.field;
}
public final SectionFieldMapping copy(ConversionsAPISection section, ConversionsAPIUserAndAppDataField conversionsAPIUserAndAppDataField) {
Intrinsics.checkNotNullParameter(section, "section");
return new SectionFieldMapping(section, conversionsAPIUserAndAppDataField);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof SectionFieldMapping)) {
return false;
}
SectionFieldMapping sectionFieldMapping = (SectionFieldMapping) obj;
return this.section == sectionFieldMapping.section && this.field == sectionFieldMapping.field;
}
public final ConversionsAPIUserAndAppDataField getField() {
return this.field;
}
public final ConversionsAPISection getSection() {
return this.section;
}
public int hashCode() {
int hashCode = this.section.hashCode() * 31;
ConversionsAPIUserAndAppDataField conversionsAPIUserAndAppDataField = this.field;
return hashCode + (conversionsAPIUserAndAppDataField == null ? 0 : conversionsAPIUserAndAppDataField.hashCode());
}
public final void setField(ConversionsAPIUserAndAppDataField conversionsAPIUserAndAppDataField) {
this.field = conversionsAPIUserAndAppDataField;
}
public final void setSection(ConversionsAPISection conversionsAPISection) {
Intrinsics.checkNotNullParameter(conversionsAPISection, "<set-?>");
this.section = conversionsAPISection;
}
public String toString() {
return "SectionFieldMapping(section=" + this.section + ", field=" + this.field + ')';
}
public SectionFieldMapping(ConversionsAPISection section, ConversionsAPIUserAndAppDataField conversionsAPIUserAndAppDataField) {
Intrinsics.checkNotNullParameter(section, "section");
this.section = section;
this.field = conversionsAPIUserAndAppDataField;
}
}
static {
Map<AppEventUserAndAppDataField, SectionFieldMapping> mapOf;
Map<CustomEventField, SectionCustomEventFieldMapping> mapOf2;
Map<String, ConversionsAPIEventName> mapOf3;
AppEventUserAndAppDataField appEventUserAndAppDataField = AppEventUserAndAppDataField.ANON_ID;
ConversionsAPISection conversionsAPISection = ConversionsAPISection.USER_DATA;
Pair pair = TuplesKt.to(appEventUserAndAppDataField, new SectionFieldMapping(conversionsAPISection, ConversionsAPIUserAndAppDataField.ANON_ID));
Pair pair2 = TuplesKt.to(AppEventUserAndAppDataField.APP_USER_ID, new SectionFieldMapping(conversionsAPISection, ConversionsAPIUserAndAppDataField.FB_LOGIN_ID));
Pair pair3 = TuplesKt.to(AppEventUserAndAppDataField.ADVERTISER_ID, new SectionFieldMapping(conversionsAPISection, ConversionsAPIUserAndAppDataField.MAD_ID));
Pair pair4 = TuplesKt.to(AppEventUserAndAppDataField.PAGE_ID, new SectionFieldMapping(conversionsAPISection, ConversionsAPIUserAndAppDataField.PAGE_ID));
Pair pair5 = TuplesKt.to(AppEventUserAndAppDataField.PAGE_SCOPED_USER_ID, new SectionFieldMapping(conversionsAPISection, ConversionsAPIUserAndAppDataField.PAGE_SCOPED_USER_ID));
AppEventUserAndAppDataField appEventUserAndAppDataField2 = AppEventUserAndAppDataField.ADV_TE;
ConversionsAPISection conversionsAPISection2 = ConversionsAPISection.APP_DATA;
mapOf = MapsKt__MapsKt.mapOf(pair, pair2, pair3, pair4, pair5, TuplesKt.to(appEventUserAndAppDataField2, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.ADV_TE)), TuplesKt.to(AppEventUserAndAppDataField.APP_TE, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.APP_TE)), TuplesKt.to(AppEventUserAndAppDataField.CONSIDER_VIEWS, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.CONSIDER_VIEWS)), TuplesKt.to(AppEventUserAndAppDataField.DEVICE_TOKEN, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.DEVICE_TOKEN)), TuplesKt.to(AppEventUserAndAppDataField.EXT_INFO, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.EXT_INFO)), TuplesKt.to(AppEventUserAndAppDataField.INCLUDE_DWELL_DATA, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.INCLUDE_DWELL_DATA)), TuplesKt.to(AppEventUserAndAppDataField.INCLUDE_VIDEO_DATA, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.INCLUDE_VIDEO_DATA)), TuplesKt.to(AppEventUserAndAppDataField.INSTALL_REFERRER, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.INSTALL_REFERRER)), TuplesKt.to(AppEventUserAndAppDataField.INSTALLER_PACKAGE, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.INSTALLER_PACKAGE)), TuplesKt.to(AppEventUserAndAppDataField.RECEIPT_DATA, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.RECEIPT_DATA)), TuplesKt.to(AppEventUserAndAppDataField.URL_SCHEMES, new SectionFieldMapping(conversionsAPISection2, ConversionsAPIUserAndAppDataField.URL_SCHEMES)), TuplesKt.to(AppEventUserAndAppDataField.USER_DATA, new SectionFieldMapping(conversionsAPISection, null)));
topLevelTransformations = mapOf;
Pair pair6 = TuplesKt.to(CustomEventField.EVENT_TIME, new SectionCustomEventFieldMapping(null, ConversionsAPICustomEventField.EVENT_TIME));
Pair pair7 = TuplesKt.to(CustomEventField.EVENT_NAME, new SectionCustomEventFieldMapping(null, ConversionsAPICustomEventField.EVENT_NAME));
CustomEventField customEventField = CustomEventField.VALUE_TO_SUM;
ConversionsAPISection conversionsAPISection3 = ConversionsAPISection.CUSTOM_DATA;
mapOf2 = MapsKt__MapsKt.mapOf(pair6, pair7, TuplesKt.to(customEventField, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.VALUE_TO_SUM)), TuplesKt.to(CustomEventField.CONTENT_IDS, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.CONTENT_IDS)), TuplesKt.to(CustomEventField.CONTENTS, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.CONTENTS)), TuplesKt.to(CustomEventField.CONTENT_TYPE, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.CONTENT_TYPE)), TuplesKt.to(CustomEventField.CURRENCY, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.CURRENCY)), TuplesKt.to(CustomEventField.DESCRIPTION, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.DESCRIPTION)), TuplesKt.to(CustomEventField.LEVEL, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.LEVEL)), TuplesKt.to(CustomEventField.MAX_RATING_VALUE, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.MAX_RATING_VALUE)), TuplesKt.to(CustomEventField.NUM_ITEMS, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.NUM_ITEMS)), TuplesKt.to(CustomEventField.PAYMENT_INFO_AVAILABLE, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.PAYMENT_INFO_AVAILABLE)), TuplesKt.to(CustomEventField.REGISTRATION_METHOD, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.REGISTRATION_METHOD)), TuplesKt.to(CustomEventField.SEARCH_STRING, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.SEARCH_STRING)), TuplesKt.to(CustomEventField.SUCCESS, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.SUCCESS)), TuplesKt.to(CustomEventField.ORDER_ID, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.ORDER_ID)), TuplesKt.to(CustomEventField.AD_TYPE, new SectionCustomEventFieldMapping(conversionsAPISection3, ConversionsAPICustomEventField.AD_TYPE)));
customEventTransformations = mapOf2;
mapOf3 = MapsKt__MapsKt.mapOf(TuplesKt.to(AppEventsConstants.EVENT_NAME_UNLOCKED_ACHIEVEMENT, ConversionsAPIEventName.UNLOCKED_ACHIEVEMENT), TuplesKt.to(AppEventsConstants.EVENT_NAME_ACTIVATED_APP, ConversionsAPIEventName.ACTIVATED_APP), TuplesKt.to(AppEventsConstants.EVENT_NAME_ADDED_PAYMENT_INFO, ConversionsAPIEventName.ADDED_PAYMENT_INFO), TuplesKt.to(AppEventsConstants.EVENT_NAME_ADDED_TO_CART, ConversionsAPIEventName.ADDED_TO_CART), TuplesKt.to(AppEventsConstants.EVENT_NAME_ADDED_TO_WISHLIST, ConversionsAPIEventName.ADDED_TO_WISHLIST), TuplesKt.to(AppEventsConstants.EVENT_NAME_COMPLETED_REGISTRATION, ConversionsAPIEventName.COMPLETED_REGISTRATION), TuplesKt.to(AppEventsConstants.EVENT_NAME_VIEWED_CONTENT, ConversionsAPIEventName.VIEWED_CONTENT), TuplesKt.to(AppEventsConstants.EVENT_NAME_INITIATED_CHECKOUT, ConversionsAPIEventName.INITIATED_CHECKOUT), TuplesKt.to(AppEventsConstants.EVENT_NAME_ACHIEVED_LEVEL, ConversionsAPIEventName.ACHIEVED_LEVEL), TuplesKt.to(AppEventsConstants.EVENT_NAME_PURCHASED, ConversionsAPIEventName.PURCHASED), TuplesKt.to(AppEventsConstants.EVENT_NAME_RATED, ConversionsAPIEventName.RATED), TuplesKt.to(AppEventsConstants.EVENT_NAME_SEARCHED, ConversionsAPIEventName.SEARCHED), TuplesKt.to(AppEventsConstants.EVENT_NAME_SPENT_CREDITS, ConversionsAPIEventName.SPENT_CREDITS), TuplesKt.to(AppEventsConstants.EVENT_NAME_COMPLETED_TUTORIAL, ConversionsAPIEventName.COMPLETED_TUTORIAL));
standardEventTransformations = mapOf3;
}
public static final class SectionCustomEventFieldMapping {
private ConversionsAPICustomEventField field;
private ConversionsAPISection section;
public static /* synthetic */ SectionCustomEventFieldMapping copy$default(SectionCustomEventFieldMapping sectionCustomEventFieldMapping, ConversionsAPISection conversionsAPISection, ConversionsAPICustomEventField conversionsAPICustomEventField, int i, Object obj) {
if ((i & 1) != 0) {
conversionsAPISection = sectionCustomEventFieldMapping.section;
}
if ((i & 2) != 0) {
conversionsAPICustomEventField = sectionCustomEventFieldMapping.field;
}
return sectionCustomEventFieldMapping.copy(conversionsAPISection, conversionsAPICustomEventField);
}
public final ConversionsAPISection component1() {
return this.section;
}
public final ConversionsAPICustomEventField component2() {
return this.field;
}
public final SectionCustomEventFieldMapping copy(ConversionsAPISection conversionsAPISection, ConversionsAPICustomEventField field) {
Intrinsics.checkNotNullParameter(field, "field");
return new SectionCustomEventFieldMapping(conversionsAPISection, field);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof SectionCustomEventFieldMapping)) {
return false;
}
SectionCustomEventFieldMapping sectionCustomEventFieldMapping = (SectionCustomEventFieldMapping) obj;
return this.section == sectionCustomEventFieldMapping.section && this.field == sectionCustomEventFieldMapping.field;
}
public final ConversionsAPICustomEventField getField() {
return this.field;
}
public final ConversionsAPISection getSection() {
return this.section;
}
public int hashCode() {
ConversionsAPISection conversionsAPISection = this.section;
return ((conversionsAPISection == null ? 0 : conversionsAPISection.hashCode()) * 31) + this.field.hashCode();
}
public final void setField(ConversionsAPICustomEventField conversionsAPICustomEventField) {
Intrinsics.checkNotNullParameter(conversionsAPICustomEventField, "<set-?>");
this.field = conversionsAPICustomEventField;
}
public final void setSection(ConversionsAPISection conversionsAPISection) {
this.section = conversionsAPISection;
}
public String toString() {
return "SectionCustomEventFieldMapping(section=" + this.section + ", field=" + this.field + ')';
}
public SectionCustomEventFieldMapping(ConversionsAPISection conversionsAPISection, ConversionsAPICustomEventField field) {
Intrinsics.checkNotNullParameter(field, "field");
this.section = conversionsAPISection;
this.field = field;
}
}
public enum DataProcessingParameterName {
OPTIONS(FacebookSdk.DATA_PROCESSION_OPTIONS),
COUNTRY(FacebookSdk.DATA_PROCESSION_OPTIONS_COUNTRY),
STATE(FacebookSdk.DATA_PROCESSION_OPTIONS_STATE);
public static final Companion Companion = new Companion(null);
private final String rawValue;
public final String getRawValue() {
return this.rawValue;
}
DataProcessingParameterName(String str) {
this.rawValue = str;
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final DataProcessingParameterName invoke(String rawValue) {
Intrinsics.checkNotNullParameter(rawValue, "rawValue");
for (DataProcessingParameterName dataProcessingParameterName : DataProcessingParameterName.valuesCustom()) {
if (Intrinsics.areEqual(dataProcessingParameterName.getRawValue(), rawValue)) {
return dataProcessingParameterName;
}
}
return null;
}
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static DataProcessingParameterName[] valuesCustom() {
DataProcessingParameterName[] valuesCustom = values();
return (DataProcessingParameterName[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}
public enum ValueTransformationType {
ARRAY,
BOOL,
INT;
public static final Companion Companion = new Companion(null);
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
public final ValueTransformationType invoke(String rawValue) {
Intrinsics.checkNotNullParameter(rawValue, "rawValue");
if (!Intrinsics.areEqual(rawValue, AppEventUserAndAppDataField.EXT_INFO.getRawValue()) && !Intrinsics.areEqual(rawValue, AppEventUserAndAppDataField.URL_SCHEMES.getRawValue()) && !Intrinsics.areEqual(rawValue, CustomEventField.CONTENT_IDS.getRawValue()) && !Intrinsics.areEqual(rawValue, CustomEventField.CONTENTS.getRawValue()) && !Intrinsics.areEqual(rawValue, DataProcessingParameterName.OPTIONS.getRawValue())) {
if (!Intrinsics.areEqual(rawValue, AppEventUserAndAppDataField.ADV_TE.getRawValue()) && !Intrinsics.areEqual(rawValue, AppEventUserAndAppDataField.APP_TE.getRawValue())) {
if (Intrinsics.areEqual(rawValue, CustomEventField.EVENT_TIME.getRawValue())) {
return ValueTransformationType.INT;
}
return null;
}
return ValueTransformationType.BOOL;
}
return ValueTransformationType.ARRAY;
}
}
/* renamed from: values, reason: to resolve conflict with enum method */
public static ValueTransformationType[] valuesCustom() {
ValueTransformationType[] valuesCustom = values();
return (ValueTransformationType[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
}
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r1v4, types: [java.lang.String] */
/* JADX WARN: Type inference failed for: r1v7, types: [java.util.List] */
/* JADX WARN: Type inference failed for: r1v8, types: [java.lang.Object] */
/* JADX WARN: Type inference failed for: r1v9, types: [java.util.Map] */
public static final Object transformValue$facebook_core_release(String field, Object value) {
Integer intOrNull;
Integer intOrNull2;
Intrinsics.checkNotNullParameter(field, "field");
Intrinsics.checkNotNullParameter(value, "value");
ValueTransformationType invoke = ValueTransformationType.Companion.invoke(field);
String str = value instanceof String ? (String) value : null;
if (invoke == null || str == null) {
return value;
}
int i = WhenMappings.$EnumSwitchMapping$0[invoke.ordinal()];
if (i != 1) {
if (i != 2) {
if (i != 3) {
throw new NoWhenBranchMatchedException();
}
intOrNull2 = StringsKt__StringNumberConversionsKt.toIntOrNull(value.toString());
return intOrNull2;
}
intOrNull = StringsKt__StringNumberConversionsKt.toIntOrNull(str);
if (intOrNull != null) {
return Boolean.valueOf(intOrNull.intValue() != 0);
}
return null;
}
try {
Utility utility = Utility.INSTANCE;
List<String> convertJSONArrayToList = Utility.convertJSONArrayToList(new JSONArray(str));
ArrayList arrayList = new ArrayList();
Iterator it = convertJSONArrayToList.iterator();
while (it.hasNext()) {
?? r1 = (String) it.next();
try {
try {
Utility utility2 = Utility.INSTANCE;
r1 = Utility.convertJSONObjectToHashMap(new JSONObject((String) r1));
} catch (JSONException unused) {
Utility utility3 = Utility.INSTANCE;
r1 = Utility.convertJSONArrayToList(new JSONArray((String) r1));
}
} catch (JSONException unused2) {
}
arrayList.add(r1);
}
return arrayList;
} catch (JSONException e) {
Logger.Companion.log(LoggingBehavior.APP_EVENTS, TAG, "\n transformEvents JSONException: \n%s\n%s", value, e);
return Unit.INSTANCE;
}
}
public static final ArrayList<Map<String, Object>> transformEvents$facebook_core_release(String appEvents) {
String stackTraceToString;
Intrinsics.checkNotNullParameter(appEvents, "appEvents");
ArrayList<Map> arrayList = new ArrayList();
try {
Utility utility = Utility.INSTANCE;
for (String str : Utility.convertJSONArrayToList(new JSONArray(appEvents))) {
Utility utility2 = Utility.INSTANCE;
arrayList.add(Utility.convertJSONObjectToHashMap(new JSONObject(str)));
}
if (arrayList.isEmpty()) {
return null;
}
ArrayList<Map<String, Object>> arrayList2 = new ArrayList<>();
for (Map map : arrayList) {
LinkedHashMap linkedHashMap = new LinkedHashMap();
LinkedHashMap linkedHashMap2 = new LinkedHashMap();
for (String str2 : map.keySet()) {
CustomEventField invoke = CustomEventField.Companion.invoke(str2);
SectionCustomEventFieldMapping sectionCustomEventFieldMapping = customEventTransformations.get(invoke);
if (invoke != null && sectionCustomEventFieldMapping != null) {
ConversionsAPISection section = sectionCustomEventFieldMapping.getSection();
if (section != null) {
if (section == ConversionsAPISection.CUSTOM_DATA) {
String rawValue = sectionCustomEventFieldMapping.getField().getRawValue();
Object obj = map.get(str2);
if (obj == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.Any");
}
Object transformValue$facebook_core_release = transformValue$facebook_core_release(str2, obj);
if (transformValue$facebook_core_release != null) {
linkedHashMap.put(rawValue, transformValue$facebook_core_release);
} else {
throw new NullPointerException("null cannot be cast to non-null type kotlin.Any");
}
} else {
continue;
}
} else {
try {
String rawValue2 = sectionCustomEventFieldMapping.getField().getRawValue();
if (invoke == CustomEventField.EVENT_NAME && ((String) map.get(str2)) != null) {
AppEventsConversionsAPITransformer appEventsConversionsAPITransformer = INSTANCE;
Object obj2 = map.get(str2);
if (obj2 == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.String");
}
linkedHashMap2.put(rawValue2, appEventsConversionsAPITransformer.transformEventName((String) obj2));
} else if (invoke == CustomEventField.EVENT_TIME && ((Integer) map.get(str2)) != null) {
Object obj3 = map.get(str2);
if (obj3 == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.Any");
}
Object transformValue$facebook_core_release2 = transformValue$facebook_core_release(str2, obj3);
if (transformValue$facebook_core_release2 != null) {
linkedHashMap2.put(rawValue2, transformValue$facebook_core_release2);
} else {
throw new NullPointerException("null cannot be cast to non-null type kotlin.Any");
}
}
} catch (ClassCastException e) {
Logger.Companion companion = Logger.Companion;
LoggingBehavior loggingBehavior = LoggingBehavior.APP_EVENTS;
stackTraceToString = ExceptionsKt__ExceptionsKt.stackTraceToString(e);
companion.log(loggingBehavior, TAG, "\n transformEvents ClassCastException: \n %s ", stackTraceToString);
}
}
}
}
if (!linkedHashMap.isEmpty()) {
linkedHashMap2.put(ConversionsAPISection.CUSTOM_DATA.getRawValue(), linkedHashMap);
}
arrayList2.add(linkedHashMap2);
}
return arrayList2;
} catch (JSONException e2) {
Logger.Companion.log(LoggingBehavior.APP_EVENTS, TAG, "\n transformEvents JSONException: \n%s\n%s", appEvents, e2);
return null;
}
}
private final void transformAndUpdateAppData(Map<String, Object> map, AppEventUserAndAppDataField appEventUserAndAppDataField, Object obj) {
SectionFieldMapping sectionFieldMapping = topLevelTransformations.get(appEventUserAndAppDataField);
ConversionsAPIUserAndAppDataField field = sectionFieldMapping == null ? null : sectionFieldMapping.getField();
if (field == null) {
return;
}
map.put(field.getRawValue(), obj);
}
private final void transformAndUpdateUserData(Map<String, Object> map, AppEventUserAndAppDataField appEventUserAndAppDataField, Object obj) {
if (appEventUserAndAppDataField == AppEventUserAndAppDataField.USER_DATA) {
try {
Utility utility = Utility.INSTANCE;
map.putAll(Utility.convertJSONObjectToHashMap(new JSONObject((String) obj)));
return;
} catch (JSONException e) {
Logger.Companion.log(LoggingBehavior.APP_EVENTS, TAG, "\n transformEvents JSONException: \n%s\n%s", obj, e);
return;
}
}
SectionFieldMapping sectionFieldMapping = topLevelTransformations.get(appEventUserAndAppDataField);
ConversionsAPIUserAndAppDataField field = sectionFieldMapping == null ? null : sectionFieldMapping.getField();
if (field == null) {
return;
}
map.put(field.getRawValue(), obj);
}
public final void transformAndUpdateAppAndUserData$facebook_core_release(Map<String, Object> userData, Map<String, Object> appData, AppEventUserAndAppDataField field, Object value) {
Intrinsics.checkNotNullParameter(userData, "userData");
Intrinsics.checkNotNullParameter(appData, "appData");
Intrinsics.checkNotNullParameter(field, "field");
Intrinsics.checkNotNullParameter(value, "value");
SectionFieldMapping sectionFieldMapping = topLevelTransformations.get(field);
if (sectionFieldMapping == null) {
return;
}
int i = WhenMappings.$EnumSwitchMapping$1[sectionFieldMapping.getSection().ordinal()];
if (i == 1) {
transformAndUpdateAppData(appData, field, value);
} else {
if (i != 2) {
return;
}
transformAndUpdateUserData(userData, field, value);
}
}
private final String transformEventName(String str) {
Map<String, ConversionsAPIEventName> map = standardEventTransformations;
if (!map.containsKey(str)) {
return str;
}
ConversionsAPIEventName conversionsAPIEventName = map.get(str);
return conversionsAPIEventName == null ? "" : conversionsAPIEventName.getRawValue();
}
public final Map<String, Object> combineCommonFields$facebook_core_release(Map<String, ? extends Object> userData, Map<String, ? extends Object> appData, Map<String, ? extends Object> restOfData) {
Intrinsics.checkNotNullParameter(userData, "userData");
Intrinsics.checkNotNullParameter(appData, "appData");
Intrinsics.checkNotNullParameter(restOfData, "restOfData");
LinkedHashMap linkedHashMap = new LinkedHashMap();
linkedHashMap.put(OtherEventConstants.ACTION_SOURCE.getRawValue(), OtherEventConstants.APP.getRawValue());
linkedHashMap.put(ConversionsAPISection.USER_DATA.getRawValue(), userData);
linkedHashMap.put(ConversionsAPISection.APP_DATA.getRawValue(), appData);
linkedHashMap.putAll(restOfData);
return linkedHashMap;
}
private final List<Map<String, Object>> combineAllTransformedDataForMobileAppInstall(Map<String, ? extends Object> map, Object obj) {
if (obj == null) {
return null;
}
LinkedHashMap linkedHashMap = new LinkedHashMap();
linkedHashMap.putAll(map);
linkedHashMap.put(ConversionsAPICustomEventField.EVENT_NAME.getRawValue(), OtherEventConstants.MOBILE_APP_INSTALL.getRawValue());
linkedHashMap.put(ConversionsAPICustomEventField.EVENT_TIME.getRawValue(), obj);
return CollectionsKt__CollectionsJVMKt.listOf(linkedHashMap);
}
private final List<Map<String, Object>> combineAllTransformedDataForCustom(Map<String, ? extends Object> map, List<? extends Map<String, ? extends Object>> list) {
if (list.isEmpty()) {
return null;
}
ArrayList arrayList = new ArrayList();
Iterator<T> it = list.iterator();
while (it.hasNext()) {
Map map2 = (Map) it.next();
LinkedHashMap linkedHashMap = new LinkedHashMap();
linkedHashMap.putAll(map);
linkedHashMap.putAll(map2);
arrayList.add(linkedHashMap);
}
return arrayList;
}
public final List<Map<String, Object>> combineAllTransformedData$facebook_core_release(AppEventType eventType, Map<String, Object> userData, Map<String, Object> appData, Map<String, Object> restOfData, List<? extends Map<String, ? extends Object>> customEvents, Object obj) {
Intrinsics.checkNotNullParameter(eventType, "eventType");
Intrinsics.checkNotNullParameter(userData, "userData");
Intrinsics.checkNotNullParameter(appData, "appData");
Intrinsics.checkNotNullParameter(restOfData, "restOfData");
Intrinsics.checkNotNullParameter(customEvents, "customEvents");
Map<String, Object> combineCommonFields$facebook_core_release = combineCommonFields$facebook_core_release(userData, appData, restOfData);
int i = WhenMappings.$EnumSwitchMapping$2[eventType.ordinal()];
if (i == 1) {
return combineAllTransformedDataForMobileAppInstall(combineCommonFields$facebook_core_release, obj);
}
if (i != 2) {
return null;
}
return combineAllTransformedDataForCustom(combineCommonFields$facebook_core_release, customEvents);
}
private final AppEventType splitAppEventParameters(Map<String, ? extends Object> map, Map<String, Object> map2, Map<String, Object> map3, ArrayList<Map<String, Object>> arrayList, Map<String, Object> map4) {
Object obj = map.get(OtherEventConstants.EVENT.getRawValue());
AppEventType.Companion companion = AppEventType.Companion;
if (obj != null) {
AppEventType invoke = companion.invoke((String) obj);
if (invoke == AppEventType.OTHER) {
return invoke;
}
for (Map.Entry<String, ? extends Object> entry : map.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
AppEventUserAndAppDataField invoke2 = AppEventUserAndAppDataField.Companion.invoke(key);
if (invoke2 != null) {
INSTANCE.transformAndUpdateAppAndUserData$facebook_core_release(map2, map3, invoke2, value);
} else {
boolean areEqual = Intrinsics.areEqual(key, ConversionsAPISection.CUSTOM_EVENTS.getRawValue());
boolean z = value instanceof String;
if (invoke == AppEventType.CUSTOM && areEqual && z) {
ArrayList<Map<String, Object>> transformEvents$facebook_core_release = transformEvents$facebook_core_release((String) value);
if (transformEvents$facebook_core_release != null) {
arrayList.addAll(transformEvents$facebook_core_release);
}
} else if (DataProcessingParameterName.Companion.invoke(key) != null) {
map4.put(key, value);
}
}
}
return invoke;
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.String");
}
public final List<Map<String, Object>> conversionsAPICompatibleEvent$facebook_core_release(Map<String, ? extends Object> parameters) {
Intrinsics.checkNotNullParameter(parameters, "parameters");
LinkedHashMap linkedHashMap = new LinkedHashMap();
LinkedHashMap linkedHashMap2 = new LinkedHashMap();
ArrayList<Map<String, Object>> arrayList = new ArrayList<>();
LinkedHashMap linkedHashMap3 = new LinkedHashMap();
AppEventType splitAppEventParameters = splitAppEventParameters(parameters, linkedHashMap, linkedHashMap2, arrayList, linkedHashMap3);
if (splitAppEventParameters == AppEventType.OTHER) {
return null;
}
return combineAllTransformedData$facebook_core_release(splitAppEventParameters, linkedHashMap, linkedHashMap2, linkedHashMap3, arrayList, parameters.get(OtherEventConstants.INSTALL_EVENT_TIME.getRawValue()));
}
}