导航菜单

页面标题

页面副标题

BetterTogether v3.0.0 - x.java 源代码

正在查看: BetterTogether v3.0.0 应用的 x.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package j9;

import android.content.Context;
import com.adapty.internal.utils.HashingHelper;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import kotlin.Unit;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Charsets;

public final class x {

    public static final ReentrantReadWriteLock f10655d = new ReentrantReadWriteLock();

    public final Context f10656a;

    public final a9.n f10657b;

    public final lq.x f10658c;

    public x(Context context, a9.n nVar) {
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(nVar, "storylyTracker");
        this.f10656a = context;
        this.f10657b = nVar;
        this.f10658c = lq.n.b(w.f10654d);
    }

    public static String a(String str) {
        MessageDigest messageDigest = MessageDigest.getInstance(HashingHelper.MD5);
        byte[] bytes = str.getBytes(Charsets.UTF_8);
        Intrinsics.checkNotNullExpressionValue(bytes, "this as java.lang.String).getBytes(charset)");
        String bigInteger = new BigInteger(1, messageDigest.digest(bytes)).toString(16);
        Intrinsics.checkNotNullExpressionValue(bigInteger, "BigInteger(1, md.digest(…yteArray())).toString(16)");
        return kotlin.text.y.J(bigInteger, 32);
    }

    public static String c(String str) {
        return "stryly-local-cache-" + a(str) + '-' + kotlin.text.z.a0(8, str);
    }

    public static String d(String str) {
        return "stryly-meta-cache-" + a(str) + '-' + kotlin.text.z.a0(8, str);
    }

    public final boolean b(String str, String str2) {
        ReentrantReadWriteLock.WriteLock writeLock;
        boolean z4;
        a9.n nVar = this.f10657b;
        ReentrantReadWriteLock reentrantReadWriteLock = f10655d;
        try {
            try {
                reentrantReadWriteLock.writeLock().lock();
                try {
                    FileOutputStream openFileOutput = this.f10656a.openFileOutput(str, 0);
                    try {
                        byte[] bytes = str2.getBytes(Charsets.UTF_8);
                        Intrinsics.checkNotNullExpressionValue(bytes, "this as java.lang.String).getBytes(charset)");
                        openFileOutput.write(bytes);
                        openFileOutput.flush();
                        Unit unit = Unit.f12192a;
                        rk.r.o(openFileOutput, (Throwable) null);
                        writeLock = reentrantReadWriteLock.writeLock();
                        z4 = true;
                    } finally {
                    }
                } catch (Exception e10) {
                    a9.a aVar = a9.a.f304q0;
                    tr.a0 a0Var = new tr.a0();
                    rk.r.P(a0Var, "error", Intrinsics.k(e10.getMessage(), "local:writeFile:write:"));
                    Unit unit2 = Unit.f12192a;
                    a9.n.f(nVar, aVar, a0Var.a());
                    writeLock = reentrantReadWriteLock.writeLock();
                    z4 = false;
                }
                writeLock.unlock();
                return z4;
            } catch (Throwable th2) {
                reentrantReadWriteLock.writeLock().unlock();
                throw th2;
            }
        } catch (Exception e11) {
            a9.a aVar2 = a9.a.f304q0;
            tr.a0 a0Var2 = new tr.a0();
            rk.r.P(a0Var2, "error", Intrinsics.k(e11.getMessage(), "local:writeFile:writelock:"));
            Unit unit3 = Unit.f12192a;
            a9.n.f(nVar, aVar2, a0Var2.a());
            return false;
        }
    }

    public final String e(String str) {
        ReentrantReadWriteLock.ReadLock readLock;
        String str2;
        a9.n nVar = this.f10657b;
        Context context = this.f10656a;
        File file = new File(context.getFilesDir(), str);
        ReentrantReadWriteLock reentrantReadWriteLock = f10655d;
        try {
            try {
                reentrantReadWriteLock.readLock().lock();
                try {
                } catch (Exception e10) {
                    a9.a aVar = a9.a.f304q0;
                    tr.a0 a0Var = new tr.a0();
                    rk.r.P(a0Var, "error", Intrinsics.k(e10.getMessage(), "local:readFile:read:"));
                    Unit unit = Unit.f12192a;
                    a9.n.f(nVar, aVar, a0Var.a());
                    readLock = reentrantReadWriteLock.readLock();
                    str2 = null;
                }
                if (!file.exists()) {
                    return null;
                }
                FileInputStream openFileInput = context.openFileInput(str);
                try {
                    Intrinsics.checkNotNullExpressionValue(openFileInput, "it");
                    Reader inputStreamReader = new InputStreamReader(openFileInput, Charsets.UTF_8);
                    str2 = com.bumptech.glide.e.M(inputStreamReader instanceof BufferedReader ? (BufferedReader) inputStreamReader : new BufferedReader(inputStreamReader, 8192));
                    rk.r.o(openFileInput, (Throwable) null);
                    readLock = reentrantReadWriteLock.readLock();
                    readLock.unlock();
                    try {
                        reentrantReadWriteLock.writeLock().lock();
                        try {
                            file.delete();
                            return str2;
                        } catch (Exception e11) {
                            a9.a aVar2 = a9.a.f304q0;
                            tr.a0 a0Var2 = new tr.a0();
                            rk.r.P(a0Var2, "error", Intrinsics.k(e11.getMessage(), "local:readFile:delete:"));
                            Unit unit2 = Unit.f12192a;
                            a9.n.f(nVar, aVar2, a0Var2.a());
                            return null;
                        } finally {
                            reentrantReadWriteLock.writeLock().unlock();
                        }
                    } catch (Exception e12) {
                        a9.a aVar3 = a9.a.f304q0;
                        tr.a0 a0Var3 = new tr.a0();
                        rk.r.P(a0Var3, "error", Intrinsics.k(e12, "local:readFile:writelock:"));
                        Unit unit3 = Unit.f12192a;
                        a9.n.f(nVar, aVar3, a0Var3.a());
                        return null;
                    }
                } finally {
                }
            } finally {
                reentrantReadWriteLock.readLock().unlock();
            }
        } catch (Exception e13) {
            a9.a aVar4 = a9.a.f304q0;
            tr.a0 a0Var4 = new tr.a0();
            rk.r.P(a0Var4, "error", Intrinsics.k(e13, "local:readFile:readlock:"));
            Unit unit4 = Unit.f12192a;
            a9.n.f(nVar, aVar4, a0Var4.a());
            return null;
        }
    }
}