Swiggy v4.51.1版本的 MD5 值为:5af7ec91512a0a8c1510e3f8bac20b8b
以下内容为反编译后的 m.java 源代码,内容仅作参考
package in.swiggy.android.swiggylynx.ui;
import android.content.SharedPreferences;
import android.os.Build;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
import com.xiaomi.mipush.sdk.Constants;
import in.swiggy.android.commons.utils.x;
import in.swiggy.android.swiggylynx.plugin.swiggylynxcoreplugin.SwiggyLynxCorePlugin;
import in.swiggy.android.swiggylynx.plugin.swiggylynxcoreplugin.getSwiggyHeaders.GetSwiggyHeaderResponsePayload;
import in.swiggy.android.tejas.TejasConstants;
import in.swiggy.android.tejas.feature.address.model.Address;
import in.swiggy.android.tejas.oldapi.network.responses.orderhistory.ServiceLineTypes;
import in.swiggy.koordinates.compass.core.dataModels.f;
import java.util.Iterator;
import java.util.List;
import kotlin.Triple;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.o;
import kotlin.text.Regex;
import kotlin.text.q;
public final class m {
public static final m a = new m();
public static final class a {
public static final a a = new a();
private a() {
}
public final void a(SwiggyLynxWebView swiggyLynxWebView) {
d.a.a(swiggyLynxWebView, "__test_get_cart__", "true");
}
}
public static final class b {
public static final b a = new b();
private b() {
}
public final void a(SwiggyLynxWebView swiggyLynxWebView) {
if (swiggyLynxWebView != null) {
m.a.b(swiggyLynxWebView, "UPDATE_SELECTED_ADDRESS()");
}
}
}
public static final class c {
private final GetSwiggyHeaderResponsePayload a;
public c(GetSwiggyHeaderResponsePayload swiggyHeaderResponsePayload) {
o.k(swiggyHeaderResponsePayload, "swiggyHeaderResponsePayload");
this.a = swiggyHeaderResponsePayload;
}
@JavascriptInterface
public final String getSwiggyHeaders() {
return kotlinx.serialization.json.a.d.b(GetSwiggyHeaderResponsePayload.Companion.serializer(), this.a);
}
}
public static final class d {
public static final d a = new d();
private d() {
}
public final void a(SwiggyLynxWebView swiggyLynxWebView, String key, String value) {
o.k(key, "key");
o.k(value, "value");
if (swiggyLynxWebView != null) {
swiggyLynxWebView.evaluateJavascript("window.localStorage.setItem('" + key + "','" + value + "');", null);
}
}
}
public static final class e {
public static final e a = new e();
private e() {
}
public final void a(SwiggyLynxWebView swiggyLynxWebView, String query, String action) {
o.k(query, "query");
o.k(action, "action");
if (swiggyLynxWebView != null) {
m mVar = m.a;
mVar.b(swiggyLynxWebView, "HANDLE_IM_SEARCH_ACTIONS(\"" + query + "\",\"" + action + "\")");
}
}
}
public static final class f {
public static final f a = new f();
private f() {
}
public final void a(SwiggyLynxWebView swiggyLynxWebView, in.swiggy.android.swiggylynx.service.a mSwiggyLynxInterface, in.swiggy.android.repositories.cart.services.i cartService, SharedPreferences sharedPreferences) {
o.k(mSwiggyLynxInterface, "mSwiggyLynxInterface");
o.k(cartService, "cartService");
o.k(sharedPreferences, "sharedPreferences");
if (m.a.d(sharedPreferences) && swiggyLynxWebView != null) {
swiggyLynxWebView.addJavascriptInterface(new in.swiggy.android.swiggylynx.utils.i(mSwiggyLynxInterface, cartService), "direct_bridge");
}
}
}
public static final class g {
public static final g a = new g();
public static final class a {
private final String a;
public a(String payload) {
o.k(payload, "payload");
this.a = payload;
}
@JavascriptInterface
public final String getWebViewLastState() {
return this.a;
}
}
private g() {
}
public final void a(SwiggyLynxWebView swiggyLynxWebView, String statePayload) {
o.k(statePayload, "statePayload");
if (swiggyLynxWebView != null) {
swiggyLynxWebView.addJavascriptInterface(new a(statePayload), "__webview_state__");
}
}
}
private m() {
}
public final boolean d(SharedPreferences sharedPreferences) {
return o.f(sharedPreferences.getString("enable_exposing_direct_bridge", "enable_exposing_direct_bridge"), "true");
}
public static void f(m mVar, String str, in.swiggy.android.repositories.interfaces.d dVar, in.swiggy.android.commons.utils.contextservice.h hVar, in.swiggy.koordinates.compass.core.b bVar, String str2, in.swiggy.android.repositories.interfaces.e eVar, SharedPreferences sharedPreferences, in.swiggy.android.repositories.cart.interfaces.cart.a aVar, SwiggyLynxWebView swiggyLynxWebView, in.swiggy.android.commons.utils.a aVar2, in.swiggy.android.commons.ozone.a aVar3, String str3, String str4, Function1 function1, int i, Object obj) {
Function1 function12;
if ((i & 8192) != 0) {
function12 = null;
} else {
function12 = function1;
}
mVar.e(str, dVar, hVar, bVar, str2, eVar, sharedPreferences, aVar, swiggyLynxWebView, aVar2, aVar3, str3, str4, function12);
}
private final Triple<String, String, Address> g(in.swiggy.koordinates.compass.core.b bVar, in.swiggy.android.repositories.interfaces.d dVar) {
String str;
String str2;
in.swiggy.koordinates.compass.core.dataModels.f b2 = bVar.getLocation().getValue().b();
in.swiggy.android.swiggylocation.helpers.a aVar = in.swiggy.android.swiggylocation.helpers.a.a;
List<Address> I = dVar.I();
o.j(I, "getAddresses(...)");
in.swiggy.android.swiggylocation.helpers.b c2 = aVar.c(bVar, I);
Object obj = null;
if (c2 != null) {
str = c2.a();
} else {
str = null;
}
if (b2 instanceof f.a) {
str2 = ((f.a) b2).a();
List<Address> I2 = dVar.I();
o.j(I2, "getAddresses(...)");
Iterator<T> it = I2.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
Object next = it.next();
if (o.f(((Address) next).getId(), str2)) {
obj = next;
break;
}
}
obj = (Address) obj;
} else {
str2 = "";
}
return new Triple<>(str, str2, obj);
}
private final String h(in.swiggy.koordinates.compass.core.b bVar) {
in.swiggy.koordinates.compass.core.dataModels.a value = bVar.i().getValue();
if (value != null) {
double a2 = value.b().a();
double b2 = value.b().b();
return a2 + Constants.ACCEPT_TIME_SEPARATOR_SP + b2;
}
return "0.0,0.0";
}
private final String i() {
String str = Build.MODEL;
if (str != null) {
return new Regex("\\s").i(str, "");
}
return null;
}
private final String j(String str, SharedPreferences sharedPreferences) {
boolean P;
String string;
boolean C;
P = q.P(str, "https://payments-staging.swiggy.com", false, 2, null);
if (P && (string = sharedPreferences.getString("payment-secret-key", "")) != null) {
C = q.C(string);
if (C) {
return "";
}
return string;
}
return "";
}
private final String k(in.swiggy.android.repositories.cart.interfaces.cart.a aVar, in.swiggy.koordinates.compass.core.b bVar) {
f.a aVar2;
in.swiggy.koordinates.compass.core.dataModels.f b2 = bVar.getLocation().getValue().b();
String str = null;
if (b2 instanceof f.a) {
aVar2 = (f.a) b2;
} else {
aVar2 = null;
}
if (aVar2 != null) {
str = aVar2.a();
}
if (aVar.getDeliveryAddress() != null) {
return String.valueOf(aVar.getDeliveryAddress().getId());
}
if (str == null) {
return "";
}
return str;
}
public final void b(WebView webView, String methodCall) {
o.k(webView, "<this>");
o.k(methodCall, "methodCall");
webView.evaluateJavascript("javascript:try{" + methodCall + "}catch(error){}", null);
}
public final void c(SwiggyLynxWebView swiggyLynxWebView) {
String name;
if (swiggyLynxWebView != null) {
try {
b(swiggyLynxWebView, "clearLocalStorage()");
} catch (Exception e2) {
if (!m.class.isAnonymousClass()) {
name = m.class.getSimpleName();
if (name.length() > 23) {
o.h(name);
name = name.substring(0, 23);
o.j(name, "substring(...)");
}
o.h(name);
} else {
name = m.class.getName();
if (name.length() > 23) {
o.h(name);
name = name.substring(name.length() - 23, name.length());
o.j(name, "substring(...)");
}
o.h(name);
}
x.i(name, e2);
}
}
}
public final void e(String url, in.swiggy.android.repositories.interfaces.d user, in.swiggy.android.commons.utils.contextservice.h contextService, in.swiggy.koordinates.compass.core.b locationContext, String webFlow, in.swiggy.android.repositories.interfaces.e xpExperimentContext, SharedPreferences sharedPreferences, in.swiggy.android.repositories.cart.interfaces.cart.a cart, SwiggyLynxWebView swiggyLynxWebView, in.swiggy.android.commons.utils.a appBuildDetails, in.swiggy.android.commons.ozone.a ozoneStorageManager, String isQuicks, String hideBackButton, Function1<? super String, String> function1) {
o.k(url, "url");
o.k(user, "user");
o.k(contextService, "contextService");
o.k(locationContext, "locationContext");
o.k(webFlow, "webFlow");
o.k(xpExperimentContext, "xpExperimentContext");
o.k(sharedPreferences, "sharedPreferences");
o.k(cart, "cart");
o.k(appBuildDetails, "appBuildDetails");
o.k(ozoneStorageManager, "ozoneStorageManager");
o.k(isQuicks, "isQuicks");
o.k(hideBackButton, "hideBackButton");
GetSwiggyHeaderResponsePayload l = l(url, user, contextService, locationContext, webFlow, xpExperimentContext, sharedPreferences, cart, appBuildDetails, ozoneStorageManager, isQuicks, hideBackButton, function1);
l.g(user.getTid());
l.f(user.getSessionId());
l.e(user.getDeviceId());
if (swiggyLynxWebView != null) {
swiggyLynxWebView.addJavascriptInterface(new c(l), "__native_headers__");
}
}
public final GetSwiggyHeaderResponsePayload l(String url, in.swiggy.android.repositories.interfaces.d user, in.swiggy.android.commons.utils.contextservice.h contextService, in.swiggy.koordinates.compass.core.b locationContext, String webFlow, in.swiggy.android.repositories.interfaces.e xpExperimentContext, SharedPreferences sharedPreferences, in.swiggy.android.repositories.cart.interfaces.cart.a cart, in.swiggy.android.commons.utils.a appBuildDetails, in.swiggy.android.commons.ozone.a ozoneStorageManager, String isQuicks, String hideBackButton, Function1<? super String, String> function1) {
String str;
o.k(url, "url");
o.k(user, "user");
o.k(contextService, "contextService");
o.k(locationContext, "locationContext");
o.k(webFlow, "webFlow");
o.k(xpExperimentContext, "xpExperimentContext");
o.k(sharedPreferences, "sharedPreferences");
o.k(cart, "cart");
o.k(appBuildDetails, "appBuildDetails");
o.k(ozoneStorageManager, "ozoneStorageManager");
o.k(isQuicks, "isQuicks");
o.k(hideBackButton, "hideBackButton");
in.swiggy.koordinates.core.f a2 = locationContext.getLocation().getValue().a();
in.swiggy.android.swiggylocation.helpers.a aVar = in.swiggy.android.swiggylocation.helpers.a.a;
List<Address> I = user.I();
o.j(I, "getAddresses(...)");
in.swiggy.android.swiggylocation.helpers.b c2 = aVar.c(locationContext, I);
in.swiggy.koordinates.compass.core.dataModels.f b2 = locationContext.getLocation().getValue().b();
f.a aVar2 = b2 instanceof f.a ? (f.a) b2 : null;
String a3 = aVar2 != null ? aVar2.a() : null;
if (ozoneStorageManager.h()) {
String g2 = ozoneStorageManager.g();
str = g2 == null ? "" : g2;
} else {
str = null;
}
String str2 = a3;
if (user.F()) {
String tid = user.getTid();
String sessionId = user.getSessionId();
String deviceId = user.getDeviceId();
String customerId = user.getCustomerId();
String h = h(locationContext);
String token = user.getToken();
o.j(token, "getToken(...)");
String valueOf = String.valueOf(appBuildDetails.h());
String swuid = user.getSwuid();
o.j(swuid, "getSwuid(...)");
String valueOf2 = String.valueOf(c2 != null ? c2.d() : null);
String str3 = Build.VERSION.RELEASE;
String i = i();
String k = k(cart, locationContext);
String j = j(url, sharedPreferences);
String e2 = g(locationContext, user).e();
String f2 = g(locationContext, user).f();
String valueOf3 = String.valueOf(a2.a());
String valueOf4 = String.valueOf(a2.b());
Address g3 = g(locationContext, user).g();
String name = g3 != null ? g3.getName() : null;
Address g4 = g(locationContext, user).g();
String contactNumber = g4 != null ? g4.getContactNumber() : null;
Address g5 = g(locationContext, user).g();
String annotationTagStringIdentifier = g5 != null ? g5.getAnnotationTagStringIdentifier() : null;
String valueOf5 = String.valueOf(SwiggyLynxCorePlugin.Companion.b(xpExperimentContext, sharedPreferences));
String string = sharedPreferences.getString("userAgent", "");
String valueOf6 = String.valueOf(contextService.j());
String k2 = in.swiggy.android.analytics.gtm.e.k();
String m = m(xpExperimentContext, sharedPreferences);
String string2 = sharedPreferences.getString("current_city_id", "");
return new GetSwiggyHeaderResponsePayload(tid, sessionId, deviceId, customerId, h, token, valueOf, swuid, valueOf2, "Swiggy-Android", "an", "4.51.1", str3, i, k, "1", ServiceLineTypes.TYPE_FOOD, "Regular", TejasConstants.ENABLE_V4_PROFILE_API_DEFAULT, webFlow, j, e2, f2, valueOf3, valueOf4, name, contactNumber, annotationTagStringIdentifier, valueOf5, string, valueOf6, k2, m, string2 == null ? "" : string2, str, String.valueOf(in.swiggy.android.swiggylynx.utils.b.a(xpExperimentContext, sharedPreferences)), isQuicks, hideBackButton, function1 != null ? function1.invoke("retainedCartOrderId") : null);
}
String tid2 = user.getTid();
String sessionId2 = user.getSessionId();
String deviceId2 = user.getDeviceId();
String h2 = h(locationContext);
String token2 = user.getToken();
o.j(token2, "getToken(...)");
String valueOf7 = String.valueOf(appBuildDetails.h());
String swuid2 = user.getSwuid();
o.j(swuid2, "getSwuid(...)");
return new GetSwiggyHeaderResponsePayload(tid2, sessionId2, deviceId2, (String) null, h2, token2, valueOf7, swuid2, String.valueOf(c2 != null ? c2.d() : null), "Swiggy-Android", "an", "4.51.1", Build.VERSION.RELEASE, i(), str2 == null ? "" : str2, "1", ServiceLineTypes.TYPE_FOOD, "Regular", TejasConstants.ENABLE_V4_PROFILE_API_DEFAULT, webFlow, j(url, sharedPreferences), g(locationContext, user).e(), g(locationContext, user).f(), String.valueOf(a2.a()), String.valueOf(a2.b()), (String) null, (String) null, (String) null, String.valueOf(SwiggyLynxCorePlugin.Companion.b(xpExperimentContext, sharedPreferences)), sharedPreferences.getString("userAgent", ""), String.valueOf(contextService.j()), in.swiggy.android.analytics.gtm.e.k(), m(xpExperimentContext, sharedPreferences), (String) null, str, String.valueOf(in.swiggy.android.swiggylynx.utils.b.a(xpExperimentContext, sharedPreferences)), isQuicks, hideBackButton, function1 != null ? function1.invoke("retainedCartOrderId") : null, 0, 2, (DefaultConstructorMarker) null);
}
public final String m(in.swiggy.android.repositories.interfaces.e xpExperimentContext, SharedPreferences sharedPreferences) {
o.k(xpExperimentContext, "xpExperimentContext");
o.k(sharedPreferences, "sharedPreferences");
if (!d(sharedPreferences)) {
return null;
}
String H = xpExperimentContext.H("is_hero_api_inline_html", "default");
if (!o.f(H, "true") && !o.f(H, TejasConstants.ENABLE_V4_PROFILE_API_DEFAULT)) {
return null;
}
return H;
}
public final void n(SwiggyLynxWebView swiggyLynxWebView) {
String name;
if (swiggyLynxWebView != null) {
try {
b(swiggyLynxWebView, "onHalfCardBackgroundTap()");
} catch (Exception e2) {
if (!m.class.isAnonymousClass()) {
name = m.class.getSimpleName();
if (name.length() > 23) {
o.h(name);
name = name.substring(0, 23);
o.j(name, "substring(...)");
}
o.h(name);
} else {
name = m.class.getName();
if (name.length() > 23) {
o.h(name);
name = name.substring(name.length() - 23, name.length());
o.j(name, "substring(...)");
}
o.h(name);
}
x.i(name, e2);
}
}
}
public final void o(SwiggyLynxWebView swiggyLynxWebView, boolean z, boolean z2) {
String name;
if (swiggyLynxWebView != null) {
try {
b(swiggyLynxWebView, "swipeBottomsheet(" + z + Constants.ACCEPT_TIME_SEPARATOR_SP + z2 + ")");
} catch (Exception e2) {
if (!m.class.isAnonymousClass()) {
name = m.class.getSimpleName();
if (name.length() > 23) {
o.h(name);
name = name.substring(0, 23);
o.j(name, "substring(...)");
}
o.h(name);
} else {
name = m.class.getName();
if (name.length() > 23) {
o.h(name);
name = name.substring(name.length() - 23, name.length());
o.j(name, "substring(...)");
}
o.h(name);
}
x.i(name, e2);
}
}
}
}