APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:造梦次元
版本号:1.1.73
包名称:com.ideaflow.zmcy

MD5 校验值:290b0e4cd89c7a20355df0a13ec24559

反编译源代码说明

WebContentHandler.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package com.ideaflow.zmcy.module.web;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import com.heytap.mcssdk.constant.b;
import com.huawei.hms.push.AttributionReporter;
import com.ideaflow.zmcy.BuildConfig;
import com.ideaflow.zmcy.R;
import com.ideaflow.zmcy.constants.Api;
import com.ideaflow.zmcy.constants.Constants;
import com.ideaflow.zmcy.constants.EventBusOnPipeOpened;
import com.ideaflow.zmcy.entity.CreatorClientConfig;
import com.ideaflow.zmcy.entity.CreatorClientMenu;
import com.ideaflow.zmcy.entity.User;
import com.ideaflow.zmcy.mmkv.AppConfigMMKV;
import com.ideaflow.zmcy.mmkv.RedDotMMKV;
import com.ideaflow.zmcy.mmkv.UserConfigMMKV;
import com.ideaflow.zmcy.module.chat.ChatDetailActivity;
import com.ideaflow.zmcy.module.creator.CreatorConfig;
import com.ideaflow.zmcy.module.login.LoginDialog;
import com.ideaflow.zmcy.tools.BuildToolKitKt;
import com.ideaflow.zmcy.tools.CommonKitKt;
import com.ideaflow.zmcy.tools.LifecycleBus;
import com.jstudio.jkit.AppKit;
import com.umeng.analytics.pro.f;
import java.util.ArrayList;
import java.util.List;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
import rxhttp.wrapper.entity.KeyValuePair;
import rxhttp.wrapper.utils.BuildUtil;

@Metadata(d1 = {"\u0000@\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0005\n\u0002\u0010!\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u000b\bÆ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J4\u0010\n\u001a\u00020\u00042\u0006\u0010\u000b\u001a\u00020\u00042\f\u0010\f\u001a\b\u0012\u0004\u0012\u00020\u00040\r2\u000e\u0010\u000e\u001a\n\u0012\u0004\u0012\u00020\u0004\u0018\u00010\r2\u0006\u0010\u000f\u001a\u00020\u0004J\u001a\u0010\u0010\u001a\u0004\u0018\u00010\u00112\u0006\u0010\u0012\u001a\u00020\u00132\b\u0010\u0014\u001a\u0004\u0018\u00010\u0004J\u0016\u0010\u0015\u001a\u00020\u00162\u0006\u0010\u0012\u001a\u00020\u00132\u0006\u0010\u0017\u001a\u00020\u0018J\u0016\u0010\u0019\u001a\u00020\u00162\u0006\u0010\u0012\u001a\u00020\u00132\u0006\u0010\u0017\u001a\u00020\u0018J\u001e\u0010\u001a\u001a\u00020\u00162\u0006\u0010\u0012\u001a\u00020\u00132\u0006\u0010\u0017\u001a\u00020\u00182\u0006\u0010\u001b\u001a\u00020\u0004J\u001e\u0010\u001c\u001a\u00020\u00162\u0006\u0010\u0012\u001a\u00020\u00132\u0006\u0010\u0017\u001a\u00020\u00182\u0006\u0010\u0014\u001a\u00020\u0004J$\u0010\u001d\u001a\u00020\u00162\u0006\u0010\u0012\u001a\u00020\u00132\b\u0010\u0014\u001a\u0004\u0018\u00010\u00042\n\b\u0002\u0010\u001e\u001a\u0004\u0018\u00010\u0004J(\u0010\u001f\u001a\u00020\u00162\u0006\u0010\u0012\u001a\u00020\u00132\u0006\u0010\u000b\u001a\u00020\u00042\u0006\u0010 \u001a\u00020\u00042\b\b\u0002\u0010!\u001a\u00020\u0007J\u000e\u0010\"\u001a\u00020\u00162\u0006\u0010\u0012\u001a\u00020\u0013R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u0011\u0010\u0006\u001a\u00020\u0007¢\u0006\b\n\u0000\u001a\u0004\b\b\u0010\t¨\u0006#"}, d2 = {"Lcom/ideaflow/zmcy/module/web/WebContentHandler;", "", "()V", "LOCAL_PREVIEW_URL", "", "ONLINE_PREVIEW_URL", "USE_LOCAL", "", "getUSE_LOCAL", "()Z", "buildParams", "url", "common", "", b.D, "id", "getPipeIntent", "Landroid/content/Intent;", f.X, "Landroid/content/Context;", "pipeId", "loadCreatorCreate", "", "creatorMenu", "Lcom/ideaflow/zmcy/entity/CreatorClientMenu;", "loadCreatorDraftBox", "loadCreatorEditCartoon", "cartoonId", "loadCreatorEditPipe", "loadPipeScene", "sourceCartoonId", "loadUrl", "title", "showAppBar", "showFeedback", "1.1.73-20240523_yybRelease"}, k = 1, mv = {1, 9, 0}, xi = 48)
public final class WebContentHandler {
    private static final String LOCAL_PREVIEW_URL = "https://appassets.androidplatform.net/assets/dist/preview.html";
    public static final WebContentHandler INSTANCE = new WebContentHandler();
    private static final String ONLINE_PREVIEW_URL = Api.Url.INSTANCE.getBASE_H5_URL() + Api.H5.PIPE_URL;
    private static final boolean USE_LOCAL = BuildToolKitKt.isTestEnvironment() ^ true;

