Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Sources/ScrollkeeperUI/ScrollkeeperApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public struct ScrollkeeperApp: App {
#else
AboutCommands(updater: updater)
#endif
#else
PadAboutCommands()
#endif
}

Expand All @@ -39,6 +41,8 @@ public struct ScrollkeeperApp: App {
SettingsView()
.environment(store)
}
#else
AboutWindow()
#endif
}

Expand Down
52 changes: 52 additions & 0 deletions Sources/ScrollkeeperUI/Views/AboutWindow.swift
Original file line number Diff line number Diff line change
@@ -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
5 changes: 3 additions & 2 deletions docs/specs/library-manager/requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading