From 349194e744940773e09df125dc4e5dbef90e4429 Mon Sep 17 00:00:00 2001 From: Giancarlo Buenaflor Date: Wed, 22 Mar 2023 10:43:55 +0000 Subject: [PATCH 1/3] Update README.md --- README.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index dfc854f4..e29b8c54 100644 --- a/README.md +++ b/README.md @@ -97,13 +97,21 @@ Create a Kotlin file in your commonMain e.g. `AppSetup.kt` or however you want t ```Kotlin import io.sentry.kotlin.multiplatform.Context import io.sentry.kotlin.multiplatform.Sentry +import io.sentry.kotlin.multiplatform.OptionsConfiguration // The context is needed for Android initializations fun initializeSentry(context: Context?) { - Sentry.init(context) { - it.dsn = "__DSN__" - } + Sentry.init(optionsConfiguration()) +} + +fun initializeSentry() { + Sentry.init(optionsConfiguration()) } + +private fun optionsConfiguration(): OptionsConfiguration = { + it.dsn = "https://83f281ded2844eda83a8a413b080dbb9@o447951.ingest.sentry.io/5903800" +} + ``` Now call this function in an early lifecycle stage in your platforms. @@ -131,7 +139,7 @@ class AppDelegate: NSObject, UIApplicationDelegate { _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil ) -> Bool { - AppSetupKt.initializeSentry(context = nil) + AppSetupKt.initializeSentry() return true } } From d7ad18d7318164d2fbceb16ae2d7b8c1f16bb347 Mon Sep 17 00:00:00 2001 From: Giancarlo Buenaflor Date: Wed, 22 Mar 2023 10:45:03 +0000 Subject: [PATCH 2/3] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e29b8c54..9870fa01 100644 --- a/README.md +++ b/README.md @@ -100,8 +100,8 @@ import io.sentry.kotlin.multiplatform.Sentry import io.sentry.kotlin.multiplatform.OptionsConfiguration // The context is needed for Android initializations -fun initializeSentry(context: Context?) { - Sentry.init(optionsConfiguration()) +fun initializeSentry(context: Context) { + Sentry.init(context, optionsConfiguration()) } fun initializeSentry() { From f50538f2c49cffa289ee3e5f84b4e8f3057b0c23 Mon Sep 17 00:00:00 2001 From: buenaflor Date: Wed, 22 Mar 2023 12:09:00 +0100 Subject: [PATCH 3/3] update dsn in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9870fa01..aeec5845 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,7 @@ fun initializeSentry() { } private fun optionsConfiguration(): OptionsConfiguration = { - it.dsn = "https://83f281ded2844eda83a8a413b080dbb9@o447951.ingest.sentry.io/5903800" + it.dsn = "__DSN__" } ```