Fixed Widget stats
This commit is contained in:
@@ -1020,7 +1020,7 @@ extension ClimbingDataManager {
|
||||
private func updateLiveActivityForActiveSession() {
|
||||
guard let activeSession = activeSession,
|
||||
activeSession.status == .active,
|
||||
let gym = gym(withId: activeSession.gymId)
|
||||
let _ = gym(withId: activeSession.gymId)
|
||||
else {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ final class LiveActivityManager {
|
||||
do {
|
||||
let activity = try Activity<SessionActivityAttributes>.request(
|
||||
attributes: attributes,
|
||||
contentState: initialContentState,
|
||||
content: .init(state: initialContentState, staleDate: nil),
|
||||
pushType: nil
|
||||
)
|
||||
self.currentActivity = activity
|
||||
@@ -81,12 +81,8 @@ final class LiveActivityManager {
|
||||
completedProblems: completedProblems
|
||||
)
|
||||
|
||||
do {
|
||||
await currentActivity.update(using: updatedContentState, alertConfiguration: nil)
|
||||
print("✅ Live Activity updated successfully")
|
||||
} catch {
|
||||
print("❌ Failed to update live activity: \(error)")
|
||||
}
|
||||
await currentActivity.update(.init(state: updatedContentState, staleDate: nil))
|
||||
print("✅ Live Activity updated successfully")
|
||||
}
|
||||
|
||||
/// Call this when a ClimbSession ends to end the Live Activity
|
||||
@@ -98,14 +94,9 @@ final class LiveActivityManager {
|
||||
|
||||
print("🔴 Ending Live Activity: \(currentActivity.id)")
|
||||
|
||||
do {
|
||||
await currentActivity.end(using: nil, dismissalPolicy: .immediate)
|
||||
self.currentActivity = nil
|
||||
print("✅ Live Activity ended successfully")
|
||||
} catch {
|
||||
print("❌ Failed to end live activity: \(error)")
|
||||
self.currentActivity = nil
|
||||
}
|
||||
await currentActivity.end(nil, dismissalPolicy: .immediate)
|
||||
self.currentActivity = nil
|
||||
print("✅ Live Activity ended successfully")
|
||||
}
|
||||
|
||||
/// Check if Live Activities are available and authorized
|
||||
|
||||
Reference in New Issue
Block a user