Skip to content

Commit

Permalink
fix: customAction handling
Browse files Browse the repository at this point in the history
  • Loading branch information
lovegaoshi committed Sep 14, 2023
1 parent f9e222b commit 49da020
Showing 1 changed file with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,23 +286,27 @@ class NotificationManager internal constructor(
instanceId: Int
): MutableMap<String, NotificationCompat.Action> {
if (!needsCustomActionsToAddMissingButtons) return mutableMapOf()
val actionMap = mutableMapOf(
REWIND to createNotificationAction(
rewindIcon ?: DEFAULT_REWIND_ICON,
REWIND,
instanceId
),
FORWARD to createNotificationAction(
forwardIcon ?: DEFAULT_FORWARD_ICON,
FORWARD,
instanceId
),
STOP to createNotificationAction(
stopIcon ?: DEFAULT_STOP_ICON,
STOP,
instanceId
var actionMap: MutableMap<String, NotificationCompat.Action> = mutableMapOf()
// only use rewind/forward/stop mapping with android >13.
if (Build.VERSION.SDK_INT >= 33) {
actionMap = mutableMapOf(
REWIND to createNotificationAction(
rewindIcon ?: DEFAULT_REWIND_ICON,
REWIND,
instanceId
),
FORWARD to createNotificationAction(
forwardIcon ?: DEFAULT_FORWARD_ICON,
FORWARD,
instanceId
),
STOP to createNotificationAction(
stopIcon ?: DEFAULT_STOP_ICON,
STOP,
instanceId
)
)
)
}
customIcons.forEach { (key, value) ->
actionMap[key] = createNotificationAction(value?: DEFAULT_STOP_ICON, key, instanceId)
}
Expand Down

0 comments on commit 49da020

Please sign in to comment.