Fixed Widget stats

This commit is contained in:
2025-09-15 23:27:21 -06:00
parent 363fbd676a
commit b53dfb1aa5
13 changed files with 94 additions and 157 deletions

View File

@@ -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
}

View File

@@ -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