From 6d24fd9336fbf9a9790a3f9c37d97599a1b301f7 Mon Sep 17 00:00:00 2001 From: Amine Bou Date: Wed, 23 May 2018 20:39:50 +0200 Subject: [PATCH] Removed every config string added at build time. --- .github/CONTRIBUTING.md | 10 +------ app/build.gradle | 26 ------------------- .../bou/readerforselfoss/HomeActivity.kt | 15 +++-------- .../apps/amine/bou/readerforselfoss/MyApp.kt | 2 +- .../fragments/ArticleFragment.kt | 3 ++- .../settings/SettingsActivity.java | 6 ++--- .../bou/readerforselfoss/utils/Config.kt | 8 ++++++ app/src/main/res/values/styles.xml | 7 ----- 8 files changed, 18 insertions(+), 59 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index a6003e3..b9549df 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -49,10 +49,6 @@ You'll have to: - Define some parameters either in `~/.gradle/gradle.properties` or as gradle parameters (see the examples) - - feedbackEmail: An email to receive users feedback. - - sourceUrl: an url to the source code, used in the settings. **It can be empty.** - - trackerUrl: an url to the tracker, used in the settings. **It can be empty.** - - githubToken: a github token used to report issues from within the app. [Details here](https://github.com/heinrichreimer/android-issue-reporter#how-to-create-a-bot-key). **It can be empty.** - appLoginUrl, appLoginUsername and appLoginPassword: url, username and password of a selfoss instance. **These are only used for tests. They can be empty if you don't test API calls.** ### Examples: @@ -62,14 +58,10 @@ You'll have to: appLoginUrl="URL" # It can be empty. appLoginUsername="LOGIN" # It can be empty. appLoginPassword="PASS" # It can be empty. -feedbackEmail="EMAIL" -sourceUrl="URLSOURCE" # It can be empty. -trackerUrl="URLTRACKER" # It can be empty. -githubToken="GITHUBTOKEN" # It can be empty or use https://github.com/heinrichreimer/android-issue-reporter#how-to-create-a-bot-key to generate one ``` #### As gradle parameters ``` -./gradlew .... -P appLoginUrl="URL" -P appLoginUsername="LOGIN" -P appLoginPassword="PASS" -P feedbackEmail="EMAIL" -P sourceUrl="URLSOURCE" -P trackerUrl="URLTRACKER" -P githubToken="GITHUBTOKEN" +./gradlew .... -P appLoginUrl="URL" -P appLoginUsername="LOGIN" -P appLoginPassword="PASS" ``` diff --git a/app/build.gradle b/app/build.gradle index 87043f1..f3aefce 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -61,12 +61,6 @@ android { // tests testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - - buildConfigField "String", "FEEDBACK_EMAIL", feedbackEmail - buildConfigField "String", "SOURCE_URL", sourceUrl - buildConfigField "String", "TRACKER_URL", trackerUrl - buildConfigField "String", "TRANSLATION_URL", translationUrl - buildConfigField "String", "GITHUB_TOKEN", githubToken } buildTypes { release { @@ -86,13 +80,11 @@ android { githubConfig { versionNameSuffix '-github' dimension "build" - buildConfigField "boolean", "GITHUB_VERSION", "true" } storeConfig { // As jenkins publishes to alpha first, this is the default suffix now. versionNameSuffix '-store' dimension "build" - buildConfigField "boolean", "GITHUB_VERSION", "false" } } } @@ -157,9 +149,6 @@ dependencies { implementation 'com.52inc:scoops:1.0.0' implementation'com.jrummyapps:colorpicker:2.1.7' - // Github issues reporter - implementation 'com.heinrichreimersoftware:android-issue-reporter:1.3.1' - implementation 'com.github.rubensousa:floatingtoolbar:1.5.1' // Pager @@ -177,7 +166,6 @@ dependencies { afterEvaluate { initAppLoginPropertiesIfNeeded() - initAppForSecretPropertiesIfNeeded() } def initAppLoginPropertiesIfNeeded() { @@ -191,17 +179,3 @@ 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: "feedbackEmail", value: System.getProperty("feedbackEmail")) - entry(key: "sourceUrl", value: System.getProperty("sourceUrl")) - entry(key: "trackerUrl", value: System.getProperty("trackerUrl")) - entry(key: "translationUrl", value: System.getProperty("translationUrl")) - entry(key: "githubToken", value: System.getProperty("githubToken")) - } - } -} diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt index ffb108a..4e7b7cf 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/HomeActivity.kt @@ -5,6 +5,7 @@ import android.content.Intent import android.content.SharedPreferences import android.graphics.Color import android.graphics.drawable.GradientDrawable +import android.net.Uri import android.os.Bundle import android.preference.PreferenceManager import android.support.v4.view.MenuItemCompat @@ -55,7 +56,6 @@ import com.ashokvarma.bottomnavigation.TextBadgeItem import com.ftinc.scoop.Scoop import com.github.stkent.amplify.tracking.Amplify import com.google.gson.reflect.TypeToken -import com.heinrichreimersoftware.androidissuereporter.IssueReporterLauncher import com.mikepenz.aboutlibraries.Libs import com.mikepenz.aboutlibraries.LibsBuilder import com.mikepenz.materialdrawer.Drawer @@ -432,17 +432,8 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener { icon = R.drawable.ic_bug_report iconTintingEnabled = true onClick { _ -> - IssueReporterLauncher.forTarget( - getString(R.string.report_github_user), - getString(R.string.report_github_repo) - ) - .theme(R.style.Theme_App_Light) - .guestToken(BuildConfig.GITHUB_TOKEN) - .minDescriptionLength(20) - .putExtraInfo("Unique ID", settings.getString("unique_id", "")) - .putExtraInfo("From github", BuildConfig.GITHUB_VERSION) - .homeAsUpEnabled(true) - .launch(this@HomeActivity) + val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(Config.trackerUrl)) + startActivity(browserIntent) false } } 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 6f1d3b6..c5ddfb7 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/MyApp.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/MyApp.kt @@ -76,7 +76,7 @@ class MyApp : MultiDexApplication() { private fun initAmplify() { Amplify.initSharedInstance(this) .setPositiveFeedbackCollectors(GooglePlayStoreFeedbackCollector()) - .setCriticalFeedbackCollectors(DefaultEmailFeedbackCollector(BuildConfig.FEEDBACK_EMAIL)) + .setCriticalFeedbackCollectors(DefaultEmailFeedbackCollector(Config.feedbackEmail)) .applyAllDefaultRules() } diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/fragments/ArticleFragment.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/fragments/ArticleFragment.kt index 293106b..7e71a76 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/fragments/ArticleFragment.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/fragments/ArticleFragment.kt @@ -26,6 +26,7 @@ import apps.amine.bou.readerforselfoss.api.mercury.MercuryApi import apps.amine.bou.readerforselfoss.api.mercury.ParsedContent import apps.amine.bou.readerforselfoss.api.selfoss.Item import apps.amine.bou.readerforselfoss.themes.AppColors +import apps.amine.bou.readerforselfoss.utils.Config import apps.amine.bou.readerforselfoss.utils.buildCustomTabsIntent import apps.amine.bou.readerforselfoss.utils.customtabs.CustomTabActivityHelper import apps.amine.bou.readerforselfoss.utils.isEmptyOrNullOrNullString @@ -305,7 +306,7 @@ class ArticleFragment : Fragment() { { dialog, _ -> // This won't be translated because it should only be temporary. - val to = BuildConfig.FEEDBACK_EMAIL + val to = Config.feedbackEmail val subject= "[ReaderForSelfoss MalformedURLException]" val body= "Please specify the source, item and spout you are using for the url below : \n ${e.message}" val mailTo = "mailto:" + to + "?&subject=" + Uri.encode(subject) + "&body=" + Uri.encode(body) 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 f6f222e..424f23c 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 @@ -306,7 +306,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity { findPreference("trackerLink").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { - openUrl(Uri.parse(BuildConfig.TRACKER_URL)); + openUrl(Uri.parse(Config.trackerUrl)); return true; } }); @@ -314,7 +314,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity { findPreference("sourceLink").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { - openUrl(Uri.parse(BuildConfig.SOURCE_URL)); + openUrl(Uri.parse(Config.sourceUrl)); return false; } }); @@ -322,7 +322,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity { findPreference("translation").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { - openUrl(Uri.parse(BuildConfig.TRANSLATION_URL)); + openUrl(Uri.parse(Config.translationUrl)); return false; } }); diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/utils/Config.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/utils/Config.kt index ae86b59..e5cb510 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/utils/Config.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/utils/Config.kt @@ -28,6 +28,14 @@ class Config(c: Context) { companion object { const val settingsName = "paramsselfoss" + const val feedbackEmail = "aminecmi@gmail.com" + + const val translationUrl = "https://crwd.in/readerforselfoss" + + const val sourceUrl = "https://github.com/aminecmi/ReaderforSelfoss" + + const val trackerUrl = "https://github.com/aminecmi/ReaderforSelfoss/issues" + fun logoutAndRedirect( c: Context, callingActivity: Activity, diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index e440c82..5f5ece7 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -43,11 +43,4 @@ @style/DrawerArrowStyle--> - -