mirror of
https://github.com/maxgoedjen/secretive.git
synced 2026-03-11 12:07:22 +01:00
Fixignoring bugs
This commit is contained in:
@@ -16,7 +16,9 @@ class PreviewUpdater: UpdaterProtocol {
|
||||
self.update = Release(name: "10.10.10", html_url: URL(string: "https://example.com")!, body: "Critical Security Update")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func ignore(release: Release) {
|
||||
}
|
||||
}
|
||||
|
||||
extension PreviewUpdater {
|
||||
|
||||
@@ -87,9 +87,13 @@ struct ContentView<UpdaterType: UpdaterProtocol, AgentStatusCheckerType: AgentSt
|
||||
severity = .advisory
|
||||
text = "Update Available"
|
||||
}
|
||||
return AnyView(NoticeView(text: text, severity: severity, actionTitle: "Update") {
|
||||
NSWorkspace.shared.open(update.html_url)
|
||||
})
|
||||
let action = {
|
||||
_ = NSWorkspace.shared.open(update.html_url)
|
||||
}
|
||||
let ignoreAction = {
|
||||
updater.ignore(release: update)
|
||||
}
|
||||
return AnyView(NoticeView(text: text, severity: severity, actionTitle: "Update", action: action, secondaryActionTitle: "Ignore", secondaryAction: ignoreAction))
|
||||
}
|
||||
|
||||
func agentNotice() -> some View {
|
||||
|
||||
@@ -7,12 +7,28 @@ struct NoticeView: View {
|
||||
let severity: Severity
|
||||
let actionTitle: String?
|
||||
let action: (() -> Void)?
|
||||
let secondaryActionTitle: String?
|
||||
let secondaryAction: (() -> Void)?
|
||||
|
||||
public init(text: String, severity: NoticeView.Severity, actionTitle: String?, action: (() -> Void)?, secondaryActionTitle: String? = nil, secondaryAction: (() -> Void)? = nil) {
|
||||
self.text = text
|
||||
self.severity = severity
|
||||
self.actionTitle = actionTitle
|
||||
self.action = action
|
||||
self.secondaryActionTitle = secondaryActionTitle
|
||||
self.secondaryAction = secondaryAction
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
Text(text).bold()
|
||||
Spacer()
|
||||
if action != nil {
|
||||
if secondaryAction != nil {
|
||||
Button(action: secondaryAction!) {
|
||||
Text(secondaryActionTitle!)
|
||||
}
|
||||
}
|
||||
Button(action: action!) {
|
||||
Text(actionTitle!)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user