iOS Release - 1.0.1
This commit is contained in:
@@ -87,16 +87,28 @@ final class LiveActivityManager {
|
||||
|
||||
/// Call this when a ClimbSession ends to end the Live Activity
|
||||
func endLiveActivity() async {
|
||||
guard let currentActivity else {
|
||||
print("ℹ️ No current activity to end")
|
||||
return
|
||||
// First end the tracked activity if it exists
|
||||
if let currentActivity {
|
||||
print("🔴 Ending tracked Live Activity: \(currentActivity.id)")
|
||||
await currentActivity.end(nil, dismissalPolicy: .immediate)
|
||||
self.currentActivity = nil
|
||||
print("✅ Tracked Live Activity ended successfully")
|
||||
}
|
||||
|
||||
print("🔴 Ending Live Activity: \(currentActivity.id)")
|
||||
// Force end ALL active activities of our type to ensure cleanup
|
||||
print("🔍 Checking for any remaining active activities...")
|
||||
let activities = Activity<SessionActivityAttributes>.activities
|
||||
|
||||
await currentActivity.end(nil, dismissalPolicy: .immediate)
|
||||
self.currentActivity = nil
|
||||
print("✅ Live Activity ended successfully")
|
||||
if activities.isEmpty {
|
||||
print("ℹ️ No additional activities found")
|
||||
} else {
|
||||
print("🔴 Found \(activities.count) additional active activities, ending them...")
|
||||
for activity in activities {
|
||||
print("🔴 Force ending activity: \(activity.id)")
|
||||
await activity.end(nil, dismissalPolicy: .immediate)
|
||||
}
|
||||
print("✅ All Live Activities ended successfully")
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if Live Activities are available and authorized
|
||||
|
||||
Reference in New Issue
Block a user