Skip to content

Commit

Permalink
Don't uniquely rely on timer to refresh clock display
Browse files Browse the repository at this point in the history
  • Loading branch information
madbranch committed Sep 3, 2024
1 parent 77060b1 commit 1aacbab
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions TimeKeen/Views/CurrentTimeEntry/CurrentTimeEntryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ struct CurrentTimeEntryView: View {
breaks = [BreakEntry]()
notes = ""
clockInState = .clockedInWorking
updateClockInDuration(input: Date.now)
}

func startBreak(at breakStart: Date) {
Expand All @@ -338,6 +339,7 @@ struct CurrentTimeEntryView: View {

self.breakStart = breakStart
clockInState = .clockedInTakingABreak
updateClockInDuration(input: Date.now)
}

func endBreak(at breakEnd: Date) {
Expand All @@ -346,6 +348,7 @@ struct CurrentTimeEntryView: View {
}
breaks = breaks + [BreakEntry(start: breakStart, end: breakEnd)]
clockInState = .clockedInWorking
updateClockInDuration(input: Date.now)
}

func clockOut(at end: Date, notes: String) {
Expand All @@ -357,5 +360,6 @@ struct CurrentTimeEntryView: View {
timeEntry.breaks.append(contentsOf: breaks)
context.insert(timeEntry)
clockInState = .clockedOut
updateClockInDuration(input: Date.now)
}
}

0 comments on commit 1aacbab

Please sign in to comment.