导航菜单

页面标题

页面副标题

Housing v14.7.8 - TemplateHelper.java 源代码

正在查看: Housing v14.7.8 应用的 TemplateHelper.java JAVA 源代码文件

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


package com.moengage.richnotification.internal.builder;

import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Build;
import android.text.Html;
import android.text.Spanned;
import android.util.DisplayMetrics;
import android.widget.ImageView;
import android.widget.RemoteViews;
import androidx.annotation.DrawableRes;
import androidx.core.app.s;
import com.facebook.react.uimanager.a;
import com.moengage.core.internal.logger.Logger;
import com.moengage.core.internal.model.SdkInstance;
import com.moengage.core.internal.utils.CoreUtils;
import com.moengage.pushbase.MoEPushConstants;
import com.moengage.pushbase.internal.CacheStrategy;
import com.moengage.pushbase.internal.ImageHelper;
import com.moengage.pushbase.internal.MapperKt;
import com.moengage.pushbase.internal.MoEPushWorker;
import com.moengage.pushbase.internal.PushConstantsInternal;
import com.moengage.pushbase.internal.UtilsKt;
import com.moengage.pushbase.internal.model.NotificationMetaData;
import com.moengage.pushbase.internal.model.TemplateTrackingMeta;
import com.moengage.pushbase.model.NotificationPayload;
import com.moengage.pushbase.model.action.Action;
import com.moengage.richnotification.R;
import com.moengage.richnotification.internal.Evaluator;
import com.moengage.richnotification.internal.RichPushConstantsKt;
import com.moengage.richnotification.internal.RichPushUtilsKt;
import com.moengage.richnotification.internal.models.Card;
import com.moengage.richnotification.internal.models.ChronometerStyle;
import com.moengage.richnotification.internal.models.CollapsedTemplate;
import com.moengage.richnotification.internal.models.DefaultText;
import com.moengage.richnotification.internal.models.DismissCta;
import com.moengage.richnotification.internal.models.ExpandedTemplate;
import com.moengage.richnotification.internal.models.HeaderStyle;
import com.moengage.richnotification.internal.models.ImageWidget;
import com.moengage.richnotification.internal.models.LayoutStyle;
import com.moengage.richnotification.internal.models.Template;
import com.moengage.richnotification.internal.models.Widget;
import com.moengage.trigger.evaluator.internal.CampaignPathManagerKt;
import com.newrelic.agent.android.analytics.AnalyticsAttribute;
import com.newrelic.agent.android.instrumentation.Instrumented;
import com.newrelic.agent.android.instrumentation.JSONObjectInstrumentation;
import java.util.Iterator;
import java.util.List;
import kotlin.Metadata;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.jvm.internal.c;
import kotlin.jvm.internal.k0;
import kotlin.jvm.internal.r;
import kotlin.text.q;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.JSONArray;
import org.json.JSONObject;

