Perfume Of Love v2.14.9版本的 MD5 值为:16011aefc5a55805771706ce3b259b4e

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


package com.chartboost.sdk.impl;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Handler;
import androidx.webkit.ProxyConfig;
import com.chartboost.sdk.impl.n1;
import com.chartboost.sdk.internal.Model.CBError;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.concurrent.Executor;
import javax.net.ssl.HttpsURLConnection;
public class n1 {
    public final Executor a;
    public final g1 b;
    public final h1 c;
    public final Handler d;

    public n1(Executor executor, g1 g1Var, h1 h1Var, Handler handler) {
        this.a = executor;
        this.b = g1Var;
        this.c = h1Var;
        this.d = handler;
    }

    public void a(com.chartboost.sdk.internal.Model.a aVar, boolean z, String str, CBError.CBClickError cBClickError) {
        if (aVar == null) {
            s3.b("CBURLOpener", "Impression is null on urlOpenAttempted");
            return;
        }
        aVar.H = false;
        if (aVar.G()) {
            aVar.b = l3.DISMISSING;
        }
        if (!z) {
            aVar.a(str, cBClickError);
            return;
        }
        aVar.a();
        i1 i1Var = aVar.y;
        if (i1Var != null) {
            this.b.a(i1Var);
        }
    }

    public void b(Context context, com.chartboost.sdk.internal.Model.a aVar, String str) {
        try {
            String scheme = new URI(str).getScheme();
            if (scheme == null) {
                a(aVar, false, str, CBError.CBClickError.URI_INVALID);
            } else if (!scheme.equals(ProxyConfig.MATCH_HTTP) && !scheme.equals("https")) {
                c(context, aVar, str);
            } else {
                this.a.execute(new a(str, context, aVar));
            }
        } catch (URISyntaxException unused) {
            a(aVar, false, str, CBError.CBClickError.URI_INVALID);
        }
    }

    public void c(Context context, com.chartboost.sdk.internal.Model.a aVar, String str) {
        if (aVar != null && aVar.G()) {
            aVar.b = l3.NONE;
        }
        if (context == null) {
            a(aVar, false, str, CBError.CBClickError.NO_HOST_ACTIVITY);
            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);
        } catch (Exception unused) {
            if (str.startsWith("market://")) {
                try {
                    str = "https://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);
                } catch (Exception e) {
                    s3.a("CBURLOpener", "Exception raised openeing an inavld playstore URL", e);
                    a(aVar, false, str, CBError.CBClickError.URI_UNRECOGNIZED);
                    return;
                }
            } else {
                a(aVar, false, str, CBError.CBClickError.URI_UNRECOGNIZED);
                return;
            }
        }
        a(aVar, true, str, null);
    }

    public class a implements Runnable {
        public final String a;
        public final Context b;
        public final com.chartboost.sdk.internal.Model.a c;

        public a(String str, Context context, com.chartboost.sdk.internal.Model.a aVar) {
            this.a = str;
            this.b = context;
            this.c = aVar;
        }

        public final void a(final String str) {
            final Context context = this.b;
            final com.chartboost.sdk.internal.Model.a aVar = this.c;
            n1.this.d.post(new Runnable() {
                @Override
                public final void run() {
                    n1.a.this.a(context, aVar, str);
                }
            });
        }

        @Override
        public void run() {
            HttpsURLConnection httpsURLConnection;
            Exception e;
            try {
                String str = this.a;
                if (n1.this.c.e()) {
                    HttpsURLConnection httpsURLConnection2 = null;
                    try {
                        httpsURLConnection = (HttpsURLConnection) new URL(this.a).openConnection();
                        try {
                            try {
                                httpsURLConnection.setSSLSocketFactory(j1.a());
                                httpsURLConnection.setInstanceFollowRedirects(false);
                                httpsURLConnection.setConnectTimeout(10000);
                                httpsURLConnection.setReadTimeout(10000);
                                String headerField = httpsURLConnection.getHeaderField("Location");
                                if (headerField != null) {
                                    str = headerField;
                                }
                            } catch (Exception e2) {
                                e = e2;
                                s3.a("CBURLOpener", "Exception raised while opening a HTTPS Connection", e);
                            }
                        } catch (Throwable th) {
                            th = th;
                            httpsURLConnection2 = httpsURLConnection;
                            if (httpsURLConnection2 != null) {
                                httpsURLConnection2.disconnect();
                            }
                            throw th;
                        }
                    } catch (Exception e3) {
                        httpsURLConnection = null;
                        e = e3;
                    } catch (Throwable th2) {
                        th = th2;
                        if (httpsURLConnection2 != null) {
                        }
                        throw th;
                    }
                    httpsURLConnection.disconnect();
                }
                a(str);
            } catch (Exception e4) {
                s3.b("CBURLOpener", "open followTask: " + e4);
            }
        }

        public void a(Context context, com.chartboost.sdk.internal.Model.a aVar, String str) {
            try {
                n1.this.c(context, aVar, str);
            } catch (Exception e) {
                s3.b("CBURLOpener", "open openOnUiThread Runnable.run: " + e);
            }
        }
    }

    public boolean a(Context context, String str) {
        try {
            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) {
            s3.a("CBURLOpener", "Cannot open URL", e);
            return false;
        }
    }

    public void a(Context context, com.chartboost.sdk.internal.Model.a aVar, String str) {
        b(context, aVar, str);
    }
}