Swiggy v4.51.1版本的 MD5 值为:5af7ec91512a0a8c1510e3f8bac20b8b
以下内容为反编译后的 DeepLinkActivity.java 源代码,内容仅作参考
package in.swiggy.android.activities;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import com.appsflyer.AppsFlyerConversionListener;
import com.google.android.gms.actions.SearchIntents;
import com.newrelic.agent.android.distributedtracing.DistributedTracing;
import com.payu.threedsbase.constants.APIConstants;
import in.juspay.hypersdk.core.PaymentConstants;
import in.swiggy.android.R;
import in.swiggy.android.activities.HomeActivity;
import in.swiggy.android.analytics.perf.AppLaunchContext;
import in.swiggy.android.analytics.perf.SwiggyPerfMonitor;
import in.swiggy.android.analytics.perf.a;
import in.swiggy.android.commons.extension.StringExtensionsKt;
import in.swiggy.android.commonsui.ui.arch.BaseMvvmActivity;
import in.swiggy.android.compass.defaulting.AppDefaultingContext;
import in.swiggy.android.constants.SwiggyGTMConstants;
import in.swiggy.android.deeplink.b;
import in.swiggy.android.mvvm.viewmodels.DeepLinkActivityViewModel;
import in.swiggy.android.notificationkit.processors.b;
import in.swiggy.android.notificationkit.processors.h;
import in.swiggy.android.tejas.generated.DownloaderGeneratedApiService;
import in.swiggy.android.tejas.oldapi.models.KeySeparator;
import in.swiggy.android.track.receivers.NotificationClickedBroadcastReceiver;
import io.reactivex.processors.BehaviorProcessor;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import kotlin.Unit;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.text.StringsKt__StringsKt;
import kotlinx.coroutines.CoroutineDispatcher;
import kotlinx.coroutines.f0;
import kotlinx.coroutines.q1;
import kotlinx.coroutines.v0;
import org.json.JSONObject;
public class DeepLinkActivity extends BaseMvvmActivity<DeepLinkActivityViewModel, in.swiggy.android.databinding.o> {
public static final a C = new a(null);
public static final int D = 8;
private static boolean E;
public BehaviorProcessor<c> A;
private q1 B;
public in.swiggy.android.repositories.interfaces.d j;
public AppDefaultingContext k;
public in.swiggy.android.analytics.d l;
public AppsFlyerConversionListener m;
public SharedPreferences n;
public in.swiggy.android.analytics.interfaces.c o;
public DownloaderGeneratedApiService p;
public in.swiggy.koordinates.compass.core.b q;
public LocationManager r;
public in.swiggy.android.swiggylocation.location.j s;
public in.swiggy.android.apputils.d t;
public in.swiggy.android.discovery.pageskeleton.datamanager.b u;
public in.swiggy.android.deeplink.b v;
public in.swiggy.android.commons.featureFlags.d w;
public in.swiggy.android.swiggylocation.utils.eventmanager.interfaces.a x;
private io.reactivex.disposables.a y;
private CoroutineDispatcher z;
public static final class a {
public a(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final boolean a() {
return DeepLinkActivity.E;
}
private a() {
}
}
public static final class b extends kotlin.coroutines.a implements kotlinx.coroutines.f0 {
public b(f0.a aVar) {
super(aVar);
}
@Override
public void L(CoroutineContext coroutineContext, Throwable th) {
in.swiggy.android.commons.utils.x.i("DeepLinkActivity", th);
}
}
public DeepLinkActivity() {
super(R.layout.activity_deeplink, kotlin.jvm.internal.r.b(DeepLinkActivityViewModel.class), null, 4, null);
this.y = new io.reactivex.disposables.a();
this.z = v0.b();
}
private final void A1() {
T1().edit().remove("deeplink_type").apply();
}
private final void B1() {
Bundle extras;
String string;
Intent intent = getIntent();
if (intent != null && (extras = intent.getExtras()) != null && (string = extras.getString("actionId")) != null) {
in.swiggy.android.commons.utils.x.b("actionId", string);
int i = extras.getInt("notificationId", -1);
if (i > -1) {
Object systemService = getApplicationContext().getSystemService("notification");
kotlin.jvm.internal.o.i(systemService, "null cannot be cast to non-null type android.app.NotificationManager");
((NotificationManager) systemService).cancel(i);
}
}
}
private final void C1() {
((DeepLinkActivityViewModel) V0()).i7();
}
private final void D1(Function0<Unit> function0) {
q1 q1Var = this.B;
if (q1Var != null) {
q1.a.a(q1Var, null, 1, null);
}
this.B = kotlinx.coroutines.g.d(androidx.lifecycle.s.a(this), new b(kotlinx.coroutines.f0.v0), null, new DeepLinkActivity$fetchLocationAndListen$2(this, function0, null), 2, null);
}
private final String L1(String str, String str2) {
boolean P;
if (StringExtensionsKt.c(str2)) {
return "direct";
}
if (str != null && str.length() != 0) {
List<String> e = SwiggyGTMConstants.a.e();
if (!(e instanceof Collection) || !e.isEmpty()) {
for (String str3 : e) {
P = kotlin.text.q.P(str, str3, false, 2, null);
if (P) {
return "seo";
}
}
}
}
return "external";
}
private final String P1() {
String dataString;
Intent intent = getIntent();
if (intent != null && (dataString = intent.getDataString()) != null) {
Uri parse = Uri.parse(dataString);
if (kotlin.jvm.internal.o.f(parse.getHost(), "otpVerify") || kotlin.jvm.internal.o.f(parse.getPath(), "/otpVerify")) {
return parse.getQueryParameter(APIConstants.OTP);
}
return null;
}
return null;
}
private final void U1(Intent intent, final boolean z) {
K1().init();
String P1 = P1();
if (P1 != null && !isTaskRoot()) {
finish();
R1().q0(P1);
return;
}
in.swiggy.android.notificationkit.utils.c cVar = in.swiggy.android.notificationkit.utils.c.a;
Bundle extras = intent.getExtras();
Context applicationContext = getApplicationContext();
kotlin.jvm.internal.o.j(applicationContext, "getApplicationContext(...)");
cVar.c(extras, applicationContext, Q1());
E = true;
d2(intent);
D1(new Function0<Unit>() {
{
super(0);
}
@Override
public Unit invoke() {
invoke2();
return Unit.a;
}
public final void invoke2() {
in.swiggy.koordinates.core.f a2 = DeepLinkActivity.this.M1().getLocation().getValue().a();
if (in.swiggy.koordinates.compass.utils.c.a.d(a2)) {
DeepLinkActivity.this.Y1();
return;
}
DeepLinkActivityViewModel w1 = DeepLinkActivity.w1(DeepLinkActivity.this);
final boolean z2 = z;
final DeepLinkActivity deepLinkActivity = DeepLinkActivity.this;
w1.J7(a2, new Function0<Unit>() {
public static final class a<T> implements androidx.lifecycle.z {
final DeepLinkActivity a;
public a(DeepLinkActivity deepLinkActivity) {
this.a = deepLinkActivity;
}
@Override
public final void onChanged(T value) {
kotlin.jvm.internal.o.k(value, "value");
if (((Boolean) value).booleanValue()) {
this.a.Y1();
}
}
}
{
super(0);
}
@Override
public Unit invoke() {
invoke2();
return Unit.a;
}
public final void invoke2() {
if (!z2 || !deepLinkActivity.W1()) {
deepLinkActivity.Y1();
} else {
DeepLinkActivity.w1(deepLinkActivity).T7();
DeepLinkActivity deepLinkActivity2 = deepLinkActivity;
DeepLinkActivity.w1(deepLinkActivity2).B7().k(deepLinkActivity2, new a(deepLinkActivity));
}
DeepLinkActivity.w1(deepLinkActivity).h7();
}
});
}
});
if (Build.VERSION.SDK_INT >= 31) {
B1();
}
}
private final Intent V1(Intent intent) {
if (kotlin.jvm.internal.o.f(intent.getAction(), SearchIntents.ACTION_SEARCH)) {
Intent intent2 = new Intent(getApplicationContext(), HomeActivity.class);
intent2.setFlags(603979776);
Bundle bundle = new Bundle();
bundle.putString("landingActivity", "explore");
bundle.putString("query", intent.getStringExtra("query"));
intent2.putExtras(bundle);
return intent2;
}
return null;
}
private final void X1(Intent intent) {
Intent intent2 = new Intent(this, HomeActivity.class);
intent2.setAction(intent.getAction());
intent2.setData(intent.getData());
intent.putExtra("deeplink_activity_processors_failed", true);
Bundle extras = intent.getExtras();
if (extras != null) {
intent2.putExtras(extras);
}
Bundle extras2 = intent.getExtras();
if (extras2 != null) {
intent2.putExtras(extras2);
intent2.putExtra("launchReferrer", intent.getDataString());
}
intent2.setFlags(872415232);
startActivity(intent2);
}
public final void Y1() {
String str;
String uri;
CharSequence k1;
E = false;
c2();
z1();
Intent intent = getIntent();
kotlin.jvm.internal.o.j(intent, "getIntent(...)");
Z1(intent);
Bundle extras = getIntent().getExtras();
if (extras != null) {
a2(extras);
}
in.swiggy.android.commons.rxjava.e.m(new Function0<Unit>() {
{
super(0);
}
@Override
public Unit invoke() {
invoke2();
return Unit.a;
}
public final void invoke2() {
DeepLinkActivity deepLinkActivity = DeepLinkActivity.this;
deepLinkActivity.y1(deepLinkActivity.getIntent());
}
});
finishAndRemoveTask();
Intent intent2 = getIntent();
kotlin.jvm.internal.o.j(intent2, "getIntent(...)");
Intent V1 = V1(intent2);
if (V1 != null) {
startActivity(V1);
return;
}
sendBroadcast(new Intent(this, NotificationClickedBroadcastReceiver.class));
if (getIntent().getData() == null) {
Intent intent3 = getIntent();
kotlin.jvm.internal.o.j(intent3, "getIntent(...)");
X1(intent3);
return;
}
Uri d = androidx.core.app.b.d(this);
String str2 = null;
if (d != null) {
str = d.toString();
} else {
str = null;
}
String string = T1().getString("android_playstore_uri", "android-app://com.android.vending");
if (string != null) {
k1 = StringsKt__StringsKt.k1(string);
str2 = k1.toString();
}
String str3 = "";
if ((str2 != null && kotlin.jvm.internal.o.f(str, str2)) || M1().getLocation().getValue().a().a() == 0.0d) {
in.swiggy.android.deeplink.b F1 = F1();
Intent intent4 = getIntent();
kotlin.jvm.internal.o.j(intent4, "getIntent(...)");
if (F1.a(intent4, this, false) != null) {
BehaviorProcessor<c> G1 = G1();
String dataString = getIntent().getDataString();
if (dataString == null) {
dataString = "";
}
kotlin.jvm.internal.o.h(dataString);
G1.y0(new c(dataString, DeeplinkSource.FIREBASE_DYNAMIC_LINK));
HomeActivity.a aVar = HomeActivity.C0;
String dataString2 = getIntent().getDataString();
if (dataString2 != null) {
str3 = dataString2;
}
aVar.a(this, str3);
return;
}
}
getIntent().putExtra("launched_from_deeplink_activity", true);
getIntent().putExtra("launch_source_package", str);
Uri data = getIntent().getData();
if (data != null && (uri = data.toString()) != null) {
T1().edit().putString("app_launch_url", uri).apply();
SharedPreferences.Editor edit = T1().edit();
if (str != null) {
str3 = str;
}
edit.putString("app_launch_referrer", str3).apply();
T1().edit().putString("app_launch_source", L1(str, uri)).apply();
in.swiggy.android.deeplink.b F12 = F1();
Intent intent5 = getIntent();
kotlin.jvm.internal.o.j(intent5, "getIntent(...)");
if (b.a.a(F12, intent5, this, false, 4, null) == null) {
Intent intent6 = getIntent();
kotlin.jvm.internal.o.j(intent6, "getIntent(...)");
X1(intent6);
return;
}
in.swiggy.android.analytics.perf.b.a.b(new a.C0561a("", in.swiggy.koordinates.compass.utils.d.a.a(this, O1()), null, 4, null));
}
}
private final void Z1(Intent intent) {
String dataString = intent.getDataString();
if (dataString != null && kotlin.jvm.internal.o.f(Uri.parse(dataString).getHost(), "menu")) {
Q1().i("source_attribution", new in.swiggy.android.analytics.attribution.b("", null, dataString, "deeplink", null, null, 50, null));
}
}
private final void a2(Bundle bundle) {
String string = bundle.getString("metaInfo");
if (string != null && string.length() != 0) {
try {
JSONObject jSONObject = new JSONObject(bundle.getString("metaInfo", ""));
String optString = jSONObject.optString("eventName");
String str = "deeplink";
String optString2 = jSONObject.optString("messageId");
String optString3 = jSONObject.optString(DistributedTracing.NR_ID_ATTRIBUTE);
String string2 = bundle.getString("category");
if (string2 != null) {
if (string2.hashCode() == -471072136 && string2.equals("chat-with-direct-reply")) {
str = "notification";
optString = "click-decx-chat-pn";
}
if (string2.hashCode() == 866154181 && string2.equals("order-status-update")) {
optString2 = bundle.getString("order_id", "");
}
}
String str2 = optString;
String str3 = str;
String str4 = optString2;
if (str2 != null && str2.length() != 0) {
Q1().b(Q1().q(str3, str2, str4, 9999, optString3));
}
} catch (Exception e) {
in.swiggy.android.commons.utils.x.i("DeepLinkActivity", e);
}
}
h.a aVar = in.swiggy.android.notificationkit.processors.h.e;
if (aVar.b(bundle)) {
aVar.c(Q1(), bundle);
}
b.a aVar2 = in.swiggy.android.notificationkit.processors.b.e;
if (aVar2.c(bundle)) {
aVar2.d(Q1(), bundle);
String string3 = bundle.getString("orderId", "");
kotlin.jvm.internal.o.j(string3, "getString(...)");
((DeepLinkActivityViewModel) V0()).R7(aVar2.b(string3));
}
}
private final void b2(Intent intent) {
J1().r(intent.getDataString());
Bundle extras = intent.getExtras();
if (extras != null && extras.containsKey("landingActivity")) {
in.swiggy.android.apputils.d J1 = J1();
kotlin.jvm.internal.o.h(extras);
J1.q(extras.getString("landingActivity"));
}
}
private final void c2() {
if (getIntent().getDataString() != null) {
BehaviorProcessor<c> G1 = G1();
String dataString = getIntent().getDataString();
if (dataString == null) {
dataString = "";
}
kotlin.jvm.internal.o.h(dataString);
G1.y0(new c(dataString, DeeplinkSource.NORMAL_DEEPLINK));
if (J1() != null) {
Intent intent = getIntent();
kotlin.jvm.internal.o.j(intent, "getIntent(...)");
b2(intent);
}
}
}
private final void d2(Intent intent) {
if (intent != null && kotlin.jvm.internal.o.f("android.intent.action.VIEW", intent.getAction()) && intent.getDataString() != null) {
in.swiggy.android.analytics.gtm.e.A("deeplink");
in.swiggy.android.commons.extension.a.b(T1(), "launch_source", "deeplink");
in.swiggy.android.analytics.perf.b.a.b(new a.b(SwiggyPerfMonitor.a.h(), AppLaunchContext.DEEPLINK));
}
}
public static final DeepLinkActivityViewModel w1(DeepLinkActivity deepLinkActivity) {
return (DeepLinkActivityViewModel) deepLinkActivity.V0();
}
public final void y1(Intent intent) {
Uri parse;
Set<String> queryParameterNames;
if (intent != null) {
try {
if (kotlin.jvm.internal.o.f("android.intent.action.VIEW", intent.getAction()) && intent.getDataString() != null && (queryParameterNames = (parse = Uri.parse(intent.getDataString())).getQueryParameterNames()) != null && queryParameterNames.contains(PaymentConstants.CLIENT_ID) && queryParameterNames.contains("seller_id")) {
String swuid = R1().getSwuid();
String query = parse.getQuery();
I1().hitAppsFlyerPixel("https://t.o-s.io/aclick?device_id=" + swuid + KeySeparator.AMP + query).k0(io.reactivex.schedulers.a.c()).P(io.reactivex.schedulers.a.c()).e0();
}
} catch (Exception e) {
in.swiggy.android.commons.utils.x.i("DeepLinkActivity", e);
}
}
}
private final void z1() {
Bundle extras;
String string;
boolean U;
List K0;
boolean U2;
A1();
Intent intent = getIntent();
if (intent != null && (extras = intent.getExtras()) != null && (string = extras.getString("market_referrer")) != null) {
kotlin.jvm.internal.o.h(string);
U = StringsKt__StringsKt.U(string, KeySeparator.AMP, false, 2, null);
if (U) {
K0 = StringsKt__StringsKt.K0(string, new String[]{KeySeparator.AMP}, false, 0, 6, null);
String[] strArr = (String[]) K0.toArray(new String[0]);
if (strArr != null && strArr.length != 0) {
for (String str : strArr) {
U2 = StringsKt__StringsKt.U(str, "af_sub1=burn", false, 2, null);
if (U2) {
in.swiggy.android.commons.extension.a.b(T1(), "deeplink_type", "EARN_FLOW");
return;
}
}
}
}
}
}
public final AppDefaultingContext E1() {
AppDefaultingContext appDefaultingContext = this.k;
if (appDefaultingContext != null) {
return appDefaultingContext;
}
kotlin.jvm.internal.o.C("appDefaultingContext");
return null;
}
public final in.swiggy.android.deeplink.b F1() {
in.swiggy.android.deeplink.b bVar = this.v;
if (bVar != null) {
return bVar;
}
kotlin.jvm.internal.o.C("deepLinkHandler");
return null;
}
public final BehaviorProcessor<c> G1() {
BehaviorProcessor<c> behaviorProcessor = this.A;
if (behaviorProcessor != null) {
return behaviorProcessor;
}
kotlin.jvm.internal.o.C("deeplinkBehaviorProcessor");
return null;
}
public final CoroutineDispatcher H1() {
return this.z;
}
public final DownloaderGeneratedApiService I1() {
DownloaderGeneratedApiService downloaderGeneratedApiService = this.p;
if (downloaderGeneratedApiService != null) {
return downloaderGeneratedApiService;
}
kotlin.jvm.internal.o.C("downloaderGeneratedApiService");
return null;
}
public final in.swiggy.android.apputils.d J1() {
in.swiggy.android.apputils.d dVar = this.t;
if (dVar != null) {
return dVar;
}
kotlin.jvm.internal.o.C("eventLoggerSingleton");
return null;
}
public final in.swiggy.android.commons.featureFlags.d K1() {
in.swiggy.android.commons.featureFlags.d dVar = this.w;
if (dVar != null) {
return dVar;
}
kotlin.jvm.internal.o.C("featureFlags");
return null;
}
public final in.swiggy.koordinates.compass.core.b M1() {
in.swiggy.koordinates.compass.core.b bVar = this.q;
if (bVar != null) {
return bVar;
}
kotlin.jvm.internal.o.C("locationContext");
return null;
}
public final in.swiggy.android.swiggylocation.utils.eventmanager.interfaces.a N1() {
in.swiggy.android.swiggylocation.utils.eventmanager.interfaces.a aVar = this.x;
if (aVar != null) {
return aVar;
}
kotlin.jvm.internal.o.C("locationEventManager");
return null;
}
public final LocationManager O1() {
LocationManager locationManager = this.r;
if (locationManager != null) {
return locationManager;
}
kotlin.jvm.internal.o.C("locationManager");
return null;
}
public final in.swiggy.android.analytics.interfaces.c Q1() {
in.swiggy.android.analytics.interfaces.c cVar = this.o;
if (cVar != null) {
return cVar;
}
kotlin.jvm.internal.o.C("mSwiggyEventHandler");
return null;
}
public final in.swiggy.android.repositories.interfaces.d R1() {
in.swiggy.android.repositories.interfaces.d dVar = this.j;
if (dVar != null) {
return dVar;
}
kotlin.jvm.internal.o.C("mUser");
return null;
}
public final in.swiggy.android.discovery.pageskeleton.datamanager.b S1() {
in.swiggy.android.discovery.pageskeleton.datamanager.b bVar = this.u;
if (bVar != null) {
return bVar;
}
kotlin.jvm.internal.o.C("pageSkeletonDataManager");
return null;
}
public final SharedPreferences T1() {
SharedPreferences sharedPreferences = this.n;
if (sharedPreferences != null) {
return sharedPreferences;
}
kotlin.jvm.internal.o.C("sharedPreferences");
return null;
}
public final boolean W1() {
return in.swiggy.koordinates.compass.utils.d.a.a(this, O1());
}
@Override
public void onBackPressed() {
((DeepLinkActivityViewModel) V0()).g7();
super.onBackPressed();
}
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
C1();
if (s1()) {
setIntent(new Intent());
}
onNewIntent(getIntent());
}
@Override
protected void onDestroy() {
super.onDestroy();
this.y.dispose();
S1().k(false);
E = false;
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if (intent != null) {
setIntent(intent);
if (((DeepLinkActivityViewModel) V0()).L7(intent) && !((DeepLinkActivityViewModel) V0()).S7()) {
U1(intent, true);
} else {
U1(intent, false);
}
}
}
@Override
protected void onStop() {
super.onStop();
}
}