Skip to content

Commit

Permalink
Merge pull request #57 from Windos/v0.7.0
Browse files Browse the repository at this point in the history
v0.6.3
  • Loading branch information
Windos authored Feb 2, 2019
2 parents 1aa9512 + 3f66268 commit 584a60b
Show file tree
Hide file tree
Showing 39 changed files with 641 additions and 377 deletions.
2 changes: 1 addition & 1 deletion Azure-Pipelines/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ param(

# Bootstrap step
if ($Bootstrap.IsPresent) {
Write-Host "Validate and install missing prerequisits for building ..."
Write-Information "Validate and install missing prerequisits for building ..."

# For testing Pester
if (-not (Get-Module -Name Pester -ListAvailable)) {
Expand Down
20 changes: 10 additions & 10 deletions BurntToast/BurntToast.psd1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@{
RootModule = 'BurntToast.psm1'
ModuleVersion = '0.6.2'
ModuleVersion = '0.6.3'
# 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 @@ -32,15 +32,15 @@
Tags = @('Notifications', 'Utilities', 'Windows10', 'Toast')
LicenseUri = 'https://github.com/Windos/BurntToast/blob/master/LICENSE'
ProjectUri = 'https://github.com/Windos/BurntToast'
IconUri = 'https://cdn.rawgit.com/Windos/BurntToast/master/Media/BurntToast-Logo.png'
ReleaseNotes = '
* Updated UWP Toolkit to 2.2.0
* Fixed an issue with sound looping
* New-BurntToastNotification now accepts multiple ProgressBar objects
* Fixed Issue #28 on GitHub, ProgressBars should now work for all locales
* Fixed Issue #18 on GitHub, Images from the internet will now be downloaded locally
* Supports regular images, hero images, and applogo
* All functions now included in .psm1 for release (Thanks @HalbaradKenafin)
IconUri = 'https://raw.githubusercontent.com/Windos/BurntToast/master/Media/BurntToast-Logo.png'
ReleaseNotes = '# 0.6.3
* Update Windows Community Toolkit (UWP Notifications) to 5.0.0.
* Also switched to the UAP variant, as the .NET Standard one was causing issues for some users.
* (BACKEND) Implemented CI pester tests on Azure DevOps Pipelines, including code coverage stats.
* Fixed style issues flagged by Codacy, mainly Markdown headers.
* Added WhatIf support to all functions, laying ground work for expanded (read: any) Pester tests.
* Functions all in .psm1 now, instead of separate .ps1 files. SPEED!
'
}
}
Expand Down
7 changes: 5 additions & 2 deletions BurntToast/Public/New-BTAction.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
https://github.com/Windos/BurntToast/blob/master/Help/New-BTAction.md
#>

[CmdletBinding(DefaultParametersetName = 'Custom Actions')]
[CmdletBinding(DefaultParametersetName = 'Custom Actions',
SupportsShouldProcess = $true)]
[OutputType([Microsoft.Toolkit.Uwp.Notifications.IToastActions])]
param (
# Button objects created with the New-BTButton function. Up to five can be included, or less if Context Menu Items are also included.
Expand Down Expand Up @@ -90,6 +91,8 @@
}
}

$ToastActions
if($PSCmdlet.ShouldProcess("returning: [$($ToastActions.GetType().Name)] with $($ToastActions.Inputs.Count) Inputs, $($ToastActions.Buttons.Count) Buttons, and $($ToastActions.ContextMenuItems.Count) ContextMenuItems")) {
$ToastActions
}
}
}
8 changes: 5 additions & 3 deletions BurntToast/Public/New-BTAppId.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
https://github.com/Windos/BurntToast/blob/master/Help/New-BTAppId.md
#>

