diff --git a/Linphone/LinphoneApp.swift b/Linphone/LinphoneApp.swift index 9596a76ce..0930db967 100644 --- a/Linphone/LinphoneApp.swift +++ b/Linphone/LinphoneApp.swift @@ -18,6 +18,9 @@ */ import SwiftUI +#if USE_CRASHLYTICS +import Firebase +#endif @main struct LinphoneApp: App { @@ -32,6 +35,12 @@ struct LinphoneApp: App { @State private var startCallViewModel: StartCallViewModel? @State private var callViewModel: CallViewModel? + init() { +#if USE_CRASHLYTICS + FirebaseApp.configure() +#endif + } + var body: some Scene { WindowGroup { if coreContext.coreIsStarted { diff --git a/Linphone/Utils/Log.swift b/Linphone/Utils/Log.swift index bb4e61cb1..23901a029 100644 --- a/Linphone/Utils/Log.swift +++ b/Linphone/Utils/Log.swift @@ -24,6 +24,9 @@ import UIKit import os import linphonesw import linphone +#if USE_CRASHLYTICS +import Firebase +#endif class Log: LoggingServiceDelegate { @@ -88,6 +91,9 @@ class Log: LoggingServiceDelegate { } else { NSLog(log) } +#if USE_CRASHLYTICS + Crashlytics.crashlytics().log("\(levelStr) [\(domain)] \(message)\n") +#endif } func onLogMessageWritten(logService: linphonesw.LoggingService, domain: String, level: linphonesw.LogLevel, message: String) { diff --git a/Podfile b/Podfile index 2e9ccd0fd..0c727cb84 100644 --- a/Podfile +++ b/Podfile @@ -9,10 +9,16 @@ def basic_pods else pod 'linphone-sdk', :path => ENV['PODFILE_PATH'] # local sdk end - + + crashlytics end - +def crashlytics + if not ENV['USE_CRASHLYTICS'].nil? + pod 'Firebase/Analytics' + pod 'Firebase/Crashlytics' + end +end target 'Linphone' do # Comment the next line if you don't want to use dynamic frameworks