GoooBet v1.0版本的 MD5 值为:ff9748f16167bfd7735b669c0a9931c5
以下内容为反编译后的 b.java 源代码,内容仅作参考
package com.truenet.android;
import a.a.b.b.h;
import a.a.b.b.i;
import a.a.b.b.l;
import a.a.b.b.m;
import a.a.b.b.n;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.appodeal.ads.utils.LogConstants;
import com.truenet.android.a.j;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpCookie;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.TimeUnit;
public final class b {
static final a.a.d.e[] f3933a = {n.a(new l(n.a(b.class), "queue", "getQueue()Ljava/util/concurrent/SynchronousQueue;")), n.a(new l(n.a(b.class), "webView", "getWebView()Landroid/webkit/WebView;"))};
public static final a b;
private static final String n;
private static final a.a.e.b o;
private Bitmap c;
private long d;
private String e;
private String f;
private final List<C0189b> g;
private final a.a.c h;
private final a.a.c i;
private final Context j;
private final String k;
private final int l;
private final long m;
public final SynchronousQueue<String> j() {
a.a.c cVar = this.h;
a.a.d.e eVar = f3933a[0];
return (SynchronousQueue) cVar.a();
}
public final WebView k() {
a.a.c cVar = this.i;
a.a.d.e eVar = f3933a[1];
return (WebView) cVar.a();
}
public b(Context context, String str, int i, long j) {
h.b(context, "context");
h.b(str, "url");
this.j = context;
this.k = str;
this.l = i;
this.m = j;
this.e = str;
this.g = new ArrayList();
this.h = a.a.d.a(f.f3938a);
this.i = a.a.d.a(new g());
}
public final Bitmap a() {
return this.c;
}
public final int b() {
return this.g.size();
}
public final long c() {
return this.d;
}
public final List<C0189b> d() {
return a.a.a.g.a((Iterable) this.g);
}
public final String e() {
return this.e;
}
public final String f() {
return this.f;
}
static final class f extends i implements a.a.b.a.a<SynchronousQueue<String>> {
public static final f f3938a = new f();
f() {
super(0);
}
@Override
public final SynchronousQueue<String> a() {
return new SynchronousQueue<>();
}
}
static final class g extends i implements a.a.b.a.a<WebView> {
g() {
super(0);
}
@Override
public final WebView a() {
try {
WebView webView = new WebView(b.this.j);
if (Build.VERSION.SDK_INT >= 11) {
webView.setLayerType(1, null);
}
WebSettings settings = webView.getSettings();
h.a((Object) settings, com.appnext.core.a.b.hW);
settings.setJavaScriptEnabled(true);
webView.setWebChromeClient(new WebChromeClient());
webView.setWebViewClient(new c());
return webView;
} catch (Exception e) {
Log.e(b.n, e.getMessage());
return null;
}
}
}
public static final class a {
private a() {
}
public a(a.a.b.b.e eVar) {
this();
}
public final boolean a(String str) {
return a.a.e.c.a(str, "http://play.google.com", false, 2, null) || a.a.e.c.a(str, "https://play.google.com", false, 2, null) || a.a.e.c.a(str, "http://itunes.apple.com", false, 2, null) || a.a.e.c.a(str, "https://itunes.apple.com", false, 2, null) || !(a.a.e.c.a(str, "http://", false, 2, null) || a.a.e.c.a(str, "https://", false, 2, null) || !b.o.a(str));
}
}
static {
a aVar = new a(null);
b = aVar;
n = aVar.getClass().getSimpleName();
o = new a.a.e.b("^\\w+(://){1}.+$");
}
public static final class C0189b {
private final String f3934a;
private final long b;
private final int c;
private final List<String> d;
private final String e;
public static C0189b a(C0189b c0189b, String str, long j, int i, List list, String str2, int i2, Object obj) {
if ((i2 & 1) != 0) {
str = c0189b.f3934a;
}
if ((i2 & 2) != 0) {
j = c0189b.b;
}
long j2 = j;
if ((i2 & 4) != 0) {
i = c0189b.c;
}
int i3 = i;
if ((i2 & 8) != 0) {
list = c0189b.d;
}
List list2 = list;
if ((i2 & 16) != 0) {
str2 = c0189b.e;
}
return c0189b.a(str, j2, i3, list2, str2);
}
public final C0189b a(String str, long j, int i, List<String> list, String str2) {
h.b(str, "url");
return new C0189b(str, j, i, list, str2);
}
public boolean equals(Object obj) {
if (this != obj) {
if (obj instanceof C0189b) {
C0189b c0189b = (C0189b) obj;
if (h.a((Object) this.f3934a, (Object) c0189b.f3934a)) {
if (this.b == c0189b.b) {
if (!(this.c == c0189b.c) || !h.a(this.d, c0189b.d) || !h.a((Object) this.e, (Object) c0189b.e)) {
}
}
}
}
return false;
}
return true;
}
public int hashCode() {
String str = this.f3934a;
int hashCode = str != null ? str.hashCode() : 0;
long j = this.b;
int i = ((((hashCode * 31) + ((int) (j ^ (j >>> 32)))) * 31) + this.c) * 31;
List<String> list = this.d;
int hashCode2 = (i + (list != null ? list.hashCode() : 0)) * 31;
String str2 = this.e;
return hashCode2 + (str2 != null ? str2.hashCode() : 0);
}
public String toString() {
return "ConnectionInfo(url=" + this.f3934a + ", loadTime=" + this.b + ", httpCode=" + this.c + ", cookie=" + this.d + ", redirectUrl=" + this.e + ")";
}
public C0189b(String str, long j, int i, List<String> list, String str2) {
h.b(str, "url");
this.f3934a = str;
this.b = j;
this.c = i;
this.d = list;
this.e = str2;
}
public final String a() {
return this.f3934a;
}
public final long b() {
return this.b;
}
public final int c() {
return this.c;
}
public final List<String> d() {
return this.d;
}
public final String e() {
return this.e;
}
}
static C0189b a(b bVar, String str, List list, int i, Object obj) {
if ((i & 2) != 0) {
list = (List) null;
}
return bVar.a(str, list);
}
private final C0189b a(String str, List<String> list) {
String str2;
this.f = (String) null;
if (b.a(str)) {
return new C0189b(str, 0L, 200, null, null);
}
try {
URL url = new URL(str);
URLConnection openConnection = url.openConnection();
if (openConnection == null) {
throw new a.a.h("null cannot be cast to non-null type java.net.HttpURLConnection");
}
HttpURLConnection httpURLConnection = (HttpURLConnection) openConnection;
httpURLConnection.setInstanceFollowRedirects(false);
httpURLConnection.setConnectTimeout(((int) this.m) * 1000);
httpURLConnection.setReadTimeout(((int) this.m) * 1000);
httpURLConnection.addRequestProperty("User-Agent", com.truenet.android.a.i.f3931a.a(this.j));
if (list != null) {
List<String> list2 = list;
ArrayList arrayList = new ArrayList(a.a.a.g.a(list2, 10));
Iterator<T> it = list2.iterator();
while (it.hasNext()) {
List<HttpCookie> parse = HttpCookie.parse((String) it.next());
h.a((Object) parse, "HttpCookie.parse(it)");
arrayList.add((HttpCookie) a.a.a.g.c(parse));
}
httpURLConnection.setRequestProperty("Cookie", TextUtils.join(r3, arrayList));
}
long currentTimeMillis = System.currentTimeMillis();
httpURLConnection.connect();
long currentTimeMillis2 = System.currentTimeMillis() - currentTimeMillis;
String headerField = httpURLConnection.getHeaderField(LogConstants.EVENT_LOCATION);
if (headerField != null) {
a.a.e.b bVar = o;
h.a((Object) headerField, "nextUrl");
if (!bVar.a(headerField)) {
StringBuilder sb = new StringBuilder();
sb.append(url.getProtocol());
sb.append("://");
sb.append(url.getHost());
h.a((Object) headerField, "nextUrl");
if (!a.a.e.c.a(headerField, "/", false, 2, null)) {
headerField = '/' + headerField;
}
sb.append(headerField);
headerField = sb.toString();
}
str2 = headerField;
} else {
str2 = null;
}
C0189b c0189b = new C0189b(str, currentTimeMillis2, httpURLConnection.getResponseCode(), httpURLConnection.getHeaderFields().get("Set-Cookie"), str2);
int responseCode = httpURLConnection.getResponseCode();
if (200 <= responseCode && 299 >= responseCode) {
InputStream inputStream = httpURLConnection.getInputStream();
h.a((Object) inputStream, "inputStream");
this.f = a(inputStream);
long currentTimeMillis3 = System.currentTimeMillis() - currentTimeMillis;
new Handler(Looper.getMainLooper()).post(new e(httpURLConnection, this, list, url, str));
String take = j().take();
h.a((Object) take, "jsRedirectUrl");
if (take.length() == 0) {
return C0189b.a(c0189b, null, currentTimeMillis3, 0, null, null, 29, null);
}
return C0189b.a(c0189b, null, currentTimeMillis3, 0, null, take, 13, null);
}
if (300 <= responseCode && 399 >= responseCode) {
return c0189b;
}
return C0189b.a(c0189b, null, 0L, 0, null, null, 15, null);
} catch (Throwable unused) {
return null;
}
}
public static final class e implements Runnable {
final HttpURLConnection f3937a;
final b b;
final List c;
final URL d;
final String e;
e(HttpURLConnection httpURLConnection, b bVar, List list, URL url, String str) {
this.f3937a = httpURLConnection;
this.b = bVar;
this.c = list;
this.d = url;
this.e = str;
}
@Override
public final void run() {
WebView k = this.b.k();
if (k != null) {
k.loadDataWithBaseURL(this.e, this.b.f(), this.f3937a.getContentType(), this.f3937a.getContentEncoding(), null);
}
}
}
private final String a(InputStream inputStream) {
BufferedInputStream bufferedInputStream = (BufferedInputStream) null;
m.a aVar = new m.a();
aVar.element = (BufferedReader) 0;
try {
StringBuilder sb = new StringBuilder();
BufferedInputStream bufferedInputStream2 = new BufferedInputStream(inputStream);
try {
aVar.element = new BufferedReader(new InputStreamReader(bufferedInputStream2));
m.a aVar2 = new m.a();
aVar2.element = (String) 0;
while (new d(aVar2, aVar).a() != null) {
sb.append((String) aVar2.element);
}
String sb2 = sb.toString();
h.a((Object) sb2, "result.toString()");
try {
BufferedReader bufferedReader = (BufferedReader) aVar.element;
if (bufferedReader != null) {
bufferedReader.close();
}
bufferedInputStream2.close();
} catch (Throwable th) {
Log.e(getClass().getCanonicalName(), "stream closed with error!", th);
}
return sb2;
} catch (Throwable th2) {
th = th2;
bufferedInputStream = bufferedInputStream2;
try {
BufferedReader bufferedReader2 = (BufferedReader) aVar.element;
if (bufferedReader2 != null) {
bufferedReader2.close();
}
if (bufferedInputStream != null) {
bufferedInputStream.close();
}
} catch (Throwable th3) {
Log.e(getClass().getCanonicalName(), "stream closed with error!", th3);
}
throw th;
}
} catch (Throwable th4) {
th = th4;
}
}
public static final class d extends i implements a.a.b.a.a<String> {
final m.a $line;
final m.a $reader;
d(m.a aVar, m.a aVar2) {
super(0);
this.$line = aVar;
this.$reader = aVar2;
}
@Override
public final String a() {
this.$line.element = ((BufferedReader) this.$reader.element).readLine();
return (String) this.$line.element;
}
}
public final void g() {
int c2;
long currentTimeMillis = System.currentTimeMillis();
C0189b a2 = a(this, this.k, null, 2, null);
if (a2 != null) {
this.g.add(a2);
while (true) {
if ((a2 != null ? a2.e() : null) == null || !a(currentTimeMillis)) {
break;
}
String e2 = a2.e();
if (e2 == null) {
h.a();
}
a2 = a(e2, a2.d());
if (a2 != null) {
this.g.add(a2);
}
}
if (a2 != null && 200 <= (c2 = a2.c()) && 299 >= c2 && this.f != null) {
WebView k = k();
this.c = k != null ? j.a(k) : null;
}
long j = 0;
Iterator<T> it = this.g.iterator();
while (it.hasNext()) {
j += ((C0189b) it.next()).b();
}
this.d = j;
this.e = ((C0189b) a.a.a.g.e(this.g)).a();
}
if (this.g.isEmpty()) {
this.d = System.currentTimeMillis() - currentTimeMillis;
}
}
private final boolean a(long j) {
int size = this.g.size();
int i = this.l;
return (size < i || i == -1) && System.currentTimeMillis() - j < this.m * ((long) 1000);
}
public final class c extends WebViewClient {
private ScheduledExecutorService b = Executors.newScheduledThreadPool(1);
private ScheduledFuture<?> c;
public c() {
}
private final void a(WebView webView, String str) {
a();
if (str != null) {
if (webView != null) {
webView.stopLoading();
}
b.this.j().offer(str);
}
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, WebResourceRequest webResourceRequest) {
a(webView, String.valueOf(webResourceRequest != null ? webResourceRequest.getUrl() : null));
return true;
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
a(webView, str);
return true;
}
@Override
public void onPageFinished(WebView webView, String str) {
a();
this.c = this.b.schedule(new a(), 1L, TimeUnit.SECONDS);
super.onPageFinished(webView, str);
}
static final class a implements Runnable {
a() {
}
@Override
public final void run() {
b.this.j().offer("");
}
}
@Override
public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
a();
if (webView != null) {
webView.stopLoading();
}
b.this.j().offer("");
super.onReceivedError(webView, webResourceRequest, webResourceError);
}
private final void a() {
ScheduledFuture<?> scheduledFuture = this.c;
if (scheduledFuture != null) {
scheduledFuture.cancel(false);
}
this.c = (ScheduledFuture) null;
}
}
}