TIM v2.3.1版本的 MD5 值为:d6957e3ee7ce901ccc491cefdea0da8c
以下内容为反编译后的 URLInterceptManager.java 源代码,内容仅作参考
package com.tencent.mobileqq.vas;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import com.tencent.common.config.AppSetting;
import com.tencent.mobileqq.activity.JumpActivity;
import com.tencent.mobileqq.app.QQAppInterface;
import com.tencent.mobileqq.app.ThreadManager;
import com.tencent.mobileqq.utils.FileUtils;
import com.tencent.mobileqq.utils.JumpAction;
import com.tencent.mobileqq.utils.JumpParser;
import com.tencent.mobileqq.webview.swift.WebViewPluginSchemeConfig;
import com.tencent.qphone.base.util.QLog;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import mqq.manager.Manager;
import org.json.JSONArray;
import org.json.JSONObject;
public class URLInterceptManager implements Manager {
public static String f34281a = "URLInterceptManager";
public static int f94878a = -1;
public static int f94879b = 1;
public static int f94880c = 2;
public static int d = 3;
AtomicBoolean f34283a = new AtomicBoolean(false);
Map f34282a = new HashMap();
Map f34284b = new HashMap();
Map f34285c = new HashMap();
public URLInterceptManager(QQAppInterface qQAppInterface) {
}
public URLInterceptManager(Context context) {
ThreadManager.a(new vse(this, context), 8, null, true);
}
private void a(JSONObject jSONObject) {
if (jSONObject != null) {
try {
JSONArray jSONArray = jSONObject.has("urltoapi") ? jSONObject.getJSONArray("urltoapi") : null;
if (jSONArray != null) {
for (int i = 0; i < jSONArray.length(); i++) {
JSONObject jSONObject2 = jSONArray.getJSONObject(i);
if (jSONObject2 != null) {
String string = jSONObject2.has("url") ? jSONObject2.getString("url") : null;
if (string != null) {
String string2 = jSONObject2.has("api") ? jSONObject2.getString("api") : null;
if (!TextUtils.isEmpty(string2) && string2.startsWith(WebViewPluginSchemeConfig.f34715m)) {
int i2 = jSONObject2.has("match_type") ? jSONObject2.getInt("match_type") : f94878a;
if (i2 != f94878a) {
String string3 = jSONObject2.has("minVer") ? jSONObject2.getString("minVer") : null;
if (!TextUtils.isEmpty(string3)) {
String string4 = jSONObject2.has("maxVer") ? jSONObject2.getString("maxVer") : null;
if (!TextUtils.isEmpty(string4) && IndividuationConfigInfo.a(AppSetting.g, string4) && IndividuationConfigInfo.a(string3, AppSetting.g)) {
if (QLog.isColorLevel()) {
QLog.d(f34281a, 2, "Parse from Json: URL = " + string + " API = " + string2 + " type = " + i2);
}
if (i2 == f94879b) {
this.f34282a.put(string, string2);
} else if (i2 == f94880c) {
this.f34284b.put(string, string2);
} else if (i2 == d) {
this.f34285c.put(string, string2);
}
}
}
}
}
}
}
}
}
this.f34283a.set(true);
} catch (Exception e) {
QLog.e(f34281a, 1, "doParseJson fail: " + e.getMessage());
}
}
}
public void a(QQAppInterface qQAppInterface) {
a(ClubContentJsonTask.a(qQAppInterface, ClubContentJsonTask.l, true));
}
public void a(Context context) {
String str;
String str2 = ClubContentJsonTask.l.f94808b;
File file = new File(context.getFilesDir(), str2);
if (file.exists()) {
try {
str = FileUtils.a(file);
} catch (OutOfMemoryError e) {
if (QLog.isColorLevel()) {
QLog.e(f34281a, 2, "getJsonOOM,json_name:" + str2 + e.getMessage());
}
str = null;
}
if (str != null) {
try {
a(new JSONObject(str));
return;
} catch (Exception e2) {
QLog.e(f34281a, 1, "getJsonError,Exception:" + str2 + e2.getMessage());
return;
}
}
return;
}
QLog.w(f34281a, 1, "json file not exist");
}
public String a(String str) {
String substring;
int indexOf;
int i;
int indexOf2;
if (!this.f34283a.get()) {
if (QLog.isColorLevel()) {
QLog.e(f34281a, 2, "checkURL fail config not load");
}
return null;
} else if (TextUtils.isEmpty(str)) {
if (QLog.isColorLevel()) {
QLog.e(f34281a, 2, "checkURL url = null");
}
return null;
} else {
if (QLog.isColorLevel()) {
QLog.d(f34281a, 2, "checkURL original url = " + str);
}
if (str.contains("www.urlshare.cn/umirror_url_check") && (indexOf = str.indexOf("&url=")) > 0 && (indexOf2 = str.indexOf("&src_uin", (i = indexOf + 5))) > i) {
str = str.substring(i, indexOf2);
}
if (this.f34282a.containsKey(str)) {
if (QLog.isColorLevel()) {
QLog.d(f34281a, 2, "checkURL full match url=" + str + " Replace with: " + ((String) this.f34282a.get(str)));
}
return (String) this.f34282a.get(str);
}
int indexOf3 = str.indexOf("?");
int indexOf4 = str.indexOf("#");
int min = Math.min(indexOf3, indexOf4);
if (min > 0) {
substring = str.substring(0, min);
} else {
int max = Math.max(indexOf3, indexOf4);
substring = max > 0 ? str.substring(0, max) : str;
}
if (this.f34284b.containsKey(substring)) {
if (QLog.isColorLevel()) {
QLog.d(f34281a, 2, "checkURL without param match url=" + str + " Replace with: " + ((String) this.f34284b.get(substring)));
}
return (String) this.f34284b.get(substring);
}
if (this.f34285c.keySet().size() > 0) {
for (String str2 : this.f34285c.keySet()) {
if (str.startsWith(str2)) {
if (QLog.isColorLevel()) {
QLog.d(f34281a, 2, "checkURL part match url=" + str + " Replace with: " + ((String) this.f34285c.get(str)));
}
return (String) this.f34285c.get(str2);
}
}
}
if (QLog.isColorLevel()) {
QLog.d(f34281a, 2, "checkURL not match! url = " + str);
}
return null;
}
}
public boolean a(Intent intent, QQAppInterface qQAppInterface, Context context) {
JumpAction a2;
if (intent.getComponent() == null || !"com.tencent.mobileqq.activity.QQBrowserActivity".equals(intent.getComponent().getClassName())) {
return false;
}
if (!this.f34283a.get()) {
ThreadManager.a(new vsf(this, qQAppInterface), 8, null, true);
return false;
}
String a3 = a(intent.getStringExtra("url"));
if (TextUtils.isEmpty(a3) || (a2 = JumpParser.a(qQAppInterface, context, a3)) == null) {
return false;
}
a2.m9235b();
return true;
}
public boolean a(Intent intent, Activity activity) {
if (intent.getComponent() != null && "com.tencent.mobileqq.activity.QQBrowserActivity".equals(intent.getComponent().getClassName())) {
String a2 = a(intent.getStringExtra("url"));
if (!TextUtils.isEmpty(a2)) {
Intent intent2 = new Intent(activity, JumpActivity.class);
intent2.setData(Uri.parse(a2));
intent2.putExtra("from", "webview");
activity.startActivity(intent2);
return true;
}
}
return false;
}
@Override
public void onDestroy() {
}
}