package com.ss.android.ugc.aweme.live.livehostimpl; import X.AbstractC30284Buz; import X.AbstractC30352Bw5; import X.AbstractC42305GjO; import X.AbstractC48549J4o; import X.AbstractC524424z; import X.AbstractC99113vA; import X.AnonymousClass0WE; import X.AnonymousClass2IT; import X.AnonymousClass2O8; import X.C10810c2; import X.C12290eQ; import X.C164266cx; import X.C16640lR; import X.C18740op; import X.C18770os; import X.C21280sv; import X.C21680tZ; import X.C21690ta; import X.C22330uc; import X.C22430um; import X.C29732Bm5; import X.C36000EBx; import X.C36002EBz; import X.C38141f1; import X.C47824IqD; import X.C48283Ixc; import X.C48547J4m; import X.C48678J9n; import X.C48679J9o; import X.C48680J9p; import X.C48976JKz; import X.C49003JMa; import X.C49015JMm; import X.C49123JQq; import X.C524024v; import X.C524124w; import X.C67492lG; import X.C99073v6; import X.C99423vf; import X.CAF; import X.COK; import X.E2O; import X.E5A; import X.EC0; import X.EC1; import X.J3D; import X.J6R; import X.J6V; import X.J6Y; import X.JD9; import X.JMA; import X.JQ0; import X.KL9; import android.app.Activity; import android.app.Application; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.text.TextUtils; import android.webkit.WebView; import com.bytedance.android.livesdk.livesetting.hybrid.LiveSchemaSkipDeepLinkEnableSetting; import com.bytedance.android.livesdk.livesetting.hybrid.LiveSchemaSkipDeepLinkSetting; import com.bytedance.android.livesdk.livesetting.hybrid.LiveSchemaUseRouterListSetting; import com.bytedance.android.livesdkapi.host.IHostAction; import com.bytedance.android.livesdkapi.host.IHostContext; import com.bytedance.android.livesdkapi.host.IHostWebView; import com.bytedance.android.livesdkapi.session.EnterRoomConfig; import com.bytedance.covode.number.Covode; import com.bytedance.ies.bullet.kit.lynx.ILynxKitApi; import com.bytedance.ies.bullet.service.base.IResourceLoaderService; import com.bytedance.ies.bullet.service.base.resourceloader.config.GeckoConfig; import com.bytedance.ies.ugc.aweme.network.RetrofitFactory; import com.bytedance.router.SmartRouter; import com.lynx.tasm.LynxEnv; import com.ss.android.common.applog.AppLog; import com.ss.android.ugc.aweme.gecko.GeckoXNetImpl; import com.ss.android.ugc.aweme.live.ILiveInnerService; import com.ss.android.ugc.aweme.live.LiveDummyActivity; import com.ss.android.ugc.aweme.live.LiveHostOuterService; import com.ss.android.ugc.aweme.live.LiveOuterService; import com.ss.android.ugc.aweme.ttlive.ILiveApi; import com.ss.android.ugc.aweme.utils.ActivityStack; import com.swift.sandhook.utils.FileUtils; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.regex.Pattern; import kotlin.g.b.m; import org.json.JSONException; import org.json.JSONObject; public class LiveHostAction implements IHostAction { public ILiveApi LIZ = ((ILiveApi) RetrofitFactory.LIZ().LIZIZ(C10810c2.LJ).LIZJ().LIZ(ILiveApi.class)); static { Covode.recordClassIndex(80828); } public static Object LIZ(Bundle bundle, String str) { try { return bundle.get(str); } catch (Exception | OutOfMemoryError unused) { return null; } } private String LIZ(String str, Bundle bundle) { C67492lG LIZ2 = C67492lG.LIZ(str); for (String str2 : bundle.keySet()) { Object LIZ3 = LIZ(bundle, str2); if (LIZ3 != null) { LIZ2.LIZ(str2, LIZ3.toString()); } } return LIZ2.LIZ.LIZ(); } public static void LIZ(Context context, Intent intent) { C21280sv.LIZ(intent, context); context.startActivity(intent); } private boolean LIZ(Context context, String str, boolean z) { if (!(context instanceof Activity) || TextUtils.isEmpty(str)) { return false; } if (str.startsWith("sslocal://showcaseh5")) { LiveHostOuterService.LJIILL().LIZ(context, str); return true; } else if (!z) { SmartRouter.buildRoute(context, str).open(); return true; } else { Uri parse = Uri.parse(str); String uri = parse.buildUpon().clearQuery().build().toString(); for (String str2 : LiveSchemaUseRouterListSetting.INSTANCE.getValue()) { if (str2.equals(uri)) { SmartRouter.buildRoute(context, str).open(); return true; } } if (LiveSchemaSkipDeepLinkEnableSetting.INSTANCE.getValue()) { String host = parse.getHost(); if (TextUtils.equals(host, "webcast_lynxview") || TextUtils.equals(host, "webcast_webview") || TextUtils.equals(host, "webcast_lynxview_popup") || TextUtils.equals(host, "webcast_webview_popup")) { String queryParameter = parse.getQueryParameter("url"); if (!TextUtils.isEmpty(queryParameter)) { Uri parse2 = Uri.parse(queryParameter); for (String str3 : LiveSchemaSkipDeepLinkSetting.INSTANCE.getValue()) { if (TextUtils.equals(parse2.getHost(), str3)) { SmartRouter.buildRoute(context, str).open(); return true; } } } } } Intent LIZIZ = LiveHostOuterService.LJIILL().LIZIZ(context); if (LIZIZ == null) { return false; } String host2 = parse.getHost(); if (TextUtils.equals(host2, "webcast_webview") || TextUtils.equals(host2, "webcast_webview_popup")) { LIZIZ.putExtra("need_sec_link", true); LIZIZ.putExtra("need_detect_2_jump", true); LIZIZ.putExtra("sec_link_scene", "deeplink"); } LIZIZ.setData(parse); LIZ(context, LIZIZ); return true; } } @Override // com.bytedance.android.livesdkapi.host.IHostAction public void finishLivePlayActivity() { Activity[] activityStack = ActivityStack.getActivityStack(); Class LIZJ = ((ILiveInnerService) C524024v.LIZIZ(ILiveInnerService.class)).LIZJ(); for (Activity activity : activityStack) { if (LIZJ.isInstance(activity)) { activity.finish(); } } } @Override // com.bytedance.android.livesdkapi.host.IHostAction public List<C49123JQq> getHostLynxBehaviors() { return KL9.LIZ(true); } @Override // com.bytedance.android.livesdkapi.host.IHostAction public List<C29732Bm5> getLiveActivityTasksSetting() { return LiveHostOuterService.LJIILL().LJIIIIZZ(); } @Override // com.bytedance.android.livesdkapi.host.IHostAction public String getReportUrl() { return LiveHostOuterService.LJIILL().LJIIIZ(); } @Override // com.bytedance.android.livesdkapi.host.IHostAction public AbstractC30284Buz getSearchComponent(final String str) { return new AbstractC30284Buz() { /* class com.ss.android.ugc.aweme.live.livehostimpl.LiveHostAction.AnonymousClass1 */ static { Covode.recordClassIndex(80829); } @Override // X.AbstractC30284Buz public final List<EnterRoomConfig> LIZ() { return LiveOuterService.LJJIFFI().LJIIIZ().LIZ(str).LIZ(); } @Override // X.AbstractC30284Buz public final void LIZ(int i2, AbstractC30352Bw5 bw5) { LiveOuterService.LJJIFFI().LJIIIZ().LIZ(str).LIZ(i2, bw5); } @Override // X.AbstractC30284Buz public final void LIZ(long j) { LiveOuterService.LJJIFFI().LJIIIZ().LIZ(str).LIZ(j); } @Override // X.AbstractC30284Buz public final void LIZ(Map<String, String> map) { LiveOuterService.LJJIFFI().LJIIIZ().LIZ(str).LIZ(map); } @Override // X.AbstractC30284Buz public final void LIZIZ() { LiveOuterService.LJJIFFI().LJIIIZ().LIZ(str).LIZIZ(); } }; } @Override // com.bytedance.android.livesdkapi.host.IHostAction public JSONObject getTTSetting() { try { return LiveHostOuterService.LJIILL().LJIILIIL(); } catch (JSONException e) { e.printStackTrace(); return new JSONObject(); } } @Override // com.bytedance.android.livesdkapi.host.IHostAction public E2O getVideoOnDemandParams() { E2O e2o = new E2O(); double LJIIL = LiveHostOuterService.LJIILL().LJIIL(); int LJIIJJI = LiveHostOuterService.LJIILL().LJIIJJI(); e2o.LIZ = LJIIL; e2o.LIZIZ = LJIIJJI; return e2o; } @Override // com.bytedance.android.livesdkapi.host.IHostAction public void goEditDoBAgeGatePage(Activity activity, String str, AbstractC99113vA r6) { this.LIZ.getDoBStatus().LIZIZ(C22330uc.LIZIZ(C22430um.LIZJ)).LIZ(C21680tZ.LIZ(C21690ta.LIZ)).LIZ(new C99073v6(activity, r6, str), new C99423vf(r6)); } @Override // com.bytedance.android.livesdkapi.host.IHostAction public boolean handleIntentSchema(WebView webView, String str) { return new C48283Ixc().shouldOverrideUrlLoading(webView, str); } @Override // com.bytedance.android.livesdkapi.host.IHostAction public boolean handleSchema(Context context, String str, Bundle bundle) { return handleSchema(context, str, bundle, true); } @Override // com.bytedance.android.livesdkapi.host.IHostAction public boolean handleSchema(Context context, String str, Bundle bundle, boolean z) { Activity activity; if (!(context instanceof Activity)) { return false; } str.hashCode(); switch (str.hashCode()) { case -1863814380: if (str.equals("//report") && (activity = (Activity) context) != null) { StringBuilder sb = new StringBuilder(); sb.append("https://www.tiktokv.com/aweme/in_app/report/"); try { sb.append("?object_id=").append(LIZ(bundle, "reportVideo.user.id")).append("&owner_id=").append(LIZ(bundle, "reportVideo.user.id")).append("&report_type=").append(LIZ(bundle, "reportVideo.activity.type")).append("&room_id=").append(LIZ(bundle, "reportVideo.media.id")); } catch (Exception unused) { } Intent LIZ2 = LiveHostOuterService.LJIILL().LIZ((Context) activity); Bundle bundle2 = new Bundle(); bundle2.putBoolean("show_load_dialog", false); bundle2.putBoolean("hide_nav_bar", true); LIZ2.putExtras(bundle2); LIZ2.setData(Uri.parse(sb.toString())); C21280sv.LIZ(LIZ2, activity); activity.startActivity(LIZ2); break; } case -1813849575: if (str.equals("//webview")) { StringBuilder sb2 = new StringBuilder(); sb2.append("aweme://webview/?url=").append(LIZ(bundle, "bundle_open_url")); if (bundle.containsKey("title")) { sb2.append("&title=").append(LIZ(bundle, "title")); } str = sb2.toString(); break; } break; case -1588030678: if (str.equals("//livend/submitfeedbackacitivity") && bundle != null && bundle.containsKey("roomId")) { try { C67492lG LIZ3 = C67492lG.LIZ(C38141f1.LIZ.LIZIZ.getFeedbackConf().getFeHelp()); LIZ3.LIZ.LIZ("roomId", bundle.getLong("roomId")); C18740op r1 = C18770os.LIZ().LIZJ; if (r1.LIZIZ == null) { r1.LIZIZ = new ArrayList<>(); } r1.LIZIZ.add("roomId"); LIZ3.LIZ("feedback_id", "6954"); LIZ3.LIZ("enter_from", "live_end"); C18770os.LIZ(C18770os.LIZ(), LIZ3.LIZ()); break; } catch (AnonymousClass2O8 unused2) { break; } } case -570110082: if (str.equals("//verify/acitivity")) { str = "aweme://aweme/zhima/live"; break; } break; case -262720268: if (str.equals("//live/detail")) { long j = bundle.getLong("live.intent.extra.ROOM_ID"); EnterRoomConfig enterRoomConfig = new EnterRoomConfig(); enterRoomConfig.LIZLLL.LJJJJL = j; LiveOuterService.LJJIFFI().LJIIIZ().LIZ(context, enterRoomConfig, ""); break; } break; case 337200928: if (str.equals("//chargeDeal")) { new LiveHostApp().openWallet((Activity) context); return true; } break; case 947267529: if (str.equals("//profile")) { str = LIZ("aweme://user/profile/" + LIZ(bundle, "user_id"), bundle); break; } break; case 1392218355: if (str.equals("//item")) { str = LIZ("aweme://aweme/detail/" + LIZ(bundle, "extra_key_id"), bundle); break; } break; } return LIZ(context, str, z); } @Override // com.bytedance.android.livesdkapi.host.IHostAction public boolean hostInterceptSpark(String str) { return C164266cx.LIZ(str); } @Override // com.bytedance.android.livesdkapi.host.IHostAction public void initLynxEnv() { if (!LynxEnv.LIZIZ().LJFF.get()) { C47824IqD.LIZ().LIZ(ILynxKitApi.class); } E5A e5a = (E5A) J6V.LIZIZ.LIZ().LIZ("live", E5A.class); if (e5a == null || !m.LIZ((Object) e5a.LIZJ(), (Object) "live")) { Context LIZ2 = AnonymousClass0WE.LJJI.LIZ(); if (!(LIZ2 instanceof Application)) { LIZ2 = null; } Application application = (Application) LIZ2; if (application != null) { C48680J9p j9p = new C48680J9p(application); AbstractC524424z LIZ3 = C524124w.LIZ(IHostContext.class); m.LIZIZ(LIZ3, ""); C48678J9n.LIZIZ = ((IHostContext) LIZ3).isLocalTest(); C48679J9o LIZ4 = j9p.LIZ(); J6Y LIZ5 = J6V.LIZIZ.LIZ(); J6R LIZ6 = new J6R().LIZ(E5A.class, new C48976JKz(LIZ4)); EC0 ec0 = new EC0(); C36002EBz eBz = new C36002EBz(); AbstractC524424z LIZ7 = C524124w.LIZ(IHostWebView.class); m.LIZIZ(LIZ7, ""); eBz.LIZIZ = ((IHostWebView) LIZ7).LIZLLL(); J6R LIZ8 = LIZ6.LIZ(J3D.class, new JD9(ec0, eBz.LIZ())); C49015JMm jMm = new C49015JMm(application); m.LIZIZ(AnonymousClass2IT.LIZ, ""); m.LIZIZ("gecko-va.tiktokv.com", ""); String LIZ9 = C16640lR.LIZ(); m.LIZIZ(LIZ9, ""); ArrayList arrayList = new ArrayList(); for (Pattern pattern : COK.LIZ()) { if (pattern != null) { String pattern2 = pattern.toString(); m.LIZIZ(pattern2, ""); if (pattern2.length() > 0) { Uri parse = Uri.parse(pattern.toString()); m.LIZIZ(parse, ""); String path = parse.getPath(); if (!(path == null || path.length() == 0)) { String path2 = parse.getPath(); if (path2 == null) { m.LIZIZ(); } m.LIZIZ(path2, ""); arrayList.add(path2); } } } } String valueOf = String.valueOf(AnonymousClass0WE.LJIILJJIL); String LJFF = AnonymousClass0WE.LJJI.LJFF(); String serverDeviceId = AppLog.getServerDeviceId(); if (serverDeviceId == null) { serverDeviceId = ""; } JQ0 jq0 = new JQ0(); GeckoXNetImpl geckoXNetImpl = new GeckoXNetImpl(application); AnonymousClass2IT r2 = AnonymousClass2IT.LIZ; m.LIZIZ(r2, ""); String LIZJ = r2.LIZJ(); m.LIZIZ(LIZJ, ""); jMm.init(new JMA("gecko-va.tiktokv.com", LIZ9, arrayList, valueOf, LJFF, serverDeviceId, new GeckoConfig(LIZJ, "offlineX", new C49003JMa(), true, false, 16, null), null, jq0, geckoXNetImpl, FileUtils.FileMode.MODE_IWUSR)); LIZ5.LIZ("live", LIZ8.LIZ(IResourceLoaderService.class, jMm).LIZ(AbstractC48549J4o.class, new C48547J4m(new C36000EBx().LIZ())).LIZ()); } } } @Override // com.bytedance.android.livesdkapi.host.IHostAction public void notifyShowLiveIconEntrance(boolean z) { LiveHostOuterService.LJIILL().LIZ(z); } @Override // X.AbstractC524424z public void onInit() { } @Override // com.bytedance.android.livesdkapi.host.IHostAction public void openFeedBack(String str, Context context) { Intent LIZ2 = LiveHostOuterService.LJIILL().LIZ(context); LIZ2.setData(Uri.parse("https://m.tiktok.com/falcon/tiktok_rn_web/feedback/?hide_nav_bar=1?enter_from=".concat(String.valueOf(str)))); LIZ2.putExtra("hide_nav_bar", true); LIZ(context, LIZ2); } @Override // com.bytedance.android.livesdkapi.host.IHostAction public boolean openHostBrowser(String str, Bundle bundle, Context context) { Intent LIZ2 = LiveHostOuterService.LJIILL().LIZ(context); LIZ2.putExtras(bundle); LIZ2.setData(Uri.parse(str)); LIZ(context, LIZ2); return true; } @Override // com.bytedance.android.livesdkapi.host.IHostAction public boolean openHostBrowser(String str, boolean z, String str2, Context context) { StringBuilder sb = new StringBuilder(); sb.append("aweme://webview/?url=").append(str); if (z) { sb.append("&title=").append(str2); } return LIZ(context, sb.toString(), true); } @Override // com.bytedance.android.livesdkapi.host.IHostAction public void openLiveBrowser(String str, Bundle bundle, Context context) { Uri parse; if (!(context instanceof Activity)) { context = ActivityStack.getTopActivity(); } if (context != null) { if (hostInterceptSpark(str)) { LiveOuterService.LJJIFFI().LIZ(context, CAF.LIZ(str).LJI().toString()); return; } Intent intent = new Intent(context, LiveDummyActivity.class); bundle.putString("url", str); String string = bundle.getString("original_scheme"); if (!TextUtils.isEmpty(string) && (parse = Uri.parse(string)) != null) { String queryParameter = parse.getQueryParameter("sec_link_scene"); if (!TextUtils.isEmpty(queryParameter)) { bundle.putString("sec_link_scene", queryParameter); } } bundle.putBoolean("show_progress", false); intent.putExtra("intent_type", 1); intent.putExtras(bundle); LIZ(context, intent); } } @Override // com.bytedance.android.livesdkapi.host.IHostAction public void openLiveBrowser(String str, String str2, Context context) { Bundle bundle = new Bundle(); bundle.putBoolean("hide_nav_bar", TextUtils.isEmpty(str2)); bundle.putString("title", str2); openLiveBrowser(str, bundle, context); } @Override // com.bytedance.android.livesdkapi.host.IHostAction public void openLiveLynx(String str, Bundle bundle, Context context) { if (!(context instanceof Activity)) { context = ActivityStack.getTopActivity(); } if (context != null) { Intent intent = new Intent(context, LiveDummyActivity.class); bundle.putString("url", str); intent.putExtra("intent_type", 4); intent.putExtras(bundle); LIZ(context, intent); } } @Override // com.bytedance.android.livesdkapi.host.IHostAction public void openLiveNewHybrid(Uri uri, Context context, Bundle bundle) { if (!(context instanceof Activity)) { context = ActivityStack.getTopActivity(); } if (context != null) { Intent intent = new Intent(context, LiveDummyActivity.class); intent.putExtra("intent_type", 5); bundle.putParcelable("bundle_uri", uri); intent.putExtras(bundle); LIZ(context, intent); } } @Override // com.bytedance.android.livesdkapi.host.IHostAction public void openRegionListPage(Activity activity, final EC1 ec1) { C12290eQ.LIZIZ().openCountryListActivity(activity, new AbstractC42305GjO() { /* class com.ss.android.ugc.aweme.live.livehostimpl.LiveHostAction.AnonymousClass2 */ static { Covode.recordClassIndex(80830); } @Override // X.AbstractC42305GjO public final void onChanged(String str, String str2) { EC1 ec1 = ec1; if (ec1 != null) { ec1.LIZ(str, str2); } } @Override // X.AbstractC42305GjO public final void onExit() { EC1 ec1 = ec1; if (ec1 != null) { ec1.LIZ(); } } }); } @Override // com.bytedance.android.livesdkapi.host.IHostAction public void openSignActivity(Context context, Intent intent) { } @Override // com.bytedance.android.livesdkapi.host.IHostAction public void openUserProfilePage(long j, Map<String, String> map) { C67492lG LIZ2 = C67492lG.LIZ("aweme://user/profile/".concat(String.valueOf(j))); if (map != null) { for (String str : map.keySet()) { LIZ2.LIZ(str, map.get(str)); } } C18770os.LIZ(C18770os.LIZ(), LIZ2.LIZ.LIZ()); } @Override // com.bytedance.android.livesdkapi.host.IHostAction public void openUserProfilePage(Context context, long j, Bundle bundle) { C18770os.LIZ(C18770os.LIZ(), "aweme://user/profile/".concat(String.valueOf(j))); } @Override // com.bytedance.android.livesdkapi.host.IHostAction public void openVideoDetailPage(String str, String str2) { } @Override // com.bytedance.android.livesdkapi.host.IHostAction public void preloadLiveClass(Context context) { LiveOuterService.LJJIFFI().LIZ().LJJ().LIZ(context); } @Override // com.bytedance.android.livesdkapi.host.IHostAction public void switchToLiveTab(int i2, String str) { } @Override // com.bytedance.android.livesdkapi.host.IHostAction public boolean tryOpenAdByOpenUrl(Context context, long j, String str, String str2) { return false; } @Override // com.bytedance.android.livesdkapi.host.IHostAction public boolean tryShowKoiRedPackageInLive(String str) { return false; } }