@Metadata(d1 = {"\u0000Â\u0001\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0010\u0011\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010 \n\u0000\n\u0002\u0010\u000b\n\u0002\b\b\n\u0002\u0010\t\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0010\u0007\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b \n\u0002\u0010\u0015\n\u0002\b\u0003\b\u0000\u0018\u00002\u00020\u0001B\u000f\u0012\u0006\u0010\u0003\u001a\u00020\u0002¢\u0006\u0004\b\u0004\u0010\u0005J%\u0010\r\u001a\u00020\f2\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010\t\u001a\u00020\b2\u0006\u0010\u000b\u001a\u00020\n¢\u0006\u0004\b\r\u0010\u000eJ-\u0010\u0015\u001a\u00020\f2\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0010\u001a\u00020\u000f2\u0006\u0010\u0012\u001a\u00020\u00112\u0006\u0010\u0014\u001a\u00020\u0013¢\u0006\u0004\b\u0015\u0010\u0016J%\u0010\u001b\u001a\u00020\f2\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0018\u001a\u00020\u00172\u0006\u0010\u001a\u001a\u00020\u0019¢\u0006\u0004\b\u001b\u0010\u001cJ%\u0010\u001d\u001a\u00020\f2\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010\t\u001a\u00020\b2\u0006\u0010\u000b\u001a\u00020\n¢\u0006\u0004\b\u001d\u0010\u000eJ%\u0010\"\u001a\u00020\f2\u0006\u0010\u001f\u001a\u00020\u001e2\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010!\u001a\u00020 ¢\u0006\u0004\b\"\u0010#J%\u0010'\u001a\u00020$2\u0006\u0010\u0018\u001a\u00020\u00172\u0006\u0010%\u001a\u00020$2\u0006\u0010&\u001a\u00020 ¢\u0006\u0004\b'\u0010(J=\u0010,\u001a\u00020\f2\u0006\u0010\u0018\u001a\u00020\u00172\u0006\u0010\u001a\u001a\u00020\u00192\u0006\u0010)\u001a\u00020\u00112\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010+\u001a\u00020*2\u0006\u0010!\u001a\u00020 ¢\u0006\u0004\b,\u0010-JE\u00100\u001a\u00020\f2\u0006\u0010\u0018\u001a\u00020\u00172\u0006\u0010\u001a\u001a\u00020\u00192\u0006\u0010)\u001a\u00020\u00112\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010+\u001a\u00020*2\u0006\u0010/\u001a\u00020.2\u0006\u0010!\u001a\u00020 ¢\u0006\u0004\b0\u00101J'\u00102\u001a\u00020\f2\b\u0010\u001f\u001a\u0004\u0018\u00010\u001e2\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010!\u001a\u00020 ¢\u0006\u0004\b2\u0010#J%\u00104\u001a\u00020\f2\u0006\u00103\u001a\u00020\u00112\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010!\u001a\u00020 ¢\u0006\u0004\b4\u00105J\u001d\u00106\u001a\u00020\f2\u0006\u0010\u0018\u001a\u00020\u00172\u0006\u0010\u0007\u001a\u00020\u0006¢\u0006\u0004\b6\u00107J\u001b\u0010<\u001a\u00020;2\f\u0010:\u001a\b\u0012\u0004\u0012\u00020908¢\u0006\u0004\b<\u0010=J\u001d\u0010>\u001a\u00020\f2\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0014\u001a\u00020\u0013¢\u0006\u0004\b>\u0010?J\u001d\u0010@\u001a\u00020\f2\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0010\u001a\u00020\u000f¢\u0006\u0004\b@\u0010AJE\u0010H\u001a\u00020\f2\u0006\u0010\u0018\u001a\u00020\u00172\u0006\u0010\u001a\u001a\u00020\u00192\u0006\u0010\t\u001a\u00020\b2\u0006\u0010\u0007\u001a\u00020\u00062\f\u0010C\u001a\b\u0012\u0004\u0012\u00020.0B2\u0006\u0010E\u001a\u00020DH\u0000¢\u0006\u0004\bF\u0010GJ/\u0010K\u001a\u00020D2\u0006\u0010\u0018\u001a\u00020\u00172\u0006\u0010\u001a\u001a\u00020\u00192\u0006\u0010\t\u001a\u00020\b2\u0006\u0010\u0007\u001a\u00020\u0006H\u0000¢\u0006\u0004\bI\u0010JJ'\u0010Q\u001a\u00020D2\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010L\u001a\u00020\u00112\u0006\u0010N\u001a\u00020MH\u0000¢\u0006\u0004\bO\u0010PJ\u0019\u0010U\u001a\u0004\u0018\u00010R2\u0006\u0010/\u001a\u00020.H\u0000¢\u0006\u0004\bS\u0010TJU\u0010[\u001a\u00020D2\u0006\u0010\u0018\u001a\u00020\u00172\u0006\u0010\u001a\u001a\u00020\u00192\u0006\u0010\t\u001a\u00020\b2\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010/\u001a\u00020V2\u0006\u0010+\u001a\u00020*2\n\b\u0002\u0010W\u001a\u0004\u0018\u00010$2\b\b\u0002\u0010X\u001a\u00020 H\u0000¢\u0006\u0004\bY\u0010ZJ\u0017\u0010^\u001a\u00020\f2\u0006\u0010\u0007\u001a\u00020\u0006H\u0000¢\u0006\u0004\b\\\u0010]J3\u0010e\u001a\u00020\f2\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010_\u001a\u00020 2\b\b\u0002\u0010a\u001a\u00020`2\b\b\u0002\u0010b\u001a\u00020 H\u0000¢\u0006\u0004\bc\u0010dJ)\u0010k\u001a\u00020\f2\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010g\u001a\u00020f2\b\b\u0002\u0010h\u001a\u00020DH\u0000¢\u0006\u0004\bi\u0010jJ/\u0010n\u001a\u00020\f2\u0006\u0010\u0018\u001a\u00020\u00172\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010\t\u001a\u00020\b2\u0006\u0010\u001a\u001a\u00020\u0019H\u0000¢\u0006\u0004\bl\u0010mJ/\u0010r\u001a\u00020\f2\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010o\u001a\u00020 2\u0006\u0010\t\u001a\u00020\b2\u0006\u0010\u001a\u001a\u00020\u0019H\u0000¢\u0006\u0004\bp\u0010qJ7\u0010u\u001a\u00020\f2\u0006\u0010\u0018\u001a\u00020\u00172\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010o\u001a\u00020 2\u0006\u0010\t\u001a\u00020\b2\u0006\u0010\u001a\u001a\u00020\u0019H\u0000¢\u0006\u0004\bs\u0010tJQ\u0010z\u001a\u00020\f2\u0006\u0010\u0018\u001a\u00020\u00172\u0006\u0010\u001a\u001a\u00020\u00192\u0006\u0010\t\u001a\u00020\b2\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010/\u001a\u00020V2\u0006\u0010+\u001a\u00020*2\u0006\u0010v\u001a\u00020 2\b\b\u0002\u0010w\u001a\u00020 H\u0000¢\u0006\u0004\bx\u0010yJ;\u0010}\u001a\u00020\f2\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010E\u001a\u00020D2\u0006\u0010\u0010\u001a\u00020\u000f2\b\b\u0001\u0010{\u001a\u00020 2\b\b\u0001\u0010|\u001a\u00020 H\u0002¢\u0006\u0004\b}\u0010~J \u0010\u007f\u001a\u00020D2\u000e\u0010:\u001a\n\u0012\u0004\u0012\u000209\u0018\u000108H\u0002¢\u0006\u0005\b\u007f\u0010\u0080\u0001JB\u0010\u0081\u0001\u001a\u00020\f2\u0006\u0010\u0018\u001a\u00020\u00172\u0006\u0010\t\u001a\u00020\b2\u0006\u0010\u001a\u001a\u00020\u00192\u0006\u0010+\u001a\u00020*2\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010v\u001a\u00020 H\u0002¢\u0006\u0006\b\u0081\u0001\u0010\u0082\u0001J1\u0010\u0083\u0001\u001a\u00020\f2\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0010\u001a\u00020\u000f2\u0006\u0010\u0012\u001a\u00020\u00112\u0006\u0010\u0014\u001a\u00020\u0013H\u0002¢\u0006\u0005\b\u0083\u0001\u0010\u0016R\u0015\u0010\u0003\u001a\u00020\u00028\u0002X\u0082\u0004¢\u0006\u0007\n\u0005\b\u0003\u0010\u0084\u0001R\u0017\u0010\u0085\u0001\u001a\u00020\u00118\u0002X\u0082D¢\u0006\b\n\u0006\b\u0085\u0001\u0010\u0086\u0001R\u0018\u0010\u0088\u0001\u001a\u00030\u0087\u00018\u0002X\u0082\u0004¢\u0006\b\n\u0006\b\u0088\u0001\u0010\u0089\u0001¨\u0006\u008a\u0001"}, d2 = {"Lcom/moengage/richnotification/internal/builder/TemplateHelper;", "", "Lcom/moengage/core/internal/model/SdkInstance;", "sdkInstance", "<init>", "(Lcom/moengage/core/internal/model/SdkInstance;)V", "Landroid/widget/RemoteViews;", "remoteViews", "Lcom/moengage/richnotification/internal/models/Template;", "template", "Lcom/moengage/pushbase/model/NotificationPayload;", "payload", "Lzp/j0;", "setAssetsIfRequired", "(Landroid/widget/RemoteViews;Lcom/moengage/richnotification/internal/models/Template;Lcom/moengage/pushbase/model/NotificationPayload;)V", "Lcom/moengage/richnotification/internal/models/DefaultText;", "defaultText", "", AnalyticsAttribute.APP_NAME_ATTRIBUTE, "Lcom/moengage/richnotification/internal/models/HeaderStyle;", "headerStyle", "setDefaultTextAndStyle", "(Landroid/widget/RemoteViews;Lcom/moengage/richnotification/internal/models/DefaultText;Ljava/lang/String;Lcom/moengage/richnotification/internal/models/HeaderStyle;)V", "Landroid/content/Context;", "context", "Lcom/moengage/pushbase/internal/model/NotificationMetaData;", "metaData", "addActionToDismissCTA", "(Landroid/widget/RemoteViews;Landroid/content/Context;Lcom/moengage/pushbase/internal/model/NotificationMetaData;)V", "addLargeIcon", "Lcom/moengage/richnotification/internal/models/LayoutStyle;", "layout", "", "viewId", "setBackgroundColor", "(Lcom/moengage/richnotification/internal/models/LayoutStyle;Landroid/widget/RemoteViews;I)V", "Landroid/graphics/Bitmap;", "bitmap", "maxHeight", "scaleBitmap", "(Landroid/content/Context;Landroid/graphics/Bitmap;I)Landroid/graphics/Bitmap;", "templateName", "Lcom/moengage/richnotification/internal/models/Card;", "card", "addActionToCard", "(Landroid/content/Context;Lcom/moengage/pushbase/internal/model/NotificationMetaData;Ljava/lang/String;Landroid/widget/RemoteViews;Lcom/moengage/richnotification/internal/models/Card;I)V", "Lcom/moengage/richnotification/internal/models/Widget;", "widget", "addActionToWidget", "(Landroid/content/Context;Lcom/moengage/pushbase/internal/model/NotificationMetaData;Ljava/lang/String;Landroid/widget/RemoteViews;Lcom/moengage/richnotification/internal/models/Card;Lcom/moengage/richnotification/internal/models/Widget;I)V", "addLayoutStyle", "assetColor", "addPersistenceAsset", "(Ljava/lang/String;Landroid/widget/RemoteViews;I)V", "setSmallIconColor", "(Landroid/content/Context;Landroid/widget/RemoteViews;)V", "", "Lcom/moengage/pushbase/model/action/Action;", "actions", "Lorg/json/JSONObject;", "actionListToActionJson", "([Lcom/moengage/pushbase/model/action/Action;)Lorg/json/JSONObject;", "setHeaderStyle", "(Landroid/widget/RemoteViews;Lcom/moengage/richnotification/internal/models/HeaderStyle;)V", "setContentText", "(Landroid/widget/RemoteViews;Lcom/moengage/richnotification/internal/models/DefaultText;)V", "", "actionButtons", "", "isPersistent", "addActionButton$rich_notification_defaultRelease", "(Landroid/content/Context;Lcom/moengage/pushbase/internal/model/NotificationMetaData;Lcom/moengage/richnotification/internal/models/Template;Landroid/widget/RemoteViews;Ljava/util/List;Z)V", "addActionButton", "addImageToExpandedTemplate$rich_notification_defaultRelease", "(Landroid/content/Context;Lcom/moengage/pushbase/internal/model/NotificationMetaData;Lcom/moengage/richnotification/internal/models/Template;Landroid/widget/RemoteViews;)Z", "addImageToExpandedTemplate", RichPushConstantsKt.PROPERTY_FORMAT_KEY, "", "timerExpiry", "setChronometer$rich_notification_defaultRelease", "(Landroid/widget/RemoteViews;Ljava/lang/String;J)Z", "setChronometer", "Lcom/moengage/richnotification/internal/models/ChronometerStyle;", "getChronometerStyle$rich_notification_defaultRelease", "(Lcom/moengage/richnotification/internal/models/Widget;)Lcom/moengage/richnotification/internal/models/ChronometerStyle;", "getChronometerStyle", "Lcom/moengage/richnotification/internal/models/ImageWidget;", "preloadedBitmap", "maxAllowedImageHeight", "addImageWidgetToTemplate$rich_notification_defaultRelease", "(Landroid/content/Context;Lcom/moengage/pushbase/internal/model/NotificationMetaData;Lcom/moengage/richnotification/internal/models/Template;Landroid/widget/RemoteViews;Lcom/moengage/richnotification/internal/models/ImageWidget;Lcom/moengage/richnotification/internal/models/Card;Landroid/graphics/Bitmap;I)Z", "addImageWidgetToTemplate", "removeImageWidgetFromExpandedTemplate$rich_notification_defaultRelease", "(Landroid/widget/RemoteViews;)V", "removeImageWidgetFromExpandedTemplate", "layoutId", "", "radius", CampaignPathManagerKt.TRIGGER_JSON_WAIT_PERIOD_UNIT, "setViewCornerToRounded$rich_notification_defaultRelease", "(Landroid/widget/RemoteViews;IFI)V", "setViewCornerToRounded", "Lcom/moengage/richnotification/internal/models/DismissCta;", "dismissCtaText", "shouldCustomiseDismissView", "setDismissCtaCustomization$rich_notification_defaultRelease", "(Landroid/widget/RemoteViews;Lcom/moengage/richnotification/internal/models/DismissCta;Z)V", "setDismissCtaCustomization", "setHeaderAssetsAndIcon$rich_notification_defaultRelease", "(Landroid/content/Context;Landroid/widget/RemoteViews;Lcom/moengage/richnotification/internal/models/Template;Lcom/moengage/pushbase/internal/model/NotificationMetaData;)V", "setHeaderAssetsAndIcon", "rootViewId", "addDecoratedStyleBaseProperties$rich_notification_defaultRelease", "(Landroid/widget/RemoteViews;ILcom/moengage/richnotification/internal/models/Template;Lcom/moengage/pushbase/internal/model/NotificationMetaData;)V", "addDecoratedStyleBaseProperties", "addDefaultActionToNotificationClick$rich_notification_defaultRelease", "(Landroid/content/Context;Landroid/widget/RemoteViews;ILcom/moengage/richnotification/internal/models/Template;Lcom/moengage/pushbase/internal/model/NotificationMetaData;)V", "addDefaultActionToNotificationClick", "widgetId", "cardId", "addActionToImageWidget$rich_notification_defaultRelease", "(Landroid/content/Context;Lcom/moengage/pushbase/internal/model/NotificationMetaData;Lcom/moengage/richnotification/internal/models/Template;Landroid/widget/RemoteViews;Lcom/moengage/richnotification/internal/models/ImageWidget;Lcom/moengage/richnotification/internal/models/Card;II)V", "addActionToImageWidget", "crossButton", "separator", "setAssets", "(Landroid/widget/RemoteViews;ZLcom/moengage/richnotification/internal/models/DefaultText;II)V", "containsSnoozeAction", "([Lcom/moengage/pushbase/model/action/Action;)Z", "addDefaultAction", "(Landroid/content/Context;Lcom/moengage/richnotification/internal/models/Template;Lcom/moengage/pushbase/internal/model/NotificationMetaData;Lcom/moengage/richnotification/internal/models/Card;Landroid/widget/RemoteViews;I)V", "setHeaderTextAndStyle", "Lcom/moengage/core/internal/model/SdkInstance;", "tag", "Ljava/lang/String;", "", "actionButtonIdArray", "[I", "rich-notification_defaultRelease"}, k = 1, mv = {1, 9, 0}, xi = 48)
@Instrumented
@SourceDebugExtension({"SMAP\nTemplateHelper.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TemplateHelper.kt\ncom/moengage/richnotification/internal/builder/TemplateHelper\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,693:1\n1#2:694\n*E\n"})
public final class TemplateHelper {

