-
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a5d1c29
commit 0f6d94a
Showing
15 changed files
with
261 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// | ||
// CaskAdditionalInfo.swift | ||
// Applite | ||
// | ||
// Created by Milán Várady on 2025.01.02. | ||
// | ||
|
||
import Foundation | ||
|
||
struct CaskAdditionalInfoResponse: Decodable { | ||
let casks: [CaskAdditionalInfo] | ||
} | ||
|
||
struct CaskAdditionalInfo: Codable, Hashable { | ||
let token: String | ||
let tap: String | ||
let homepage: URL | ||
let url: URL | ||
/// Installed version | ||
let installed: String? | ||
let installed_time: Date? | ||
let auto_updates: Bool? | ||
let deprecated: Bool | ||
let deprection_date: Date? | ||
let deprecation_reason: String? | ||
let deprecation_replacement: String? | ||
let disabled: Bool | ||
let disabled_date: Date? | ||
let disabled_reason: String? | ||
let disabled_replacement: String? | ||
|
||
static let dummy = CaskAdditionalInfo( | ||
token: "Applite", tap: "homebrew/cask", | ||
homepage: URL(string: "https://aerolite.dev/applite")!, | ||
url: URL(string: "https://github.com/milanvarady/Applite/releases/download/v1.2.5/Applite.dmg")!, | ||
installed: "1.2.5", | ||
installed_time: Date(timeIntervalSince1970: 1735754762), | ||
auto_updates: true, | ||
deprecated: false, | ||
deprection_date: nil, | ||
deprecation_reason: nil, | ||
deprecation_replacement: nil, | ||
disabled: false, | ||
disabled_date: nil, | ||
disabled_reason: nil, | ||
disabled_replacement: nil | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
Applite/Views/App Views/App View/AppView+GetInfoButton.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// AppView+GetInfoButton.swift | ||
// Applite | ||
// | ||
// Created by Milán Várady on 2025.01.02. | ||
// | ||
|
||
import SwiftUI | ||
|
||
extension AppView { | ||
struct GetInfoButton: View { | ||
@ObservedObject var cask: Cask | ||
@EnvironmentObject var caskManager: CaskManager | ||
@Environment(\.openWindow) var openWindow | ||
|
||
@StateObject var alert = AlertManager() | ||
|
||
var body: some View { | ||
Button { | ||
Task { | ||
do { | ||
let caskInfo = try await caskManager.getAdditionalInfoForCask(cask) | ||
openWindow(value: caskInfo) | ||
} catch { | ||
alert.show(error: error, title: "Failed to gather cask info") | ||
} | ||
} | ||
} label: { | ||
Label("Get Info", systemImage: "info.circle") | ||
} | ||
.alertManager(alert) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.