Add SandwichReminder-AutoOrder feature for automated sandwich ordering and enhance SandwichReminder logic

This commit is contained in:
Arne Moerman
2026-05-08 16:00:22 +02:00
parent c26898d4d2
commit 2592c0145f
5 changed files with 372 additions and 57 deletions
+15 -2
View File
@@ -118,8 +118,21 @@ function Invoke-Feature {
if ($decision -eq 'order') {
try {
Start-Process $Config['url']
Write-Log -Level Info -Message "Opened sandwich order URL: $($Config['url'])" -Feature 'SandwichReminder'
$rootConfig = Get-Config
$autoOrderConfig = $null
if ($rootConfig.features.ContainsKey('SandwichReminder-AutoOrder')) {
$autoOrderConfig = $rootConfig.features['SandwichReminder-AutoOrder']
}
if ($autoOrderConfig -and $autoOrderConfig['enabled']) {
Write-Log -Level Info -Message 'SandwichReminder-AutoOrder is enabled; running auto-order flow.' -Feature 'SandwichReminder'
[void](Invoke-SandwichAutoOrderFlow -AutoOrderConfig $autoOrderConfig -FallbackUrl $Config['url'])
}
else {
Start-Process $Config['url']
Write-Log -Level Info -Message "Opened sandwich order URL: $($Config['url'])" -Feature 'SandwichReminder'
}
}
catch {
Write-Log -Level Error -Message "Failed to open sandwich order URL '$($Config['url'])': $_" -Feature 'SandwichReminder'