Skip to content

Commit

Permalink
removed CryptoCurrency enum
Browse files Browse the repository at this point in the history
  • Loading branch information
artemperl committed Jun 5, 2017
1 parent fd868e7 commit fc86132
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class LendingWidgetConfigureActivity : AppCompatActivity() {
if (url.isBlank()) {
return
}
if (url.startsWith("http://")) {
if (url.toLowerCase().startsWith("http://")) {
url = url.substring(7)
}
this.storeUrl("${url}", mAppWidgetId)
Expand Down
10 changes: 2 additions & 8 deletions app/src/main/java/com/artem/lendingwidget/data/Botlog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,13 @@ data class Botlog(val last_status: String,
val last_update: Date,
val log : Array<String>,
val outputCurrency: CurrencyEntry,
val raw_data: Map<CryptoCurrency, Data>) {
val raw_data: Map<String, Data>) {

data class CurrencyEntry(val currency: CryptoCurrency,
data class CurrencyEntry(val currency: String,
val highestBid: Float)

data class Data(val averageLendingRate: Float,
val lentSum: Float,
val maxToLend: Float)

}

enum class CryptoCurrency {
// TODO add more currencies
BTC,
ETH
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.artem.lendingwidget.extensions
import android.content.Context
import com.artem.lendingwidget.data.Botlog
import com.artem.lendingwidget.data.CoinDeskRate
import com.artem.lendingwidget.data.CryptoCurrency
import com.artem.lendingwidget.data.Currency
import com.github.salomonbrys.kotson.fromJson
import com.google.gson.Gson
Expand Down Expand Up @@ -66,8 +65,8 @@ fun Context.getBotlog(widgetId: Int): Botlog? {
}
}

fun Context.getCryptoCurrency(widgetId: Int): CryptoCurrency {
return CryptoCurrency.valueOf(this.getSharedPreferences(PREFS_NAME, 0).getString(PREF_CRYPTO_CURRENCY + widgetId, "BTC"))
fun Context.getCryptoCurrency(widgetId: Int): String {
return this.getSharedPreferences(PREFS_NAME, 0).getString(PREF_CRYPTO_CURRENCY + widgetId, "BTC")
}

fun Context.getCurrency(widgetId: Int): Currency {
Expand Down

0 comments on commit fc86132

Please # to comment.