    @NotNull
    private final int[] actionButtonIdArray;

    @NotNull
    private final SdkInstance sdkInstance;

    @NotNull
    private final String tag;

    public TemplateHelper(@NotNull SdkInstance sdkInstance) {
        r.k(sdkInstance, "sdkInstance");
        this.sdkInstance = sdkInstance;
        this.tag = "RichPush_5.1.1_TemplateHelper";
        this.actionButtonIdArray = new int[]{R.id.actionButton1, R.id.actionButton2};
    }

    public static void addActionToImageWidget$rich_notification_defaultRelease$default(TemplateHelper templateHelper, Context context, NotificationMetaData notificationMetaData, Template template, RemoteViews remoteViews, ImageWidget imageWidget, Card card, int i, int i2, int i3, Object obj) {
        templateHelper.addActionToImageWidget$rich_notification_defaultRelease(context, notificationMetaData, template, remoteViews, imageWidget, card, i, (i3 & 128) != 0 ? R.id.card : i2);
    }

    private final void addDefaultAction(Context context, Template template, NotificationMetaData metaData, Card card, RemoteViews remoteViews, int widgetId) {
        TemplateTrackingMeta templateTrackingMeta = new TemplateTrackingMeta(template.getTemplateName(), card.getId(), -1);
        Intent redirectIntent = UtilsKt.getRedirectIntent(context, metaData.getPayload().getPayload());
        redirectIntent.putExtra(PushConstantsInternal.TEMPLATE_META, MapperKt.templateTrackingMetaToJsonString(templateTrackingMeta));
        remoteViews.setOnClickPendingIntent(widgetId, CoreUtils.getPendingIntentActivity$default(context, CoreUtils.getUniqueNumber(), redirectIntent, 0, 8, null));
    }

