Skip to content

Commit

Permalink
serial processing of changes to the graph image
Browse files Browse the repository at this point in the history
  • Loading branch information
krugerk committed Jan 7, 2025
1 parent b692d0c commit 56673db
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions BeeSwift/Components/GoalImageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,21 @@ class GoalImageView : UIView {
object: nil,
queue: OperationQueue.main
) { [weak self] _ in
self?.refresh()
DispatchQueue.main.async {
self?.refresh()
}
}

refresh()
}

@MainActor
private func clearGoalGraph() {
imageView.image = UIImage(named: "GraphPlaceholder")
currentlyShowingGraph = false
beeLemniscateView.isHidden = true
}

@MainActor
private func showGraphImage(image: UIImage) {
let duration = isThumbnail ? 0.0 : 0.2

Expand All @@ -88,6 +91,7 @@ class GoalImageView : UIView {
}
}

@MainActor
private func refresh() {
// Invalidate the download token, meaning that any queued download callbacks
// will no-op. This avoids race conditions with downloads finishing out of order.
Expand Down

0 comments on commit 56673db

Please sign in to comment.