    public final boolean getUSE_LOCAL() {
        return USE_LOCAL;
    }

    private WebContentHandler() {
    }

    public static void loadUrl$default(WebContentHandler webContentHandler, Context context, String str, String str2, boolean z, int i, Object obj) {
        if ((i & 8) != 0) {
            z = false;
        }
        webContentHandler.loadUrl(context, str, str2, z);
    }

    public final void loadUrl(Context context, String url, String title, boolean showAppBar) {
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(url, "url");
        Intrinsics.checkNotNullParameter(title, "title");
        if (url.length() == 0) {
            return;
        }
        Intent intent = new Intent(context, (Class<?>) ShowWebActivity.class);
        intent.putExtra(Constants.Params.ARG1, url);
        intent.putExtra(Constants.Params.ARG2, title);
        intent.putExtra(Constants.Params.ARG3, showAppBar);
        context.startActivity(intent);
    }

    public final void showFeedback(Context context) {
        String id;
        User user;
        String nickname;
        User user2;
        String avatar;
        Intrinsics.checkNotNullParameter(context, "context");
        User user3 = UserConfigMMKV.INSTANCE.getUser();
        if (user3 == null || (id = user3.getId()) == null || (user = UserConfigMMKV.INSTANCE.getUser()) == null || (nickname = user.getNickname()) == null || (user2 = UserConfigMMKV.INSTANCE.getUser()) == null || (avatar = user2.getAvatar()) == null) {
            return;
        }
        String uri = Uri.parse(Api.Url.FEEDBACK_URL).buildUpon().appendQueryParameter("nickname", nickname).appendQueryParameter("avatar", avatar).appendQueryParameter("openid", id).build().toString();
        Intrinsics.checkNotNullExpressionValue(uri, "toString(...)");
        Intent intent = new Intent(context, (Class<?>) ShowWebActivity.class);
        intent.putExtra(Constants.Params.ARG1, uri);
        intent.putExtra(Constants.Params.ARG2, CommonKitKt.forString(R.string.feedback));
        intent.putExtra(Constants.Params.ARG3, true);
        context.startActivity(intent);
    }

    public static void loadPipeScene$default(WebContentHandler webContentHandler, Context context, String str, String str2, int i, Object obj) {
        if ((i & 4) != 0) {
            str2 = null;
        }
        webContentHandler.loadPipeScene(context, str, str2);
    }

    public final void loadPipeScene(final Context context, final String pipeId, final String sourceCartoonId) {
        Intrinsics.checkNotNullParameter(context, "context");
        LoginDialog.INSTANCE.checkLogin(new Function0<Unit>() {
            {
                super(0);
            }

            @Override
            public Unit invoke() {
                invoke2();
                return Unit.INSTANCE;
            }

            public final void invoke2() {
                AppKit.INSTANCE.obtain().topActivity();
                Intent pipeIntent = WebContentHandler.INSTANCE.getPipeIntent(context, pipeId);
                String str = sourceCartoonId;
                if (str != null && str.length() != 0 && pipeIntent != null) {
                    pipeIntent.putExtra(Constants.Params.ARG5, sourceCartoonId);
                }
                context.startActivity(pipeIntent);
                String str2 = pipeId;
                if (str2 != null) {
                    RedDotMMKV.INSTANCE.removeUnReadCount(str2);
                    LifecycleBus.INSTANCE.post(new EventBusOnPipeOpened(str2));
                }
            }
        });
    }

    public final Intent getPipeIntent(Context context, String pipeId) {
        Intrinsics.checkNotNullParameter(context, "context");
        String str = pipeId;
        if (str == null || str.length() == 0 || UserConfigMMKV.INSTANCE.getUser() == null) {
            return null;
        }
        if (AppConfigMMKV.INSTANCE.getUseWebVersionChatRoom()) {
            String str2 = (USE_LOCAL ? LOCAL_PREVIEW_URL : ONLINE_PREVIEW_URL) + "?clientType=android&pipe_id=" + pipeId;
            Intent intent = new Intent(context, (Class<?>) ShowWebActivity.class);
            intent.putExtra(Constants.Params.ARG1, str2);
            intent.putExtra(Constants.Params.ARG3, false);
            intent.putExtra(Constants.Params.ARG4, false);
            return intent;
        }
        Intent intent2 = new Intent(context, (Class<?>) ChatDetailActivity.class);
        intent2.putExtra(Constants.Params.ARG1, pipeId);
        return intent2;
    }

