jimu-decompiled/sources/com/tencent/open/a.java
2025-05-13 19:24:51 +02:00

133 lines
4.7 KiB
Java

package com.tencent.open;
import android.net.Uri;
import android.webkit.WebView;
import com.tencent.open.a.f;
import java.io.UnsupportedEncodingException;
import java.lang.ref.WeakReference;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class a {
protected HashMap<String, b> a = new HashMap<>();
/* compiled from: ProGuard */
public static class b {
/* JADX WARN: Code restructure failed: missing block: B:44:0x013c, code lost:
r13.a((java.lang.Object) null);
*/
/* JADX WARN: Code restructure failed: missing block: B:45:0x013f, code lost:
return;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public void call(java.lang.String r11, java.util.List<java.lang.String> r12, com.tencent.open.a.C0016a r13) {
/*
Method dump skipped, instructions count: 353
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.open.a.b.call(java.lang.String, java.util.List, com.tencent.open.a$a):void");
}
public boolean customCallback() {
return false;
}
}
public void a(b bVar, String str) {
this.a.put(str, bVar);
}
public void a(String str, String str2, List<String> list, C0016a c0016a) {
f.a("openSDK_LOG.JsBridge", "getResult---objName = " + str + " methodName = " + str2);
int size = list.size();
for (int i = 0; i < size; i++) {
try {
list.set(i, URLDecoder.decode(list.get(i), "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
b bVar = this.a.get(str);
if (bVar != null) {
f.b("openSDK_LOG.JsBridge", "call----");
bVar.call(str2, list, c0016a);
} else {
f.b("openSDK_LOG.JsBridge", "not call----objName NOT FIND");
if (c0016a != null) {
c0016a.a();
}
}
}
/* compiled from: ProGuard */
/* renamed from: com.tencent.open.a$a, reason: collision with other inner class name */
public static class C0016a {
protected WeakReference<WebView> a;
protected long b;
protected String c;
public C0016a(WebView webView, long j, String str) {
this.a = new WeakReference<>(webView);
this.b = j;
this.c = str;
}
public void a(Object obj) {
String obj2;
WebView webView = this.a.get();
if (webView == null) {
return;
}
if (obj instanceof String) {
obj2 = "'" + ((Object) ((String) obj).replace("\\", "\\\\").replace("'", "\\'")) + "'";
} else {
obj2 = ((obj instanceof Number) || (obj instanceof Long) || (obj instanceof Integer) || (obj instanceof Double) || (obj instanceof Float)) ? obj.toString() : obj instanceof Boolean ? obj.toString() : "'undefined'";
}
webView.loadUrl("javascript:window.JsBridge&&JsBridge.callback(" + this.b + ",{'r':0,'result':" + obj2 + "});");
}
public void a() {
WebView webView = this.a.get();
if (webView == null) {
return;
}
webView.loadUrl("javascript:window.JsBridge&&JsBridge.callback(" + this.b + ",{'r':1,'result':'no such method'})");
}
public void a(String str) {
WebView webView = this.a.get();
if (webView != null) {
webView.loadUrl("javascript:" + str);
}
}
}
public boolean a(WebView webView, String str) {
f.a("openSDK_LOG.JsBridge", "-->canHandleUrl---url = " + str);
if (str == null || !Uri.parse(str).getScheme().equals("jsbridge")) {
return false;
}
ArrayList arrayList = new ArrayList(Arrays.asList((str + "/#").split("/")));
if (arrayList.size() < 6) {
return false;
}
String str2 = (String) arrayList.get(2);
String str3 = (String) arrayList.get(3);
List<String> subList = arrayList.subList(4, arrayList.size() - 1);
C0016a c0016a = new C0016a(webView, 4L, str);
webView.getUrl();
a(str2, str3, subList, c0016a);
return true;
}
}