Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Mansi-mParticle committed Jul 29, 2024
1 parent 1ef6041 commit 59ead43
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/kotlin/com/mparticle/kits/MParticleAutopilot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class MParticleAutopilot : Autopilot() {
if (!UAStringUtil.isEmpty(accentColor)) {
try {
val colorValue = when {
accentColor.equals("System default") -> {
accentColor.equals("System default", ignoreCase = true) -> {
val typedValue = TypedValue()
val theme = context.theme
theme.resolveAttribute(R.attr.windowBackground, typedValue, true)
Expand All @@ -112,6 +112,12 @@ class MParticleAutopilot : Autopilot() {
}
editor.putInt(NOTIFICATION_COLOR, colorValue)
} catch (e: IllegalArgumentException) {
// Handle parsing errors by setting the default color
val typedValue = TypedValue()
val theme = context.theme
theme.resolveAttribute(R.attr.windowBackground, typedValue, true)
val defaultColor = typedValue.data
editor.putInt(NOTIFICATION_COLOR, defaultColor)
Logger.warning(e, "Unable to parse notification accent color: $accentColor")
}
}
Expand Down

0 comments on commit 59ead43

Please sign in to comment.