导航菜单

页面标题

页面副标题

OLX India v19.42.007 - PushTemplateReceiver.java 源代码

正在查看: OLX India v19.42.007 应用的 PushTemplateReceiver.java JAVA 源代码文件

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


package com.clevertap.android.pushtemplates;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.Html;
import android.text.Spanned;
import android.widget.RemoteViews;
import androidx.core.app.k;
import androidx.core.app.z;
import com.clevertap.android.sdk.CleverTapInstanceConfig;
import com.clevertap.android.sdk.b0;
import com.clevertap.android.sdk.interfaces.NotificationHandler;
import com.clevertap.android.sdk.pushnotification.CTNotificationIntentService;
import com.clevertap.android.sdk.u1;
import java.util.ArrayList;
import java.util.concurrent.Callable;

public class PushTemplateReceiver extends BroadcastReceiver {
    private String A;
    private String B;
    private String C;
    private String D;
    private boolean E;
    private String F;
    private String G;
    private CleverTapInstanceConfig H;
    private b0 g;
    private RemoteViews h;
    private RemoteViews i;
    private RemoteViews j;
    private RemoteViews k;
    private String l;
    private l m;
    private String n;
    private String o;
    private String p;
    private String q;
    private boolean x;
    private NotificationManager y;
    private String z;
    boolean a = true;
    boolean b = true;
    boolean c = true;
    boolean d = true;
    boolean e = true;
    boolean f = true;
    private ArrayList r = new ArrayList();
    private ArrayList s = new ArrayList();
    private ArrayList t = new ArrayList();
    private ArrayList u = new ArrayList();
    private ArrayList v = new ArrayList();
    private int w = 0;

    class a implements Callable {
        final Context a;
        final Intent b;
        final Bundle c;

        a(Context context, Intent intent, Bundle bundle) {
            this.a = context;
            this.b = intent;
            this.c = bundle;
        }

        @Override
        public Void call() {
            try {
            } catch (Throwable th) {
                com.clevertap.android.pushtemplates.b.c("Couldn't render notification: " + th.getLocalizedMessage());
            }
            if (PushTemplateReceiver.this.E) {
                w.f(this.a);
                w.e(this.a, this.b);
                return null;
            }
            if (PushTemplateReceiver.this.m != null) {
                int i = b.a[PushTemplateReceiver.this.m.ordinal()];
                if (i == 1) {
                    PushTemplateReceiver.this.n(this.a, this.c, this.b);
                } else if (i == 2) {
                    PushTemplateReceiver.this.i(this.a, this.c);
                } else if (i == 3) {
                    PushTemplateReceiver.this.l(this.a, this.c);
                } else if (i == 4) {
                    PushTemplateReceiver.this.j(this.a, this.c, this.b);
                } else if (i == 5) {
                    PushTemplateReceiver.this.k(this.a, this.c);
                }
            }
            return null;
        }
    }

    static class b {
        static final int[] a;

