Move ACRA endpoint config to build.gradle.kts

This commit is contained in:
arkon 2021-01-17 11:09:29 -05:00
parent 878008e93b
commit 3319ccfd41
2 changed files with 15 additions and 22 deletions

View file

@ -20,17 +20,6 @@ if (gradle.startParameter.taskRequests.toString().contains("Standard")) {
shortcutHelper.setFilePath("./shortcuts.xml") shortcutHelper.setFilePath("./shortcuts.xml")
fun runCommand(command: String): String {
val byteOut = ByteArrayOutputStream()
project.exec {
commandLine = command.split(" ")
standardOutput = byteOut
}
return String(byteOut.toByteArray()).trim()
}
android { android {
compileSdkVersion(AndroidConfig.compileSdk) compileSdkVersion(AndroidConfig.compileSdk)
buildToolsVersion(AndroidConfig.buildTools) buildToolsVersion(AndroidConfig.buildTools)
@ -49,6 +38,9 @@ android {
buildConfigField("String", "BUILD_TIME", "\"${getBuildTime()}\"") buildConfigField("String", "BUILD_TIME", "\"${getBuildTime()}\"")
buildConfigField("boolean", "INCLUDE_UPDATER", "false") buildConfigField("boolean", "INCLUDE_UPDATER", "false")
// Please disable ACRA or use your own instance in forked versions of the project
buildConfigField("String", "ACRA_URI", "\"https://tachiyomi.kanade.eu/crash_report\"")
multiDexEnabled = true multiDexEnabled = true
ndk { ndk {
@ -334,3 +326,12 @@ fun getBuildTime(): String {
df.timeZone = TimeZone.getTimeZone("UTC") df.timeZone = TimeZone.getTimeZone("UTC")
return df.format(Date()) return df.format(Date())
} }
fun runCommand(command: String): String {
val byteOut = ByteArrayOutputStream()
project.exec {
commandLine = command.split(" ")
standardOutput = byteOut
}
return String(byteOut.toByteArray()).trim()
}

View file

@ -28,24 +28,17 @@ import java.security.Security
excludeMatchingSharedPreferencesKeys = [".*username.*", ".*password.*", ".*token.*"] excludeMatchingSharedPreferencesKeys = [".*username.*", ".*password.*", ".*token.*"]
) )
@AcraHttpSender( @AcraHttpSender(
uri = "https://tachiyomi.kanade.eu/crash_report", uri = BuildConfig.ACRA_URI,
httpMethod = HttpSender.Method.PUT httpMethod = HttpSender.Method.PUT
) )
open class App : Application(), LifecycleObserver { open class App : Application(), LifecycleObserver {
private val preferences: PreferencesHelper by injectLazy()
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
if (BuildConfig.DEBUG) Timber.plant(Timber.DebugTree()) if (BuildConfig.DEBUG) Timber.plant(Timber.DebugTree())
// Debug tool; see https://fbflipper.com/
// SoLoader.init(this, false)
// if (BuildConfig.DEBUG && FlipperUtils.shouldEnableFlipper(this)) {
// val client = AndroidFlipperClient.getInstance(this)
// client.addPlugin(InspectorFlipperPlugin(this, DescriptorMapping.withDefaults()))
// client.addPlugin(DatabasesFlipperPlugin(this))
// client.start()
// }
// TLS 1.3 support for Android < 10 // TLS 1.3 support for Android < 10
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
Security.insertProviderAt(Conscrypt.newProvider(), 1) Security.insertProviderAt(Conscrypt.newProvider(), 1)
@ -74,7 +67,6 @@ open class App : Application(), LifecycleObserver {
@OnLifecycleEvent(Lifecycle.Event.ON_STOP) @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
@Suppress("unused") @Suppress("unused")
fun onAppBackgrounded() { fun onAppBackgrounded() {
val preferences: PreferencesHelper by injectLazy()
if (preferences.lockAppAfter().get() >= 0) { if (preferences.lockAppAfter().get() >= 0) {
SecureActivityDelegate.locked = true SecureActivityDelegate.locked = true
} }