|
|
|
|
@ -2,7 +2,6 @@ package net.pokeranalytics.android.api |
|
|
|
|
|
|
|
|
|
import android.content.Context |
|
|
|
|
import com.android.volley.Request |
|
|
|
|
import com.android.volley.Response |
|
|
|
|
import com.android.volley.toolbox.StringRequest |
|
|
|
|
import com.android.volley.toolbox.Volley |
|
|
|
|
import kotlinx.serialization.json.Json |
|
|
|
|
@ -16,14 +15,14 @@ class FreeConverterApi { |
|
|
|
|
fun currencyRate(pair: String, context: Context, callback: (Double) -> (Unit)) { |
|
|
|
|
|
|
|
|
|
val queue = Volley.newRequestQueue(context) |
|
|
|
|
val url = "https://free.currconv.com/api/v7/convert?q=${pair}&compact=ultra&apiKey=5ba8d38995282fe8b1c8" |
|
|
|
|
val url = "https://free.currconv.com/api/v7/convert?q=${pair}&compact=ultra&apiKey=9b56e742a75392c8aeb7" |
|
|
|
|
|
|
|
|
|
// https://free.currconv.com/api/v7/convert?q=GBP_USD&compact=ultra&apiKey=5ba8d38995282fe8b1c8 |
|
|
|
|
// { "USD_PHP": 44.1105, "PHP_USD": 0.0227 } |
|
|
|
|
|
|
|
|
|
val stringRequest = StringRequest( |
|
|
|
|
Request.Method.GET, url, |
|
|
|
|
Response.Listener { response -> |
|
|
|
|
{ response -> |
|
|
|
|
|
|
|
|
|
val json = Json(JsonConfiguration.Stable) |
|
|
|
|
val f = json.parseJson(response) |
|
|
|
|
@ -34,7 +33,7 @@ class FreeConverterApi { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
Response.ErrorListener { |
|
|
|
|
{ |
|
|
|
|
Timber.d("Api call failed: ${it.message}") |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|