Merge pull request #118 from Romanitho/dev
Added App changelog link on notification clickpull/119/head
commit
5652a5eaea
|
@ -0,0 +1,12 @@
|
|||
#Get App Info
|
||||
|
||||
Function Get-AppInfo ($AppID) {
|
||||
#Get AppID Info
|
||||
$String = & $winget show $AppID --accept-source-agreements -s winget | Out-String
|
||||
|
||||
#Search for Release Note info
|
||||
$ReleaseNote = [regex]::match($String,"(?<=Release Notes Url: )(.*)(?=\n)").Groups[0].Value
|
||||
|
||||
#Return Release Note
|
||||
return $ReleaseNote
|
||||
}
|
|
@ -1,12 +1,17 @@
|
|||
#Function to send notifications to user
|
||||
|
||||
function Start-NotifTask ($Title, $Message, $MessageType, $Balise) {
|
||||
function Start-NotifTask ($Title, $Message, $MessageType, $Balise, $OnClickAction) {
|
||||
|
||||
if (($WAUConfig.WAU_NotificationLevel -eq "Full") -or ($WAUConfig.WAU_NotificationLevel -eq "SuccessOnly" -and $MessageType -eq "Success")) {
|
||||
|
||||
#Prepare OnClickAction (if set)
|
||||
if ($OnClickAction){
|
||||
$ToastOnClickAction = "activationType='protocol' launch='$OnClickAction'"
|
||||
}
|
||||
|
||||
#Add XML variables
|
||||
[xml]$ToastTemplate = @"
|
||||
<toast launch="ms-get-started://redirect?id=apps_action">
|
||||
<toast $ToastOnClickAction>
|
||||
<visual>
|
||||
<binding template="ToastImageAndText03">
|
||||
<text id="1">$Title</text>
|
||||
|
|
|
@ -2,13 +2,16 @@
|
|||
|
||||
Function Update-App ($app) {
|
||||
|
||||
#Get App Info
|
||||
$OnClickAction = Get-AppInfo $app.Id
|
||||
|
||||
#Send available update notification
|
||||
Write-Log "Updating $($app.Name) from $($app.Version) to $($app.AvailableVersion)..." "Cyan"
|
||||
$Title = $NotifLocale.local.outputs.output[2].title -f $($app.Name)
|
||||
$Message = $NotifLocale.local.outputs.output[2].message -f $($app.Version), $($app.AvailableVersion)
|
||||
$MessageType = "info"
|
||||
$Balise = $($app.Name)
|
||||
Start-NotifTask $Title $Message $MessageType $Balise
|
||||
Start-NotifTask $Title $Message $MessageType $Balise $OnClickAction
|
||||
|
||||
#Winget upgrade
|
||||
Write-Log "########## WINGET UPGRADE PROCESS STARTS FOR APPLICATION ID '$($App.Id)' ##########" "Gray"
|
||||
|
@ -62,7 +65,7 @@ Function Update-App ($app) {
|
|||
$Message = $NotifLocale.local.outputs.output[3].message -f $($app.AvailableVersion)
|
||||
$MessageType = "success"
|
||||
$Balise = $($app.Name)
|
||||
Start-NotifTask $Title $Message $MessageType $Balise
|
||||
Start-NotifTask $Title $Message $MessageType $Balise $OnClickAction
|
||||
|
||||
$Script:InstallOK += 1
|
||||
|
||||
|
@ -77,7 +80,7 @@ Function Update-App ($app) {
|
|||
$Message = $NotifLocale.local.outputs.output[4].message
|
||||
$MessageType = "error"
|
||||
$Balise = $($app.Name)
|
||||
Start-NotifTask $Title $Message $MessageType $Balise
|
||||
Start-NotifTask $Title $Message $MessageType $Balise $OnClickAction
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2,12 +2,14 @@
|
|||
|
||||
function Update-WAU {
|
||||
|
||||
$OnClickAction = "https://github.com/Romanitho/Winget-AutoUpdate/releases"
|
||||
|
||||
#Send available update notification
|
||||
$Title = $NotifLocale.local.outputs.output[2].title -f "Winget-AutoUpdate"
|
||||
$Message = $NotifLocale.local.outputs.output[2].message -f $WAUCurrentVersion, $WAUAvailableVersion
|
||||
$MessageType = "info"
|
||||
$Balise = "Winget-AutoUpdate"
|
||||
Start-NotifTask $Title $Message $MessageType $Balise
|
||||
Start-NotifTask $Title $Message $MessageType $Balise $OnClickAction
|
||||
|
||||
#Run WAU update
|
||||
try {
|
||||
|
@ -52,7 +54,7 @@ function Update-WAU {
|
|||
$Message = $NotifLocale.local.outputs.output[3].message -f $WAUAvailableVersion
|
||||
$MessageType = "success"
|
||||
$Balise = "Winget-AutoUpdate"
|
||||
Start-NotifTask $Title $Message $MessageType $Balise
|
||||
Start-NotifTask $Title $Message $MessageType $Balise $OnClickAction
|
||||
|
||||
#Rerun with newer version
|
||||
Write-Log "Re-run WAU"
|
||||
|
@ -69,7 +71,7 @@ function Update-WAU {
|
|||
$Message = $NotifLocale.local.outputs.output[4].message
|
||||
$MessageType = "error"
|
||||
$Balise = "Winget-AutoUpdate"
|
||||
Start-NotifTask $Title $Message $MessageType $Balise
|
||||
Start-NotifTask $Title $Message $MessageType $Balise $OnClickAction
|
||||
Write-Log "WAU Update failed" "Red"
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue