From 150550dc2c26fb82ad760b9cd3ad5aa5c49d205d Mon Sep 17 00:00:00 2001 From: ChronosX88 Date: Sat, 15 Jan 2022 19:33:30 +0300 Subject: [PATCH] Move all ACRA credentials to props file --- .gitignore | 2 ++ .idea/misc.xml | 10 ++++++++++ acra.properties.sample | 3 +++ app/build.gradle | 8 ++++++++ .../java/org/yggdrasil/app/crispa/YggApplication.kt | 11 +++-------- 5 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 acra.properties.sample diff --git a/.gitignore b/.gitignore index 9075d15..e8d7c57 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ /app/src/main/assets/yggdrasil-0.3.8-linux-arm64 /app/src/main/assets/yggdrasil-0.3.8-linux-armhf /.idea/ + +acra.properties diff --git a/.idea/misc.xml b/.idea/misc.xml index 860da66..57bb2d2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,5 +1,15 @@ + + + diff --git a/acra.properties.sample b/acra.properties.sample new file mode 100644 index 0000000..9cb8c87 --- /dev/null +++ b/acra.properties.sample @@ -0,0 +1,3 @@ +ACRA_BACKEND_URL="" +ACRA_LOGIN="" +ACRA_PASSWORD="" diff --git a/app/build.gradle b/app/build.gradle index 5852d76..178eb70 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,6 +1,10 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' +def acraSecretsPropertiesFile = rootProject.file("acra.properties") +def acraSecretsProperties = new Properties() +acraSecretsProperties.load(new FileInputStream(acraSecretsPropertiesFile)) + android { compileSdkVersion 31 defaultConfig { @@ -12,6 +16,10 @@ android { versionName "2.0.18" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" setProperty("archivesBaseName", project.getParent().name+"-"+versionName) + + buildConfigField("String", "ACRA_BACKEND_URL", acraSecretsProperties['ACRA_BACKEND_URL']) + buildConfigField("String", "ACRA_LOGIN", acraSecretsProperties['ACRA_LOGIN']) + buildConfigField("String", "ACRA_PASSWORD", acraSecretsProperties['ACRA_PASSWORD']) } signingConfigs { release { diff --git a/app/src/main/java/org/yggdrasil/app/crispa/YggApplication.kt b/app/src/main/java/org/yggdrasil/app/crispa/YggApplication.kt index d8f9fb4..3d525e5 100644 --- a/app/src/main/java/org/yggdrasil/app/crispa/YggApplication.kt +++ b/app/src/main/java/org/yggdrasil/app/crispa/YggApplication.kt @@ -9,11 +9,6 @@ import org.acra.ktx.initAcra import org.acra.sender.HttpSender class YggApplication : Application() { - - companion object { - const val ACRA_BACKEND_URL = "http://acrarium.rivchain.org/acrarium-1.4.6/report" - } - override fun attachBaseContext(base: Context) { super.attachBaseContext(base) @@ -23,9 +18,9 @@ class YggApplication : Application() { reportFormat = StringFormat.JSON //each plugin you chose above can be configured in a block like this: httpSender { - uri = ACRA_BACKEND_URL - basicAuthLogin="KOF7CEnt5tfTqIhj" - basicAuthPassword = "F4cCIqo9EjpihcPt" + uri = BuildConfig.ACRA_BACKEND_URL + basicAuthLogin = BuildConfig.ACRA_LOGIN + basicAuthPassword = BuildConfig.ACRA_PASSWORD httpMethod = HttpSender.Method.POST } dialog {