Removed every config string added at build time.

This commit is contained in:
Amine Bou 2018-05-23 20:39:50 +02:00
parent a3a7b78c96
commit 6d24fd9336
8 changed files with 18 additions and 59 deletions

View File

@ -49,10 +49,6 @@ You'll have to:
- Define some parameters either in `~/.gradle/gradle.properties` or as gradle parameters (see the examples) - 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.** - 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: ### Examples:
@ -62,14 +58,10 @@ You'll have to:
appLoginUrl="URL" # It can be empty. appLoginUrl="URL" # It can be empty.
appLoginUsername="LOGIN" # It can be empty. appLoginUsername="LOGIN" # It can be empty.
appLoginPassword="PASS" # 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 #### 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"
``` ```

View File

@ -61,12 +61,6 @@ android {
// tests // tests
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 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 { buildTypes {
release { release {
@ -86,13 +80,11 @@ android {
githubConfig { githubConfig {
versionNameSuffix '-github' versionNameSuffix '-github'
dimension "build" dimension "build"
buildConfigField "boolean", "GITHUB_VERSION", "true"
} }
storeConfig { storeConfig {
// As jenkins publishes to alpha first, this is the default suffix now. // As jenkins publishes to alpha first, this is the default suffix now.
versionNameSuffix '-store' versionNameSuffix '-store'
dimension "build" dimension "build"
buildConfigField "boolean", "GITHUB_VERSION", "false"
} }
} }
} }
@ -157,9 +149,6 @@ dependencies {
implementation 'com.52inc:scoops:1.0.0' implementation 'com.52inc:scoops:1.0.0'
implementation'com.jrummyapps:colorpicker:2.1.7' 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' implementation 'com.github.rubensousa:floatingtoolbar:1.5.1'
// Pager // Pager
@ -177,7 +166,6 @@ dependencies {
afterEvaluate { afterEvaluate {
initAppLoginPropertiesIfNeeded() initAppLoginPropertiesIfNeeded()
initAppForSecretPropertiesIfNeeded()
} }
def initAppLoginPropertiesIfNeeded() { 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"))
}
}
}

View File

@ -5,6 +5,7 @@ import android.content.Intent
import android.content.SharedPreferences import android.content.SharedPreferences
import android.graphics.Color import android.graphics.Color
import android.graphics.drawable.GradientDrawable import android.graphics.drawable.GradientDrawable
import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.preference.PreferenceManager import android.preference.PreferenceManager
import android.support.v4.view.MenuItemCompat import android.support.v4.view.MenuItemCompat
@ -55,7 +56,6 @@ import com.ashokvarma.bottomnavigation.TextBadgeItem
import com.ftinc.scoop.Scoop import com.ftinc.scoop.Scoop
import com.github.stkent.amplify.tracking.Amplify import com.github.stkent.amplify.tracking.Amplify
import com.google.gson.reflect.TypeToken import com.google.gson.reflect.TypeToken
import com.heinrichreimersoftware.androidissuereporter.IssueReporterLauncher
import com.mikepenz.aboutlibraries.Libs import com.mikepenz.aboutlibraries.Libs
import com.mikepenz.aboutlibraries.LibsBuilder import com.mikepenz.aboutlibraries.LibsBuilder
import com.mikepenz.materialdrawer.Drawer import com.mikepenz.materialdrawer.Drawer
@ -432,17 +432,8 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
icon = R.drawable.ic_bug_report icon = R.drawable.ic_bug_report
iconTintingEnabled = true iconTintingEnabled = true
onClick { _ -> onClick { _ ->
IssueReporterLauncher.forTarget( val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(Config.trackerUrl))
getString(R.string.report_github_user), startActivity(browserIntent)
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)
false false
} }
} }

View File

@ -76,7 +76,7 @@ class MyApp : MultiDexApplication() {
private fun initAmplify() { private fun initAmplify() {
Amplify.initSharedInstance(this) Amplify.initSharedInstance(this)
.setPositiveFeedbackCollectors(GooglePlayStoreFeedbackCollector()) .setPositiveFeedbackCollectors(GooglePlayStoreFeedbackCollector())
.setCriticalFeedbackCollectors(DefaultEmailFeedbackCollector(BuildConfig.FEEDBACK_EMAIL)) .setCriticalFeedbackCollectors(DefaultEmailFeedbackCollector(Config.feedbackEmail))
.applyAllDefaultRules() .applyAllDefaultRules()
} }

View File

@ -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.mercury.ParsedContent
import apps.amine.bou.readerforselfoss.api.selfoss.Item import apps.amine.bou.readerforselfoss.api.selfoss.Item
import apps.amine.bou.readerforselfoss.themes.AppColors 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.buildCustomTabsIntent
import apps.amine.bou.readerforselfoss.utils.customtabs.CustomTabActivityHelper import apps.amine.bou.readerforselfoss.utils.customtabs.CustomTabActivityHelper
import apps.amine.bou.readerforselfoss.utils.isEmptyOrNullOrNullString import apps.amine.bou.readerforselfoss.utils.isEmptyOrNullOrNullString
@ -305,7 +306,7 @@ class ArticleFragment : Fragment() {
{ dialog, _ -> { dialog, _ ->
// This won't be translated because it should only be temporary. // 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 subject= "[ReaderForSelfoss MalformedURLException]"
val body= "Please specify the source, item and spout you are using for the url below : \n ${e.message}" 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) val mailTo = "mailto:" + to + "?&subject=" + Uri.encode(subject) + "&body=" + Uri.encode(body)

View File

@ -306,7 +306,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
findPreference("trackerLink").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { findPreference("trackerLink").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
openUrl(Uri.parse(BuildConfig.TRACKER_URL)); openUrl(Uri.parse(Config.trackerUrl));
return true; return true;
} }
}); });
@ -314,7 +314,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
findPreference("sourceLink").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { findPreference("sourceLink").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
openUrl(Uri.parse(BuildConfig.SOURCE_URL)); openUrl(Uri.parse(Config.sourceUrl));
return false; return false;
} }
}); });
@ -322,7 +322,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
findPreference("translation").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { findPreference("translation").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
openUrl(Uri.parse(BuildConfig.TRANSLATION_URL)); openUrl(Uri.parse(Config.translationUrl));
return false; return false;
} }
}); });

View File

@ -28,6 +28,14 @@ class Config(c: Context) {
companion object { companion object {
const val settingsName = "paramsselfoss" 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( fun logoutAndRedirect(
c: Context, c: Context,
callingActivity: Activity, callingActivity: Activity,

View File

@ -43,11 +43,4 @@
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>--> <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>-->
</style> </style>
<style name="Theme.App.Light" parent="Theme.IssueReporter.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:textColorPrimary">@color/md_grey_900</item>
</style>
</resources> </resources>