Wetter: fehlende Ortungserlaubnis wird als solche benannt

"Wetter nicht abrufbar" war eine falsche Auskunft: abrufbar war es sehr wohl,
es fehlte nur die Erlaubnis. Derselbe Fehlertyp wie zuvor beim Kalender —
ein Zustand, den die App nicht kennt, landet im nächstbesten Sammelfall und
schickt den Nutzer damit in die Irre.

locationUndetermined ist jetzt ein eigener Zustand neben locationDenied. Der
Unterschied ist nicht kosmetisch: bei undetermined lohnt eine Anfrage, bei
denied fragt macOS nie wieder und es hilft nur der Weg über die
Systemeinstellungen oder ein fest gewählter Ort. Beide Fälle führen jetzt
dorthin, wo es weitergeht.

Die Anfrage kommt aus dem Berechtigungen-Reiter, nicht aus dem Hintergrund —
dieselbe Lehre wie beim Kalender: ohne Vordergrundfenster zeigt macOS keinen
Dialog, und die App wirkt kaputt, ohne dass irgendwo ein Fehler steht.

Aufgefallen war es daran, dass im Protokoll überhaupt kein Wetter-Eintrag
stand. Der einzige Pfad zu "nicht abrufbar" ohne Protokolleintrag war der
Standort — jetzt protokolliert auch der.
This commit is contained in:
Guido Schmit
2026-08-10 20:45:49 +02:00
parent a557c81baf
commit 3d21cac3b7
10 changed files with 534 additions and 329 deletions

View File

