Skip to content

Commit

Permalink
Merge pull request #143 from Windos/v0.8.4
Browse files Browse the repository at this point in the history
v0.8.4
  • Loading branch information
Windos authored Dec 29, 2020
2 parents ffe568b + 0ea9681 commit c7c0cfe
Show file tree
Hide file tree
Showing 16 changed files with 111 additions and 36 deletions.
1 change: 0 additions & 1 deletion Azure-Pipelines/BurntToast-Template.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ if ($WinMajorVersion -ge 10) {
$Library = @( Get-ChildItem -Path $PSScriptRoot\lib\Microsoft.Toolkit.Uwp.Notifications\*.dll -Recurse -ErrorAction SilentlyContinue )

if ($IsWindows) {
$Library += @( Get-ChildItem -Path $PSScriptRoot\lib\Microsoft.Windows.CsWinRT\*.dll -Recurse -ErrorAction SilentlyContinue )
$Library += @( Get-ChildItem -Path $PSScriptRoot\lib\Microsoft.Windows.SDK.NET\*.dll -Recurse -ErrorAction SilentlyContinue )
}

Expand Down
16 changes: 14 additions & 2 deletions BurntToast/BurntToast.psd1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@{
RootModule = 'BurntToast.psm1'
ModuleVersion = '0.8.3'
ModuleVersion = '0.8.4'
# Can only use CompatiblePSEditions if PowerShellVersion is set to 5.1, not sure about limiting this to that version yet.
# CompatiblePSEditions = @('Desktop')
GUID = '751a2aeb-a68f-422e-a2ea-376bdd81612a'
Expand Down Expand Up @@ -42,7 +42,19 @@
LicenseUri = 'https://github.com/Windos/BurntToast/blob/main/LICENSE'
ProjectUri = 'https://github.com/Windos/BurntToast'
IconUri = 'https://raw.githubusercontent.com/Windos/BurntToast/main/Media/BurntToast-Logo.png'
ReleaseNotes = '#0.8.3
ReleaseNotes = '# 0.8.4
* Enhancement: Header ID on New-BTHeader is now optional. An ID will be auto generated if not specified (#125)
* Thanks [@glennsarti](https://github.com/glennsarti)
* Enhancement: Hero images can now be specified using the New-BurntToastNotification function using the -HeroImage parameter (#80)
* Thanks [@UniverseCitiz3n](https://github.com/UniverseCitiz3n)
* Enhancement: AppIDs can now be specified using the New-BurntToastNotification function using the -AppId parameter.
* 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.
* Fix: Weird edge cases when taking text from Twitch/IRC and using them in a toast is now sorted.
* Thanks [@potatoqualitee](https://github.com/potatoqualitee) and [@vexx32](https://github.com/vexx32)
# 0.8.3
* Fix: Error when running Update-BTNotification on PowerShell 6.0+ (#120)
* Fix: Error when using actionable toast parameters on any version (#122)
Expand Down
1 change: 0 additions & 1 deletion BurntToast/BurntToast.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ if ($WinMajorVersion -ge 10) {
$Library = @( Get-ChildItem -Path $PSScriptRoot\lib\Microsoft.Toolkit.Uwp.Notifications\*.dll -Recurse -ErrorAction SilentlyContinue )

if ($IsWindows) {
$Library += @( Get-ChildItem -Path $PSScriptRoot\lib\Microsoft.Windows.CsWinRT\*.dll -Recurse -ErrorAction SilentlyContinue )
$Library += @( Get-ChildItem -Path $PSScriptRoot\lib\Microsoft.Windows.SDK.NET\*.dll -Recurse -ErrorAction SilentlyContinue )
}

Expand Down
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
8 changes: 4 additions & 4 deletions BurntToast/Public/New-BTHeader.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
Microsoft.Toolkit.Uwp.Notifications.ToastHeader
.EXAMPLE
New-BTHeader -Id 'primary header' -Title 'First Category'
New-BTHeader -Title 'First Category'
This command creates a Toast Header object, which will be displayed with the text "First Category."
Expand All @@ -38,8 +38,8 @@
# Unique string that identifies a header. If a new Id is provided, the system will treat the header as a new header even if it has the same display text as a previous header.
#
# It is possible to update a header's display text by re-using the Id but changing the title.
[Parameter(Mandatory)]
[string] $Id,
[Parameter()]
[string] $Id = 'ID' + (New-Guid).ToString().Replace('-','').ToUpper(),

# The header string that is displayed to the user.
[Parameter(Mandatory)]
Expand All @@ -58,7 +58,7 @@
[Microsoft.Toolkit.Uwp.Notifications.ToastActivationType] $ActivationType = [Microsoft.Toolkit.Uwp.Notifications.ToastActivationType]::Protocol
)

$Header = [Microsoft.Toolkit.Uwp.Notifications.ToastHeader]::new($Id, $Title, $Arguments)
$Header = [Microsoft.Toolkit.Uwp.Notifications.ToastHeader]::new($Id, ($Title -replace '\x01'), $Arguments)

if ($ActivationType) {
$Header.ActivationType = $ActivationType
Expand Down
2 changes: 1 addition & 1 deletion BurntToast/Public/New-BTText.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
$TextObj = [Microsoft.Toolkit.Uwp.Notifications.AdaptiveText]::new()

if ($Text) {
$TextObj.Text = $Text
$TextObj.Text = $Text -replace '\x01'
}

if ($MaxLines) {
Expand Down
20 changes: 16 additions & 4 deletions BurntToast/Public/New-BurntToastNotification.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

[Alias('Toast')]
[CmdletBinding(DefaultParameterSetName = 'Sound',
SupportsShouldProcess = $true,
SupportsShouldProcess = $true,
HelpUri = 'https://github.com/Windos/BurntToast/blob/main/Help/New-BurntToastNotification.md')]
param (
# Specifies the text to show on the Toast Notification. Up to three strings can be displayed, the first of which will be embolden as a title.
Expand All @@ -83,9 +83,15 @@

#TODO: [ValidateScript({ Test-ToastImage -Path $_ })]

# Specifies the AppId of the 'application' or process that spawned the toast notification.
[string] $AppId = $Script:Config.AppId,

# Specifies the path to an image that will override the default image displayed with a Toast Notification.
[String] $AppLogo,

# Specifies the path to an image that will be used as the hero image on the toast.
[String] $HeroImage,

# Selects the sound to acompany the Toast Notification. Any 'Alarm' or 'Call' tones will automatically loop and extent the amount of time that a Toast is displayed on screen.
#
# Cannot be used in conjunction with the 'Silent' switch.
Expand Down Expand Up @@ -217,14 +223,20 @@
WhatIf = $false
}

if ($HeroImage) {
$BTImageHero = New-BTImage -Source $HeroImage -HeroImage -WhatIf:$false
$BindingSplat['HeroImage'] = $BTImageHero
}

if ($Column) {
$BindingSplat['Column'] = $Column
}

$Binding = New-BTBinding @BindingSplat
$Visual = New-BTVisual -BindingGeneric $Binding -WhatIf:$false

$ContentSplat = @{'Audio' = $Audio
$ContentSplat = @{
'Audio' = $Audio
'Visual' = $Visual
}

Expand All @@ -250,7 +262,7 @@

$ToastSplat = @{
Content = $Content
AppId = $Script:Config.AppId
AppId = $AppId
}

if ($UniqueIdentifier) {
Expand Down Expand Up @@ -278,7 +290,7 @@
$ToastSplat.Add('DismissedAction', $DismissedAction)
}

if($PSCmdlet.ShouldProcess( "submitting: $($Content.GetContent())" )) {
if ($PSCmdlet.ShouldProcess( "submitting: $($Content.GetContent())" )) {
Submit-BTNotification @ToastSplat
}
}
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
1 change: 0 additions & 1 deletion BurntToast/lib/Microsoft.Windows.CsWinRT/README.md

This file was deleted.

Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion BurntToast/lib/Microsoft.Windows.SDK.NET/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Microsoft.Windows.SDK.NET.10.0.18362.3-preview\lib\netcoreapp5.0
Microsoft.Windows.SDK.NET.Ref.10.0.19041.12\lib
Binary file not shown.
20 changes: 20 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Full Change Log

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

- Enhancement: Header ID on New-BTHeader is now optional. An ID will be auto generated if not specified ([#125](https://github.com/Windos/BurntToast/issues/125))

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

- Enhancement: Hero images can now be specified using the New-BurntToastNotification function using the -HeroImage parameter ([#80](https://github.com/Windos/BurntToast/issues/80))

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

- Enhancement: AppIDs can now be specified using the New-BurntToastNotification function using the -AppId parameter.

- 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.

- Fix: Weird edge cases when taking text from Twitch/IRC and using them in a toast is now sorted.

- Thanks [@potatoqualitee](https://github.com/potatoqualitee) and [@vexx32](https://github.com/vexx32)

- [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
43 changes: 24 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,26 @@ if you using Powershell 6 or later, extract into `$env:userprofile\Documents\Pow

**Please note:** as of v0.5.0, BurntToast no longer works on Windows 8.

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

- Enhancement: Header ID on New-BTHeader is now optional. An ID will be auto generated if not specified ([#125](https://github.com/Windos/BurntToast/issues/125))

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

- Enhancement: Hero images can now be specified using the New-BurntToastNotification function using the -HeroImage parameter ([#80](https://github.com/Windos/BurntToast/issues/80))

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

- Enhancement: AppIDs can now be specified using the New-BurntToastNotification function using the -AppId parameter.

- 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.

- Fix: Weird edge cases when taking text from Twitch/IRC and using them in a toast is now sorted.

- Thanks [@potatoqualitee](https://github.com/potatoqualitee) and [@vexx32](https://github.com/vexx32)

- [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 Expand Up @@ -100,32 +120,17 @@ if you using Powershell 6 or later, extract into `$env:userprofile\Documents\Pow

- Fix: BurntToast and .NET 5 ([#101](https://github.com/Windos/BurntToast/issues/101))

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

- Update: Microsoft Community Toolkit to 6.0.0

- New: Support relative paths on images

- New: "ScheduledToast" switch added to `Get-BTHistory` which returns scheduled or snoozed toast notifications

- Enhancement: Libraries only loaded on module import if libraries not already loaded

- Enhancement: Validate that image paths exist

- Fix: Reverted to XML clean up to remove curly braces if databindings are not being used (Issue #72)

- Known Issues:

- Regardless of what snooze option is chosen, a snoozed toast will re-appear after 9 minutes
- Cause is unknown and isn''t unique to v0.7.1, will be investigated while working on v0.7.2

- see more in the [Full Change Log](CHANGES.md)

## Contributors

- [Windos](https://github.com/Windos)
- [jeremytbrun](https://github.com/jeremytbrun)
- [KelvinTegelaar](https://github.com/KelvinTegelaar)
- [steviecoaster](https://github.com/steviecoaster)
- [glennsarti](https://github.com/glennsarti)
- [UniverseCitiz3n](https://github.com/UniverseCitiz3n)
- [cedarbaum](https://github.com/cedarbaum)

## License

Expand Down
17 changes: 17 additions & 0 deletions Tests/New-BTHeader.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@ Describe 'New-BTHeader' {
$Log | Should -Be $Expected
}
}

Context 'loaded without Id' {
Start-Transcript tmp.log
try {
New-BTHeader -Title 'First Category' -WhatIf
}
finally {
Stop-Transcript
$Log = (Get-Content tmp.log).Where({ $_ -match "What if: " })
Remove-Item tmp.log
}
It 'generates an Id' {
$Expected = 'Id=[a-zA-Z\d]+:Title'
$Log | Should -Match $Expected
}
}

Context 'clickable header text' {
Start-Transcript tmp.log
try {
Expand Down

0 comments on commit c7c0cfe

Please sign in to comment.