mirror of
https://github.com/revanced/revanced-manager-compose-old.git
synced 2025-04-29 22:14:28 +02:00
feat: sentry integration
This commit is contained in:
parent
e4fe4a6a40
commit
3f027c0701
1
.github/workflows/release.yml
vendored
1
.github/workflows/release.yml
vendored
@ -24,6 +24,7 @@ jobs:
|
||||
- name: Build with Gradle
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
||||
run: ./gradlew assembleRelease
|
||||
- name: Sign APK
|
||||
id: sign_apk
|
||||
|
@ -36,7 +36,7 @@ android {
|
||||
|
||||
buildConfigField("String", "REVANCED_API_URL", "\"https://releases.revanced.app\"")
|
||||
buildConfigField("String", "GITHUB_API_URL", "\"https://api.github.com\"")
|
||||
|
||||
buildConfigField("String", "SENTRY_DSN", System.getenv("SENTRY_DSN") ?: "\"\"")
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
@ -129,4 +129,7 @@ dependencies {
|
||||
implementation("io.ktor:ktor-client-okhttp:$ktorVersion")
|
||||
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
|
||||
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
|
||||
|
||||
// Sentry
|
||||
implementation("io.sentry:sentry-android:6.7.0")
|
||||
}
|
||||
|
@ -48,6 +48,10 @@
|
||||
tools:node="remove" />
|
||||
</provider>
|
||||
|
||||
<meta-data
|
||||
android:name="io.sentry.dsn"
|
||||
android:value="" />
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
|
@ -18,10 +18,10 @@ import app.revanced.manager.ui.screen.MainDashboardScreen
|
||||
import app.revanced.manager.ui.screen.subscreens.*
|
||||
import app.revanced.manager.ui.theme.ReVancedManagerTheme
|
||||
import app.revanced.manager.ui.theme.Theme
|
||||
import app.revanced.manager.util.requestAllFilesAccess
|
||||
import app.revanced.manager.util.requestIgnoreBatteryOptimizations
|
||||
import com.xinto.taxi.Taxi
|
||||
import com.xinto.taxi.rememberBackstackNavigator
|
||||
import io.sentry.SentryOptions
|
||||
import io.sentry.android.core.SentryAndroid
|
||||
import org.koin.android.ext.android.inject
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
@ -30,6 +30,17 @@ class MainActivity : ComponentActivity() {
|
||||
@OptIn(ExperimentalAnimationApi::class)
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
installSplashScreen()
|
||||
SentryAndroid.init(this) {
|
||||
it.dsn = if (prefs.sentry) BuildConfig.SENTRY_DSN else ""
|
||||
it.environment = BuildConfig.BUILD_TYPE
|
||||
it.release = BuildConfig.VERSION_NAME
|
||||
|
||||
it.beforeSend = SentryOptions.BeforeSendCallback { event, _ ->
|
||||
if (prefs.sentry) {
|
||||
event
|
||||
} else null
|
||||
}
|
||||
}
|
||||
super.onCreate(savedInstanceState)
|
||||
setContent {
|
||||
ReVancedManagerTheme(
|
||||
|
@ -16,4 +16,5 @@ class PreferencesManager(
|
||||
var theme by enumPreference("theme", Theme.SYSTEM)
|
||||
var srcPatches by stringPreference("src_patches", ghPatches)
|
||||
var srcIntegrations by stringPreference("src_integrations", ghIntegrations)
|
||||
var sentry by booleanPreference("sentry", true)
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import io.ktor.client.request.*
|
||||
import io.ktor.client.statement.*
|
||||
import io.ktor.util.cio.*
|
||||
import io.ktor.utils.io.*
|
||||
import io.sentry.Sentry
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.io.File
|
||||
@ -52,6 +53,7 @@ class ManagerAPI(
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.e(tag, "An error occurred while downloading patches", e)
|
||||
Sentry.captureException(e)
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,7 +67,6 @@ class ManagerAPI(
|
||||
file
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -7,7 +7,6 @@ import app.revanced.manager.network.dto.GithubContributor
|
||||
import app.revanced.manager.network.dto.GithubReleases
|
||||
import app.revanced.manager.network.utils.APIResponse
|
||||
import app.revanced.manager.network.utils.getOrNull
|
||||
import app.revanced.manager.network.utils.getOrThrow
|
||||
import io.ktor.client.request.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
@ -42,7 +41,6 @@ class GithubServiceImpl(
|
||||
|
||||
override suspend fun findAsset(repo: String, file: String): PatchesAsset {
|
||||
val releases = getReleases(repo).getOrNull() ?: throw Exception("Cannot retrieve assets")
|
||||
|
||||
val asset = releases.assets.find { asset ->
|
||||
(asset.name.contains(file) && !asset.name.contains("-sources") && !asset.name.contains("-javadoc"))
|
||||
} ?: throw MissingAssetException()
|
||||
|
@ -14,6 +14,7 @@ import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import app.revanced.patcher.util.patch.PatchBundle
|
||||
import dalvik.system.DexClassLoader
|
||||
import io.sentry.Sentry
|
||||
import java.util.*
|
||||
|
||||
class PatcherUtils(val app: Application) {
|
||||
@ -40,6 +41,7 @@ class PatcherUtils(val app: Application) {
|
||||
} else throw IllegalStateException("No patch bundle(s) selected.")
|
||||
} catch (e: Exception) {
|
||||
Log.e(tag, "Failed to load patch bundle.", e)
|
||||
Sentry.captureException(e)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,13 +22,11 @@ import app.revanced.manager.patcher.aligning.ZipAligner
|
||||
import app.revanced.manager.patcher.aligning.zip.ZipFile
|
||||
import app.revanced.manager.patcher.aligning.zip.structures.ZipEntry
|
||||
import app.revanced.manager.patcher.signing.Signer
|
||||
import app.revanced.manager.ui.Resource
|
||||
import app.revanced.manager.ui.viewmodel.Logging
|
||||
import app.revanced.patcher.Patcher
|
||||
import app.revanced.patcher.PatcherOptions
|
||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||
import app.revanced.patcher.logging.Logger
|
||||
import app.revanced.patcher.patch.Patch
|
||||
import io.sentry.Sentry
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.koin.core.component.KoinComponent
|
||||
@ -79,6 +77,7 @@ class PatcherWorker(
|
||||
setForeground(ForegroundInfo(1, createNotification()))
|
||||
} catch (e: Exception) {
|
||||
Log.d(tag, "Failed to set foreground info:", e)
|
||||
Sentry.captureException(e)
|
||||
}
|
||||
|
||||
return try {
|
||||
@ -86,6 +85,7 @@ class PatcherWorker(
|
||||
Result.success()
|
||||
} catch (e: Exception) {
|
||||
Log.e(tag, "Error while patching: ${e.message ?: e::class.simpleName}")
|
||||
Sentry.captureException(e)
|
||||
Result.failure()
|
||||
}
|
||||
}
|
||||
@ -176,7 +176,6 @@ class PatcherWorker(
|
||||
Logging.log += "Failed to apply $patch" + result.exceptionOrNull()!!.cause + "\n"
|
||||
return@forEach
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Logging.log += "Saving file\n"
|
||||
|
@ -12,6 +12,7 @@ import app.revanced.manager.patcher.PatcherUtils
|
||||
import app.revanced.manager.ui.Resource
|
||||
import app.revanced.manager.util.tag
|
||||
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
|
||||
import io.sentry.Sentry
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
@ -50,6 +51,7 @@ class AppSelectorViewModel(
|
||||
Log.d(tag, "Filtered apps.")
|
||||
} catch (e: Exception) {
|
||||
Log.e(tag, "An error occurred while filtering", e)
|
||||
Sentry.captureException(e)
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,6 +84,7 @@ class AppSelectorViewModel(
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
Log.e(tag, "Failed to load apk", e)
|
||||
Sentry.captureException(e)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user