Skip to content

Commit

Permalink
CorpseFinder: UninstallWatcher notification should only show delete a…
Browse files Browse the repository at this point in the history
…ction if there is something to delete
  • Loading branch information
d4rken committed Feb 6, 2025
1 parent cd65b26 commit 38b07aa
Showing 1 changed file with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,27 +90,29 @@ class UninstallWatcherNotifications @Inject constructor(
setContentText(resultText)
setStyle(BigTextStyle().bigText(resultText))

val deleteIntent = Intent(context, ExternalWatcherTaskReceiver::class.java).apply {
action = ExternalWatcherTaskReceiver.TASK_INTENT
val deleteTask = ExternalWatcherTask.Delete(
target = result.pkgId,
)
putExtra(ExternalWatcherTaskReceiver.EXTRA_TASK, deleteTask)
}
if (result.foundItems > 0) {
val deleteIntent = Intent(context, ExternalWatcherTaskReceiver::class.java).apply {
action = ExternalWatcherTaskReceiver.TASK_INTENT
val deleteTask = ExternalWatcherTask.Delete(
target = result.pkgId,
)
putExtra(ExternalWatcherTaskReceiver.EXTRA_TASK, deleteTask)
}

val deletePi = PendingIntent.getBroadcast(
context,
0,
deleteIntent,
PendingIntentCompat.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
)
val deletePi = PendingIntent.getBroadcast(
context,
0,
deleteIntent,
PendingIntentCompat.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
)

val deleteAction = NotificationCompat.Action(
R.drawable.ic_delete,
context.getString(R.string.corpsefinder_watcher_notification_delete_action),
deletePi
)
addAction(deleteAction)
val deleteAction = NotificationCompat.Action(
R.drawable.ic_delete,
context.getString(R.string.corpsefinder_watcher_notification_delete_action),
deletePi
)
addAction(deleteAction)
}
}.build()

fun notifyOfScan(result: ExternalWatcherResult.Scan) {
Expand Down

0 comments on commit 38b07aa

Please sign in to comment.