QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685

以下内容为反编译后的 HippyAdditionView.java 源代码,内容仅作参考


package com.tencent.mtt.hippy.qb.portal;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.view.View;
import android.widget.FrameLayout;
import com.tencent.common.threadpool.BrowserExecutorSupplier;
import com.tencent.mtt.R;
import com.tencent.mtt.base.functionwindow.ActivityHandler;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.browser.window.PageFrame;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.browser.window.WindowManager;
import com.tencent.mtt.businesscenter.facade.IFrameworkDelegate;
import com.tencent.mtt.external.reader.image.ImageReaderController;
import com.tencent.mtt.hippy.HippyInstanceContext;
import com.tencent.mtt.hippy.common.HippyArray;
import com.tencent.mtt.hippy.common.HippyMap;
import com.tencent.mtt.hippy.modules.Promise;
import com.tencent.mtt.hippy.qb.IHippyWindow;
import com.tencent.mtt.hippy.qb.ModuleParams;
import com.tencent.mtt.hippy.qb.QBHippyEngineManager;
import com.tencent.mtt.hippy.qb.QBHippyWindow;
import com.tencent.mtt.hippy.qb.modules.base.ICircleModule;
import com.tencent.mtt.hippy.qb.portal.HippyEventHubBase;
import com.tencent.mtt.hippy.qb.portal.HippyNativePage;
import com.tencent.mtt.hippy.qb.portal.HippyVerticalConfigManager;
import com.tencent.mtt.hippy.qb.portal.eventdefine.HippyEventHubDefineBase;
import com.tencent.mtt.hippy.qb.portal.eventdefine.HippyPageEventDefine;
import com.tencent.mtt.hippy.qb.update.HippyUpdateQuery;
import com.tencent.mtt.hippy.qb.update.MTT.JsBundleModule;
import com.tencent.mtt.hippy.qb.views.webview.HippyQBWebView;
import com.tencent.mtt.hippy.qb.views.webview.HippyQBWebViewController;
import com.tencent.mtt.hippy.uimanager.HippyCustomViewCreator;
import com.tencent.mtt.log.access.Logs;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.view.layout.QBFrameLayout;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import org.json.JSONException;
import org.json.JSONObject;

public class HippyAdditionView extends QBFrameLayout implements IHippyWindow.HippyInstanceLoadSuccessListener, ModuleParams.CusTomDemotionCallBack, HippyEventHubBase.IEventListener {
    public static final int MSG_BACK = 6;
    public static final int MSG_INTERCEPT_UNIT_TIME = 4;
    public static final int MSG_LOAD_RN_PAGE = 5;
    public static final int MSG_RN_EVENT = 1;
    public static final int MSG_SET_PAGE_TITLE = 3;
    public static final int MSG_SET_TOOLBAR_MODE = 2;
    private static final String TAG = "HippyAdditionView";
    protected AtomicInteger mBackStackCounter;
    private Context mContext;
    private String mCustomPageTitle;
    private boolean mDebugUrl;
    private HippyPageEventHub mEventHub;
    private HippyMap mExtraInfo;
    protected int mHashCode;
    HippyInstanceContext mHippyContext;
    protected QBHippyWindow mHippyRootView;
    private int mOrientation;
    private HippyNativePage mParent;
    private ArrayList<PeddingAction> mPeddingActions;
    HippyQBWebView mPreloadWebView;
    protected HippyBackWebView mReactBakWebView;
    private HippyVerticalConfigManager.ReactConfigInfo mReactConfigInfo;
    private boolean mSetComment;
    private int mStatusBarHeight;
    private int mTopViewHeight;
    private Handler mUIHandler;
    protected String mUrl;
    protected HippyNativePage.IRNPageUrlListener mUrlListener;
    private String mValueCompName;
    private String mValueModule;
    public String mValuePreloadWebviewUrl;

    public static class PeddingAction {
        String mAction;
        Bundle mBundle;

        public PeddingAction(String str, Bundle bundle) {
            this.mAction = str;
            this.mBundle = bundle;
        }
    }

    public class PreloadWebViewCustomCreatorWrapper implements HippyCustomViewCreator {
        PreloadWebViewCustomCreatorWrapper() {
        }