    public static boolean addImageWidgetToTemplate$rich_notification_defaultRelease$default(TemplateHelper templateHelper, Context context, NotificationMetaData notificationMetaData, Template template, RemoteViews remoteViews, ImageWidget imageWidget, Card card, Bitmap bitmap, int i, int i2, Object obj) {
        return templateHelper.addImageWidgetToTemplate$rich_notification_defaultRelease(context, notificationMetaData, template, remoteViews, imageWidget, card, (i2 & 64) != 0 ? null : bitmap, (i2 & 128) != 0 ? 192 : i);
    }

    private final boolean containsSnoozeAction(Action[] actions) {
        if (actions == null) {
            return false;
        }
        Iterator a = c.a(actions);
        while (a.hasNext()) {
            if (r.f(((Action) a.next()).getActionType(), MoEPushConstants.ACTION_REMIND_ME_LATER)) {
                return true;
            }
        }
        return false;
    }

    private final void setAssets(RemoteViews remoteViews, boolean isPersistent, DefaultText defaultText, @DrawableRes int crossButton, @DrawableRes int separator) {
        if (isPersistent) {
            remoteViews.setImageViewResource(R.id.closeButton, crossButton);
            remoteViews.setViewVisibility(R.id.closeButton, 0);
        }
        if (!q.D(defaultText.getSummary())) {
            remoteViews.setImageViewResource(R.id.separatorSummary, separator);
            remoteViews.setViewVisibility(R.id.separatorSummary, 0);
        }
        remoteViews.setImageViewResource(R.id.separatorTime, separator);
    }

    public static void setDismissCtaCustomization$rich_notification_defaultRelease$default(TemplateHelper templateHelper, RemoteViews remoteViews, DismissCta dismissCta, boolean z, int i, Object obj) {
        if ((i & 4) != 0) {
            z = RichPushUtilsKt.doesSdkSupportDecoratedStyleOnDevice();
        }
        templateHelper.setDismissCtaCustomization$rich_notification_defaultRelease(remoteViews, dismissCta, z);
    }

    private final void setHeaderTextAndStyle(RemoteViews remoteViews, DefaultText defaultText, String appName, HeaderStyle headerStyle) {
        if (!q.D(defaultText.getSummary())) {
            remoteViews.setViewVisibility(R.id.summaryText, 0);
            remoteViews.setTextViewText(R.id.summaryText, Html.fromHtml(defaultText.getSummary(), 63));
        }
        remoteViews.setTextViewText(R.id.time, RichPushUtilsKt.getTime());
        if (q.D(appName)) {
            throw new IllegalStateException("App name cannot be empty");
        }
        remoteViews.setTextViewText(R.id.appName, appName);
        setHeaderStyle(remoteViews, headerStyle);
    }

    public static void setViewCornerToRounded$rich_notification_defaultRelease$default(TemplateHelper templateHelper, RemoteViews remoteViews, int i, float f, int i2, int i3, Object obj) {
        if ((i3 & 4) != 0) {
            f = 4.0f;
        }
        if ((i3 & 8) != 0) {
            i2 = 1;
        }
        templateHelper.setViewCornerToRounded$rich_notification_defaultRelease(remoteViews, i, f, i2);
    }

    @NotNull
    public final JSONObject actionListToActionJson(@NotNull Action[] actions) {
        r.k(actions, "actions");
        JSONObject jSONObject = new JSONObject();
        JSONArray jSONArray = new JSONArray();
        if (actions.length == 0) {
            jSONObject.put("actions", jSONArray);
            return jSONObject;
        }
        for (Action action : actions) {
            jSONArray.put(action.getPayload());
        }
        jSONObject.put("actions", jSONArray);
        return jSONObject;
    }

