得物.apk(点击下载) / PmShareIconCallback$initShareButton$2.java


package com.shizhuang.duapp.modules.product_detail.detailv3.callbacks;

import a.f;
import a01.a;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import androidx.lifecycle.LifecycleOwnerKt;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import com.shizhuang.duapp.R;
import com.shizhuang.duapp.common.helper.net.ParamsBuilder;
import com.shizhuang.duapp.common.utils.screenshot.models.DouYinActivityInfoModel;
import com.shizhuang.duapp.modules.du_mall_common.constant.MallABTest;
import com.shizhuang.duapp.modules.product_detail.api.GrowthService;
import com.shizhuang.duapp.modules.product_detail.detail.dialog.CommodityPictorialShareDialog;
import com.shizhuang.duapp.modules.product_detail.detailv3.model.PmBrandItemModel;
import com.shizhuang.duapp.modules.product_detail.detailv3.model.PmDetailInfoModel;
import com.shizhuang.duapp.modules.product_detail.detailv3.model.PmFavoriteCountModel;
import com.shizhuang.duapp.modules.product_detail.detailv3.model.PmModel;
import com.shizhuang.duapp.modules.product_detail.detailv3.vm.PmViewModel;
import com.shizhuang.duapp.modules.product_detail.model.DistributionCodeModel;
import com.shizhuang.duapp.modules.product_detail.model.HelpGetFreeMailModel;
import com.shizhuang.duapp.modules.product_detail.model.ShareCardModel;
import com.shizhuang.duapp.modules.router.ServiceManager;
import com.shizhuang.duapp.modules.share.ShareDialog;
import com.shizhuang.duapp.modules.share.ShareIconBean;
import com.shizhuang.duapp.modules.share.ShareRightFlagBean;
import com.shizhuang.dudatastatistics.factory.PoizonAnalyzeFactory;
import com.shizhuang.model.trend.PersonalLetterModel;
import com.shizhuang.model.trend.PersonalLetterProductModel;
import df.b0;
import fd.c;
import fi.b;
import ij.c0;
import ij.h;
import j50.p;
import j60.x;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import k31.d;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Lambda;
import kotlin.text.StringsKt__StringsJVMKt;
import m01.t;
import m01.u;
import pb1.i;
import r01.o;
import rd.g;
import td.j;
import td.s;
import ub1.e;

@Metadata(bv = {1, 0, 3}, d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "", "invoke"}, k = 3, mv = {1, 4, 2})
/* compiled from: PmShareIconCallback.kt */
public final class PmShareIconCallback$initShareButton$2 extends Lambda implements Function0<Unit> {
    public static ChangeQuickRedirect changeQuickRedirect;
    public final /* synthetic */ PmShareIconCallback this$0;

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public PmShareIconCallback$initShareButton$2(PmShareIconCallback pmShareIconCallback) {
        super(0);
        this.this$0 = pmShareIconCallback;
    }

