Add crashlytics (WIP)

This commit is contained in:
QuentinArguillere 2024-01-12 15:56:07 +01:00
parent 4efc28da9e
commit 3f4e8d79cf
3 changed files with 23 additions and 2 deletions

View file

@ -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 {

View file

@ -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) {

10
Podfile
View file

@ -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