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


package com.shizhuang.duapp.modules.web;

import ah1.c;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.webkit.CookieManager;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.shizhuang.duapp.common.bean.GameConfigModel;
import com.shizhuang.duapp.hybrid.HtmlCacheEnhancer;
import com.shizhuang.duapp.libs.web.IHandlerErrorListener;
import com.shizhuang.duapp.libs.web.webservice.IDuWebViewComponent;
import com.shizhuang.duapp.modules.router.service.IWebService;
import com.shizhuang.duapp.modules.web.game.GameHelper;
import com.shizhuang.duapp.modules.web.helper.PreRenderHelper;
import com.shizhuang.duapp.modules.web.ui.fragment.DuWebFragment;
import com.shizhuang.stone.SZStone;
import com.tencent.mmkv.MMKV;
import df.b0;
import java.util.Arrays;
import java.util.List;
import kotlin.Metadata;
import kr.b;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import pr.d;
import qc.f;

@Route(path = "/web/service")
@Metadata(bv = {}, d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0007\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\u0002\u0010\u0003¨\u0006\u0004"}, d2 = {"Lcom/shizhuang/duapp/modules/web/WebServiceImpl;", "Lcom/shizhuang/duapp/modules/router/service/IWebService;", "<init>", "()V", "du_web_release"}, k = 1, mv = {1, 4, 2})
/* compiled from: WebServiceImpl.kt */
public final class WebServiceImpl implements IWebService {
    public static ChangeQuickRedirect changeQuickRedirect;

    /* compiled from: WebServiceImpl.kt */
    public static final class a implements IHandlerErrorListener {

        /* renamed from: a  reason: collision with root package name */
        public static final a f25889a = new a();
        public static ChangeQuickRedirect changeQuickRedirect;

        @Override // com.shizhuang.duapp.libs.web.IHandlerErrorListener
        public final void onError(@Nullable Throwable th2) {
            if (!PatchProxy.proxy(new Object[]{th2}, this, changeQuickRedirect, false, 332059, new Class[]{Throwable.class}, Void.TYPE).isSupported) {
                fo.a.g(new JockHandlerException(th2), "jockey-error", new Object[0]);
            }
        }
    }

    @Override // com.shizhuang.duapp.modules.router.service.IWebService
    public void clearCookie() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 332053, new Class[0], Void.TYPE).isSupported && !PatchProxy.proxy(new Object[0], null, d.changeQuickRedirect, true, 37586, new Class[0], Void.TYPE).isSupported) {
            CookieManager.getInstance().removeAllCookies(null);
        }
    }

    @Override // com.shizhuang.duapp.modules.router.service.IWebService
    public void clearGameInfo() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 332055, new Class[0], Void.TYPE).isSupported) {
            if (!PatchProxy.proxy(new Object[0], GameHelper.d(), GameHelper.changeQuickRedirect, false, 332362, new Class[0], Void.TYPE).isSupported) {
                b0.i("GAME_FILE").clearAll();
            }
        }
    }

    /* JADX DEBUG: Multi-variable search result rejected for r14v0, resolved type: boolean */
    /* JADX WARN: Multi-variable type inference failed */
    @Override // com.shizhuang.duapp.modules.router.service.IWebService
    @NotNull
    public IDuWebViewComponent getDuWebComponent(@Nullable String str, boolean z) {
        Object[] objArr = {str, new Byte(z ? (byte) 1 : 0)};
        ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
        Class cls = Boolean.TYPE;
        PatchProxyResult proxy = PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 332057, new Class[]{String.class, cls}, IDuWebViewComponent.class);
        if (proxy.isSupported) {
            return (IDuWebViewComponent) proxy.result;
        }
        DuWebFragment.a aVar = DuWebFragment.T;
        PatchProxyResult proxy2 = PatchProxy.proxy(new Object[]{str, new Byte((byte) z)}, aVar, DuWebFragment.a.changeQuickRedirect, false, 333365, new Class[]{String.class, cls}, DuWebFragment.class);
        if (proxy2.isSupported) {
            return (DuWebFragment) proxy2.result;
        }
        DuWebFragment duWebFragment = new DuWebFragment();
        Bundle bundle = new Bundle();
        bundle.putString("loadUrl", str);
        bundle.putBoolean("isNeedCache", z);
        duWebFragment.setArguments(bundle);
        return duWebFragment;
    }

    @Override // com.shizhuang.duapp.modules.router.service.IWebService
    @NotNull
    public String getGameCountDownUrl(@Nullable String str) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str}, this, changeQuickRedirect, false, 332056, new Class[]{String.class}, String.class);
        if (proxy.isSupported) {
            return (String) proxy.result;
        }
        GameHelper d = GameHelper.d();
        PatchProxyResult proxy2 = PatchProxy.proxy(new Object[]{str}, d, GameHelper.changeQuickRedirect, false, 332359, new Class[]{String.class}, String.class);
        if (proxy2.isSupported) {
            return (String) proxy2.result;
        }
        String str2 = d.b.get(str);
        if (!TextUtils.isEmpty(str2)) {
            return str2;
        }
        if (f.i()) {
            return "https://cdn-fast.dewu.com/nezha-plus/detail/5ff3d42b30cb7918edb69942";
        }
        return f.j() ? "https://pre-fast.dewu.com/nezha-plus/detail/5ff3d42b30cb7918edb69942" : "https://t1-fast.dewu.com/nezha-plus/detail/5ff7b4980e731e7608b2cf53";
    }

    @Override // com.alibaba.android.arouter.facade.template.IProvider
    public void init(@NotNull Context context) {
        boolean z = PatchProxy.proxy(new Object[]{context}, this, changeQuickRedirect, false, 332051, new Class[]{Context.class}, Void.TYPE).isSupported;
    }

    @Override // com.shizhuang.duapp.modules.router.service.IWebService
    public void initGameInfo(@Nullable List<GameConfigModel> list) {
        if (!PatchProxy.proxy(new Object[]{list}, this, changeQuickRedirect, false, 332054, new Class[]{List.class}, Void.TYPE).isSupported && list != null && (!list.isEmpty())) {
            GameHelper d = GameHelper.d();
            if (!PatchProxy.proxy(new Object[]{list}, d, GameHelper.changeQuickRedirect, false, 332355, new Class[]{List.class}, Void.TYPE).isSupported) {
                d.f25890a.clear();
                for (GameConfigModel gameConfigModel : list) {
                    d.f25890a.put(gameConfigModel.gameName, gameConfigModel.initUrl);
                }
            }
        }
    }

    @Override // com.shizhuang.duapp.modules.router.service.IWebService
    public void initUnLock(@NotNull Context context) {
        if (!PatchProxy.proxy(new Object[]{context}, this, changeQuickRedirect, false, 332050, new Class[]{Context.class}, Void.TYPE).isSupported) {
            b.k(qc.b.f37325a);
            b.l(new ae1.a());
            b.m(a.f25889a);
            String stoneSync = SZStone.getStoneSync(context);
            if (!PatchProxy.proxy(new Object[]{context, stoneSync}, null, b.changeQuickRedirect, true, 37439, new Class[]{Context.class, String.class}, Void.TYPE).isSupported) {
                if (!PatchProxy.proxy(new Object[]{context, stoneSync}, null, bh1.b.changeQuickRedirect, true, 341450, new Class[]{Context.class, String.class}, Void.TYPE).isSupported) {
                    if (!PatchProxy.proxy(new Object[]{context}, null, c.changeQuickRedirect, true, 341437, new Class[]{Context.class}, Void.TYPE).isSupported && MMKV.getRootDir() == null) {
                        MMKV.initialize(context.getFilesDir().getAbsolutePath() + "/mmkv");
                    }
                    c.c("risk_sk", stoneSync, "du_sdl");
                    bh1.b.a();
                }
            }
            HtmlCacheEnhancer.getInstance().register(PreRenderHelper.f25907a);
        }
    }

    @Override // com.shizhuang.duapp.modules.router.service.IWebService
    public void syncCookie(@Nullable String str, @NotNull String... strArr) {
        if (!PatchProxy.proxy(new Object[]{str, strArr}, this, changeQuickRedirect, false, 332052, new Class[]{String.class, String[].class}, Void.TYPE).isSupported) {
            d.a(str, (String[]) Arrays.copyOf(strArr, strArr.length));
        }
    }

    @Override // com.shizhuang.duapp.modules.router.service.IWebService
    @NotNull
    public IDuWebViewComponent getDuWebComponent(@Nullable String str) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str}, this, changeQuickRedirect, false, 332058, new Class[]{String.class}, IDuWebViewComponent.class);
        return proxy.isSupported ? (IDuWebViewComponent) proxy.result : getDuWebComponent(str, true);
    }
}