Skip to content

Commit b3801cc

Browse files
committedFeb 25, 2025
feat: replace bugsnag with acra
1 parent a1609ba commit b3801cc

File tree

10 files changed

+61
-27
lines changed

10 files changed

+61
-27
lines changed
 

‎README.md

+1-7
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,4 @@ Different phone [OEMs](https://en.wikipedia.org/wiki/Original_equipment_manufact
1717
It is recommended that you disable the battery optimization for this app in order to get accurate alarms.
1818
In the worst case, if you still have issues, try to keep the phone plugged in and/or the screen on while working.
1919

20-
Read more about this topic on [www.dontkillmyapp.com](https://dontkillmyapp.com/)
21-
22-
## Sponsors
23-
24-
<a href="https://www.bugsnag.com/" target="_blank">
25-
<img src="resources/sponsors/bugsnag_logo.png" alt="Bugsnag logo" width="156">
26-
</a>
20+
Read more about this topic on [www.dontkillmyapp.com](https://dontkillmyapp.com/)

‎androidApp/build.gradle.kts

+12-5
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,17 @@ android {
5353
}
5454
}
5555
compileOptions {
56-
sourceCompatibility = JavaVersion.VERSION_19
57-
targetCompatibility = JavaVersion.VERSION_19
58-
isCoreLibraryDesugaringEnabled = true
56+
sourceCompatibility = JavaVersion.VERSION_17
57+
targetCompatibility = JavaVersion.VERSION_17
5958
}
6059
kotlinOptions {
61-
jvmTarget = "19"
60+
jvmTarget = "17"
61+
}
62+
63+
java {
64+
toolchain {
65+
languageVersion = JavaLanguageVersion.of(17)
66+
}
6267
}
6368

6469
androidResources {
@@ -100,7 +105,9 @@ dependencies {
100105

101106
implementation(libs.androidx.ui.tooling)
102107
implementation(libs.androidx.ui.tooling.preview)
103-
implementation(libs.bugsnag.android)
108+
109+
implementation(libs.acra.mail)
110+
implementation(libs.acra.notification)
104111

105112
"googleImplementation"(libs.billing.ktx)
106113
}

‎androidApp/src/main/java/com/apps/adrcotfas/goodtime/GoodtimeApplication.kt

+33-2
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,15 @@ import com.apps.adrcotfas.goodtime.di.getWith
4141
import com.apps.adrcotfas.goodtime.di.insertKoin
4242
import com.apps.adrcotfas.goodtime.settings.notifications.SoundsViewModel
4343
import com.apps.adrcotfas.goodtime.settings.reminders.ReminderHelper
44-
import com.bugsnag.android.Bugsnag
44+
import com.apps.adrcotfas.goodtime.shared.R
4545
import kotlinx.coroutines.CoroutineScope
4646
import kotlinx.coroutines.MainScope
4747
import kotlinx.coroutines.launch
48+
import org.acra.ACRA
49+
import org.acra.config.mailSender
50+
import org.acra.config.notification
51+
import org.acra.data.StringFormat
52+
import org.acra.ktx.initAcra
4853
import org.koin.android.ext.android.get
4954
import org.koin.core.module.dsl.viewModel
5055
import org.koin.core.qualifier.named
@@ -55,7 +60,7 @@ class GoodtimeApplication : Application() {
5560

5661
override fun onCreate() {
5762
super.onCreate()
58-
Bugsnag.start(this)
63+
if (ACRA.isACRASenderServiceProcess()) return
5964
insertKoin(
6065
module {
6166
single<Context> { this@GoodtimeApplication }
@@ -140,4 +145,30 @@ class GoodtimeApplication : Application() {
140145
val billing = get<BillingAbstract>()
141146
billing.init()
142147
}
148+
149+
override fun attachBaseContext(context: Context) {
150+
super.attachBaseContext(context)
151+
152+
ACRA.DEV_LOGGING = true
153+
initAcra {
154+
buildConfigClass = BuildConfig::class.java
155+
reportFormat = StringFormat.JSON
156+
157+
notification {
158+
// required
159+
title = getString(R.string.main_crash_notification_title)
160+
// required
161+
text = getString(R.string.main_crash_notification_desc)
162+
// required
163+
channelName = getString(R.string.main_crash_channel_name)
164+
resSendButtonIcon = null
165+
resDiscardButtonIcon = null
166+
}
167+
mailSender {
168+
mailTo = getString(R.string.contact_address)
169+
subject = getString(R.string.crash_report_title)
170+
reportFileName = "crash.txt"
171+
}
172+
}
173+
}
143174
}

‎androidApp/src/main/java/com/apps/adrcotfas/goodtime/settings/about/SendFeedback.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import android.os.Build
2525
import android.widget.Toast
2626
import com.apps.adrcotfas.goodtime.common.getVersionCode
2727
import com.apps.adrcotfas.goodtime.common.getVersionName
28+
import com.apps.adrcotfas.goodtime.shared.R
2829

2930
fun getDeviceInfo(): String {
3031
val manufacturer = Build.MANUFACTURER
@@ -36,8 +37,8 @@ fun getDeviceInfo(): String {
3637
fun sendFeedback(context: Context) {
3738
val email = Intent(Intent.ACTION_SENDTO)
3839
email.data = Uri.Builder().scheme("mailto").build()
39-
email.putExtra(Intent.EXTRA_EMAIL, arrayOf("goodtime-app@googlegroups.com"))
40-
email.putExtra(Intent.EXTRA_SUBJECT, "[Goodtime Productivity] Feedback")
40+
email.putExtra(Intent.EXTRA_EMAIL, arrayOf(context.getString(R.string.contact_address)))
41+
email.putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.feedback_title))
4142
email.putExtra(
4243
Intent.EXTRA_TEXT,
4344
"""

‎gradle/libs.versions.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[versions]
22

3+
acra = "5.12.0"
34
android-minSdk = "26"
45
android-compileSdk = "35"
56
android-targetSdk = "35"
67

78
agp = "8.7.3"
89
billingKtx = "7.1.1"
9-
bugsnagAndroid = "6.12.0"
1010
kotlin = "2.1.0"
1111
kotlinxCollectionsImmutable = "0.3.8"
1212
ksp = "2.1.0-1.0.29"
@@ -45,6 +45,8 @@ vico = "2.1.0-alpha.1"
4545
androidchart = "3.1.0.25"
4646

4747
[libraries]
48+
acra-mail = { module = "ch.acra:acra-mail", version.ref = "acra" }
49+
acra-notification = { module = "ch.acra:acra-notification", version.ref = "acra" }
4850
androidchart = { module = "com.github.AppDevNext:AndroidChart", version.ref = "androidchart" }
4951
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidx-core-ktx" }
5052
androidx-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "androidx-foundation" }
@@ -69,7 +71,6 @@ androidx-room-paging = { group = "androidx.room", name = "room-paging", version.
6971
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "androidx-room" }
7072
androidx-room-testing = { module = "androidx.room:room-testing", version.ref = "androidx-room" }
7173
billing-ktx = { module = "com.android.billingclient:billing-ktx", version.ref = "billingKtx" }
72-
bugsnag-android = { module = "com.bugsnag:bugsnag-android", version.ref = "bugsnagAndroid" }
7374
kotlinx-collections-immutable = { module = "org.jetbrains.kotlinx:kotlinx-collections-immutable", version.ref = "kotlinxCollectionsImmutable" }
7475
sqlite-bundled = { module = "androidx.sqlite:sqlite-bundled", version.ref = "sqlite" }
7576

@@ -94,7 +95,6 @@ turbine = { module = "app.cash.turbine:turbine", version.ref = "turbine" }
9495
okio-fakefilesystem = { module = "com.squareup.okio:okio-fakefilesystem", version.ref = "okio" }
9596
touchlab-kermit = { module = "co.touchlab:kermit", version.ref = "kermit" }
9697
touchlab-kermit-simple = { module = "co.touchlab:kermit-simple", version.ref = "kermit" }
97-
touchlab-kermit-bugsnag = { module = "co.touchlab:kermit-bugsnag", version.ref = "kermit" }
9898
mikepenz-aboutlibraries-core = { module = "com.mikepenz:aboutlibraries-core", version.ref = "mikepenz-aboutlibraries" }
9999
mikepenz-aboutlibraries-compose = { module = "com.mikepenz:aboutlibraries-compose-m3", version.ref = "mikepenz-aboutlibraries" }
100100

‎resources/sponsors/bugsnag_logo.png

-38.2 KB
Binary file not shown.

‎shared/build.gradle.kts

-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ kotlin {
6969
implementation(libs.kotlinx.datetime)
7070
implementation(libs.androidx.lifecycle.viewmodel)
7171
api(libs.touchlab.kermit)
72-
// TODO: integrate with CrashKiOS too
73-
api(libs.touchlab.kermit.bugsnag)
7472
}
7573
commonTest.dependencies {
7674
implementation(libs.bundles.shared.commonTest)

‎shared/src/commonMain/kotlin/com/apps/adrcotfas/goodtime/di/AppModule.kt

+1-4
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ package com.apps.adrcotfas.goodtime.di
2020
import androidx.datastore.core.DataStore
2121
import androidx.datastore.preferences.core.PreferenceDataStoreFactory
2222
import androidx.datastore.preferences.core.Preferences
23-
import co.touchlab.kermit.ExperimentalKermitApi
2423
import co.touchlab.kermit.Logger
2524
import co.touchlab.kermit.Severity
2625
import co.touchlab.kermit.StaticConfig
27-
import co.touchlab.kermit.bugsnag.BugsnagLogWriter
2826
import co.touchlab.kermit.platformLogWriter
2927
import com.apps.adrcotfas.goodtime.bl.FinishedSessionsHandler
3028
import com.apps.adrcotfas.goodtime.bl.TimeProvider
@@ -80,12 +78,11 @@ fun insertKoin(appModule: Module, flavorModule: Module): KoinApplication {
8078
expect fun isDebug(): Boolean
8179
expect val platformModule: Module
8280

83-
@OptIn(ExperimentalKermitApi::class)
8481
private val coreModule = module {
8582
val baseLogger =
8683
Logger(
8784
config = StaticConfig(
88-
logWriterList = listOf(platformLogWriter(), BugsnagLogWriter()),
85+
logWriterList = listOf(platformLogWriter()),
8986
minSeverity = if (isDebug()) Severity.Verbose else Severity.Info,
9087
),
9188
tag = "Goodtime",

‎shared/src/main/res/values/strings_main.xml

+5-2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
<string name="main_break_finished">Break finished</string>
4343
<string name="main_continue">Continue?</string>
4444
<string name="main_productivity_reminder_desc">"It's time to be productive!"</string>
45-
<string name="main_notifications_channel_name">Goodtime Notifications</string>
46-
<string name="main_reminder_channel_name">Goodtime Reminder Notifications</string>
45+
<string name="main_notifications_channel_name">Timer Notifications</string>
46+
<string name="main_reminder_channel_name">Reminder Notifications</string>
47+
<string name="main_crash_channel_name">Crash reports</string>
48+
<string name="main_crash_notification_title">App crashed</string>
49+
<string name="main_crash_notification_desc">Sorry for the inconvenience. Please send a report to the developer.</string>
4750
</resources>

‎shared/src/main/res/values/untranslatable.xml

+3
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,7 @@
2020
<string name="product_name_long" translatable="false">Goodtime Productivity</string>
2121
<string name="main_min" translatable="false">%1$smin</string>
2222
<string name="main_plus_1_min" translatable="false">+1 min</string>
23+
<string name="contact_address" translatable="false">"goodtime-app@googlegroups.com"</string>
24+
<string name="feedback_title" translatable="false">"[Goodtime Productivity] Feedback"</string>
25+
<string name="crash_report_title" translatable="false">"[Goodtime Productivity] Crash report"</string>
2326
</resources>

0 commit comments

Comments
 (0)
Please sign in to comment.