Skip to content

Commit

Permalink
Replace Crashlytics with Sentry Multiplatform
Browse files Browse the repository at this point in the history
  • Loading branch information
findjigar committed Mar 26, 2024
1 parent 6deac19 commit c355df4
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 86 deletions.
2 changes: 0 additions & 2 deletions android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ plugins {
id("com.android.application")
kotlin("android")
alias(libs.plugins.googleServices)
alias(libs.plugins.crashlytics)
}
val releaseEnabled = file("./release.jks").exists()

Expand Down Expand Up @@ -87,7 +86,6 @@ dependencies {
implementation(libs.accompanist.navigationAnimation)
implementation(platform(libs.firebase.bom))
implementation(libs.firebase.analytics)
implementation(libs.firebase.crashlytics)

implementation(libs.hyperdrive.multiplatformx.api)

Expand Down
2 changes: 0 additions & 2 deletions android/src/main/java/co/touchlab/droidcon/android/MainApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ import co.touchlab.droidcon.ui.uiModule
import co.touchlab.droidcon.util.ClasspathResourceReader
import com.google.firebase.analytics.ktx.analytics
import com.google.firebase.ktx.Firebase
import com.russhwolf.settings.ExperimentalSettingsApi
import com.russhwolf.settings.ObservableSettings
import com.russhwolf.settings.SharedPreferencesSettings
import org.koin.dsl.module

@OptIn(ExperimentalSettingsApi::class)
class MainApp : Application() {

override fun onCreate() {
Expand Down
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.crashlytics).apply(false)
alias(libs.plugins.googleServices).apply(false)
alias(libs.plugins.kotlinMultiplatform).apply(false)
alias(libs.plugins.androidLibrary).apply(false)
Expand Down
6 changes: 2 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ hyperdrive = "0.1.148"
multiplatformSettings = "1.1.1"
sqlDelight = "2.0.1"
firebase-bom = "32.7.4"
firebase-crashlytics-gradle = "2.9.9"
gms-google-services = "4.4.1"

compose-androidx-ui = "1.6.3"
Expand Down Expand Up @@ -56,7 +55,6 @@ androidx-core-splashscreen = { module = "androidx.core:core-splashscreen", versi
accompanist-navigationAnimation = { module = "com.google.accompanist:accompanist-navigation-animation", version.ref = "accompanistNavigationAnimation" }
firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebase-bom" }
firebase-analytics = { module = "com.google.firebase:firebase-analytics-ktx", version = "_" }
firebase-crashlytics = { module = "com.google.firebase:firebase-crashlytics-ktx", version = "_" }
hyperdrive-multiplatformx-api = { module = "org.brightify.hyperdrive:multiplatformx-api", version.ref = "hyperdrive" }
android-desugar = { module = "com.android.tools:desugar_jdk_libs", version.ref = "android-desugaring" }
uuid = { module = "com.benasher44:uuid", version.ref = "uuid" }
Expand All @@ -71,6 +69,8 @@ kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutine

kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" }

sentry = { module = "io.sentry:sentry-kotlin-multiplatform", version = "0.5.0" }

ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-ios = { module = "io.ktor:ktor-client-ios", version.ref = "ktor" }
ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" }
Expand All @@ -88,7 +88,6 @@ sqldelight-runtime = { module = "app.cash.sqldelight:runtime", version.ref = "sq

kermit = { module = "co.touchlab:kermit", version.ref = "kermit" }
kermit-simple = { module = "co.touchlab:kermit-simple", version.ref = "kermit" }
kermit-crashlytics = { module = "co.touchlab:kermit-crashlytics", version.ref = "kermit" }
stately-common = { module = "co.touchlab:stately-common", version.ref = "stately" }

# Sample - Android
Expand All @@ -109,7 +108,6 @@ koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin" }
koin-test = { module = "io.insert-koin:koin-test", version.ref = "koin" }

[plugins]
crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebase-crashlytics-gradle" }
googleServices = { id = "com.google.gms.google-services", version.ref = "gms-google-services" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
androidLibrary = { id = "com.android.library", version.ref = "android-gradle-plugin" }
Expand Down
26 changes: 12 additions & 14 deletions ios/Droidcon/Droidcon.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@
F1465EF923AA94BF0055F7C3 /* Sources */,
F1465EFA23AA94BF0055F7C3 /* Frameworks */,
F1465EFB23AA94BF0055F7C3 /* Resources */,
A33EA3A8289D4DFD008850F7 /* Crashlytics Script */,
D1B96CC21A1B9CA2AD709245 /* [CP] Embed Pods Frameworks */,
0134B0E72BB23D3000CFA19F /* ShellScript */,
);
buildRules = (
);
Expand Down Expand Up @@ -369,47 +369,45 @@
shellPath = /bin/sh;
shellScript = "cd \"$SRCROOT/../..\"\n./gradlew :ios:embedAndSignAppleFrameworkForXcode \n";
};
A08E871D529FE29D7BFB8889 /* [CP] Check Pods Manifest.lock */ = {
0134B0E72BB23D3000CFA19F /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Droidcon-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
shellScript = "if which sentry-cli >/dev/null; then\nexport SENTRY_ORG={SENTRY_ORG}\nexport SENTRY_PROJECT={SENTRY_PROJECT}\nexport SENTRY_AUTH_TOKEN={SENTRY_AUTH_TOKEN}\nERROR=$(sentry-cli debug-files upload --include-sources \"$DWARF_DSYM_FOLDER_PATH\" --force-foreground 2>&1 >/dev/null)\nif [ ! $? -eq 0 ]; then\necho \"error: sentry-cli - $ERROR\"\nfi\nelse\necho \"error: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases\"\nfi\n";
};
A33EA3A8289D4DFD008850F7 /* Crashlytics Script */ = {
A08E871D529FE29D7BFB8889 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}",
"$(SRCROOT)/$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)",
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "Crashlytics Script";
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Droidcon-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n\"${PODS_ROOT}/FirebaseCrashlytics/run\"\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
D1B96CC21A1B9CA2AD709245 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
Expand Down Expand Up @@ -528,7 +526,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Apple Development: [email protected] (94U525PPDD)";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 6A5MWU525T;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down
1 change: 0 additions & 1 deletion ios/Droidcon/Droidcon/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class AppDelegate: NSObject, UIApplicationDelegate {
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
FirebaseApp.configure()
AppInitKt.setupKermit()

startKoin()

Expand Down
2 changes: 1 addition & 1 deletion ios/Droidcon/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ install! 'cocoapods', :deterministic_uuids => false

target 'Droidcon' do
pod 'Kingfisher', '~> 7.8.1'
pod 'Sentry', '~> 8.20.0'
pod 'Firebase/Analytics'
pod 'Firebase/Crashlytics'
end
51 changes: 12 additions & 39 deletions ios/Droidcon/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ PODS:
- FirebaseAnalytics (~> 10.15.0)
- Firebase/CoreOnly (10.15.0):
- FirebaseCore (= 10.15.0)
- Firebase/Crashlytics (10.15.0):
- Firebase/CoreOnly
- FirebaseCrashlytics (~> 10.15.0)
- FirebaseAnalytics (10.15.0):
- FirebaseAnalytics/AdIdSupport (= 10.15.0)
- FirebaseCore (~> 10.0)
Expand All @@ -31,31 +28,13 @@ PODS:
- FirebaseCoreInternal (~> 10.0)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/Logger (~> 7.8)
- FirebaseCoreExtension (10.19.0):
- FirebaseCore (~> 10.0)
- FirebaseCoreInternal (10.19.0):
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- FirebaseCrashlytics (10.15.0):
- FirebaseCore (~> 10.5)
- FirebaseInstallations (~> 10.0)
- FirebaseSessions (~> 10.5)
- GoogleDataTransport (~> 9.2)
- GoogleUtilities/Environment (~> 7.8)
- nanopb (< 2.30910.0, >= 2.30908.0)
- PromisesObjC (~> 2.1)
- FirebaseInstallations (10.15.0):
- FirebaseCore (~> 10.0)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8)
- PromisesObjC (~> 2.1)
- FirebaseSessions (10.19.0):
- FirebaseCore (~> 10.5)
- FirebaseCoreExtension (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleDataTransport (~> 9.2)
- GoogleUtilities/Environment (~> 7.10)
- nanopb (< 2.30910.0, >= 2.30908.0)
- PromisesSwift (~> 2.1)
- GoogleAppMeasurement (10.15.0):
- GoogleAppMeasurement/AdIdSupport (= 10.15.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
Expand All @@ -76,10 +55,6 @@ PODS:
- GoogleUtilities/Network (~> 7.11)
- "GoogleUtilities/NSData+zlib (~> 7.11)"
- nanopb (< 2.30910.0, >= 2.30908.0)
- GoogleDataTransport (9.2.5):
- GoogleUtilities/Environment (~> 7.7)
- nanopb (< 2.30910.0, >= 2.30908.0)
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/AppDelegateSwizzler (7.11.5):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
Expand All @@ -106,49 +81,47 @@ PODS:
- nanopb/decode (2.30909.0)
- nanopb/encode (2.30909.0)
- PromisesObjC (2.3.1)
- PromisesSwift (2.3.1):
- PromisesObjC (= 2.3.1)
- Sentry (8.20.0):
- Sentry/Core (= 8.20.0)
- SentryPrivate (= 8.20.0)
- Sentry/Core (8.20.0):
- SentryPrivate (= 8.20.0)
- SentryPrivate (8.20.0)

DEPENDENCIES:
- Firebase/Analytics
- Firebase/Crashlytics
- Kingfisher (~> 7.8.1)
- Sentry (~> 8.20.0)

SPEC REPOS:
trunk:
- Firebase
- FirebaseAnalytics
- FirebaseCore
- FirebaseCoreExtension
- FirebaseCoreInternal
- FirebaseCrashlytics
- FirebaseInstallations
- FirebaseSessions
- GoogleAppMeasurement
- GoogleDataTransport
- GoogleUtilities
- Kingfisher
- nanopb
- PromisesObjC
- PromisesSwift
- Sentry
- SentryPrivate

SPEC CHECKSUMS:
Firebase: 66043bd4579e5b73811f96829c694c7af8d67435
FirebaseAnalytics: 47cef43728f81a839cf1306576bdd77ffa2eac7e
FirebaseCore: 2cec518b43635f96afe7ac3a9c513e47558abd2e
FirebaseCoreExtension: c08d14c7b22e07994e876d837e6f58642f340087
FirebaseCoreInternal: b444828ea7cfd594fca83046b95db98a2be4f290
FirebaseCrashlytics: a83f26fb922a3fe181eb738fb4dcf0c92bba6455
FirebaseInstallations: cae95cab0f965ce05b805189de1d4c70b11c76fb
FirebaseSessions: e5f4caa188dc8bc6142abc974355be75b042215e
GoogleAppMeasurement: 722db6550d1e6d552b08398b69a975ac61039338
GoogleDataTransport: 54dee9d48d14580407f8f5fbf2f496e92437a2f2
GoogleUtilities: 13e2c67ede716b8741c7989e26893d151b2b2084
Kingfisher: 63f677311d36a3473f6b978584f8a3845d023dc5
nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4
PromisesSwift: 28dca69a9c40779916ac2d6985a0192a5cb4a265
Sentry: a8d7b373b9f9868442b02a0c425192f693103cbf
SentryPrivate: 006b24af16828441f70e2ab6adf241bd0a8ad130

PODFILE CHECKSUM: 4654f3ccb4ae86c4f9440935f0df48a0ebdaaeb8
PODFILE CHECKSUM: 93eb4b2b1c30be7ff2afd9f4127e820ca4f2f507

COCOAPODS: 1.14.3
1 change: 0 additions & 1 deletion shared-ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ kotlin {
implementation(project(":shared"))

api(libs.kermit)
api(libs.kermit.crashlytics)
api(libs.kotlinx.coroutines.core)
api(libs.kotlinx.datetime)
api(libs.multiplatformSettings.core)
Expand Down
2 changes: 1 addition & 1 deletion shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ kotlin {
sourceSets {
commonMain.dependencies {
api(libs.kermit)
api(libs.kermit.crashlytics)
api(libs.kotlinx.coroutines.core)
api(libs.kotlinx.datetime)
api(libs.multiplatformSettings.core)
Expand All @@ -79,6 +78,7 @@ kotlin {
implementation(libs.stately.common)
implementation(libs.koin.core)
implementation(libs.korio)
implementation(libs.sentry)
}
androidMain.dependencies {
implementation(libs.sqldelight.driver.android)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@ import co.touchlab.droidcon.domain.repository.impl.SqlDelightDriverFactory
import co.touchlab.droidcon.service.AndroidNotificationService
import co.touchlab.droidcon.util.formatter.AndroidDateFormatter
import co.touchlab.droidcon.util.formatter.DateFormatter
import co.touchlab.kermit.ExperimentalKermitApi
import co.touchlab.kermit.LogcatWriter
import co.touchlab.kermit.Logger
import co.touchlab.kermit.StaticConfig
import co.touchlab.kermit.crashlytics.CrashlyticsLogWriter
import com.russhwolf.settings.ExperimentalSettingsApi
import io.ktor.client.engine.HttpClientEngine
import io.ktor.client.engine.okhttp.OkHttp
import org.koin.core.module.Module
import org.koin.dsl.module

@OptIn(ExperimentalSettingsApi::class, ExperimentalKermitApi::class)
actual val platformModule: Module = module {
single<SqlDriver> {
SqlDelightDriverFactory(context = get()).createDriver()
Expand All @@ -41,6 +37,8 @@ actual val platformModule: Module = module {
AndroidDateFormatter(dateTimeService = get())
}

val baseKermit = Logger(config = StaticConfig(logWriterList = listOf(LogcatWriter(), CrashlyticsLogWriter())), tag = "Droidcon")
val baseKermit = Logger(config = StaticConfig(logWriterList = listOf(LogcatWriter())), tag = "Droidcon")
factory { (tag: String?) -> if (tag != null) baseKermit.withTag(tag) else baseKermit }
}

actual val sentryDsn = "https://6a97c8a17bd4ce7adc4a93d0bd3cb300@o4506955696766976.ingest.us.sentry.io/4506956255854592"
6 changes: 6 additions & 0 deletions shared/src/commonMain/kotlin/co/touchlab/droidcon/Koin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import co.touchlab.droidcon.domain.service.impl.json.AboutJsonResourceDataSource
import co.touchlab.droidcon.domain.service.impl.json.JsonResourceReader
import co.touchlab.droidcon.domain.service.impl.json.JsonSeedResourceDataSource
import io.ktor.client.HttpClient
import io.sentry.kotlin.multiplatform.Sentry
import kotlinx.datetime.Clock
import kotlinx.serialization.json.Json
import org.koin.core.KoinApplication
Expand All @@ -54,7 +55,12 @@ import org.koin.core.qualifier.qualifier
import org.koin.core.scope.Scope
import org.koin.dsl.module

expect val sentryDsn: String

fun initKoin(additionalModules: List<Module>): KoinApplication {
Sentry.init {
it.dsn = sentryDsn
}
val koinApplication = startKoin {
modules(
additionalModules +
Expand Down
2 changes: 2 additions & 0 deletions shared/src/iosMain/kotlin/co/touchlab/droidcon/Koin.ios.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,5 @@ fun Koin.get(objCProtocol: ObjCProtocol, qualifier: Qualifier?): Any {
val kClazz = requireNotNull(getOriginalKotlinClass(objCProtocol)) { "Could not get original kotlin class for $objCProtocol." }
return get(kClazz, qualifier, null)
}

actual val sentryDsn = "https://5678e5aebe72952167c6fb89bbad02e3@o4506955696766976.ingest.us.sentry.io/4506973278961664"
15 changes: 0 additions & 15 deletions shared/src/iosMain/kotlin/co/touchlab/droidcon/util/AppInit.kt

This file was deleted.

0 comments on commit c355df4

Please sign in to comment.