Swiggy v4.51.1版本的 MD5 值为:5af7ec91512a0a8c1510e3f8bac20b8b
以下内容为反编译后的 TrackOrderDeliveryStateViewModel.java 源代码,内容仅作参考
package in.swiggy.android.track.viewmodels.v3.orderstates;
import android.content.SharedPreferences;
import androidx.databinding.ObservableFloat;
import androidx.databinding.ObservableInt;
import androidx.databinding.ViewDataBinding;
import androidx.lifecycle.y;
import androidx.navigation.NavController;
import com.google.gson.Gson;
import com.newrelic.agent.android.instrumentation.GsonInstrumentation;
import com.newrelic.agent.android.instrumentation.Instrumented;
import com.rudderstack.android.sdk.core.MessageType;
import com.swiggy.pos.service.grpc.v1.Configurations;
import com.swiggy.pos.service.grpc.v1.DeliveryDetails;
import com.swiggy.pos.service.grpc.v1.Messages;
import com.swiggy.pos.service.grpc.v1.OrderStatus;
import com.swiggy.pos.service.grpc.v1.OutletDetails;
import com.swiggy.pos.service.grpc.v1.TrackOrderV3;
import in.swiggy.android.commons.extension.KotlinExtensionsKt;
import in.swiggy.android.commons.extension.StringExtensionsKt;
import in.swiggy.android.commons.utils.ICoroutineHelper;
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.swiggylynx.ui.LynxData;
import in.swiggy.android.tejas.feature.trackv3.responsedatatypes.MessagesMetaDataType;
import in.swiggy.android.tejas.feature.trackv3.responsedatatypes.TrackOrderState;
import in.swiggy.android.track.databinding.y0;
import in.swiggy.android.track.f;
import in.swiggy.android.trackkit.models.FTUEType;
import in.swiggy.android.trackkit.models.TrackFTUEToolTipData;
import java.util.Map;
import kotlin.Unit;
import kotlin.collections.j0;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.MutablePropertyReference1Impl;
import kotlin.jvm.internal.o;
import kotlin.jvm.internal.r;
import kotlin.properties.e;
import kotlin.reflect.l;
import kotlin.text.StringsKt__StringsKt;
import kotlin.text.q;
import org.json.JSONException;
@Instrumented
public final class TrackOrderDeliveryStateViewModel extends in.swiggy.android.commonsFeature.baseviewmodels.a implements in.swiggy.android.mvvm.b {
private final y<String> A;
private final y<Integer> B;
private final y<Integer> C;
private final y<Integer> D;
private final String E;
private final y<Integer> F;
private final ObservableFloat G;
private final y<String> H;
private final y<Float> I;
private int J;
private String K;
private OrderStatus L;
private Configurations M;
private OutletDetails N;
private final ObservableInt O;
public in.swiggy.android.commonsFeature.utils.a P;
private String Q;
private boolean R;
private boolean S;
private boolean T;
private final int U;
private final int V;
private y0 W;
private final e X;
private final String k;
private TrackOrderV3 l;
private DeliveryDetails m;
private final in.swiggy.android.track.services.v3.a n;
private final float o;
private final float p;
private final float q;
private final float r;
private final y<Integer> s;
private final y<String> t;
private final y<String> u;
private final y<Integer> v;
private final y<String> w;
private final y<String> x;
private final ObservableFloat y;
private final y<Integer> z;
static final l<Object>[] Z = {r.f(new MutablePropertyReference1Impl(TrackOrderDeliveryStateViewModel.class, "deliveryMessage", "getDeliveryMessage()Ljava/lang/String;", 0))};
public static final a Y = new a(null);
public static final int c0 = 8;
private static final String p0 = TrackOrderDeliveryStateViewModel.class.getSimpleName();
public static final class a {
public a(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private a() {
}
}
public static final class b extends kotlin.properties.c<String> {
final TrackOrderDeliveryStateViewModel b;
public b(Object obj, TrackOrderDeliveryStateViewModel trackOrderDeliveryStateViewModel) {
super(obj);
this.b = trackOrderDeliveryStateViewModel;
}
@Override
protected void c(l<?> property, String str, String str2) {
o.k(property, "property");
String str3 = str2;
if (!o.f(str, str3)) {
this.b.V7(str3);
}
}
}
public TrackOrderDeliveryStateViewModel(in.swiggy.android.commonsFeature.baseviewmodels.b sharedState, String str, TrackOrderV3 trackOrderV3, DeliveryDetails deliveryDetails, in.swiggy.android.track.services.v3.a trackOrderFragmentV3Service) {
super(sharedState);
Integer valueOf;
Integer valueOf2;
o.k(sharedState, "sharedState");
o.k(trackOrderFragmentV3Service, "trackOrderFragmentV3Service");
this.k = str;
this.l = trackOrderV3;
this.m = deliveryDetails;
this.n = trackOrderFragmentV3Service;
this.o = r0().m(g.dimen_8dp);
this.p = r0().m(g.dimen_12dp);
float m = r0().m(g.dimen_16dp);
this.q = m;
this.r = r0().m(g.dimen_64dp);
Integer num = 0;
this.s = new y<>(num);
this.t = new y<>();
this.u = new y<>();
this.v = new y<>(8);
this.w = new y<>();
this.x = new y<>();
this.y = new ObservableFloat(m);
this.z = new y<>(8);
this.A = new y<>();
this.B = new y<>(-1);
this.C = new y<>();
this.D = new y<>(num);
this.E = N().getString("de_vaccine_cta_base_url", "https://promos.swiggy.com/de-vaccinated-faqs/v4/index.html");
this.F = new y<>(8);
this.G = new ObservableFloat(m);
this.H = new y<>();
this.I = new y<>();
this.O = new ObservableInt(f.de_not_assigned_icon);
this.T = true;
SharedPreferences N = N();
if (num instanceof String) {
String string = N.getString("track_decx_tooltip_show_count", (String) num);
valueOf = (Integer) (string == null ? "" : string);
} else {
valueOf = Integer.valueOf(N.getInt("track_decx_tooltip_show_count", num.intValue()));
}
this.U = valueOf.intValue();
SharedPreferences N2 = N();
Integer num2 = 3;
if (num2 instanceof String) {
String string2 = N2.getString("track_decx_tooltip_show_count_limit", (String) num2);
valueOf2 = (Integer) (string2 == null ? "" : string2);
} else {
valueOf2 = Integer.valueOf(N2.getInt("track_decx_tooltip_show_count_limit", num2.intValue()));
}
this.V = valueOf2.intValue();
kotlin.properties.a aVar = kotlin.properties.a.a;
this.X = new b("", this);
}
private final String F7() {
Map l;
String json;
try {
l = j0.l(kotlin.o.a("entity_type", "DECX_TOOLTIP"), kotlin.o.a("is_capping_enabled", Boolean.TRUE), kotlin.o.a("entity_id", "85c15410-60f1-4627-86ed-553f47193c73"), kotlin.o.a(MessageType.PAGE, "track_v3"));
Gson g = i0.g();
if (!(g instanceof Gson)) {
json = g.toJson(l);
} else {
json = GsonInstrumentation.toJson(g, l);
}
o.j(json, "toJson(...)");
return json;
} catch (JSONException e) {
x.i(p0, e);
return "-";
}
}
private final void J7() {
boolean C;
CharSequence k1;
Configurations configurations = this.M;
if (configurations != null) {
this.R = configurations.getIsDeCxConversationAllowed();
this.S = configurations.getIsDeCxConversationEnabled();
}
DeliveryDetails deliveryDetails = this.m;
Unit unit = null;
String str = null;
if (deliveryDetails != null) {
String deliveryExecContactNumber = deliveryDetails.getDeliveryExecContactNumber();
if (deliveryExecContactNumber != null) {
o.h(deliveryExecContactNumber);
k1 = StringsKt__StringsKt.k1(deliveryExecContactNumber);
str = k1.toString();
}
if (str != null) {
C = q.C(str);
if (!C) {
this.Q = str;
int m = r0().m(g.dimen_32dp);
this.w.r(G().A(m, m, deliveryDetails.getDeliveryExecImageOverlayIcon()));
this.s.r(0);
unit = Unit.a;
}
}
this.s.r(8);
unit = Unit.a;
}
if (unit == null) {
this.s.r(8);
}
}
private final void K7() {
Unit unit;
boolean C;
boolean C2;
M7();
DeliveryDetails deliveryDetails = this.m;
if (deliveryDetails != null) {
String deliveryExecImageUrl = deliveryDetails.getDeliveryExecImageUrl();
o.h(deliveryExecImageUrl);
C = q.C(deliveryExecImageUrl);
if (C) {
this.x.r(null);
return;
}
String c = in.swiggy.android.commonsFeature.utils.a.c(v7(), deliveryExecImageUrl, 0, 0, 6, null);
C2 = q.C(c);
if ((!C2) && !o.f(this.x.f(), c)) {
this.x.r(c);
}
unit = Unit.a;
} else {
unit = null;
}
if (unit == null) {
this.x.r(null);
}
}
private final void L7() {
Messages i;
int i2;
TrackOrderV3 trackOrderV3 = this.l;
if (trackOrderV3 != null && (i = in.swiggy.android.track.utils.d.i(trackOrderV3)) != null) {
String description = i.getDescription();
String str = i.getMetaMap().get(MessagesMetaDataType.VACCINE_DOSES);
if (str != null) {
i2 = Integer.parseInt(str);
} else {
i2 = 0;
}
this.J = i2;
this.K = i.getMetaMap().get(MessagesMetaDataType.DE_ID);
if (description != null && description.length() != 0 && this.J >= 1) {
this.H.r(description + " ");
this.F.r(0);
return;
}
this.H.r("");
this.F.r(8);
}
}
private final void M7() {
String hiddenState;
OrderStatus orderStatus = this.L;
if (orderStatus != null && (hiddenState = orderStatus.getHiddenState()) != null) {
int hashCode = hiddenState.hashCode();
if (hashCode != -1431725382) {
if (hashCode != -804109473) {
if (hashCode != 422194963 || !hiddenState.equals("processing")) {
return;
}
} else if (!hiddenState.equals(TrackOrderState.CONFIRMED)) {
return;
}
this.O.h(f.de_not_assigned_icon);
} else if (hiddenState.equals(TrackOrderState.PICKED_UP)) {
this.O.h(f.de_assigned_placeholder);
}
}
}
private final void N7() {
if (Y7()) {
ICoroutineHelper.DefaultImpls.c(this, new TrackOrderDeliveryStateViewModel$handleFTUEToast$1(this, null), 1000L, null, 4, null);
this.T = false;
}
}
private final void O7() {
Messages l;
TrackOrderV3 trackOrderV3 = this.l;
if (trackOrderV3 != null && (l = in.swiggy.android.track.utils.d.l(trackOrderV3)) != null && StringExtensionsKt.e(l.getDescription())) {
this.t.r(l.getDescription());
String description = l.getDescription();
o.j(description, "getDescription(...)");
X7(description);
}
}
private final void P7() {
String str;
float f;
Messages l0;
Messages m0;
TrackOrderV3 trackOrderV3 = this.l;
String str2 = null;
if (trackOrderV3 != null && (m0 = in.swiggy.android.track.utils.d.m0(trackOrderV3)) != null) {
str = m0.getDescription();
} else {
str = null;
}
TrackOrderV3 trackOrderV32 = this.l;
if (trackOrderV32 != null && (l0 = in.swiggy.android.track.utils.d.l0(trackOrderV32)) != null) {
str2 = l0.getDescription();
}
if (str != null && str.length() != 0 && str2 != null && str2.length() != 0) {
this.v.r(0);
this.u.r(str + " : " + str2);
this.y.h(this.o);
this.I.r(Float.valueOf(this.p));
} else if (str2 != null && str2.length() != 0) {
this.u.r(str2);
this.v.r(0);
this.y.h(this.o);
this.I.r(Float.valueOf(this.p));
} else {
this.v.r(8);
Integer f2 = this.F.f();
if (f2 != null && f2.intValue() == 8) {
f = this.q;
} else {
f = this.o;
}
this.y.h(f);
this.I.r(Float.valueOf(this.q));
}
}
public final void Q7() {
in.swiggy.android.commons.extension.a.b(N(), "track_decx_tooltip_show_count", Integer.valueOf(this.U + 1));
}
public final void V7(String str) {
Map<String, String> f;
String f2 = this.n.m2().f();
if (f2 == null) {
f2 = "";
}
f = kotlin.collections.i0.f(kotlin.o.a("order-state", f2));
in.swiggy.android.analytics.interfaces.c g3 = g3();
String str2 = this.k;
if (str2 == null) {
str2 = "-";
}
g3.j(g3.s("track_v3", "impression-delivery-message", str, 9999, str2, f));
}
public final void W7() {
in.swiggy.android.analytics.interfaces.c g3 = g3();
String str = this.k;
if (str == null) {
str = "-";
}
g3.j(g3.q("track_v3", "impression-decx-tooltip", str, 9999, F7()));
}
private final boolean Y7() {
FTUEType fTUEType;
if (this.V > this.U && this.R && this.S) {
TrackFTUEToolTipData a0 = this.n.a0();
if (a0 != null) {
fTUEType = a0.c();
} else {
fTUEType = null;
}
if (fTUEType != FTUEType.DELIVERY_INST_FTUE_TOOLTIP) {
return true;
}
}
return false;
}
public final y<String> A7() {
return this.A;
}
public final y<Integer> B7() {
return this.B;
}
public final y<Integer> C7() {
return this.C;
}
public final y<Integer> D7() {
return this.D;
}
public final y<Integer> E7() {
return this.z;
}
public final y<String> G7() {
return this.t;
}
public final y<String> H7() {
return this.u;
}
public final y<Integer> I7() {
return this.v;
}
public final boolean R7() {
return this.R;
}
public final boolean S7() {
return this.S;
}
public final Function0<Unit> T7() {
return new Function0<Unit>() {
{
super(0);
}
@Override
public Unit invoke() {
invoke2();
return Unit.a;
}
public final void invoke2() {
in.swiggy.android.track.services.v3.a aVar;
Map<String, String> f;
OrderStatus orderStatus;
String str;
boolean C;
in.swiggy.android.track.services.v3.a aVar2;
String str2;
in.swiggy.android.track.services.v3.a aVar3;
String q7 = TrackOrderDeliveryStateViewModel.this.q7();
if (q7 != null) {
C = q.C(q7);
if (!C) {
if (!TrackOrderDeliveryStateViewModel.this.S7() || !TrackOrderDeliveryStateViewModel.this.R7()) {
aVar2 = TrackOrderDeliveryStateViewModel.this.n;
aVar2.K4(TrackOrderDeliveryStateViewModel.this.q7());
} else {
str2 = TrackOrderDeliveryStateViewModel.this.k;
if (str2 != null) {
aVar3 = TrackOrderDeliveryStateViewModel.this.n;
aVar3.A6(str2);
}
}
}
}
aVar = TrackOrderDeliveryStateViewModel.this.n;
String f2 = aVar.m2().f();
if (f2 == null) {
f2 = "";
}
f = kotlin.collections.i0.f(kotlin.o.a("order-state", f2));
in.swiggy.android.analytics.interfaces.c g3 = TrackOrderDeliveryStateViewModel.this.g3();
TrackOrderDeliveryStateViewModel trackOrderDeliveryStateViewModel = TrackOrderDeliveryStateViewModel.this;
String str3 = (trackOrderDeliveryStateViewModel.S7() && trackOrderDeliveryStateViewModel.R7()) ? "click-decx-chat" : "click-call-de";
orderStatus = trackOrderDeliveryStateViewModel.L;
String orderState = orderStatus != null ? orderStatus.getOrderState() : null;
if (orderState == null) {
orderState = "-";
}
str = trackOrderDeliveryStateViewModel.k;
g3.b(g3.s("track_v3", str3, orderState, 9999, str == null ? "-" : str, f));
}
};
}
public final Function0<Unit> U7() {
return new Function0<Unit>() {
{
super(0);
}
@Override
public Unit invoke() {
invoke2();
return Unit.a;
}
public final void invoke2() {
Boolean bool;
String str;
String str2;
String str3;
String str4;
boolean C;
if (TrackOrderDeliveryStateViewModel.this.z7() >= 1) {
String s7 = TrackOrderDeliveryStateViewModel.this.s7();
if (s7 != null) {
C = q.C(s7);
bool = Boolean.valueOf(!C);
} else {
bool = null;
}
if (KotlinExtensionsKt.h(bool)) {
str = "&de_id=" + TrackOrderDeliveryStateViewModel.this.s7();
} else {
str = "";
}
str2 = TrackOrderDeliveryStateViewModel.this.E;
final String str5 = str2 + "?vaccination_doses=" + TrackOrderDeliveryStateViewModel.this.z7() + str;
in.swiggy.android.commonsui.ui.arch.navigation.a I2 = TrackOrderDeliveryStateViewModel.this.I2();
final TrackOrderDeliveryStateViewModel trackOrderDeliveryStateViewModel = TrackOrderDeliveryStateViewModel.this;
I2.a(new Function1<NavController, Unit>() {
{
super(1);
}
public final void a(NavController emit) {
in.swiggy.android.track.services.v3.a aVar;
o.k(emit, "$this$emit");
aVar = TrackOrderDeliveryStateViewModel.this.n;
aVar.O2();
emit.O(in.swiggy.android.track.fragments.e.a.b(new LynxData(str5, false, 0, null, null, null, false, 126, null)));
}
@Override
public Unit invoke(NavController navController) {
a(navController);
return Unit.a;
}
});
in.swiggy.android.analytics.interfaces.c g3 = TrackOrderDeliveryStateViewModel.this.g3();
TrackOrderDeliveryStateViewModel trackOrderDeliveryStateViewModel2 = TrackOrderDeliveryStateViewModel.this;
str3 = trackOrderDeliveryStateViewModel2.k;
str4 = trackOrderDeliveryStateViewModel2.k;
if (str4 == null) {
str4 = "-";
}
g3.b(g3.r("track_v3", "click-covid-vaccination-view", str3, str4, String.valueOf(trackOrderDeliveryStateViewModel2.z7())));
}
}
};
}
public final void X7(String str) {
o.k(str, "<set-?>");
this.X.b(this, Z[0], str);
}
public final void Z7(TrackOrderV3 trackOrderV3, DeliveryDetails deliveryDetails) {
this.m = deliveryDetails;
if (trackOrderV3 != null) {
this.l = trackOrderV3;
this.L = in.swiggy.android.track.utils.d.L(trackOrderV3);
this.N = in.swiggy.android.track.utils.d.M(trackOrderV3);
this.M = in.swiggy.android.track.utils.d.f(trackOrderV3);
}
O7();
K7();
J7();
N7();
L7();
P7();
}
public final ObservableFloat o7() {
return this.y;
}
public final y<Integer> p7() {
return this.s;
}
public final String q7() {
return this.Q;
}
public final y<String> r7() {
return this.w;
}
@Override
public void s2(in.swiggy.android.mvvm.services.q bindingService) {
o.k(bindingService, "bindingService");
ViewDataBinding a2 = bindingService.a();
if (a2 instanceof y0) {
this.W = (y0) a2;
}
}
public final String s7() {
return this.K;
}
public final ObservableInt t7() {
return this.O;
}
public final y<String> u7() {
return this.x;
}
public final in.swiggy.android.commonsFeature.utils.a v7() {
in.swiggy.android.commonsFeature.utils.a aVar = this.P;
if (aVar != null) {
return aVar;
}
o.C("deImageUtil");
return null;
}
public final y<String> w7() {
return this.H;
}
public final y<Float> x7() {
return this.I;
}
public final y<Integer> y7() {
return this.F;
}
public final int z7() {
return this.J;
}
}