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


package com.shizhuang.duapp.modules.home.utils;

import android.appwidget.AppWidgetManager;
import android.content.Context;
import android.net.Uri;
import com.alibaba.android.arouter.launcher.ARouter;
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.modules.home.model.DrawBoxInfo;
import com.shizhuang.duapp.modules.home.model.GameWidgetInfo;
import df.b0;
import ij.q;
import ij.r;
import ij.x;
import ik1.f;
import ik1.h0;
import ik1.q0;
import java.net.URLEncoder;
import kotlin.coroutines.Continuation;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsJVMKt;
import kotlin.text.StringsKt__StringsKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import rd.l;
import td.s;
import ud0.d;

/* compiled from: GameWidgetHelperMainProgress.kt */
public final class GameWidgetHelperMainProgress {
    @NotNull

    /* renamed from: a  reason: collision with root package name */
    public static final GameWidgetHelperMainProgress f15831a = new GameWidgetHelperMainProgress();
    public static ChangeQuickRedirect changeQuickRedirect;
    @Nullable
    private static GameWidgetInfo data;
    @Nullable
    private static DrawBoxInfo drawBoxInfo;

    /* compiled from: GameWidgetHelperMainProgress.kt */
    public static final class a extends s<GameWidgetInfo> {
        public static ChangeQuickRedirect changeQuickRedirect;

        @Override // com.shizhuang.duapp.common.helper.net.facade.IViewHandler, td.a
        public void onSuccess(Object obj) {
            GameWidgetInfo gameWidgetInfo = (GameWidgetInfo) obj;
            if (!PatchProxy.proxy(new Object[]{gameWidgetInfo}, this, changeQuickRedirect, false, 157049, new Class[]{GameWidgetInfo.class}, Void.TYPE).isSupported) {
                super.onSuccess(gameWidgetInfo);
                if (!PatchProxy.proxy(new Object[]{gameWidgetInfo}, GameWidgetHelperMainProgress.f15831a, GameWidgetHelperMainProgress.changeQuickRedirect, false, 157026, new Class[]{GameWidgetInfo.class}, Void.TYPE).isSupported && gameWidgetInfo != null) {
                    f.i(q0.b, null, null, new GameWidgetHelperMainProgress$downLoadWidgetImage$$inlined$let$lambda$1(gameWidgetInfo, null, gameWidgetInfo), 3, null);
                }
            }
        }
    }

    /* compiled from: GameWidgetHelperMainProgress.kt */
    public static final class b extends s<DrawBoxInfo> {
        public static ChangeQuickRedirect changeQuickRedirect;
        public final /* synthetic */ Context b;

        public b(Context context) {
            this.b = context;
        }

        @Override // com.shizhuang.duapp.common.helper.net.facade.IViewHandler, td.s, td.a
        public void onBzError(@Nullable l<DrawBoxInfo> lVar) {
            if (!PatchProxy.proxy(new Object[]{lVar}, this, changeQuickRedirect, false, 157051, new Class[]{l.class}, Void.TYPE).isSupported) {
                super.onBzError(lVar);
                GameWidgetHelperMainProgress gameWidgetHelperMainProgress = GameWidgetHelperMainProgress.f15831a;
                Context context = this.b;
                gameWidgetHelperMainProgress.f(context, AppWidgetManager.getInstance(context.getApplicationContext()), null);
            }
        }

        @Override // com.shizhuang.duapp.common.helper.net.facade.IViewHandler, td.a
        public void onSuccess(Object obj) {
            DrawBoxInfo drawBoxInfo = (DrawBoxInfo) obj;
            if (!PatchProxy.proxy(new Object[]{drawBoxInfo}, this, changeQuickRedirect, false, 157050, new Class[]{DrawBoxInfo.class}, Void.TYPE).isSupported) {
                super.onSuccess(drawBoxInfo);
                GameWidgetHelperMainProgress gameWidgetHelperMainProgress = GameWidgetHelperMainProgress.f15831a;
                gameWidgetHelperMainProgress.d(drawBoxInfo);
                Context context = this.b;
                gameWidgetHelperMainProgress.f(context, AppWidgetManager.getInstance(context.getApplicationContext()), drawBoxInfo);
            }
        }
    }

