Merge pull request #312 from KnifMelti/variables_fix

Variables from User-Run moved
pull/315/head
Romain 2023-04-12 14:21:44 +02:00 committed by GitHub
commit 633687a923
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 10 deletions

View File

@ -44,10 +44,6 @@ Get-NotifLocale
#Set common variables
$OnClickAction = "$WorkingDir\logs\updates.log"
$Button1Text = $NotifLocale.local.outputs.output[11].message
#The variables afterwards are used within Start-NotifTask.ps1
$Title = "Winget-AutoUpdate (WAU)"
$Balise = "Winget-AutoUpdate (WAU)"
$UserRun = $True
if ($Logs) {
if (Test-Path "$WorkingDir\logs\updates.log") {
@ -57,7 +53,7 @@ if ($Logs) {
#Not available yet
$Message = $NotifLocale.local.outputs.output[5].message
$MessageType = "warning"
Start-NotifTask -Message $Message -MessageType $MessageType
Start-NotifTask -Message $Message -MessageType $MessageType -UserRun
}
}
elseif ($Help) {
@ -69,7 +65,7 @@ else {
if (Test-WAUisRunning) {
$Message = $NotifLocale.local.outputs.output[8].message
$MessageType = "warning"
Start-NotifTask -Message $Message -MessageType $MessageType -Button1Text $Button1Text -Button1Action $OnClickAction -ButtonDismiss
Start-NotifTask -Message $Message -MessageType $MessageType -Button1Text $Button1Text -Button1Action $OnClickAction -ButtonDismiss -UserRun
break
}
#Run scheduled task
@ -77,7 +73,7 @@ else {
#Starting check - Send notification
$Message = $NotifLocale.local.outputs.output[6].message
$MessageType = "info"
Start-NotifTask -Message $Message -MessageType $MessageType -Button1Text $Button1Text -Button1Action $OnClickAction -ButtonDismiss
Start-NotifTask -Message $Message -MessageType $MessageType -Button1Text $Button1Text -Button1Action $OnClickAction -ButtonDismiss -UserRun
#Sleep until the task is done
While (Test-WAUisRunning) {
Start-Sleep 3
@ -95,12 +91,12 @@ else {
$MessageType = "success"
$Message = $NotifLocale.local.outputs.output[9].message
}
Start-NotifTask -Message $Message -MessageType $MessageType -Button1Text $Button1Text -Button1Action $OnClickAction -ButtonDismiss
Start-NotifTask -Message $Message -MessageType $MessageType -Button1Text $Button1Text -Button1Action $OnClickAction -ButtonDismiss -UserRun
}
catch {
#Check failed - Just send notification
$Message = $NotifLocale.local.outputs.output[7].message
$MessageType = "error"
Start-NotifTask -Message $Message -MessageType $MessageType -Button1Text $Button1Text -Button1Action $OnClickAction -ButtonDismiss
Start-NotifTask -Message $Message -MessageType $MessageType -Button1Text $Button1Text -Button1Action $OnClickAction -ButtonDismiss -UserRun
}
}

View File

@ -11,7 +11,8 @@ function Start-NotifTask {
[String]$Body,
[String]$Button1Text,
[String]$Button1Action,
[Switch]$ButtonDismiss = $false
[Switch]$ButtonDismiss = $false,
[Switch]$UserRun = $false
)
if (($WAUConfig.WAU_NotificationLevel -eq "Full") -or ($WAUConfig.WAU_NotificationLevel -eq "SuccessOnly" -and $MessageType -eq "Success") -or ($UserRun)) {