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.
|
/// Kill switch checker.
|
||||||
public let killSwitch: BLKillSwitchClient
|
public let killSwitch: BLKillSwitchClient
|
||||||
|
|
||||||
/// Crash reporter (MetricKit).
|
/// Crash reporter (MetricKit). Created lazily on MainActor.
|
||||||
public let crashReporter: BLCrashReporter
|
public private(set) var crashReporter: BLCrashReporter?
|
||||||
|
|
||||||
/// Keychain access (via bundleId as service).
|
/// Keychain access (via bundleId as service).
|
||||||
public let keychain: BLKeychainAccessor
|
public let keychain: BLKeychainAccessor
|
||||||
|
|
||||||
/// Audit logger.
|
/// Audit logger type (static API — call BLAuditLogger.log()).
|
||||||
public let auditLog: BLAuditLogger
|
public let auditLog: BLAuditLogger.Type = BLAuditLogger.self
|
||||||
|
|
||||||
/// Auth client.
|
/// Auth client.
|
||||||
public let auth: BLAuthClient
|
public let auth: BLAuthClient
|
||||||
@ -56,10 +56,9 @@ public final class ByteLystPlatform {
|
|||||||
self.telemetry = BLTelemetryClient(config: config, client: client)
|
self.telemetry = BLTelemetryClient(config: config, client: client)
|
||||||
self.flags = BLFeatureFlagClient(config: config, client: client)
|
self.flags = BLFeatureFlagClient(config: config, client: client)
|
||||||
self.killSwitch = BLKillSwitchClient(config: config)
|
self.killSwitch = BLKillSwitchClient(config: config)
|
||||||
self.crashReporter = BLCrashReporter(productId: config.productId)
|
|
||||||
self.keychain = BLKeychainAccessor(service: config.bundleId)
|
self.keychain = BLKeychainAccessor(service: config.bundleId)
|
||||||
self.auditLog = BLAuditLogger(productId: config.productId)
|
|
||||||
self.auth = BLAuthClient(config: config, client: client)
|
self.auth = BLAuthClient(config: config, client: client)
|
||||||
|
BLAuditLogger.configure(fileName: "\(config.productId)_audit_log.json")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Test-only initializer that accepts a custom URLSessionConfiguration.
|
/// Test-only initializer that accepts a custom URLSessionConfiguration.
|
||||||
@ -69,10 +68,9 @@ public final class ByteLystPlatform {
|
|||||||
self.telemetry = BLTelemetryClient(config: config, client: client)
|
self.telemetry = BLTelemetryClient(config: config, client: client)
|
||||||
self.flags = BLFeatureFlagClient(config: config, client: client)
|
self.flags = BLFeatureFlagClient(config: config, client: client)
|
||||||
self.killSwitch = BLKillSwitchClient(config: config)
|
self.killSwitch = BLKillSwitchClient(config: config)
|
||||||
self.crashReporter = BLCrashReporter(productId: config.productId)
|
|
||||||
self.keychain = BLKeychainAccessor(service: config.bundleId)
|
self.keychain = BLKeychainAccessor(service: config.bundleId)
|
||||||
self.auditLog = BLAuditLogger(productId: config.productId)
|
|
||||||
self.auth = BLAuthClient(config: config, client: client)
|
self.auth = BLAuthClient(config: config, client: client)
|
||||||
|
BLAuditLogger.configure(fileName: "\(config.productId)_audit_log.json")
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
@ -84,6 +82,9 @@ public final class ByteLystPlatform {
|
|||||||
telemetry.start()
|
telemetry.start()
|
||||||
flags.start(userId: userId)
|
flags.start(userId: userId)
|
||||||
Task { await killSwitch.check() }
|
Task { await killSwitch.check() }
|
||||||
|
Task { @MainActor in
|
||||||
|
self.crashReporter = BLCrashReporter(productId: config.productId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Stop all services: flush telemetry, stop flag polling.
|
/// Stop all services: flush telemetry, stop flag polling.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user