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 import SwiftUI
#if USE_CRASHLYTICS
import Firebase
#endif
@main @main
struct LinphoneApp: App { struct LinphoneApp: App {
@ -32,6 +35,12 @@ struct LinphoneApp: App {
@State private var startCallViewModel: StartCallViewModel? @State private var startCallViewModel: StartCallViewModel?
@State private var callViewModel: CallViewModel? @State private var callViewModel: CallViewModel?
init() {
#if USE_CRASHLYTICS
FirebaseApp.configure()
#endif
}
var body: some Scene { var body: some Scene {
WindowGroup { WindowGroup {
if coreContext.coreIsStarted { if coreContext.coreIsStarted {

View file

@ -24,6 +24,9 @@ import UIKit
import os import os
import linphonesw import linphonesw
import linphone import linphone
#if USE_CRASHLYTICS
import Firebase
#endif
class Log: LoggingServiceDelegate { class Log: LoggingServiceDelegate {
@ -88,6 +91,9 @@ class Log: LoggingServiceDelegate {
} else { } else {
NSLog(log) 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) { func onLogMessageWritten(logService: linphonesw.LoggingService, domain: String, level: linphonesw.LogLevel, message: String) {

View file

@ -10,9 +10,15 @@ def basic_pods
pod 'linphone-sdk', :path => ENV['PODFILE_PATH'] # local sdk pod 'linphone-sdk', :path => ENV['PODFILE_PATH'] # local sdk
end end
crashlytics
end end
def crashlytics
if not ENV['USE_CRASHLYTICS'].nil?
pod 'Firebase/Analytics'
pod 'Firebase/Crashlytics'
end
end
target 'Linphone' do target 'Linphone' do
# Comment the next line if you don't want to use dynamic frameworks # Comment the next line if you don't want to use dynamic frameworks