sojorn/sojorn_app/run_chrome.ps1
Patrick Britton 558272c9a2 Fix reaction UI updates - prioritize local state over post model
Change _reactionCountsFor and _myReactionsFor to prefer local state for immediate UI updates after toggle reactions, falling back to post model data when no local state exists.
2026-02-01 13:08:08 -06:00

52 lines
1.1 KiB
PowerShell

param(
[string]$EnvPath = (Join-Path $PSScriptRoot "..\.env")
)
if (-not (Test-Path $EnvPath)) {
Write-Error "Env file not found: ${EnvPath}"
exit 1
}
$values = @{}
Get-Content $EnvPath | ForEach-Object {
$line = $_.Trim()
if ($line.Length -eq 0) { return }
if ($line.StartsWith('#')) { return }
$parts = $line -split '=', 2
if ($parts.Count -lt 2) { return }
$key = $parts[0].Trim()
$value = $parts[1].Trim()
if ($value.StartsWith('"') -and $value.EndsWith('"')) {
$value = $value.Substring(1, $value.Length - 2)
}
$values[$key] = $value
}
$required = @('API_BASE_URL')
$missing = $required | Where-Object {
-not $values.ContainsKey($_) -or [string]::IsNullOrWhiteSpace($values[$_])
}
if ($missing.Count -gt 0) {
Write-Error "Missing required keys in ${EnvPath}: $($missing -join ', ')"
exit 1
}
$defineArgs = @(
"--dart-define=API_BASE_URL=$($values['API_BASE_URL'])"
)
Write-Host "Starting Sojorn on Chrome..." -ForegroundColor Green
Write-Host ""
Push-Location $PSScriptRoot
try {
flutter run -d chrome @defineArgs @Args
} finally {
Pop-Location
}