Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
Add support for AboutWindow's issues URL
Browse files Browse the repository at this point in the history
  • Loading branch information
david-swift committed Jan 27, 2024
1 parent fd3c81d commit aef77da
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
12 changes: 12 additions & 0 deletions Sources/Adwaita/Window/AboutWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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) }
}

}
5 changes: 3 additions & 2 deletions Tests/Demo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
3 changes: 2 additions & 1 deletion user-manual/Information/Widgets.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down

0 comments on commit aef77da

Please sign in to comment.