正在查看: CityMall v1.42.1 应用的 PushTemplateReceiver.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: CityMall v1.42.1 应用的 PushTemplateReceiver.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.clevertap.android.pushtemplates;
import G0.g;
import L0.H;
import android.app.Notification;
import android.app.NotificationChannel;
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.widget.RemoteViews;
import androidx.core.app.NotificationCompat;
import androidx.core.app.RemoteInput;
import com.clevertap.android.sdk.CleverTapAPI;
import com.clevertap.android.sdk.CleverTapInstanceConfig;
import com.clevertap.android.sdk.pushnotification.CTNotificationIntentService;
import i1.AbstractC1098a;
import java.util.ArrayList;
import java.util.concurrent.Callable;
public class PushTemplateReceiver extends BroadcastReceiver {
private String f12733A;
private String f12734B;
private String f12735C;
private String f12736D;
private String f12737E;
private boolean f12738F;
private String f12739G;
private String f12740H;
private CleverTapInstanceConfig f12741I;
private CleverTapAPI f12748g;
private RemoteViews f12749h;
private RemoteViews f12750i;
private RemoteViews f12751j;
private RemoteViews f12752k;
private String f12753l;
private g f12754m;
private String f12755n;
private String f12756o;
private String f12757p;
private String f12758q;
private String f12764w;
private boolean f12766y;
private NotificationManager f12767z;
boolean f12742a = true;
boolean f12743b = true;
boolean f12744c = true;
boolean f12745d = true;
boolean f12746e = true;
boolean f12747f = true;
private ArrayList f12759r = new ArrayList();
private ArrayList f12760s = new ArrayList();
private ArrayList f12761t = new ArrayList();
private ArrayList f12762u = new ArrayList();
private ArrayList f12763v = new ArrayList();
private int f12765x = 0;
class a implements Callable {
final Context f12768a;
final Intent f12769b;
final Bundle f12770c;
a(Context context, Intent intent, Bundle bundle) {
this.f12768a = context;
this.f12769b = intent;
this.f12770c = bundle;
}
@Override
public Void call() {
try {
} catch (Throwable th) {
com.clevertap.android.pushtemplates.a.c("Couldn't render notification: " + th.getLocalizedMessage());
}
if (PushTemplateReceiver.this.f12738F) {
d.f(this.f12768a);
d.e(this.f12768a, this.f12769b);
return null;
}
if (PushTemplateReceiver.this.f12754m != null) {
int i5 = b.f12772a[PushTemplateReceiver.this.f12754m.ordinal()];
if (i5 == 1) {
PushTemplateReceiver.this.n(this.f12768a, this.f12770c, this.f12769b);
} else if (i5 == 2) {
PushTemplateReceiver.this.i(this.f12768a, this.f12770c);
} else if (i5 == 3) {
PushTemplateReceiver.this.l(this.f12768a, this.f12770c);
} else if (i5 == 4) {
PushTemplateReceiver.this.j(this.f12768a, this.f12770c, this.f12769b);
} else if (i5 == 5) {
PushTemplateReceiver.this.k(this.f12768a, this.f12770c);
}
}
return null;
}
}
static class b {
static final int[] f12772a;
static {
int[] iArr = new int[g.values().length];
f12772a = iArr;
try {
iArr[g.RATING.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
f12772a[g.FIVE_ICONS.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
f12772a[g.PRODUCT_DISPLAY.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
f12772a[g.INPUT_BOX.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
f12772a[g.MANUAL_CAROUSEL.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
}
}
private void h(Context context, Intent intent) {
if (Build.VERSION.SDK_INT > 31) {
PendingIntent.getBroadcast(context, 12, intent, 201326592).cancel();
PendingIntent.getBroadcast(context, 11, intent, 201326592).cancel();
PendingIntent.getBroadcast(context, 10, intent, 201326592).cancel();
PendingIntent.getBroadcast(context, 9, intent, 201326592).cancel();
PendingIntent.getBroadcast(context, 8, intent, 201326592).cancel();
}
}
public void i(Context context, Bundle bundle) {
int i5 = bundle.getInt("notificationId");
bundle.putString("wzrk_dl", null);
if (this.f12747f == bundle.getBoolean("close")) {
bundle.putString("wzrk_c2a", "5cta_close");
this.f12767z.cancel(i5);
}
d.N(context, bundle, this.f12741I);
}
public void j(Context context, Bundle bundle, Intent intent) {
Intent launchIntentForPackage;
Bundle k5 = RemoteInput.k(intent);
PendingIntent c5 = I0.g.c(context, bundle, new Intent(context, (Class<?>) PushTemplateReceiver.class));
this.f12741I = (CleverTapInstanceConfig) bundle.getParcelable("config");
if (k5 != null) {
CharSequence charSequence = k5.getCharSequence("pt_input_reply");
int i5 = bundle.getInt("notificationId");
if (charSequence == null) {
com.clevertap.android.pushtemplates.a.c("PushTemplateReceiver: Input is Empty");
return;
}
com.clevertap.android.pushtemplates.a.c("Processing Input from Input Template");
bundle.putString("pt_input_reply", charSequence.toString());
d.L(context, this.f12741I, bundle, "pt_input_reply");
NotificationCompat.h hVar = this.f12766y ? new NotificationCompat.h(context, "pt_silent_sound_channel") : new NotificationCompat.h(context);
s(context);
int i6 = Build.VERSION.SDK_INT;
if (i6 >= 31) {
hVar.Y(this.f12740H);
}
hVar.S(this.f12765x).w(this.f12755n).v(bundle.getString("pt_input_feedback")).a0(1300L).A(c5).e0(System.currentTimeMillis()).l(true);
t(this.f12734B, bundle, context, hVar);
this.f12767z.notify(i5, hVar.g());
if (i6 < 31) {
if (bundle.getString("pt_input_auto_open") != null || bundle.getBoolean("pt_input_auto_open")) {
try {
Thread.sleep(1300L);
} catch (InterruptedException e5) {
e5.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")));
d.Q(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 {
int i5 = bundle.getInt("notificationId");
Notification x4 = d.x(context, i5);
if (x4 != null) {
this.f12752k = x4.bigContentView;
this.f12750i = x4.contentView;
}
p(this.f12752k, context);
boolean z4 = bundle.getBoolean("right_swipe");
this.f12759r = bundle.getStringArrayList("pt_image_list");
this.f12760s = bundle.getStringArrayList("pt_deeplink_list");
int i6 = bundle.getInt("pt_manual_carousel_current");
if (z4) {
this.f12752k.showNext(G0.d.f896c);
this.f12752k.showNext(G0.d.f898e);
this.f12752k.showNext(G0.d.f897d);
size = i6 == this.f12759r.size() - 1 ? 0 : i6 + 1;
} else {
this.f12752k.showPrevious(G0.d.f896c);
this.f12752k.showPrevious(G0.d.f898e);
this.f12752k.showPrevious(G0.d.f897d);
size = i6 == 0 ? this.f12759r.size() - 1 : i6 - 1;
}
String str = "";
ArrayList arrayList = this.f12760s;
if (arrayList == null || arrayList.size() != this.f12759r.size()) {
ArrayList arrayList2 = this.f12760s;
if (arrayList2 == null || arrayList2.size() != 1) {
ArrayList arrayList3 = this.f12760s;
if (arrayList3 == null || arrayList3.size() <= size) {
ArrayList arrayList4 = this.f12760s;
if (arrayList4 != null && arrayList4.size() < size) {
str = (String) this.f12760s.get(0);
}
} else {
str = (String) this.f12760s.get(size);
}
} else {
str = (String) this.f12760s.get(0);
}
} else {
str = (String) this.f12760s.get(size);
}
bundle.putInt("pt_manual_carousel_current", size);
bundle.remove("right_swipe");
bundle.putString("wzrk_dl", str);
bundle.putInt("manual_carousel_from", i6);
this.f12752k.setOnClickPendingIntent(G0.d.f916w, I0.g.b(context, i5, bundle, false, 4, null));
this.f12752k.setOnClickPendingIntent(G0.d.f911r, I0.g.b(context, i5, bundle, false, 5, null));
PendingIntent b5 = I0.g.b(context, i5, bundle, true, 3, null);
NotificationCompat.h hVar = x4 != null ? new NotificationCompat.h(context, x4) : o(this.f12766y, "pt_silent_sound_channel", context);
PendingIntent b6 = I0.g.b(context, i5, bundle, false, 6, null);
s(context);
r(hVar, this.f12750i, this.f12752k, this.f12755n, b5, b6);
this.f12767z.notify(i5, hVar.g());
} catch (Throwable th) {
com.clevertap.android.pushtemplates.a.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 i5, String str, CleverTapInstanceConfig cleverTapInstanceConfig) {
Intent launchIntentForPackage;
Thread.sleep(1000L);
this.f12767z.cancel(i5);
u(context, this.f12739G, 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")));
H.B(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 i5 = bundle.getInt("notificationId");
if (bundle.getBoolean("default_dl", false)) {
this.f12741I = (CleverTapInstanceConfig) bundle.getParcelable("config");
this.f12767z.cancel(i5);
try {
cls = CTNotificationIntentService.class;
String str = CTNotificationIntentService.MAIN_ACTION;
} catch (ClassNotFoundException unused) {
com.clevertap.android.pushtemplates.a.a("No Intent Service found");
cls = null;
}
if (H.x(context, cls)) {
Intent intent2 = new Intent(CTNotificationIntentService.MAIN_ACTION);
intent2.setPackage(context.getPackageName());
intent2.putExtra("ct_type", CTNotificationIntentService.TYPE_BUTTON_CLICK);
intent2.putExtras(bundle);
intent2.putExtra("dl", this.f12758q);
context.startService(intent2);
return;
}
Intent intent3 = new Intent("android.intent.action.VIEW", Uri.parse(this.f12758q));
intent3.removeExtra("wzrk_acts");
intent3.putExtra("wzrk_from", "CTPushNotificationReceiver");
intent3.setFlags(872415232);
d.N(context, bundle, this.f12741I);
intent3.putExtras(bundle);
intent3.putExtra("wzrk_dl", this.f12758q);
context.startActivity(intent3);
return;
}
String str2 = (String) this.f12760s.get(0);
if (1 == bundle.getInt("clickedStar", 0)) {
bundle.putString("wzrk_c2a", "rating_1");
if (this.f12760s.size() > 0) {
str2 = (String) this.f12760s.get(0);
}
}
if (2 == bundle.getInt("clickedStar", 0)) {
bundle.putString("wzrk_c2a", "rating_2");
str2 = this.f12760s.size() > 1 ? (String) this.f12760s.get(1) : (String) this.f12760s.get(0);
}
if (3 == bundle.getInt("clickedStar", 0)) {
bundle.putString("wzrk_c2a", "rating_3");
str2 = this.f12760s.size() > 2 ? (String) this.f12760s.get(2) : (String) this.f12760s.get(0);
}
if (4 == bundle.getInt("clickedStar", 0)) {
bundle.putString("wzrk_c2a", "rating_4");
str2 = this.f12760s.size() > 3 ? (String) this.f12760s.get(3) : (String) this.f12760s.get(0);
}
if (5 == bundle.getInt("clickedStar", 0)) {
bundle.putString("wzrk_c2a", "rating_5");
str2 = this.f12760s.size() > 4 ? (String) this.f12760s.get(4) : (String) this.f12760s.get(0);
}
String str3 = str2;
int i6 = Build.VERSION.SDK_INT;
Notification x4 = d.x(context, i5);
if (x4 != null) {
this.f12751j = x4.bigContentView;
this.f12750i = x4.contentView;
}
if (1 == bundle.getInt("clickedStar", 0)) {
this.f12751j.setImageViewResource(G0.d.f884C, G0.c.f880b);
this.f12742a = false;
} else {
this.f12751j.setImageViewResource(G0.d.f884C, G0.c.f881c);
}
if (2 == bundle.getInt("clickedStar", 0)) {
this.f12751j.setImageViewResource(G0.d.f884C, G0.c.f880b);
this.f12751j.setImageViewResource(G0.d.f885D, G0.c.f880b);
this.f12743b = false;
} else {
this.f12751j.setImageViewResource(G0.d.f885D, G0.c.f881c);
}
if (3 == bundle.getInt("clickedStar", 0)) {
this.f12751j.setImageViewResource(G0.d.f884C, G0.c.f880b);
this.f12751j.setImageViewResource(G0.d.f885D, G0.c.f880b);
this.f12751j.setImageViewResource(G0.d.f886E, G0.c.f880b);
this.f12744c = false;
} else {
this.f12751j.setImageViewResource(G0.d.f886E, G0.c.f881c);
}
if (4 == bundle.getInt("clickedStar", 0)) {
this.f12751j.setImageViewResource(G0.d.f884C, G0.c.f880b);
this.f12751j.setImageViewResource(G0.d.f885D, G0.c.f880b);
this.f12751j.setImageViewResource(G0.d.f886E, G0.c.f880b);
this.f12751j.setImageViewResource(G0.d.f887F, G0.c.f880b);
this.f12745d = false;
} else {
this.f12751j.setImageViewResource(G0.d.f887F, G0.c.f881c);
}
if (5 == bundle.getInt("clickedStar", 0)) {
this.f12751j.setImageViewResource(G0.d.f884C, G0.c.f880b);
this.f12751j.setImageViewResource(G0.d.f885D, G0.c.f880b);
this.f12751j.setImageViewResource(G0.d.f886E, G0.c.f880b);
this.f12751j.setImageViewResource(G0.d.f887F, G0.c.f880b);
this.f12751j.setImageViewResource(G0.d.f888G, G0.c.f880b);
this.f12746e = false;
} else {
this.f12751j.setImageViewResource(G0.d.f888G, G0.c.f881c);
}
h(context, intent);
bundle.putString("wzrk_dl", str3);
this.f12751j.setOnClickPendingIntent(G0.d.f890I, com.clevertap.android.sdk.pushnotification.c.a(bundle, context));
s(context);
NotificationCompat.h hVar = x4 != null ? new NotificationCompat.h(context, x4) : o(this.f12766y, "pt_silent_sound_channel", context);
PendingIntent c5 = I0.g.c(context, bundle, new Intent(context, (Class<?>) PushTemplateReceiver.class));
if (this.f12767z != null) {
hVar.S(this.f12765x).y(this.f12750i).x(this.f12751j).w(this.f12755n).A(c5).l(true);
this.f12767z.notify(i5, hVar.g());
}
d.M(context, this.f12741I, "Rating Submitted", d.c(bundle));
if (i6 < 31) {
m(context, bundle, i5, str3, this.f12741I);
}
} catch (Throwable th) {
com.clevertap.android.pushtemplates.a.d("Error creating rating notification ", th);
}
}
private NotificationCompat.h o(boolean z4, String str, Context context) {
return z4 ? new NotificationCompat.h(context, str) : new NotificationCompat.h(context);
}
private void p(RemoteViews remoteViews, Context context) {
remoteViews.setTextViewText(G0.d.f894a, d.l(context));
remoteViews.setTextViewText(G0.d.f891J, d.B(context));
String str = this.f12740H;
if (str == null || str.isEmpty()) {
remoteViews.setViewVisibility(G0.d.f889H, 8);
remoteViews.setViewVisibility(G0.d.f917x, 8);
} else {
remoteViews.setTextViewText(G0.d.f889H, Html.fromHtml(this.f12740H, 0));
}
String str2 = this.f12737E;
if (str2 == null || str2.isEmpty()) {
return;
}
remoteViews.setTextColor(G0.d.f894a, d.o(this.f12737E, "#A6A6A6"));
remoteViews.setTextColor(G0.d.f891J, d.o(this.f12737E, "#A6A6A6"));
remoteViews.setTextColor(G0.d.f889H, d.o(this.f12737E, "#A6A6A6"));
}
private void q(Bundle bundle) {
String str = this.f12755n;
if (str == null || str.isEmpty()) {
this.f12755n = bundle.getString("nt");
}
String str2 = this.f12756o;
if (str2 == null || str2.isEmpty()) {
this.f12756o = bundle.getString("nm");
}
String str3 = this.f12757p;
if (str3 == null || str3.isEmpty()) {
this.f12757p = bundle.getString("wzrk_nms");
}
String str4 = this.f12736D;
if (str4 == null || str4.isEmpty()) {
this.f12736D = bundle.getString("wzrk_bp");
}
String str5 = this.f12758q;
if (str5 == null || str5.isEmpty()) {
this.f12758q = bundle.getString("wzrk_dl");
}
String str6 = this.f12737E;
if (str6 == null || str6.isEmpty()) {
this.f12737E = bundle.getString("wzrk_clr");
}
String str7 = this.f12735C;
if (str7 == null || str7.isEmpty()) {
this.f12735C = bundle.getString("wzrk_clr");
}
String str8 = this.f12740H;
if (str8 == null || str8.isEmpty()) {
this.f12740H = bundle.getString("wzrk_st");
}
String str9 = this.f12735C;
if (str9 == null || str9.isEmpty()) {
this.f12735C = bundle.getString("wzrk_clr");
}
}
private void r(NotificationCompat.h hVar, RemoteViews remoteViews, RemoteViews remoteViews2, String str, PendingIntent pendingIntent, PendingIntent pendingIntent2) {
hVar.S(this.f12765x).y(remoteViews).x(remoteViews2).w(Html.fromHtml(str)).A(pendingIntent2).u(pendingIntent).z(5).e0(System.currentTimeMillis()).l(true);
}
private void s(Context context) {
try {
String a5 = d.a(context.getPackageManager().getApplicationInfo(context.getPackageName(), 128).metaData, "CLEVERTAP_NOTIFICATION_ICON");
if (a5 == null) {
throw new IllegalArgumentException();
}
int identifier = context.getResources().getIdentifier(a5, "drawable", context.getPackageName());
this.f12765x = identifier;
if (identifier == 0) {
throw new IllegalArgumentException();
}
} catch (Throwable unused) {
this.f12765x = d.k(context);
}
}
private void t(String str, Bundle bundle, Context context, NotificationCompat.h hVar) {
NotificationCompat.l o4;
if (str == null || !str.startsWith("http")) {
o4 = new NotificationCompat.f().o(bundle.getString("pt_input_feedback"));
} else {
try {
Bitmap w4 = d.w(str, false, context);
if (w4 == null) {
throw new Exception("Failed to fetch big picture!");
}
o4 = new NotificationCompat.e().s(bundle.getString("pt_input_feedback")).q(w4);
} catch (Throwable th) {
NotificationCompat.f o5 = new NotificationCompat.f().o(bundle.getString("pt_input_feedback"));
com.clevertap.android.pushtemplates.a.d("Falling back to big text notification, couldn't fetch big picture", th);
o4 = o5;
}
}
hVar.X(o4);
}
private void u(Context context, String str, CleverTapInstanceConfig cleverTapInstanceConfig) {
if (str == null || str.isEmpty()) {
return;
}
d.R(context, str, cleverTapInstanceConfig);
}
@Override
public void onReceive(Context context, Intent intent) {
String str;
NotificationChannel notificationChannel;
d.d(context);
if (intent.getExtras() != null) {
Bundle extras = intent.getExtras();
this.f12748g = CleverTapAPI.k0(context, extras.getString("wzrk_acct_id"));
this.f12753l = intent.getStringExtra("pt_id");
this.f12756o = extras.getString("pt_msg");
this.f12757p = extras.getString("pt_msg_summary");
this.f12755n = extras.getString("pt_title");
this.f12758q = extras.getString("pt_default_dl");
this.f12759r = d.v(extras);
this.f12760s = d.p(extras);
this.f12761t = d.m(extras);
this.f12762u = d.A(extras);
this.f12763v = d.z(extras);
this.f12733A = extras.getString("pt_product_display_linear");
this.f12767z = (NotificationManager) context.getSystemService("notification");
this.f12764w = extras.getString("wzrk_cid", "");
this.f12734B = extras.getString("pt_big_img_alt");
this.f12735C = extras.getString("pt_small_icon_clr");
int i5 = Build.VERSION.SDK_INT;
this.f12766y = i5 >= 26;
this.f12738F = extras.getBoolean("pt_dismiss_intent", false);
this.f12739G = extras.getString("pt_rating_toast");
this.f12740H = extras.getString("pt_subtitle");
q(extras);
if (i5 >= 26) {
if (this.f12764w.isEmpty()) {
str = "Unable to render notification, channelId is required but not provided in the notification payload: " + extras.toString();
} else {
NotificationManager notificationManager = this.f12767z;
if (notificationManager != null) {
notificationChannel = notificationManager.getNotificationChannel(this.f12764w);
if (notificationChannel == null) {
str = "Unable to render notification, channelId: " + this.f12764w + " not registered by the app.";
}
}
str = null;
}
if (str != null) {
com.clevertap.android.pushtemplates.a.c(str);
return;
}
}
String str2 = this.f12753l;
if (str2 != null) {
this.f12754m = g.b(str2);
}
CleverTapAPI cleverTapAPI = this.f12748g;
if (cleverTapAPI == null) {
com.clevertap.android.pushtemplates.a.c("clevertap instance is null, not running PushTemplateReceiver#renderNotification");
return;
}
try {
CleverTapInstanceConfig g5 = cleverTapAPI.Z().g();
this.f12741I = g5;
AbstractC1098a.c(g5).d().g("PushTemplateReceiver#renderNotification", new a(context, intent, extras));
} catch (Exception e5) {
com.clevertap.android.pushtemplates.a.c("Couldn't render notification: " + e5.getLocalizedMessage());
}
}
}
}