导航菜单

页面标题

页面副标题

Chaupal v3.2 - c.java 源代码

正在查看: Chaupal v3.2 应用的 c.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.media.AudioAttributes;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.service.notification.StatusBarNotification;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.widget.RemoteViews;
import android.widget.Toast;
import com.clevertap.android.sdk.CleverTapAPI;
import com.clevertap.android.sdk.CleverTapInstanceConfig;
import com.connectsdk.service.DeviceService;
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 java.util.concurrent.Callable;
import org.json.JSONArray;
import org.json.JSONObject;

public class c {

    class a implements Callable<Void> {

        final String f8065a;

        final Context f8066c;

        a(String str, Context context) {
            this.f8065a = str;
            this.f8066c = context;
        }

        @Override
        public Void call() {
            if (TextUtils.isEmpty(this.f8065a)) {
                return null;
            }
            Toast.makeText(this.f8066c, this.f8065a, 0).show();
            return null;
        }
    }

    static ArrayList<String> A(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 String B(Context context) {
        return DateUtils.formatDateTime(context, System.currentTimeMillis(), 1);
    }

    public static int C(Bundle bundle) {
        String str = "-1";
        for (String str2 : bundle.keySet()) {
            if (str2.contains("pt_timer_end")) {
                str = bundle.getString(str2);
            }
        }
        if (str.contains("$D_")) {
            str = str.split("\\$D_")[1];
        }
        int parseLong = (int) (Long.parseLong(str) - (System.currentTimeMillis() / 1000));
        if (str.equals("-1")) {
            return Integer.MIN_VALUE;
        }
        return parseLong;
    }

    static int D(Bundle bundle) {
        String str = "-1";
        for (String str2 : bundle.keySet()) {
            if (str2.contains("pt_timer_threshold")) {
                str = bundle.getString(str2);
            }
        }
        return Integer.parseInt(str != null ? str : "-1");
    }

    static boolean E(NotificationChannel notificationChannel) {
        return (Build.VERSION.SDK_INT < 26 || notificationChannel == null || notificationChannel.getImportance() == 0) ? false : true;
    }

    public static boolean F(Context context, int i7) {
        for (StatusBarNotification statusBarNotification : ((NotificationManager) context.getSystemService("notification")).getActiveNotifications()) {
            if (statusBarNotification.getId() == i7) {
                return true;
            }
        }
        return false;
    }

    public static void G(int i7, Bitmap bitmap, RemoteViews remoteViews) {
        remoteViews.setImageViewBitmap(i7, bitmap);
    }

    public static void H(int i7, int i8, RemoteViews remoteViews) {
        remoteViews.setImageViewResource(i7, i8);
    }

    public static void I(int i7, String str, RemoteViews remoteViews, Context context) {
        long currentTimeMillis = System.currentTimeMillis();
        Bitmap n7 = n(str, context);
        O(Boolean.FALSE);
        if (n7 == null) {
            com.clevertap.android.pushtemplates.a.a("Image was not perfect. URL:" + str + " hiding image view");
            O(Boolean.TRUE);
            return;
        }
        remoteViews.setImageViewBitmap(i7, n7);
        com.clevertap.android.pushtemplates.a.c("Fetched IMAGE " + str + " in " + (System.currentTimeMillis() - currentTimeMillis) + " millis");
    }

    static void J(Context context, CleverTapInstanceConfig cleverTapInstanceConfig, Bundle bundle) {
        CleverTapAPI V = cleverTapInstanceConfig != null ? CleverTapAPI.V(context, cleverTapInstanceConfig) : CleverTapAPI.H(context);
        HashMap<String, Object> r7 = r(bundle);
        String q7 = q(bundle);
        if (q7 == null || q7.isEmpty()) {
            return;
        }
        if (V != null) {
            V.w0(q7, r7);
        } else {
            com.clevertap.android.pushtemplates.a.a("CleverTap instance is NULL, not raising the event");
        }
    }

    static void K(Context context, CleverTapInstanceConfig cleverTapInstanceConfig, Bundle bundle, String str) {
        CleverTapAPI V = cleverTapInstanceConfig != null ? CleverTapAPI.V(context, cleverTapInstanceConfig) : CleverTapAPI.H(context);
        HashMap<String, Object> s7 = s(bundle, str, bundle.getString(str));
        String q7 = q(bundle);
        if (q7 == null || q7.isEmpty()) {
            return;
        }
        if (V != null) {
            V.w0(q7, s7);
        } else {
            com.clevertap.android.pushtemplates.a.a("CleverTap instance is NULL, not raising the event");
        }
    }

    static void L(Context context, CleverTapInstanceConfig cleverTapInstanceConfig, String str, HashMap<String, Object> hashMap) {
        CleverTapAPI V = cleverTapInstanceConfig != null ? CleverTapAPI.V(context, cleverTapInstanceConfig) : CleverTapAPI.H(context);
        if (str == null || str.isEmpty()) {
            return;
        }
        if (V != null) {
            V.w0(str, hashMap);
        } else {
            com.clevertap.android.pushtemplates.a.a("CleverTap instance is NULL, not raising the event");
        }
    }

    static void M(Context context, Bundle bundle, CleverTapInstanceConfig cleverTapInstanceConfig) {
        CleverTapAPI V = cleverTapInstanceConfig != null ? CleverTapAPI.V(context, cleverTapInstanceConfig) : CleverTapAPI.H(context);
        if (V != null) {
            V.y0(bundle);
        }
    }

    public static Bitmap N(Context context, int i7, String str) throws NullPointerException {
        if (str == null || str.isEmpty()) {
            return null;
        }
        int o7 = o(str, "#A6A6A6");
        Drawable drawable = androidx.core.content.a.getDrawable(context, i7);
        Objects.requireNonNull(drawable);
        Drawable mutate = drawable.mutate();
        mutate.setColorFilter(new PorterDuffColorFilter(o7, PorterDuff.Mode.SRC_IN));
        return g(mutate);
    }

    static void O(Boolean bool) {
        m3.a.f17502a = bool.booleanValue();
    }

    static void P(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;
            }
        }
    }

    static void Q(Context context, String str, CleverTapInstanceConfig cleverTapInstanceConfig) {
        if (cleverTapInstanceConfig != null) {
            com.clevertap.android.sdk.task.a.a(cleverTapInstanceConfig).b().g("PushTemplatesUtils#showToast", new a(str, context));
        }
    }

    static String a(Bundle bundle, String str) {
        try {
            Object obj = bundle.get(str);
            if (obj != null) {
                return obj.toString();
            }
            return null;
        } catch (Throwable unused) {
            return null;
        }
    }

    static void b(Context context, int i7) {
        ((NotificationManager) context.getSystemService("notification")).cancel(i7);
    }

    static HashMap<String, Object> c(Bundle bundle) {
        bundle.remove(DeviceService.KEY_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(c((Bundle) obj));
                } else {
                    hashMap.put(str, bundle.get(str));
                }
            }
        }
        return hashMap;
    }

    static void d(Context context) {
        NotificationManager notificationManager = (NotificationManager) context.getSystemService("notification");
        if (notificationManager != null && Build.VERSION.SDK_INT >= 26) {
            if (notificationManager.getNotificationChannel("pt_silent_sound_channel") == null || !(notificationManager.getNotificationChannel("pt_silent_sound_channel") == null || E(notificationManager.getNotificationChannel("pt_silent_sound_channel")))) {
                Uri parse = Uri.parse("android.resource://" + context.getPackageName() + "/raw/pt_silent_sound");
                NotificationChannel notificationChannel = new NotificationChannel("pt_silent_sound_channel", m3.a.f17503b, 4);
                if (parse != null) {
                    notificationChannel.setSound(parse, new AudioAttributes.Builder().setUsage(5).build());
                }
                notificationChannel.setDescription("A channel to silently update notifications");
                notificationChannel.setShowBadge(false);
                notificationManager.createNotificationChannel(notificationChannel);
            }
        }
    }

    static void e(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 (!new File(absolutePath + "/" + str).delete()) {
                        com.clevertap.android.pushtemplates.a.a("Failed to clean up the following file: " + str);
                    }
                } else if (stringExtra == null && str.contains("null")) {
                    if (!new File(absolutePath + "/" + str).delete()) {
                        com.clevertap.android.pushtemplates.a.a("Failed to clean up the following file: " + str);
                    }
                }
            }
        }
    }

    static void f(Context context) {
        NotificationManager notificationManager = (NotificationManager) context.getSystemService("notification");
        if (notificationManager != null && Build.VERSION.SDK_INT >= 26 && notificationManager.getNotificationChannel("pt_silent_sound_channel") != null && E(notificationManager.getNotificationChannel("pt_silent_sound_channel"))) {
            notificationManager.deleteNotificationChannel("pt_silent_sound_channel");
        }
    }

    static Bitmap g(Drawable drawable) throws NullPointerException {
        Bitmap createBitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(createBitmap);
        drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
        drawable.draw(canvas);
        return createBitmap;
    }

    static Bundle h(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 i7 = 0; i7 < optJSONArray.length(); i7++) {
                    strArr[i7] = optJSONArray.optString(i7);
                }
                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;
    }

    static JSONArray i(Bundle bundle) {
        String string = bundle.getString("wzrk_acts");
        if (string != null) {
            try {
                return new JSONArray(string);
            } catch (Throwable th) {
                com.clevertap.android.pushtemplates.a.a("error parsing notification actions: " + th.getLocalizedMessage());
            }
        }
        return null;
    }

    private static Bitmap j(Context context) throws NullPointerException {
        try {
            Drawable applicationLogo = context.getPackageManager().getApplicationLogo(context.getApplicationInfo());
            if (applicationLogo != null) {
                return g(applicationLogo);
            }
            throw new Exception("Logo is null");
        } catch (Exception unused) {
            return g(context.getPackageManager().getApplicationIcon(context.getApplicationInfo()));
        }
    }

    static int k(Context context) {
        return context.getApplicationInfo().icon;
    }

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

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

    private static android.graphics.Bitmap n(java.lang.String r17, android.content.Context r18) {
        throw new UnsupportedOperationException("Method not decompiled: com.clevertap.android.pushtemplates.c.n(java.lang.String, android.content.Context):android.graphics.Bitmap");
    }

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

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

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

    static HashMap<String, Object> r(Bundle bundle) {
        HashMap<String, Object> hashMap = new HashMap<>();
        for (String str : bundle.keySet()) {
            if (str.contains("pt_event_property")) {
                if (bundle.getString(str) == null || bundle.getString(str).isEmpty()) {
                    com.clevertap.android.pushtemplates.a.c("Property Key is Empty. Skipping Property: " + str);
                } else if (str.contains("pt_event_property_")) {
                    hashMap.put(str.split("pt_event_property_")[1], bundle.getString(str));
                } else {
                    com.clevertap.android.pushtemplates.a.c("Property " + str + " does not have the separator");
                }
            }
        }
        return hashMap;
    }

    static HashMap<String, Object> s(Bundle bundle, String str, String str2) {
        HashMap<String, Object> hashMap = new HashMap<>();
        for (String str3 : bundle.keySet()) {
            if (str3.contains("pt_event_property")) {
                if (bundle.getString(str3) == null || bundle.getString(str3).isEmpty()) {
                    com.clevertap.android.pushtemplates.a.c("Property Key is Empty. Skipping Property: " + str3);
                } else if (str3.contains("pt_event_property_")) {
                    String[] split = str3.split("pt_event_property_");
                    if (bundle.getString(str3).equalsIgnoreCase(str)) {
                        hashMap.put(split[1], str2);
                    } else {
                        hashMap.put(split[1], bundle.getString(str3));
                    }
                } else {
                    com.clevertap.android.pushtemplates.a.c("Property " + str3 + " does not have the separator");
                }
            }
        }
        return hashMap;
    }

    public static boolean t() {
        return m3.a.f17502a;
    }

    public static int u(Bundle bundle) {
        String string = bundle.getString("pt_flip_interval");
        if (string != null) {
            try {
                return Math.max(Integer.parseInt(string), 4000);
            } catch (Exception unused) {
                com.clevertap.android.pushtemplates.a.a("Flip Interval couldn't be converted to number: " + string + " - Defaulting to base value: 4000");
            }
        }
        return 4000;
    }

    static ArrayList<String> v(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 w(String str, boolean z6, Context context) throws NullPointerException {
        if (str == null || str.equals("")) {
            if (z6) {
                return j(context);
            }
            return null;
        }
        if (!str.startsWith("http")) {
            str = "http://static.wizrocket.com/android/ico//" + str;
        }
        Bitmap n7 = n(str, context);
        if (n7 != null) {
            return n7;
        }
        if (z6) {
            return j(context);
        }
        return null;
    }

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

    public static ArrayList<Integer> y(Context context) {
        ArrayList<Integer> arrayList = new ArrayList<>();
        if (Build.VERSION.SDK_INT >= 23) {
            for (StatusBarNotification statusBarNotification : ((NotificationManager) context.getSystemService("notification")).getActiveNotifications()) {
                if (statusBarNotification.getPackageName().equalsIgnoreCase(context.getPackageName())) {
                    arrayList.add(Integer.valueOf(statusBarNotification.getId()));
                }
            }
        }
        return arrayList;
    }

    static ArrayList<String> z(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;
    }
}