Skip to content

Commit

Permalink
fix: Show a spinner when loading calendar entries (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbmorley committed Jan 22, 2024
1 parent b289b11 commit a7b5f3c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion macos/Overview/Model/WindowModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,20 @@ class WindowModel: ObservableObject {
init(applicationModel: ApplicationModel) {
self.applicationModel = applicationModel
self.selections = selectionsStorage
self.loading = true
}

func start() {
dispatchPrecondition(condition: .onQueue(.main))

// Update the summaries.
// TODO: Set loading
$year
.combineLatest(applicationModel.$calendars, $selections, applicationModel.updates)
.receive(on: DispatchQueue.main)
.map { contents in
self.loading = true
return contents
}
.receive(on: updateQueue)
.map { (year, calendars, selections, _) in
return (year, calendars.filter { selections.contains($0.calendarIdentifier) })
Expand All @@ -67,6 +72,7 @@ class WindowModel: ObservableObject {
return
}
self.summaries = summaries
self.loading = false
}
.store(in: &cancellables)

Expand Down

0 comments on commit a7b5f3c

Please sign in to comment.