package com.discord.app; import android.content.SharedPreferences; import com.discord.models.experiments.domain.Experiment; import com.discord.stores.StoreExperiments; import com.discord.utilities.cache.SharedPreferencesProvider; import com.discord.utilities.rx.ObservableExtensionsKt; import d0.g; import d0.z.d.m; import d0.z.d.o; import kotlin.Lazy; import kotlin.jvm.functions.Function0; import rx.Observable; import rx.functions.Action1; /* compiled from: RebrandFeatureFlag.kt */ public final class RebrandFeatureFlag { public static final Lazy a = g.lazy(a.i); public static boolean b; /* renamed from: c reason: collision with root package name */ public static final RebrandFeatureFlag f1591c = null; public int d; public final SharedPreferences e; /* compiled from: RebrandFeatureFlag.kt */ public static final class a extends o implements Function0 { public static final a i = new a(); public a() { super(0); } /* Return type fixed from 'java.lang.Object' to match base method */ @Override // kotlin.jvm.functions.Function0 /* renamed from: invoke */ public RebrandFeatureFlag mo1invoke() { return new RebrandFeatureFlag(null, 1); } } /* compiled from: RebrandFeatureFlag.kt */ public static final class b implements j0.k.b { public static final b i = new b(); /* Return type fixed from 'java.lang.Object' to match base method */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // j0.k.b public Boolean call(Experiment experiment) { return Boolean.valueOf(experiment != null); } } /* compiled from: RebrandFeatureFlag.kt */ public static final class c implements Action1 { public final /* synthetic */ RebrandFeatureFlag i; public c(RebrandFeatureFlag rebrandFeatureFlag) { this.i = rebrandFeatureFlag; } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // rx.functions.Action1 public void call(Experiment experiment) { Experiment experiment2 = experiment; if (experiment2 != null) { this.i.d = experiment2.getBucket(); RebrandFeatureFlag rebrandFeatureFlag = RebrandFeatureFlag.f1591c; RebrandFeatureFlag rebrandFeatureFlag2 = this.i; boolean z2 = true; if (rebrandFeatureFlag2.d < 1) { z2 = false; } RebrandFeatureFlag.b = z2; rebrandFeatureFlag2.e.edit().putInt("CACHE_KEY_REBRAND_EXPERIMENT_BUCKET", experiment2.getBucket()).apply(); } } } public RebrandFeatureFlag() { this(null, 1); } public RebrandFeatureFlag(SharedPreferences sharedPreferences, int i) { boolean z2 = true; SharedPreferences sharedPreferences2 = (i & 1) != 0 ? SharedPreferencesProvider.INSTANCE.get() : null; m.checkNotNullParameter(sharedPreferences2, "sharedPreferences"); this.e = sharedPreferences2; this.d = -1; int i2 = sharedPreferences2.getInt("CACHE_KEY_REBRAND_EXPERIMENT_BUCKET", -1); if (i2 != -1) { this.d = i2; b = i2 < 1 ? false : z2; } } public static final RebrandFeatureFlag a() { return (RebrandFeatureFlag) a.getValue(); } public final Observable b(StoreExperiments storeExperiments) { Observable t = storeExperiments.observeUserExperiment("2021-04_product_rebrand", true).x(b.i).Z(1).t(new c(this)); m.checkNotNullExpressionValue(t, "storeExperiments.observeā€¦nt)\n }\n }"); return ObservableExtensionsKt.computationLatest(t); } }