Skip to content

task(SDK-1556) - Minor improvements around dot sep #815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ public class PTConstants {

public static final String PT_MSG_ALT = "pt_msg_alt";

public static final String PT_MSG_SUMMARY_ALT = "pt_msg_summary_alt";

public static final String PT_PRODUCT_DISPLAY_LINEAR = "pt_product_display_linear";

public static final String PT_PRODUCT_DISPLAY_ACTION_TEXT_COLOUR = "pt_product_display_action_text_clr";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ class TemplateRenderer : INotificationRenderer, AudibleNotification {
var pt_timer_end = 0
private var pt_title_alt: String? = null
private var pt_msg_alt: String? = null
private var pt_msg_summary_alt: String? = null
private var pt_big_img_alt: String? = null
internal var pt_product_display_linear: String? = null
internal var pt_meta_clr: String? = null
internal var pt_product_display_action_text_clr: String? = null
internal var pt_small_icon_clr: String? = null
internal var pt_small_icon: Bitmap? = null
internal var pt_dot_sep: Bitmap? = null
private var pt_cancel_notif_id: String? = null
private var pt_cancel_notif_ids: ArrayList<Int>? = null
var actions: JSONArray? = null
Expand Down Expand Up @@ -282,6 +282,13 @@ class TemplateRenderer : INotificationRenderer, AudibleNotification {
)
}

if (pt_msg_summary_alt != null && pt_msg_summary_alt!!.isNotEmpty()) {
ptJsonObj?.put(PT_MSG_SUMMARY, pt_msg_summary_alt) ?: basicTemplateBundle.putString(
PT_MSG_SUMMARY,
pt_msg_summary_alt
)
}


if (ptJsonObj != null) {
basicTemplateBundle.putString(
Expand Down Expand Up @@ -411,6 +418,7 @@ class TemplateRenderer : INotificationRenderer, AudibleNotification {
pt_timer_end = Utils.getTimerEnd(extras)
pt_big_img_alt = extras.getString(PT_BIG_IMG_ALT)
pt_msg_alt = extras.getString(PT_MSG_ALT)
pt_msg_summary_alt = extras.getString(PT_MSG_SUMMARY_ALT)
pt_title_alt = extras.getString(PT_TITLE_ALT)
pt_product_display_linear = extras.getString(PT_PRODUCT_DISPLAY_LINEAR)
pt_product_display_action_text_clr = darkModeAdaptiveColors[PT_PRODUCT_DISPLAY_ACTION_TEXT_COLOUR]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,9 @@ internal open class ContentView(

private fun setDotSep() {
try {
renderer.pt_dot = context.resources.getIdentifier(
PTConstants.PT_DOT_SEP,
"drawable",
context.packageName
)
renderer.pt_dot_sep = Utils.setBitMapColour(context, renderer.pt_dot, renderer.pt_meta_clr, PTConstants.PT_META_CLR_DEFAULTS)
} catch (e: NullPointerException) {
renderer.pt_dot = R.drawable.pt_dot_sep
Utils.setBitMapColour(context, renderer.pt_dot, renderer.pt_meta_clr, PTConstants.PT_META_CLR_DEFAULTS)
} catch (_: NullPointerException) {
PTLog.debug("NPE while setting dot sep color")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.os.Bundle
import android.text.Html
import android.widget.RemoteViews
import androidx.core.app.NotificationCompat
import com.clevertap.android.pushtemplates.PTConstants
import com.clevertap.android.pushtemplates.TemplateRenderer

internal abstract class Style(private var renderer: TemplateRenderer) {
Expand Down Expand Up @@ -39,7 +40,7 @@ internal abstract class Style(private var renderer: TemplateRenderer) {
.setContentIntent(pIntent)
.setVibrate(longArrayOf(0L))
.setWhen(System.currentTimeMillis())
.setColor(Color.parseColor(renderer.pt_small_icon_clr ?: "#FFFFFF"))
.setColor(Color.parseColor(renderer.pt_small_icon_clr ?: PTConstants.PT_META_CLR_DEFAULTS))
.setAutoCancel(true)
.setStyle(
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
Expand Down