@@ -1,458 +1,490 @@
{
"sourceLanguage" : "en",
"strings" : {
"menu.openPanel" : {
"extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Panel öffnen"
"sourceLanguage": "en",
"strings": {
"menu.openPanel": {
"extractionState": "stale",
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Panel öffnen"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Open Panel"
"en": {
"stringUnit": {
"state": "translated",
"value": "Open Panel"
}
}
}
},
"menu.quit" : {
"extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Onyx beenden"
"menu.quit": {
"extractionState": "stale",
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Onyx beenden"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Quit Onyx"
"en": {
"stringUnit": {
"state": "translated",
"value": "Quit Onyx"
}
}
}
},
"menu.settings" : {
"extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Einstellungen …"
"menu.settings": {
"extractionState": "stale",
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Einstellungen …"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Settings…"
"en": {
"stringUnit": {
"state": "translated",
"value": "Settings…"
}
}
}
},
"settings.display.all" : {
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Allen Displays"
"settings.display.all": {
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Allen Displays"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "All displays"
"en": {
"stringUnit": {
"state": "translated",
"value": "All displays"
}
}
}
},
"settings.display.builtInOnly" : {
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Nur dem internen Display"
"settings.display.builtInOnly": {
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Nur dem internen Display"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Built-in display only"
"en": {
"stringUnit": {
"state": "translated",
"value": "Built-in display only"
}
}
}
},
"settings.display.hint" : {
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Auf Displays ohne echte Notch erscheint oben mittig ein Balken, der sich genauso verhält. Ist der Deckel geschlossen und kein internes Display vorhanden, erscheint das Panel trotzdem auf einem externen — sonst wäre Onyx nicht erreichbar."
"settings.display.hint": {
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Auf Displays ohne echte Notch erscheint oben mittig ein Balken, der sich genauso verhält. Ist der Deckel geschlossen und kein internes Display vorhanden, erscheint das Panel trotzdem auf einem externen — sonst wäre Onyx nicht erreichbar."
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "On displays without a real notch, a bar appears at the top centre and behaves the same. With the lid closed and no built-in display present, the panel still appears on an external one — otherwise Onyx would be unreachable."
"en": {
"stringUnit": {
"state": "translated",
"value": "On displays without a real notch, a bar appears at the top centre and behaves the same. With the lid closed and no built-in display present, the panel still appears on an external one — otherwise Onyx would be unreachable."
}
}
}
},
"settings.display.menuBarIcon" : {
"extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Symbol in der Menüleiste anzeigen"
"settings.display.menuBarIcon": {
"extractionState": "stale",
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Symbol in der Menüleiste anzeigen"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Show icon in the menu bar"
"en": {
"stringUnit": {
"state": "translated",
"value": "Show icon in the menu bar"
}
}
}
},
"settings.display.menuBarIcon.hint" : {
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Über das Symbol erreichst du Panel, Einstellungen und Beenden. Ohne es kommst du nur über die Notch an Onyx heran."
"settings.display.menuBarIcon.hint": {
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Über das Symbol erreichst du Panel, Einstellungen und Beenden. Ohne es kommst du nur über die Notch an Onyx heran."
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "The icon gives you the panel, settings and quit. Without it, the notch is the only way to reach Onyx."
"en": {
"stringUnit": {
"state": "translated",
"value": "The icon gives you the panel, settings and quit. Without it, the notch is the only way to reach Onyx."
}
}
}
},
"settings.display.policy" : {
"extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Panel anzeigen auf"
"settings.display.policy": {
"extractionState": "stale",
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Panel anzeigen auf"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Show panel on"
"en": {
"stringUnit": {
"state": "translated",
"value": "Show panel on"
}
}
}
},
"settings.permissions.calendar" : {
"extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Kalender"
"settings.permissions.calendar": {
"extractionState": "stale",
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Kalender"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Calendar"
"en": {
"stringUnit": {
"state": "translated",
"value": "Calendar"
}
}
}
},
"settings.permissions.calendar.why" : {
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Onyx zeigt deine Termine im Kalender-Widget an. Es wird ausschließlich gelesen, nie geschrieben."
"settings.permissions.calendar.why": {
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Onyx zeigt deine Termine im Kalender-Widget an. Es wird ausschließlich gelesen, nie geschrieben."
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Onyx shows your events in the calendar widget. It only ever reads, never writes."
"en": {
"stringUnit": {
"state": "translated",
"value": "Onyx shows your events in the calendar widget. It only ever reads, never writes."
}
}
}
},
"settings.permissions.granted" : {
"extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Erteilt"
"settings.permissions.granted": {
"extractionState": "stale",
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Erteilt"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Granted"
"en": {
"stringUnit": {
"state": "translated",
"value": "Granted"
}
}
}
},
"settings.permissions.openSystem" : {
"extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Systemeinstellungen öffnen"
"settings.permissions.openSystem": {
"extractionState": "stale",
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Systemeinstellungen öffnen"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Open System Settings"
"en": {
"stringUnit": {
"state": "translated",
"value": "Open System Settings"
}
}
}
},
"settings.permissions.request" : {
"extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Anfragen"
"settings.permissions.request": {
"extractionState": "stale",
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Anfragen"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Request"
"en": {
"stringUnit": {
"state": "translated",
"value": "Request"
}
}
}
},
"settings.size.large" : {
"extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Groß (2×2)"
"settings.size.large": {
"extractionState": "stale",
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Groß (2×2)"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Large (2×2)"
"en": {
"stringUnit": {
"state": "translated",
"value": "Large (2×2)"
}
}
}
},
"settings.size.medium" : {
"extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Mittel (2×1)"
"settings.size.medium": {
"extractionState": "stale",
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Mittel (2×1)"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Medium (2×1)"
"en": {
"stringUnit": {
"state": "translated",
"value": "Medium (2×1)"
}
}
}
},
"settings.size.small" : {
"extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Klein (1×1)"
"settings.size.small": {
"extractionState": "stale",
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Klein (1×1)"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Small (1×1)"
"en": {
"stringUnit": {
"state": "translated",
"value": "Small (1×1)"
}
}
}
},
"settings.size.wide" : {
"extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Breit (4×1)"
"settings.size.wide": {
"extractionState": "stale",
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Breit (4×1)"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Wide (4×1)"
"en": {
"stringUnit": {
"state": "translated",
"value": "Wide (4×1)"
}
}
}
},
"settings.tab.display" : {
"extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Anzeige"
"settings.tab.display": {
"extractionState": "stale",
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Anzeige"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Display"
"en": {
"stringUnit": {
"state": "translated",
"value": "Display"
}
}
}
},
"settings.tab.permissions" : {
"extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Berechtigungen"
"settings.tab.permissions": {
"extractionState": "stale",
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Berechtigungen"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Permissions"
"en": {
"stringUnit": {
"state": "translated",
"value": "Permissions"
}
}
}
},
"settings.tab.widgets" : {
"extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Widgets"
"settings.tab.widgets": {
"extractionState": "stale",
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Widgets"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Widgets"
"en": {
"stringUnit": {
"state": "translated",
"value": "Widgets"
}
}
}
},
"settings.widgets.add" : {
"extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Hinzufügen"
"settings.widgets.add": {
"extractionState": "stale",
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Hinzufügen"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Add"
"en": {
"stringUnit": {
"state": "translated",
"value": "Add"
}
}
}
},
"settings.widgets.available" : {
"extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Verfügbar"
"settings.widgets.available": {
"extractionState": "stale",
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Verfügbar"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Available"
"en": {
"stringUnit": {
"state": "translated",
"value": "Available"
}
}
}
},
"settings.widgets.empty" : {
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Keine Widgets im Panel. Das Panel bleibt leer, bis du eins hinzufügst."
"settings.widgets.empty": {
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Keine Widgets im Panel. Das Panel bleibt leer, bis du eins hinzufügst."
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "No widgets in the panel. It stays empty until you add one."
"en": {
"stringUnit": {
"state": "translated",
"value": "No widgets in the panel. It stays empty until you add one."
}
}
}
},
"settings.widgets.hint" : {
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Die Reihenfolge bestimmt die Anordnung im Panel. Jedes Widget rückt an die erste Stelle, an die es passt."
"settings.widgets.hint": {
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Die Reihenfolge bestimmt die Anordnung im Panel. Jedes Widget rückt an die erste Stelle, an die es passt."
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "The order determines the arrangement in the panel. Each widget takes the first spot it fits into."
"en": {
"stringUnit": {
"state": "translated",
"value": "The order determines the arrangement in the panel. Each widget takes the first spot it fits into."
}
}
}
},
"settings.widgets.inPanel" : {
"extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Im Panel"
"settings.widgets.inPanel": {
"extractionState": "stale",
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Im Panel"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "In the panel"
"en": {
"stringUnit": {
"state": "translated",
"value": "In the panel"
}
}
}
},
"settings.widgets.remove" : {
"extractionState" : "stale",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Aus dem Panel entfernen"
"settings.widgets.remove": {
"extractionState": "stale",
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Aus dem Panel entfernen"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Remove from panel"
"en": {
"stringUnit": {
"state": "translated",
"value": "Remove from panel"
}
}
}
},
"settings.permissions.location": {
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Standort"
}
},
"en": {
"stringUnit": {
"state": "translated",
"value": "Location"
}
}
}
},
"settings.permissions.location.why": {
"localizations": {
"de": {
"stringUnit": {
"state": "translated",
"value": "Onyx zeigt das Wetter an deinem aktuellen Standort. Ohne Zugriff kannst du stattdessen einen festen Ort wählen."
}
},
"en": {
"stringUnit": {
"state": "translated",
"value": "Onyx shows the weather for your current location. Without access you can pick a fixed place instead."
}
}
}
}
},
"version" : "1.0"
"version": "1.0"
}

