正在查看: Vi App v10.18.0 应用的 PushTemplateReceiver.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Vi App v10.18.0 应用的 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.RemoteInput;
import androidx.core.text.b;
import com.clevertap.android.pushtemplates.content.PendingIntentFactory;
import com.clevertap.android.sdk.CleverTapAPI;
import com.clevertap.android.sdk.CleverTapInstanceConfig;
import com.clevertap.android.sdk.Constants;
import com.clevertap.android.sdk.ManifestInfo;
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 {
private CleverTapAPI cleverTapAPI;
private CleverTapInstanceConfig config;
private RemoteViews contentViewBig;
private RemoteViews contentViewManualCarousel;
private RemoteViews contentViewRating;
private RemoteViews contentViewSmall;
private NotificationManager notificationManager;
private String pt_big_img;
private String pt_big_img_alt;
private boolean pt_dismiss_intent;
private String pt_id;
private String pt_meta_clr;
private String pt_msg;
private String pt_msg_summary;
private String pt_product_display_linear;
private String pt_rating_default_dl;
private String pt_rating_toast;
private String pt_small_icon_clr;
private String pt_subtitle;
private String pt_title;
private boolean requiresChannelId;
private TemplateType templateType;
public boolean clicked1 = true;
public boolean clicked2 = true;
public boolean clicked3 = true;
public boolean clicked4 = true;
public boolean clicked5 = true;
public boolean close = true;
private ArrayList<String> imageList = new ArrayList<>();
private ArrayList<String> deepLinkList = new ArrayList<>();
private ArrayList<String> bigTextList = new ArrayList<>();
private ArrayList<String> smallTextList = new ArrayList<>();
private ArrayList<String> priceList = new ArrayList<>();
private int smallIcon = 0;
public static class AnonymousClass2 {
public static final int[] $SwitchMap$com$clevertap$android$pushtemplates$TemplateType;
static {
int[] iArr = new int[TemplateType.values().length];
$SwitchMap$com$clevertap$android$pushtemplates$TemplateType = iArr;
try {
iArr[TemplateType.RATING.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$clevertap$android$pushtemplates$TemplateType[TemplateType.FIVE_ICONS.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$com$clevertap$android$pushtemplates$TemplateType[TemplateType.PRODUCT_DISPLAY.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$com$clevertap$android$pushtemplates$TemplateType[TemplateType.INPUT_BOX.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$com$clevertap$android$pushtemplates$TemplateType[TemplateType.MANUAL_CAROUSEL.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
}
}
private void cancelRatingClickIntents(Context context, Intent intent) {
for (int i : intent.getIntArrayExtra(PTConstants.KEY_REQUEST_CODES)) {
PendingIntent.getBroadcast(context, i, intent, 201326592).cancel();
}
}
public void handleFiveCTANotification(Context context, Bundle bundle) {
int i = bundle.getInt("notificationId");
bundle.putString(Constants.DEEP_LINK_KEY, null);
if (this.close == bundle.getBoolean(Constants.KEY_HIDE_CLOSE)) {
bundle.putString(Constants.KEY_C2A, "5cta_close");
this.notificationManager.cancel(i);
}
Utils.raiseNotificationClicked(context, bundle, this.config);
}
public void handleInputBoxNotification(Context context, Bundle bundle, Intent intent) {
Intent launchIntentForPackage;
Bundle resultsFromIntent = RemoteInput.getResultsFromIntent(intent);
PendingIntent dismissIntent = PendingIntentFactory.setDismissIntent(context, bundle, new Intent(context, (Class<?>) PushTemplateReceiver.class));
this.config = (CleverTapInstanceConfig) bundle.getParcelable(Constants.KEY_CONFIG);
if (resultsFromIntent != null) {
CharSequence charSequence = resultsFromIntent.getCharSequence("pt_input_reply");
int i = bundle.getInt("notificationId");
if (charSequence == null) {
PTLog.verbose("PushTemplateReceiver: Input is Empty");
return;
}
PTLog.verbose("Processing Input from Input Template");
bundle.putString("pt_input_reply", charSequence.toString());
Utils.raiseCleverTapEvent(context, this.config, bundle, "pt_input_reply");
NotificationCompat.Builder builder = this.requiresChannelId ? new NotificationCompat.Builder(context, PTConstants.PT_SILENT_CHANNEL_ID) : new NotificationCompat.Builder(context);
setSmallIcon(context);
int i2 = Build.VERSION.SDK_INT;
if (i2 >= 31) {
builder.setSubText(this.pt_subtitle);
}
builder.setSmallIcon(this.smallIcon).setContentTitle(this.pt_title).setContentText(bundle.getString(PTConstants.PT_INPUT_FEEDBACK)).setTimeoutAfter(1300L).setDeleteIntent(dismissIntent).setWhen(System.currentTimeMillis()).setAutoCancel(true);
setStandardViewBigImageStyle(this.pt_big_img_alt, bundle, context, builder);
this.notificationManager.notify(i, builder.build());
if (i2 < 31) {
if (bundle.getString(PTConstants.PT_INPUT_AUTO_OPEN) != null || bundle.getBoolean(PTConstants.PT_INPUT_AUTO_OPEN)) {
try {
Thread.sleep(1300L);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (!bundle.containsKey(Constants.DEEP_LINK_KEY) || bundle.getString(Constants.DEEP_LINK_KEY) == null) {
launchIntentForPackage = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
if (launchIntentForPackage == null) {
return;
}
} else {
launchIntentForPackage = new Intent("android.intent.action.VIEW", Uri.parse(intent.getStringExtra(Constants.DEEP_LINK_KEY)));
Utils.setPackageNameFromResolveInfoList(context, launchIntentForPackage);
}
launchIntentForPackage.putExtras(bundle);
launchIntentForPackage.putExtra("pt_reply", charSequence);
launchIntentForPackage.removeExtra(Constants.WZRK_ACTIONS);
launchIntentForPackage.setFlags(872415232);
context.startActivity(launchIntentForPackage);
}
}
}
}
public void handleManualCarouselNotification(Context context, Bundle bundle) {
int size;
try {
int i = bundle.getInt("notificationId");
Notification notificationById = Utils.getNotificationById(context, i);
if (notificationById == null) {
PTLog.verbose("Manual Carousel Notification is null, returning");
return;
}
RemoteViews remoteViews = notificationById.bigContentView;
this.contentViewManualCarousel = remoteViews;
this.contentViewSmall = notificationById.contentView;
setCustomContentViewBasicKeys(remoteViews, context);
boolean z = bundle.getBoolean(PTConstants.PT_RIGHT_SWIPE);
this.imageList = bundle.getStringArrayList(PTConstants.PT_IMAGE_LIST);
this.deepLinkList = bundle.getStringArrayList(PTConstants.PT_DEEPLINK_LIST);
int i2 = bundle.getInt(PTConstants.PT_MANUAL_CAROUSEL_CURRENT);
if (z) {
this.contentViewManualCarousel.showNext(R.id.carousel_image);
this.contentViewManualCarousel.showNext(R.id.carousel_image_right);
this.contentViewManualCarousel.showNext(R.id.carousel_image_left);
size = i2 == this.imageList.size() - 1 ? 0 : i2 + 1;
} else {
this.contentViewManualCarousel.showPrevious(R.id.carousel_image);
this.contentViewManualCarousel.showPrevious(R.id.carousel_image_right);
this.contentViewManualCarousel.showPrevious(R.id.carousel_image_left);
size = i2 == 0 ? this.imageList.size() - 1 : i2 - 1;
}
String str = "";
ArrayList<String> arrayList = this.deepLinkList;
if (arrayList == null || arrayList.size() != this.imageList.size()) {
ArrayList<String> arrayList2 = this.deepLinkList;
if (arrayList2 == null || arrayList2.size() != 1) {
ArrayList<String> arrayList3 = this.deepLinkList;
if (arrayList3 == null || arrayList3.size() <= size) {
ArrayList<String> arrayList4 = this.deepLinkList;
if (arrayList4 != null && arrayList4.size() < size) {
str = this.deepLinkList.get(0);
}
} else {
str = this.deepLinkList.get(size);
}
} else {
str = this.deepLinkList.get(0);
}
} else {
str = this.deepLinkList.get(size);
}
bundle.putInt(PTConstants.PT_MANUAL_CAROUSEL_CURRENT, size);
bundle.remove(PTConstants.PT_RIGHT_SWIPE);
bundle.putString(Constants.DEEP_LINK_KEY, str);
bundle.putInt(PTConstants.PT_MANUAL_CAROUSEL_FROM, i2);
this.contentViewManualCarousel.setOnClickPendingIntent(R.id.rightArrowPos0, PendingIntentFactory.getPendingIntent(context, i, bundle, false, 4, null));
this.contentViewManualCarousel.setOnClickPendingIntent(R.id.leftArrowPos0, PendingIntentFactory.getPendingIntent(context, i, bundle, false, 5, null));
PendingIntent pendingIntent = PendingIntentFactory.getPendingIntent(context, i, bundle, true, 3, null);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, notificationById);
PendingIntent pendingIntent2 = PendingIntentFactory.getPendingIntent(context, i, bundle, false, 6, null);
setSmallIcon(context);
setNotificationBuilderBasics(builder, this.contentViewSmall, this.contentViewManualCarousel, this.pt_title, pendingIntent, pendingIntent2);
this.notificationManager.notify(i, builder.build());
} catch (Throwable th) {
PTLog.verbose("Error creating manual carousel notification ", th);
}
}
public void handleProductDisplayNotification(Context context, Bundle bundle) {
try {
int i = bundle.getInt("notificationId");
Notification notificationById = Utils.getNotificationById(context, i);
if (notificationById == null) {
PTLog.verbose("Product Display Notification is null, returning");
return;
}
this.contentViewBig = notificationById.bigContentView;
this.contentViewSmall = notificationById.contentView;
boolean z = false;
String str = this.pt_product_display_linear;
if (str != null && !str.isEmpty()) {
z = true;
}
setCustomContentViewBasicKeys(this.contentViewBig, context);
if (!z) {
setCustomContentViewBasicKeys(this.contentViewSmall, context);
}
int i2 = bundle.getInt(PTConstants.PT_CURRENT_POSITION);
this.contentViewBig.setDisplayedChild(R.id.carousel_image, i2);
this.imageList = bundle.getStringArrayList(PTConstants.PT_IMAGE_LIST);
this.deepLinkList = bundle.getStringArrayList(PTConstants.PT_DEEPLINK_LIST);
this.bigTextList = bundle.getStringArrayList(PTConstants.PT_BIGTEXT_LIST);
this.smallTextList = bundle.getStringArrayList(PTConstants.PT_SMALLTEXT_LIST);
this.priceList = bundle.getStringArrayList(PTConstants.PT_PRICE_LIST);
String str2 = this.deepLinkList.get(i2);
if (z) {
this.contentViewBig.setTextViewText(R.id.product_name, this.bigTextList.get(i2));
} else {
this.contentViewBig.setTextViewText(R.id.title, this.bigTextList.get(i2));
}
this.contentViewBig.setTextViewText(R.id.msg, this.smallTextList.get(i2));
this.contentViewBig.setTextViewText(R.id.product_price, this.priceList.get(i2));
bundle.remove(PTConstants.PT_CURRENT_POSITION);
Bundle bundle2 = (Bundle) bundle.clone();
bundle2.putBoolean(PTConstants.PT_IMAGE_1, true);
bundle2.putInt("notificationId", i);
bundle2.putString(PTConstants.PT_BUY_NOW_DL, str2);
bundle2.putBoolean(PTConstants.PT_BUY_NOW, true);
this.contentViewBig.setOnClickPendingIntent(R.id.product_action, PendingIntentFactory.getCtaLaunchPendingIntent(context, bundle2, str2, i));
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, notificationById);
Bundle bundle3 = (Bundle) bundle.clone();
bundle3.putString(Constants.DEEP_LINK_KEY, str2);
PendingIntent pendingIntent = PendingIntentFactory.getPendingIntent(context, i, bundle3, true, 20, null);
if (this.notificationManager != null) {
PendingIntent dismissIntent = PendingIntentFactory.setDismissIntent(context, bundle, new Intent(context, (Class<?>) PushTemplateReceiver.class));
setSmallIcon(context);
setNotificationBuilderBasics(builder, this.contentViewSmall, this.contentViewBig, this.pt_title, pendingIntent, dismissIntent);
this.notificationManager.notify(i, builder.build());
}
} catch (Throwable th) {
PTLog.verbose("Error creating product display notification ", th);
}
}
@SuppressLint({"MissingPermission"})
private void handleRatingDeepLink(Context context, Bundle bundle, int i, String str, CleverTapInstanceConfig cleverTapInstanceConfig) throws InterruptedException {
Intent launchIntentForPackage;
Thread.sleep(1000L);
this.notificationManager.cancel(i);
setToast(context, this.pt_rating_toast, cleverTapInstanceConfig);
context.sendBroadcast(new Intent("android.intent.action.CLOSE_SYSTEM_DIALOGS"));
if (bundle.containsKey(Constants.DEEP_LINK_KEY)) {
launchIntentForPackage = new Intent("android.intent.action.VIEW", Uri.parse(bundle.getString(Constants.DEEP_LINK_KEY)));
com.clevertap.android.sdk.Utils.setPackageNameFromResolveInfoList(context, launchIntentForPackage);
} else {
launchIntentForPackage = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
if (launchIntentForPackage == null) {
return;
}
}
launchIntentForPackage.putExtras(bundle);
launchIntentForPackage.putExtra(Constants.DEEP_LINK_KEY, str);
launchIntentForPackage.removeExtra(Constants.WZRK_ACTIONS);
launchIntentForPackage.putExtra(Constants.WZRK_FROM_KEY, Constants.WZRK_FROM);
launchIntentForPackage.setFlags(872415232);
context.startActivity(launchIntentForPackage);
}
public void handleRatingNotification(Context context, Bundle bundle, Intent intent) {
try {
int i = bundle.getInt("notificationId");
if (bundle.getBoolean(PTConstants.DEFAULT_DL, false)) {
this.config = (CleverTapInstanceConfig) bundle.getParcelable(Constants.KEY_CONFIG);
this.notificationManager.cancel(i);
Class<?> cls = null;
try {
cls = Class.forName("com.clevertap.android.sdk.pushnotification.CTNotificationIntentService");
} catch (ClassNotFoundException unused) {
PTLog.debug("No Intent Service found");
}
if (com.clevertap.android.sdk.Utils.isServiceAvailable(context, cls)) {
Intent intent2 = new Intent(CTNotificationIntentService.MAIN_ACTION);
intent2.setPackage(context.getPackageName());
intent2.putExtra(Constants.KEY_CT_TYPE, CTNotificationIntentService.TYPE_BUTTON_CLICK);
intent2.putExtras(bundle);
intent2.putExtra("dl", this.pt_rating_default_dl);
context.startService(intent2);
return;
}
Intent intent3 = new Intent("android.intent.action.VIEW", Uri.parse(this.pt_rating_default_dl));
intent3.removeExtra(Constants.WZRK_ACTIONS);
intent3.putExtra(Constants.WZRK_FROM_KEY, Constants.WZRK_FROM);
intent3.setFlags(872415232);
Utils.raiseNotificationClicked(context, bundle, this.config);
intent3.putExtras(bundle);
intent3.putExtra(Constants.DEEP_LINK_KEY, this.pt_rating_default_dl);
context.startActivity(intent3);
return;
}
String str = this.deepLinkList.get(0);
if (1 == bundle.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {
bundle.putString(Constants.KEY_C2A, "rating_1");
if (this.deepLinkList.size() > 0) {
str = this.deepLinkList.get(0);
}
}
if (2 == bundle.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {
bundle.putString(Constants.KEY_C2A, "rating_2");
str = this.deepLinkList.size() > 1 ? this.deepLinkList.get(1) : this.deepLinkList.get(0);
}
if (3 == bundle.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {
bundle.putString(Constants.KEY_C2A, "rating_3");
str = this.deepLinkList.size() > 2 ? this.deepLinkList.get(2) : this.deepLinkList.get(0);
}
if (4 == bundle.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {
bundle.putString(Constants.KEY_C2A, "rating_4");
str = this.deepLinkList.size() > 3 ? this.deepLinkList.get(3) : this.deepLinkList.get(0);
}
if (5 == bundle.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {
bundle.putString(Constants.KEY_C2A, "rating_5");
str = this.deepLinkList.size() > 4 ? this.deepLinkList.get(4) : this.deepLinkList.get(0);
}
String str2 = str;
int i2 = Build.VERSION.SDK_INT;
Notification notificationById = Utils.getNotificationById(context, i);
if (notificationById == null) {
PTLog.verbose("Rating Notification is null, returning");
return;
}
this.contentViewRating = notificationById.bigContentView;
this.contentViewSmall = notificationById.contentView;
if (1 == bundle.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {
this.contentViewRating.setImageViewResource(R.id.star1, R.drawable.pt_star_filled);
this.clicked1 = false;
} else {
this.contentViewRating.setImageViewResource(R.id.star1, R.drawable.pt_star_outline);
}
if (2 == bundle.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {
RemoteViews remoteViews = this.contentViewRating;
int i3 = R.id.star1;
int i4 = R.drawable.pt_star_filled;
remoteViews.setImageViewResource(i3, i4);
this.contentViewRating.setImageViewResource(R.id.star2, i4);
this.clicked2 = false;
} else {
this.contentViewRating.setImageViewResource(R.id.star2, R.drawable.pt_star_outline);
}
if (3 == bundle.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {
RemoteViews remoteViews2 = this.contentViewRating;
int i5 = R.id.star1;
int i6 = R.drawable.pt_star_filled;
remoteViews2.setImageViewResource(i5, i6);
this.contentViewRating.setImageViewResource(R.id.star2, i6);
this.contentViewRating.setImageViewResource(R.id.star3, i6);
this.clicked3 = false;
} else {
this.contentViewRating.setImageViewResource(R.id.star3, R.drawable.pt_star_outline);
}
if (4 == bundle.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {
RemoteViews remoteViews3 = this.contentViewRating;
int i7 = R.id.star1;
int i8 = R.drawable.pt_star_filled;
remoteViews3.setImageViewResource(i7, i8);
this.contentViewRating.setImageViewResource(R.id.star2, i8);
this.contentViewRating.setImageViewResource(R.id.star3, i8);
this.contentViewRating.setImageViewResource(R.id.star4, i8);
this.clicked4 = false;
} else {
this.contentViewRating.setImageViewResource(R.id.star4, R.drawable.pt_star_outline);
}
if (5 == bundle.getInt(PTConstants.KEY_CLICKED_STAR, 0)) {
RemoteViews remoteViews4 = this.contentViewRating;
int i9 = R.id.star1;
int i10 = R.drawable.pt_star_filled;
remoteViews4.setImageViewResource(i9, i10);
this.contentViewRating.setImageViewResource(R.id.star2, i10);
this.contentViewRating.setImageViewResource(R.id.star3, i10);
this.contentViewRating.setImageViewResource(R.id.star4, i10);
this.contentViewRating.setImageViewResource(R.id.star5, i10);
this.clicked5 = false;
} else {
this.contentViewRating.setImageViewResource(R.id.star5, R.drawable.pt_star_outline);
}
cancelRatingClickIntents(context, intent);
bundle.putString(Constants.DEEP_LINK_KEY, str2);
this.contentViewRating.setOnClickPendingIntent(R.id.tVRatingConfirmation, LaunchPendingIntentFactory.getActivityIntent(bundle, context));
setSmallIcon(context);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, notificationById);
PendingIntent dismissIntent = PendingIntentFactory.setDismissIntent(context, bundle, new Intent(context, (Class<?>) PushTemplateReceiver.class));
if (this.notificationManager != null) {
builder.setSmallIcon(this.smallIcon).setCustomContentView(this.contentViewSmall).setCustomBigContentView(this.contentViewRating).setContentTitle(this.pt_title).setDeleteIntent(dismissIntent).setAutoCancel(true);
this.notificationManager.notify(i, builder.build());
}
Utils.raiseCleverTapEvent(context, this.config, "Rating Submitted", Utils.convertRatingBundleObjectToHashMap(bundle));
if (i2 < 31) {
handleRatingDeepLink(context, bundle, i, str2, this.config);
}
} catch (Throwable th) {
PTLog.verbose("Error creating rating notification ", th);
}
}
private void setCustomContentViewBasicKeys(RemoteViews remoteViews, Context context) {
int i = R.id.app_name;
remoteViews.setTextViewText(i, Utils.getApplicationName(context));
int i2 = R.id.timestamp;
remoteViews.setTextViewText(i2, Utils.getTimeStamp(context));
String str = this.pt_subtitle;
if (str == null || str.isEmpty()) {
remoteViews.setViewVisibility(R.id.subtitle, 8);
remoteViews.setViewVisibility(R.id.sep_subtitle, 8);
} else if (Build.VERSION.SDK_INT >= 24) {
remoteViews.setTextViewText(R.id.subtitle, b.a(this.pt_subtitle, 0));
} else {
remoteViews.setTextViewText(R.id.subtitle, Html.fromHtml(this.pt_subtitle));
}
String str2 = this.pt_meta_clr;
if (str2 == null || str2.isEmpty()) {
return;
}
remoteViews.setTextColor(i, Utils.getColour(this.pt_meta_clr, "#A6A6A6"));
remoteViews.setTextColor(i2, Utils.getColour(this.pt_meta_clr, "#A6A6A6"));
remoteViews.setTextColor(R.id.subtitle, Utils.getColour(this.pt_meta_clr, "#A6A6A6"));
}
private void setKeysFromDashboard(Bundle bundle) {
String str = this.pt_title;
if (str == null || str.isEmpty()) {
this.pt_title = bundle.getString(Constants.NOTIF_TITLE);
}
String str2 = this.pt_msg;
if (str2 == null || str2.isEmpty()) {
this.pt_msg = bundle.getString(Constants.NOTIF_MSG);
}
String str3 = this.pt_msg_summary;
if (str3 == null || str3.isEmpty()) {
this.pt_msg_summary = bundle.getString(Constants.WZRK_MSG_SUMMARY);
}
String str4 = this.pt_big_img;
if (str4 == null || str4.isEmpty()) {
this.pt_big_img = bundle.getString(Constants.WZRK_BIG_PICTURE);
}
String str5 = this.pt_rating_default_dl;
if (str5 == null || str5.isEmpty()) {
this.pt_rating_default_dl = bundle.getString(Constants.DEEP_LINK_KEY);
}
String str6 = this.pt_meta_clr;
if (str6 == null || str6.isEmpty()) {
this.pt_meta_clr = bundle.getString(Constants.WZRK_COLOR);
}
String str7 = this.pt_small_icon_clr;
if (str7 == null || str7.isEmpty()) {
this.pt_small_icon_clr = bundle.getString(Constants.WZRK_COLOR);
}
String str8 = this.pt_subtitle;
if (str8 == null || str8.isEmpty()) {
this.pt_subtitle = bundle.getString(Constants.WZRK_SUBTITLE);
}
String str9 = this.pt_small_icon_clr;
if (str9 == null || str9.isEmpty()) {
this.pt_small_icon_clr = bundle.getString(Constants.WZRK_COLOR);
}
}
private void setNotificationBuilderBasics(NotificationCompat.Builder builder, RemoteViews remoteViews, RemoteViews remoteViews2, String str, PendingIntent pendingIntent, PendingIntent pendingIntent2) {
builder.setSmallIcon(this.smallIcon).setCustomContentView(remoteViews).setCustomBigContentView(remoteViews2).setContentTitle(Html.fromHtml(str)).setDeleteIntent(pendingIntent2).setContentIntent(pendingIntent).setDefaults(5).setWhen(System.currentTimeMillis()).setAutoCancel(true);
}
private void setSmallIcon(Context context) {
try {
String _getManifestStringValueForKey = Utils._getManifestStringValueForKey(context.getPackageManager().getApplicationInfo(context.getPackageName(), 128).metaData, ManifestInfo.LABEL_NOTIFICATION_ICON);
if (_getManifestStringValueForKey == null) {
throw new IllegalArgumentException();
}
int identifier = context.getResources().getIdentifier(_getManifestStringValueForKey, "drawable", context.getPackageName());
this.smallIcon = identifier;
if (identifier == 0) {
throw new IllegalArgumentException();
}
} catch (Throwable unused) {
this.smallIcon = Utils.getAppIconAsIntId(context);
}
}
private void setStandardViewBigImageStyle(String str, Bundle bundle, Context context, NotificationCompat.Builder builder) {
NotificationCompat.BigPictureStyle bigText;
if (str == null || !str.startsWith("http")) {
bigText = new NotificationCompat.BigTextStyle().bigText(bundle.getString(PTConstants.PT_INPUT_FEEDBACK));
} else {
try {
Bitmap notificationBitmap = Utils.getNotificationBitmap(str, false, context);
if (notificationBitmap == null) {
throw new Exception("Failed to fetch big picture!");
}
bigText = new NotificationCompat.BigPictureStyle().setSummaryText(bundle.getString(PTConstants.PT_INPUT_FEEDBACK)).bigPicture(notificationBitmap);
} catch (Throwable th) {
NotificationCompat.BigPictureStyle bigText2 = new NotificationCompat.BigTextStyle().bigText(bundle.getString(PTConstants.PT_INPUT_FEEDBACK));
PTLog.verbose("Falling back to big text notification, couldn't fetch big picture", th);
bigText = bigText2;
}
}
builder.setStyle(bigText);
}
private void setToast(Context context, String str, CleverTapInstanceConfig cleverTapInstanceConfig) {
if (str == null || str.isEmpty()) {
return;
}
Utils.showToast(context, str, cleverTapInstanceConfig);
}
@Override
public void onReceive(final Context context, final Intent intent) {
Utils.createSilentNotificationChannel(context);
if (intent.getExtras() != null) {
final Bundle extras = intent.getExtras();
this.cleverTapAPI = CleverTapAPI.getGlobalInstance(context, extras.getString(Constants.WZRK_ACCT_ID_KEY));
this.pt_id = intent.getStringExtra(PTConstants.PT_ID);
this.pt_msg = extras.getString(PTConstants.PT_MSG);
this.pt_msg_summary = extras.getString(PTConstants.PT_MSG_SUMMARY);
this.pt_title = extras.getString(PTConstants.PT_TITLE);
this.pt_rating_default_dl = extras.getString(PTConstants.PT_DEFAULT_DL);
this.imageList = Utils.getImageListFromExtras(extras);
this.deepLinkList = Utils.getDeepLinkListFromExtras(extras);
this.bigTextList = Utils.getBigTextFromExtras(extras);
this.smallTextList = Utils.getSmallTextFromExtras(extras);
this.priceList = Utils.getPriceFromExtras(extras);
this.pt_product_display_linear = extras.getString(PTConstants.PT_PRODUCT_DISPLAY_LINEAR);
this.notificationManager = (NotificationManager) context.getSystemService("notification");
this.pt_big_img_alt = extras.getString(PTConstants.PT_BIG_IMG_ALT);
this.pt_small_icon_clr = extras.getString(PTConstants.PT_SMALL_ICON_COLOUR);
this.requiresChannelId = Build.VERSION.SDK_INT >= 26;
this.pt_dismiss_intent = extras.getBoolean(PTConstants.PT_DISMISS_INTENT, false);
this.pt_rating_toast = extras.getString(PTConstants.PT_RATING_TOAST);
this.pt_subtitle = extras.getString(PTConstants.PT_SUBTITLE);
setKeysFromDashboard(extras);
String str = this.pt_id;
if (str != null) {
this.templateType = TemplateType.fromString(str);
}
CleverTapAPI cleverTapAPI = this.cleverTapAPI;
if (cleverTapAPI == null) {
PTLog.verbose("clevertap instance is null, not running PushTemplateReceiver#renderNotification");
return;
}
try {
CleverTapInstanceConfig config = cleverTapAPI.getCoreState().getConfig();
this.config = config;
CTExecutorFactory.executors(config).postAsyncSafelyTask().execute("PushTemplateReceiver#renderNotification", new Callable<Void>() {
@Override
public Void call() throws Exception {
try {
} catch (Throwable th) {
PTLog.verbose("Couldn't render notification: " + th.getLocalizedMessage());
}
if (PushTemplateReceiver.this.pt_dismiss_intent) {
Utils.deleteSilentNotificationChannel(context);
Utils.deleteImageFromStorage(context, intent);
return null;
}
if (PushTemplateReceiver.this.templateType != null) {
int i = AnonymousClass2.$SwitchMap$com$clevertap$android$pushtemplates$TemplateType[PushTemplateReceiver.this.templateType.ordinal()];
if (i == 1) {
PushTemplateReceiver.this.handleRatingNotification(context, extras, intent);
} else if (i == 2) {
PushTemplateReceiver.this.handleFiveCTANotification(context, extras);
} else if (i == 3) {
PushTemplateReceiver.this.handleProductDisplayNotification(context, extras);
} else if (i == 4) {
PushTemplateReceiver.this.handleInputBoxNotification(context, extras, intent);
} else if (i == 5) {
PushTemplateReceiver.this.handleManualCarouselNotification(context, extras);
}
}
return null;
}
});
} catch (Exception e) {
PTLog.verbose("Couldn't render notification: " + e.getLocalizedMessage());
}
}
}
}