package defpackage;

import android.content.SharedPreferences;
import androidx.media3.container.NalUnitUtil;
import androidx.media3.exoplayer.upstream.CmcdData;
import com.strmr.ps.data.model.StreamInfo;
import kotlin.Metadata;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\bÆ\u0002\u0018\u00002\u00020\u0001:\u0001\u0002¨\u0006\u0003"}, d2 = {"Lae8;", "", CmcdData.OBJECT_TYPE_AUDIO_ONLY, "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
public final class ae8 {
    public static SharedPreferences a;

    @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\b\u0086\b\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lae8$a;", "", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final /* data */ class a {
        public final int a;
        public final String b;
        public final int c;

        public a(int i, String str, int i2) {
            this.a = i;
            this.b = str;
            this.c = i2;
        }

        public final boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (!(obj instanceof a)) {
                return false;
            }
            a aVar = (a) obj;
            return this.a == aVar.a && cr4.b(this.b, aVar.b) && this.c == aVar.c;
        }

        public final int hashCode() {
            return Integer.hashCode(this.c) + vw2.b(Integer.hashCode(this.a) * 31, 31, this.b);
        }

        public final String toString() {
            return n41.q(fi7.k("PreferredPack(showTmdbId=", this.a, ", infoHash=", this.b, ", season="), this.c, ")");
        }
    }

    public static a a(int i, int i2) {
        int i3;
        int i4;
        String string;
        SharedPreferences sharedPreferences = a;
        if (sharedPreferences != null && (i3 = sharedPreferences.getInt("show_tmdb_id", -1)) == i && (i4 = sharedPreferences.getInt("season", -1)) == i2 && (string = sharedPreferences.getString("info_hash", null)) != null) {
            return new a(i3, string, i4);
        }
        return null;
    }

    public static a b(int i) {
        int i2;
        String string;
        SharedPreferences sharedPreferences = a;
        if (sharedPreferences == null || (i2 = sharedPreferences.getInt("show_tmdb_id", -1)) != i || (string = sharedPreferences.getString("info_hash", null)) == null) {
            return null;
        }
        return new a(i2, string, sharedPreferences.getInt("season", -1));
    }

    public static void c(int i, int i2, StreamInfo streamInfo) {
        SharedPreferences sharedPreferences;
        SharedPreferences.Editor editorEdit;
        SharedPreferences.Editor editorPutInt;
        SharedPreferences.Editor editorPutString;
        SharedPreferences.Editor editorPutInt2;
        cr4.g(streamInfo, "stream");
        if (!streamInfo.isSeasonPack() || n89.ab(streamInfo.getInfoHash()) || (sharedPreferences = a) == null || (editorEdit = sharedPreferences.edit()) == null || (editorPutInt = editorEdit.putInt("show_tmdb_id", i)) == null || (editorPutString = editorPutInt.putString("info_hash", streamInfo.getInfoHash())) == null || (editorPutInt2 = editorPutString.putInt("season", i2)) == null) {
            return;
        }
        editorPutInt2.apply();
    }
}
