导航菜单

页面标题

页面副标题

Hopscotch v9.7.2 - k.java 源代码

正在查看: Hopscotch v9.7.2 应用的 k.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.clevertap.android.pushtemplates;

import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.ResolveInfo;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.service.notification.StatusBarNotification;
import android.widget.RemoteViews;
import androidx.core.content.a;
import com.clevertap.android.sdk.CleverTapInstanceConfig;
import com.clevertap.android.sdk.bitmap.h;
import com.clevertap.android.sdk.network.e;
import com.clevertap.android.sdk.u;
import com.clevertap.android.sdk.y0;
import com.facebook.common.util.UriUtil;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import org.json.JSONArray;
import org.json.JSONObject;

public final class k {
    public static HashMap<String, Object> a(Bundle bundle) {
        bundle.remove("config");
        HashMap<String, Object> hashMap = new HashMap<>();
        for (String str : bundle.keySet()) {
            if (str.contains("wzrk_") || str.equals("pt_id")) {
                Object obj = bundle.get(str);
                if (obj instanceof Bundle) {
                    hashMap.putAll(a((Bundle) obj));
                } else {
                    hashMap.put(str, bundle.get(str));
                }
            }
        }
        return hashMap;
    }

    public static void b(Context context, Intent intent) {
        String stringExtra = intent.getStringExtra("wzrk_pid");
        File dir = new ContextWrapper(context.getApplicationContext()).getDir("pt_dir", 0);
        String absolutePath = dir.getAbsolutePath();
        String[] list = dir.list();
        if (list != null) {
            for (String str : list) {
                if (stringExtra == null || !str.contains(stringExtra)) {
                    if (stringExtra == null && str.contains("null") && !new File(android.support.v4.media.a.k(absolutePath, "/", str)).delete()) {
                        b.a("Failed to clean up the following file: ".concat(str));
                    }
                } else if (!new File(android.support.v4.media.a.k(absolutePath, "/", str)).delete()) {
                    b.a("Failed to clean up the following file: ".concat(str));
                }
            }
        }
    }

    public static void c(Context context) {
        int i;
        NotificationManager notificationManager = (NotificationManager) context.getSystemService("notification");
        if (notificationManager == null || (i = Build.VERSION.SDK_INT) < 26 || notificationManager.getNotificationChannel("pt_silent_sound_channel") == null) {
            return;
        }
        NotificationChannel notificationChannel = notificationManager.getNotificationChannel("pt_silent_sound_channel");
        if (i < 26 || notificationChannel == null || notificationChannel.getImportance() == 0) {
            return;
        }
        notificationManager.deleteNotificationChannel("pt_silent_sound_channel");
    }

    public static Bundle d(JSONObject jSONObject) {
        Bundle bundle = new Bundle();
        Iterator<String> keys = jSONObject.keys();
        while (keys.hasNext()) {
            String next = keys.next();
            JSONArray optJSONArray = jSONObject.optJSONArray(next);
            String optString = jSONObject.optString(next);
            if (optJSONArray != null && optJSONArray.length() <= 0) {
                bundle.putStringArray(next, new String[0]);
            } else if (optJSONArray != null && optJSONArray.optString(0) != null) {
                String[] strArr = new String[optJSONArray.length()];
                for (int i = 0; i < optJSONArray.length(); i++) {
                    strArr[i] = optJSONArray.optString(i);
                }
                bundle.putStringArray(next, strArr);
            } else if (optString != null) {
                bundle.putString(next, optString);
            } else {
                System.err.println("unable to transform json to bundle " + next);
            }
        }
        return bundle;
    }

    public static String e(Context context) {
        ApplicationInfo applicationInfo = context.getApplicationInfo();
        int i = applicationInfo.labelRes;
        return i == 0 ? applicationInfo.nonLocalizedLabel.toString() : context.getString(i);
    }

    public static ArrayList<String> f(Bundle bundle) {
        ArrayList<String> arrayList = new ArrayList<>();
        for (String str : bundle.keySet()) {
            if (str.contains("pt_bt")) {
                arrayList.add(bundle.getString(str));
            }
        }
        return arrayList;
    }

    public static Bitmap g(Context context, String str) {
        com.clevertap.android.sdk.network.e a = com.clevertap.android.sdk.bitmap.h.a(h.a.DOWNLOAD_ANY_BITMAP, new com.clevertap.android.sdk.bitmap.a(str, false, context, null, -1L, -1));
        if (a.d() == e.a.SUCCESS) {
            return a.a();
        }
        StringBuilder l = androidx.privacysandbox.ads.adservices.java.internal.a.l("network call for bitmap download failed with url : ", str, " http status: ");
        l.append(a.d());
        y0.j(l.toString());
        return null;
    }