[CmdletBinding()]
[CmdletBinding(SupportsShouldProcess = $true)]
param (
# Specifies the new AppId. You can use any alphanumeric characters.
#
Expand All @@ -42,8 +42,10 @@
$RegPath = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings'

if (!(Test-Path -Path "$RegPath\$AppId")) {
$null = New-Item -Path "$RegPath\$AppId" -Force
$null = New-ItemProperty -Path "$RegPath\$AppId" -Name 'ShowInActionCenter' -Value 1 -PropertyType 'DWORD'
if($PSCmdlet.ShouldProcess("creating: '$RegPath\$AppId' with property 'ShowInActionCenter' set to '1' (DWORD)")) {
$null = New-Item -Path "$RegPath\$AppId" -Force
$null = New-ItemProperty -Path "$RegPath\$AppId" -Name 'ShowInActionCenter' -Value 1 -PropertyType 'DWORD'
}
} else {
Write-Verbose -Message 'Specified AppId is already present in the registry.'
}
Expand Down
7 changes: 5 additions & 2 deletions BurntToast/Public/New-BTAudio.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
https://github.com/Windos/BurntToast/blob/master/Help/New-BTAudio.md
#>

[CmdletBinding(DefaultParameterSetName = 'StandardSound')]
[CmdletBinding(DefaultParameterSetName = 'StandardSound',
SupportsShouldProcess = $true)]
[OutputType([Microsoft.Toolkit.Uwp.Notifications.ToastAudio])]
param (
# Specifies one of the built in Microsoft notification sounds.
Expand Down Expand Up @@ -107,5 +108,7 @@
$Audio.Loop = $Loop
$Audio.Silent = $Silent

$Audio
if($PSCmdlet.ShouldProcess("returning: [$($Audio.GetType().Name)]:Src=$($Audio.Src):Loop=$($Audio.Loop):Silent=$($Audio.Silent)")) {
$Audio
}
}
6 changes: 4 additions & 2 deletions BurntToast/Public/New-BTBinding.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
https://github.com/Windos/BurntToast/blob/master/Help/New-BTBinding.md
#>

[CmdletBinding()]
[CmdletBinding(SupportsShouldProcess = $true)]
[OutputType([Microsoft.Toolkit.Uwp.Notifications.ToastBindingGeneric])]
param (
# The contents of the body of the Toast, which can include Text (New-BTText), Image (New-BTImage), Group (not yet implemented), and Progress Bar (New-BTProgressBar).
Expand Down Expand Up @@ -100,5 +100,7 @@
$Binding.Language = $Language
}

$Binding
if($PSCmdlet.ShouldProcess("returning: [$($Binding.GetType().Name)]:Children=$($Binding.Children.Count):AddImageQuery=$($Binding.AddImageQuery.Count):AppLogoOverride=$($Binding.AppLogoOverride.Count):Attribution=$($Binding.Attribution.Count):BaseUri=$($Binding.BaseUri.Count):HeroImage=$($Binding.HeroImage.Count):Language=$($Binding.Language.Count)")) {
$Binding
}
}
9 changes: 7 additions & 2 deletions BurntToast/Public/New-BTButton.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
https://github.com/Windos/BurntToast/blob/master/Help/New-BTButton.md
#>

[CmdletBinding(DefaultParametersetName = 'Button')]
[CmdletBinding(DefaultParametersetName = 'Button',
SupportsShouldProcess = $true)]
[OutputType([Microsoft.Toolkit.Uwp.Notifications.ToastButton], ParameterSetName = 'Button')]
[OutputType([Microsoft.Toolkit.Uwp.Notifications.ToastButtonDismiss], ParameterSetName = 'Dismiss')]
[OutputType([Microsoft.Toolkit.Uwp.Notifications.ToastButtonSnooze], ParameterSetName = 'Snooze')]
Expand Down Expand Up @@ -137,5 +138,9 @@
}
}

$Button
switch ($Button.GetType().Name) {
ToastButton { if($PSCmdlet.ShouldProcess("returning: [$($Button.GetType().Name)]:Content=$($Button.Content):Arguments=$($Button.Arguments):ActivationType=$($Button.ActivationType):ImageUri=$($Button.ImageUri):TextBoxId=$($Button.TextBoxId)")) { $Button }}
ToastButtonSnooze { if($PSCmdlet.ShouldProcess("returning: [$($Button.GetType().Name)]:CustomContent=$($Button.CustomContent):ImageUri=$($Button.ImageUri):SelectionBoxId=$($Button.SelectionBoxId)")) { $Button } }
ToastButtonDismiss { if($PSCmdlet.ShouldProcess("returning: [$($Button.GetType().Name)]:CustomContent=$($Button.CustomContent):ImageUri=$($Button.ImageUri)")) { $Button } }
}
}
6 changes: 4 additions & 2 deletions BurntToast/Public/New-BTContent.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
https://github.com/Windos/BurntToast/blob/master/Help/New-BTContent.md
#>

[CmdletBinding()]
[CmdletBinding(SupportsShouldProcess = $true)]
[OutputType([Microsoft.Toolkit.Uwp.Notifications.ToastContent])]
param (
# Optionally create custom actions with buttons and inputs (New-BTAction.)
Expand Down Expand Up @@ -98,5 +98,7 @@
$ToastContent.Visual = $Visual
}

$ToastContent
if($PSCmdlet.ShouldProcess( "returning: [$($ToastContent.GetType().Name)] with XML: $($ToastContent.GetContent())" )) {
$ToastContent
}
}
6 changes: 4 additions & 2 deletions BurntToast/Public/New-BTContextMenuItem.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
https://github.com/Windos/BurntToast/blob/master/Help/New-BTContextMenuItem.md
#>

[CmdletBinding()]
[CmdletBinding(SupportsShouldProcess = $true)]
[OutputType([Microsoft.Toolkit.Uwp.Notifications.ToastContextMenuItem])]

