Swiggy v4.51.1版本的 MD5 值为:5af7ec91512a0a8c1510e3f8bac20b8b
以下内容为反编译后的 q1.java 源代码,内容仅作参考
package in.swiggy.android.utils;
import android.content.SharedPreferences;
import android.net.Uri;
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.extension.StringExtensionsKt;
import in.swiggy.android.swiggylynx.plugin.SwiggyLynxPluginData;
import in.swiggy.android.swiggylynx.ui.LynxData;
import in.swiggy.android.tejas.utils.GsonUtil;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.text.StringsKt__StringsKt;
@Instrumented
public final class q1 {
public static final a c = new a(null);
public static final int d = 8;
public SharedPreferences a;
public in.swiggy.android.repositories.interfaces.e b;
public static final class a {
public a(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private a() {
}
}
private final in.swiggy.android.utils.swiggymoney.c b() {
Object fromJson;
String str = "{\n \"mappings\":[{\n \"old_config\":\"swiggy-money/add-money\",\n \"new_config\":\"payments/index.html\"\n },{\n \"old_config\":\"swiggy-money/add-voucher\",\n \"new_config\":\"voucher/index.html\"\n },{\n \"old_config\":\"swiggy-money\",\n \"new_config\":\"ledger/index.html\"\n },{\n \"old_config\":\"swiggy-money/kyc\",\n \"new_config\":\"ledger/index.html\"\n }\n ]\n }";
String string = a().getString("android_swiggy_money_new_stack_mapping_config", "{\n \"mappings\":[{\n \"old_config\":\"swiggy-money/add-money\",\n \"new_config\":\"payments/index.html\"\n },{\n \"old_config\":\"swiggy-money/add-voucher\",\n \"new_config\":\"voucher/index.html\"\n },{\n \"old_config\":\"swiggy-money\",\n \"new_config\":\"ledger/index.html\"\n },{\n \"old_config\":\"swiggy-money/kyc\",\n \"new_config\":\"ledger/index.html\"\n }\n ]\n }");
if (string != null) {
str = string;
}
try {
Gson gson = GsonUtil.getGson();
if (!(gson instanceof Gson)) {
fromJson = gson.fromJson(str, (Class<Object>) in.swiggy.android.utils.swiggymoney.c.class);
} else {
fromJson = GsonInstrumentation.fromJson(gson, str, (Class<Object>) in.swiggy.android.utils.swiggymoney.c.class);
}
kotlin.jvm.internal.o.h(fromJson);
return (in.swiggy.android.utils.swiggymoney.c) fromJson;
} catch (Exception e) {
in.swiggy.android.commons.utils.x.i("SwiggyMoneyUtil", e);
return new in.swiggy.android.utils.swiggymoney.c(null, 1, null);
}
}
private final String c() {
String string = a().getString("android_swiggy_money_new_stack_base_url", "https://webviews.swiggy.com/swiggy-money/");
if (string == null) {
return "https://webviews.swiggy.com/swiggy-money/";
}
return string;
}
private final String d() {
String string = a().getString("android_swiggy_money_new_stack_url", "https://webviews.swiggy.com/swiggy-money/ledger/index.html");
if (string == null) {
return "https://webviews.swiggy.com/swiggy-money/ledger/index.html";
}
return string;
}
private final String e(in.swiggy.android.utils.swiggymoney.c cVar, String str) {
Object obj;
boolean U;
List<in.swiggy.android.utils.swiggymoney.a> a2 = cVar.a();
if (a2 == null) {
return null;
}
Iterator<T> it = a2.iterator();
while (true) {
if (it.hasNext()) {
obj = it.next();
String b = ((in.swiggy.android.utils.swiggymoney.a) obj).b();
if (b == null) {
b = "";
}
U = StringsKt__StringsKt.U(str, b, false, 2, null);
if (U) {
break;
}
} else {
obj = null;
break;
}
}
in.swiggy.android.utils.swiggymoney.a aVar = (in.swiggy.android.utils.swiggymoney.a) obj;
if (aVar == null) {
return null;
}
return aVar.a();
}
private final String h(String str) {
String str2;
String e = e(b(), str);
if (e == null) {
str2 = d();
} else {
str2 = c() + e;
}
Uri parse = Uri.parse(str);
String query = parse.getQuery();
if (query != null && query.length() != 0) {
String uri = new Uri.Builder().encodedPath(str2).encodedQuery(parse.getQuery()).build().toString();
kotlin.jvm.internal.o.j(uri, "toString(...)");
return uri;
}
return str2;
}
public static LynxData j(q1 q1Var, String str, int i, Object obj) {
if ((i & 1) != 0) {
str = null;
}
return q1Var.i(str);
}
public final SharedPreferences a() {
SharedPreferences sharedPreferences = this.a;
if (sharedPreferences != null) {
return sharedPreferences;
}
kotlin.jvm.internal.o.C("mSharedPreferences");
return null;
}
public final String f(String str) {
String d2 = d();
if (StringExtensionsKt.c(str)) {
return d2;
}
if (g(str)) {
if (str == null) {
str = "";
}
return h(str);
} else if (str == null) {
return "";
} else {
return str;
}
}
public final boolean g(String str) {
Object fromJson;
List<String> a2;
boolean U;
String str2 = "{\n \"urls\":[\"my-account/swiggy-money\"]\n }";
String string = a().getString("android_swiggy_money_old_stack_url_list", "{\n \"urls\":[\"my-account/swiggy-money\"]\n }");
if (string != null) {
str2 = string;
}
try {
Gson gson = GsonUtil.getGson();
if (!(gson instanceof Gson)) {
fromJson = gson.fromJson(str2, (Class<Object>) in.swiggy.android.utils.swiggymoney.b.class);
} else {
fromJson = GsonInstrumentation.fromJson(gson, str2, (Class<Object>) in.swiggy.android.utils.swiggymoney.b.class);
}
in.swiggy.android.utils.swiggymoney.b bVar = (in.swiggy.android.utils.swiggymoney.b) fromJson;
if (bVar != null && (a2 = bVar.a()) != null) {
for (String str3 : a2) {
Boolean bool = null;
if (str != null) {
U = StringsKt__StringsKt.U(str, str3, false, 2, null);
bool = Boolean.valueOf(U);
}
if (KotlinExtensionsKt.h(bool)) {
return true;
}
}
}
return false;
} catch (Exception e) {
in.swiggy.android.commons.utils.x.i("SwiggyMoneyUtil", e);
return false;
}
}
public final LynxData i(String str) {
Set d2;
String f = f(str);
d2 = kotlin.collections.p0.d(new SwiggyLynxPluginData.PaymentLynxPluginData(null, 1, null));
return new LynxData(f, false, 0, null, d2, null, false, 110, null);
}
}