        @Override
        public View createCustomView(String str, Context context, HippyMap hippyMap) {
            if (TextUtils.equals(str, HippyQBWebViewController.CLASS_NAME) || TextUtils.equals(str, HippyQBWebViewController.CLASS_NAME_TKD)) {
                String string = (hippyMap != null && hippyMap.containsKey("source") && hippyMap.getMap("source").containsKey("uri")) ? hippyMap.getMap("source").getString("uri") : "";
                if (HippyAdditionView.this.mPreloadWebView != null && !TextUtils.isEmpty(string) && string.equalsIgnoreCase(HippyAdditionView.this.mPreloadWebView.getUrl())) {
                    final HippyQBWebView hippyQBWebView = HippyAdditionView.this.mPreloadWebView;
                    HippyAdditionView hippyAdditionView = HippyAdditionView.this;
                    hippyAdditionView.mPreloadWebView = null;
                    hippyAdditionView.post(new Runnable() {
                        @Override
                        public void run() {
                            hippyQBWebView.setEventsPending(false);
                        }
                    });
                    return hippyQBWebView;
                }
            }
            if (HippyAdditionView.this.getCustomViewCreater() != null) {
                return HippyAdditionView.this.getCustomViewCreater().createCustomView(str, context, hippyMap);
            }
            return null;
        }
    }

    public HippyAdditionView(Context context) {
        super(context);
        this.mValueModule = "";
        this.mValueCompName = "";
        this.mExtraInfo = null;
        this.mOrientation = -1;
        this.mSetComment = false;
        this.mDebugUrl = false;
        this.mValuePreloadWebviewUrl = "";
        this.mUrl = "";
        this.mHashCode = 0;
        this.mPreloadWebView = null;
        this.mTopViewHeight = 0;
        this.mPeddingActions = new ArrayList<>();
        this.mBackStackCounter = new AtomicInteger(0);
        this.mStatusBarHeight = 0;
        this.mCustomPageTitle = null;
    }

