QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 PirateNovelReaderModeMgr.java 源代码,内容仅作参考
package com.tencent.mtt.external.novel.pirate.hover;
import android.content.DialogInterface;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.CompoundButton;
import com.tencent.common.featuretoggle.FeatureToggle;
import com.tencent.common.manifest.EventEmiter;
import com.tencent.common.manifest.EventMessage;
import com.tencent.common.utils.UrlUtils;
import com.tencent.mtt.base.stat.StatManager;
import com.tencent.mtt.browser.plugin.facade.IPluginService;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.businesscenter.facade.IFrameworkDelegate;
import com.tencent.mtt.businesscenter.facade.IWebPageStatService;
import com.tencent.mtt.external.novel.pirate.rn.NovelDecodeDomainManager;
import com.tencent.mtt.external.novel.pirate.rn.data.PiratePageCycleListener;
import com.tencent.mtt.external.novel.pirate.rn.js.PirateJsManager;
import com.tencent.mtt.external.pagetoolbox.facade.IPageToolBoxGuideService;
import com.tencent.mtt.external.pagetoolbox.facade.PageToolBoxGuideBean;
import com.tencent.mtt.log.access.Logs;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.setting.PublicSettingManager;
import com.tencent.mtt.view.dialog.newui.SimpleDialogBuilder;
import com.tencent.mtt.view.dialog.newui.dialog.DialogBase;
import com.tencent.mtt.view.dialog.newui.view.ViewOnClickListener;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import java.util.HashMap;
import java.util.Map;
import qb.novel.BuildConfig;
public class PirateNovelReaderModeMgr implements DialogInterface.OnDismissListener {
private static String f55354d = "PirateNovelReaderModeMgr";
private static PirateNovelReaderModeMgr e = null;
private static String f = "key_piratenovel_readermode_dialog_showed_";
private static String g = "key_piratenovel_readermode_default";
DialogBase f55355a = null;
boolean f55356b = true;
boolean f55357c = false;
public static PirateNovelReaderModeMgr a() {
if (e == null) {
synchronized (PirateNovelReaderModeMgr.class) {
if (e == null) {
e = new PirateNovelReaderModeMgr();
}
}
}
return e;
}
public static void a(boolean z, String str, String str2, String str3, long j) {
if (z && NovelDecodeDomainManager.a().b(str3)) {
HashMap hashMap = new HashMap();
hashMap.put("url", str3);
hashMap.put("costTime", String.valueOf(j));
hashMap.put("stateKey", str2);
hashMap.put("isOptimize", String.valueOf(c()));
hashMap.put("isEnableJS", String.valueOf(d()));
hashMap.put("isJSOptimize", String.valueOf(PirateJsManager.a()));
StatManager.b().a(str, (Map<String, String>) hashMap, true);
}
}
private boolean a(String str) {
if (TextUtils.isEmpty(str)) {
return false;
}
Logs.c(f55354d, "isReaderModeDialogShowed call");
long currentTimeMillis = System.currentTimeMillis();
String hostNew = UrlUtils.getHostNew(str);
PublicSettingManager a2 = PublicSettingManager.a();
StringBuilder sb = new StringBuilder();
sb.append(f);
sb.append(hostNew);
return currentTimeMillis - a2.getLong(sb.toString(), 0L) > 604800000;
}
public static boolean b() {
return FeatureToggle.a(BuildConfig.FEATURE_TOGGLE_PIRATE_NOVEL_866108373);
}
private void c(String str, final String str2, final Bundle bundle) {
if (this.f55355a != null) {
return;
}
Logs.c(f55354d, "showReaderModeDialog called");
this.f55355a = SimpleDialogBuilder.f().d("进入小说畅读,享受沉浸阅读体验!").f("下次默认进入").a(true).a(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
PirateNovelReaderModeMgr.this.f55356b = z;
EventCollector.getInstance().onCheckedChanged(compoundButton, z);
}
}).a("进入畅读").a_(new ViewOnClickListener() {
@Override
public void onClick(View view, DialogBase dialogBase) {
PirateNovelReaderModeMgr.this.a(str2, bundle);
((IWebPageStatService) QBContext.getInstance().getService(IWebPageStatService.class)).stat("web_0132");
}
}).c("下次再说").c(new ViewOnClickListener() {
@Override
public void onClick(View view, DialogBase dialogBase) {
dialogBase.dismiss();
((IWebPageStatService) QBContext.getInstance().getService(IWebPageStatService.class)).stat("web_0133");
}
}).d();
this.f55355a.setOnDismissListener(this);
this.f55355a.show();
if (!TextUtils.isEmpty(str)) {
String hostNew = UrlUtils.getHostNew(str);
if (!TextUtils.isEmpty(hostNew)) {
PublicSettingManager.a().setLong(f + hostNew, System.currentTimeMillis());
}
}
((IWebPageStatService) QBContext.getInstance().getService(IWebPageStatService.class)).stat("web_0131");
}
public static boolean c() {
return FeatureToggle.a(BuildConfig.FEATURE_TOGGLE_PIRATE_EXTRACT_OPTIMIZE_869242103);
}
public static boolean d() {
return !FeatureToggle.a(BuildConfig.FEATURE_TOGGLE_PIRATE_JS_ENABLE_869242103);
}
public static boolean e() {
return FeatureToggle.a(BuildConfig.BUG_TOGGLE_CHAPTER_DISORDER_94578867);
}
private void f() {
PiratePageCycleListener.getInstance().f55601d = -1L;
}
private boolean g() {
return PublicSettingManager.a().getBoolean(g, false);
}
protected void a(int i) {
}
protected void a(String str, Bundle bundle) {
Logs.c(f55354d, "runReader called");
((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams(str).b(1).a(bundle).c(0));
}
public void a(boolean z) {
PublicSettingManager.a().setBoolean(g, z);
}
public boolean a(String str, String str2, Bundle bundle) {
boolean g2 = g();
((IWebPageStatService) QBContext.getInstance().getService(IWebPageStatService.class)).stat(g2 ? "web_0134" : "web_0135");
if (a(str)) {
f();
c(str, str2, bundle);
return false;
}
if (g2) {
a(str2, bundle);
return true;
}
f();
b(str, str2, bundle);
return false;
}
protected void b(String str, final String str2, final Bundle bundle) {
PageToolBoxGuideBean pageToolBoxGuideBean = new PageToolBoxGuideBean();
pageToolBoxGuideBean.f56136a = IPluginService.PLUGIN_PIRATE_NOVEL;
pageToolBoxGuideBean.f56137b = str;
pageToolBoxGuideBean.f = "开启";
pageToolBoxGuideBean.f56138c = "小说畅读可用";
pageToolBoxGuideBean.g = new Runnable() {
@Override
public void run() {
PirateNovelReaderModeMgr.this.a(str2, bundle);
PirateNovelReaderModeMgr.this.a(true);
}
};
pageToolBoxGuideBean.i = !this.f55357c;
pageToolBoxGuideBean.h = new PageToolBoxGuideBean.StatCallBack() {
@Override
public void a(int i) {
PirateNovelReaderModeMgr.this.a(i);
}
};
pageToolBoxGuideBean.a("https://res.imtt.qq.com/res_mtt/plugin/lottie/read_mode_guide_0814.json", "https://res.imtt.qq.com/res_mtt/plugin/lottie/read_mode_guide_0814_night.json");
EventEmiter.getDefault().emit(new EventMessage(IPageToolBoxGuideService.EVENT_TOOL_GUIDE, pageToolBoxGuideBean));
this.f55357c = true;
Logs.c(f55354d, "showReadModeGuid onReceiveValue true");
Logs.c(f55354d, "showReadModeGuid onReceiveValue originalPageUrl =" + str);
}
@Override
public void onDismiss(DialogInterface dialogInterface) {
PublicSettingManager.a().setBoolean(g, this.f55356b);
this.f55355a = null;
}
}