Skip to content

Commit

Permalink
Deprecate notification comment input. Disable on API 29+ because of h…
Browse files Browse the repository at this point in the history
  • Loading branch information
F43nd1r committed Apr 23, 2023
1 parent b562bd2 commit 74803a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,29 +137,32 @@ class NotificationConfiguration(

/**
* in-line comment button text.
* No effect on pre-nougat devices.
* Only available on API 24 - 28.
*
* @see androidx.core.app.NotificationCompat.Builder.addAction
* @since 5.0.0
* @deprecated not available on API 29+
*/
val sendWithCommentButtonText: String? = null,

/**
* in-line comment button icon.
* No effect on pre-nougat devices.
* Only available on API 24 - 28.
*
* @see androidx.core.app.NotificationCompat.Builder.addAction
* @since 5.0.0
* @deprecated not available on API 29+
*/
@DrawableRes
val resSendWithCommentButtonIcon: Int = android.R.drawable.ic_menu_send,

/**
* in-line comment prompt label.
* No effect on pre-nougat devices.
* Only available on API 24 - 28.
*
* @see androidx.core.app.RemoteInput.Builder.setLabel
* @since 5.0.0
* @deprecated not available on API 29+
*/
val commentPrompt: String? = null,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class NotificationInteraction : HasConfigPlugin(NotificationConfiguration::class
notificationConfig.color?.let { notification.color = it }
val sendIntent = getSendIntent(context, config, reportFile)
val discardIntent = getDiscardIntent(context)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && notificationConfig.sendWithCommentButtonText?.isNotEmpty() == true) {
if (Build.VERSION.SDK_INT in Build.VERSION_CODES.N..Build.VERSION_CODES.P && notificationConfig.sendWithCommentButtonText?.isNotEmpty() == true) {
val remoteInput = RemoteInput.Builder(KEY_COMMENT)
notificationConfig.commentPrompt?.takeIf { it.isNotBlank() }?.let { remoteInput.setLabel(it) }
notification.addAction(
Expand Down

0 comments on commit 74803a0

Please sign in to comment.