    public final void addActionButton$rich_notification_defaultRelease(@NotNull Context context, @NotNull NotificationMetaData metaData, @NotNull Template template, @NotNull RemoteViews remoteViews, @NotNull List<? extends Widget> actionButtons, boolean isPersistent) {
        r.k(context, "context");
        r.k(metaData, "metaData");
        r.k(template, "template");
        r.k(remoteViews, "remoteViews");
        r.k(actionButtons, "actionButtons");
        boolean z = true;
        if (!actionButtons.isEmpty()) {
            int size = CoreUtils.getDeviceDimensions(context).width / actionButtons.size();
            int min = Math.min(actionButtons.size(), 2);
            for (int i = 0; i < min; i++) {
                Widget widget = actionButtons.get(i);
                if (!RichPushConstantsKt.WIDGET_TYPE_BUTTON.equals(widget.getType())) {
                    throw new IllegalStateException("Only button widget expected.");
                }
                remoteViews.setViewVisibility(this.actionButtonIdArray[i], 0);
                if (!RichPushUtilsKt.doesSdkSupportDecoratedStyleOnDevice()) {
                    remoteViews.setInt(this.actionButtonIdArray[i], "setMaxWidth", size);
                }
                remoteViews.setTextViewText(this.actionButtonIdArray[i], Html.fromHtml(widget.getContent(), 63));
                if (widget.getStyle() != null && !q.D(widget.getStyle().getBackgroundColor())) {
                    remoteViews.setInt(this.actionButtonIdArray[i], "setBackgroundColor", Color.parseColor(widget.getStyle().getBackgroundColor()));
                }
                TemplateTrackingMeta templateTrackingMeta = new TemplateTrackingMeta(template.getTemplateName(), -1, widget.getId());
                Intent redirectIntent = UtilsKt.getRedirectIntent(context, metaData.getPayload().getPayload());
                if (containsSnoozeAction(widget.getActions())) {
                    redirectIntent = UtilsKt.getIntentForSnooze(context, metaData.getPayload().getPayload());
                }
                redirectIntent.putExtra(PushConstantsInternal.TEMPLATE_META, MapperKt.templateTrackingMetaToJsonString(templateTrackingMeta));
                if (!(widget.getActions().length == 0)) {
                    JSONObject actionListToActionJson = new TemplateHelper(this.sdkInstance).actionListToActionJson(widget.getActions());
                    redirectIntent.putExtra(PushConstantsInternal.ACTION, actionListToActionJson == null ? actionListToActionJson.toString() : JSONObjectInstrumentation.toString(actionListToActionJson));
                }
                remoteViews.setOnClickPendingIntent(this.actionButtonIdArray[i], CoreUtils.getPendingIntentActivity$default(context, CoreUtils.getUniqueNumber(), redirectIntent, 0, 8, null));
            }
        }
        if (isPersistent) {
            if (!RichPushUtilsKt.doesSdkSupportDecoratedStyleOnDevice()) {
                Evaluator evaluator = new Evaluator(this.sdkInstance.logger);
                CollapsedTemplate collapsedTemplate = template.getCollapsedTemplate();
                String type = collapsedTemplate != null ? collapsedTemplate.getType() : null;
                ExpandedTemplate expandedTemplate = template.getExpandedTemplate();
                if (!evaluator.isTimerTemplate$rich_notification_defaultRelease(type, expandedTemplate != null ? expandedTemplate.getType() : null)) {
                    z = false;
                }
            }
            setDismissCtaCustomization$rich_notification_defaultRelease(remoteViews, template.getDismissCta(), z);
            addActionToDismissCTA(remoteViews, context, metaData);
        }
    }

    public final void addActionToCard(@NotNull Context context, @NotNull NotificationMetaData metaData, @NotNull String templateName, @NotNull RemoteViews remoteViews, @NotNull Card card, int viewId) {
        r.k(context, "context");
        r.k(metaData, "metaData");
        r.k(templateName, "templateName");
        r.k(remoteViews, "remoteViews");
        r.k(card, "card");
        if (card.getActions().length == 0) {
            return;
        }
        Intent redirectIntent = UtilsKt.getRedirectIntent(context, metaData.getPayload().getPayload());
        Intent putExtra = redirectIntent.putExtra(PushConstantsInternal.TEMPLATE_META, MapperKt.templateTrackingMetaToJsonString(new TemplateTrackingMeta(templateName, card.getId(), -1)));
        JSONObject actionListToActionJson = actionListToActionJson(card.getActions());
        putExtra.putExtra(PushConstantsInternal.ACTION, actionListToActionJson == null ? actionListToActionJson.toString() : JSONObjectInstrumentation.toString(actionListToActionJson));
        remoteViews.setOnClickPendingIntent(viewId, CoreUtils.getPendingIntentActivity$default(context, CoreUtils.getUniqueNumber(), redirectIntent, 0, 8, null));
    }

    public final void addActionToDismissCTA(@NotNull RemoteViews remoteViews, @NotNull Context context, @NotNull NotificationMetaData metaData) {
        r.k(remoteViews, "remoteViews");
        r.k(context, "context");
        r.k(metaData, "metaData");
        Intent intent = new Intent(context, (Class<?>) MoEPushWorker.class);
        Intent putExtras = intent.putExtras(metaData.getPayload().getPayload());
        JSONObject buildDismissActionJson = UtilsKt.buildDismissActionJson(UtilsKt.getNotificationTagFromCampaignId(metaData.getPayload().getCampaignId()));
        putExtras.putExtra(PushConstantsInternal.ACTION, buildDismissActionJson == null ? buildDismissActionJson.toString() : JSONObjectInstrumentation.toString(buildDismissActionJson)).setAction(PushConstantsInternal.INTENT_ACTION_NOTIFICATION_CLOSE_CLICKED);
        remoteViews.setOnClickPendingIntent(R.id.closeButton, CoreUtils.getPendingIntentService$default(context, CoreUtils.getUniqueNumber(), intent, 0, 8, null));
    }

    public final void addActionToImageWidget$rich_notification_defaultRelease(@NotNull Context context, @NotNull NotificationMetaData metaData, @NotNull Template template, @NotNull RemoteViews remoteViews, @NotNull ImageWidget widget, @NotNull Card card, int widgetId, int cardId) {
        r.k(context, "context");
        r.k(metaData, "metaData");
        r.k(template, "template");
        r.k(remoteViews, "remoteViews");
        r.k(widget, "widget");
        r.k(card, "card");
        if (widget.getActions().length == 0 && card.getActions().length == 0) {
            addDefaultAction(context, template, metaData, card, remoteViews, widgetId);
        } else {
            addActionToWidget(context, metaData, template.getTemplateName(), remoteViews, card, widget, widgetId);
            addActionToCard(context, metaData, template.getTemplateName(), remoteViews, card, cardId);
        }
    }

