fix(swift-sdk): guard BLBiometricAuth and BLCrashReporter for watchOS compatibility

BLBiometricAuth imports LocalAuthentication (unavailable on watchOS).
BLCrashReporter imports MetricKit (unavailable on watchOS).
Package.swift declares watchOS 10+ as a platform target.

Fix: wrap both files in #if canImport() guards.
BLCrashReport model struct stays outside the guard (data-only, all platforms).
This commit is contained in:
saravanakumardb1 2026-02-28 22:51:26 -08:00
parent 23d14f33ea
commit b068e4bc1a
2 changed files with 14 additions and 3 deletions

View File

@ -1,11 +1,15 @@
// Biometric Authentication
// Generic Face ID / Touch ID wrapper using LocalAuthentication.
// Product apps pass a custom reason string for the biometric prompt.
// Not available on watchOS guarded with #if canImport.
import Foundation
#if canImport(LocalAuthentication)
import LocalAuthentication
/// Generic biometric authentication for all ByteLyst iOS apps.
/// Generic biometric authentication for all ByteLyst iOS/macOS apps.
/// Not available on watchOS (LocalAuthentication is iOS/macOS only).
public enum BLBiometricAuth {
public enum BiometricType {
@ -70,3 +74,4 @@ public enum BLBiometricAuth {
}
}
}
#endif

View File

@ -2,11 +2,12 @@
// Generic MetricKit-based crash and performance reporting.
// Stores crash diagnostics locally for debugging and feedback forms.
// Product apps configure with a product-specific persistence key.
// Not available on watchOS MetricKit is iOS/macOS only.
import Foundation
import MetricKit
/// Crash report model stored locally.
/// Available on all platforms (data-only struct).
public struct BLCrashReport: Codable, Identifiable, Sendable {
public let id: String
public let date: Date
@ -25,8 +26,12 @@ public struct BLCrashReport: Codable, Identifiable, Sendable {
}
}
/// Generic MetricKit crash reporter for all ByteLyst iOS apps.
#if canImport(MetricKit)
import MetricKit
/// Generic MetricKit crash reporter for all ByteLyst iOS/macOS apps.
/// Subscribes to MetricKit, stores crash reports in UserDefaults.
/// Not available on watchOS (MetricKit is iOS 13+ / macOS 12+ only).
@MainActor
public final class BLCrashReporter: NSObject, ObservableObject, MXMetricManagerSubscriber {
@ -127,3 +132,4 @@ public final class BLCrashReporter: NSObject, ObservableObject, MXMetricManagerS
diagnosticCount = loadCrashReports().count
}
}
#endif