    public static int h(String str, String str2) {
        try {
            return Color.parseColor(str);
        } catch (Exception unused) {
            b.a("Can not parse colour value: " + str + " Switching to default colour: " + str2);
            return Color.parseColor(str2);
        }
    }

    public static ArrayList<String> i(Bundle bundle) {
        ArrayList<String> arrayList = new ArrayList<>();
        for (String str : bundle.keySet()) {
            if (str.contains("pt_dl")) {
                arrayList.add(bundle.getString(str));
            }
        }
        return arrayList;
    }

    public static String j(Bundle bundle) {
        String str = null;
        for (String str2 : bundle.keySet()) {
            if (str2.contains("pt_event_name")) {
                str = bundle.getString(str2);
            }
        }
        return str;
    }

    public static ArrayList<String> k(Bundle bundle) {
        ArrayList<String> arrayList = new ArrayList<>();
        for (String str : bundle.keySet()) {
            if (str.contains("pt_img")) {
                arrayList.add(bundle.getString(str));
            }
        }
        return arrayList;
    }

    public static Bitmap l(Context context, String str) throws NullPointerException {
        if (str == null || str.equals("")) {
            return null;
        }
        if (!str.startsWith(UriUtil.HTTP_SCHEME)) {
            str = "http://static.wizrocket.com/android/ico//".concat(str);
        }
        Bitmap g = g(context, str);
        if (g != null) {
            return g;
        }
        return null;
    }

    public static Notification m(int i, Context context) {
        for (StatusBarNotification statusBarNotification : ((NotificationManager) context.getSystemService("notification")).getActiveNotifications()) {
            if (statusBarNotification.getId() == i) {
                return statusBarNotification.getNotification();
            }
        }
        return null;
    }

    public static ArrayList<String> n(Bundle bundle) {
        ArrayList<String> arrayList = new ArrayList<>();
        for (String str : bundle.keySet()) {
            if (str.contains("pt_price") && !str.contains("pt_price_list")) {
                arrayList.add(bundle.getString(str));
            }
        }
        return arrayList;
    }

    public static ArrayList<String> o(Bundle bundle) {
        ArrayList<String> arrayList = new ArrayList<>();
        for (String str : bundle.keySet()) {
            if (str.contains("pt_st")) {
                arrayList.add(bundle.getString(str));
            }
        }
        return arrayList;
    }

    public static void p(int i, String str, RemoteViews remoteViews, Context context) {
        long currentTimeMillis = System.currentTimeMillis();
        Bitmap g = g(context, str);
        a.a = false;
        if (g == null) {
            b.a("Image was not perfect. URL:" + str + " hiding image view");
            a.a = true;
            return;
        }
        remoteViews.setImageViewBitmap(i, g);
        b.b("Fetched IMAGE " + str + " in " + (System.currentTimeMillis() - currentTimeMillis) + " millis");
    }

    public static void q(Context context, CleverTapInstanceConfig cleverTapInstanceConfig, HashMap hashMap) {
        u G = cleverTapInstanceConfig != null ? u.G(context, cleverTapInstanceConfig, null) : u.v(context, null);
        if (G != null) {
            G.R("Rating Submitted", hashMap);
        } else {
            b.a("CleverTap instance is NULL, not raising the event");
        }
    }

    public static Bitmap r(Context context, int i, String str) throws NullPointerException {
        if (str == null || str.isEmpty()) {
            return null;
        }
        int h = h(str, "#A6A6A6");
        Drawable b = a.C0052a.b(context, i);
        Objects.requireNonNull(b);
        Drawable mutate = b.mutate();
        mutate.setColorFilter(new PorterDuffColorFilter(h, PorterDuff.Mode.SRC_IN));
        Bitmap createBitmap = Bitmap.createBitmap(mutate.getIntrinsicWidth(), mutate.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(createBitmap);
        mutate.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
        mutate.draw(canvas);
        return createBitmap;
    }

    public static void s(Context context, Intent intent) {
        List<ResolveInfo> queryIntentActivities = context.getPackageManager().queryIntentActivities(intent, 0);
        String packageName = context.getPackageName();
        Iterator<ResolveInfo> it = queryIntentActivities.iterator();
        while (it.hasNext()) {
            if (packageName.equals(it.next().activityInfo.packageName)) {
                intent.setPackage(packageName);
                return;
            }
        }
    }
}