ac124342fa
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
29 lines
855 B
Swift
29 lines
855 B
Swift
import FirebaseCrashlytics
|
|
|
|
enum CrashlyticsService {
|
|
|
|
static func setUserProperties(isPremium: Bool) {
|
|
Crashlytics.crashlytics().setCustomValue(isPremium, forKey: "is_premium")
|
|
}
|
|
|
|
static func log(_ message: String) {
|
|
Crashlytics.crashlytics().log(message)
|
|
}
|
|
|
|
static func record(_ error: Error, context: String? = nil) {
|
|
if let context {
|
|
Crashlytics.crashlytics().setCustomValue(context, forKey: "context")
|
|
}
|
|
Crashlytics.crashlytics().record(error: error)
|
|
}
|
|
|
|
static func record(message: String, context: String? = nil) {
|
|
if let context {
|
|
Crashlytics.crashlytics().setCustomValue(context, forKey: "context")
|
|
}
|
|
Crashlytics.crashlytics().record(
|
|
exceptionModel: ExceptionModel(name: "AppError", reason: message)
|
|
)
|
|
}
|
|
}
|