    public final void loadCreatorCreate(Context context, CreatorClientMenu creatorMenu) {
        CreatorClientConfig creatorConfig;
        List<String> commonParam;
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(creatorMenu, "creatorMenu");
        String url = creatorMenu.getUrl();
        if (url == null || (creatorConfig = CreatorConfig.INSTANCE.getCreatorConfig()) == null || (commonParam = creatorConfig.getCommonParam()) == null) {
            return;
        }
        String buildParams = buildParams(url, commonParam, creatorMenu.getUrlParams(), "");
        Intent intent = new Intent(context, (Class<?>) ShowWebActivity.class);
        intent.putExtra(Constants.Params.ARG1, buildParams);
        intent.putExtra(Constants.Params.ARG2, "");
        intent.putExtra(Constants.Params.ARG3, false);
        context.startActivity(intent);
    }

    public final void loadCreatorDraftBox(Context context, CreatorClientMenu creatorMenu) {
        CreatorClientConfig creatorConfig;
        List<String> commonParam;
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(creatorMenu, "creatorMenu");
        String url = creatorMenu.getUrl();
        if (url == null || (creatorConfig = CreatorConfig.INSTANCE.getCreatorConfig()) == null || (commonParam = creatorConfig.getCommonParam()) == null) {
            return;
        }
        String buildParams = buildParams(url, commonParam, creatorMenu.getUrlParams(), "");
        Intent intent = new Intent(context, (Class<?>) ShowWebActivity.class);
        intent.putExtra(Constants.Params.ARG1, buildParams);
        intent.putExtra(Constants.Params.ARG2, "");
        intent.putExtra(Constants.Params.ARG3, false);
        context.startActivity(intent);
    }

    public final void loadCreatorEditPipe(Context context, CreatorClientMenu creatorMenu, String pipeId) {
        CreatorClientConfig creatorConfig;
        List<String> commonParam;
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(creatorMenu, "creatorMenu");
        Intrinsics.checkNotNullParameter(pipeId, "pipeId");
        String url = creatorMenu.getUrl();
        if (url == null || (creatorConfig = CreatorConfig.INSTANCE.getCreatorConfig()) == null || (commonParam = creatorConfig.getCommonParam()) == null) {
            return;
        }
        String buildParams = buildParams(url, commonParam, creatorMenu.getUrlParams(), pipeId);
        Intent intent = new Intent(context, (Class<?>) ShowWebActivity.class);
        intent.putExtra(Constants.Params.ARG1, buildParams);
        intent.putExtra(Constants.Params.ARG2, "");
        intent.putExtra(Constants.Params.ARG3, false);
        context.startActivity(intent);
    }

    public final void loadCreatorEditCartoon(Context context, CreatorClientMenu creatorMenu, String cartoonId) {
        CreatorClientConfig creatorConfig;
        List<String> commonParam;
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(creatorMenu, "creatorMenu");
        Intrinsics.checkNotNullParameter(cartoonId, "cartoonId");
        String url = creatorMenu.getUrl();
        if (url == null || (creatorConfig = CreatorConfig.INSTANCE.getCreatorConfig()) == null || (commonParam = creatorConfig.getCommonParam()) == null) {
            return;
        }
        String buildParams = buildParams(url, commonParam, creatorMenu.getUrlParams(), cartoonId);
        Intent intent = new Intent(context, (Class<?>) ShowWebActivity.class);
        intent.putExtra(Constants.Params.ARG1, buildParams);
        intent.putExtra(Constants.Params.ARG2, "");
        intent.putExtra(Constants.Params.ARG3, false);
        context.startActivity(intent);
    }

    public final String buildParams(String url, List<String> common, List<String> params, String id) {
        Intrinsics.checkNotNullParameter(url, "url");
        Intrinsics.checkNotNullParameter(common, "common");
        Intrinsics.checkNotNullParameter(id, "id");
        ArrayList arrayList = new ArrayList();
        if (common.contains("osVersion")) {
            arrayList.add(new KeyValuePair("osVersion", Build.VERSION.RELEASE));
        }
        if (common.contains("osType")) {
            arrayList.add(new KeyValuePair("osType", "Android"));
        }
        if (common.contains(AttributionReporter.APP_VERSION)) {
            arrayList.add(new KeyValuePair(AttributionReporter.APP_VERSION, BuildConfig.VERSION_NAME));
        }
        if (params != null && params.contains("draft")) {
            arrayList.add(new KeyValuePair("draft", 1));
        }
        if (params != null && params.contains("theme")) {
            arrayList.add(new KeyValuePair("theme", "light"));
        }
        if (params != null && params.contains("pipeId")) {
            arrayList.add(new KeyValuePair("pipeId", id));
        }
        if (params != null && params.contains("cartoonId")) {
            arrayList.add(new KeyValuePair("cartoonId", id));
        }
        String uri = BuildUtil.getHttpUrl(url, arrayList, null).uri().toString();
        Intrinsics.checkNotNullExpressionValue(uri, "toString(...)");
        return uri;
    }
}