param (
Expand All @@ -49,5 +49,7 @@
$MenuItem.ActivationType = $ActivationType
}

$MenuItem
if($PSCmdlet.ShouldProcess("returning: [$($MenuItem.GetType().Name)]:Content=$($MenuItem.Content):Arguments=$($MenuItem.Arguments):ActivationType=$($MenuItem.ActivationType)")) {
$MenuItem
}
}
6 changes: 4 additions & 2 deletions BurntToast/Public/New-BTHeader.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
https://github.com/Windos/BurntToast/blob/master/Help/New-BTHeader.md
#>

[CmdletBinding()]
[CmdletBinding(SupportsShouldProcess = $true)]

param (
# 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.
Expand Down Expand Up @@ -63,5 +63,7 @@
$Header.ActivationType = $ActivationType
}

$Header
if($PSCmdlet.ShouldProcess("returning: [$($Header.GetType().Name)]:Id=$($Header.Id):Title=$($Header.Title):Arguments=$($Header.Arguments):ActivationType=$($Header.ActivationType)")) {
$Header
}
}
11 changes: 8 additions & 3 deletions BurntToast/Public/New-BTImage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
https://github.com/Windos/BurntToast/blob/master/Help/New-BTImage.md
#>

[CmdletBinding(DefaultParameterSetName = 'Image')]
[CmdletBinding(DefaultParameterSetName = 'Image',
SupportsShouldProcess = $true)]
[OutputType([Microsoft.Toolkit.Uwp.Notifications.AdaptiveImage], ParameterSetName = 'Image')]
[OutputType([Microsoft.Toolkit.Uwp.Notifications.ToastGenericAppLogo], ParameterSetName = 'AppLogo')]
[OutputType([Microsoft.Toolkit.Uwp.Notifications.ToastGenericHeroImage], ParameterSetName = 'Hero')]
Expand Down Expand Up @@ -107,7 +108,7 @@

if ($Source) {
if ($Source -like 'http?://*') {
$RemoteFileName = $Source.Split('/')[-1]
$RemoteFileName = $Source.Split('/')[-1] -replace '[\[\]*?]',''

$NewFilePath = '{0}\{1}' -f $Env:TEMP, $RemoteFileName

Expand All @@ -129,5 +130,9 @@
$Image.AddImageQuery = $AddImageQuery
}

$Image
switch ($Image.GetType().Name) {
AdaptiveImage { if($PSCmdlet.ShouldProcess("returning: [$($Image.GetType().Name)]:Source=$($Image.Source):AlternateText=$($Image.AlternateText):HintCrop=$($Image.HintCrop):HintRemoveMargin=$($Image.HintRemoveMargin):HintAlign=$($Image.HintAlign):AddImageQuery=$($Image.AddImageQuery)")) { $Image } }
ToastGenericAppLogo { if($PSCmdlet.ShouldProcess("returning: [$($Image.GetType().Name)]:Source=$($Image.Source):AlternateText=$($Image.AlternateText):HintCrop=$($Image.HintCrop):AddImageQuery=$($Image.AddImageQuery)")) { $Image } }
ToastGenericHeroImage { if($PSCmdlet.ShouldProcess("returning: [$($Image.GetType().Name)]:Source=$($Image.Source):AlternateText=$($Image.AlternateText):AddImageQuery=$($Image.AddImageQuery)")) { $Image } }
}
}
8 changes: 6 additions & 2 deletions BurntToast/Public/New-BTInput.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
https://github.com/Windos/BurntToast/blob/master/Help/New-BTInput.md
#>

[CmdletBinding(DefaultParametersetName = 'Text')]
[CmdletBinding(DefaultParametersetName = 'Text',
SupportsShouldProcess = $true)]
[OutputType([Microsoft.Toolkit.Uwp.Notifications.ToastTextBox], ParametersetName = 'Text')]
[OutputType([Microsoft.Toolkit.Uwp.Notifications.ToastSelectionBox], ParametersetName = 'Text')]

Expand Down Expand Up @@ -96,5 +97,8 @@
$ToastInput.Title = $Title
}

$ToastInput
switch ($Image.GetType().Name) {
ToastTextBox { if($PSCmdlet.ShouldProcess("returning: [$($ToastInput.GetType().Name)]:Id=$($ToastInput.Id):Title=$($ToastInput.Title):PlaceholderContent=$($ToastInput.PlaceholderContent):DefaultInput=$($ToastInput.DefaultInput)")) { $ToastInput } }
ToastSelectionBox { if($PSCmdlet.ShouldProcess("returning: [$($ToastInput.GetType().Name)]:Id=$($ToastInput.Id):Title=$($ToastInput.Title):DefaultSelectionBoxItemId=$($ToastInput.DefaultSelectionBoxItemId):DefaultInput=$($ToastInput.Items.Count)")) { $ToastInput } }
}
}
7 changes: 5 additions & 2 deletions BurntToast/Public/New-BTProgressBar.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
https://github.com/Windos/BurntToast/blob/master/Help/New-BTProgressBar.md
#>

