Swiggy v4.51.1版本的 MD5 值为:5af7ec91512a0a8c1510e3f8bac20b8b
以下内容为反编译后的 MenuLicenseViewModel.java 源代码,内容仅作参考
package in.swiggy.android.menu.footer;
import android.content.SharedPreferences;
import androidx.databinding.ObservableArrayList;
import androidx.databinding.ObservableBoolean;
import androidx.databinding.ObservableField;
import com.google.gson.Gson;
import com.newrelic.agent.android.instrumentation.GsonInstrumentation;
import com.newrelic.agent.android.instrumentation.Instrumented;
import in.swiggy.android.commons.extension.KotlinExtensionsKt;
import in.swiggy.android.commons.utils.contextservice.h;
import in.swiggy.android.commons.utils.i0;
import in.swiggy.android.commons.utils.x;
import in.swiggy.android.commonsui.ui.g;
import in.swiggy.android.menu.i;
import in.swiggy.android.menucommons.datamodel.c;
import in.swiggy.android.menucommons.intefaces.d;
import in.swiggy.android.mvvm.aarch.CoreViewModel;
import in.swiggy.android.mvvm.services.s;
import in.swiggy.android.tejas.feature.home.model.pageconfig.BannerType;
import in.swiggy.android.tejas.feature.home.model.pageconfig.CardType;
import in.swiggy.android.tejas.feature.home.model.pageconfig.PopUpWidgetCrossButtonPosition;
import in.swiggy.android.tejas.feature.menu.restlicense.model.RestaurantLicenseInfo;
import in.swiggy.android.tejas.oldapi.models.restaurant.Restaurant;
import java.util.List;
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;
@Instrumented
public final class MenuLicenseViewModel extends CoreViewModel {
public static final a s = new a(null);
private final RestaurantLicenseInfo e;
public s f;
public h g;
public SharedPreferences h;
public c i;
public d j;
public ObservableBoolean k;
private ObservableBoolean l;
private ObservableArrayList<in.swiggy.android.mvvm.base.c> m;
private in.swiggy.android.menucommons.viewmodel.b n;
private ObservableField<String> o;
private ObservableBoolean p;
private ObservableField<String> q;
private final j r;
public static final class a {
public a(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private a() {
}
}
public MenuLicenseViewModel(RestaurantLicenseInfo restaurantLicenseInfo) {
String str;
j b;
o.k(restaurantLicenseInfo, "restaurantLicenseInfo");
this.e = restaurantLicenseInfo;
this.l = new ObservableBoolean(false);
this.m = new ObservableArrayList<>();
List<String> textList = restaurantLicenseInfo.getTextList();
if (textList != null) {
str = textList.get(0);
} else {
str = null;
}
this.n = new in.swiggy.android.menucommons.viewmodel.b(str, false, false, null, 14, null);
this.o = new ObservableField<>("");
this.p = new ObservableBoolean(false);
this.q = new ObservableField<>("");
b = l.b(new Function0<String>() {
{
super(0);
}
@Override
public final String invoke() {
RestaurantLicenseInfo restaurantLicenseInfo2;
h G = MenuLicenseViewModel.this.G();
int m = MenuLicenseViewModel.this.j7().m(g.dimen_26dp);
int m2 = MenuLicenseViewModel.this.j7().m(g.dimen_52dp);
restaurantLicenseInfo2 = MenuLicenseViewModel.this.e;
return G.A(m, m2, restaurantLicenseInfo2.getImageId());
}
});
this.r = b;
}
private final String a7(String str) {
String str2;
String d = h7().d();
Long c = h7().c();
Restaurant f = h7().f();
if (f != null) {
str2 = f.mId;
} else {
str2 = null;
}
return str + "?context=MenuFeedback&request_id=" + d + "&load_timestamp=" + c + "&restaurant_id=" + str2;
}
private final void n7() {
this.m.clear();
this.m.add(new in.swiggy.android.menucommons.viewmodel.b(j7().getString(i.menu_price_disclaimer), false, false, null, 14, null));
this.m.add(new in.swiggy.android.menucommons.viewmodel.b(j7().getString(i.menu_nutrition_disclaimer), false, false, null, 14, null));
this.m.add(new in.swiggy.android.menucommons.viewmodel.b(j7().getString(i.menu_energy_disclaimer), false, false, null, 14, null));
this.m.add(new in.swiggy.android.menucommons.viewmodel.b(j7().getString(i.menu_ai_crafted_disclaimer), false, false, null, 14, null));
}
private final void o7() {
String str;
Object fromJson;
boolean C;
try {
Gson g = i0.g();
if (!(g instanceof Gson)) {
fromJson = g.fromJson("{\"webViewURL\":\"https://webviews.swiggy.com/feedback/menu.html\", \"showReportIssue\":true,\"reportIssueText\":\"Report an issue with the menu\"}", (Class<Object>) in.swiggy.android.menu.model.a.class);
} else {
fromJson = GsonInstrumentation.fromJson(g, "{\"webViewURL\":\"https://webviews.swiggy.com/feedback/menu.html\", \"showReportIssue\":true,\"reportIssueText\":\"Report an issue with the menu\"}", (Class<Object>) in.swiggy.android.menu.model.a.class);
}
in.swiggy.android.menu.model.a aVar = (in.swiggy.android.menu.model.a) fromJson;
if (aVar != null && o.f(aVar.b(), Boolean.TRUE)) {
this.p.h(true);
this.o.h(aVar.a());
String c = aVar.c();
if (c != null) {
C = q.C(c);
if (!C) {
this.q.h(aVar.c());
return;
}
}
this.q.h("");
return;
}
this.p.h(false);
this.o.h("");
} catch (Exception e) {
if (!MenuLicenseViewModel.class.isAnonymousClass()) {
str = MenuLicenseViewModel.class.getSimpleName();
if (str.length() > 23) {
o.h(str);
str = str.substring(0, 23);
o.j(str, "substring(...)");
}
o.h(str);
} else {
String name = MenuLicenseViewModel.class.getName();
if (name.length() > 23) {
o.h(name);
name = name.substring(name.length() - 23, name.length());
o.j(name, "substring(...)");
}
str = name;
o.h(str);
}
x.b(str, e.toString());
}
}
public final h G() {
h hVar = this.g;
if (hVar != null) {
return hVar;
}
o.C("contextService");
return null;
}
public final ObservableArrayList<in.swiggy.android.mvvm.base.c> b7() {
return this.m;
}
public final ObservableBoolean c7() {
return this.l;
}
public final ObservableBoolean d7() {
ObservableBoolean observableBoolean = this.k;
if (observableBoolean != null) {
return observableBoolean;
}
o.C("hideFooter");
return null;
}
public final String e7() {
return (String) this.r.getValue();
}
public final in.swiggy.android.menucommons.viewmodel.b f7() {
return this.n;
}
public final d g7() {
d dVar = this.j;
if (dVar != null) {
return dVar;
}
o.C("menuClickNavigationService");
return null;
}
public final c h7() {
c cVar = this.i;
if (cVar != null) {
return cVar;
}
o.C("menuItemRestaurant");
return null;
}
public final ObservableField<String> i7() {
return this.o;
}
@Override
public void init() {
boolean z;
List<String> textList;
m7(g7().J());
n7();
ObservableBoolean observableBoolean = this.l;
String disclaimer = this.e.getDisclaimer();
boolean z2 = true;
if (disclaimer != null && disclaimer.length() != 0) {
z = false;
} else {
z = true;
}
if (!KotlinExtensionsKt.e(Boolean.valueOf(z)) && ((textList = this.e.getTextList()) == null || textList.size() <= 0)) {
z2 = false;
}
observableBoolean.h(z2);
o7();
}
public final s j7() {
s sVar = this.f;
if (sVar != null) {
return sVar;
}
o.C("resourceService");
return null;
}
public final ObservableBoolean k7() {
return this.p;
}
public final void l7() {
String g = this.q.g();
if (g != null && g.length() != 0) {
d g7 = g7();
CardType cardType = CardType.FULL_SCREEN;
BannerType bannerType = BannerType.WEBVIEW;
String g2 = this.q.g();
if (g2 == null) {
g2 = "";
}
g7.n(cardType, bannerType, a7(g2), true, PopUpWidgetCrossButtonPosition.NONE, 0.9f, j7().i(g.dimen_16dp), null, "", null, false, false, "menu");
}
}
public final void m7(ObservableBoolean observableBoolean) {
o.k(observableBoolean, "<set-?>");
this.k = observableBoolean;
}
}