Swiggy v4.51.1版本的 MD5 值为:5af7ec91512a0a8c1510e3f8bac20b8b
以下内容为反编译后的 QuizLoaderViewModel.java 源代码,内容仅作参考
package in.swiggy.android.web.loader;
import android.content.SharedPreferences;
import android.graphics.drawable.Drawable;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.newrelic.agent.android.instrumentation.GsonInstrumentation;
import in.swiggy.android.commons.extension.KotlinExtensionsKt;
import in.swiggy.android.commons.utils.i0;
import in.swiggy.android.commonsui.ui.f;
import in.swiggy.android.mvvm.services.s;
import in.swiggy.android.tejas.feature.home.model.progressivebanner.ProgressiveBannerConfig;
import in.swiggy.android.web.e;
import java.lang.reflect.Type;
import kotlin.j;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.o;
import kotlin.l;
import kotlin.text.q;
public final class QuizLoaderViewModel extends c {
public static final a m = new a(null);
private final s c;
private final SharedPreferences d;
private final j e;
private final j f;
private final Drawable g;
private final int h;
private final j i;
private final String j;
private final boolean k;
private final int l;
public static final class a {
public a(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private a() {
}
}
public QuizLoaderViewModel(s resourcesService, SharedPreferences sharedPreferences) {
j b;
j b2;
j b3;
String str;
String str2;
boolean z;
boolean C;
o.k(resourcesService, "resourcesService");
o.k(sharedPreferences, "sharedPreferences");
this.c = resourcesService;
this.d = sharedPreferences;
b = l.b(new Function0<ProgressiveBannerConfig>() {
public static final class a extends TypeToken<ProgressiveBannerConfig> {
}
public static final class b extends TypeToken<ProgressiveBannerConfig> {
}
{
super(0);
}
@Override
public final ProgressiveBannerConfig invoke() {
Object fromJson;
try {
String string = QuizLoaderViewModel.this.n().getString("progressive_banner_config", "{\"enableFilterTriggerCount\":2,\"disableFilterTriggerCount\":2,\"inProgressState\":{\"title\":\"You’ve completed %d% already!\",\"subtitle\":\"Only %d more questions to get better suggestions\",\"iconId\":\"MERCHANDISING_BANNERS/IMAGES/MERCH/2023/11/27/b7d3fa38-6732-47a2-b7c9-30bc490137cf_in progress.png\"},\"endState\":{\"title\":\"You’ve got quite a taste 👌\",\"subtitle\":\"We’re working to bring\nbetter recommendations\nto you soon!\",\"iconId\":\"MERCHANDISING_BANNERS/IMAGES/MERCH/2023/11/27/275ce722-79e0-41df-8b0b-5ab762ba497a_start.png\"},\"loaderLottieUrl\":\"https://media-assets.swiggy.com/swiggy/image/upload/loader_optimized.json\",\"loaderBgColor\":\"#1B222E\",\"loaderText\":\"Finding the right questions to get to know you better:)\"}");
if (!in.swiggy.android.constants.b.a.l(string)) {
Gson g = i0.g();
o.j(g, "getGson(...)");
Type type = new a().getType();
if (!(g instanceof Gson)) {
fromJson = g.fromJson("{\"enableFilterTriggerCount\":2,\"disableFilterTriggerCount\":2,\"inProgressState\":{\"title\":\"You’ve completed %d% already!\",\"subtitle\":\"Only %d more questions to get better suggestions\",\"iconId\":\"MERCHANDISING_BANNERS/IMAGES/MERCH/2023/11/27/b7d3fa38-6732-47a2-b7c9-30bc490137cf_in progress.png\"},\"endState\":{\"title\":\"You’ve got quite a taste 👌\",\"subtitle\":\"We’re working to bring\nbetter recommendations\nto you soon!\",\"iconId\":\"MERCHANDISING_BANNERS/IMAGES/MERCH/2023/11/27/275ce722-79e0-41df-8b0b-5ab762ba497a_start.png\"},\"loaderLottieUrl\":\"https://media-assets.swiggy.com/swiggy/image/upload/loader_optimized.json\",\"loaderBgColor\":\"#1B222E\",\"loaderText\":\"Finding the right questions to get to know you better:)\"}", type);
} else {
fromJson = GsonInstrumentation.fromJson(g, "{\"enableFilterTriggerCount\":2,\"disableFilterTriggerCount\":2,\"inProgressState\":{\"title\":\"You’ve completed %d% already!\",\"subtitle\":\"Only %d more questions to get better suggestions\",\"iconId\":\"MERCHANDISING_BANNERS/IMAGES/MERCH/2023/11/27/b7d3fa38-6732-47a2-b7c9-30bc490137cf_in progress.png\"},\"endState\":{\"title\":\"You’ve got quite a taste 👌\",\"subtitle\":\"We’re working to bring\nbetter recommendations\nto you soon!\",\"iconId\":\"MERCHANDISING_BANNERS/IMAGES/MERCH/2023/11/27/275ce722-79e0-41df-8b0b-5ab762ba497a_start.png\"},\"loaderLottieUrl\":\"https://media-assets.swiggy.com/swiggy/image/upload/loader_optimized.json\",\"loaderBgColor\":\"#1B222E\",\"loaderText\":\"Finding the right questions to get to know you better:)\"}", type);
}
} else {
Gson g2 = i0.g();
o.j(g2, "getGson(...)");
Type type2 = new b().getType();
if (!(g2 instanceof Gson)) {
fromJson = g2.fromJson(string, type2);
} else {
fromJson = GsonInstrumentation.fromJson(g2, string, type2);
}
}
return (ProgressiveBannerConfig) fromJson;
} catch (Exception unused) {
return null;
}
}
});
this.e = b;
b2 = l.b(new Function0<String>() {
{
super(0);
}
@Override
public final String invoke() {
ProgressiveBannerConfig l;
l = QuizLoaderViewModel.this.l();
if (l != null) {
return l.getLoaderLottieUrl();
}
return null;
}
});
this.f = b2;
this.g = resourcesService.c(e.instamart_lottie_placeholder);
this.h = 100;
b3 = l.b(new Function0<Integer>() {
@Override
public final Integer invoke() {
return 1;
}
});
this.i = b3;
ProgressiveBannerConfig l = l();
if (l != null) {
str = l.getLoaderText();
} else {
str = null;
}
this.j = str;
ProgressiveBannerConfig l2 = l();
if (l2 != null) {
str2 = l2.getLoaderText();
} else {
str2 = null;
}
if (str2 != null) {
C = q.C(str2);
if (!C) {
z = false;
this.k = KotlinExtensionsKt.e(Boolean.valueOf(z));
ProgressiveBannerConfig l3 = l();
this.l = in.swiggy.android.commons.extension.a.c(l3 != null ? l3.getLoaderBgColor() : null, resourcesService.n(f.quiz_bg_color));
}
}
z = true;
this.k = KotlinExtensionsKt.e(Boolean.valueOf(z));
ProgressiveBannerConfig l32 = l();
this.l = in.swiggy.android.commons.extension.a.c(l32 != null ? l32.getLoaderBgColor() : null, resourcesService.n(f.quiz_bg_color));
}
public final ProgressiveBannerConfig l() {
return (ProgressiveBannerConfig) this.e.getValue();
}
public final int f() {
return this.l;
}
public final String g() {
return (String) this.f.getValue();
}
public final String h() {
return this.j;
}
public final boolean i() {
return this.k;
}
public final int j() {
return this.h;
}
public final int k() {
return ((Number) this.i.getValue()).intValue();
}
public final Drawable m() {
return this.g;
}
public final SharedPreferences n() {
return this.d;
}
}