diff --git a/Sources/ScrollkeeperUI/ScrollkeeperApp.swift b/Sources/ScrollkeeperUI/ScrollkeeperApp.swift index 6a5a8e5..5498d20 100644 --- a/Sources/ScrollkeeperUI/ScrollkeeperApp.swift +++ b/Sources/ScrollkeeperUI/ScrollkeeperApp.swift @@ -31,6 +31,8 @@ public struct ScrollkeeperApp: App { #else AboutCommands(updater: updater) #endif + #else + PadAboutCommands() #endif } @@ -39,6 +41,8 @@ public struct ScrollkeeperApp: App { SettingsView() .environment(store) } + #else + AboutWindow() #endif } diff --git a/Sources/ScrollkeeperUI/Views/AboutWindow.swift b/Sources/ScrollkeeperUI/Views/AboutWindow.swift new file mode 100644 index 0000000..90f41de --- /dev/null +++ b/Sources/ScrollkeeperUI/Views/AboutWindow.swift @@ -0,0 +1,52 @@ +#if os(iOS) +import SwiftUI + +/// Replaces the About item in the iPad's menu bar, whose default opens an empty window, with one that opens +/// `AboutWindow`. +struct PadAboutCommands: Commands { + var body: some Commands { + CommandGroup(replacing: .appInfo) { AboutWindowButton() } + } +} + +/// The notice, links and acknowledgments that Settings shows, in a window of their own. It takes no links, which +/// still reach the library window. +struct AboutWindow: Scene { + static let id = "about" + + var body: some Scene { + WindowGroup("About \(AboutInfo.appName)", id: Self.id) { + AboutWindowContent() + } + .handlesExternalEvents(matching: []) + } +} + +/// Opens the About window; a view of its own, since `openWindow` is read from a view's environment. +private struct AboutWindowButton: View { + @Environment(\.openWindow) private var openWindow + + var body: some View { + Button("About \(AboutInfo.appName)") { openWindow(id: AboutWindow.id) } + } +} + +private struct AboutWindowContent: View { + @Environment(\.dismissWindow) private var dismissWindow + + var body: some View { + NavigationStack { + Form { + AboutView() + AcknowledgmentsView() + } + .navigationTitle("About \(AboutInfo.appName)") + .toolbar { + ToolbarItem(placement: .confirmationAction) { + Button("Done") { dismissWindow(id: AboutWindow.id) } + } + } + } + } +} +#endif diff --git a/docs/specs/library-manager/requirements.md b/docs/specs/library-manager/requirements.md index eccf7cd..73b5098 100644 --- a/docs/specs/library-manager/requirements.md +++ b/docs/specs/library-manager/requirements.md @@ -256,8 +256,9 @@ once, online or off. 11.1 The app is free. No feature depends on a payment. 11.2 The notice that Paizo's Community Use Policy prescribes is shown, in the - policy's own wording, in the README, in the Mac app's About panel, and in - the settings of both apps. + policy's own wording, in the README, in the Mac app's About panel, in the + settings of both apps, and in the window About Scrollkeeper opens from the + iPad's menu bar, which otherwise opens an empty window. 11.3 The Mac app and the README link to a page for optional donations. The iPad app does not, because Apple restricts links to outside payment pages. 11.4 Cover images and product descriptions are shown unmodified. The app icon