diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index e43235d..5259427 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -46,12 +46,30 @@ You can directly import this project into IntellIJ/Android Studio. You'll have to: -- Configure Fabric, or [remove it](https://docs.fabric.io/android/fabric/settings/removing.html#). +- Configure fabric and add your `apiKey` and `apiSecret` in the `fabric.properties` file. - Create a firebase project and add the `google-services.json` to the `app/` folder. -- Define the following in `res/values/strings.xml` or create `res/values/secrets.xml` +- Define the following some parameters either in `~/.gradle/gradle.properties` or as gradle parameters (see the examples) - - mercury: A [Mercury](https://mercury.postlight.com/web-parser/) web parser api key for the internal browser - - feedback_email: An email to receive users feedback. - - source_url: an url to the source code, used in the settings - - tracker_url: an url to the tracker, used in the settings -- To run your app, you'll have to add `-P appLoginUrl="your.selfoss-instance.url" -P appLoginUsername="Username" -P appLoginPassword="password"`. (These are only used to run the espresso tests. You should be able to use empty strings or fake values to build the app) + - mercuryApiKey: A [Mercury](https://mercury.postlight.com/web-parser/) web parser api key for the internal browser + - feedbackEmail: An email to receive users feedback. + - sourceUrl: an url to the source code, used in the settings + - trackerUrl: an url to the tracker, used in the settings + +### Examples: +#### Inside ~/.gradle/gradle.properties + +``` +appLoginUrl="URL" +appLoginUsername="LOGIN" +appLoginPassword="PASS" +mercuryApiKey="LONGAPIKEY" +feedbackEmail="EMAIL" +sourceUrl="URLSOURCE" +trackerUrl="URLTRACKER" +``` + +#### As gradle parameters + +``` +./gradlew .... -P appLoginUrl="URL" -P appLoginUsername="LOGIN" -P appLoginPassword="PASS" -P mercuryApiKey="LONGAPIKEY" -P feedbackEmail="EMAIL" -P sourceUrl="URLSOURCE" -P trackerUrl="URLTRACKER" +``` diff --git a/.gitignore b/.gitignore index ad7be5c..66ca69c 100644 --- a/.gitignore +++ b/.gitignore @@ -214,6 +214,4 @@ gradle-app.setting # End of https://www.gitignore.io/api/java,gradle,android,androidstudio -secrets.xml - release/ \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index cc11917..1629f4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +**1.5.2.17** + +- Source code and tracker links weren't being set, and updated the contributing doc. + **1.5.2.15/16** - Adding an account header on the lateral drawer. diff --git a/app/build.gradle b/app/build.gradle index 3c6490e..5dfb613 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -53,6 +53,11 @@ android { // tests testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + + buildConfigField "String", "MERCURY_KEY", mercuryApiKey + buildConfigField "String", "FEEDBACK_EMAIL", feedbackEmail + buildConfigField "String", "SOURCE_URL", sourceUrl + buildConfigField "String", "TRACKER_URL", trackerUrl } buildTypes { release { @@ -165,6 +170,7 @@ apply plugin: 'com.google.gms.google-services' afterEvaluate { initFabricPropertiesIfNeeded() initAppLoginPropertiesIfNeeded() + initAppForSecretPropertiesIfNeeded() } def initFabricPropertiesIfNeeded() { @@ -189,3 +195,16 @@ def initAppLoginPropertiesIfNeeded() { } } } + +def initAppForSecretPropertiesIfNeeded() { + def propertiesFile = file(System.getProperty("user.home") + '/.gradle/gradle.properties') + if (!propertiesFile.exists()) { + def commentMessage = "This is autogenerated local property from system environment to prevent key to be committed to source control." + ant.propertyfile(file: System.getProperty("user.home") + "/.gradle/gradle.properties", comment: commentMessage) { + entry(key: "mercuryApiKey", value: System.getProperty("mercuryApiKey")) + entry(key: "feedbackEmail", value: System.getProperty("feedbackEmail")) + entry(key: "sourceUrl", value: System.getProperty("sourceUrl")) + entry(key: "trackerUrl", value: System.getProperty("trackerUrl")) + } + } +} diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/MyApp.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/MyApp.kt index 8b882c3..f159ba2 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/MyApp.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/MyApp.kt @@ -49,7 +49,7 @@ class MyApp : MultiDexApplication() { private fun initAmplify() { Amplify.initSharedInstance(this) - .setFeedbackEmailAddress(getString(R.string.feedback_email)) + .setFeedbackEmailAddress(BuildConfig.FEEDBACK_EMAIL) .applyAllDefaultRules() } diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/ReaderActivity.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/ReaderActivity.kt index 59b62d4..c91c0b3 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/ReaderActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/ReaderActivity.kt @@ -51,7 +51,7 @@ class ReaderActivity : DragDismissActivity() { val title: TextView = v.findViewById(R.id.title) val content: HtmlTextView = v.findViewById(R.id.content) val url = intent.getStringExtra("url") - val parser = MercuryApi(getString(R.string.mercury)) + val parser = MercuryApi(BuildConfig.MERCURY_KEY) val browserBtn: ImageButton = v.findViewById(R.id.browserBtn) val shareBtn: ImageButton = v.findViewById(R.id.shareBtn) diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/settings/SettingsActivity.java b/app/src/main/java/apps/amine/bou/readerforselfoss/settings/SettingsActivity.java index 07df4d4..1712917 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/settings/SettingsActivity.java +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/settings/SettingsActivity.java @@ -27,6 +27,7 @@ import android.widget.Toast; import java.util.List; +import apps.amine.bou.readerforselfoss.BuildConfig; import apps.amine.bou.readerforselfoss.R; import apps.amine.bou.readerforselfoss.utils.Config; import com.ftinc.scoop.ui.ScoopSettingsActivity; @@ -242,7 +243,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity { findPreference( "trackerLink" ).setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { - openUrl(Uri.parse(getString(R.string.tracker_url))); + openUrl(Uri.parse(BuildConfig.TRACKER_URL)); return true; } }); @@ -250,7 +251,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity { findPreference("sourceLink").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { - openUrl(Uri.parse(getString(R.string.source_url))); + openUrl(Uri.parse(BuildConfig.SOURCE_URL)); return false; } }); diff --git a/secrets.tar.enc b/secrets.tar.enc deleted file mode 100644 index b3ca8b4..0000000 Binary files a/secrets.tar.enc and /dev/null differ