From 31c81021ce333a03d3c4a67056fb6af11246e670 Mon Sep 17 00:00:00 2001 From: Sweetbread Date: Wed, 14 May 2025 21:21:39 +0300 Subject: [PATCH] fix: change ACRA to Sentry --- .gitignore | 1 + NOTICE.md | 14 ++++----- app/build.gradle.kts | 18 +++++++++-- app/src/main/AndroidManifest.xml | 31 ++++++++++++++++++- app/src/main/java/ru/sweetbread/unn/UNNApp.kt | 11 ------- gradle/libs.versions.toml | 5 ++- secrets.properties | 5 --- 7 files changed, 56 insertions(+), 29 deletions(-) delete mode 100644 secrets.properties diff --git a/.gitignore b/.gitignore index faf530b..deee376 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ .externalNativeBuild .cxx local.properties +secrets.properties \ No newline at end of file diff --git a/NOTICE.md b/NOTICE.md index ff035a6..254008c 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -8,12 +8,6 @@ This project incorporates components from the following third-party libraries: Licensed under Apache License 2.0 [https://developer.android.com](https://developer.android.com) -## ACRA -- **ch.acra:acra-http** - Copyright ACRA - Licensed under Apache License 2.0 - [https://github.com/ACRA/acra](https://github.com/ACRA/acra) - ## Coil - **io.coil-kt:coil-compose** Copyright Coil Contributors @@ -53,6 +47,12 @@ This project incorporates components from the following third-party libraries: Copyright Google LLC Licensed under Apache License 2.0 +## Sentry Android +- **io.sentry:sentry-android** + Copyright Sentry and contributors + Licensed under MIT License + [https://github.com/getsentry/sentry-java](https://github.com/getsentry/sentry-java) + ## Build Tools - **Gradle Plugins** (Android, Kotlin) Copyright Google LLC / JetBrains s.r.o. @@ -67,4 +67,4 @@ This product includes software developed by: - Google LLC - And other contributors listed above -Full license texts are available in the [LICENSE](LICENSE) file and respective library repositories. \ No newline at end of file +Full license texts are available in the [LICENSE](LICENSE) file and respective library repositories. diff --git a/app/build.gradle.kts b/app/build.gradle.kts index f8f545c..75c2523 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -2,6 +2,7 @@ import java.time.LocalDateTime import java.time.format.DateTimeFormatter +import java.util.Properties plugins { alias(libs.plugins.androidApplication) @@ -9,6 +10,7 @@ plugins { alias(libs.plugins.kotlin.compose) id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin") id("com.google.devtools.ksp") + id("io.sentry.android.gradle") version "5.5.0" } secrets { @@ -32,6 +34,15 @@ android { useSupportLibrary = true } + val secretProperties = Properties().apply { + val secretFile = rootProject.file("secrets.properties") + if (secretFile.exists()) + secretFile.inputStream().use { load(it) } + else + println("Warning: secrets.properties not found!") + } + manifestPlaceholders["sentry_url"] = secretProperties.getProperty("SENTRY_URL")!! + // javaCompileOptions { // annotationProcessorOptions { // arguments += ["room.schemaLocation": "$projectDir/schemas".toString()] @@ -44,18 +55,21 @@ android { isMinifyEnabled = false proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") resValue("string", "app_name", "@string/app_name_reg") + manifestPlaceholders["sentry_env"] = "production" } debug { applicationIdSuffix = ".debug" versionNameSuffix = "-debug+${LocalDateTime.now().format(DateTimeFormatter.BASIC_ISO_DATE)}" resValue("string", "app_name", "@string/app_name_dev") + manifestPlaceholders["sentry_env"] = "debug" } create("beta") { versionNameSuffix = "-beta+${LocalDateTime.now().format(DateTimeFormatter.BASIC_ISO_DATE)}" resValue("string", "app_name", "@string/app_name_beta") signingConfig = signingConfigs.getByName("debug") + manifestPlaceholders["sentry_env"] = "beta" } } compileOptions { @@ -120,9 +134,9 @@ dependencies { implementation(libs.compose) - implementation(libs.acra.http) + implementation(libs.sentry) implementation(libs.androidx.room.runtime) implementation(libs.androidx.room.ktx) ksp(libs.androidx.room.compiler) -} \ No newline at end of file +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 65116ae..4675019 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -15,6 +15,35 @@ android:supportsRtl="true" android:theme="@style/Theme.UNN" tools:targetApi="31"> + + + + + + + + + + + - \ No newline at end of file + diff --git a/app/src/main/java/ru/sweetbread/unn/UNNApp.kt b/app/src/main/java/ru/sweetbread/unn/UNNApp.kt index f7e789f..8cd5ff8 100644 --- a/app/src/main/java/ru/sweetbread/unn/UNNApp.kt +++ b/app/src/main/java/ru/sweetbread/unn/UNNApp.kt @@ -8,16 +8,5 @@ import android.content.Context class UNNApp : Application() { override fun attachBaseContext(base: Context) { super.attachBaseContext(base) - -// initAcra { -// buildConfigClass = BuildConfig::class.java -// reportFormat = StringFormat.JSON -// httpSender { -// uri = BuildConfig.ACRA_URL -// basicAuthLogin = BuildConfig.ACRA_LOGIN -// basicAuthPassword = BuildConfig.ACRA_PASS -// httpMethod = HttpSender.Method.POST -// } -// } } } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 97521b8..09c1f52 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,4 @@ [versions] -acraHttp = "5.11.3" agp = "8.7.3" calendar = "2.6.2" coilCompose = "2.7.0" @@ -23,11 +22,11 @@ activity = "1.10.1" navigationCompose = "2.8.9" roomRuntime = "2.7.1" secretsGradlePlugin = "2.0.1" +sentryAndroid = "8.12.0" splitties = "3.0.0" materialIconsCoreAndroid = "1.7.8" [libraries] -acra-http = { module = "ch.acra:acra-http", version.ref = "acraHttp" } androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } androidx-core-splashscreen = { module = "androidx.core:core-splashscreen", version.ref = "coreSplashscreen" } androidx-datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "datastorePreferences" } @@ -62,6 +61,7 @@ androidx-lifecycle-livedata-ktx = { group = "androidx.lifecycle", name = "lifecy androidx-lifecycle-viewmodel-ktx = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "lifecycle" } androidx-activity = { group = "androidx.activity", name = "activity", version.ref = "activity" } secrets-gradle-plugin = { module = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin", version.ref = "secretsGradlePlugin" } +sentry = { module = "io.sentry:sentry-android", version.ref = "sentryAndroid" } splitties-base = { module = "com.louiscad.splitties:splitties-fun-pack-android-base-with-views-dsl", version.ref = "splitties" } splitties-room = { module = "com.louiscad.splitties:splitties-arch-room", version.ref = "splitties" } androidx-material-icons-core-android = { group = "androidx.compose.material", name = "material-icons-core-android", version.ref = "materialIconsCoreAndroid" } @@ -70,4 +70,3 @@ androidx-material-icons-core-android = { group = "androidx.compose.material", na androidApplication = { id = "com.android.application", version.ref = "agp" } jetbrainsKotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } - diff --git a/secrets.properties b/secrets.properties deleted file mode 100644 index e8b061b..0000000 --- a/secrets.properties +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2025 Gleb Zaharov. License: GPLv3 (see LICENSE). - -ACRA_URL=https://bugs.coders-squad.com/report -ACRA_LOGIN=pMJkqPlNLX4kQ3kK -ACRA_PASS=HYY72oV4ybmpCggC \ No newline at end of file