    @Override // kotlin.jvm.functions.Function0
    public final void invoke() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 262899, new Class[0], Void.TYPE).isSupported) {
            h hVar = h.f33463a;
            PmShareIconCallback pmShareIconCallback = this.this$0;
            String str = pmShareIconCallback.p ? "微信" : "普通";
            String valueOf = String.valueOf(pmShareIconCallback.c().getSpuId());
            String valueOf2 = String.valueOf(this.this$0.c().k().O());
            if (!PatchProxy.proxy(new Object[]{str, "", valueOf, valueOf2}, hVar, h.changeQuickRedirect, false, 20610, new Class[]{String.class, String.class, String.class, String.class}, Void.TYPE).isSupported) {
                HashMap j = a.j("current_page", "400000", "block_type", "1707");
                if (str.length() > 0) {
                    j.put("block_content_title", str);
                }
                if ("".length() > 0) {
                    j.put("jump_content_url", "");
                }
                if (valueOf != null) {
                    if (valueOf.length() > 0) {
                        j.put("spu_id", valueOf);
                    }
                }
                if (valueOf2 != null) {
                    if (valueOf2.length() > 0) {
                        j.put(MallABTest.Keys.PRODUCT_DETAIL_TYPE, valueOf2);
                    }
                }
                PoizonAnalyzeFactory.a().track("trade_product_detail_block_click", j);
            }
            PmShareIconCallback pmShareIconCallback2 = this.this$0;
            AnonymousClass1 r22 = new Function0<Unit>(this) {
                /* class com.shizhuang.duapp.modules.product_detail.detailv3.callbacks.PmShareIconCallback$initShareButton$2.AnonymousClass1 */
                public static ChangeQuickRedirect changeQuickRedirect;
                public final /* synthetic */ PmShareIconCallback$initShareButton$2 this$0;

                {
                    this.this$0 = r1;
                }

                /* JADX WARNING: Code restructure failed: missing block: B:165:0x04b0, code lost:
                    r15 = r11.getMiniShareLinkUrl();
                 */
                @Override // kotlin.jvm.functions.Function0
                public final void invoke() {
                    PmModel value;
                    PersonalLetterModel personalLetterModel;
                    ShareDialog shareDialog;
                    boolean z;
                    String str;
                    String str2;
                    String str3;
                    String str4;
                    ShareDialog shareDialog2;
                    i iVar;
                    ShareDialog x;
                    ShareDialog w;
                    ShareDialog v4;
                    String str5;
                    String str6;
                    String str7;
                    String str8;
                    String str9;
                    String str10;
                    boolean z4;
                    if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 262900, new Class[0], Void.TYPE).isSupported && (value = this.this$0.this$0.c().getModel().getValue()) != null) {
                        PmShareIconCallback pmShareIconCallback = this.this$0.this$0;
                        if (!PatchProxy.proxy(new Object[]{value}, pmShareIconCallback, PmShareIconCallback.changeQuickRedirect, false, 262859, new Class[]{PmModel.class}, Void.TYPE).isSupported) {
                            ArrayList<ShareIconBean> h12 = ShareDialog.h();
                            h12.add(0, new ShareIconBean(R.mipmap.du_share_peronal_latter, R.string.du_share_personal_letter, 16));
                            PatchProxyResult proxy = PatchProxy.proxy(new Object[]{value}, pmShareIconCallback, PmShareIconCallback.changeQuickRedirect, false, 262860, new Class[]{PmModel.class}, PersonalLetterModel.class);
                            if (proxy.isSupported) {
                                personalLetterModel = (PersonalLetterModel) proxy.result;
                            } else {
                                personalLetterModel = new PersonalLetterModel();
                                personalLetterModel.type = 7;
                                PersonalLetterProductModel personalLetterProductModel = new PersonalLetterProductModel();
                                personalLetterModel.product = personalLetterProductModel;
                                personalLetterProductModel.productId = String.valueOf(pmShareIconCallback.c().getSpuId());
                                personalLetterModel.product.skuId = String.valueOf(pmShareIconCallback.c().getSkuId());
                                PersonalLetterProductModel personalLetterProductModel2 = personalLetterModel.product;
                                PmDetailInfoModel detail = value.getDetail();
                                personalLetterProductModel2.productName = detail != null ? detail.detailTitle() : null;
                                PersonalLetterProductModel personalLetterProductModel3 = personalLetterModel.product;
                                String f = pmShareIconCallback.c().k().f();
                                if (f == null) {
                                    f = "";
                                }
                                personalLetterProductModel3.cover = p.b(f);
                                personalLetterModel.product.price = String.valueOf(pmShareIconCallback.c().k().g());
                                PersonalLetterProductModel personalLetterProductModel4 = personalLetterModel.product;
                                StringBuilder h13 = f.h("https://m.poizon.com/router/product/ProductDetail?spuId=");
                                h13.append(pmShareIconCallback.c().getSpuId());
                                h13.append("&skuId=");
                                h13.append(pmShareIconCallback.c().getSkuId());
                                h13.append("&sourceName=sms&propertyValueId=");
                                h13.append(pmShareIconCallback.c().A());
                                personalLetterProductModel4.jumpUrl = h13.toString();
                                PersonalLetterProductModel personalLetterProductModel5 = personalLetterModel.product;
                                PmBrandItemModel brand = value.getBrand();
                                personalLetterProductModel5.brandName = brand != null ? brand.getBrandName() : null;
                                PersonalLetterProductModel personalLetterProductModel6 = personalLetterModel.product;
                                PmBrandItemModel brand2 = value.getBrand();
                                personalLetterProductModel6.brandLogo = brand2 != null ? brand2.getBrandLogo() : null;
                            }
                            Object[] objArr = {h12, new Byte((byte) 1), personalLetterModel};
                            ChangeQuickRedirect changeQuickRedirect2 = ShareDialog.changeQuickRedirect;
                            Class cls = Boolean.TYPE;
                            PatchProxyResult proxy2 = PatchProxy.proxy(objArr, null, changeQuickRedirect2, true, 321751, new Class[]{ArrayList.class, cls, PersonalLetterModel.class}, ShareDialog.class);
                            if (proxy2.isSupported) {
                                shareDialog = (ShareDialog) proxy2.result;
                            } else {
                                ShareDialog shareDialog3 = new ShareDialog();
                                Bundle bundle = new Bundle();
                                bundle.putBoolean("shareFriendsList", true);
                                bundle.putParcelable("shareProductModel", personalLetterModel);
                                bundle.putParcelableArrayList("shareIconList", h12);
                                shareDialog3.setArguments(bundle);
                                shareDialog = shareDialog3;
                            }
                            ShareDialog G = shareDialog.G();
                            if (ServiceManager.s().isUserLogin()) {
                                qz0.a aVar = qz0.a.f37571a;
                                long fetchSpuId = value.fetchSpuId();
                                s withoutToast = new m01.s(pmShareIconCallback, value, G, pmShareIconCallback.f13641c).withoutToast();
                                if (!PatchProxy.proxy(new Object[]{new Long(fetchSpuId), withoutToast}, aVar, qz0.a.changeQuickRedirect, false, 258654, new Class[]{Long.TYPE, s.class}, Void.TYPE).isSupported) {
                                    j.doRequest(((GrowthService) j.getJavaGoApi(GrowthService.class)).getShareUser(g.a(ParamsBuilder.newParams().addParams("spuId", Long.valueOf(fetchSpuId)))), withoutToast);
                                }
                            }
                            PatchProxyResult proxy3 = PatchProxy.proxy(new Object[0], pmShareIconCallback, PmShareIconCallback.changeQuickRedirect, false, 262857, new Class[0], cls);
                            if (proxy3.isSupported) {
                                z = ((Boolean) proxy3.result).booleanValue();
                            } else {
                                DouYinActivityInfoModel douYinActivityInfoModel = pmShareIconCallback.e;
                                String name = douYinActivityInfoModel != null ? douYinActivityInfoModel.getName() : null;
                                z = !(name == null || StringsKt__StringsJVMKt.isBlank(name)) && b0.i("video_share_pop").getInt(d.f34500a.a(name), 0) == 0;
                            }
                            pmShareIconCallback.f22027h = z;
                            if (z) {
                                ShareRightFlagBean shareRightFlagBean = new ShareRightFlagBean();
                                shareRightFlagBean.iconRes = R.drawable.du_share_icon_douyin_tips;
                                shareRightFlagBean.width = b.b((float) 52);
                                shareRightFlagBean.height = b.b((float) 12);
                                shareRightFlagBean.rightMargin = 0;
                                if (G != null) {
                                    G.I(shareRightFlagBean);
                                }
                                DouYinActivityInfoModel douYinActivityInfoModel2 = pmShareIconCallback.e;
                                String name2 = douYinActivityInfoModel2 != null ? douYinActivityInfoModel2.getName() : null;
                                if (!(name2 == null || StringsKt__StringsJVMKt.isBlank(name2))) {
                                    b0.i("video_share_pop").putInt(d.f34500a.a(name2), 1);
                                }
                            } else if (G != null) {
                                G.I(null);
                            }
                            if (G != null) {
                                PatchProxyResult proxy4 = PatchProxy.proxy(new Object[0], CommodityPictorialShareDialog.m, CommodityPictorialShareDialog.a.changeQuickRedirect, false, 261510, new Class[0], cls);
                                if (proxy4.isSupported) {
                                    z4 = ((Boolean) proxy4.result).booleanValue();
                                } else {
                                    Calendar instance = Calendar.getInstance();
                                    Date time = instance.getTime();
                                    instance.set(2021, 9, 24, 0, 0, 0);
                                    z4 = time.before(instance.getTime());
                                }
                                G.f(new ShareIconBean(R.drawable.ic_share_pictorial, R.string.du_commodity_pictorial_share, 100, z4 ? new ShareRightFlagBean() : null));
                            }
                            DistributionCodeModel distributionCodeModel = pmShareIconCallback.d;
                            String keywordText = distributionCodeModel != null ? distributionCodeModel.getKeywordText() : null;
                            if (!(keywordText == null || StringsKt__StringsJVMKt.isBlank(keywordText)) && G != null) {
                                PatchProxyResult proxy5 = PatchProxy.proxy(new Object[]{null}, G, ShareDialog.changeQuickRedirect, false, 321795, new Class[]{ShareRightFlagBean.class}, ShareDialog.class);
                                if (proxy5.isSupported) {
                                    ShareDialog shareDialog4 = (ShareDialog) proxy5.result;
                                } else {
                                    G.s.add(new ShareIconBean(R.mipmap.du_share_dw_code, R.string.du_share_dw_code, 15, null));
                                }
                            }
                            HelpGetFreeMailModel helpGetFreeMailModel = pmShareIconCallback.f;
                            Integer showType = helpGetFreeMailModel != null ? helpGetFreeMailModel.getShowType() : null;
                            if (showType != null && showType.intValue() == 1) {
                                if (G != null) {
                                    str = null;
                                    ShareIconBean shareIconBean = new ShareIconBean(-1, -1, 19, null);
                                    shareIconBean.setExtraInfo(h2.h.e(pmShareIconCallback.f));
                                    Unit unit = Unit.INSTANCE;
                                    G.f(shareIconBean);
                                } else {
                                    str = null;
                                }
                                pmShareIconCallback.d();
                            } else {
                                str = null;
                            }
                            if (c.d("face_scan_code_v510", 0) == 1) {
                                if (G != null) {
                                    G.f(new ShareIconBean(R.mipmap.scan_face, R.string.scan_face_share, 20));
                                }
                                c0 c0Var = c0.f33454a;
                                PmDetailInfoModel detail2 = value.getDetail();
                                String valueOf = detail2 != null ? String.valueOf(detail2.getSpuId()) : str;
                                if (!PatchProxy.proxy(new Object[]{valueOf}, c0Var, c0.changeQuickRedirect, false, 20975, new Class[]{String.class}, Void.TYPE).isSupported) {
                                    HashMap j = a.j("current_page", "400000", "block_type", "3133");
                                    if (valueOf != null) {
                                        if (valueOf.length() > 0) {
                                            j.put("spu_id", valueOf);
                                        }
                                    }
                                    PoizonAnalyzeFactory.a().track("venue_pop_ups_exposure", j);
                                }
                            }
                            if (qc.b.f37325a) {
                                PmDetailInfoModel detail3 = value.getDetail();
                                String logoUrl = detail3 != null ? detail3.getLogoUrl() : str;
                                i iVar2 = new i();
                                iVar2.x("fit_center");
                                Unit unit2 = Unit.INSTANCE;
                                e.a(logoUrl, 100, iVar2);
                            }
                            DistributionCodeModel distributionCodeModel2 = pmShareIconCallback.d;
                            String shortUrl = distributionCodeModel2 != null ? distributionCodeModel2.getShortUrl() : str;
                            if (shortUrl == null || StringsKt__StringsJVMKt.isBlank(shortUrl)) {
                                str2 = pmShareIconCallback.c().k().k();
                            } else {
                                DistributionCodeModel distributionCodeModel3 = pmShareIconCallback.d;
                                str2 = distributionCodeModel3 != null ? distributionCodeModel3.getShortUrl() : str;
                            }
                            DistributionCodeModel distributionCodeModel4 = pmShareIconCallback.d;
                            String miniProgramsUrl = distributionCodeModel4 != null ? distributionCodeModel4.getMiniProgramsUrl() : str;
                            if (miniProgramsUrl == null || StringsKt__StringsJVMKt.isBlank(miniProgramsUrl)) {
                                PmViewModel.PmGlobalStatus k = pmShareIconCallback.c().k();
                                PatchProxyResult proxy6 = PatchProxy.proxy(new Object[0], k, PmViewModel.PmGlobalStatus.changeQuickRedirect, false, 272112, new Class[0], String.class);
                                if (proxy6.isSupported) {
                                    str3 = (String) proxy6.result;
                                } else {
                                    PmModel value2 = k.f22397c.getModel().getValue();
                                    if (value2 == null || (r11 = value2.getShareInfo()) == null || str3 == null) {
                                        str4 = "";
                                        str3 = str4;
                                    } else {
                                        try {
                                            Uri parse = Uri.parse(str3);
                                            if (parse.getQueryParameter("skuId") == null) {
                                                Uri.Builder buildUpon = parse.buildUpon();
                                                StringBuilder sb2 = new StringBuilder();
                                                str4 = "";
                                                try {
                                                    sb2.append(str4);
                                                    sb2.append(k.f22397c.getSkuId());
                                                    str3 = buildUpon.appendQueryParameter("skuId", sb2.toString()).build().toString();
                                                } catch (Exception unused) {
                                                }
                                            }
                                        } catch (Exception unused2) {
                                        }
                                    }
                                }
                                str4 = "";
                            } else {
                                str4 = "";
                                DistributionCodeModel distributionCodeModel5 = pmShareIconCallback.d;
                                str3 = distributionCodeModel5 != null ? distributionCodeModel5.getMiniProgramsUrl() : null;
                            }
                            long g3 = pmShareIconCallback.c().k().g();
                            o oVar = o.f37583a;
                            ShareCardModel shareCardModel = pmShareIconCallback.f22026g;
                            String f12 = pmShareIconCallback.c().k().f();
                            PatchProxyResult proxy7 = PatchProxy.proxy(new Object[]{shareCardModel, value, str2, str3, null, new Long(g3), f12}, oVar, o.changeQuickRedirect, false, 264828, new Class[]{ShareCardModel.class, PmModel.class, String.class, String.class, Bitmap.class, Long.TYPE, String.class}, i.class);
                            if (proxy7.isSupported) {
                                iVar = (i) proxy7.result;
                                shareDialog2 = G;
                            } else {
                                iVar = new i();
                                PmDetailInfoModel detail4 = value.getDetail();
                                PmFavoriteCountModel favoriteCount = value.getFavoriteCount();
                                if (favoriteCount == null || (str5 = favoriteCount.getContent()) == null) {
                                    str5 = str4;
                                }
                                String title = shareCardModel != null ? shareCardModel.getTitle() : null;
                                if (!(title == null || title.length() == 0)) {
                                    str6 = shareCardModel != null ? shareCardModel.getTitle() : null;
                                } else {
                                    PmDetailInfoModel detail5 = value.getDetail();
                                    if (detail5 == null || (str6 = detail5.getTitle()) == null) {
                                        str6 = str4;
                                    }
                                }
                                String text = shareCardModel != null ? shareCardModel.getText() : null;
                                if (!(text == null || text.length() == 0)) {
                                    str8 = shareCardModel != null ? shareCardModel.getText() : null;
                                    shareDialog2 = G;
                                    str7 = str4;
                                } else if (g3 > 0) {
                                    StringBuilder h14 = f.h("当前售价:");
                                    str7 = str4;
                                    shareDialog2 = G;
                                    h14.append(x.f34215a.g(Long.valueOf(g3), true));
                                    h14.append('\n');
                                    h14.append(str5);
                                    str8 = h14.toString();
                                } else {
                                    shareDialog2 = G;
                                    str7 = str4;
                                    str8 = a40.f.g("¥--\n", str5);
                                }
                                if (g3 > 0) {
                                    StringBuilder h15 = f.h("当前售价:");
                                    h15.append(x.f34215a.g(Long.valueOf(g3), true));
                                    str5 = h15.toString();
                                }
                                if (detail4 == null || (str9 = detail4.getTitle()) == null) {
                                    str9 = str7;
                                }
                                Uri.Builder buildUpon2 = Uri.parse(str2).buildUpon();
                                buildUpon2.appendQueryParameter("share_platform_title", PushConstants.PUSH_TYPE_WITHDRAW_NOTIFICATION);
                                buildUpon2.appendQueryParameter("outside_channel_type", "0");
                                String uri = buildUpon2.build().toString();
                                StringBuilder sb3 = new StringBuilder();
                                PmDetailInfoModel detail6 = value.getDetail();
                                if (detail6 == null || (str10 = detail6.getTitle()) == null) {
                                    str10 = str7;
                                }
                                sb3.append(str10);
                                sb3.append('\n');
                                sb3.append(str5);
                                sb3.append(' ');
                                sb3.append(uri);
                                sb3.append(" (分享自 @得物APP)");
                                String sb4 = sb3.toString();
                                iVar.G(str6);
                                iVar.C(str8);
                                iVar.r(null);
                                iVar.F(str2);
                                iVar.s(str9);
                                iVar.D(sb4);
                                iVar.y(str3);
                                if (!(f12 == null || f12.length() == 0)) {
                                    iVar.w(false);
                                    iVar.x("fit_center");
                                    iVar.u(e.a(f12, b.b((float) 150), iVar));
                                }
                            }
                            if (!(pmShareIconCallback.f13641c.getSupportFragmentManager().findFragmentByTag(pmShareIconCallback.m) != null || shareDialog2 == null || (x = shareDialog2.x(iVar)) == null || (w = x.w(new t(pmShareIconCallback, value))) == null || (v4 = w.v(new u(pmShareIconCallback))) == null)) {
                                v4.show(pmShareIconCallback.f13641c.getSupportFragmentManager(), pmShareIconCallback.m);
                            }
                            pmShareIconCallback.b().f().setValue(Boolean.TRUE);
                        }
                    }
                }
            };
            if (!PatchProxy.proxy(new Object[]{r22}, pmShareIconCallback2, PmShareIconCallback.changeQuickRedirect, false, 262858, new Class[]{Function0.class}, Void.TYPE).isSupported) {
                if (pmShareIconCallback2.d != null) {
                    r22.invoke();
                } else {
                    ik1.f.i(LifecycleOwnerKt.getLifecycleScope(pmShareIconCallback2.f13641c), null, null, new PmShareIconCallback$requestShareDialogData$1(pmShareIconCallback2, r22, null), 3, null);
                }
            }
        }
    }
}