        static {
            int[] iArr = new int[l.values().length];
            a = iArr;
            try {
                iArr[l.RATING.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[l.FIVE_ICONS.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                a[l.PRODUCT_DISPLAY.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                a[l.INPUT_BOX.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                a[l.MANUAL_CAROUSEL.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
        }
    }

    private void h(Context context, Intent intent) {
        int i = Build.VERSION.SDK_INT >= 23 ? 201326592 : 134217728;
        for (int i2 : intent.getIntArrayExtra("requestCodes")) {
            PendingIntent.getBroadcast(context, i2, intent, i).cancel();
        }
    }

    public void i(Context context, Bundle bundle) {
        int i = bundle.getInt("notificationId");
        bundle.putString("wzrk_dl", null);
        if (this.f == bundle.getBoolean("close")) {
            bundle.putString("wzrk_c2a", "5cta_close");
            this.y.cancel(i);
        }
        w.M(context, bundle, this.H);
    }

    public void j(Context context, Bundle bundle, Intent intent) {
        Intent launchIntentForPackage;
        Bundle k = z.k(intent);
        PendingIntent d = com.clevertap.android.pushtemplates.content.g.d(context, bundle, new Intent(context, (Class<?>) PushTemplateReceiver.class));
        this.H = bundle.getParcelable("config");
        if (k != null) {
            CharSequence charSequence = k.getCharSequence("pt_input_reply");
            int i = bundle.getInt("notificationId");
            if (charSequence == null) {
                com.clevertap.android.pushtemplates.b.c("PushTemplateReceiver: Input is Empty");
                return;
            }
            com.clevertap.android.pushtemplates.b.c("Processing Input from Input Template");
            bundle.putString("pt_input_reply", charSequence.toString());
            w.K(context, this.H, bundle, "pt_input_reply");
            k.i iVar = this.x ? new k.i(context, "pt_silent_sound_channel") : new k.i(context);
            r(context);
            int i2 = Build.VERSION.SDK_INT;
            if (i2 >= 31) {
                iVar.h0(this.G);
            }
            iVar.b0(this.w).D(this.n).C(bundle.getString("pt_input_feedback")).j0(1300L).I(d).n0(System.currentTimeMillis()).r(true);
            s(this.A, bundle, context, iVar);
            this.y.notify(i, iVar.g());
            if (i2 < 31) {
                if (bundle.getString("pt_input_auto_open") != null || bundle.getBoolean("pt_input_auto_open")) {
                    try {
                        Thread.sleep(1300L);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    if (!bundle.containsKey("wzrk_dl") || bundle.getString("wzrk_dl") == null) {
                        launchIntentForPackage = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
                        if (launchIntentForPackage == null) {
                            return;
                        }
                    } else {
                        launchIntentForPackage = new Intent("android.intent.action.VIEW", Uri.parse(intent.getStringExtra("wzrk_dl")));
                        w.P(context, launchIntentForPackage);
                    }
                    launchIntentForPackage.putExtras(bundle);
                    launchIntentForPackage.putExtra("pt_reply", charSequence);
                    launchIntentForPackage.removeExtra("wzrk_acts");
                    launchIntentForPackage.setFlags(872415232);
                    context.startActivity(launchIntentForPackage);
                }
            }
        }
    }

    public void k(Context context, Bundle bundle) {
        int size;
        try {
            if (Build.VERSION.SDK_INT < 23) {
                bundle.putString("extras_from", "PTReceiver");
                NotificationHandler G = b0.G();
                if (G != null) {
                    G.onMessageReceived(context, bundle, "FCM");
                    return;
                }
                return;
            }
            int i = bundle.getInt("notificationId");
            Notification x = w.x(context, i);
            if (x == null) {
                com.clevertap.android.pushtemplates.b.c("Manual Carousel Notification is null, returning");
                return;
            }
            RemoteViews remoteViews = x.bigContentView;
            this.k = remoteViews;
            this.i = x.contentView;
            o(remoteViews, context);
            boolean z = bundle.getBoolean("right_swipe");
            this.r = bundle.getStringArrayList("pt_image_list");
            this.s = bundle.getStringArrayList("pt_deeplink_list");
            int i2 = bundle.getInt("pt_manual_carousel_current");
            if (z) {
                this.k.showNext(f.carousel_image);
                this.k.showNext(f.carousel_image_right);
                this.k.showNext(f.carousel_image_left);
                size = i2 == this.r.size() - 1 ? 0 : i2 + 1;
            } else {
                this.k.showPrevious(f.carousel_image);
                this.k.showPrevious(f.carousel_image_right);
                this.k.showPrevious(f.carousel_image_left);
                size = i2 == 0 ? this.r.size() - 1 : i2 - 1;
            }
            String str = "";
            ArrayList arrayList = this.s;
            if (arrayList == null || arrayList.size() != this.r.size()) {
                ArrayList arrayList2 = this.s;
                if (arrayList2 == null || arrayList2.size() != 1) {
                    ArrayList arrayList3 = this.s;
                    if (arrayList3 == null || arrayList3.size() <= size) {
                        ArrayList arrayList4 = this.s;
                        if (arrayList4 != null && arrayList4.size() < size) {
                            str = (String) this.s.get(0);
                        }
                    } else {
                        str = (String) this.s.get(size);
                    }
                } else {
                    str = (String) this.s.get(0);
                }
            } else {
                str = (String) this.s.get(size);
            }
            bundle.putInt("pt_manual_carousel_current", size);
            bundle.remove("right_swipe");
            bundle.putString("wzrk_dl", str);
            bundle.putInt("manual_carousel_from", i2);
            this.k.setOnClickPendingIntent(f.rightArrowPos0, com.clevertap.android.pushtemplates.content.g.b(context, i, bundle, false, 4, null));
            this.k.setOnClickPendingIntent(f.leftArrowPos0, com.clevertap.android.pushtemplates.content.g.b(context, i, bundle, false, 5, null));
            PendingIntent b2 = com.clevertap.android.pushtemplates.content.g.b(context, i, bundle, true, 3, null);
            k.i iVar = new k.i(context, x);
            PendingIntent b3 = com.clevertap.android.pushtemplates.content.g.b(context, i, bundle, false, 6, null);
            r(context);
            q(iVar, this.i, this.k, this.n, b2, b3);
            this.y.notify(i, iVar.g());
        } catch (Throwable th) {
            com.clevertap.android.pushtemplates.b.d("Error creating manual carousel notification ", th);
        }
    }

    public void l(android.content.Context r13, android.os.Bundle r14) {
        throw new UnsupportedOperationException("Method not decompiled: com.clevertap.android.pushtemplates.PushTemplateReceiver.l(android.content.Context, android.os.Bundle):void");
    }

    private void m(Context context, Bundle bundle, int i, String str, CleverTapInstanceConfig cleverTapInstanceConfig) {
        Intent launchIntentForPackage;
        Thread.sleep(1000L);
        this.y.cancel(i);
        t(context, this.F, cleverTapInstanceConfig);
        context.sendBroadcast(new Intent("android.intent.action.CLOSE_SYSTEM_DIALOGS"));
        if (bundle.containsKey("wzrk_dl")) {
            launchIntentForPackage = new Intent("android.intent.action.VIEW", Uri.parse(bundle.getString("wzrk_dl")));
            u1.y(context, launchIntentForPackage);
        } else {
            launchIntentForPackage = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
            if (launchIntentForPackage == null) {
                return;
            }
        }
        launchIntentForPackage.putExtras(bundle);
        launchIntentForPackage.putExtra("wzrk_dl", str);
        launchIntentForPackage.removeExtra("wzrk_acts");
        launchIntentForPackage.putExtra("wzrk_from", "CTPushNotificationReceiver");
        launchIntentForPackage.setFlags(872415232);
        context.startActivity(launchIntentForPackage);
    }

    public void n(Context context, Bundle bundle, Intent intent) {
        Class<CTNotificationIntentService> cls;
        try {
            int i = bundle.getInt("notificationId");
            if (bundle.getBoolean("default_dl", false)) {
                this.H = bundle.getParcelable("config");
                this.y.cancel(i);
                try {
                    cls = CTNotificationIntentService.class;
                    String str = CTNotificationIntentService.MAIN_ACTION;
                } catch (ClassNotFoundException unused) {
                    com.clevertap.android.pushtemplates.b.a("No Intent Service found");
                    cls = null;
                }
                if (u1.u(context, cls)) {
                    Intent intent2 = new Intent("com.clevertap.PUSH_EVENT");
                    intent2.setPackage(context.getPackageName());
                    intent2.putExtra("ct_type", "com.clevertap.ACTION_BUTTON_CLICK");
                    intent2.putExtras(bundle);
                    intent2.putExtra("dl", this.q);
                    context.startService(intent2);
                    return;
                }
                Intent intent3 = new Intent("android.intent.action.VIEW", Uri.parse(this.q));
                intent3.removeExtra("wzrk_acts");
                intent3.putExtra("wzrk_from", "CTPushNotificationReceiver");
                intent3.setFlags(872415232);
                w.M(context, bundle, this.H);
                intent3.putExtras(bundle);
                intent3.putExtra("wzrk_dl", this.q);
                context.startActivity(intent3);
                return;
            }
            String str2 = (String) this.s.get(0);
            if (1 == bundle.getInt("clickedStar", 0)) {
                bundle.putString("wzrk_c2a", "rating_1");
                if (this.s.size() > 0) {
                    str2 = (String) this.s.get(0);
                }
            }
            if (2 == bundle.getInt("clickedStar", 0)) {
                bundle.putString("wzrk_c2a", "rating_2");
                str2 = this.s.size() > 1 ? (String) this.s.get(1) : (String) this.s.get(0);
            }
            if (3 == bundle.getInt("clickedStar", 0)) {
                bundle.putString("wzrk_c2a", "rating_3");
                str2 = this.s.size() > 2 ? (String) this.s.get(2) : (String) this.s.get(0);
            }
            if (4 == bundle.getInt("clickedStar", 0)) {
                bundle.putString("wzrk_c2a", "rating_4");
                str2 = this.s.size() > 3 ? (String) this.s.get(3) : (String) this.s.get(0);
            }
            if (5 == bundle.getInt("clickedStar", 0)) {
                bundle.putString("wzrk_c2a", "rating_5");
                str2 = this.s.size() > 4 ? (String) this.s.get(4) : (String) this.s.get(0);
            }
            String str3 = str2;
            int i2 = Build.VERSION.SDK_INT;
            if (i2 < 23) {
                bundle.putString("extras_from", "PTReceiver");
                Bundle bundle2 = (Bundle) bundle.clone();
                NotificationHandler G = b0.G();
                if (G != null) {
                    G.onMessageReceived(context, bundle, "FCM");
                    bundle2.putString("wzrk_dl", str3);
                    w.L(context, this.H, "Rating Submitted", w.c(bundle));
                    m(context, bundle2, i, str3, this.H);
                    return;
                }
                return;
            }
            Notification x = w.x(context, i);
            if (x == null) {
                com.clevertap.android.pushtemplates.b.c("Rating Notification is null, returning");
                return;
            }
            this.j = x.bigContentView;
            this.i = x.contentView;
            if (1 == bundle.getInt("clickedStar", 0)) {
                this.j.setImageViewResource(f.star1, e.pt_star_filled);
                this.a = false;
            } else {
                this.j.setImageViewResource(f.star1, e.pt_star_outline);
            }
            if (2 == bundle.getInt("clickedStar", 0)) {
                this.j.setImageViewResource(f.star1, e.pt_star_filled);
                this.j.setImageViewResource(f.star2, e.pt_star_filled);
                this.b = false;
            } else {
                this.j.setImageViewResource(f.star2, e.pt_star_outline);
            }
            if (3 == bundle.getInt("clickedStar", 0)) {
                this.j.setImageViewResource(f.star1, e.pt_star_filled);
                this.j.setImageViewResource(f.star2, e.pt_star_filled);
                this.j.setImageViewResource(f.star3, e.pt_star_filled);
                this.c = false;
            } else {
                this.j.setImageViewResource(f.star3, e.pt_star_outline);
            }
            if (4 == bundle.getInt("clickedStar", 0)) {
                this.j.setImageViewResource(f.star1, e.pt_star_filled);
                this.j.setImageViewResource(f.star2, e.pt_star_filled);
                this.j.setImageViewResource(f.star3, e.pt_star_filled);
                this.j.setImageViewResource(f.star4, e.pt_star_filled);
                this.d = false;
            } else {
                this.j.setImageViewResource(f.star4, e.pt_star_outline);
            }
            if (5 == bundle.getInt("clickedStar", 0)) {
                this.j.setImageViewResource(f.star1, e.pt_star_filled);
                this.j.setImageViewResource(f.star2, e.pt_star_filled);
                this.j.setImageViewResource(f.star3, e.pt_star_filled);
                this.j.setImageViewResource(f.star4, e.pt_star_filled);
                this.j.setImageViewResource(f.star5, e.pt_star_filled);
                this.e = false;
            } else {
                this.j.setImageViewResource(f.star5, e.pt_star_outline);
            }
            h(context, intent);
            bundle.putString("wzrk_dl", str3);
            this.j.setOnClickPendingIntent(f.tVRatingConfirmation, com.clevertap.android.sdk.pushnotification.g.a(bundle, context));
            r(context);
            k.i iVar = new k.i(context, x);
            PendingIntent d = com.clevertap.android.pushtemplates.content.g.d(context, bundle, new Intent(context, (Class<?>) PushTemplateReceiver.class));
            if (this.y != null) {
                iVar.b0(this.w).F(this.i).E(this.j).D(this.n).I(d).r(true);
                this.y.notify(i, iVar.g());
            }
            w.L(context, this.H, "Rating Submitted", w.c(bundle));
            if (i2 < 31) {
                m(context, bundle, i, str3, this.H);
            }
        } catch (Throwable th) {
            com.clevertap.android.pushtemplates.b.d("Error creating rating notification ", th);
        }
    }

    private void o(RemoteViews remoteViews, Context context) {
        Spanned fromHtml;
        remoteViews.setTextViewText(f.app_name, w.l(context));
        remoteViews.setTextViewText(f.timestamp, w.B(context));
        String str = this.G;
        if (str == null || str.isEmpty()) {
            remoteViews.setViewVisibility(f.subtitle, 8);
            remoteViews.setViewVisibility(f.sep_subtitle, 8);
        } else if (Build.VERSION.SDK_INT >= 24) {
            int i = f.subtitle;
            fromHtml = Html.fromHtml(this.G, 0);
            remoteViews.setTextViewText(i, fromHtml);
        } else {
            remoteViews.setTextViewText(f.subtitle, Html.fromHtml(this.G));
        }
        String str2 = this.D;
        if (str2 == null || str2.isEmpty()) {
            return;
        }
        remoteViews.setTextColor(f.app_name, w.o(this.D, "#A6A6A6"));
        remoteViews.setTextColor(f.timestamp, w.o(this.D, "#A6A6A6"));
        remoteViews.setTextColor(f.subtitle, w.o(this.D, "#A6A6A6"));
    }

    private void p(Bundle bundle) {
        String str = this.n;
        if (str == null || str.isEmpty()) {
            this.n = bundle.getString("nt");
        }
        String str2 = this.o;
        if (str2 == null || str2.isEmpty()) {
            this.o = bundle.getString("nm");
        }
        String str3 = this.p;
        if (str3 == null || str3.isEmpty()) {
            this.p = bundle.getString("wzrk_nms");
        }
        String str4 = this.C;
        if (str4 == null || str4.isEmpty()) {
            this.C = bundle.getString("wzrk_bp");
        }
        String str5 = this.q;
        if (str5 == null || str5.isEmpty()) {
            this.q = bundle.getString("wzrk_dl");
        }
        String str6 = this.D;
        if (str6 == null || str6.isEmpty()) {
            this.D = bundle.getString("wzrk_clr");
        }
        String str7 = this.B;
        if (str7 == null || str7.isEmpty()) {
            this.B = bundle.getString("wzrk_clr");
        }
        String str8 = this.G;
        if (str8 == null || str8.isEmpty()) {
            this.G = bundle.getString("wzrk_st");
        }
        String str9 = this.B;
        if (str9 == null || str9.isEmpty()) {
            this.B = bundle.getString("wzrk_clr");
        }
    }

    private void q(k.i iVar, RemoteViews remoteViews, RemoteViews remoteViews2, String str, PendingIntent pendingIntent, PendingIntent pendingIntent2) {
        iVar.b0(this.w).F(remoteViews).E(remoteViews2).D(Html.fromHtml(str)).I(pendingIntent2).B(pendingIntent).H(5).n0(System.currentTimeMillis()).r(true);
    }

    private void r(Context context) {
        try {
            String a2 = w.a(context.getPackageManager().getApplicationInfo(context.getPackageName(), 128).metaData, "CLEVERTAP_NOTIFICATION_ICON");
            if (a2 == null) {
                throw new IllegalArgumentException();
            }
            int identifier = context.getResources().getIdentifier(a2, "drawable", context.getPackageName());
            this.w = identifier;
            if (identifier == 0) {
                throw new IllegalArgumentException();
            }
        } catch (Throwable unused) {
            this.w = w.k(context);
        }
    }

    private void s(String str, Bundle bundle, Context context, k.i iVar) {
        k.n x;
        if (str == null || !str.startsWith("http")) {
            x = new k.g().x(bundle.getString("pt_input_feedback"));
        } else {
            try {
                Bitmap w = w.w(str, false, context);
                if (w == null) {
                    throw new Exception("Failed to fetch big picture!");
                }
                x = new k.f().C(bundle.getString("pt_input_feedback")).z(w);
            } catch (Throwable th) {
                k.g x2 = new k.g().x(bundle.getString("pt_input_feedback"));
                com.clevertap.android.pushtemplates.b.d("Falling back to big text notification, couldn't fetch big picture", th);
                x = x2;
            }
        }
        iVar.g0(x);
    }

    private void t(Context context, String str, CleverTapInstanceConfig cleverTapInstanceConfig) {
        if (str == null || str.isEmpty()) {
            return;
        }
        w.Q(context, str, cleverTapInstanceConfig);
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        w.d(context);
        if (intent.getExtras() != null) {
            Bundle extras = intent.getExtras();
            this.g = b0.D(context, extras.getString("wzrk_acct_id"));
            this.l = intent.getStringExtra("pt_id");
            this.o = extras.getString("pt_msg");
            this.p = extras.getString("pt_msg_summary");
            this.n = extras.getString("pt_title");
            this.q = extras.getString("pt_default_dl");
            this.r = w.v(extras);
            this.s = w.p(extras);
            this.t = w.m(extras);
            this.u = w.A(extras);
            this.v = w.z(extras);
            this.z = extras.getString("pt_product_display_linear");
            this.y = (NotificationManager) context.getSystemService("notification");
            this.A = extras.getString("pt_big_img_alt");
            this.B = extras.getString("pt_small_icon_clr");
            this.x = Build.VERSION.SDK_INT >= 26;
            this.E = extras.getBoolean("pt_dismiss_intent", false);
            this.F = extras.getString("pt_rating_toast");
            this.G = extras.getString("pt_subtitle");
            p(extras);
            String str = this.l;
            if (str != null) {
                this.m = l.fromString(str);
            }
            b0 b0Var = this.g;
            if (b0Var == null) {
                com.clevertap.android.pushtemplates.b.c("clevertap instance is null, not running PushTemplateReceiver#renderNotification");
                return;
            }
            try {
                CleverTapInstanceConfig f = b0Var.y().f();
                this.H = f;
                com.clevertap.android.sdk.task.a.a(f).c().g("PushTemplateReceiver#renderNotification", new a(context, intent, extras));
            } catch (Exception e) {
                com.clevertap.android.pushtemplates.b.c("Couldn't render notification: " + e.getLocalizedMessage());
            }
        }
    }
}