Skip to content

Commit fc86132

Browse files
committed
removed CryptoCurrency enum
1 parent fd868e7 commit fc86132

3 files changed

Lines changed: 5 additions & 12 deletions

File tree

app/src/main/java/com/artem/lendingwidget/LendingWidgetConfigureActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class LendingWidgetConfigureActivity : AppCompatActivity() {
118118
if (url.isBlank()) {
119119
return
120120
}
121-
if (url.startsWith("http://")) {
121+
if (url.toLowerCase().startsWith("http://")) {
122122
url = url.substring(7)
123123
}
124124
this.storeUrl("${url}", mAppWidgetId)

app/src/main/java/com/artem/lendingwidget/data/Botlog.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,13 @@ data class Botlog(val last_status: String,
77
val last_update: Date,
88
val log : Array<String>,
99
val outputCurrency: CurrencyEntry,
10-
val raw_data: Map<CryptoCurrency, Data>) {
10+
val raw_data: Map<String, Data>) {
1111

12-
data class CurrencyEntry(val currency: CryptoCurrency,
12+
data class CurrencyEntry(val currency: String,
1313
val highestBid: Float)
1414

1515
data class Data(val averageLendingRate: Float,
1616
val lentSum: Float,
1717
val maxToLend: Float)
1818

19-
}
20-
21-
enum class CryptoCurrency {
22-
// TODO add more currencies
23-
BTC,
24-
ETH
2519
}

app/src/main/java/com/artem/lendingwidget/extensions/BotlogStoreExtensions.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package com.artem.lendingwidget.extensions
33
import android.content.Context
44
import com.artem.lendingwidget.data.Botlog
55
import com.artem.lendingwidget.data.CoinDeskRate
6-
import com.artem.lendingwidget.data.CryptoCurrency
76
import com.artem.lendingwidget.data.Currency
87
import com.github.salomonbrys.kotson.fromJson
98
import com.google.gson.Gson
@@ -66,8 +65,8 @@ fun Context.getBotlog(widgetId: Int): Botlog? {
6665
}
6766
}
6867

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

7372
fun Context.getCurrency(widgetId: Int): Currency {

0 commit comments

Comments
 (0)