导航菜单

页面标题

页面副标题

CityMall v1.42.1 - d.java 源代码

正在查看: CityMall v1.42.1 应用的 d.java JAVA 源代码文件

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


package com.clevertap.android.pushtemplates;

import G0.i;
import G0.j;
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 androidx.core.content.ContextCompat;
import com.clevertap.android.sdk.CleverTapAPI;
import com.clevertap.android.sdk.CleverTapInstanceConfig;
import i1.AbstractC1098a;
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 abstract class d {

    class a implements Callable {

        final String f12829a;

        final Context f12830b;

        a(String str, Context context) {
            this.f12829a = str;
            this.f12830b = context;
        }

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

    static ArrayList A(Bundle bundle) {
        ArrayList 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) {
        int importance;
        if (Build.VERSION.SDK_INT < 26 || notificationChannel == null) {
            return false;
        }
        importance = notificationChannel.getImportance();
        return importance != 0;
    }

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

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

    public static void H(int i5, int i6, RemoteViews remoteViews) {
        remoteViews.setImageViewResource(i5, i6);
    }

    public static void I(int i5, String str, RemoteViews remoteViews) {
        Bitmap n4 = n(str);
        P(Boolean.FALSE);
        if (n4 != null) {
            remoteViews.setImageViewBitmap(i5, n4);
            return;
        }
        com.clevertap.android.pushtemplates.a.a("Image was not perfect. URL:" + str + " hiding image view");
        P(Boolean.TRUE);
    }

    public static void J(int i5, String str, RemoteViews remoteViews, Context context) {
        Bitmap n4 = n(str);
        P(Boolean.FALSE);
        if (n4 != null) {
            remoteViews.setImageViewBitmap(i5, n4);
            return;
        }
        com.clevertap.android.pushtemplates.a.a("Image was not perfect. URL:" + str + " hiding image view");
        P(Boolean.TRUE);
    }

    static void K(Context context, CleverTapInstanceConfig cleverTapInstanceConfig, Bundle bundle) {
        CleverTapAPI F02 = cleverTapInstanceConfig != null ? CleverTapAPI.F0(context, cleverTapInstanceConfig) : CleverTapAPI.d0(context);
        HashMap r4 = r(bundle);
        String q4 = q(bundle);
        if (q4 == null || q4.isEmpty()) {
            return;
        }
        if (F02 != null) {
            F02.g1(q4, r4);
        } else {
            com.clevertap.android.pushtemplates.a.a("CleverTap instance is NULL, not raising the event");
        }
    }

    static void L(Context context, CleverTapInstanceConfig cleverTapInstanceConfig, Bundle bundle, String str) {
        CleverTapAPI F02 = cleverTapInstanceConfig != null ? CleverTapAPI.F0(context, cleverTapInstanceConfig) : CleverTapAPI.d0(context);
        HashMap s4 = s(bundle, str, bundle.getString(str));
        String q4 = q(bundle);
        if (q4 == null || q4.isEmpty()) {
            return;
        }
        if (F02 != null) {
            F02.g1(q4, s4);
        } else {
            com.clevertap.android.pushtemplates.a.a("CleverTap instance is NULL, not raising the event");
        }
    }

    static void M(Context context, CleverTapInstanceConfig cleverTapInstanceConfig, String str, HashMap hashMap) {
        CleverTapAPI F02 = cleverTapInstanceConfig != null ? CleverTapAPI.F0(context, cleverTapInstanceConfig) : CleverTapAPI.d0(context);
        if (str == null || str.isEmpty()) {
            return;
        }
        if (F02 != null) {
            F02.g1(str, hashMap);
        } else {
            com.clevertap.android.pushtemplates.a.a("CleverTap instance is NULL, not raising the event");
        }
    }

    static void N(Context context, Bundle bundle, CleverTapInstanceConfig cleverTapInstanceConfig) {
        CleverTapAPI F02 = cleverTapInstanceConfig != null ? CleverTapAPI.F0(context, cleverTapInstanceConfig) : CleverTapAPI.d0(context);
        if (F02 != null) {
            F02.m1(bundle);
        }
    }

    public static Bitmap O(Context context, int i5, String str) {
        if (str == null || str.isEmpty()) {
            return null;
        }
        int o4 = o(str, "#A6A6A6");
        Drawable e5 = ContextCompat.e(context, i5);
        Objects.requireNonNull(e5);
        Drawable mutate = e5.mutate();
        mutate.setColorFilter(new PorterDuffColorFilter(o4, PorterDuff.Mode.SRC_IN));
        return g(mutate);
    }

    static void P(Boolean bool) {
        G0.a.f877a = bool.booleanValue();
    }

    static void Q(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 R(Context context, String str, CleverTapInstanceConfig cleverTapInstanceConfig) {
        if (cleverTapInstanceConfig != null) {
            AbstractC1098a.c(cleverTapInstanceConfig).c().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 i5) {
        ((NotificationManager) context.getSystemService("notification")).cancel(i5);
    }

    static HashMap c(Bundle bundle) {
        bundle.remove("config");
        HashMap 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) {
        NotificationChannel notificationChannel;
        NotificationChannel notificationChannel2;
        NotificationChannel notificationChannel3;
        NotificationManager notificationManager = (NotificationManager) context.getSystemService("notification");
        if (notificationManager != null && Build.VERSION.SDK_INT >= 26) {
            notificationChannel = notificationManager.getNotificationChannel("pt_silent_sound_channel");
            if (notificationChannel != null) {
                notificationChannel2 = notificationManager.getNotificationChannel("pt_silent_sound_channel");
                if (notificationChannel2 == null) {
                    return;
                }
                notificationChannel3 = notificationManager.getNotificationChannel("pt_silent_sound_channel");
                if (E(notificationChannel3)) {
                    return;
                }
            }
            Uri parse = Uri.parse("android.resource://" + context.getPackageName() + "/raw/pt_silent_sound");
            j.a();
            NotificationChannel a5 = i.a("pt_silent_sound_channel", G0.a.f878b, 4);
            if (parse != null) {
                a5.setSound(parse, new AudioAttributes.Builder().setUsage(5).build());
            }
            a5.setDescription("A channel to silently update notifications");
            a5.setShowBadge(false);
            notificationManager.createNotificationChannel(a5);
        }
    }

    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) {
        NotificationChannel notificationChannel;
        NotificationChannel notificationChannel2;
        NotificationManager notificationManager = (NotificationManager) context.getSystemService("notification");
        if (notificationManager != null && Build.VERSION.SDK_INT >= 26) {
            notificationChannel = notificationManager.getNotificationChannel("pt_silent_sound_channel");
            if (notificationChannel != null) {
                notificationChannel2 = notificationManager.getNotificationChannel("pt_silent_sound_channel");
                if (E(notificationChannel2)) {
                    notificationManager.deleteNotificationChannel("pt_silent_sound_channel");
                }
            }
        }
    }

    static Bitmap g(Drawable drawable) {
        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 i5 = 0; i5 < optJSONArray.length(); i5++) {
                    strArr[i5] = optJSONArray.optString(i5);
                }
                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) {
        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 i5 = applicationInfo.labelRes;
        return i5 == 0 ? applicationInfo.nonLocalizedLabel.toString() : context.getString(i5);
    }

    static ArrayList m(Bundle bundle) {
        ArrayList 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) {
        throw new UnsupportedOperationException("Method not decompiled: com.clevertap.android.pushtemplates.d.n(java.lang.String):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 p(Bundle bundle) {
        ArrayList 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 r(Bundle bundle) {
        HashMap 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 s(Bundle bundle, String str, String str2) {
        HashMap 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 G0.a.f877a;
    }

    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 v(Bundle bundle) {
        ArrayList 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 z4, Context context) {
        if (str == null || str.equals("")) {
            if (z4) {
                return j(context);
            }
            return null;
        }
        if (!str.startsWith("http")) {
            str = "http://static.wizrocket.com/android/ico//" + str;
        }
        Bitmap n4 = n(str);
        if (n4 != null) {
            return n4;
        }
        if (z4) {
            return j(context);
        }
        return null;
    }

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

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

    static ArrayList z(Bundle bundle) {
        ArrayList 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;
    }
}