macos: Sparkle notFound acknowledgement should only be called on dismiss (#9126)

This was causing the "no update found" message to never really appear in
the real world.
This commit is contained in:
Mitchell Hashimoto
2025-10-10 09:30:12 -07:00
committed by GitHub
parent 2bf9c777d7
commit 207eccffda
5 changed files with 19 additions and 9 deletions

View File

@@ -23,11 +23,12 @@ struct UpdatePill: View {
.transition(.opacity.combined(with: .scale(scale: 0.95)))
.onChange(of: model.state) { newState in
resetTask?.cancel()
if case .notFound = newState {
if case .notFound(let notFound) = newState {
resetTask = Task { [weak model] in
try? await Task.sleep(for: .seconds(5))
guard !Task.isCancelled, case .notFound? = model?.state else { return }
model?.state = .idle
notFound.acknowledgement()
}
} else {
resetTask = nil
@@ -40,8 +41,9 @@ struct UpdatePill: View {
@ViewBuilder
private var pillButton: some View {
Button(action: {
if case .notFound = model.state {
if case .notFound(let notFound) = model.state {
model.state = .idle
notFound.acknowledgement()
} else {
showPopover.toggle()
}