[CmdletBinding(DefaultParameterSetName = 'Determinate')]
[CmdletBinding(DefaultParameterSetName = 'Determinate',
SupportsShouldProcess = $true)]
param (
# The text displayed above the progress bar. Generally used to give context around what the bar represents.
[string] $Title,
Expand Down Expand Up @@ -93,5 +94,7 @@
$ProgressBar.ValueStringOverride = $ValueDisplay
}

$ProgressBar
if($PSCmdlet.ShouldProcess("returning: [$($ProgressBar.GetType().Name)]:Status=$($ProgressBar.Status):Title=$($ProgressBar.Title):Value=$($ProgressBar.Value):ValueStringOverride=$($ProgressBar.ValueStringOverride)")) {
$ProgressBar
}
}
8 changes: 6 additions & 2 deletions BurntToast/Public/New-BTSelectionBoxItem.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
https://github.com/Windos/BurntToast/blob/master/Help/New-BTSelectionBoxItem.md
#>

[CmdletBinding()]
[CmdletBinding(SupportsShouldProcess = $true)]
[OutputType([Microsoft.Toolkit.Uwp.Notifications.ToastSelectionBoxItem])]

param (
Expand All @@ -41,5 +41,9 @@
[string] $Content
)

[Microsoft.Toolkit.Uwp.Notifications.ToastSelectionBoxItem]::new($Id, $Content)
$SelectionBoxItem = [Microsoft.Toolkit.Uwp.Notifications.ToastSelectionBoxItem]::new($Id, $Content)

if($PSCmdlet.ShouldProcess("returning: [$($SelectionBoxItem.GetType().Name)]:Id=$($SelectionBoxItem.Id):Content=$($SelectionBoxItem.Content)")) {
$SelectionBoxItem
}
}
6 changes: 4 additions & 2 deletions BurntToast/Public/New-BTText.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
https://github.com/Windos/BurntToast/blob/master/Help/New-BTText.md
#>

[CmdletBinding()]
[CmdletBinding(SupportsShouldProcess = $true)]
[OutputType([Microsoft.Toolkit.Uwp.Notifications.AdaptiveText])]
param (
# The text to display. Data binding support added in Creators Update, only works for toast top-level text elements (But appears to not be working via PowerShell yet.)
Expand Down Expand Up @@ -100,5 +100,7 @@
$TextObj.Language = $Language
}

$TextObj
if($PSCmdlet.ShouldProcess("returning: [$($TextObj.GetType().Name)]:Text=$($TextObj.Text):HintMaxLines=$($TextObj.HintMaxLines):HintMinLines=$($TextObj.HintMinLines):HintWrap=$($TextObj.HintWrap):HintAlign=$($TextObj.HintAlign):HintStyle=$($TextObj.HintStyle):Language=$($TextObj.Language)")) {
$TextObj
}
}
13 changes: 6 additions & 7 deletions BurntToast/Public/New-BTVisual.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
https://github.com/Windos/BurntToast/blob/master/Help/New-BTVisual.md
#>

[CmdletBinding()]
[CmdletBinding(SupportsShouldProcess = $true)]
[OutputType([Microsoft.Toolkit.Uwp.Notifications.ToastVisual])]
param (
# The generic Toast binding, which can be rendered on all devices. This binding is created using the New-BTBinding function.
[Parameter()]
[Parameter(Mandatory)]
[Microsoft.Toolkit.Uwp.Notifications.ToastBindingGeneric] $BindingGeneric,

# Specify this switch to allow Windows to append a query string to the image URI supplied in the Toast notification. Use this attribute if your server hosts images and can handle query strings, either by retrieving an image variant based on the query strings or by ignoring the query string and returning the image as specified without the query string. This query string specifies scale, contrast setting, and language.
Expand All @@ -44,10 +44,7 @@
)

$Visual = [Microsoft.Toolkit.Uwp.Notifications.ToastVisual]::new()

if ($BindingGeneric) {
$Visual.BindingGeneric = $BindingGeneric
}
$Visual.BindingGeneric = $BindingGeneric

if ($AddImageQuery) {
$Visual.AddImageQuery = $AddImageQuery
Expand All @@ -61,5 +58,7 @@
$Visual.Language = $Language
}

$Visual
if($PSCmdlet.ShouldProcess("returning: [$($Visual.GetType().Name)]:BindingGeneric=$($Visual.BindingGeneric.Children.Count):BaseUri=$($Visual.BaseUri):Language=$($Visual.Language)")) {
$Visual
}
}
Loading

0 comments on commit 584a60b

Please sign in to comment.