Add temperature-units config option

This commit is contained in:
James Babcock committed 2026-10-24 00:16:50 -07:00
1 parent 1780057f3c
commit 5256ab1ddc
8 files changed
+48 -6

No files matched your search

+6 -1
View File
@@ -1,6 +1,6 @@
import { ensureLocationPermission, hasLocationPermission } from "../../native/location-permissions";
import { weatherBridge } from "../../native/weather";
import { toggleSettingMenuItem } from "../../ui/dashboard-settings";
import { onAnySettingChanged, toggleSettingMenuItem } from "../../ui/dashboard-settings";
import { openSettingsSubMenu } from "../../ui/dashboard/settings-panel";
import { WeatherLayer } from "./weather";
import { weatherShowInStatusBarSetting, weatherShowOnSystemCardSetting } from "./weather-settings";
@@ -19,6 +19,7 @@ export function createWeatherAppWindow(options: InProcessAppOptions): InProcessW
let closed = false;
let requestingPermission = false;
let unsubscribe: (() => void) | null = null;
let unsubscribeSettings: (() => void) | null = null;
const requestUpdate = () => {
if (closed || requestingPermission) return;
@@ -81,11 +82,15 @@ export function createWeatherAppWindow(options: InProcessAppOptions): InProcessW
closed = true;
unsubscribe?.();
unsubscribe = null;
unsubscribeSettings?.();
unsubscribeSettings = null;
weatherBridge.stop();
options.onClosed();
},
});
unsubscribe = weatherBridge.onStateChange(() => app.requestRender());
// Repaint for a temperature-unit change made in the Settings app.
unsubscribeSettings = onAnySettingChanged(() => app.requestRender());
requestUpdate();
return app;
}