Skip to content

Commit

Permalink
Make small fixes
Browse files Browse the repository at this point in the history
- Fix sync error on Loading Market News
- Fix Metrics icons
- Fix ETF icons
  • Loading branch information
rafaelekol committed May 30, 2024
1 parent f49d03f commit b51d586
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ fun EtfPage(
DescriptionCard(
title,
description,
ImageSource.Remote("https://cdn.blocksdecoded.com/category-icons/lending@3x.png")
ImageSource.Remote("https://cdn.blocksdecoded.com/header-images/ETF_bitcoin@3x.png")
)
}
item {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class EtfViewModel(

private fun etfViewItem(etf: Etf, timeDuration: TimeDuration) = EtfViewItem(
title = etf.ticker,
iconUrl = "https://cdn.blocksdecoded.com/header-images/${etf.ticker.lowercase()}@3x.png",
iconUrl = "https://cdn.blocksdecoded.com/etf-tresuries/${etf.ticker}@3x.png",
subtitle = etf.name,
value = etf.totalAssets?.let {
App.numberFormatter.formatFiatShort(it, currencyManager.baseCurrency.symbol, 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,16 @@ class MetricsPageViewModel(
else -> throw Exception("MetricsType not supported")
}

private val icon = when(metricsType) {
MetricsType.Volume24h -> "total_volume"
MetricsType.TotalMarketCap -> "total_mcap"
else -> throw Exception("MetricsType not supported")
}

private val header = MarketModule.Header(
title = Translator.getString(title),
description = Translator.getString(description),
icon = ImageSource.Remote("https://cdn.blocksdecoded.com/header-images/total_volume@3x.png")
icon = ImageSource.Remote("https://cdn.blocksdecoded.com/header-images/$icon@3x.png")
)

override fun createState(): MetricsPageModule.UiState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,19 @@ class MarketPostService(
private val backgroundManager: BackgroundManager,
) : BackgroundManager.Listener {
private val coroutineScope = CoroutineScope(Dispatchers.Default)
private var xxxJob: Job? = null
private var job: Job? = null

private val stateSubject = BehaviorSubject.create<DataState<List<Post>>>()
val stateObservable: Observable<DataState<List<Post>>>
get() = stateSubject

init {
backgroundManager.registerListener(this)
fetchPosts()
}

private fun fetchPosts() {
xxxJob?.cancel()
xxxJob = coroutineScope.launch {
job?.cancel()
job = coroutineScope.launch {
try {
val posts = marketKit.postsSingle().await()
stateSubject.onNext(DataState.Success(posts))
Expand Down

0 comments on commit b51d586

Please sign in to comment.