    public final void addActionToWidget(@NotNull Context context, @NotNull NotificationMetaData metaData, @NotNull String templateName, @NotNull RemoteViews remoteViews, @NotNull Card card, @NotNull Widget widget, int viewId) {
        r.k(context, "context");
        r.k(metaData, "metaData");
        r.k(templateName, "templateName");
        r.k(remoteViews, "remoteViews");
        r.k(card, "card");
        r.k(widget, "widget");
        if (widget.getActions().length == 0) {
            return;
        }
        Intent redirectIntent = UtilsKt.getRedirectIntent(context, metaData.getPayload().getPayload());
        TemplateHelper templateHelper = new TemplateHelper(this.sdkInstance);
        Intent putExtra = redirectIntent.putExtra(PushConstantsInternal.TEMPLATE_META, MapperKt.templateTrackingMetaToJsonString(new TemplateTrackingMeta(templateName, card.getId(), widget.getId())));
        JSONObject actionListToActionJson = templateHelper.actionListToActionJson(widget.getActions());
        putExtra.putExtra(PushConstantsInternal.ACTION, actionListToActionJson == null ? actionListToActionJson.toString() : JSONObjectInstrumentation.toString(actionListToActionJson));
        remoteViews.setOnClickPendingIntent(viewId, CoreUtils.getPendingIntentActivity$default(context, CoreUtils.getUniqueNumber(), redirectIntent, 0, 8, null));
    }

    public final void addDecoratedStyleBaseProperties$rich_notification_defaultRelease(@NotNull RemoteViews remoteViews, int rootViewId, @NotNull Template template, @NotNull NotificationMetaData metaData) {
        r.k(remoteViews, "remoteViews");
        r.k(template, "template");
        r.k(metaData, "metaData");
        setViewCornerToRounded$rich_notification_defaultRelease$default(this, remoteViews, rootViewId, 0.0f, 0, 12, null);
        s notificationBuilder = metaData.getNotificationBuilder();
        Spanned fromHtml = Html.fromHtml(template.getDefaultText().getSummary(), 63);
        r.j(fromHtml, "fromHtml(...)");
        notificationBuilder.A(q.p0(fromHtml));
    }

    public final void addDefaultActionToNotificationClick$rich_notification_defaultRelease(@NotNull Context context, @NotNull RemoteViews remoteViews, int rootViewId, @NotNull Template template, @NotNull NotificationMetaData metaData) {
        r.k(context, "context");
        r.k(remoteViews, "remoteViews");
        r.k(template, "template");
        r.k(metaData, "metaData");
        TemplateTrackingMeta templateTrackingMeta = new TemplateTrackingMeta(template.getTemplateName(), -1, -1);
        Intent redirectIntent = UtilsKt.getRedirectIntent(context, metaData.getPayload().getPayload());
        redirectIntent.putExtra(PushConstantsInternal.TEMPLATE_META, MapperKt.templateTrackingMetaToJsonString(templateTrackingMeta));
        PendingIntent pendingIntentActivity$default = CoreUtils.getPendingIntentActivity$default(context, CoreUtils.getUniqueNumber(), redirectIntent, 0, 8, null);
        remoteViews.setOnClickPendingIntent(rootViewId, pendingIntentActivity$default);
        metaData.getNotificationBuilder().g(pendingIntentActivity$default);
    }

    public final boolean addImageToExpandedTemplate$rich_notification_defaultRelease(@NotNull Context context, @NotNull NotificationMetaData metaData, @NotNull Template template, @NotNull RemoteViews remoteViews) {
        r.k(context, "context");
        r.k(metaData, "metaData");
        r.k(template, "template");
        r.k(remoteViews, "remoteViews");
        if (template.getExpandedTemplate() == null) {
            return false;
        }
        Card card = template.getExpandedTemplate().getCards().get(0);
        if (card.getWidgets().isEmpty()) {
            return false;
        }
        Widget widget = card.getWidgets().get(0);
        if (RichPushConstantsKt.WIDGET_TYPE_IMAGE.equals(widget.getType())) {
            return addImageWidgetToTemplate$rich_notification_defaultRelease$default(this, context, metaData, template, remoteViews, (ImageWidget) widget, card, null, 0, RichPushConstantsKt.MAX_IMAGE_HEIGHT, null);
        }
        return false;
    }

    public final boolean addImageWidgetToTemplate$rich_notification_defaultRelease(@NotNull Context context, @NotNull NotificationMetaData metaData, @NotNull Template template, @NotNull RemoteViews remoteViews, @NotNull ImageWidget widget, @NotNull Card card, @Nullable Bitmap preloadedBitmap, int maxAllowedImageHeight) {
        Bitmap bitmap;
        int i;
        r.k(context, "context");
        r.k(metaData, "metaData");
        r.k(template, "template");
        r.k(remoteViews, "remoteViews");
        r.k(widget, "widget");
        r.k(card, "card");
        if (template.getExpandedTemplate() == null) {
            return false;
        }
        if (preloadedBitmap == null) {
            Bitmap downloadImageBitmap = CoreUtils.downloadImageBitmap(widget.getContent());
            if (downloadImageBitmap == null) {
                return false;
            }
            bitmap = downloadImageBitmap;
        } else {
            bitmap = preloadedBitmap;
        }
        if (!RichPushUtilsKt.doesSdkSupportDecoratedStyleOnDevice()) {
            int transformToPx = !template.getExpandedTemplate().getActionButtonList().isEmpty() ? UtilsKt.transformToPx(context, maxAllowedImageHeight - 40) : UtilsKt.transformToPx(context, maxAllowedImageHeight);
            boolean isTablet = CoreUtils.isTablet(context);
            if (!isTablet) {
                bitmap = scaleBitmap(context, bitmap, transformToPx);
            }
            if (isTablet) {
                remoteViews.setViewVisibility(R.id.horizontalFitCenterImage, 8);
                remoteViews.setViewVisibility(R.id.verticalImage, 8);
                i = R.id.horizontalCenterCropImage;
            } else if (bitmap.getHeight() >= bitmap.getWidth()) {
                remoteViews.setViewVisibility(R.id.horizontalCenterCropImage, 8);
                remoteViews.setViewVisibility(R.id.horizontalFitCenterImage, 8);
                i = R.id.verticalImage;
            } else if (bitmap.getHeight() >= transformToPx) {
                remoteViews.setViewVisibility(R.id.horizontalFitCenterImage, 8);
                remoteViews.setViewVisibility(R.id.verticalImage, 8);
                i = R.id.horizontalCenterCropImage;
            } else {
                remoteViews.setViewVisibility(R.id.horizontalCenterCropImage, 8);
                remoteViews.setViewVisibility(R.id.verticalImage, 8);
                i = R.id.horizontalFitCenterImage;
            }
        } else if (widget.getScaleType() == ImageView.ScaleType.CENTER_CROP) {
            remoteViews.setViewVisibility(R.id.centerInsideImage, 8);
            setViewCornerToRounded$rich_notification_defaultRelease$default(this, remoteViews, R.id.centerCropImage, 0.0f, 0, 12, null);
            i = R.id.centerCropImage;
        } else {
            remoteViews.setViewVisibility(R.id.centerCropImage, 8);
            i = R.id.centerInsideImage;
        }
        int i2 = i;
        remoteViews.setImageViewBitmap(i2, bitmap);
        remoteViews.setViewVisibility(i2, 0);
        addActionToImageWidget$rich_notification_defaultRelease$default(this, context, metaData, template, remoteViews, widget, card, i2, 0, 128, null);
        return true;
    }

