Skip to content

Commit

Permalink
Implement logic for UniqueIdentifier on remove function
Browse files Browse the repository at this point in the history
  • Loading branch information
Windos committed Dec 30, 2020
1 parent c7c0cfe commit 1156f5a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion BurntToast/Public/Remove-BTNotification.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ function Remove-BTNotification {
[string] $UniqueIdentifier
)

if (!(Test-Path -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings\$AppId")) {
if ($UniqueIdentifier) {
if($PSCmdlet.ShouldProcess("Tag: $UniqueIdentifier, Group: $UniqueIdentifier, AppId: $AppId", 'Selectively removing notifications')) {
[Windows.UI.Notifications.ToastNotificationManager]::History.Remove($UniqueIdentifier, $UniqueIdentifier, $AppId)
}
} elseif (!(Test-Path -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings\$AppId")) {
Write-Warning -Message "The AppId $AppId is not present in the registry, please run New-BTAppId to avoid inconsistent Toast behaviour."
}

Expand Down

0 comments on commit 1156f5a

Please sign in to comment.