Skip to content

Commit 555648c

Browse files
committed
Fix App Store review issues: location permission, weather attribution, window management
- Add NSLocationUsageDescription to Info.plist for macOS (Guideline 5.1.1) - Add Apple Weather trademark and legal attribution link to WeatherResultView (Guideline 5.2.5) - Add Window menu item (Cmd+0) to show main window on macOS (Guideline 4) - Add MacAppDelegate to reopen window when dock icon clicked with no visible windows
1 parent 0464462 commit 555648c

File tree

3 files changed

+48
-2
lines changed

3 files changed

+48
-2
lines changed

apple/Clarissa/Resources/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
<string>Clarissa needs access to your contacts to help you find and reference contact information.</string>
5050
<key>NSLocationWhenInUseUsageDescription</key>
5151
<string>Clarissa needs your location to provide weather information and location-based assistance.</string>
52+
<key>NSLocationUsageDescription</key>
53+
<string>Clarissa needs your location to provide weather information and location-based assistance.</string>
5254
<key>NSMicrophoneUsageDescription</key>
5355
<string>Clarissa uses the microphone for voice input so you can speak your messages.</string>
5456
<key>NSPhotoLibraryUsageDescription</key>

apple/Clarissa/Sources/App/ClarissaApp.swift

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@ import FoundationModels
66

77
#if os(macOS)
88
import AppKit
9+
10+
/// macOS App Delegate to handle dock icon clicks when window is closed
11+
final class MacAppDelegate: NSObject, NSApplicationDelegate {
12+
/// Called when user clicks dock icon - reopen main window if none visible
13+
func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
14+
if !flag {
15+
// No visible windows - reopen the main window
16+
if let window = sender.windows.first {
17+
window.makeKeyAndOrderFront(nil)
18+
}
19+
}
20+
return true
21+
}
22+
}
923
#endif
1024

1125
#if os(iOS)
@@ -99,6 +113,10 @@ struct ClarissaApp: App {
99113
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
100114
#endif
101115

116+
#if os(macOS)
117+
@NSApplicationDelegateAdaptor(MacAppDelegate.self) var macAppDelegate
118+
#endif
119+
102120
// Use shared AppState so Intents, URL handling, and UI all share one source of truth
103121
// Note: Using @ObservedObject since AppState.shared is already created elsewhere
104122
// @StateObject would create ownership confusion with the shared singleton
@@ -246,6 +264,21 @@ struct ClarissaApp: App {
246264
.keyboardShortcut(".", modifiers: .command)
247265
}
248266

267+
// Window menu - add command to show main window
268+
CommandGroup(before: .windowList) {
269+
Button("Clarissa") {
270+
NSApplication.shared.activate(ignoringOtherApps: true)
271+
if let window = NSApplication.shared.windows.first(where: { $0.title == "Clarissa" || $0.identifier?.rawValue.contains("main") == true }) {
272+
window.makeKeyAndOrderFront(nil)
273+
} else if let window = NSApplication.shared.windows.first {
274+
window.makeKeyAndOrderFront(nil)
275+
}
276+
}
277+
.keyboardShortcut("0", modifiers: .command)
278+
279+
Divider()
280+
}
281+
249282
// Help menu
250283
CommandGroup(replacing: .help) {
251284
Link("Clarissa Documentation", destination: URL(string: "https://github.com/cameronrye/clarissa")!)

apple/Clarissa/Sources/UI/ToolResultViews.swift

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,20 @@ struct WeatherResultView: View {
159159
Text("\(Int(result.temperature))\(result.temperatureUnit)")
160160
.font(.title.weight(.semibold))
161161
}
162+
163+
// Apple Weather attribution (required by WeatherKit)
164+
Link(destination: URL(string: "https://weatherkit.apple.com/legal-attribution.html")!) {
165+
HStack(spacing: 4) {
166+
Image(systemName: "apple.logo")
167+
.font(.caption2)
168+
Text("Weather")
169+
.font(.caption2)
170+
}
171+
.foregroundStyle(.secondary)
172+
}
173+
.accessibilityLabel("Apple Weather. Tap for legal attribution.")
162174
}
163-
.accessibilityElement(children: .combine)
164-
.accessibilityLabel("Weather: \(result.condition), \(Int(result.temperature)) degrees")
175+
.accessibilityElement(children: .contain)
165176
}
166177
}
167178

0 commit comments

Comments
 (0)