    public final void addLargeIcon(@NotNull RemoteViews remoteViews, @NotNull Template template, @NotNull NotificationPayload payload) {
        RemoteViews remoteViews2;
        r.k(remoteViews, "remoteViews");
        r.k(template, "template");
        r.k(payload, "payload");
        if (template.getShouldShowLargeIcon()) {
            Bitmap bitmapFromUrl = !q.D(payload.getAddOnFeatures().getLargeIconUrl()) ? new ImageHelper(this.sdkInstance).getBitmapFromUrl(payload.getAddOnFeatures().getLargeIconUrl(), CacheStrategy.MEMORY) : null;
            if (bitmapFromUrl != null) {
                remoteViews.setImageViewBitmap(R.id.largeIcon, bitmapFromUrl);
            } else if (this.sdkInstance.getInitConfig().getPush().getMeta().getLargeIcon() != -1) {
                remoteViews.setImageViewResource(R.id.largeIcon, this.sdkInstance.getInitConfig().getPush().getMeta().getLargeIcon());
            }
            if (RichPushUtilsKt.doesSdkSupportDecoratedStyleOnDevice()) {
                remoteViews2 = remoteViews;
                setViewCornerToRounded$rich_notification_defaultRelease$default(this, remoteViews2, R.id.largeIcon, 0.0f, 0, 12, null);
            } else {
                remoteViews2 = remoteViews;
            }
            remoteViews2.setViewVisibility(R.id.largeIcon, 0);
        }
    }

    public final void addLayoutStyle(@Nullable LayoutStyle layout, @NotNull RemoteViews remoteViews, int viewId) {
        r.k(remoteViews, "remoteViews");
        if (layout == null) {
            return;
        }
        setBackgroundColor(layout, remoteViews, viewId);
    }

    public final void addPersistenceAsset(@NotNull String assetColor, @NotNull RemoteViews remoteViews, int viewId) {
        r.k(assetColor, "assetColor");
        r.k(remoteViews, "remoteViews");
        remoteViews.setImageViewResource(viewId, RichPushConstantsKt.ASSET_COLOR_DARK_GREY.equals(assetColor) ? R.drawable.moe_rich_push_dark_cross : R.drawable.moe_rich_push_light_cross);
        remoteViews.setViewVisibility(viewId, 0);
    }

    @Nullable
    public final ChronometerStyle getChronometerStyle$rich_notification_defaultRelease(@NotNull Widget widget) {
        r.k(widget, "widget");
        if (widget.getStyle() instanceof ChronometerStyle) {
            return (ChronometerStyle) widget.getStyle();
        }
        return null;
    }

    public final void removeImageWidgetFromExpandedTemplate$rich_notification_defaultRelease(@NotNull RemoteViews remoteViews) {
        r.k(remoteViews, "remoteViews");
        if (RichPushUtilsKt.doesSdkSupportDecoratedStyleOnDevice()) {
            remoteViews.setViewVisibility(R.id.centerInsideImage, 8);
            remoteViews.setViewVisibility(R.id.centerCropImage, 8);
        } else {
            remoteViews.setViewVisibility(R.id.horizontalFitCenterImage, 8);
            remoteViews.setViewVisibility(R.id.verticalImage, 8);
            remoteViews.setViewVisibility(R.id.horizontalCenterCropImage, 8);
        }
    }

    @NotNull
    public final Bitmap scaleBitmap(@NotNull Context context, @NotNull Bitmap bitmap, int maxHeight) {
        r.k(context, "context");
        r.k(bitmap, "bitmap");
        try {
            int height = bitmap.getHeight();
            int width = bitmap.getWidth();
            DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
            Logger.log$default(this.sdkInstance.logger, 0, null, null, new TemplateHelper$scaleBitmap$1(this, maxHeight), 7, null);
            Logger.log$default(this.sdkInstance.logger, 0, null, null, new TemplateHelper$scaleBitmap$2(this, displayMetrics), 7, null);
            Logger.log$default(this.sdkInstance.logger, 0, null, null, new TemplateHelper$scaleBitmap$3(this, width, height), 7, null);
            if (height < width) {
                int i = (height * displayMetrics.widthPixels) / width;
                Logger.log$default(this.sdkInstance.logger, 0, null, null, new TemplateHelper$scaleBitmap$5(this, displayMetrics, i), 7, null);
                Bitmap createScaledBitmap = Bitmap.createScaledBitmap(bitmap, displayMetrics.widthPixels, i, true);
                r.h(createScaledBitmap);
                return createScaledBitmap;
            }
            k0 k0Var = new k0();
            int i2 = (width * maxHeight) / height;
            k0Var.element = i2;
            int i3 = displayMetrics.widthPixels;
            if (i2 > i3) {
                k0Var.element = i3;
            }
            Logger.log$default(this.sdkInstance.logger, 0, null, null, new TemplateHelper$scaleBitmap$4(this, k0Var, maxHeight), 7, null);
            Bitmap createScaledBitmap2 = Bitmap.createScaledBitmap(bitmap, k0Var.element, maxHeight, true);
            r.h(createScaledBitmap2);
            return createScaledBitmap2;
        } catch (Throwable th) {
            Logger.log$default(this.sdkInstance.logger, 1, th, null, new TemplateHelper$scaleBitmap$6(this), 4, null);
            return bitmap;
        }
    }

