Snaptube v4.40.0.4401610版本的 MD5 值为:ca2b95dcff63007195db02a6c93091b9

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


package o;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.support.v4.content.LocalBroadcastManager;
import android.text.TextUtils;
import com.facebook.ads.InterstitialAd;
import com.facebook.ads.NativeAd;
import com.facebook.ads.internal.DisplayAdController;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import net.pubnative.mediation.broadcast.MediationEventBus;
public final class avx {
    public static boolean m15636(Context context, Object obj, String str) {
        return m15637(context, obj, str, "impression");
    }

    public static boolean m15639(Context context, Object obj, String str) {
        return m15637(context, obj, str, "click");
    }

    private static boolean m15637(Context context, Object obj, String str, String str2) {
        String str3;
        Map<String, String> map = null;
        if (context == null || obj == null) {
            return false;
        }
        if (TextUtils.equals(str2, "impression")) {
            str3 = "http://analytics.snappea.com/facebook/ad/impression";
        } else {
            str3 = TextUtils.equals(str2, "click") ? "http://analytics.snappea.com/facebook/ad/click" : null;
        }
        if (TextUtils.isEmpty(str3)) {
            return false;
        }
        if (obj instanceof NativeAd) {
            map = m15634((NativeAd) obj);
        } else if (obj instanceof InterstitialAd) {
            map = m15633((InterstitialAd) obj);
        }
        if (map == null || TextUtils.isEmpty(map.get("placement_id"))) {
            return false;
        }
        map.put("action", str2);
        map.put("ad_pos", str);
        Uri.Builder buildUpon = Uri.parse(str3).buildUpon();
        for (Map.Entry<String, String> entry : map.entrySet()) {
            buildUpon.appendQueryParameter(entry.getKey(), entry.getValue());
        }
        return LocalBroadcastManager.getInstance(context).sendBroadcast(new Intent("com.snaptube.premium.ad.analytics.REPORT").putExtra("com.snaptube.premium.ad.analytics.extra.URL", buildUpon.build().toString()));
    }

    private static Map<String, String> m15634(NativeAd nativeAd) {
        HashMap hashMap = new HashMap();
        if (nativeAd == null) {
            return hashMap;
        }
        hashMap.put(MediationEventBus.PARAM_PROVIDER, "facebook");
        hashMap.put("placement_id", (String) m15632(nativeAd, "f", String.class));
        com.facebook.ads.internal.adapters.l lVar = (com.facebook.ads.internal.adapters.l) m15632(m15632(nativeAd, "j", DisplayAdController.class), "o", com.facebook.ads.internal.adapters.l.class);
        if (lVar != null) {
            hashMap.put("title", (String) m15632(lVar, "e", String.class));
            m15635((Uri) m15632(lVar, "d", Uri.class), hashMap);
        }
        return hashMap;
    }

    private static Map<String, String> m15633(InterstitialAd interstitialAd) {
        HashMap hashMap = new HashMap();
        if (interstitialAd == null) {
            return hashMap;
        }
        hashMap.put(MediationEventBus.PARAM_PROVIDER, "facebook");
        hashMap.put("placement_id", (String) m15632(interstitialAd, "c", String.class));
        String str = (String) m15632((com.facebook.ads.internal.adapters.o) m15632(m15632(m15632(interstitialAd, "d", DisplayAdController.class), "o", com.facebook.ads.internal.adapters.j.class), "g", com.facebook.ads.internal.adapters.o.class), "a", String.class);
        hashMap.put("title", m15638(str));
        m15635(m15631(str), hashMap);
        return hashMap;
    }

    private static void m15635(Uri uri, Map<String, String> map) {
        if (uri != null && map != null) {
            map.put("store_id", uri.getQueryParameter("store_id"));
            map.put("link", uri.getQueryParameter("link"));
        }
    }

    private static Object m15632(Object obj, String str, Class cls) {
        if (obj == null || str == null || cls == null) {
            return null;
        }
        try {
            Field declaredField = obj.getClass().getDeclaredField(str);
            declaredField.setAccessible(true);
            Object obj2 = declaredField.get(obj);
            if (declaredField.getType().equals(cls) || obj2.getClass().equals(cls)) {
                return declaredField.get(obj);
            }
            throw new Exception("Field " + str + " type is " + declaredField.getType() + ", but the type expected is " + cls);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
            return null;
        } catch (NoSuchFieldException e2) {
            e2.printStackTrace();
            return null;
        } catch (Throwable th) {
            th.printStackTrace();
            return null;
        }
    }

    private static Uri m15631(String str) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        int i = 0;
        do {
            i = str.indexOf("href=\"fbad://", i);
            if (i >= 0) {
                i += "href=\"".length();
                String substring = str.substring(i, Math.min(i + 20, str.length()));
                if (substring.startsWith("fbad://open_link") || substring.startsWith("fbad://store")) {
                    int indexOf = str.indexOf(34, i);
                    if (indexOf < 0) {
                        return null;
                    }
                    return Uri.parse(str.substring(i, indexOf));
                }
            }
        } while (i >= 0);
        return null;
    }

    private static String m15638(String str) {
        int indexOf;
        int length;
        int indexOf2;
        if (!TextUtils.isEmpty(str) && (indexOf = str.indexOf("<div class=\"title\">")) >= 0 && (indexOf2 = str.indexOf("</div>", (length = indexOf + "<div class=\"title\">".length()))) >= 0) {
            return str.substring(length, indexOf2);
        }
        return null;
    }
}