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:
parent
23d14f33ea
commit
b068e4bc1a
@ -1,11 +1,15 @@
|
|||||||
// ── Biometric Authentication ────────────────────────────────
|
// ── Biometric Authentication ────────────────────────────────
|
||||||
// Generic Face ID / Touch ID wrapper using LocalAuthentication.
|
// Generic Face ID / Touch ID wrapper using LocalAuthentication.
|
||||||
// Product apps pass a custom reason string for the biometric prompt.
|
// Product apps pass a custom reason string for the biometric prompt.
|
||||||
|
// Not available on watchOS — guarded with #if canImport.
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
#if canImport(LocalAuthentication)
|
||||||
import 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 BLBiometricAuth {
|
||||||
|
|
||||||
public enum BiometricType {
|
public enum BiometricType {
|
||||||
@ -70,3 +74,4 @@ public enum BLBiometricAuth {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@ -2,11 +2,12 @@
|
|||||||
// Generic MetricKit-based crash and performance reporting.
|
// Generic MetricKit-based crash and performance reporting.
|
||||||
// Stores crash diagnostics locally for debugging and feedback forms.
|
// Stores crash diagnostics locally for debugging and feedback forms.
|
||||||
// Product apps configure with a product-specific persistence key.
|
// Product apps configure with a product-specific persistence key.
|
||||||
|
// Not available on watchOS — MetricKit is iOS/macOS only.
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import MetricKit
|
|
||||||
|
|
||||||
/// Crash report model stored locally.
|
/// Crash report model stored locally.
|
||||||
|
/// Available on all platforms (data-only struct).
|
||||||
public struct BLCrashReport: Codable, Identifiable, Sendable {
|
public struct BLCrashReport: Codable, Identifiable, Sendable {
|
||||||
public let id: String
|
public let id: String
|
||||||
public let date: Date
|
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.
|
/// Subscribes to MetricKit, stores crash reports in UserDefaults.
|
||||||
|
/// Not available on watchOS (MetricKit is iOS 13+ / macOS 12+ only).
|
||||||
@MainActor
|
@MainActor
|
||||||
public final class BLCrashReporter: NSObject, ObservableObject, MXMetricManagerSubscriber {
|
public final class BLCrashReporter: NSObject, ObservableObject, MXMetricManagerSubscriber {
|
||||||
|
|
||||||
@ -127,3 +132,4 @@ public final class BLCrashReporter: NSObject, ObservableObject, MXMetricManagerS
|
|||||||
diagnosticCount = loadCrashReports().count
|
diagnosticCount = loadCrashReports().count
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user