fix(swift-sdk): resolve BLAuditLogger + BLCrashReporter build errors in ByteLystPlatform
- BLAuditLogger is an enum (static API) — cannot be constructed; use .Type reference + configure()
- BLCrashReporter is @MainActor — defer construction to start() via Task { @MainActor }
This commit is contained in:
parent
2eadf480dc
commit
6856d23a2e
@ -35,14 +35,14 @@ public final class ByteLystPlatform {
|
||||
/// Kill switch checker.
|
||||
public let killSwitch: BLKillSwitchClient
|
||||
|
||||
/// Crash reporter (MetricKit).
|
||||
public let crashReporter: BLCrashReporter
|
||||
/// Crash reporter (MetricKit). Created lazily on MainActor.
|
||||
public private(set) var crashReporter: BLCrashReporter?
|
||||
|
||||
/// Keychain access (via bundleId as service).
|
||||
public let keychain: BLKeychainAccessor
|
||||
|
||||
/// Audit logger.
|
||||
public let auditLog: BLAuditLogger
|
||||
/// Audit logger type (static API — call BLAuditLogger.log()).
|
||||
public let auditLog: BLAuditLogger.Type = BLAuditLogger.self
|
||||
|
||||
/// Auth client.
|
||||
public let auth: BLAuthClient
|
||||
@ -56,10 +56,9 @@ public final class ByteLystPlatform {
|
||||
self.telemetry = BLTelemetryClient(config: config, client: client)
|
||||
self.flags = BLFeatureFlagClient(config: config, client: client)
|
||||
self.killSwitch = BLKillSwitchClient(config: config)
|
||||
self.crashReporter = BLCrashReporter(productId: config.productId)
|
||||
self.keychain = BLKeychainAccessor(service: config.bundleId)
|
||||
self.auditLog = BLAuditLogger(productId: config.productId)
|
||||
self.auth = BLAuthClient(config: config, client: client)
|
||||
BLAuditLogger.configure(fileName: "\(config.productId)_audit_log.json")
|
||||
}
|
||||
|
||||
/// Test-only initializer that accepts a custom URLSessionConfiguration.
|
||||
@ -69,10 +68,9 @@ public final class ByteLystPlatform {
|
||||
self.telemetry = BLTelemetryClient(config: config, client: client)
|
||||
self.flags = BLFeatureFlagClient(config: config, client: client)
|
||||
self.killSwitch = BLKillSwitchClient(config: config)
|
||||
self.crashReporter = BLCrashReporter(productId: config.productId)
|
||||
self.keychain = BLKeychainAccessor(service: config.bundleId)
|
||||
self.auditLog = BLAuditLogger(productId: config.productId)
|
||||
self.auth = BLAuthClient(config: config, client: client)
|
||||
BLAuditLogger.configure(fileName: "\(config.productId)_audit_log.json")
|
||||
}
|
||||
|
||||
// MARK: - Lifecycle
|
||||
@ -84,6 +82,9 @@ public final class ByteLystPlatform {
|
||||
telemetry.start()
|
||||
flags.start(userId: userId)
|
||||
Task { await killSwitch.check() }
|
||||
Task { @MainActor in
|
||||
self.crashReporter = BLCrashReporter(productId: config.productId)
|
||||
}
|
||||
}
|
||||
|
||||
/// Stop all services: flush telemetry, stop flag polling.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user