APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:FreeTelec
版本号:1.13.0
包名称:fr.r0ro.android.FreeTelec

MD5 校验值:1c0b849068c6d731df1325f993a128f9

反编译源代码说明

e.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package fr.r0ro.android.FreeTelec;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.http.HttpResponseCache;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.WindowManager;
import android.widget.Toast;
import com.google.android.gms.ads.AdError;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.FullScreenContentCallback;
import com.google.android.gms.ads.LoadAdError;
import com.google.android.gms.ads.MobileAds;
import com.google.android.gms.ads.RequestConfiguration;
import com.google.android.gms.ads.initialization.AdapterStatus;
import com.google.android.gms.ads.initialization.InitializationStatus;
import com.google.android.gms.ads.initialization.OnInitializationCompleteListener;
import com.google.android.gms.ads.interstitial.InterstitialAd;
import com.google.android.gms.ads.interstitial.InterstitialAdLoadCallback;
import com.google.firebase.analytics.FirebaseAnalytics;
import e2.e;
import fr.r0ro.android.FreeTelec.a;
import fr.r0ro.teleclib.FreeboxScanner;
import g2.b;
import g2.c;
import g2.d;
import g2.f;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import p3.k;

public class e {
    private static Boolean A;
    private static Boolean B;
    private static Boolean C;
    private static Boolean D;
    private static HashSet<h> E;
    private static boolean F;
    private static boolean G;
    private static String H;

    private static final Boolean f18372y;

    protected static e f18373z;

    private final Context f18374a;

    private boolean f18375b;

    private boolean f18383j;

    private boolean f18384k;

    private g2.c f18387n;

    private g2.b f18388o;

    public FirebaseAnalytics f18392s;

    private final com.google.firebase.remoteconfig.a f18395v;

    private final SharedPreferences f18396w;

    private boolean f18376c = false;

    private FreeboxScanner f18377d = null;

    h f18378e = null;

    private e2.e f18379f = null;

    private final Handler f18380g = new Handler();

    private final HashSet<e2.d> f18381h = new HashSet<>();

    private final Runnable f18382i = new b();

    private String f18385l = "Non scanné";

    private String f18386m = "Non scanné";

    private String f18389p = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED;

    private String f18390q = "Non scanné";

    AlertDialog f18391r = null;

    public ArrayList<Integer> f18393t = null;

    private AdRequest.Builder f18394u = null;

    private InterstitialAd f18397x = null;

    public class a implements FreeboxScanner.FreeboxScannerListener {
        a() {
        }

        @Override
        public void onFreeboxDetected(FreeboxScanner.Freebox freebox) {
            h mVar;
            Log.i("FreeTelecSingleton", "onFreeboxDetected: " + freebox);
            if (FreeboxScanner.Freebox.FREEBOX_TYPE_HID.equals(freebox.type)) {
                mVar = new n(freebox);
            } else if (FreeboxScanner.Freebox.FREEBOX_TYPE_ATV.equals(freebox.type)) {
                mVar = new m(e.this.f18374a, freebox);
            } else {
                Log.e("FreeTelecSingleton", "unexpected freebox type: " + freebox.type);
                return;
            }
            e.E.add(mVar);
        }

        @Override
        public void onScanDone(Set<FreeboxScanner.Freebox> set) {
            Log.i("FreeTelecSingleton", "onScanDone: " + set);
            Boolean unused = e.A = Boolean.FALSE;
            e.this.J();
        }
    }

    class b implements Runnable {
        b() {
        }

        @Override
        public void run() {
            e.t0("AtvDiscover", "stop scan after timeout");
            e.this.f18379f.d();
            e.t0("AtvDiscover", "found " + e.this.f18381h.size() + " devices: " + e.this.f18381h);
            HashSet hashSet = e.E;
            HashSet unused = e.E = new HashSet();
            Iterator it = hashSet.iterator();
            while (it.hasNext()) {
                h hVar = (h) it.next();
                if (hVar.f18422b != 3) {
                    e.E.add(hVar);
                }
            }
            if (e.this.f18381h.size() == 0) {
                Log.i("AtvDiscover", "no android tv device found");
            }
            Iterator it2 = e.this.f18381h.iterator();
            while (it2.hasNext()) {
                e2.d dVar = (e2.d) it2.next();
                j jVar = new j(e.this.f18374a, dVar.h().toString(), dVar);
                e.t0("AtvDiscover", "adding atv telec: " + jVar);
                e.E.add(jVar);
            }
            Boolean unused2 = e.C = Boolean.FALSE;
            e.this.J();
        }
    }

