Swiggy v4.51.1版本的 MD5 值为:5af7ec91512a0a8c1510e3f8bac20b8b
以下内容为反编译后的 OnboardingFragmentViewModel.java 源代码,内容仅作参考
package in.swiggy.android.onboarding.viewmodel;
import android.content.SharedPreferences;
import androidx.databinding.ObservableField;
import androidx.databinding.ObservableFloat;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.y;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.gson.Gson;
import com.newrelic.agent.android.instrumentation.GsonInstrumentation;
import com.newrelic.agent.android.instrumentation.Instrumented;
import in.swiggy.android.R;
import in.swiggy.android.commons.utils.i0;
import in.swiggy.android.dls.button.ButtonType;
import in.swiggy.android.mvvm.aarch.CoreViewModel;
import in.swiggy.android.mvvm.viewmodels.loginsignup.LoginFragmentViewModel;
import in.swiggy.android.onboarding.c;
import in.swiggy.android.tejas.generated.ISwiggyNetworkWrapper;
import java.util.List;
import kotlin.Pair;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlinx.coroutines.v0;
import org.json.JSONObject;
@Instrumented
public final class OnboardingFragmentViewModel extends CoreViewModel {
private final ISwiggyNetworkWrapper e;
private final y<in.swiggy.android.commons.utils.l<in.swiggy.android.onboarding.c>> f;
private final LiveData<in.swiggy.android.commons.utils.l<in.swiggy.android.onboarding.c>> g;
public in.swiggy.android.mvvm.services.s h;
public in.swiggy.android.feature.web.a i;
public in.swiggy.android.analytics.newrelic.a j;
public in.swiggy.android.analytics.interfaces.c k;
public in.swiggy.android.repositories.interfaces.e l;
public in.swiggy.android.commons.utils.contextservice.h m;
public SharedPreferences n;
private final ObservableFloat o;
private final kotlin.j p;
private final ObservableField<String> q;
private final ObservableField<String> r;
private kotlinx.coroutines.flow.i<Pair<in.swiggy.android.onboarding.models.e, List<in.swiggy.android.onboarding.models.e>>> s;
private final kotlinx.coroutines.flow.s<Pair<in.swiggy.android.onboarding.models.e, List<in.swiggy.android.onboarding.models.e>>> t;
public OnboardingFragmentViewModel(ISwiggyNetworkWrapper mNetworkWrapper) {
kotlin.j b;
List n;
kotlin.jvm.internal.o.k(mNetworkWrapper, "mNetworkWrapper");
this.e = mNetworkWrapper;
y<in.swiggy.android.commons.utils.l<in.swiggy.android.onboarding.c>> yVar = new y<>();
this.f = yVar;
this.g = yVar;
this.o = new ObservableFloat(BitmapDescriptorFactory.HUE_RED);
b = kotlin.l.b(new Function0<in.swiggy.android.dls.button.a>() {
{
super(0);
}
@Override
public final in.swiggy.android.dls.button.a invoke() {
return new in.swiggy.android.dls.button.a(ButtonType.Primary, OnboardingFragmentViewModel.this.r0().getString(R.string.get_started), null, null, true);
}
});
this.p = b;
this.q = new ObservableField<>("Swiggy");
this.r = new ObservableField<>("your delicacy");
n = kotlin.collections.r.n();
kotlinx.coroutines.flow.i<Pair<in.swiggy.android.onboarding.models.e, List<in.swiggy.android.onboarding.models.e>>> a = kotlinx.coroutines.flow.t.a(new Pair(null, n));
this.s = a;
this.t = kotlinx.coroutines.flow.f.c(a);
}
private final String d7(String str) {
JSONObject jSONObject = new JSONObject();
jSONObject.put("button_name", str);
return in.swiggy.android.logging.utils.a.a(jSONObject);
}
private final String n7() {
return e3().H("enable_new_nu_du_flow", "default");
}
public final void o7() {
this.f.r(new in.swiggy.android.commons.utils.l<>(c.u.a));
}
public final void p7() {
g7().b(g7().q("onboarding-screen", "click-login", "-", 9999, d7(r0().getString(R.string.get_started))));
}
private final void q7() {
g7().j(g7().q("onboarding-screen", "impression-login", "-", 9999, d7(r0().getString(R.string.get_started))));
}
private final void r7() {
G().d(LoginFragmentViewModel.class, r0().getString(R.string.complete_the_next_steps_to_unlock_a_coupon));
}
private final void t7() {
this.f.r(new in.swiggy.android.commons.utils.l<>(new c.d0("https://media-assets.swiggy.com/swiggy/raw/upload/v1669042143/lottie/location_permission_lottie_updated.zip")));
}
private final void u7() {
q7();
}
public final in.swiggy.android.commons.utils.contextservice.h G() {
in.swiggy.android.commons.utils.contextservice.h hVar = this.m;
if (hVar != null) {
return hVar;
}
kotlin.jvm.internal.o.C("contextService");
return null;
}
@Override
public void U6() {
in.swiggy.android.searchutils.a aVar = in.swiggy.android.searchutils.a.a;
in.swiggy.android.analytics.gtm.g q = g7().q("onboarding-screen", "-", "-", 9999, aVar.f(aVar.f("{}", "variant_id", n7()), "XP", "enable_new_nu_du_flow"));
if (q != null) {
g7().f(q);
}
}
public final Object c7(long j, kotlin.coroutines.c<? super Unit> cVar) {
Object f;
Object g = kotlinx.coroutines.g.g(v0.a(), new OnboardingFragmentViewModel$checkForCategoryChange$2(this, j, null), cVar);
f = kotlin.coroutines.intrinsics.b.f();
if (g == f) {
return g;
}
return Unit.a;
}
public final in.swiggy.android.repositories.interfaces.e e3() {
in.swiggy.android.repositories.interfaces.e eVar = this.l;
if (eVar != null) {
return eVar;
}
kotlin.jvm.internal.o.C("xpExperimentContext");
return null;
}
public final in.swiggy.android.dls.button.a e7() {
return (in.swiggy.android.dls.button.a) this.p.getValue();
}
public final LiveData<in.swiggy.android.commons.utils.l<in.swiggy.android.onboarding.c>> f7() {
return this.g;
}
public final in.swiggy.android.analytics.interfaces.c g7() {
in.swiggy.android.analytics.interfaces.c cVar = this.k;
if (cVar != null) {
return cVar;
}
kotlin.jvm.internal.o.C("mSwiggyEventHandler");
return null;
}
public final kotlinx.coroutines.flow.s<Pair<in.swiggy.android.onboarding.models.e, List<in.swiggy.android.onboarding.models.e>>> h7() {
return this.t;
}
public final in.swiggy.android.onboarding.models.c i7(SharedPreferences sharedPreferences) {
Object fromJson;
kotlin.jvm.internal.o.k(sharedPreferences, "sharedPreferences");
String str = "{\"video_url\":\"https://media-assets.swiggy.com/swiggy/video/upload/v1685089112/Footage_Final_Shorter_xskkev.mp4\",\"video_id\":\"Footage_Final_Shorter_xskkev.mp4\",\"android_video_downscale_manufactures_enable\":\"oppo,vivo\",\"android_decoder_fallback_enable\":\"false\",\"video_sections\":[{\"start\":0,\"title\":\"Food\",\"subtitle\":\"Order from top restaurants\"},{\"start\":3,\"title\":\"Instamart\",\"subtitle\":\"Get groceries in 15-30 mins\"},{\"start\":8,\"title\":\"Dineout \",\"subtitle\":\"Up to 40% off on dining bills\"}]}";
String string = sharedPreferences.getString("nux_screen_data", "{\"video_url\":\"https://media-assets.swiggy.com/swiggy/video/upload/v1685089112/Footage_Final_Shorter_xskkev.mp4\",\"video_id\":\"Footage_Final_Shorter_xskkev.mp4\",\"android_video_downscale_manufactures_enable\":\"oppo,vivo\",\"android_decoder_fallback_enable\":\"false\",\"video_sections\":[{\"start\":0,\"title\":\"Food\",\"subtitle\":\"Order from top restaurants\"},{\"start\":3,\"title\":\"Instamart\",\"subtitle\":\"Get groceries in 15-30 mins\"},{\"start\":8,\"title\":\"Dineout \",\"subtitle\":\"Up to 40% off on dining bills\"}]}");
if (string != null) {
str = string;
}
Gson g = i0.g();
if (!(g instanceof Gson)) {
fromJson = g.fromJson(str, (Class<Object>) in.swiggy.android.onboarding.models.c.class);
} else {
fromJson = GsonInstrumentation.fromJson(g, str, (Class<Object>) in.swiggy.android.onboarding.models.c.class);
}
return (in.swiggy.android.onboarding.models.c) fromJson;
}
@Override
public void init() {
super.init();
r7();
u7();
t7();
}
public final ObservableFloat j7() {
return this.o;
}
public final Function0<Unit> k7() {
return new Function0<Unit>() {
{
super(0);
}
@Override
public Unit invoke() {
invoke2();
return Unit.a;
}
public final void invoke2() {
OnboardingFragmentViewModel.this.p7();
OnboardingFragmentViewModel.this.o7();
}
};
}
public final ObservableField<String> l7() {
return this.r;
}
public final ObservableField<String> m7() {
return this.q;
}
public final in.swiggy.android.mvvm.services.s r0() {
in.swiggy.android.mvvm.services.s sVar = this.h;
if (sVar != null) {
return sVar;
}
kotlin.jvm.internal.o.C("resourcesService");
return null;
}
public final Object s7(List<in.swiggy.android.onboarding.models.d> list, kotlin.coroutines.c<? super Unit> cVar) {
Object f;
Object g = kotlinx.coroutines.g.g(v0.a(), new OnboardingFragmentViewModel$parseOnBoardingTextChangeConfig$2(list, this, null), cVar);
f = kotlin.coroutines.intrinsics.b.f();
if (g == f) {
return g;
}
return Unit.a;
}
}