Skip to content

Commit

Permalink
Remove default color handling code
Browse files Browse the repository at this point in the history
  • Loading branch information
Mansi-mParticle committed Jul 29, 2024
1 parent 59ead43 commit 7d0669c
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions src/main/kotlin/com/mparticle/kits/MParticleAutopilot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,8 @@ class MParticleAutopilot : Autopilot() {
val accentColor = configuration.notificationColor
if (!UAStringUtil.isEmpty(accentColor)) {
try {
val colorValue = when {
accentColor.equals("System default", ignoreCase = true) -> {
val typedValue = TypedValue()
val theme = context.theme
theme.resolveAttribute(R.attr.windowBackground, typedValue, true)
typedValue.data
}

else -> Color.parseColor(accentColor)
}
editor.putInt(NOTIFICATION_COLOR, colorValue)
editor.putInt(NOTIFICATION_COLOR, Color.parseColor(accentColor))
} 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 7d0669c

Please sign in to comment.