Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement updated MainActor approach #636

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Sources/Site/Music/VaultModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ enum LocationAuthorization {
case denied // Locations denied by user.
}

@MainActor public final class VaultModel: ObservableObject {
public final class VaultModel: ObservableObject {
let urlString: String

@Published public var vault: Vault?
Expand All @@ -56,6 +56,7 @@ enum LocationAuthorization {
self.error = error
}

@MainActor
public func load() async {
Logger.vaultModel.log("start")
defer {
Expand All @@ -82,6 +83,7 @@ enum LocationAuthorization {
}
}

@MainActor
private func updateTodayConcerts() {
guard let vault else {
Logger.vaultModel.log("No Vault to calculate todayConcerts.")
Expand All @@ -93,6 +95,7 @@ enum LocationAuthorization {
Logger.vaultModel.log("Today Count: \(self.todayConcerts.count, privacy: .public)")
}

@MainActor
private func monitorDayChanges() async {
Logger.vaultModel.log("start day monitoring")
defer {
Expand All @@ -106,6 +109,7 @@ enum LocationAuthorization {
}
}

@MainActor
private func geocodeVenues() async {
guard let vault else {
Logger.vaultModel.log("No Vault to geocode venues.")
Expand All @@ -130,6 +134,7 @@ enum LocationAuthorization {
}
}

@MainActor
private func monitorUserLocation() async {
Logger.vaultModel.log("start location monitoring")
defer {
Expand Down