Finish crashlytics integration. Add "CRASH ME" button in contacts view, uncomment when testing to make sure it's properly connected

This commit is contained in:
QuentinArguillere 2024-01-16 21:04:59 +01:00
parent 33b07f1440
commit bca8612eab
4 changed files with 43 additions and 6 deletions

View file

@ -542,6 +542,7 @@
D719ABB02ABC67BF00B41C10 /* Frameworks */,
D719ABB12ABC67BF00B41C10 /* Resources */,
D7FB55122AD53FE200A5AB15 /* Run Script */,
66BF2D4B2B558A3100A5F2E3 /* Crashlytics */,
);
buildRules = (
);
@ -610,6 +611,29 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
66BF2D4B2B558A3100A5F2E3 /* Crashlytics */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}",
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${PRODUCT_NAME}",
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Info.plist",
"$(TARGET_BUILD_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/GoogleService-Info.plist",
"$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)",
);
name = Crashlytics;
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "val=`expr \"$GCC_PREPROCESSOR_DEFINITIONS\" : \".*USE_CRASHLYTICS=\\([0-9]*\\)\"`\nif [ $val = 1 ]; then\n ${PODS_ROOT}/FirebaseCrashlytics/run\nfi\n\n";
};
D7FB55122AD53FE200A5AB15 /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;

View file

@ -245,6 +245,10 @@ final class CoreContext: ObservableObject {
}
}
}
func crashForCrashlytics() {
fatalError("Crashing app to test crashlytics")
}
}
// swiftlint:enable large_tuple

View file

@ -22,9 +22,20 @@ import SwiftUI
import Firebase
#endif
class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
#if USE_CRASHLYTICS
FirebaseApp.configure()
#endif
return true
}
}
@main
struct LinphoneApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var delegate
@ObservedObject private var coreContext = CoreContext.shared
@ObservedObject private var sharedMainViewModel = SharedMainViewModel.shared
@ -35,12 +46,6 @@ 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

@ -50,6 +50,10 @@ struct ContactsView: View {
}
.padding()
// For testing crashlytics
/*Button(action: CoreContext.shared.crashForCrashlytics, label: {
Text("CRASH ME")
})*/
}
}
.navigationViewStyle(.stack)