Life Simulator: Game Dev v0.6版本的 MD5 值为:ecca8c682c00d3b861fbed7f58e41c8d

以下内容为反编译后的 al.java 源代码,内容仅作参考


package com.chartboost.sdk.impl;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import com.chartboost.sdk.Libraries.CBLogging;
import com.chartboost.sdk.Libraries.CBUtility;
import com.chartboost.sdk.Model.CBError;
import com.chartboost.sdk.Model.a;
import com.chartboost.sdk.c;
import com.mopub.common.Constants;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;

public class al {
    final ai a;
    private final a b;
    private com.chartboost.sdk.Model.a c;

    public interface a {
        void a(com.chartboost.sdk.Model.a aVar, boolean z, String str, CBError.CBClickError cBClickError, c.a aVar2);
    }

    public al(a aVar, ai aiVar) {
        this.a = aiVar;
        this.b = aVar;
    }

    public a a() {
        return this.b;
    }

    public void a(com.chartboost.sdk.Model.a aVar, final String str, final Activity activity, final c.a aVar2) {
        this.c = aVar;
        try {
            String scheme = new URI(str).getScheme();
            if (scheme == null) {
                if (this.b != null) {
                    this.b.a(aVar, false, str, CBError.CBClickError.URI_INVALID, aVar2);
                }
            } else if (!scheme.equals(Constants.HTTP) && !scheme.equals(Constants.HTTPS)) {
                a(str, activity, aVar2);
            } else {
                aa.a().execute(new Runnable() {
                    @Override
                    public void run() {
                        String str2;
                        HttpURLConnection httpURLConnection;
                        try {
                            String str3 = str;
                            if (al.this.a.b()) {
                                HttpURLConnection httpURLConnection2 = null;
                                try {
                                    try {
                                        httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
                                    } catch (Exception e) {
                                        e = e;
                                    }
                                } catch (Throwable th) {
                                    th = th;
                                }
                                try {
                                    httpURLConnection.setInstanceFollowRedirects(false);
                                    httpURLConnection.setConnectTimeout(10000);
                                    httpURLConnection.setReadTimeout(10000);
                                    String headerField = httpURLConnection.getHeaderField("Location");
                                    if (headerField == null) {
                                        headerField = str3;
                                    }
                                    if (httpURLConnection != null) {
                                        httpURLConnection.disconnect();
                                        str2 = headerField;
                                    } else {
                                        str2 = headerField;
                                    }
                                } catch (Exception e2) {
                                    httpURLConnection2 = httpURLConnection;
                                    e = e2;
                                    CBLogging.b("CBURLOpener", "Exception raised while opening a HTTP Conection", e);
                                    if (httpURLConnection2 != null) {
                                        httpURLConnection2.disconnect();
                                        str2 = str3;
                                        a(str2);
                                    }
                                    str2 = str3;
                                    a(str2);
                                } catch (Throwable th2) {
                                    httpURLConnection2 = httpURLConnection;
                                    th = th2;
                                    if (httpURLConnection2 != null) {
                                        httpURLConnection2.disconnect();
                                    }
                                    throw th;
                                }
                                a(str2);
                            }
                            str2 = str3;
                            a(str2);
                        } catch (Exception e3) {
                            com.chartboost.sdk.Tracking.a.a(al.class, "open followTask", e3);
                        }
                    }

                    public void a(final String str2) {
                        Runnable runnable = new Runnable() {
                            @Override
                            public void run() {
                                try {
                                    al.this.a(str2, activity, aVar2);
                                } catch (Exception e) {
                                    com.chartboost.sdk.Tracking.a.a(al.class, "open openOnUiThread Runnable.run", e);
                                }
                            }
                        };
                        if (activity != null) {
                            activity.runOnUiThread(runnable);
                        } else {
                            CBUtility.c().post(runnable);
                        }
                    }
                });
            }
        } catch (URISyntaxException e) {
            if (this.b != null) {
                this.b.a(aVar, false, str, CBError.CBClickError.URI_INVALID, aVar2);
            }
        }
    }

    void a(String str, Context context, c.a aVar) {
        String str2;
        if (this.c != null && this.c.a()) {
            this.c.d = a.e.NONE;
        }
        if (context == null) {
            context = com.chartboost.sdk.i.m;
        }
        if (context == null) {
            if (this.b != null) {
                this.b.a(this.c, false, str, CBError.CBClickError.NO_HOST_ACTIVITY, aVar);
                return;
            }
            return;
        }
        try {
            Intent intent = new Intent("android.intent.action.VIEW");
            if (!(context instanceof Activity)) {
                intent.addFlags(268435456);
            }
            intent.setData(Uri.parse(str));
            context.startActivity(intent);
            str2 = str;
        } catch (Exception e) {
            if (str.startsWith("market://")) {
                try {
                    str = "http://market.android.com/" + str.substring(9);
                    Intent intent2 = new Intent("android.intent.action.VIEW");
                    if (!(context instanceof Activity)) {
                        intent2.addFlags(268435456);
                    }
                    intent2.setData(Uri.parse(str));
                    context.startActivity(intent2);
                    str2 = str;
                } catch (Exception e2) {
                    String str3 = str;
                    CBLogging.b("CBURLOpener", "Exception raised openeing an inavld playstore URL", e2);
                    if (this.b != null) {
                        this.b.a(this.c, false, str3, CBError.CBClickError.URI_UNRECOGNIZED, aVar);
                        return;
                    }
                    return;
                }
            } else {
                if (this.b != null) {
                    this.b.a(this.c, false, str, CBError.CBClickError.URI_UNRECOGNIZED, aVar);
                }
                str2 = str;
            }
        }
        if (this.b != null) {
            this.b.a(this.c, true, str2, null, aVar);
        }
    }

    public static boolean a(String str) {
        try {
            Context context = com.chartboost.sdk.i.m;
            Intent intent = new Intent("android.intent.action.VIEW");
            if (!(context instanceof Activity)) {
                intent.addFlags(268435456);
            }
            intent.setData(Uri.parse(str));
            return context.getPackageManager().queryIntentActivities(intent, 65536).size() > 0;
        } catch (Exception e) {
            CBLogging.b("CBURLOpener", "Cannot open URL", e);
            com.chartboost.sdk.Tracking.a.a(al.class, "canOpenURL", e);
            return false;
        }
    }
}