    public final void setAssetsIfRequired(@NotNull RemoteViews remoteViews, @NotNull Template template, @NotNull NotificationPayload payload) {
        r.k(remoteViews, "remoteViews");
        r.k(template, "template");
        r.k(payload, "payload");
        String assetColor = template.getAssetColor();
        if (r.f(assetColor, RichPushConstantsKt.ASSET_COLOR_DARK_GREY)) {
            setAssets(remoteViews, payload.getAddOnFeatures().getIsPersistent(), template.getDefaultText(), R.drawable.moe_rich_push_dark_cross, R.drawable.moe_rich_push_dark_separator);
        } else if (r.f(assetColor, RichPushConstantsKt.ASSET_COLOR_LIGHT_GREY)) {
            setAssets(remoteViews, payload.getAddOnFeatures().getIsPersistent(), template.getDefaultText(), R.drawable.moe_rich_push_light_cross, R.drawable.moe_rich_push_light_separator);
        } else {
            Logger.log$default(this.sdkInstance.logger, 1, null, null, new TemplateHelper$setAssetsIfRequired$1(this), 6, null);
            setAssets(remoteViews, payload.getAddOnFeatures().getIsPersistent(), template.getDefaultText(), R.drawable.moe_rich_push_light_cross, R.drawable.moe_rich_push_light_separator);
        }
    }

    public final void setBackgroundColor(@NotNull LayoutStyle layout, @NotNull RemoteViews remoteViews, int viewId) {
        r.k(layout, "layout");
        r.k(remoteViews, "remoteViews");
        if (q.D(layout.getBackgroundColor())) {
            return;
        }
        remoteViews.setInt(viewId, "setBackgroundColor", Color.parseColor(layout.getBackgroundColor()));
    }

    public final boolean setChronometer$rich_notification_defaultRelease(@NotNull RemoteViews remoteViews, @NotNull String format, long timerExpiry) {
        r.k(remoteViews, "remoteViews");
        r.k(format, RichPushConstantsKt.PROPERTY_FORMAT_KEY);
        if (timerExpiry == -1) {
            return false;
        }
        remoteViews.setChronometer(R.id.moEChronometer, timerExpiry, format, true);
        remoteViews.setViewVisibility(R.id.chronometerLayout, 0);
        remoteViews.setViewVisibility(R.id.moEChronometer, 0);
        return true;
    }

    public final void setContentText(@NotNull RemoteViews remoteViews, @NotNull DefaultText defaultText) {
        r.k(remoteViews, "remoteViews");
        r.k(defaultText, "defaultText");
        int i = R.id.title;
        Spanned fromHtml = Html.fromHtml(defaultText.getTitle(), 63);
        r.j(fromHtml, "fromHtml(...)");
        remoteViews.setTextViewText(i, q.p0(fromHtml));
        if (q.D(defaultText.getMessage())) {
            return;
        }
        int i2 = R.id.message;
        Spanned fromHtml2 = Html.fromHtml(defaultText.getMessage(), 63);
        r.j(fromHtml2, "fromHtml(...)");
        remoteViews.setTextViewText(i2, q.p0(fromHtml2));
    }

    public final void setDefaultTextAndStyle(@NotNull RemoteViews remoteViews, @NotNull DefaultText defaultText, @NotNull String appName, @NotNull HeaderStyle headerStyle) throws IllegalStateException {
        r.k(remoteViews, "remoteViews");
        r.k(defaultText, "defaultText");
        r.k(appName, AnalyticsAttribute.APP_NAME_ATTRIBUTE);
        r.k(headerStyle, "headerStyle");
        int i = R.id.title;
        Spanned fromHtml = Html.fromHtml(defaultText.getTitle(), 63);
        r.j(fromHtml, "fromHtml(...)");
        remoteViews.setTextViewText(i, q.p0(fromHtml));
        int i2 = R.id.message;
        Spanned fromHtml2 = Html.fromHtml(defaultText.getMessage(), 63);
        r.j(fromHtml2, "fromHtml(...)");
        remoteViews.setTextViewText(i2, q.p0(fromHtml2));
        if (RichPushUtilsKt.doesSdkSupportDecoratedStyleOnDevice()) {
            return;
        }
        setHeaderTextAndStyle(remoteViews, defaultText, appName, headerStyle);
    }

    public final void setDismissCtaCustomization$rich_notification_defaultRelease(@NotNull RemoteViews remoteViews, @NotNull DismissCta dismissCtaText, boolean shouldCustomiseDismissView) {
        r.k(remoteViews, "remoteViews");
        r.k(dismissCtaText, "dismissCtaText");
        if (shouldCustomiseDismissView) {
            remoteViews.setTextViewText(R.id.closeButton, Html.fromHtml(dismissCtaText.getText(), 63));
        }
        remoteViews.setViewVisibility(R.id.closeButton, 0);
    }

    public final void setHeaderAssetsAndIcon$rich_notification_defaultRelease(@NotNull Context context, @NotNull RemoteViews remoteViews, @NotNull Template template, @NotNull NotificationMetaData metaData) {
        r.k(context, "context");
        r.k(remoteViews, "remoteViews");
        r.k(template, "template");
        r.k(metaData, "metaData");
        setAssetsIfRequired(remoteViews, template, metaData.getPayload());
        if (this.sdkInstance.getInitConfig().getPush().getMeta().getSmallIcon() != -1) {
            remoteViews.setImageViewResource(R.id.smallIcon, this.sdkInstance.getInitConfig().getPush().getMeta().getSmallIcon());
            setSmallIconColor(context, remoteViews);
        }
    }

    public final void setHeaderStyle(@NotNull RemoteViews remoteViews, @NotNull HeaderStyle headerStyle) {
        r.k(remoteViews, "remoteViews");
        r.k(headerStyle, "headerStyle");
        String appNameColor = headerStyle.getAppNameColor();
        if (appNameColor == null || q.D(appNameColor)) {
            return;
        }
        int parseColor = Color.parseColor(headerStyle.getAppNameColor());
        remoteViews.setTextColor(R.id.appName, parseColor);
        remoteViews.setTextColor(R.id.time, parseColor);
    }

    public final void setSmallIconColor(@NotNull Context context, @NotNull RemoteViews remoteViews) {
        r.k(context, "context");
        r.k(remoteViews, "remoteViews");
        if (this.sdkInstance.getInitConfig().getPush().getMeta().getNotificationColor() <= 0) {
            return;
        }
        remoteViews.setInt(R.id.smallIcon, "setColorFilter", context.getResources().getColor(this.sdkInstance.getInitConfig().getPush().getMeta().getNotificationColor()));
    }

    public final void setViewCornerToRounded$rich_notification_defaultRelease(@NotNull RemoteViews remoteViews, int layoutId, float radius, int unit) {
        r.k(remoteViews, "remoteViews");
        if (Build.VERSION.SDK_INT >= 31) {
            a.w(remoteViews, layoutId, radius, unit);
        }
    }
}