    @Nullable
    public final Object a(@Nullable String str, @NotNull String str2, @NotNull Continuation<? super String> continuation) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str, str2, continuation}, this, changeQuickRedirect, false, 157027, new Class[]{String.class, String.class, Continuation.class}, Object.class);
        return proxy.isSupported ? proxy.result : f.l(h0.b(), new GameWidgetHelperMainProgress$getDownloadedPath$2(str, str2, null), continuation);
    }

    public final void b() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 157025, new Class[0], Void.TYPE).isSupported) {
            d.getGameWidgetData(new a().withoutToast());
        }
    }

    public final void c(@Nullable Context context, @Nullable Uri uri) {
        boolean z = false;
        if (!PatchProxy.proxy(new Object[]{context, uri}, this, changeQuickRedirect, false, 157020, new Class[]{Context.class, Uri.class}, Void.TYPE).isSupported && uri != null) {
            try {
                String queryParameter = uri.getQueryParameter("jumpUrl");
                String queryParameter2 = uri.getQueryParameter(PushConstants.BASIC_PUSH_STATUS_CODE);
                Integer num = null;
                if (queryParameter != null && StringsKt__StringsKt.contains$default((CharSequence) queryParameter, (CharSequence) "https://m.poizon.com/router/web/BrowserPage?loadUrl=", false, 2, (Object) null)) {
                    ARouter.getInstance().build("/web/BrowserPage").setUri(Uri.parse("https://m.poizon.com/router/web/BrowserPage?loadUrl=" + URLEncoder.encode(StringsKt__StringsJVMKt.replace$default(queryParameter, "https://m.poizon.com/router/web/BrowserPage?loadUrl=", "", false, 4, (Object) null), "utf-8"))).withFlags(32768).addFlags(268435456).navigation(context);
                }
                if (queryParameter2 != null) {
                    if (queryParameter2.length() > 0) {
                        z = true;
                    }
                    if (!z) {
                        queryParameter2 = null;
                    }
                    if (queryParameter2 == null) {
                        return;
                    }
                    if (StringsKt__StringsJVMKt.equals("DRAW_BOX", queryParameter2, true)) {
                        r rVar = r.f33474a;
                        DrawBoxInfo drawBoxInfo2 = drawBoxInfo;
                        if (drawBoxInfo2 != null) {
                            num = drawBoxInfo2.getStatus();
                        }
                        rVar.a(String.valueOf(num));
                        return;
                    }
                    q.a(q.f33473a, null, queryParameter, 1);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    public final void d(@Nullable DrawBoxInfo drawBoxInfo2) {
        if (!PatchProxy.proxy(new Object[]{drawBoxInfo2}, this, changeQuickRedirect, false, 157019, new Class[]{DrawBoxInfo.class}, Void.TYPE).isSupported) {
            drawBoxInfo = drawBoxInfo2;
        }
    }

    public final void e(@Nullable Context context) {
        if (!PatchProxy.proxy(new Object[]{context}, this, changeQuickRedirect, false, 157021, new Class[]{Context.class}, Void.TYPE).isSupported && context != null) {
            d.fetchDrawBoxData(new b(context).withoutToast());
        }
    }

    public final void f(Context context, AppWidgetManager appWidgetManager, DrawBoxInfo drawBoxInfo2) {
        if (!PatchProxy.proxy(new Object[]{context, appWidgetManager, drawBoxInfo2}, this, changeQuickRedirect, false, 157022, new Class[]{Context.class, AppWidgetManager.class, DrawBoxInfo.class}, Void.TYPE).isSupported && context != null && appWidgetManager != null) {
            ae0.l lVar = new ae0.l();
            if (!PatchProxy.proxy(new Object[]{context, appWidgetManager, drawBoxInfo2}, lVar, ae0.l.changeQuickRedirect, false, 157386, new Class[]{Context.class, AppWidgetManager.class, DrawBoxInfo.class}, Void.TYPE).isSupported) {
                lVar.f1319a.inflaterBoxWidget(context, appWidgetManager, drawBoxInfo2);
            }
        }
    }

    public final void g(@Nullable String str, @NotNull Context context) {
        if (!PatchProxy.proxy(new Object[]{str, context}, this, changeQuickRedirect, false, 157023, new Class[]{String.class, Context.class}, Void.TYPE).isSupported && Intrinsics.areEqual("gameCombine", str)) {
            x.f33480a.d("游戏聚合组件");
            b0.h().putInt("com.shizhuang.duapp.widget.action.ADD_APPWIDGET_gameCombine", 0);
        }
    }
}