-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add deprecated and disabled warnings
- Loading branch information
1 parent
775db38
commit d239783
Showing
11 changed files
with
226 additions
and
64 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// CaskWarning.swift | ||
// Applite | ||
// | ||
// Created by Milán Várady on 2025.01.13. | ||
// | ||
|
||
import SwiftUI | ||
|
||
enum CaskWarning: Codable { | ||
case hasCaveat(caveat: String) | ||
case deprecated(date: String, reason: String) | ||
case disabled(date: String, reason: String) | ||
|
||
var title: LocalizedStringKey { | ||
switch self { | ||
case .hasCaveat: return "App has Caveats" | ||
case .deprecated: return "App is Deprecated" | ||
case .disabled: return "App is Disabled" | ||
} | ||
} | ||
|
||
var isDisabled: Bool { | ||
switch self { | ||
case .hasCaveat, .deprecated: return false | ||
case .disabled: return true | ||
} | ||
} | ||
} |
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
52 changes: 52 additions & 0 deletions
52
Applite/Views/App Views/App View/AppView+IconsAndWarnings.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,52 @@ | ||
// | ||
// AppView+IconsAndWarnings.swift | ||
// Applite | ||
// | ||
// Created by Milán Várady on 2025.01.13. | ||
// | ||
|
||
import SwiftUI | ||
|
||
extension AppView { | ||
struct IconsAndWarnings: View { | ||
@ObservedObject var cask: Cask | ||
|
||
var body: some View { | ||
// Show tap icon if from a third-party tap | ||
if cask.info.tap != "homebrew/cask" { | ||
InfoPopup( | ||
text: "This app is from a third-party tap:\n`\(cask.info.tap)`", | ||
sfSymbol: "spigot.fill" | ||
) | ||
.controlSize(.large) | ||
} | ||
|
||
if let warning = cask.info.warning { | ||
Group { | ||
switch warning { | ||
case .hasCaveat(let caveat): | ||
InfoPopup( | ||
text: LocalizedStringKey(caveat), | ||
sfSymbol: "exclamationmark.circle" | ||
) | ||
|
||
case .deprecated(let date, let reason): | ||
InfoPopup( | ||
text: "**This app is deprecated**\n**Reason:** \(reason)\n**Date:** \(date)", | ||
sfSymbol: "exclamationmark.triangle.fill", | ||
color: .orange | ||
) | ||
|
||
case .disabled(let date, let reason): | ||
InfoPopup( | ||
text: "**This app is disabled**\n**Reason:** \(reason)\n**Date:** \(date)", | ||
sfSymbol: "exclamationmark.triangle.fill", | ||
color: .red | ||
) | ||
} | ||
} | ||
.imageScale(.large) | ||
} | ||
} | ||
} | ||
} |
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.