    public HippyAdditionView(Context context, HippyNativePage hippyNativePage, HippyNativePage.IRNPageUrlListener iRNPageUrlListener, String str, String str2, HippyMap hippyMap) {
        super(context);
        this.mValueModule = "";
        this.mValueCompName = "";
        this.mExtraInfo = null;
        this.mOrientation = -1;
        this.mSetComment = false;
        this.mDebugUrl = false;
        this.mValuePreloadWebviewUrl = "";
        this.mUrl = "";
        this.mHashCode = 0;
        this.mPreloadWebView = null;
        this.mTopViewHeight = 0;
        this.mPeddingActions = new ArrayList<>();
        this.mBackStackCounter = new AtomicInteger(0);
        this.mStatusBarHeight = 0;
        this.mCustomPageTitle = null;
        this.mContext = context;
        this.mHashCode = hashCode();
        this.mUrlListener = iRNPageUrlListener;
        this.mParent = hippyNativePage;
        this.mValueModule = str;
        this.mValueCompName = str2;
        this.mExtraInfo = hippyMap;
        initBackGroundColor();
        loadUrl();
        this.mUIHandler = new Handler(Looper.getMainLooper()) {
            @Override
            public void handleMessage(Message message) {
                PageFrame s;
                int i = message.what;
                if (i == 1) {
                    HippyAdditionView.this.mUrlListener.onRNPageEventHandle(message);
                    return;
                }
                if (i == 4) {
                    HippyAdditionView.this.onInterceptUnitTime(message);
                    return;
                }
                if (i != 5) {
                    if (i != 6) {
                        return;
                    }
                    if (HippyAdditionView.this.mBackStackCounter.get() > 0) {
                        HippyAdditionView.this.mBackStackCounter.decrementAndGet();
                        HippyAdditionView.this.doHippyBack();
                        return;
                    } else {
                        if (HippyAdditionView.this.interceptGoBackEvent() || (s = WindowManager.a().s()) == null || !s.canGoBack(false)) {
                            return;
                        }
                        s.back(false);
                        return;
                    }
                }
                HippyMap hippyMap2 = (HippyMap) ((Object[]) message.obj)[1];
                String string = hippyMap2.getString("url");
                Bundle bundle = new Bundle(9);
                bundle.putString("url", string);
                if (hippyMap2.containsKey(ICircleModule.CIRCLE_ARGUMENTS)) {
                    HippyMap map = hippyMap2.getMap(ICircleModule.CIRCLE_ARGUMENTS);
                    for (String str3 : map.keySet()) {
                        bundle.putString(str3, map.get(str3).toString());
                    }
                }
                ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams(string).a(bundle).d(true).c(0).b(1));
            }
        };
        initPreloadWebview();
    }

    public void doHippyBack() {
        sendEvent(HippyEventHubDefineBase.EVENT_DO_BACK, new Bundle(9));
    }

    private void handleJSBundleVersion(HippyMap hippyMap, final Promise promise) {
        HippyArray array = hippyMap.getArray("moduleList");
        final HippyMap hippyMap2 = new HippyMap();
        ArrayList<String> arrayList = new ArrayList<>();
        if (array == null || array.size() <= 0) {
            return;
        }
        for (int i = 0; i < array.size(); i++) {
            String string = array.getString(i);
            String moduleVersionName = QBHippyEngineManager.getInstance().getModuleVersionName(string);
            if (TextUtils.isEmpty(moduleVersionName)) {
                arrayList.add(string);
            } else {
                hippyMap2.pushString(string, moduleVersionName);
            }
        }
        if (arrayList.size() > 0) {
            new HippyUpdateQuery().query(arrayList, new HippyUpdateQuery.QueryCallback() {
                @Override
                public void onFinish(ArrayList<JsBundleModule> arrayList2, int i2) {
                    if (arrayList2 != null && arrayList2.size() > 0) {
                        Iterator<JsBundleModule> it = arrayList2.iterator();
                        while (it.hasNext()) {
                            JsBundleModule next = it.next();
                            hippyMap2.pushString(next.sModuleName, next.sVersionName);
                        }
                    }
                    promise.resolve(hippyMap2);
                }
            });
        } else {
            promise.resolve(hippyMap2);
        }
    }

    private void handlePreloadWebView(final HippyMap hippyMap) {
        BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
            @Override
            public void run() {
                if (HippyAdditionView.this.mPreloadWebView == null) {
                    String string = hippyMap.getString("uri");
                    if (TextUtils.isEmpty(string) || HippyAdditionView.this.mHippyRootView == null || HippyAdditionView.this.mHippyRootView.getHippyRootView() == null) {
                        return;
                    }
                    HippyCustomViewCreator customViewCreater = HippyAdditionView.this.getCustomViewCreater();
                    if (customViewCreater != null) {
                        HippyAdditionView hippyAdditionView = HippyAdditionView.this;
                        hippyAdditionView.mPreloadWebView = (HippyQBWebView) customViewCreater.createCustomView(HippyQBWebViewController.CLASS_NAME, hippyAdditionView.mHippyRootView.getHippyRootView().getContext(), hippyMap);
                    }
                    if (HippyAdditionView.this.mPreloadWebView == null) {
                        HippyAdditionView hippyAdditionView2 = HippyAdditionView.this;
                        hippyAdditionView2.mPreloadWebView = new HippyQBWebView(hippyAdditionView2.mHippyRootView.getHippyRootView().getContext());
                    }
                    HippyAdditionView.this.mPreloadWebView.setEventsPending(true);
                    HippyAdditionView.this.mPreloadWebView.loadUrl(string);
                }
            }
        });
    }

    private void handleUsedTime(HippyMap hippyMap) {
        if ("start".equals(hippyMap.getString("type"))) {
            HashMap<String, String> hashMap = new HashMap<>();
            hashMap.put("scene", hippyMap.getString("scene"));
            String string = hippyMap.getString("kv");
            if (!TextUtils.isEmpty(string)) {
                hashMap.put("kv", string);
            }
            hashMap.put("ch", hippyMap.getString("ch") + "__" + hippyMap.getString("tabid"));
            this.mParent.interceptUnitTime(hippyMap.getString(ImageReaderController.REPORT_UNIT), -1, hashMap);
        }
    }

    private void initBackGroundColor() {
        setBackgroundColor(MttResources.c(R.color.transparent));
    }

    private void initPreloadWebview() {
        if (this.mPreloadWebView != null || TextUtils.isEmpty(this.mValuePreloadWebviewUrl)) {
            return;
        }
        Context context = this.mContext;
        this.mHippyContext = new HippyInstanceContext(context instanceof Activity ? (Activity) context : ActivityHandler.b().a());
        HippyCustomViewCreator customViewCreater = getCustomViewCreater();
        if (customViewCreater != null) {
            this.mPreloadWebView = (HippyQBWebView) customViewCreater.createCustomView(HippyQBWebViewController.CLASS_NAME, this.mHippyContext, null);
        }
        if (this.mPreloadWebView == null) {
            this.mPreloadWebView = new HippyQBWebView(this.mHippyContext);
        }
        this.mPreloadWebView.setEventsPending(true);
        this.mPreloadWebView.loadUrl(this.mValuePreloadWebviewUrl);
    }

    public void sendLifecycleEvent(String str, Bundle bundle) {
        QBHippyWindow qBHippyWindow = this.mHippyRootView;
        if (qBHippyWindow != null) {
            this.mEventHub.sendEventToHippy(HippyEventHubDefineBase.EVENT_LIFE_CYCLE, qBHippyWindow.getId(), "", str, null, this.mValueModule, String.valueOf(this.mHashCode), bundle);
        }
    }

    private void sendPeddingEvent() {
        if (this.mPeddingActions.size() > 0) {
            this.mUIHandler.post(new Runnable() {
                @Override
                public void run() {
                    Iterator it = HippyAdditionView.this.mPeddingActions.iterator();
                    while (it.hasNext()) {
                        PeddingAction peddingAction = (PeddingAction) it.next();
                        HippyAdditionView.this.sendLifecycleEvent(peddingAction.mAction, peddingAction.mBundle);
                    }
                    HippyAdditionView.this.mPeddingActions.clear();
                }
            });
        }
    }

    private void startCreateReactView() {
        if (this.mHippyRootView != null) {
            return;
        }
        createReactView();
    }

    private void switchBakWebView() {
        if (this.mReactBakWebView != null) {
            return;
        }
        HippyVerticalConfigManager.ReactConfigInfo reactConfigInfo = this.mReactConfigInfo;
        this.mReactBakWebView = new HippyBackWebView(getContext(), reactConfigInfo != null ? reactConfigInfo.backUrl : "");
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -1);
        layoutParams.topMargin = this.mStatusBarHeight + this.mTopViewHeight;
        addView(this.mReactBakWebView, layoutParams);
    }

    public void active() {
        sendLifecycleEvent(HippyEventHubDefineBase.TYPE_ON_ACTIVE, new Bundle());
    }

    protected void createReactView() {
        this.mEventHub = getEventHub();
        Bundle bundle = new Bundle(9);
        bundle.putString("abilities", this.mEventHub.getCommonAbilityString());
        bundle.putString("customerAbilities", this.mEventHub.getCustomerAbilityString());
        bundle.putString("primaryKey", String.valueOf(this.mHashCode));
        bundle.putString("url", this.mUrl);
        int i = this.mOrientation;
        if (i != -1) {
            bundle.putInt("orientation", i);
        }
        bundle.putInt("multiWindowCount", WindowManager.a().y());
        for (String str : this.mExtraInfo.keySet()) {
            if (!TextUtils.equals(str, "primaryKey")) {
                bundle.putString(str, this.mExtraInfo.getString(str));
            }
        }
        ModuleParams.Builder builder = new ModuleParams.Builder();
        String demotionUrl = getDemotionUrl();
        if (TextUtils.isEmpty(demotionUrl)) {
            builder.setCusTomDemotionCallBack(this);
        } else {
            builder.setDemotionUrl(demotionUrl);
        }
        Context context = this.mContext;
        Activity a2 = (context == null || !(context instanceof Activity)) ? ActivityHandler.b().a() : (Activity) context;
        processBuilder(builder);
        ModuleParams build = builder.setModuleName(this.mValueModule).setComponentName(this.mValueCompName).setProps(bundle).setActivity(a2).setCustomViewCreator(new PreloadWebViewCustomCreatorWrapper()).setDebug(this.mDebugUrl).setInstanceLoadSuccessListener(this).build();
        HippyInstanceContext hippyInstanceContext = this.mHippyContext;
        if (hippyInstanceContext != null) {
            build.mHippyInstanceContext = hippyInstanceContext;
        }
        this.mHippyRootView = (QBHippyWindow) QBHippyEngineManager.getInstance().loadModule(build);
        if (this.mHippyRootView != null) {
            FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -1);
            layoutParams.topMargin = this.mTopViewHeight;
            addView(this.mHippyRootView, layoutParams);
            registerMethod();
        } else {
            Logs.e(TAG, "mRnRootView loadModule Failed");
            switchBakWebView();
        }
        sendPeddingEvent();
    }

    public void deactive() {
        sendLifecycleEvent(HippyEventHubDefineBase.TYPE_ON_DEACTIVE, new Bundle());
    }

    public void destroy() {
        sendLifecycleEvent(HippyEventHubDefineBase.TYPE_ON_DESTROY, new Bundle());
        HippyPageEventHub hippyPageEventHub = this.mEventHub;
        if (hippyPageEventHub != null) {
            hippyPageEventHub.deRegistNativeMethod(this.mValueModule);
            this.mEventHub.unregisterListener(this);
            this.mEventHub.setQBHippyWindow((QBHippyWindow) null);
            this.mEventHub = null;
        }
        QBHippyWindow qBHippyWindow = this.mHippyRootView;
        if (qBHippyWindow != null) {
            qBHippyWindow.destroy();
            this.mHippyRootView = null;
        }
    }

    @Override
    public View getCusTomDemotionView() {
        HippyBackWebView hippyBackWebView = this.mReactBakWebView;
        if (hippyBackWebView != null) {
            return hippyBackWebView;
        }
        HippyVerticalConfigManager.ReactConfigInfo reactConfigInfo = this.mReactConfigInfo;
        this.mReactBakWebView = new HippyBackWebView(getContext(), reactConfigInfo != null ? reactConfigInfo.backUrl : "https://qbrnweb.html5.qq.com/favnew");
        return this.mReactBakWebView;
    }

    public HippyCustomViewCreator getCustomViewCreater() {
        return null;
    }

    public String getDemotionUrl() {
        return null;
    }

    protected HippyPageEventHub getEventHub() {
        return new HippyPageEventHub();
    }

    public HippyVerticalConfigManager.ReactConfigInfo getRNVerticalConfigInfo(String str) {
        return HippyVerticalConfigManager.getInstance().getConfigInfo(this.mValueModule);
    }

    public String getUrl() {
        return this.mUrl;
    }

    protected boolean interceptGoBackEvent() {
        return false;
    }

    @Override
    public void loadSuccess() {
        if (!TextUtils.isEmpty(this.mValueModule) && !TextUtils.isEmpty(this.mValueCompName)) {
            this.mReactConfigInfo = getRNVerticalConfigInfo(this.mValueModule);
            ActivityHandler.b().a();
        }
        sendPeddingEvent();
    }

    public void loadUrl() {
        if (TextUtils.isEmpty(this.mValueModule) || TextUtils.isEmpty(this.mValueCompName)) {
            return;
        }
        startCreateReactView();
    }

    public boolean onBackPressed() {
        return this.mHippyRootView.onBackPressed(null);
    }

    public void onDismiss() {
    }

    protected void onInterceptUnitTime(Message message) {
        Set<String> keySet;
        String str;
        StringBuilder sb;
        HippyMap hippyMap = (HippyMap) ((Object[]) message.obj)[1];
        String string = hippyMap.getString(ImageReaderController.REPORT_UNIT);
        HippyMap map = hippyMap.getMap("extras");
        if (TextUtils.isEmpty(string)) {
            return;
        }
        HashMap<String, String> hashMap = new HashMap<>();
        if (map != null && (keySet = map.keySet()) != null) {
            for (String str2 : keySet) {
                Object obj = map.get(str2);
                if (obj == null) {
                    hashMap.put(str2, "");
                } else {
                    if (obj instanceof String) {
                        str = (String) obj;
                    } else {
                        if (obj instanceof Number) {
                            sb = new StringBuilder();
                            sb.append("");
                            sb.append(obj);
                        } else if (obj instanceof Boolean) {
                            sb = new StringBuilder();
                            sb.append(((Boolean) obj).booleanValue());
                            sb.append("");
                        }
                        str = sb.toString();
                    }
                    hashMap.put(str2, str);
                }
            }
        }
        this.mParent.interceptUnitTime(string, -1, hashMap);
    }

    @Override
    public boolean onReactEvent(String str, HippyMap hippyMap, Promise promise) {
        if (hippyMap.containsKey(ICircleModule.CIRCLE_ARGUMENTS) && !TextUtils.equals(String.valueOf(this.mHashCode), hippyMap.getMap(ICircleModule.CIRCLE_ARGUMENTS).getString("primaryKey"))) {
            return true;
        }
        if (hippyMap.containsKey("primaryKey") && !TextUtils.equals(String.valueOf(this.mHashCode), hippyMap.getString("primaryKey"))) {
            return true;
        }
        if (HippyEventHubDefineBase.ABILITY_SET_TOOLBAR_MODE.name.equalsIgnoreCase(str)) {
            this.mUIHandler.obtainMessage(2, new Object[]{str, hippyMap}).sendToTarget();
            return true;
        }
        if (HippyEventHubDefineBase.ABILITY_INTERCEPT_UNIT_TIME.name.equalsIgnoreCase(str)) {
            this.mUIHandler.obtainMessage(4, new Object[]{str, hippyMap}).sendToTarget();
            return true;
        }
        if (HippyPageEventDefine.ABILITY_USED_TIME.name.equalsIgnoreCase(str)) {
            handleUsedTime(hippyMap);
            return true;
        }
        if (HippyEventHubDefineBase.ABILITY_SET_PAGE_TITLE.name.equalsIgnoreCase(str)) {
            this.mCustomPageTitle = hippyMap.getString("title");
            BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
                @Override
                public void run() {
                    if (HippyAdditionView.this.mParent.getNativeGroup() == null || HippyAdditionView.this.mParent.getNativeGroup().getWebViewClient() == null) {
                        return;
                    }
                    HippyAdditionView.this.mParent.getNativeGroup().getWebViewClient().onReceivedTitle(HippyAdditionView.this.mParent, HippyAdditionView.this.mCustomPageTitle);
                }
            });
            return true;
        }
        if (HippyEventHubDefineBase.ABILITY_LOAD_RNPAGE.name.equalsIgnoreCase(str)) {
            this.mUIHandler.obtainMessage(5, new Object[]{str, hippyMap}).sendToTarget();
            return true;
        }
        if (HippyEventHubDefineBase.ABILITY_BACK.name.equalsIgnoreCase(str)) {
            this.mUIHandler.obtainMessage(6, new Object[]{str, hippyMap}).sendToTarget();
            return true;
        }
        if (HippyEventHubDefineBase.ABILITY_ADD_BACK_STACK.name.equalsIgnoreCase(str)) {
            this.mBackStackCounter.incrementAndGet();
            return true;
        }
        if (HippyEventHubDefineBase.ABILITY_REMOVE_BACK_STACK.name.equalsIgnoreCase(str)) {
            if (this.mBackStackCounter.decrementAndGet() < 0) {
                this.mBackStackCounter.set(0);
            }
            return true;
        }
        if (HippyEventHubDefineBase.ABILITY_PRELOAD_WEBVIEW.name.equalsIgnoreCase(str)) {
            handlePreloadWebView(hippyMap);
            return true;
        }
        if (HippyEventHubDefineBase.ABILITY_GET_JSBUNDLE_VERSION.name.equalsIgnoreCase(str)) {
            handleJSBundleVersion(hippyMap, promise);
        } else {
            if (HippyEventHubDefineBase.ABILITY_CLOSE_COMMENT_MODAL.name.equalsIgnoreCase(str)) {
                this.mUIHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        HippyAdditionView.this.mParent.removeAddtionView();
                    }
                });
                try {
                    JSONObject jSONObject = new JSONObject();
                    jSONObject.put("success", true);
                    promise.resolve(jSONObject);
                } catch (JSONException unused) {
                }
                return true;
            }
            if (HippyEventHubDefineBase.ABILITY_COMMENTLIST_SEND_MSG.name.equalsIgnoreCase(str)) {
                this.mParent.sendEvent(HippyEventHubDefineBase.EVENT_COMMON_LIST_SEND_MSG, hippyMap);
                try {
                    JSONObject jSONObject2 = new JSONObject();
                    jSONObject2.put("success", true);
                    promise.resolve(jSONObject2);
                } catch (JSONException unused2) {
                }
                return true;
            }
        }
        if (this.mUrlListener == null) {
            return false;
        }
        Message obtainMessage = this.mUIHandler.obtainMessage();
        obtainMessage.what = 1;
        obtainMessage.obj = new Object[]{str, hippyMap};
        this.mUIHandler.sendMessage(obtainMessage);
        return true;
    }

    public void onStart() {
        sendLifecycleEvent(HippyEventHubDefineBase.TYPE_ON_START, new Bundle());
    }

    public void onStop() {
        sendLifecycleEvent(HippyEventHubDefineBase.TYPE_ON_STOP, new Bundle());
    }

    protected void processBuilder(ModuleParams.Builder builder) {
    }

    protected void registerMethod() {
        QBHippyWindow qBHippyWindow = this.mHippyRootView;
        if (qBHippyWindow != null) {
            this.mEventHub.setQBHippyWindow(qBHippyWindow);
            this.mEventHub.registerListener(this);
            this.mEventHub.registNativeMethod(this.mValueModule);
        }
    }

    public void sendEvent(String str, Bundle bundle) {
        QBHippyWindow qBHippyWindow = this.mHippyRootView;
        if (qBHippyWindow != null) {
            qBHippyWindow.sendEvent(str, bundle);
        }
    }
}