Skip to content

Commit

Permalink
lastFetched seemed redundant
Browse files Browse the repository at this point in the history
  • Loading branch information
krugerk committed Dec 29, 2024
1 parent 6d24998 commit d68cdbd
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions BeeSwift/GoalViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ class GoalViewController: UIViewController, UIScrollViewDelegate, DatapointTabl
private let logger = Logger(subsystem: "com.beeminder.com", category: "GoalViewController")

let goal: Goal


private var lastFetched: Date? {
didSet {
updateLastUpdatedLabel()
}
}

private let timeElapsedView = FreshnessIndicatorView()
fileprivate var goalImageView = GoalImageView(isThumbnail: false)
Expand All @@ -53,7 +46,6 @@ class GoalViewController: UIViewController, UIScrollViewDelegate, DatapointTabl

init(goal: Goal) {
self.goal = goal
self.lastFetched = goal.lastModifiedLocal
super.init(nibName: nil, bundle: nil)
}

Expand Down Expand Up @@ -495,7 +487,6 @@ class GoalViewController: UIViewController, UIScrollViewDelegate, DatapointTabl

func updateGoalAndInterface() async throws {
try await ServiceLocator.goalManager.refreshGoal(self.goal.objectID)
self.lastFetched = goal.lastModifiedLocal
updateInterfaceToMatchGoal()
}

Expand All @@ -504,6 +495,7 @@ class GoalViewController: UIViewController, UIScrollViewDelegate, DatapointTabl
self.datapointTableController.datapoints = goal.recentData.sorted(by: {$0.updatedAt < $1.updatedAt})

self.refreshCountdown()
self.updateLastUpdatedLabel()
}

func viewForZooming(in scrollView: UIScrollView) -> UIView? {
Expand All @@ -520,7 +512,7 @@ class GoalViewController: UIViewController, UIScrollViewDelegate, DatapointTabl
}

@objc func updateLastUpdatedLabel() {
let lastUpdated = self.lastFetched ?? .distantPast
let lastUpdated = self.goal.lastModifiedLocal

self.timeElapsedView.update(with: lastUpdated)
}
Expand Down

0 comments on commit d68cdbd

Please sign in to comment.