正在查看: Tuna Cash v1.0.0 应用的 AFc1tSDK.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Tuna Cash v1.0.0 应用的 AFc1tSDK.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.appsflyer.internal;
import LlLlL.IILlL;
import android.content.Context;
import android.util.Base64;
import com.appsflyer.AFLogger;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import kotlin.Pair;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.collections.LLLli;
import kotlin.collections.iIliII;
import kotlin.collections.iLilI;
import kotlin.collections.liIiIiI;
import kotlin.collections.liLLllI;
import kotlin.jvm.internal.Intrinsics;
import llLil.IlIlliI;
import org.jetbrains.annotations.NotNull;
public final class AFc1tSDK implements AFc1vSDK {
@NotNull
private final AFc1iSDK AFAdRevenueData;
@NotNull
private final AFc1qSDK getCurrencyIso4217Code;
@NotNull
private final AFc1sSDK getMediationNetwork;
@NotNull
private final Map<String, Integer> getRevenue;
public AFc1tSDK(@NotNull AFc1iSDK aFc1iSDK, @NotNull AFc1qSDK aFc1qSDK) {
Intrinsics.checkNotNullParameter(aFc1iSDK, "");
Intrinsics.checkNotNullParameter(aFc1qSDK, "");
this.AFAdRevenueData = aFc1iSDK;
this.getCurrencyIso4217Code = aFc1qSDK;
this.getMediationNetwork = new AFc1sSDK(iIliII.iiIiiI(new AFc1uSDK[]{new AFc1uSDK("ConversionsCache", liLLllI.LLiIl(AFe1mSDK.CONVERSION), 1), new AFc1uSDK("AttrCache", liLLllI.LLiIl(AFe1mSDK.ATTR), 1), new AFc1uSDK("OtherCache", iIliII.iiIiiI(new AFe1mSDK[]{AFe1mSDK.LAUNCH, AFe1mSDK.INAPP, AFe1mSDK.ADREVENUE, AFe1mSDK.ARS_VALIDATE, AFe1mSDK.PURCHASE_VALIDATE, AFe1mSDK.MANUAL_PURCHASE_VALIDATION, AFe1mSDK.SDK_SERVICES}), 40)}));
this.getRevenue = LLLli.IILii(new Pair[]{new Pair("ConversionsCache", 0), new Pair("AttrCache", 0), new Pair("OtherCache", 0)});
}
private final boolean getCurrencyIso4217Code(File file) {
try {
file.delete();
getMonetizationNetwork();
return true;
} catch (Exception e) {
AFg1gSDK.e$default(AFLogger.INSTANCE, AFg1cSDK.CACHE, IIIIlIi.LLiIl.llLii("Could not delete ", file.getName(), " from cache"), e, false, false, false, false, 120, null);
return false;
}
}
private static AFc1rSDK getMediationNetwork(File file) {
try {
InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(file), Charset.defaultCharset());
try {
char[] cArr = new char[(int) file.length()];
inputStreamReader.read(cArr);
AFc1rSDK aFc1rSDK = new AFc1rSDK(cArr);
aFc1rSDK.getMediationNetwork = file.getName();
IlIlliI.liLILi(inputStreamReader, null);
return aFc1rSDK;
} finally {
}
} catch (Exception e) {
AFLogger.INSTANCE.e(AFg1cSDK.CACHE, "Error while loading request from cache", e, false, false, true, false);
return null;
}
}
private final void getMonetizationNetwork() {
for (AFc1uSDK aFc1uSDK : this.getMediationNetwork.AFAdRevenueData) {
String str = aFc1uSDK.getCurrencyIso4217Code;
Context context = this.AFAdRevenueData.getMonetizationNetwork;
Intrinsics.iliLLil(context);
File file = new File(new File(context.getFilesDir(), "AFRequestCache"), str);
if (file.exists()) {
Map<String, Integer> map = this.getRevenue;
String str2 = aFc1uSDK.getCurrencyIso4217Code;
File[] listFiles = file.listFiles();
map.put(str2, Integer.valueOf(listFiles != null ? listFiles.length : 0));
} else {
file.mkdirs();
this.getRevenue.put(aFc1uSDK.getCurrencyIso4217Code, 0);
}
}
}
@Override
public final void AFAdRevenueData() {
try {
if (this.getCurrencyIso4217Code.AFAdRevenueData("AF_CACHE_VERSION", -1) == 1) {
Context context = this.AFAdRevenueData.getMonetizationNetwork;
Intrinsics.iliLLil(context);
if (!new File(context.getFilesDir(), "AFRequestCache").exists()) {
Context context2 = this.AFAdRevenueData.getMonetizationNetwork;
Intrinsics.iliLLil(context2);
new File(context2.getFilesDir(), "AFRequestCache").mkdir();
}
} else {
this.getCurrencyIso4217Code.getMediationNetwork("AF_CACHE_VERSION", 1);
Context context3 = this.AFAdRevenueData.getMonetizationNetwork;
Intrinsics.iliLLil(context3);
if (new File(context3.getFilesDir(), "AFRequestCache").exists()) {
Context context4 = this.AFAdRevenueData.getMonetizationNetwork;
Intrinsics.iliLLil(context4);
kotlin.io.iiILI.iliLLil(new File(context4.getFilesDir(), "AFRequestCache"));
Context context5 = this.AFAdRevenueData.getMonetizationNetwork;
Intrinsics.iliLLil(context5);
new File(context5.getFilesDir(), "AFRequestCache").mkdir();
}
}
getMonetizationNetwork();
} catch (Exception e) {
AFg1gSDK.e$default(AFLogger.INSTANCE, AFg1cSDK.CACHE, "Could not init cache", e, false, false, false, false, 120, null);
}
}
@Override
@NotNull
public final List<AFc1rSDK> getRevenue() {
AFg1gSDK.i$default(AFLogger.INSTANCE, AFg1cSDK.CACHE, "Get Cached Requests", false, 4, null);
ArrayList arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
try {
Context context = this.AFAdRevenueData.getMonetizationNetwork;
Intrinsics.iliLLil(context);
if (!new File(context.getFilesDir(), "AFRequestCache").exists()) {
Context context2 = this.AFAdRevenueData.getMonetizationNetwork;
Intrinsics.iliLLil(context2);
new File(context2.getFilesDir(), "AFRequestCache").mkdir();
}
Iterator<T> it = this.getMediationNetwork.AFAdRevenueData.iterator();
while (it.hasNext()) {
String str = ((AFc1uSDK) it.next()).getCurrencyIso4217Code;
Context context3 = this.AFAdRevenueData.getMonetizationNetwork;
Intrinsics.iliLLil(context3);
File file = new File(new File(context3.getFilesDir(), "AFRequestCache"), str);
if (!file.exists()) {
file.mkdirs();
}
File[] listFiles = file.listFiles();
if (listFiles == null) {
listFiles = new File[0];
}
liIiIiI.LLILli(arrayList2, listFiles);
}
Iterator it2 = arrayList2.iterator();
while (it2.hasNext()) {
File file2 = (File) it2.next();
AFg1gSDK.i$default(AFLogger.INSTANCE, AFg1cSDK.CACHE, "Found cached request: " + file2.getName(), false, 4, null);
AFc1rSDK mediationNetwork = getMediationNetwork(file2);
if (mediationNetwork != null) {
arrayList.add(mediationNetwork);
}
}
} catch (Exception e) {
AFg1gSDK.e$default(AFLogger.INSTANCE, AFg1cSDK.CACHE, "Could not get cached requests", e, false, false, false, false, 120, null);
}
AFg1gSDK.i$default(AFLogger.INSTANCE, AFg1cSDK.CACHE, IILlL.lLILl("Found ", arrayList.size(), " Cached Requests"), false, 4, null);
return arrayList;
}
private final String getMediationNetwork(AFe1mSDK aFe1mSDK) {
String str;
AFc1uSDK currencyIso4217Code = getCurrencyIso4217Code(aFe1mSDK);
if (currencyIso4217Code == null || (str = currencyIso4217Code.getCurrencyIso4217Code) == null) {
throw new UnsupportedOperationException("Cache do not support this type of events");
}
return str;
}
private final AFc1uSDK getCurrencyIso4217Code(AFe1mSDK aFe1mSDK) {
Object obj;
Iterator<T> it = this.getMediationNetwork.AFAdRevenueData.iterator();
while (true) {
if (!it.hasNext()) {
obj = null;
break;
}
obj = it.next();
if (((AFc1uSDK) obj).getRevenue.contains(aFe1mSDK)) {
break;
}
}
return (AFc1uSDK) obj;
}
@Override
public final void getMediationNetwork() {
try {
Context context = this.AFAdRevenueData.getMonetizationNetwork;
Intrinsics.iliLLil(context);
if (!new File(context.getFilesDir(), "AFRequestCache").exists()) {
Context context2 = this.AFAdRevenueData.getMonetizationNetwork;
Intrinsics.iliLLil(context2);
new File(context2.getFilesDir(), "AFRequestCache").mkdir();
return;
}
Iterator<T> it = this.getMediationNetwork.AFAdRevenueData.iterator();
while (it.hasNext()) {
String str = ((AFc1uSDK) it.next()).getCurrencyIso4217Code;
Context context3 = this.AFAdRevenueData.getMonetizationNetwork;
Intrinsics.iliLLil(context3);
File[] listFiles = new File(new File(context3.getFilesDir(), "AFRequestCache"), str).listFiles();
if (listFiles != null) {
Intrinsics.checkNotNullExpressionValue(listFiles, "");
for (File file : listFiles) {
AFLogger aFLogger = AFLogger.INSTANCE;
AFg1cSDK aFg1cSDK = AFg1cSDK.CACHE;
AFg1gSDK.i$default(aFLogger, aFg1cSDK, "ClearCache : Found cached request " + file.getName(), false, 4, null);
AFg1gSDK.i$default(aFLogger, aFg1cSDK, "Deleting " + file.getName() + " from cache", false, 4, null);
file.delete();
}
}
}
Context context4 = this.AFAdRevenueData.getMonetizationNetwork;
Intrinsics.iliLLil(context4);
kotlin.io.iiILI.iliLLil(new File(context4.getFilesDir(), "AFRequestCache"));
getMonetizationNetwork();
} catch (Exception e) {
AFg1gSDK.e$default(AFLogger.INSTANCE, AFg1cSDK.CACHE, "Could not clearCache request", e, false, false, false, false, 120, null);
}
}
@Override
public final String AFAdRevenueData(@NotNull AFc1rSDK aFc1rSDK) {
Exception exc;
?? r15;
AFLogger aFLogger;
AFg1cSDK aFg1cSDK;
String valueOf;
OutputStreamWriter outputStreamWriter;
String str;
List iIliII;
List<File> iLiLiI;
String str2 = "Cache request: done, cacheKey: ";
Intrinsics.checkNotNullParameter(aFc1rSDK, "");
try {
AFe1mSDK aFe1mSDK = aFc1rSDK.getMonetizationNetwork;
Intrinsics.checkNotNullExpressionValue(aFe1mSDK, "");
Context context = this.AFAdRevenueData.getMonetizationNetwork;
Intrinsics.iliLLil(context);
File file = new File(new File(context.getFilesDir(), "AFRequestCache"), getMediationNetwork(aFe1mSDK));
if (!file.exists()) {
file.mkdirs();
}
aFLogger = AFLogger.INSTANCE;
aFg1cSDK = AFg1cSDK.CACHE;
AFg1gSDK.i$default(aFLogger, aFg1cSDK, "Caching request with URL: " + aFc1rSDK.getRevenue, false, 4, null);
valueOf = String.valueOf(System.currentTimeMillis());
?? file2 = new File(file, valueOf);
try {
file2.createNewFile();
outputStreamWriter = new OutputStreamWriter(new FileOutputStream(file2.getPath(), true), Charset.defaultCharset());
} catch (Exception e) {
exc = e;
r15 = file2;
}
} catch (Exception e2) {
exc = e2;
r15 = 0;
}
try {
try {
outputStreamWriter.write("version=");
outputStreamWriter.write(aFc1rSDK.AFAdRevenueData);
outputStreamWriter.write(10);
outputStreamWriter.write("url=");
outputStreamWriter.write(aFc1rSDK.getRevenue);
outputStreamWriter.write(10);
outputStreamWriter.write("data=");
outputStreamWriter.write(Base64.encodeToString(aFc1rSDK.getMediationNetwork(), 2));
outputStreamWriter.write(10);
AFe1mSDK aFe1mSDK2 = aFc1rSDK.getMonetizationNetwork;
outputStreamWriter.write("type=");
outputStreamWriter.write(aFe1mSDK2.name());
outputStreamWriter.write(10);
outputStreamWriter.flush();
Unit unit = Unit.INSTANCE;
IlIlliI.liLILi(outputStreamWriter, null);
AFg1gSDK.i$default(aFLogger, aFg1cSDK, "Cache request: done, cacheKey: " + valueOf, false, 4, null);
AFe1mSDK aFe1mSDK3 = aFc1rSDK.getMonetizationNetwork;
Intrinsics.checkNotNullExpressionValue(aFe1mSDK3, "");
AFc1uSDK currencyIso4217Code = getCurrencyIso4217Code(aFe1mSDK3);
Integer valueOf2 = currencyIso4217Code != null ? Integer.valueOf(currencyIso4217Code.AFAdRevenueData) : null;
if (valueOf2 != null) {
int intValue = valueOf2.intValue();
Map<String, Integer> map = this.getRevenue;
AFc1uSDK currencyIso4217Code2 = getCurrencyIso4217Code(aFe1mSDK3);
if (currencyIso4217Code2 != null && (str = currencyIso4217Code2.getCurrencyIso4217Code) != null) {
Integer num = map.get(str);
int intValue2 = num != null ? num.intValue() : 0;
if (intValue2 >= intValue) {
int i = (intValue2 + 1) - intValue;
AFg1gSDK.i$default(aFLogger, aFg1cSDK, "Cache overflown for type " + aFe1mSDK3 + ", removing " + i + " item(s)", false, 4, null);
Context context2 = this.AFAdRevenueData.getMonetizationNetwork;
Intrinsics.iliLLil(context2);
File file3 = new File(new File(context2.getFilesDir(), "AFRequestCache"), getMediationNetwork(aFe1mSDK3));
if (!file3.exists()) {
file3.mkdirs();
}
File[] listFiles = file3.listFiles();
if (listFiles != null && (iIliII = iLilI.iIliII(listFiles, new Comparator() {
@Override
public final int compare(T t, T t2) {
return ILliiII.lLILIl.lLILIl(((File) t).getName(), ((File) t2).getName());
}
})) != null && (iLiLiI = CollectionsKt.iLiLiI(iIliII, i)) != null) {
for (File file4 : iLiLiI) {
file4.delete();
AFg1gSDK.i$default(AFLogger.INSTANCE, AFg1cSDK.CACHE, "Cache entry " + file4.getName() + " removed", false, 4, null);
}
}
}
getMonetizationNetwork();
} else {
throw new UnsupportedOperationException("Cache do not support this type of events");
}
}
return valueOf;
} finally {
}
} catch (Exception e3) {
exc = e3;
r15 = str2;
if (r15 != 0) {
r15.delete();
}
AFg1gSDK.e$default(AFLogger.INSTANCE, AFg1cSDK.CACHE, "Could not cache request", exc, false, false, false, false, 120, null);
return null;
}
}
@Override
public final boolean AFAdRevenueData(String str) {
if (str == null) {
return false;
}
Context context = this.AFAdRevenueData.getMonetizationNetwork;
Intrinsics.iliLLil(context);
if (!new File(context.getFilesDir(), "AFRequestCache").exists()) {
Context context2 = this.AFAdRevenueData.getMonetizationNetwork;
Intrinsics.iliLLil(context2);
new File(context2.getFilesDir(), "AFRequestCache").mkdir();
return true;
}
AFg1gSDK.i$default(AFLogger.INSTANCE, AFg1cSDK.CACHE, IIIIlIi.LLiIl.llLii("Deleting ", str, " from cache"), false, 4, null);
Iterator<T> it = this.getMediationNetwork.AFAdRevenueData.iterator();
while (it.hasNext()) {
String str2 = ((AFc1uSDK) it.next()).getCurrencyIso4217Code;
Context context3 = this.AFAdRevenueData.getMonetizationNetwork;
Intrinsics.iliLLil(context3);
File file = new File(new File(new File(context3.getFilesDir(), "AFRequestCache"), str2), str);
if (file.exists()) {
return getCurrencyIso4217Code(file);
}
}
return true;
}
}