View File

@@ -92,7 +92,9 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
// Immer einmal laden: mit Berechtigung kommen Termine, ohne sie zeigt
// das Widget den Berechtigungshinweis statt einer leeren Liste.
calendarModel.refresh()
guard !calendarModel.hasAccess else { return }
// Fenster öffnen, solange irgendeine Berechtigung noch aussteht.
let needsLocation = weatherModel?.locationIsUndetermined ?? false
guard !calendarModel.hasAccess || needsLocation else { return }
// Nicht im Hintergrund anfragen.
//
@@ -177,8 +179,9 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
@objc private func openSettings() { showSettings(tab: .widgets) }
private func showSettings(tab: SettingsTab) {
guard let model, let calendarModel else { return }
settingsWindow.show(model: model, calendarModel: calendarModel, tab: tab)
guard let model, let calendarModel, let weatherModel else { return }
settingsWindow.show(model: model, calendarModel: calendarModel,
weatherModel: weatherModel, tab: tab)
}
@objc private func quit() { NSApp.terminate(nil) }

View File

@@ -3,6 +3,7 @@ import OnyxDesign
import OnyxNotch
import OnyxWidgetKit
import CalendarProvider
import WeatherProvider
enum SettingsTab: Hashable {
case widgets, display, permissions
@@ -11,6 +12,7 @@ enum SettingsTab: Hashable {
struct SettingsView: View {
@Bindable var model: AppModel
let calendarModel: CalendarModel
let weatherModel: WeatherModel
@Binding var selectedTab: SettingsTab
var body: some View {
@@ -21,7 +23,7 @@ struct SettingsView: View {
DisplaySettings(model: model)
.tabItem { Label("settings.tab.display", systemImage: "macbook") }
.tag(SettingsTab.display)
PermissionSettings(calendarModel: calendarModel)
PermissionSettings(calendarModel: calendarModel, weatherModel: weatherModel)
.tabItem { Label("settings.tab.permissions", systemImage: "hand.raised") }
.tag(SettingsTab.permissions)
}
@@ -39,7 +41,9 @@ struct SettingsView: View {
/// Systemeinstellungen.
private struct PermissionSettings: View {
let calendarModel: CalendarModel
let weatherModel: WeatherModel
@State private var granted = false
@State private var locationGranted = false
var body: some View {
Form {
@@ -70,6 +74,30 @@ private struct PermissionSettings: View {
.fixedSize(horizontal: false, vertical: true)
}
Section {
HStack {
Label("settings.permissions.location", systemImage: "location")
Spacer()
if locationGranted {
Label("settings.permissions.granted", systemImage: "checkmark.circle.fill")
.foregroundStyle(.green)
.labelStyle(.titleAndIcon)
} else if weatherModel.locationIsDenied {
Button("settings.permissions.openSystem") { openLocationSettings() }
} else {
Button("settings.permissions.request") {
// Muss aus diesem Fenster kommen: macOS zeigt den
// Dialog nur, wenn eine App im Vordergrund ist.
weatherModel.requestLocationAuthorization()
}
}
}
Text("settings.permissions.location.why")
.font(.callout)
.foregroundStyle(.secondary)
.fixedSize(horizontal: false, vertical: true)
}
Section {
Button("settings.permissions.openSystem") { openPrivacySettings() }
}
@@ -94,6 +122,12 @@ private struct PermissionSettings: View {
@State private var didAutoRequest = false
private func openLocationSettings() {
guard let url = URL(string:
"x-apple.systempreferences:com.apple.preference.security?Privacy_LocationServices") else { return }
NSWorkspace.shared.open(url)
}
private func openPrivacySettings() {
guard let url = URL(string:
"x-apple.systempreferences:com.apple.preference.security?Privacy_Calendars") else { return }

View File

@@ -1,6 +1,7 @@
import AppKit
import SwiftUI
import CalendarProvider
import WeatherProvider
/// Führt das Einstellungsfenster selbst.
///
@@ -19,13 +20,15 @@ final class SettingsWindowController: NSObject, NSWindowDelegate {
/// Muss außerhalb der View liegen, damit ein erneutes Öffnen den Reiter setzen kann.
private var selectedTab: SettingsTab = .widgets
func show(model: AppModel, calendarModel: CalendarModel, tab: SettingsTab = .widgets) {
func show(model: AppModel, calendarModel: CalendarModel, weatherModel: WeatherModel,
tab: SettingsTab = .widgets) {
selectedTab = tab
if window == nil {
let hosting = NSHostingController(
rootView: SettingsView(model: model,
calendarModel: calendarModel,
weatherModel: weatherModel,
selectedTab: Binding(
get: { [weak self] in self?.selectedTab ?? .widgets },
set: { [weak self] in self?.selectedTab = $0 })))