Add SandwichReminder-AutoOrder feature for automated sandwich ordering and enhance SandwichReminder logic
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user