package com.tencent.mm.plugin.finder.utils; import android.content.Context; import android.content.Intent; import android.os.Build; import android.text.SpannableString; import android.text.TextPaint; import android.text.style.ClickableSpan; import android.view.View; import bw3.c52; import bw3.m42; import bw3.nd0; import bw3.s52; import bw3.ss4; import bw3.w81; import com.tencent.mars.cdn.CdnLogic; import com.tencent.mm.R; import com.tencent.mm.sdk.platformtools.BuildInfo; import com.tencent.mm.sdk.platformtools.Log; import com.tencent.mm.sdk.platformtools.MMApplicationContext; import com.tencent.mm.ui.l5; import com.tencent.thumbplayer.tmediacodec.util.MimeTypes; import cs1.g0; import ek0.v2; import ek4.d0; import ek4.y; import ft1.o; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.regex.Pattern; import lh4.m; import ln.t; import m60.d; import org.json.JSONObject; import t32.e2; import t32.e6; import vj.r; import wg4.b0; import xg4.u; import yf0.b; import yz3.j; public final class v0 { /* renamed from: a reason: collision with root package name */ public static final v0 f119383a = new v0(); /* renamed from: b reason: collision with root package name */ public static final List<Integer> f119384b = u.f(1, 2, 3, 4, 5, 7, 8, 9, 10, 11); public static final class a extends ClickableSpan { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ boolean f119385d; /* renamed from: e reason: collision with root package name */ public final /* synthetic */ Context f119386e; public a(boolean z15, Context context) { this.f119385d = z15; this.f119386e = context; } public void onClick(View view) { String str; ArrayList arrayList = new ArrayList(); arrayList.add(view); Object[] array = arrayList.toArray(); arrayList.clear(); j30.a.b("com/tencent/mm/plugin/finder/utils/FinderGameLiveUtil$getLicenseTxt$1", "android/text/style/ClickableSpan", "onClick", "(Landroid/view/View;)V", this, array); m.g(view, "widget"); v0 v0Var = v0.f119383a; Log.i("Finder.FinderGameLiveUtil", "license click"); Intent intent = new Intent(); if (this.f119385d) { str = "https://weixin.qq.com/cgi-bin/readtemplate?t=finder_live_mini_game_agreement&lang=zh_CN"; } else { str = "https://weixin.qq.com/cgi-bin/readtemplate?t=finder_live_game_agreement&lang=zh_CN"; } intent.putExtra("rawUrl", str); sv3.b.j(view.getContext(), "webview", ".ui.tools.WebViewUI", intent, null); j30.a.g(this, "com/tencent/mm/plugin/finder/utils/FinderGameLiveUtil$getLicenseTxt$1", "android/text/style/ClickableSpan", "onClick", "(Landroid/view/View;)V"); } public void updateDrawState(TextPaint textPaint) { m.g(textPaint, "ds"); textPaint.setColor(this.f119386e.getResources().getColor(R.color.f358426n4)); textPaint.setUnderlineText(false); textPaint.clearShadowLayer(); } } public static final class b<_Ret, _Var> implements g74.a { /* renamed from: a reason: collision with root package name */ public final /* synthetic */ Intent f119387a; /* renamed from: b reason: collision with root package name */ public final /* synthetic */ String f119388b; /* renamed from: c reason: collision with root package name */ public final /* synthetic */ String f119389c; public b(Intent intent, String str, String str2, int i15) { this.f119387a = intent; this.f119388b = str; this.f119389c = str2; } @Override // g74.a public Object call(Object obj) { T t15; String str; String str2; LinkedList<s52> linkedList; T t16; String str3; b.c cVar = (b.c) obj; if (cVar.f345499a == 0 && cVar.f345500b == 0) { w81 w812 = (w81) cVar.f345502d; c52 c522 = null; if (w812 == null || (linkedList = w812.f40762d) == null) { t15 = null; } else { String str4 = this.f119389c; Iterator<T> it = linkedList.iterator(); while (true) { if (!it.hasNext()) { t16 = null; break; } t16 = it.next(); m42 m422 = t16.f36076e; if (m422 != null) { str3 = m422.f29353d; } else { str3 = null; } if (m.b(str3, str4)) { break; } } t15 = t16; } if (t15 != null) { c522 = t15.f36078g; } if (c522 == null) { v0 v0Var = v0.f119383a; Log.w("Finder.FinderGameLiveUtil", "detail null"); } else { c52 c523 = t15.f36078g; String str5 = ""; if (c523 == null || (str = c523.f17952e) == null) { str = str5; } if (!(c523 == null || (str2 = c523.f17951d) == null)) { str5 = str2; } this.f119387a.putExtra("COVER_URL", str); this.f119387a.putExtra("DESC", str5); this.f119387a.putExtra("TICKET", this.f119388b); this.f119387a.putExtra("APPID", this.f119389c); this.f119387a.putExtra("POST_FROM_SCENE", 0); this.f119387a.putExtra("GameUserInfo", t15.toByteArray()); this.f119387a.addFlags(536870912); Context context = MMApplicationContext.getContext(); m.f(context, "getContext()"); ((v2) j.c(v2.class)).L6(context, this.f119387a); } } else { v0 v0Var2 = v0.f119383a; Log.w("Finder.FinderGameLiveUtil", "CgiFinderLiveGetUserGameConfig failed."); } return b0.f332794a; } } public final void a(View view) { if (view != null) { view.setPadding(view.getPaddingLeft(), view.getPaddingTop() + l5.f(view.getContext()), view.getPaddingRight(), view.getPaddingBottom()); } } public final boolean b(Context context, String str) { m.g(context, "context"); m.g(str, "packageName"); try { if (context.getPackageManager().getPackageInfo(str, 64) != null) { return true; } } catch (Exception e15) { Log.w("Finder.FinderGameLiveUtil", "checkInstalled " + str + " Exception: %s", e15.getMessage()); } return false; } public final void c(Context context, String str) { m.g(context, "context"); m.g(str, "downloadUrl"); Log.i("Finder.FinderGameLiveUtil", "download SecondCut url " + str); Intent intent = new Intent(); intent.putExtra("rawUrl", str); sv3.b.j(context, "webview", ".ui.tools.WebViewUI", intent, null); } public final void d(int i15, String str, String str2, String str3) { String str4; m.g(str, "errMsg"); JSONObject jSONObject = new JSONObject(); jSONObject.put("errCode", i15); jSONObject.put("errmsg", str); String jSONObject2 = jSONObject.toString(); m.f(jSONObject2, "retJson.toString()"); if (BuildInfo.DEBUG || BuildInfo.IS_FLAVOR_PURPLE || BuildInfo.IS_FLAVOR_RED) { d.O(new w0(jSONObject2)); } t tVar = (t) j.c(t.class); String str5 = str2 == null ? "" : str2; String jSONObject3 = jSONObject.toString(); if (str3 == null) { str4 = ""; } else { str4 = str3; } tVar.bc0(str5, jSONObject3, str4, -1, ""); } public final nd0 e() { nd0 nd02 = new nd0(); nd02.f30762f = r.k(); nd02.f30760d = Build.BRAND; nd02.f30761e = Build.MANUFACTURER; nd02.f30763g = Build.VERSION.RELEASE; nd02.f30764h = Build.VERSION.INCREMENTAL; nd02.f30765i = Build.DISPLAY; return nd02; } public final String f(boolean z15, int i15, String str, Context context, int i16) { String str2; String str3; String str4; m.g(str, "gameName"); m.g(context, "context"); if (z15) { if (i15 == 2) { str4 = context.getString(R.string.f368182d04, str); } else if (i15 == 3) { str4 = context.getString(R.string.d05, str); } else if (i15 == 4) { str4 = context.getString(R.string.d06, str); } else if (i15 == 5) { str4 = context.getString(R.string.d07, str); } else if (i15 != 7) { str4 = context.getString(R.string.d08, str); } else { str4 = context.getString(R.string.d09, str); } m.f(str4, "{\n when (team…)\n }\n }"); return str4; } if (i15 == 2) { str2 = context.getString(R.string.cyp, str); } else if (i15 == 3) { str2 = context.getString(R.string.cyq, str); } else if (i15 == 4) { str2 = context.getString(R.string.cyr, str); } else if (i15 == 5) { str2 = context.getString(R.string.cys, str); } else if (i15 == 7) { str2 = context.getString(R.string.czs, str); } else if (i15 != 8) { str2 = context.getString(R.string.cyu, str); } else { str2 = context.getString(R.string.cyt, str); } m.f(str2, "when (teamMode) {\n …, gameName)\n }"); if (i16 == 1) { str3 = context.getString(R.string.d0_); } else { str3 = ""; } m.f(str3, "when (platomId) {\n … }\n }"); return str2 + str3; } public final SpannableString g(Context context, int i15, boolean z15) { String str; m.g(context, "context"); if (z15) { str = context.getString(R.string.l4y); } else { str = context.getString(R.string.l4v); } m.f(str, "if (isMiniGame) {\n …eerror_license)\n }"); int i16 = 0; String string = context.getString(i15, str); m.f(string, "context.getString(strId, strForIndex)"); int H = d0.H(string, str, 0, false, 6, null); int length = str.length() + H; SpannableString spannableString = new SpannableString(string); if (H <= 0 || length > string.length()) { length = string.length(); Log.e("Finder.FinderGameLiveUtil", "license text err,all string:" + string + ",license:" + str); } else { i16 = H; } spannableString.setSpan(new a(z15, context), i16, length, 33); return spannableString; } public final String h(String str, int i15) { m.g(str, MimeTypes.BASE_TYPE_TEXT); Pattern compile = Pattern.compile("[一-龥]"); m.f(compile, "compile(pattern)"); int length = str.length(); int i16 = 0; int i17 = 0; int i18 = 0; while (i16 < length) { int i19 = i16 + 1; String substring = str.substring(i16, i19); m.f(substring, "this as java.lang.String…ing(startIndex, endIndex)"); if (compile.matcher(substring).matches()) { i18++; } else { i17++; } if ((i18 * 2) + i17 > i15 * 2) { StringBuilder sb5 = new StringBuilder(); String substring2 = str.substring(0, i16); m.f(substring2, "this as java.lang.String…ing(startIndex, endIndex)"); sb5.append(substring2); sb5.append("..."); return sb5.toString(); } i16 = i19; } return str; } public final void i(JSONObject jSONObject, Intent intent, ss4 ss4, String str) { String string = jSONObject.getString("ticket"); intent.putExtra("KEY_POST_FROM_SHARE", ss4.toByteArray()); intent.putExtra("KEY_TICKET", string); intent.putExtra("KEY_APPID", str); intent.putExtra("KEY_FROM_SCAN", false); Context context = MMApplicationContext.getContext(); m.f(context, "getContext()"); ((v2) j.c(v2.class)).y4(context, intent); } public final void j(int i15, JSONObject jSONObject, String str, Intent intent) { Log.i("Finder.FinderGameLiveUtil", "jumpGameLiveUI action:" + i15); String string = jSONObject.getString("liveObjectExportId"); String e25 = ((e2) j.c(e2.class)).e2(11, 8, 65); Context context = MMApplicationContext.getContext(); m.f(context, "getContext()"); ((e2) j.c(e2.class)).S7().M(i15, string, 0, r32.b.c(context), e25, ""); } public final void k(JSONObject jSONObject, String str, Intent intent) { new do1.r(str, 0, false, null, false, 28, null).h().H(new b(intent, jSONObject.optString("ticket", ""), str, 0)); } public final void l(er1.b bVar, int i15, int i16, String str) { String str2; m.g(bVar, "liveData"); if (!((o) bVar.a(o.class)).E) { JSONObject jSONObject = new JSONObject(); if (i15 == 1) { str2 = "23"; } else { str2 = "24"; } jSONObject.put("type", str2); JSONObject jSONObject2 = new JSONObject(); jSONObject2.put("appid", str); jSONObject2.put("gametype", String.valueOf(i16)); String jSONObject3 = jSONObject.toString(); m.f(jSONObject3, "actionJs.toString()"); String q15 = y.q(jSONObject3, ",", ";", false); String jSONObject4 = jSONObject2.toString(); m.f(jSONObject4, "chnlJs.toString()"); ((cs1.o) j.c(cs1.o.class)).KM0(18, q15, y.q(jSONObject4, ",", ";", false)); return; } JSONObject jSONObject5 = new JSONObject(); jSONObject5.put("type", String.valueOf(i15)); jSONObject5.put("appid", str); jSONObject5.put("gametype", String.valueOf(i16)); yz3.d c15 = j.c(cs1.o.class); m.f(c15, "getService(HellLiveReport::class.java)"); e6.a.f((e6) c15, g0.f193340k1, jSONObject5.toString(), null, 4, null); } public final int m(int i15) { if (i15 != 1) { if (i15 != 20009) { if (i15 == 20036) { return 1; } if (!(i15 == 20001 || i15 == 20002)) { if (i15 != 20013) { if (i15 == 20014) { return 11; } if (i15 == 20019) { return 13; } if (i15 == 20020) { return 14; } switch (i15) { case 10005: return 3; case 10006: case CdnLogic.kMediaTypeFavoriteBigFile: return 6; case 10008: return 7; default: switch (i15) { case 100000: return 1; case 100001: return 16; default: return 0; } } } } } return 10; } return 2; } }