正在查看: Oolka v2.4.42 应用的 PushTemplateReceiver.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Oolka v2.4.42 应用的 PushTemplateReceiver.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.clevertap.android.pushtemplates;
import android.annotation.SuppressLint;
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.widget.RemoteViews;
import androidx.core.app.NotificationCompat;
import androidx.core.app.a0;
import com.clevertap.android.sdk.CleverTapInstanceConfig;
import com.clevertap.android.sdk.n0;
import com.clevertap.android.sdk.pushnotification.CTNotificationIntentService;
import com.clevertap.android.sdk.pushnotification.LaunchPendingIntentFactory;
import com.clevertap.android.sdk.task.CTExecutorFactory;
import java.util.ArrayList;
import java.util.concurrent.Callable;
public class PushTemplateReceiver extends BroadcastReceiver {
public String A;
public String B;
public String C;
public String D;
public String E;
public boolean F;
public String G;
public String H;
public CleverTapInstanceConfig I;
public n0 g;
public RemoteViews h;
public RemoteViews i;
public RemoteViews j;
public RemoteViews k;
public String l;
public n m;
public String n;
public String o;
public String p;
public String q;
public boolean x;
public NotificationManager y;
public String z;
public boolean a = true;
public boolean b = true;
public boolean c = true;
public boolean d = true;
public boolean e = true;
public boolean f = true;
public ArrayList<String> r = new ArrayList<>();
public ArrayList<String> s = new ArrayList<>();
public ArrayList<String> t = new ArrayList<>();
public ArrayList<String> u = new ArrayList<>();
public ArrayList<String> v = new ArrayList<>();
public int w = 0;
public class a implements Callable<Void> {
public final Context a;
public final Intent b;
public final Bundle c;
public a(Context context, Intent intent, Bundle bundle) {
this.a = context;
this.b = intent;
this.c = bundle;
}
@Override
public Void call() throws Exception {
try {
} catch (Throwable th) {
e.c("Couldn't render notification: " + th.getLocalizedMessage());
}
if (PushTemplateReceiver.this.F) {
Utils.g(this.a);
Utils.f(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;
}
}
public static class b {
public static final int[] a;
static {
int[] iArr = new int[n.values().length];
a = iArr;
try {
iArr[n.RATING.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[n.FIVE_ICONS.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
a[n.PRODUCT_DISPLAY.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
a[n.INPUT_BOX.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
a[n.MANUAL_CAROUSEL.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
}
}
public final void h(Context context, Intent intent) {
for (int i : intent.getIntArrayExtra("requestCodes")) {
PendingIntent.getBroadcast(context, i, intent, 201326592).cancel();
}
}
public final 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);
}
Utils.Q(context, bundle, this.I);
}
public final void j(Context context, Bundle bundle, Intent intent) {
Intent launchIntentForPackage;
Bundle k = a0.k(intent);
PendingIntent d = com.clevertap.android.pushtemplates.content.h.d(context, bundle, new Intent(context, (Class<?>) PushTemplateReceiver.class));
this.I = (CleverTapInstanceConfig) bundle.getParcelable("config");
if (k != null) {
CharSequence charSequence = k.getCharSequence("pt_input_reply");
int i = bundle.getInt("notificationId");
if (charSequence == null) {
e.c("PushTemplateReceiver: Input is Empty");
return;
}
e.c("Processing Input from Input Template");
bundle.putString("pt_input_reply", charSequence.toString());
Utils.O(context, this.I, bundle, "pt_input_reply");
NotificationCompat.e eVar = this.x ? new NotificationCompat.e(context, "pt_silent_sound_channel") : new NotificationCompat.e(context);
r(context);
int i2 = Build.VERSION.SDK_INT;
if (i2 >= 31) {
eVar.c0(this.H);
}
eVar.W(this.w).z(this.n).y(bundle.getString("pt_input_feedback")).e0(1300L).D(d).i0(System.currentTimeMillis()).o(true);
s(this.A, bundle, context, eVar, this.B);
this.y.notify(i, eVar.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")));
Utils.T(context, launchIntentForPackage);
}
launchIntentForPackage.putExtras(bundle);
launchIntentForPackage.putExtra("pt_reply", charSequence);
launchIntentForPackage.removeExtra("wzrk_acts");
launchIntentForPackage.setFlags(872415232);
context.startActivity(launchIntentForPackage);
}
}
}
}
public final void k(Context context, Bundle bundle) {
int size;
try {
int i = bundle.getInt("notificationId");
Notification A = Utils.A(context, i);
if (A == null) {
e.c("Manual Carousel Notification is null, returning");
return;
}
RemoteViews remoteViews = A.bigContentView;
this.k = remoteViews;
this.i = A.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(i.f);
this.k.showNext(i.h);
this.k.showNext(i.g);
size = i2 == this.r.size() - 1 ? 0 : i2 + 1;
} else {
this.k.showPrevious(i.f);
this.k.showPrevious(i.h);
this.k.showPrevious(i.g);
size = i2 == 0 ? this.r.size() - 1 : i2 - 1;
}
String str = "";
ArrayList<String> arrayList = this.s;
if (arrayList == null || arrayList.size() != this.r.size()) {
ArrayList<String> arrayList2 = this.s;
if (arrayList2 == null || arrayList2.size() != 1) {
ArrayList<String> arrayList3 = this.s;
if (arrayList3 == null || arrayList3.size() <= size) {
ArrayList<String> arrayList4 = this.s;
if (arrayList4 != null && arrayList4.size() < size) {
str = this.s.get(0);
}
} else {
str = this.s.get(size);
}
} else {
str = this.s.get(0);
}
} else {
str = 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(i.w, com.clevertap.android.pushtemplates.content.h.b(context, i, bundle, false, 4, null));
this.k.setOnClickPendingIntent(i.r, com.clevertap.android.pushtemplates.content.h.b(context, i, bundle, false, 5, null));
PendingIntent b2 = com.clevertap.android.pushtemplates.content.h.b(context, i, bundle, true, 3, null);
NotificationCompat.e eVar = new NotificationCompat.e(context, A);
PendingIntent b3 = com.clevertap.android.pushtemplates.content.h.b(context, i, bundle, false, 6, null);
r(context);
q(eVar, this.i, this.k, this.n, b2, b3);
this.y.notify(i, eVar.g());
} catch (Throwable th) {
e.d("Error creating manual carousel notification ", th);
}
}
public final 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");
}
@SuppressLint({"MissingPermission"})
public final void m(Context context, Bundle bundle, int i, String str, CleverTapInstanceConfig cleverTapInstanceConfig) throws InterruptedException {
Intent launchIntentForPackage;
Thread.sleep(1000L);
this.y.cancel(i);
t(context, this.G, 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")));
com.clevertap.android.sdk.Utils.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 final void n(Context context, Bundle bundle, Intent intent) {
Class<CTNotificationIntentService> cls;
try {
int i = bundle.getInt("notificationId");
if (bundle.getBoolean("default_dl", false)) {
this.I = (CleverTapInstanceConfig) bundle.getParcelable("config");
this.y.cancel(i);
try {
cls = CTNotificationIntentService.class;
String str = CTNotificationIntentService.MAIN_ACTION;
} catch (ClassNotFoundException unused) {
e.a("No Intent Service found");
cls = null;
}
if (com.clevertap.android.sdk.Utils.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.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);
Utils.Q(context, bundle, this.I);
intent3.putExtras(bundle);
intent3.putExtra("wzrk_dl", this.q);
context.startActivity(intent3);
return;
}
String str2 = this.s.get(0);
if (1 == bundle.getInt("clickedStar", 0)) {
bundle.putString("wzrk_c2a", "rating_1");
if (this.s.size() > 0) {
str2 = this.s.get(0);
}
}
if (2 == bundle.getInt("clickedStar", 0)) {
bundle.putString("wzrk_c2a", "rating_2");
str2 = this.s.size() > 1 ? this.s.get(1) : this.s.get(0);
}
if (3 == bundle.getInt("clickedStar", 0)) {
bundle.putString("wzrk_c2a", "rating_3");
str2 = this.s.size() > 2 ? this.s.get(2) : this.s.get(0);
}
if (4 == bundle.getInt("clickedStar", 0)) {
bundle.putString("wzrk_c2a", "rating_4");
str2 = this.s.size() > 3 ? this.s.get(3) : this.s.get(0);
}
if (5 == bundle.getInt("clickedStar", 0)) {
bundle.putString("wzrk_c2a", "rating_5");
str2 = this.s.size() > 4 ? this.s.get(4) : this.s.get(0);
}
String str3 = str2;
int i2 = Build.VERSION.SDK_INT;
Notification A = Utils.A(context, i);
if (A == null) {
e.c("Rating Notification is null, returning");
return;
}
this.j = A.bigContentView;
this.i = A.contentView;
if (1 == bundle.getInt("clickedStar", 0)) {
this.j.setImageViewResource(i.C, h.b);
this.a = false;
} else {
this.j.setImageViewResource(i.C, h.c);
}
if (2 == bundle.getInt("clickedStar", 0)) {
this.j.setImageViewResource(i.C, h.b);
this.j.setImageViewResource(i.D, h.b);
this.b = false;
} else {
this.j.setImageViewResource(i.D, h.c);
}
if (3 == bundle.getInt("clickedStar", 0)) {
this.j.setImageViewResource(i.C, h.b);
this.j.setImageViewResource(i.D, h.b);
this.j.setImageViewResource(i.E, h.b);
this.c = false;
} else {
this.j.setImageViewResource(i.E, h.c);
}
if (4 == bundle.getInt("clickedStar", 0)) {
this.j.setImageViewResource(i.C, h.b);
this.j.setImageViewResource(i.D, h.b);
this.j.setImageViewResource(i.E, h.b);
this.j.setImageViewResource(i.F, h.b);
this.d = false;
} else {
this.j.setImageViewResource(i.F, h.c);
}
if (5 == bundle.getInt("clickedStar", 0)) {
this.j.setImageViewResource(i.C, h.b);
this.j.setImageViewResource(i.D, h.b);
this.j.setImageViewResource(i.E, h.b);
this.j.setImageViewResource(i.F, h.b);
this.j.setImageViewResource(i.G, h.b);
this.e = false;
} else {
this.j.setImageViewResource(i.G, h.c);
}
h(context, intent);
bundle.putString("wzrk_dl", str3);
this.j.setOnClickPendingIntent(i.I, LaunchPendingIntentFactory.a(bundle, context));
r(context);
NotificationCompat.e eVar = new NotificationCompat.e(context, A);
PendingIntent d = com.clevertap.android.pushtemplates.content.h.d(context, bundle, new Intent(context, (Class<?>) PushTemplateReceiver.class));
if (this.y != null) {
eVar.W(this.w).B(this.i).A(this.j).z(this.n).D(d).o(true);
this.y.notify(i, eVar.g());
}
Utils.P(context, this.I, "Rating Submitted", Utils.c(bundle));
if (i2 < 31) {
m(context, bundle, i, str3, this.I);
}
} catch (Throwable th) {
e.d("Error creating rating notification ", th);
}
}
public final void o(RemoteViews remoteViews, Context context) {
remoteViews.setTextViewText(i.c, Utils.m(context));
remoteViews.setTextViewText(i.J, Utils.E(context, System.currentTimeMillis()));
String str = this.H;
if (str == null || str.isEmpty()) {
remoteViews.setViewVisibility(i.H, 8);
remoteViews.setViewVisibility(i.x, 8);
} else {
remoteViews.setTextViewText(i.H, Html.fromHtml(this.H, 0));
}
String str2 = this.E;
if (str2 == null || str2.isEmpty()) {
return;
}
remoteViews.setTextColor(i.c, Utils.p(this.E, "#A6A6A6"));
remoteViews.setTextColor(i.J, Utils.p(this.E, "#A6A6A6"));
remoteViews.setTextColor(i.H, Utils.p(this.E, "#A6A6A6"));
}
@Override
public void onReceive(Context context, Intent intent) {
Utils.e(context);
if (intent.getExtras() != null) {
Bundle extras = intent.getExtras();
this.g = n0.x0(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.s = Utils.s(extras);
this.t = Utils.n(extras);
this.u = Utils.D(extras);
this.v = Utils.C(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_big_img_alt_alt_text", context.getString(k.a));
this.C = extras.getString("pt_small_icon_clr");
this.x = Build.VERSION.SDK_INT >= 26;
this.F = extras.getBoolean("pt_dismiss_intent", false);
this.G = extras.getString("pt_rating_toast");
this.H = extras.getString("pt_subtitle");
p(extras);
String str = this.l;
if (str != null) {
this.m = n.fromString(str);
}
n0 n0Var = this.g;
if (n0Var == null) {
e.c("clevertap instance is null, not running PushTemplateReceiver#renderNotification");
return;
}
try {
CleverTapInstanceConfig g = n0Var.m0().g();
this.I = g;
CTExecutorFactory.a(g).c().g("PushTemplateReceiver#renderNotification", new a(context, intent, extras));
} catch (Exception e) {
e.c("Couldn't render notification: " + e.getLocalizedMessage());
}
}
}
public final 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.D;
if (str4 == null || str4.isEmpty()) {
this.D = bundle.getString("wzrk_bp");
}
String str5 = this.q;
if (str5 == null || str5.isEmpty()) {
this.q = bundle.getString("wzrk_dl");
}
String str6 = this.E;
if (str6 == null || str6.isEmpty()) {
this.E = bundle.getString("wzrk_clr");
}
String str7 = this.C;
if (str7 == null || str7.isEmpty()) {
this.C = bundle.getString("wzrk_clr");
}
String str8 = this.H;
if (str8 == null || str8.isEmpty()) {
this.H = bundle.getString("wzrk_st");
}
}
public final void q(NotificationCompat.e eVar, RemoteViews remoteViews, RemoteViews remoteViews2, String str, PendingIntent pendingIntent, PendingIntent pendingIntent2) {
eVar.W(this.w).B(remoteViews).A(remoteViews2).z(Html.fromHtml(str)).D(pendingIntent2).x(pendingIntent).C(5).i0(System.currentTimeMillis()).o(true);
}
public final void r(Context context) {
try {
String a2 = Utils.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 = Utils.l(context);
}
}
public final void s(String str, Bundle bundle, Context context, NotificationCompat.e eVar, String str2) {
if (str != null && str.startsWith("http")) {
try {
Bitmap z = Utils.z(str, false, context);
if (z == null) {
throw new Exception("Failed to fetch big picture!");
}
NotificationCompat.BigPictureStyle v = new NotificationCompat.BigPictureStyle().y(bundle.getString("pt_input_feedback")).v(z);
if (Build.VERSION.SDK_INT >= 31) {
v.x(str2);
}
eVar.b0(v);
return;
} catch (Throwable th) {
e.d("Falling back to big text notification, couldn't fetch big picture", th);
}
}
eVar.b0(new NotificationCompat.BigTextStyle().t(bundle.getString("pt_input_feedback")));
}
public final void t(Context context, String str, CleverTapInstanceConfig cleverTapInstanceConfig) {
if (str == null || str.isEmpty()) {
return;
}
Utils.U(context, str, cleverTapInstanceConfig);
}
}