    public class c extends e.b {
        c() {
        }

        @Override
        public void a(e2.d dVar) {
            e.t0("AtvDiscover", "onDeviceFound: " + dVar);
            e.this.f18381h.add(dVar);
        }

        @Override
        public void b(e2.d dVar) {
            e.t0("AtvDiscover", "onDeviceLost: " + dVar);
            e.this.f18381h.remove(dVar);
        }

        @Override
        public void c() {
            e.t0("AtvDiscover", "onDiscoveryStarted");
            e.this.f18380g.postDelayed(e.this.f18382i, 3000L);
        }

        @Override
        public void e(int i6) {
            Log.e("AtvDiscover", "onStartDiscoveryFailed: " + i6);
        }
    }

    public class d implements DialogInterface.OnClickListener {
        d() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i6) {
            dialogInterface.dismiss();
        }
    }

    public class DialogInterfaceOnClickListenerC0075e implements DialogInterface.OnClickListener {
        DialogInterfaceOnClickListenerC0075e() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i6) {
            dialogInterface.dismiss();
            e.this.m0(true);
        }
    }

    public class f implements DialogInterface.OnClickListener {
        f() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i6) {
            dialogInterface.dismiss();
            e.this.f18391r = new AlertDialog.Builder(FreeTelecActivity.C).create();
            e.this.f18391r.setTitle("Diagnostics");
            e.this.f18391r.setMessage("Vous pouvez poster ce diagnostic sur \nhttps://iphone.r0ro.fr/forum/\n\nMDNS: " + e.this.f18390q + "\nHTTP1: " + e.this.f18385l + "\nHTTP2: " + e.this.f18386m + "\nHID: " + n.f18454q);
            e.this.f18391r.show();
        }
    }

    public class g implements Runnable {

        class a extends InterstitialAdLoadCallback {

            public class C0076a extends FullScreenContentCallback {
                C0076a() {
                }

                @Override
                public void onAdClicked() {
                    e.t0("Interstitial", "onAdClicked");
                    super.onAdClicked();
                }

                @Override
                public void onAdDismissedFullScreenContent() {
                    e.t0("Interstitial", "onAdDismissedFullScreenContent");
                    super.onAdDismissedFullScreenContent();
                    e.this.c0();
                }

                @Override
                public void onAdFailedToShowFullScreenContent(AdError adError) {
                    Log.e("Interstitial", "onAdFailedToShowFullScreenContent: " + adError);
                    super.onAdFailedToShowFullScreenContent(adError);
                }

                @Override
                public void onAdImpression() {
                    e.t0("Interstitial", "onAdImpression");
                    super.onAdImpression();
                }

                @Override
                public void onAdShowedFullScreenContent() {
                    e.t0("Interstitial", "onAdShowedFullScreenContent");
                    e.this.f18397x = null;
                    super.onAdShowedFullScreenContent();
                }
            }

            a() {
            }

            @Override
            public void onAdLoaded(InterstitialAd interstitialAd) {
                super.onAdLoaded(interstitialAd);
                e.t0("Interstitial", "onAdLoaded");
                e.this.f18397x = interstitialAd;
                e.this.f18397x.setFullScreenContentCallback(new C0076a());
            }

            @Override
            public void onAdFailedToLoad(LoadAdError loadAdError) {
                super.onAdFailedToLoad(loadAdError);
                Log.e("Interstitial", "onAdFailedToLoad: " + loadAdError);
                e.this.f18397x = null;
            }
        }

        g() {
        }

        @Override
        public void run() {
            if (e.this.f18397x == null && !FreeTelecActivity.E) {
                InterstitialAd.load(FreeTelecActivity.C, "ca-app-pub-6158104124729127/2326649045", new AdRequest.Builder().build(), new a());
            }
        }
    }

    static {
        Boolean bool = Boolean.FALSE;
        f18372y = bool;
        f18373z = null;
        A = bool;
        B = bool;
        C = bool;
        D = bool;
        E = new HashSet<>();
        F = false;
        G = false;
        H = "Vérifiez que vous êtes bien connecté au réseau wifi de votre Freebox";
    }

    public e(Context context) {
        Context applicationContext = context.getApplicationContext();
        this.f18374a = applicationContext;
        Log.i("FreeTelecSingleton", "using application context: " + applicationContext);
        if (HttpResponseCache.getInstalled() == null) {
            s0("Adding a http cache");
            try {
                HttpResponseCache.install(new File(context.getCacheDir(), "http"), 10485760L);
            } catch (IOException unused) {
                Log.e("FreeTelecSingleton", "failed to configure http cache");
            }
        } else {
            s0("http cache already configured");
        }
        this.f18392s = FirebaseAnalytics.getInstance(context);
        this.f18375b = false;
        i2.d.p(context);
        com.google.firebase.remoteconfig.a k6 = com.google.firebase.remoteconfig.a.k();
        this.f18395v = k6;
        HashMap hashMap = new HashMap();
        hashMap.put("min_interstitial_interval", 3600000);
        k6.t(new k.b().e(3600L).d(1500L).c());
        k6.u(hashMap);
        k6.i().c(new y1.d() {
            @Override
            public final void a(y1.i iVar) {
                fr.r0ro.android.FreeTelec.e.this.U(iVar);
            }
        });
        SharedPreferences sharedPreferences = context.getSharedPreferences("fr.r0ro.freetelec.PREFS", 0);
        this.f18396w = sharedPreferences;
        t0("Interstitial", "pref: " + sharedPreferences);
        b0();
    }

    public void J() {
        if (!B.booleanValue() && !A.booleanValue() && !C.booleanValue()) {
            s0("Scan is over, found " + E.size() + " telecs");
            Iterator<h> it = E.iterator();
            while (it.hasNext()) {
                s0("> " + it.next());
            }
            D = Boolean.FALSE;
            FreeTelecActivity freeTelecActivity = FreeTelecActivity.C;
            if (freeTelecActivity != null) {
                freeTelecActivity.z();
            }
            int size = E.size();
            if (size == 0) {
                ConnectivityManager connectivityManager = (ConnectivityManager) this.f18374a.getSystemService("connectivity");
                if (connectivityManager == null) {
                    H = "Impossible de vérifier les paramètres de connexion wifi";
                } else {
                    NetworkInfo networkInfo = connectivityManager.getNetworkInfo(1);
                    if (networkInfo != null && networkInfo.isConnected()) {
                        WifiInfo connectionInfo = ((WifiManager) this.f18374a.getApplicationContext().getSystemService("wifi")).getConnectionInfo();
                        if (connectionInfo != null) {
                            this.f18389p = connectionInfo.getSSID();
                        }
                        if (this.f18389p.compareToIgnoreCase("FreeWifi") == 0 || this.f18389p.compareToIgnoreCase("FreeWifi_secure") == 0) {
                            H = "Pour utilisez cette application vous devez vous connecter sur votre réseau personnel et pas sur " + this.f18389p;
                        } else {
                            H = "Vérifiez que votre Freebox est allumée et qu'elle est bien sur le même réseau Wifi que votre téléphone";
                        }
                    } else {
                        H = "Vous devez être connecté en WIFI sur votre réseau personnel pour utiliser cette application";
                    }
                }
                FreeTelecActivity.C.runOnUiThread(new Runnable() {
                    @Override
                    public final void run() {
                        fr.r0ro.android.FreeTelec.e.this.Q();
                    }
                });
                return;
            }
            if (this.f18376c) {
                c0();
            }
            if (size == 1) {
                n0(E.iterator().next());
                return;
            }
            ArrayList arrayList = new ArrayList();
            final h[] hVarArr = (h[]) E.toArray(new h[0]);
            for (h hVar : hVarArr) {
                arrayList.add(hVar.f18421a);
            }
            final String[] strArr = (String[]) arrayList.toArray(new String[0]);
            FreeTelecActivity.C.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    fr.r0ro.android.FreeTelec.e.this.S(strArr, hVarArr);
                }
            });
            return;
        }
        s0("wait for scan to be over  http: " + B + " mdns: " + A + " atv: " + C);
    }

    public static e L(Context context) {
        if (f18373z == null) {
            Log.w("FreeTelecSingleton", "CREATE INSTANCE: " + context);
            f18373z = new e(context);
        }
        return f18373z;
    }

    public void O() {
        if (this.f18387n.a()) {
            p0(false);
        } else {
            g0();
        }
    }

    public void P(g2.e eVar) {
        Log.e("RGPD", "onConsentInfoUpdateFailure: " + eVar.a() + " / " + eVar.b());
        g0();
    }

    public void Q() {
        AlertDialog alertDialog = this.f18391r;
        if (alertDialog != null && alertDialog.isShowing()) {
            this.f18391r.dismiss();
        }
        AlertDialog create = new AlertDialog.Builder(FreeTelecActivity.C).create();
        this.f18391r = create;
        create.setTitle("Aucune Freebox détéctée");
        this.f18391r.setMessage(H);
        this.f18391r.setButton(-2, "Annuler", new d());
        this.f18391r.setButton(-1, "Réessayer", new DialogInterfaceOnClickListenerC0075e());
        this.f18391r.setButton(-3, "Diagnostic", new f());
        try {
            this.f18391r.show();
        } catch (WindowManager.BadTokenException e6) {
            Log.e("FreeTelecSingleton", "bad token exception: " + e6);
        }
    }

    public void R(h[] hVarArr, DialogInterface dialogInterface, int i6) {
        if (i6 >= 0 && i6 < hVarArr.length) {
            n0(hVarArr[i6]);
            dialogInterface.dismiss();
            this.f18391r = null;
            return;
        }
        Log.e("Telec", "INTERNAL ERROR");
    }

    public void S(String[] strArr, final h[] hVarArr) {
        AlertDialog.Builder builder = new AlertDialog.Builder(FreeTelecActivity.C);
        builder.setTitle("Choix de la Freebox");
        builder.setCancelable(false);
        builder.setSingleChoiceItems(strArr, -1, new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i6) {
                fr.r0ro.android.FreeTelec.e.this.R(hVarArr, dialogInterface, i6);
            }
        });
        AlertDialog create = builder.create();
        this.f18391r = create;
        create.show();
    }

    public void T(InitializationStatus initializationStatus) {
        Log.i("ADS", "initializationStatus");
        for (Map.Entry<String, AdapterStatus> entry : initializationStatus.getAdapterStatusMap().entrySet()) {
            AdapterStatus value = entry.getValue();
            Log.i("ADS", "> " + entry.getKey() + " : " + value.getInitializationState() + " / " + value.getDescription());
        }
        d0();
    }

    public void U(y1.i iVar) {
        this.f18375b = true;
        if (iVar.n()) {
            boolean booleanValue = ((Boolean) iVar.k()).booleanValue();
            StringBuilder sb = new StringBuilder();
            sb.append("Config params updated: ");
            sb.append(booleanValue);
        } else {
            Log.e("FreeTelecSingleton", "Config params fetch failed");
        }
        m0(false);
    }

    public void V() {
        this.f18378e.a();
    }

    public void W() {
        h hVar = this.f18378e;
        if (hVar != null) {
            hVar.a();
            i iVar = i.f18424j0;
            if (iVar != null) {
                iVar.p1(this.f18378e);
            }
        }
        Context context = this.f18374a;
        h hVar2 = this.f18378e;
        Toast.makeText(context, hVar2 != null ? hVar2.f18421a : "Déconnecté", 0).show();
    }

    public void X() {
        if (this.f18397x != null) {
            t0("Interstitial", "show interstitial");
            i0();
            this.f18397x.show(FreeTelecActivity.C);
            StringBuilder sb = new StringBuilder();
            sb.append("Will show interstitial from ");
            sb.append(this.f18397x.getResponseInfo().getMediationAdapterClassName());
            return;
        }
        t0("Interstitial", "interstitial not ready");
    }

    public void Y(boolean z5, g2.e eVar) {
        if (eVar != null) {
            Log.e("RGPD", "dismissed: " + eVar.a() + " / " + eVar.b());
            p0(z5);
            return;
        }
        Log.i("RGPD", "form dismissed");
        g0();
    }

    public void Z(final boolean z5, g2.b bVar) {
        this.f18388o = bVar;
        int c6 = this.f18387n.c();
        if (!z5 && c6 != 2) {
            Log.i("RGPD", "status: " + c6);
            g0();
            return;
        }
        Log.i("RGPD", "need to get consent");
        try {
            this.f18388o.a(FreeTelecActivity.C, new b.a() {
                @Override
                public final void a(g2.e eVar) {
                    fr.r0ro.android.FreeTelec.e.this.Y(z5, eVar);
                }
            });
        } catch (WindowManager.BadTokenException unused) {
        }
    }

    public void a0(g2.e eVar) {
        Log.e("RGPD", "failed to load form: " + eVar.a() + " / " + eVar.b());
        g0();
    }

    public void c0() {
        FreeTelecActivity freeTelecActivity = FreeTelecActivity.C;
        if (freeTelecActivity == null) {
            return;
        }
        freeTelecActivity.runOnUiThread(new g());
    }

    private void d0() {
        this.f18376c = true;
        m0(false);
        i n12 = i.n1();
        if (n12 != null) {
            n12.o1();
        }
        if (FreeTelecActivity.E) {
            return;
        }
        fr.r0ro.android.FreeTelec.a aVar = fr.r0ro.android.FreeTelec.a.A0;
        if (aVar != null) {
            aVar.s1();
        }
        c0();
    }

    private void g0() {
        Log.i("RGPD", "rgpdDone");
        this.f18394u = null;
        if (G) {
            F = true;
            G = false;
            m0(false);
        }
    }

    private void h0() {
        try {
            FileOutputStream openFileOutput = this.f18374a.openFileOutput("favorites", 0);
            ObjectOutputStream objectOutputStream = new ObjectOutputStream(openFileOutput);
            objectOutputStream.writeObject(this.f18393t);
            objectOutputStream.flush();
            openFileOutput.close();
            ((a.f) fr.r0ro.android.FreeTelec.d.B0.m1()).notifyDataSetChanged();
        } catch (Exception e6) {
            if (FreeTelecApp.f18297c.booleanValue()) {
                Log.w("Main", "unable to save favorites: " + e6);
            }
        }
    }

    private void i0() {
        Date date = new Date();
        SharedPreferences.Editor edit = this.f18396w.edit();
        edit.putLong("lastShown", date.getTime());
        edit.apply();
    }

    private void j0() {
        t0("AtvDiscover", "scanAtvRemote");
        if (C.booleanValue()) {
            Log.w("AtvDiscover", "already scanning");
            return;
        }
        C = Boolean.TRUE;
        e2.e eVar = this.f18379f;
        if (eVar == null) {
            this.f18379f = new e2.e(this.f18374a);
        } else {
            eVar.d();
        }
        this.f18380g.removeCallbacks(this.f18382i);
        this.f18381h.clear();
        this.f18379f.c(new c(), this.f18380g);
    }

    private void k0() {
        if (PreferenceManager.getDefaultSharedPreferences(this.f18374a).getBoolean("disable_v5", false)) {
            s0("http scan disabled");
            return;
        }
        if (B.booleanValue()) {
            s0("http already scanning");
            return;
        }
        B = Boolean.TRUE;
        s0("start http scan");
        this.f18383j = false;
        this.f18384k = false;
        o.E(this.f18374a, "hd1.freebox.fr");
        o.E(this.f18374a, "hd2.freebox.fr");
    }

    private void l0() {
        if (A.booleanValue()) {
            t0("MDNS", "mdns already scanning");
            return;
        }
        if (this.f18377d == null) {
            this.f18377d = new FreeboxScanner(this.f18374a, new a());
        }
        t0("MDNS", "start mdns scan");
        A = Boolean.TRUE;
        HashSet<h> hashSet = E;
        E = new HashSet<>();
        Iterator<h> it = hashSet.iterator();
        while (it.hasNext()) {
            h next = it.next();
            int i6 = next.f18422b;
            if (i6 != 2 && i6 != 4) {
                E.add(next);
            }
        }
        this.f18377d.startScan(5);
    }

    private void n0(h hVar) {
        s0("Selected " + hVar);
        h hVar2 = this.f18378e;
        if (hVar2 != null) {
            hVar2.b();
        }
        this.f18378e = hVar;
        FreeTelecActivity.C.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                fr.r0ro.android.FreeTelec.e.this.W();
            }
        });
        WearableListener wearableListener = WearableListener.f18300x;
        if (wearableListener != null) {
            wearableListener.E();
        }
    }

    private static void s0(String str) {
        f18372y.booleanValue();
    }

    public static void t0(String str, String str2) {
        f18372y.booleanValue();
    }

    public void E(int i6) {
        ArrayList<Integer> arrayList = this.f18393t;
        if (arrayList != null) {
            if (!arrayList.contains(Integer.valueOf(i6))) {
                this.f18393t.add(Integer.valueOf(i6));
                Collections.sort(this.f18393t);
                h0();
            } else if (FreeTelecApp.f18297c.booleanValue()) {
                Log.w("Favorite", "unable to add channel : " + i6);
            }
        }
    }

    public boolean F() {
        t0("Interstitial", "canShowInterstitial");
        if (FreeTelecActivity.E) {
            t0("Interstitial", "don't show ads to premium");
            return false;
        }
        if (this.f18378e == null) {
            t0("Interstitial", "no remote selected");
            return false;
        }
        if (q0() >= this.f18395v.j("min_interstitial_interval")) {
            return true;
        }
        t0("Interstitial", "too soon");
        return false;
    }

    void G() {
        Log.w("RGPD", "need to ask rgpd");
        if (FreeTelecActivity.E) {
            Log.i("RGPD", "is premium");
            g0();
        } else {
            Log.w("RGPD", "asking RGPD");
            H();
        }
    }

    void H() {
        g2.d a6 = new d.a().b(false).a();
        g2.c a7 = g2.f.a(this.f18374a);
        this.f18387n = a7;
        a7.b(FreeTelecActivity.C, a6, new c.b() {
            @Override
            public final void a() {
                fr.r0ro.android.FreeTelec.e.this.O();
            }
        }, new c.a() {
            @Override
            public final void a(g2.e eVar) {
                fr.r0ro.android.FreeTelec.e.this.P(eVar);
            }
        });
    }

    public void I() {
        Log.i("RGPD", "editRgpd");
        p0(true);
    }

    public AdRequest K() {
        if (this.f18394u == null) {
            this.f18394u = new AdRequest.Builder();
        }
        return this.f18394u.build();
    }

    public void M() {
        if (!this.f18376c && FreeTelecActivity.F) {
            if (FreeTelecActivity.E) {
                d0();
            } else {
                if (FreeTelecActivity.C == null) {
                    return;
                }
                MobileAds.setRequestConfiguration(new RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("B3EEABB8EE11C2BE770B684D95219ECB")).build());
                MobileAds.initialize(FreeTelecActivity.C, new OnInitializationCompleteListener() {
                    @Override
                    public final void onInitializationComplete(InitializationStatus initializationStatus) {
                        fr.r0ro.android.FreeTelec.e.this.T(initializationStatus);
                    }
                });
            }
        }
    }

    public boolean N() {
        return this.f18376c;
    }

    public void b0() {
        if (this.f18393t != null) {
            return;
        }
        try {
            ObjectInputStream objectInputStream = new ObjectInputStream(this.f18374a.openFileInput("favorites"));
            this.f18393t = (ArrayList) objectInputStream.readObject();
            objectInputStream.close();
        } catch (FileNotFoundException unused) {
            s0("no previous favorites");
            this.f18393t = new ArrayList<>();
        } catch (Exception e6) {
            if (FreeTelecApp.f18297c.booleanValue()) {
                Log.w("Main", "unable to restore favorites: " + e6);
            }
            this.f18393t = new ArrayList<>();
        }
    }

    public void e0(String str, boolean z5, String str2) {
        String str3;
        if ("hd1.freebox.fr".equals(str)) {
            s0("got HD1 http scan result: " + z5 + " reason: " + str2);
            this.f18383j = true;
            this.f18385l = str2;
            str3 = "Freebox HD 1";
        } else if ("hd2.freebox.fr".equals(str)) {
            s0("got HD2 http scan result: " + z5 + " reason: " + str2);
            this.f18384k = true;
            this.f18386m = str2;
            str3 = "Freebox HD 2";
        } else {
            Log.e("FreeTelecSingleton", "unexpected http scan result for " + str);
            return;
        }
        if (this.f18383j && this.f18384k) {
            B = Boolean.FALSE;
        }
        o oVar = null;
        Iterator<h> it = E.iterator();
        while (true) {
            if (!it.hasNext()) {
                break;
            }
            h next = it.next();
            if (next.f18422b == 1) {
                o oVar2 = (o) next;
                if (oVar2.f18473i.equals(str)) {
                    s0("found previous entry of http telec " + str);
                    oVar = oVar2;
                    break;
                }
            }
        }
        if (z5) {
            if (oVar == null) {
                E.add(new o(this.f18374a, str3, str));
            }
        } else if (oVar != null) {
            E.remove(oVar);
        }
        J();
    }

    public void f0(int i6) {
        if (this.f18393t != null) {
            t0("Favorite", "trying to remove channel " + i6 + " from favorites");
            int indexOf = this.f18393t.indexOf(Integer.valueOf(i6));
            if (indexOf >= 0) {
                this.f18393t.remove(indexOf);
                h0();
                return;
            }
            if (FreeTelecApp.f18297c.booleanValue()) {
                Log.w("Favorite", "unable to find pos");
                for (int i7 = 0; i7 < this.f18393t.size(); i7++) {
                    t0("Favorite", "pos: " + i7 + " channel : " + this.f18393t.get(i7));
                }
            }
        }
    }

    public void m0(boolean z5) {
        if (!this.f18375b) {
            Log.i("FreeTelecSingleton", "need to fetch remote config");
            return;
        }
        if (!this.f18376c) {
            Log.i("FreeTelecSingleton", "need to wait for ads to be ready");
            return;
        }
        if (!F) {
            if (G) {
                return;
            }
            G = true;
            G();
            return;
        }
        if (D.booleanValue()) {
            Log.w("Telec", "Already scanning !!!!");
            return;
        }
        s0("Scan telec " + z5);
        if (this.f18378e != null && !z5) {
            FreeTelecActivity.C.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    fr.r0ro.android.FreeTelec.e.this.V();
                }
            });
            return;
        }
        D = Boolean.TRUE;
        FreeTelecActivity freeTelecActivity = FreeTelecActivity.C;
        if (freeTelecActivity != null) {
            freeTelecActivity.I();
        }
        l0();
        j0();
        k0();
    }

    public void o0() {
        FreeTelecActivity freeTelecActivity = FreeTelecActivity.C;
        if (freeTelecActivity == null) {
            return;
        }
        freeTelecActivity.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                fr.r0ro.android.FreeTelec.e.this.X();
            }
        });
    }

    void p0(final boolean z5) {
        g2.f.b(this.f18374a, new f.b() {
            @Override
            public final void a(g2.b bVar) {
                fr.r0ro.android.FreeTelec.e.this.Z(z5, bVar);
            }
        }, new f.a() {
            @Override
            public final void b(g2.e eVar) {
                fr.r0ro.android.FreeTelec.e.this.a0(eVar);
            }
        });
    }

    public long q0() {
        Date date = new Date();
        long j6 = 0;
        long j7 = this.f18396w.getLong("lastShown", 0L);
        if (j7 > date.getTime() + 30000) {
            Log.wtf("Interstitial", "incoherent value: " + j7);
        } else {
            j6 = j7;
        }
        return date.getTime() - j6;
    }

    public void r0(String str) {
        if (this.f18392s == null) {
            if (FreeTelecActivity.C == null) {
                return;
            }
            Log.e("ANALYTICS", "analytics is null");
            return;
        }
        Bundle bundle = new Bundle();
        bundle.putString("item_name", str);
        bundle.putString("content_type", "view");
        this.f18392s.a("view_item", bundle);
        if (FreeTelecApp.f18297c.booleanValue()) {
            StringBuilder sb = new StringBuilder();
            sb.append("Track ");
            sb.append(str);
        }
    }
}