Showing 1 changed files with 11 additions and 0 deletions
+11 -0
HealthProbe/Services/HealthKitService.swift
@@ -225,6 +225,17 @@ final class HealthKitService {
225 225
             return tc
226 226
         }
227 227
 
228
+        // Check authorization status before querying — if denied, fail immediately
229
+        // (HealthKit queries for denied types might succeed with 0 data, appearing complete)
230
+        if store.authorizationStatus(for: sampleType) == .sharingDenied {
231
+            return TypeCount(
232
+                typeIdentifier: monitoredType.id,
233
+                displayName: monitoredType.displayName,
234
+                count: -1,
235
+                quality: SnapshotQuality.unauthorized
236
+            )
237
+        }
238
+
228 239
         // 15s budget covers distribution + earliestDate + latestDate combined — not 15s each.
229 240
         do {
230 241
             return try await withTimeout(seconds: Self.perTypeTimeoutSeconds) {