Removed direct call to mercury api.

This commit is contained in:
Amine Bou 2018-05-23 20:00:46 +02:00
parent e995286068
commit a3a7b78c96
5 changed files with 7 additions and 11 deletions

View File

@ -49,7 +49,6 @@ You'll have to:
- Define some parameters either in `~/.gradle/gradle.properties` or as gradle parameters (see the examples)
- 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. **It can be empty.**
- trackerUrl: an url to the tracker, used in the settings. **It can be empty.**
@ -63,7 +62,6 @@ You'll have to:
appLoginUrl="URL" # It can be empty.
appLoginUsername="LOGIN" # It can be empty.
appLoginPassword="PASS" # It can be empty.
mercuryApiKey="LONGAPIKEY"
feedbackEmail="EMAIL"
sourceUrl="URLSOURCE" # It can be empty.
trackerUrl="URLTRACKER" # It can be empty.
@ -73,5 +71,5 @@ githubToken="GITHUBTOKEN" # It can be empty or use https://github.com/heinrichre
#### 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" -P githubToken="GITHUBTOKEN"
./gradlew .... -P appLoginUrl="URL" -P appLoginUsername="LOGIN" -P appLoginPassword="PASS" -P feedbackEmail="EMAIL" -P sourceUrl="URLSOURCE" -P trackerUrl="URLTRACKER" -P githubToken="GITHUBTOKEN"
```

View File

@ -62,7 +62,6 @@ 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
@ -172,6 +171,7 @@ dependencies {
implementation "ch.acra:acra-http:5.1.3"
implementation "ch.acra:acra-dialog:5.1.3"
}
@ -197,7 +197,6 @@ def initAppForSecretPropertiesIfNeeded() {
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"))

View File

@ -7,7 +7,7 @@ import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
class MercuryApi(private val key: String, shouldLog: Boolean) {
class MercuryApi(shouldLog: Boolean) {
private val service: MercuryService
init {
@ -26,7 +26,7 @@ class MercuryApi(private val key: String, shouldLog: Boolean) {
val retrofit =
Retrofit
.Builder()
.baseUrl("https://mercury.postlight.com")
.baseUrl("https://www.amine-bou.fr")
.client(client)
.addConverterFactory(GsonConverterFactory.create(gson))
.build()
@ -34,6 +34,6 @@ class MercuryApi(private val key: String, shouldLog: Boolean) {
}
fun parseUrl(url: String): Call<ParsedContent> {
return service.parseUrl(url, this.key)
return service.parseUrl(url)
}
}

View File

@ -6,6 +6,6 @@ import retrofit2.http.Header
import retrofit2.http.Query
interface MercuryService {
@GET("parser")
fun parseUrl(@Query("url") url: String, @Header("x-api-key") key: String): Call<ParsedContent>
@GET("parser.php")
fun parseUrl(@Query("link") link: String): Call<ParsedContent>
}

View File

@ -180,7 +180,6 @@ class ArticleFragment : Fragment() {
) {
rootView.progressBar.visibility = View.VISIBLE
val parser = MercuryApi(
BuildConfig.MERCURY_KEY,
prefs.getBoolean("should_log_everything", false)
)