Skip to content

Commit

Permalink
UniqueIdentifier on Remove-BTNotification
Browse files Browse the repository at this point in the history
  • Loading branch information
Windos committed Dec 29, 2020
1 parent c3a0719 commit 9f06ac0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions BurntToast/Public/Get-BTHistory.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ function Get-BTHistory {
if (!(Test-Path -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings\$AppId")) {
throw "The AppId $AppId is not present in the registry, please run New-BTAppId to avoid inconsistent Toast behaviour."
} else {
if ($Script:ActionsSupported) {
Write-Warning -Message 'The output from this function in some versions of PowerShell is not useful. Unfortunately this is expected at this time.'
}

$Toasts = if ($ScheduledToast) {
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($AppId).GetScheduledToastNotifications()
} else {
Expand Down
12 changes: 10 additions & 2 deletions BurntToast/Public/Remove-BTNotification.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,25 @@ function Remove-BTNotification {
https://github.com/Windos/BurntToast/blob/main/Help/Remove-BTNotification.md
#>

[CmdletBinding(SupportsShouldProcess = $true,
[CmdletBinding(DefaultParameterSetName = 'Individual',
SupportsShouldProcess = $true,
HelpUri = 'https://github.com/Windos/BurntToast/blob/main/Help/Remove-BTNotification.md')]
param (
# Specifies the AppId of the 'application' or process that spawned the toast notification.
[string] $AppId = $Script:Config.AppId,

# Specifies the tag, which identifies a given toast notification.
[Parameter(ParameterSetName = 'Individual')]
[string] $Tag,

# Specifies the group, which helps to identify a given toast notification.
[string] $Group
[Parameter(ParameterSetName = 'Individual')]
[string] $Group,

# A string that uniquely identifies a toast notification. Represents both the Tag and Group for a toast.
[Parameter(Mandatory = $true,
ParameterSetName = 'Combo')]
[string] $UniqueIdentifier
)

if (!(Test-Path -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings\$AppId")) {
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

- Thanks [@cedarbaum](https://github.com/cedarbaum)

- Enhancement: You can now specify a UniqueIdentifier when using the Remove-BTNotification function rather than component Tag and Group strings.

- [0.8.3](https://github.com/Windos/BurntToast/releases/download/v0.8.3/BurntToast.zip)

- Fix: Error when running Update-BTNotification on PowerShell 6.0+ ([#120](https://github.com/Windos/BurntToast/issues/120))
Expand Down

0 comments on commit 9f06ac0

Please sign in to comment.