Improve concurrency model for iOS
This commit is contained in:
@@ -80,7 +80,9 @@ struct SessionsView: View {
|
||||
} else if dataManager.activeSession == nil {
|
||||
Button("Start Session") {
|
||||
if dataManager.gyms.count == 1 {
|
||||
dataManager.startSession(gymId: dataManager.gyms.first!.id)
|
||||
Task {
|
||||
await dataManager.startSession(gymId: dataManager.gyms.first!.id)
|
||||
}
|
||||
} else {
|
||||
showingAddSession = true
|
||||
}
|
||||
@@ -228,7 +230,9 @@ struct ActiveSessionBanner: View {
|
||||
}
|
||||
|
||||
Button(action: {
|
||||
dataManager.endSession(session.id)
|
||||
Task {
|
||||
await dataManager.endSession(session.id)
|
||||
}
|
||||
}) {
|
||||
Image(systemName: "stop.fill")
|
||||
.font(.system(size: 16, weight: .bold))
|
||||
@@ -327,7 +331,9 @@ struct EmptySessionsView: View {
|
||||
if !dataManager.gyms.isEmpty {
|
||||
Button("Start Session") {
|
||||
if dataManager.gyms.count == 1 {
|
||||
dataManager.startSession(gymId: dataManager.gyms.first!.id)
|
||||
Task {
|
||||
await dataManager.startSession(gymId: dataManager.gyms.first!.id)
|
||||
}
|
||||
} else {
|
||||
showingAddSession = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user