Add support for AboutWindow's issues URL

This commit is contained in:
david-swift 2024-01-27 22:17:47 +01:00
parent fd3c81d520
commit aef77da78b
3 changed files with 17 additions and 3 deletions

View File

@ -29,6 +29,8 @@ public struct AboutWindow: WindowScene {
var icon: Icon?
/// The app's website.
var website: URL?
/// The link for opening issues.
var issues: URL?
/// The path to the app data file.
var path: URL?
@ -72,6 +74,15 @@ public struct AboutWindow: WindowScene {
return newSelf
}
/// Set the app's website.
/// - Parameter url: The URL to the issue tracker.
/// - Returns: The window.
public func issues(_ url: URL?) -> Self {
var newSelf = self
newSelf.issues = url
return newSelf
}
/// Get the storage for the window.
/// - Parameter app: The application.
/// - Returns: The storage.
@ -115,6 +126,7 @@ public struct AboutWindow: WindowScene {
window.generalData(title: appName, icon: icon, developer: developer, version: version)
}
if let website { window.website(url: website.absoluteString) }
if let issues { window.issues(url: issues.absoluteString) }
}
}

View File

@ -22,8 +22,9 @@ struct Demo: App {
.defaultSize(width: 650, height: 450)
.overlay {
AboutWindow(id: "about", appName: "Demo", developer: "david-swift", version: "Test")
.icon(.default(icon: .emojiNature))
.website(.init(string: "david-swift.gitbook.io/adwaita"))
.icon(.default(icon: .applicationXExecutable))
.website(.init(string: "https://david-swift.gitbook.io/adwaita"))
.issues(.init(string: "https://github.com/AparokshaUI/adwaita-swift/issues"))
Window(id: "overlay", open: 0) { window in
OverlayWindowDemo.WindowContent(window: window)
}

View File

@ -166,7 +166,8 @@ There are many more widgets available using auto-generation. Learn [how to use t
| Syntax | Description |
| --------------- | --------------------------------------------------------------------------------------- |
| `icon(_:)` | Set the app icon. |
| `website(_:)` | Set the app's website |
| `website(_:)` | Set the app's website. |
| `issues(_:)` | Set the app's bug tracker. |
### Menu Widgets
| Name | Description | Widget |