得物.apk(点击下载) / d.java


package wd0;

import a01.a;
import android.app.Activity;
import android.app.Application;
import android.content.Intent;
import android.graphics.Point;
import android.net.Uri;
import android.os.Bundle;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.fragment.app.Fragment;
import bj1.e;
import com.alibaba.android.arouter.core.LogisticsCenter;
import com.alibaba.android.arouter.facade.Postcard;
import com.alibaba.android.arouter.launcher.ARouter;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.shizhuang.duapp.R;
import com.shizhuang.duapp.common.ui.BaseFragment;
import com.shizhuang.duapp.core.heiner.applife.AppLifecycleCallback;
import com.shizhuang.duapp.modules.home.model.SceneRecoverModel;
import com.shizhuang.duapp.modules.home.ui.HomeActivity;
import com.shizhuang.duapp.modules.home.utils.DeliveryNoticeHelper;
import com.shizhuang.duapp.modules.home.utils.RecallUserRestoreBackLoginHelper;
import com.shizhuang.duapp.modules.router.ServiceManager;
import com.shizhuang.dudatastatistics.factory.PoizonAnalyzeFactory;
import df.b0;
import h2.h;
import ij.s;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import kotlin.TuplesKt;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.collections.MapsKt__MapsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Ref;
import kotlin.text.StringsKt__StringNumberConversionsKt;
import kotlin.text.StringsKt__StringsJVMKt;
import nq.b;
import o5.i;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import zd0.y;

/* compiled from: SceneRecoverActivityLifecycleCallback.kt */
public final class d implements Application.ActivityLifecycleCallbacks, AppLifecycleCallback {
    public static ChangeQuickRedirect changeQuickRedirect;
    @NotNull

    /* renamed from: a  reason: collision with root package name */
    public final HashMap<String, String> f39576a = new HashMap<>();
    @NotNull
    public final HashMap<String, String> b = new HashMap<>();

    /* renamed from: c  reason: collision with root package name */
    public Activity f39577c;
    @NotNull
    public final Map<String, String> d;

    public d() {
        Class<?> destination;
        Class<?> destination2;
        Map<String, String> mutableMapOf = MapsKt__MapsKt.mutableMapOf(TuplesKt.to("/product/ProductDetail", "商详"), TuplesKt.to("/trend/FeedDetailsPage", "社区图文"), TuplesKt.to("/live/LiveRoomPage", "直播间"), TuplesKt.to("/product/search/ProductSearchResult", "购买搜索结果"), TuplesKt.to("/web/BrowserPage", "h5"));
        this.d = mutableMapOf;
        List<String> listOf = CollectionsKt__CollectionsKt.listOf((Object[]) new String[]{"/launcher/splash", "/home/DeepLink", "/home/MobLinkDispatch", "/home/HomePage"});
        for (String str : mutableMapOf.keySet()) {
            try {
                Postcard build = ARouter.getInstance().build(str);
                LogisticsCenter.completion(build);
                if (!(build == null || (destination2 = build.getDestination()) == null)) {
                    this.f39576a.put(destination2.getName(), str);
                }
            } catch (Exception unused) {
            }
        }
        for (String str2 : listOf) {
            try {
                Postcard build2 = ARouter.getInstance().build(str2);
                LogisticsCenter.completion(build2);
                if (!(build2 == null || (destination = build2.getDestination()) == null)) {
                    this.b.put(destination.getName(), str2);
                }
            } catch (Exception unused2) {
            }
        }
    }

