package xyz.netfly;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.SystemClock;
import androidx.multidex.MultiDexApplication;
import androidx.security.crypto.MasterKey$KeyScheme;
import androidx.security.crypto.b;
import com.google.android.gms.ads.AdActivity;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.firebase.messaging.FirebaseMessaging;
import fa.h;
import j3.a;
import java.util.ArrayList;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlinx.coroutines.y;
import w8.j;
import w8.q;
import w8.t;
import xyz.stream.api.entity.LanguageConfigEntity;
import xyz.stream.utils.c;
import xyz.stream.utils.d;
import xyz.stream.utils.e;
import xyz.stream.utils.f0;
import xyz.stream.utils.k0;
import xyz.stream.utils.m;
import xyz.stream.view.ViewRuntime;
import xyz.stream.view.autosize.AutoSizeConfig;

/* JADX INFO: loaded from: classes3.dex */
public class MyApplication extends MultiDexApplication {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static Context f34822a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final AtomicBoolean f34823b = new AtomicBoolean(false);

    static {
        System.loadLibrary("gojni");
    }

    public static ArrayList a() {
        ArrayList arrayList = new ArrayList();
        arrayList.add(new LanguageConfigEntity("en-US", 1, "English", "EN"));
        arrayList.add(new LanguageConfigEntity("es-ES", 0, "Español", "ES"));
        arrayList.add(new LanguageConfigEntity("fr-FR", 0, "Français", "FR"));
        arrayList.add(new LanguageConfigEntity("pt-BR", 0, "Português", "PT"));
        arrayList.add(new LanguageConfigEntity("ar", 0, "بالعربية", "AR"));
        arrayList.add(new LanguageConfigEntity("tr-TR", 0, "Türkçe", "TR"));
        arrayList.add(new LanguageConfigEntity("it-IT", 0, "Italiano", "IT"));
        arrayList.add(new LanguageConfigEntity("de-DE", 0, "Deutsch", "DE"));
        return arrayList;
    }

    @Override // android.app.Application, android.content.ComponentCallbacks
    public final void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
    }

    @Override // android.app.Application
    public final void onCreate() {
        int i10;
        SharedPreferences sharedPreferences;
        a aVar;
        MasterKey$KeyScheme masterKey$KeyScheme;
        super.onCreate();
        f34822a = getApplicationContext();
        f0 f0VarO = f0.o();
        synchronized (f0VarO) {
            try {
                i10 = 0;
                if (((SharedPreferences) f0VarO.f36136b) == null) {
                    try {
                        sharedPreferences = getSharedPreferences("FlutterSharedPreferences", 0);
                        aVar = new a(this);
                        masterKey$KeyScheme = MasterKey$KeyScheme.f4227a;
                    } catch (Exception unused) {
                        f0VarO.f36136b = getSharedPreferences("FlutterSharedPreferences", 0);
                    }
                    if (aVar.f28623b != null) {
                        throw new IllegalArgumentException("KeyScheme set after setting a KeyGenParamSpec");
                    }
                    aVar.f28624c = masterKey$KeyScheme;
                    f0VarO.f36136b = b.a(this, "EncryptedSharedPreferences", aVar.a());
                    Map<String, ?> all = sharedPreferences.getAll();
                    if (!all.isEmpty()) {
                        SharedPreferences.Editor editorEdit = ((SharedPreferences) f0VarO.f36136b).edit();
                        for (Map.Entry<String, ?> entry : all.entrySet()) {
                            String key = entry.getKey();
                            if (!key.startsWith("__androidx_security_crypto_")) {
                                Object value = entry.getValue();
                                if (value instanceof String) {
                                    editorEdit.putString(key, (String) value);
                                } else if (value instanceof Boolean) {
                                    editorEdit.putBoolean(key, ((Boolean) value).booleanValue());
                                } else if (value instanceof Integer) {
                                    editorEdit.putInt(key, ((Integer) value).intValue());
                                } else if (value instanceof Long) {
                                    editorEdit.putLong(key, ((Long) value).longValue());
                                } else if (value instanceof Float) {
                                    editorEdit.putFloat(key, ((Float) value).floatValue());
                                } else if (value instanceof Set) {
                                    editorEdit.putStringSet(key, (Set) value);
                                } else {
                                    editorEdit.putString(key, m.a(value));
                                }
                            }
                        }
                        editorEdit.apply();
                        deleteSharedPreferences("FlutterSharedPreferences");
                    }
                }
            } catch (Throwable th) {
                throw th;
            }
        }
        e eVarD = e.d();
        Context context = f34822a;
        eVarD.f36112a = context;
        eVarD.f36113b = "3.0.3";
        eVarD.f36123l = "netfly_release";
        eVarD.f36117f = "xyz.netfly.SplashActivity";
        int i11 = 1;
        eVarD.f36118g = true;
        eVarD.f36119h = false;
        eVarD.f36120i = false;
        eVarD.f36121j = false;
        eVarD.f36122k = false;
        eVarD.f36114c = y.q(context);
        d dVar = d.f36103f;
        if (!dVar.f36105b) {
            dVar.f36105b = true;
            dVar.f36106c = SystemClock.uptimeMillis();
            Thread thread = new Thread(new c(dVar, i10), "AppAnrWatchdog");
            dVar.f36108e = thread;
            thread.setDaemon(true);
            dVar.f36108e.start();
        }
        try {
            FirebaseAnalytics.getInstance(context).setUserId(eVarD.f36114c);
            t tVar = FirebaseMessaging.c().f24128h;
            com.google.firebase.messaging.m mVar = new com.google.firebase.messaging.m("video", i10);
            tVar.getClass();
            tVar.f34251b.f(new q(j.f34225a, mVar, new t()));
            tVar.m();
        } catch (Exception unused2) {
        }
        ViewRuntime.builder(this).deviceType(e.d().f36118g, e.d().f36119h, e.d().f36120i, e.d().f36121j, e.d().f36122k).languageProvider(new h(3)).screenReporter(new h(4)).closeAdultHandler(new y.a(this, 28)).restartAction(new h(5)).build();
        e.d().f36124m = new b7.a(i11);
        AutoSizeConfig.getInstance().getExternalAdaptManager().addCancelAdaptOfActivity(AdActivity.class);
        k0.a().f36157a = "https://log.netflyapp.com/upload?filename=";
        Thread.setDefaultUncaughtExceptionHandler(new he.a());
    }
}
