Skip to content

Commit 61c7a94

Browse files
authored
Merge pull request #110 from Windos/v0.7.2
v0.7.2
2 parents f4cbd05 + 8061751 commit 61c7a94

File tree

16 files changed

+166
-2915
lines changed

16 files changed

+166
-2915
lines changed

Azure-Pipelines/BurntToast-Template.psm1

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
$WinMajorVersion = (Get-CimInstance -ClassName Win32_OperatingSystem -Property Version).Version.Split('.')[0]
33

44
if ($WinMajorVersion -ge 10) {
5-
$Library = @( Get-ChildItem -Path $PSScriptRoot\lib\*.dll -Recurse -ErrorAction SilentlyContinue )
5+
$Library = @( Get-ChildItem -Path $PSScriptRoot\lib\Microsoft.Toolkit.Uwp.Notifications\*.dll -Recurse -ErrorAction SilentlyContinue )
6+
7+
if ($IsWindows) {
8+
$Library += @( Get-ChildItem -Path $PSScriptRoot\lib\Microsoft.Windows.CsWinRT\*.dll -Recurse -ErrorAction SilentlyContinue )
9+
$Library += @( Get-ChildItem -Path $PSScriptRoot\lib\Microsoft.Windows.SDK.NET\*.dll -Recurse -ErrorAction SilentlyContinue )
10+
}
611

712
# Add one class from each expected DLL here:
813
$LibraryMap = @{
@@ -28,11 +33,13 @@ if ($WinMajorVersion -ge 10) {
2833

2934
Export-ModuleMember -Alias 'Toast'
3035
Export-ModuleMember -Function $PublicFunctions
31-
36+
3237
# Register default AppId
3338
New-BTAppId
3439

35-
$null = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
40+
if (-not $IsWindows) {
41+
$null = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
42+
}
3643
} else {
3744
throw 'This version of BurntToast will only work on Windows 10. If you would like to use BurntToast on Windows 8, please use version 0.4'
3845
}

Azure-Pipelines/build.ps1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,15 @@ if ($Bootstrap.IsPresent) {
1717
# For testing Pester
1818
if (-not (Get-Module -Name Pester -ListAvailable) -or (Get-Module -Name Pester -ListAvailable)[0].Version -eq [Version]'3.4.0') {
1919
Write-Warning "Module 'Pester' is missing. Installing 'Pester' ..."
20-
Install-Module -Name Pester -Scope CurrentUser -Force
20+
Install-Module -Name Pester -Scope CurrentUser -Force -RequiredVersion 4.10.1 -SkipPublisherCheck
2121
}
2222

23+
if ((Get-Module -Name Pester -ListAvailable)[0].Version -ne [Version]'4.10.1') {
24+
Install-Module -Name Pester -Scope CurrentUser -Force -RequiredVersion 4.10.1
25+
}
26+
27+
Import-Module -Name Pester -RequiredVersion 4.10.1
28+
2329
if (-not (Get-Module -Name PSCodeCovIo -ListAvailable)) {
2430
Write-Warning "Module 'PSCodeCovIo' is missing. Installing 'PSCodeCovIo' ..."
2531
Install-Module -Name PSCodeCovIo -Scope CurrentUser -Force
@@ -82,7 +88,7 @@ if($Test.IsPresent) {
8288
$RelevantFiles = (Get-ChildItem ./BurntToast -Recurse -Include "*.psm1","*.ps1").FullName
8389

8490
if ($env:TF_BUILD) {
85-
$res = Invoke-Pester "./Tests" -OutputFormat NUnitXml -OutputFile TestResults.xml -CodeCoverage $RelevantFiles -PassThru
91+
$res = Invoke-Pester "./Tests" -OutputFormat NUnitXml -OutputFile TestResults.xml -CodeCoverage $RelevantFiles -CodeCoverageOutputFileFormat 'JaCoCo' -CodeCoverageOutputFile "$Env:AgentTemp\CoverageResults.xml" -PassThru
8692
if ($res.FailedCount -gt 0) { throw "$($res.FailedCount) tests failed." }
8793
} else {
8894
$res = Invoke-Pester "./Tests" -CodeCoverage $RelevantFiles -PassThru

Azure-Pipelines/build.yml

Lines changed: 116 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,123 @@
1-
jobs:
2-
- job: CookToast
1+
stages:
2+
- stage: ThawBread
3+
displayName: 'Thaw Frozen Bread'
4+
jobs:
5+
- job: Srv2019_64bit
6+
displayName: 'Server 2019 - 64 bit'
7+
pool: 'AzPS7.1-Preview'
8+
steps:
9+
- task: PowerShell@2
10+
displayName: 'Run tests (individual .ps1 files) - Windows PowerShell - x64'
11+
inputs:
12+
targetType: Inline
13+
script: ./Azure-Pipelines/build.ps1 -Bootstrap -Test
14+
env:
15+
AgentTemp: $(Agent.TempDirectory)
16+
- task: PowerShell@2
17+
displayName: 'Run tests (individual .ps1 files) - PowerShell 7.1 Preview 5 - x64'
18+
inputs:
19+
targetType: Inline
20+
script: ./Azure-Pipelines/build.ps1 -Bootstrap -Test
21+
pwsh: true
22+
env:
23+
AgentTemp: $(Agent.TempDirectory)
24+
- job: Win10_32bit
25+
displayName: 'Windows 10 - 32 bit'
26+
pool: 'LabPS7x86'
27+
steps:
28+
- task: PowerShell@2
29+
displayName: 'Run tests (individual .ps1 files) - Windows PowerShell - x86'
30+
inputs:
31+
targetType: Inline
32+
script: ./Azure-Pipelines/build.ps1 -Bootstrap -Test
33+
env:
34+
AgentTemp: $(Agent.TempDirectory)
35+
- task: PowerShell@2
36+
displayName: 'Run tests (individual .ps1 files) - PowerShell 7.1 Preview 5 - x86'
37+
inputs:
38+
targetType: Inline
39+
script: ./Azure-Pipelines/build.ps1 -Bootstrap -Test
40+
pwsh: true
41+
env:
42+
AgentTemp: $(Agent.TempDirectory)
43+
- stage: CookToast
344
displayName: 'Cook Toast'
4-
pool:
5-
vmImage: 'windows-2019'
6-
steps:
7-
- task: PowerShell@2
8-
displayName: 'Run tests (individual .ps1 files)'
9-
inputs:
10-
targetType: Inline
11-
script: ./Azure-Pipelines/build.ps1 -Bootstrap -Test
45+
dependsOn: 'ThawBread'
46+
jobs:
47+
- job: PreBuild
48+
displayName: 'Pre-Build Tests'
49+
pool:
50+
vmImage: 'windows-2019'
51+
steps:
52+
- task: PowerShell@2
53+
displayName: 'Run tests (individual .ps1 files) - Windows PowerShell'
54+
inputs:
55+
targetType: Inline
56+
script: ./Azure-Pipelines/build.ps1 -Bootstrap -Test
57+
env:
58+
AgentTemp: $(Agent.TempDirectory)
59+
- job: 'BuildRetest'
60+
displayName: 'Build & Re-test'
61+
dependsOn: 'PreBuild'
62+
pool:
63+
vmImage: 'windows-2019'
64+
steps:
65+
- task: PowerShell@2
66+
displayName: 'Run tests (individual .ps1 files) - PowerShell Core'
67+
inputs:
68+
targetType: Inline
69+
script: ./Azure-Pipelines/build.ps1 -Bootstrap -Test
70+
pwsh: true
71+
env:
72+
AgentTemp: $(Agent.TempDirectory)
1273

13-
- task: PowerShell@2
14-
displayName: 'Compile module'
15-
inputs:
16-
targetType: Inline
17-
script: ./Azure-Pipelines/build.ps1 -Compile
74+
- task: PowerShell@2
75+
displayName: 'Compile module'
76+
inputs:
77+
targetType: Inline
78+
script: ./Azure-Pipelines/build.ps1 -Bootstrap -Compile
1879

19-
- task: PowerShell@2
20-
displayName: 'Run tests (compiled .psm1)'
21-
inputs:
22-
targetType: Inline
23-
script: ./Azure-Pipelines/build.ps1 -Test
80+
- task: PowerShell@2
81+
displayName: 'Run tests (compiled .psm1)'
82+
inputs:
83+
targetType: Inline
84+
script: ./Azure-Pipelines/build.ps1 -Test
85+
env:
86+
AgentTemp: $(Agent.TempDirectory)
2487

25-
- task: PublishTestResults@2
26-
displayName: 'Publish test results'
27-
inputs:
28-
testRunner: NUnit
29-
testResultsFiles: '**/TestResults.xml'
30-
condition: succeededOrFailed()
88+
- task: PublishTestResults@2
89+
displayName: 'Publish test results'
90+
inputs:
91+
testRunner: NUnit
92+
testResultsFiles: '**/TestResults.xml'
93+
condition: succeededOrFailed()
94+
- task: PublishCodeCoverageResults@1
95+
displayName: 'Publish code coverage results'
96+
inputs:
97+
summaryFileLocation: $(Agent.TempDirectory)/CoverageResults.xml
98+
pathToSources: $(Agent.TempDirectory)
99+
condition: succeededOrFailed()
31100

32-
- task: Bash@3
33-
displayName: 'Upload coverage to Codecov'
34-
inputs:
35-
targetType: 'filePath' # Optional. Options: filePath, inline
36-
filePath: ./codecov.sh
37-
arguments: -f coverage.json -t $(CODECOV_TOKEN)
38-
#script: '# Write your commands here# Use the environment variables input below to pass secret variables to this script' # Required when targetType == Inline
39-
#workingDirectory: # Optional
40-
#failOnStderr: false # Optional
101+
- task: Bash@3
102+
displayName: 'Upload coverage to Codecov'
103+
inputs:
104+
targetType: 'filePath' # Optional. Options: filePath, inline
105+
filePath: ./codecov.sh
106+
arguments: -f coverage.json -t $(CODECOV_TOKEN)
107+
#script: '# Write your commands here# Use the environment variables input below to pass secret variables to this script' # Required when targetType == Inline
108+
#workingDirectory: # Optional
109+
#failOnStderr: false # Optional
41110

42-
- task: PublishPipelineArtifact@0
43-
displayName: 'Publish compiled module artifact'
44-
inputs:
45-
artifactName: 'BurntToast'
46-
targetPath: ./BurntToast
47-
condition: succeededOrFailed()
111+
- task: PublishPipelineArtifact@0
112+
displayName: 'Publish compiled module artifact'
113+
inputs:
114+
artifactName: 'BurntToast'
115+
targetPath: ./BurntToast
116+
condition: succeededOrFailed()
48117

49-
- task: PublishPipelineArtifact@0
50-
displayName: 'Publish Pipelines scripts as artifact'
51-
inputs:
52-
artifactName: 'PipelinesScripts'
53-
targetPath: ./Azure-Pipelines
54-
condition: succeededOrFailed()
118+
- task: PublishPipelineArtifact@0
119+
displayName: 'Publish Pipelines scripts as artifact'
120+
inputs:
121+
artifactName: 'PipelinesScripts'
122+
targetPath: ./Azure-Pipelines
123+
condition: succeededOrFailed()

BurntToast/BurntToast.psd1

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@{
22
RootModule = 'BurntToast.psm1'
3-
ModuleVersion = '0.7.1'
3+
ModuleVersion = '0.7.2'
44
# Can only use CompatiblePSEditions if PowerShellVersion is set to 5.1, not sure about limiting this to that version yet.
55
# CompatiblePSEditions = @('Desktop')
66
GUID = '751a2aeb-a68f-422e-a2ea-376bdd81612a'
@@ -40,19 +40,11 @@
4040
LicenseUri = 'https://github.com/Windos/BurntToast/blob/master/LICENSE'
4141
ProjectUri = 'https://github.com/Windos/BurntToast'
4242
IconUri = 'https://raw.githubusercontent.com/Windos/BurntToast/master/Media/BurntToast-Logo.png'
43-
ReleaseNotes = '# 0.7.1
43+
ReleaseNotes = '# 0.7.2
4444
45-
* Update: Microsoft Community Toolkit to 6.0.0
46-
* New: Support relative paths on images
47-
* New: "ScheduledToast" switch added to `Get-BTHistory` which returns scheduled or snoozed toast notifications
48-
* Enhancement: Libraries only loaded on module import if libraries not already loaded
49-
* Enhancement: Validate that image paths exist
50-
* Fix: Reverted to XML clean up to remove curly braces if databindings are not being used (Issue #72)
51-
52-
## Known Issues
53-
54-
* Regardless of what snooze option is chosen, a snoozed toast will re-appear after 9 minutes
55-
* Cause is unknown and isn''t unique to v0.7.1, will be investigated while working on v0.7.2
45+
* Fix: Curly Braces when "Reminder" pops up ([#72](https://github.com/Windos/BurntToast/issues/72))
46+
* Fix: Caching remote gifs are saved based on their remote filename and not overwritten ([#105](https://github.com/Windos/BurntToast/issues/105)) - Thanks [@KelvinTegelaar](https://github.com/KelvinTegelaar)
47+
* Fix: BurntToast and .NET 5 ([#101](https://github.com/Windos/BurntToast/issues/101))
5648
'
5749
}
5850
}

BurntToast/BurntToast.psm1

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ $WinMajorVersion = (Get-CimInstance -ClassName Win32_OperatingSystem -Property V
33
if ($WinMajorVersion -ge 10) {
44
$Public = @( Get-ChildItem -Path $PSScriptRoot\Public\*.ps1 -ErrorAction SilentlyContinue )
55
$Private = @( Get-ChildItem -Path $PSScriptRoot\Private\*.ps1 -ErrorAction SilentlyContinue )
6-
$Library = @( Get-ChildItem -Path $PSScriptRoot\lib\*.dll -Recurse -ErrorAction SilentlyContinue )
6+
$Library = @( Get-ChildItem -Path $PSScriptRoot\lib\Microsoft.Toolkit.Uwp.Notifications\*.dll -Recurse -ErrorAction SilentlyContinue )
7+
8+
if ($IsWindows) {
9+
$Library += @( Get-ChildItem -Path $PSScriptRoot\lib\Microsoft.Windows.CsWinRT\*.dll -Recurse -ErrorAction SilentlyContinue )
10+
$Library += @( Get-ChildItem -Path $PSScriptRoot\lib\Microsoft.Windows.SDK.NET\*.dll -Recurse -ErrorAction SilentlyContinue )
11+
}
712

813
# Add one class from each expected DLL here:
914
$LibraryMap = @{
@@ -41,7 +46,9 @@ if ($WinMajorVersion -ge 10) {
4146
# Register default AppId
4247
New-BTAppId
4348

44-
$null = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
49+
if (-not $IsWindows) {
50+
$null = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
51+
}
4552
} else {
4653
throw 'This version of BurntToast will only work on Windows 10. If you would like to use BurntToast on Windows 8, please use version 0.4'
4754
}

BurntToast/Private/Optimize-BTImageSource.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function Optimize-BTImageSource {
55
)
66

77
if ([bool]([System.Uri]$Source).IsUnc -or $Source -like 'http?://*') {
8-
$RemoteFileName = $Source.Split('/\')[-1] -replace '[\[\]*?]',''
8+
$RemoteFileName = $Source -replace '/|:', '-'
99

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

BurntToast/Public/Submit-BTNotification.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@
5353
Write-Warning -Message "The AppId $AppId is not present in the registry, please run New-BTAppId to avoid inconsistent Toast behaviour."
5454
}
5555

56-
$null = [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime]
56+
if (-not $IsWindows) {
57+
$null = [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime]
58+
}
5759

5860
$ToastXml = [Windows.Data.Xml.Dom.XmlDocument]::new()
5961

0 commit comments

Comments
 (0)