    public final void a(@NotNull Activity activity, boolean z) {
        if (!PatchProxy.proxy(new Object[]{activity, new Byte(z ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 155280, new Class[]{Activity.class, Boolean.TYPE}, Void.TYPE).isSupported) {
            if (!b0.h().getBoolean("scene_recover_skip_clear", false)) {
                String str = this.b.get(activity.getClass().getName());
                if (str == null || (Intrinsics.areEqual(str, "/home/HomePage") && z)) {
                    b0.h().putString("last_scene_model", "");
                }
            } else if (z) {
                b0.h().putBoolean("scene_recover_skip_clear", false);
            }
        }
    }

    @NotNull
    public final String b(@Nullable String str) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str}, this, changeQuickRedirect, false, 155274, new Class[]{String.class}, String.class);
        if (proxy.isSupported) {
            return (String) proxy.result;
        }
        if (str == null) {
            return "";
        }
        String str2 = this.d.get(str);
        return str2 != null ? str2 : "主题页";
    }

    public final void c(String str, Bundle bundle) {
        if (!PatchProxy.proxy(new Object[]{str, bundle}, this, changeQuickRedirect, false, 155279, new Class[]{String.class, Bundle.class}, Void.TYPE).isSupported) {
            SceneRecoverModel sceneRecoverModel = new SceneRecoverModel(str, null, null, 6, null);
            sceneRecoverModel.setParams(sceneRecoverModel.parseBundle(bundle));
            b0.h().putString("last_scene_model", h.e(sceneRecoverModel));
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:100:? A[RETURN, SYNTHETIC] */
    /* JADX WARNING: Removed duplicated region for block: B:59:0x01a7  */
    /* JADX WARNING: Removed duplicated region for block: B:65:0x01d8  */
    /* JADX WARNING: Removed duplicated region for block: B:68:0x01e3 A[SYNTHETIC, Splitter:B:68:0x01e3] */
    public void onActivityCreated(@NotNull Activity activity, @Nullable Bundle bundle) {
        String str;
        WindowManager windowManager;
        WindowManager.LayoutParams layoutParams;
        String str2;
        if (!PatchProxy.proxy(new Object[]{activity, bundle}, this, changeQuickRedirect, false, 155275, new Class[]{Activity.class, Bundle.class}, Void.TYPE).isSupported) {
            if (!PatchProxy.proxy(new Object[]{activity}, this, changeQuickRedirect, false, 155276, new Class[]{Activity.class}, Void.TYPE).isSupported) {
                a(activity, false);
                Bundle extras = activity.getIntent().getExtras();
                String str3 = "";
                if (extras == null || (str = extras.getString("NTeRQWvye18AkPd6G")) == null) {
                    str = str3;
                }
                String queryParameter = Uri.parse(str).getQueryParameter("deliveryNotice");
                if (!(queryParameter == null || StringsKt__StringsJVMKt.isBlank(queryParameter))) {
                    Integer intOrNull = StringsKt__StringNumberConversionsKt.toIntOrNull(queryParameter);
                    int intValue = intOrNull != null ? intOrNull.intValue() : 0;
                    if (1 <= intValue && 4 >= intValue) {
                        DeliveryNoticeHelper deliveryNoticeHelper = new DeliveryNoticeHelper();
                        Integer intOrNull2 = StringsKt__StringNumberConversionsKt.toIntOrNull(queryParameter);
                        int intValue2 = intOrNull2 != null ? intOrNull2.intValue() : 0;
                        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{activity, new Integer(intValue2)}, deliveryNoticeHelper, DeliveryNoticeHelper.changeQuickRedirect, false, 156976, new Class[]{Activity.class, Integer.TYPE}, Boolean.TYPE);
                        if (proxy.isSupported) {
                            ((Boolean) proxy.result).booleanValue();
                        } else if ((activity instanceof AppCompatActivity) && 1 <= intValue2 && 4 >= intValue2) {
                            try {
                                if (b.c(activity)) {
                                    ((AppCompatActivity) activity).getLifecycle().addObserver(deliveryNoticeHelper);
                                    View inflate = LayoutInflater.from(activity).inflate(R.layout.view_delivery_notice, (ViewGroup) null);
                                    AppCompatImageView appCompatImageView = (AppCompatImageView) inflate.findViewById(R.id.icon);
                                    TextView textView = (TextView) inflate.findViewById(R.id.title);
                                    TextView textView2 = (TextView) inflate.findViewById(R.id.subTitle);
                                    ((TextView) inflate.findViewById(R.id.tvGoAtOnce)).setVisibility(intValue2 != 1 ? 0 : 8);
                                    if (intValue2 == 2) {
                                        appCompatImageView.setImageResource(R.drawable.ic_delivery_notice_2);
                                        textView.setText("你已获得限时补贴特权");
                                        textView2.setText("限时秒杀、全网低价等你来");
                                        str2 = "https://m.dewu.com/activity-ssr/welfare-center?navControl=1&toolbarControl=1&sourceName=chengjie";
                                    } else if (intValue2 != 3) {
                                        if (intValue2 == 4) {
                                            appCompatImageView.setImageResource(R.drawable.ic_delivery_notice_4);
                                            textView.setText("你已获得9元购特权");
                                            textView2.setText("热门好物,9元起购");
                                            str2 = "https://cdn-m.dewu.com/h5-growth/original/list?navControl=1&toolbarControl=1&source=chengjie";
                                        }
                                        windowManager = (WindowManager) inflate.getContext().getSystemService("window");
                                        layoutParams = new WindowManager.LayoutParams();
                                        if (!PatchProxy.proxy(new Object[]{windowManager, layoutParams}, deliveryNoticeHelper, DeliveryNoticeHelper.changeQuickRedirect, false, 156980, new Class[]{WindowManager.class, WindowManager.LayoutParams.class}, Void.TYPE).isSupported) {
                                            Display defaultDisplay = windowManager.getDefaultDisplay();
                                            Point point = new Point();
                                            layoutParams.format = -3;
                                            layoutParams.flags = 136;
                                            layoutParams.gravity = 49;
                                            layoutParams.windowAnimations = R.style.anim_popup;
                                            layoutParams.x = 0;
                                            layoutParams.y = 0;
                                            if (defaultDisplay != null) {
                                                defaultDisplay.getSize(point);
                                            }
                                            layoutParams.width = point.x - 80;
                                            layoutParams.height = -2;
                                        }
                                        if (inflate.getParent() != null) {
                                            windowManager.removeViewImmediate(inflate);
                                        }
                                        if (!b.c(activity)) {
                                            try {
                                                windowManager.addView(inflate, layoutParams);
                                                deliveryNoticeHelper.f15829c = inflate;
                                                inflate.animate().y(i.f36333a).translationY(1.0f).setDuration(500).start();
                                                s sVar = s.f33475a;
                                                String valueOf = String.valueOf(intValue2);
                                                if (!PatchProxy.proxy(new Object[]{"1", valueOf}, sVar, s.changeQuickRedirect, false, 20747, new Class[]{String.class, String.class}, Void.TYPE).isSupported) {
                                                    HashMap j = a.j("current_page", "1325", "activity_num", "1");
                                                    if (valueOf != null) {
                                                        if (valueOf.length() > 0) {
                                                            j.put("delivery_notice", valueOf);
                                                        }
                                                    }
                                                    PoizonAnalyzeFactory.a().track("venue_pop_ups_exposure", j);
                                                }
                                                Ref.FloatRef floatRef = new Ref.FloatRef();
                                                floatRef.element = i.f36333a;
                                                inflate.setOnTouchListener(new zd0.i(deliveryNoticeHelper, floatRef, str3, activity, textView, intValue2));
                                                if (!PatchProxy.proxy(new Object[]{inflate}, deliveryNoticeHelper, DeliveryNoticeHelper.changeQuickRedirect, false, 156977, new Class[]{View.class}, Void.TYPE).isSupported) {
                                                    deliveryNoticeHelper.b = e.timer(3, TimeUnit.SECONDS).observeOn(ej1.a.c()).subscribe(new zd0.h(deliveryNoticeHelper, inflate));
                                                    return;
                                                }
                                                return;
                                            } catch (Exception e) {
                                                fo.a.u("DeliveryNoticeHelper addView Exception").i(e.getMessage(), new Object[0]);
                                                return;
                                            }
                                        } else {
                                            return;
                                        }
                                    } else {
                                        appCompatImageView.setImageResource(R.drawable.ic_delivery_notice_3);
                                        textView.setText("你已获得0元抽奖特权");
                                        textView2.setText("热门好物,0元开抽");
                                        str2 = "https://cdn-m.dewu.com/h5-growth/zeroLottery?navControl=1&toolbarControl=1&source=chengjie";
                                    }
                                    str3 = str2;
                                    windowManager = (WindowManager) inflate.getContext().getSystemService("window");
                                    layoutParams = new WindowManager.LayoutParams();
                                    if (!PatchProxy.proxy(new Object[]{windowManager, layoutParams}, deliveryNoticeHelper, DeliveryNoticeHelper.changeQuickRedirect, false, 156980, new Class[]{WindowManager.class, WindowManager.LayoutParams.class}, Void.TYPE).isSupported) {
                                    }
                                    if (inflate.getParent() != null) {
                                    }
                                    if (!b.c(activity)) {
                                    }
                                }
                            } catch (Exception e6) {
                                e6.printStackTrace();
                            }
                        }
                    }
                }
            }
        }
    }

    public void onActivityDestroyed(@NotNull Activity activity) {
        boolean z = PatchProxy.proxy(new Object[]{activity}, this, changeQuickRedirect, false, 155284, new Class[]{Activity.class}, Void.TYPE).isSupported;
    }

    public void onActivityPaused(@NotNull Activity activity) {
        if (!PatchProxy.proxy(new Object[]{activity}, this, changeQuickRedirect, false, 155281, new Class[]{Activity.class}, Void.TYPE).isSupported) {
            if (!y.f40681a.e()) {
                activity = null;
            }
            this.f39577c = activity;
        }
    }

    public void onActivityResumed(@NotNull Activity activity) {
        String str;
        if (!PatchProxy.proxy(new Object[]{activity}, this, changeQuickRedirect, false, 155278, new Class[]{Activity.class}, Void.TYPE).isSupported) {
            try {
                String str2 = this.f39576a.get(activity.getClass().getName());
                if (str2 == null) {
                    a(activity, true);
                } else if (b0.h().getBoolean("scene_recover_skip_clear", false)) {
                    b0.h().putBoolean("scene_recover_skip_clear", false);
                    return;
                } else {
                    Intent intent = activity.getIntent();
                    c(str2, intent != null ? intent.getExtras() : null);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            Bundle extras = activity.getIntent().getExtras();
            if (extras == null || (str = extras.getString("NTeRQWvye18AkPd6G")) == null) {
                str = "";
            }
            y yVar = y.f40681a;
            if (yVar.a(str)) {
                ServiceManager.k().setNeedInterceptLogin(false);
            }
            Activity activity2 = this.f39577c;
            if (activity2 != null) {
                if (yVar.e() && (activity instanceof HomeActivity)) {
                    Intent intent2 = activity2.getIntent();
                    if (yVar.b(intent2 != null ? intent2.getStringExtra("loadUrl") : null)) {
                        yVar.g(true);
                        RecallUserRestoreBackLoginHelper recallUserRestoreBackLoginHelper = RecallUserRestoreBackLoginHelper.f15856a;
                        Intent intent3 = activity2.getIntent();
                        if (!recallUserRestoreBackLoginHelper.a(activity, intent3 != null ? intent3.getStringExtra("loadUrl") : null)) {
                            Fragment findFragmentByTag = ((HomeActivity) activity).getSupportFragmentManager().findFragmentByTag("mall");
                            if (!(findFragmentByTag instanceof BaseFragment)) {
                                findFragmentByTag = null;
                            }
                            BaseFragment baseFragment = (BaseFragment) findFragmentByTag;
                            if (baseFragment != null) {
                                ServiceManager.w().tryShowMallDialog(baseFragment);
                            } else {
                                return;
                            }
                        }
                    }
                }
                this.f39577c = null;
            }
        }
    }

    public void onActivitySaveInstanceState(@NotNull Activity activity, @NotNull Bundle bundle) {
        boolean z = PatchProxy.proxy(new Object[]{activity, bundle}, this, changeQuickRedirect, false, 155283, new Class[]{Activity.class, Bundle.class}, Void.TYPE).isSupported;
    }

    public void onActivityStarted(@NotNull Activity activity) {
        boolean z = PatchProxy.proxy(new Object[]{activity}, this, changeQuickRedirect, false, 155277, new Class[]{Activity.class}, Void.TYPE).isSupported;
    }

    public void onActivityStopped(@NotNull Activity activity) {
        boolean z = PatchProxy.proxy(new Object[]{activity}, this, changeQuickRedirect, false, 155282, new Class[]{Activity.class}, Void.TYPE).isSupported;
    }

    @Override // com.shizhuang.duapp.core.heiner.applife.AppLifecycleCallback
    public void onAppBackground() {
        Activity f;
        Intent intent;
        Bundle extras;
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 155286, new Class[0], Void.TYPE).isSupported) {
            b0.h().putLong("app_background_time", System.currentTimeMillis());
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 155287, new Class[0], Void.TYPE).isSupported && (f = sg.b.f()) != null && !(!Intrinsics.areEqual("/live/LiveRoomPage", this.f39576a.get(f.getClass().getName()))) && (intent = f.getIntent()) != null && (extras = intent.getExtras()) != null) {
                try {
                    Object clone = extras.clone();
                    if (clone != null) {
                        Bundle bundle = (Bundle) clone;
                        Bundle bundle2 = bundle.getBundle("liveRoomParam");
                        if (bundle2 != null) {
                            bundle2.putInt("roomId", extras.getInt("roomId"));
                            bundle2.putString("cover", extras.getString("cover"));
                            String string = extras.getString("playUrl");
                            bundle2.putString("playUrl", string);
                            if (string != null) {
                                bundle2.remove("playH265Url");
                            }
                            c("/live/LiveRoomPage", bundle);
                            return;
                        }
                        return;
                    }
                    throw new NullPointerException("null cannot be cast to non-null type android.os.Bundle");
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }

    @Override // com.shizhuang.duapp.core.heiner.applife.AppLifecycleCallback
    public void onAppForeground() {
        boolean z = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 155285, new Class[0], Void.TYPE).isSupported;
    }
}