Updated on 2026-08-14
This commit is contained in:
parent
8b75e37e30
commit
a9bca131c3
386 changed files with 1369 additions and 1347 deletions
|
|
@ -13,7 +13,7 @@ import com.tangem.domain.core.utils.catchOn
|
|||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.quotes.multi.MultiQuoteStatusFetcher
|
||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||
import timber.log.Timber
|
||||
import com.tangem.utils.logging.TangemLogger
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ internal class DefaultMultiQuoteStatusFetcher @Inject constructor(
|
|||
|
||||
override suspend fun invoke(params: MultiQuoteStatusFetcher.Params) = Either.catchOn(dispatchers.default) {
|
||||
if (params.currenciesIds.isEmpty()) {
|
||||
Timber.d("No currencies to fetch quotes for")
|
||||
TangemLogger.d("No currencies to fetch quotes for")
|
||||
return@catchOn
|
||||
}
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ internal class DefaultMultiQuoteStatusFetcher @Inject constructor(
|
|||
quotesStatusesStore.store(values = updatedResponse.quotes)
|
||||
}
|
||||
.onLeft { throwable ->
|
||||
Timber.e(throwable)
|
||||
TangemLogger.e("Error", throwable)
|
||||
quotesStatusesStore.setSourceAsOnlyCache(currenciesIds = params.currenciesIds)
|
||||
}
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ internal class DefaultMultiQuoteStatusFetcher @Inject constructor(
|
|||
|
||||
if (appCurrencyId.isNullOrBlank()) {
|
||||
val exception = IllegalStateException("Unable to get AppCurrency for updating quotes")
|
||||
Timber.e(exception)
|
||||
TangemLogger.e("Error", exception)
|
||||
|
||||
throw exception
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,17 +4,17 @@ import androidx.annotation.VisibleForTesting
|
|||
import arrow.core.left
|
||||
import com.tangem.data.quotes.store.QuotesStatusesStore
|
||||
import com.tangem.datasource.appcurrency.AppCurrencyResponseStore
|
||||
import com.tangem.utils.coroutines.AppCoroutineScope
|
||||
import com.tangem.domain.core.utils.EitherFlow
|
||||
import com.tangem.domain.models.quote.QuoteStatus
|
||||
import com.tangem.domain.quotes.multi.MultiQuoteStatusFetcher
|
||||
import com.tangem.domain.quotes.multi.MultiQuoteUpdater
|
||||
import com.tangem.utils.coroutines.AppCoroutineScope
|
||||
import com.tangem.utils.coroutines.JobHolder
|
||||
import com.tangem.utils.coroutines.saveIn
|
||||
import com.tangem.utils.logging.TangemLogger
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.*
|
||||
import timber.log.Timber
|
||||
|
||||
/**
|
||||
* Default implementation of [MultiQuoteUpdater] which updates quotes when the app currency changes
|
||||
|
|
@ -36,14 +36,14 @@ internal class DefaultMultiQuoteUpdater(
|
|||
private val updaterHolder = JobHolder()
|
||||
|
||||
override fun subscribe() {
|
||||
Timber.d("Subscribe on quotes updates")
|
||||
TangemLogger.d("Subscribe on quotes updates")
|
||||
getMultiQuoteUpdates()
|
||||
.launchIn(coroutineScope)
|
||||
.saveIn(updaterHolder)
|
||||
}
|
||||
|
||||
override fun unsubscribe() {
|
||||
Timber.e("Unsubscribe from quotes updates")
|
||||
TangemLogger.i("Unsubscribe from quotes updates")
|
||||
updaterHolder.cancel()
|
||||
}
|
||||
|
||||
|
|
@ -63,10 +63,10 @@ internal class DefaultMultiQuoteUpdater(
|
|||
appCurrencyId = appCurrency.id,
|
||||
),
|
||||
)
|
||||
.onLeft(Timber::e)
|
||||
.onLeft { TangemLogger.e("Error", it) }
|
||||
}
|
||||
.retryWhen { cause, _ ->
|
||||
Timber.e("Retry updating quotes: $cause")
|
||||
TangemLogger.e("Retry updating quotes: $cause")
|
||||
|
||||
emit(cause.left())
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import com.tangem.data.quotes.store.QuotesStatusesStore
|
|||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.models.quote.QuoteStatus
|
||||
import com.tangem.domain.quotes.QuotesRepository
|
||||
import timber.log.Timber
|
||||
import com.tangem.utils.logging.TangemLogger
|
||||
|
||||
/**
|
||||
* Default implementation of [QuotesRepository]
|
||||
|
|
@ -19,7 +19,7 @@ internal class DefaultQuotesRepository(
|
|||
|
||||
override suspend fun getMultiQuoteSyncOrNull(currenciesIds: Set<CryptoCurrency.RawID>): Set<QuoteStatus> {
|
||||
if (currenciesIds.isEmpty()) {
|
||||
Timber.e("currenciesIds are empty")
|
||||
TangemLogger.e("currenciesIds are empty")
|
||||
return emptySet()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,16 +4,16 @@ import androidx.datastore.core.DataStore
|
|||
import com.tangem.data.quotes.converter.QuoteStatusConverter
|
||||
import com.tangem.datasource.api.tangemTech.models.QuotesResponse
|
||||
import com.tangem.datasource.local.datastore.RuntimeSharedStore
|
||||
import com.tangem.utils.coroutines.AppCoroutineScope
|
||||
import com.tangem.domain.models.StatusSource
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.models.quote.QuoteStatus
|
||||
import com.tangem.utils.coroutines.AppCoroutineScope
|
||||
import com.tangem.utils.extensions.addOrReplace
|
||||
import com.tangem.utils.logging.TangemLogger
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.firstOrNull
|
||||
import kotlinx.coroutines.launch
|
||||
import timber.log.Timber
|
||||
|
||||
internal typealias CurrencyIdWithQuote = Map<String, QuotesResponse.Quote>
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ internal class DefaultQuotesStatusesStore(
|
|||
ifNotFound: (CryptoCurrency.RawID) -> QuoteStatus?,
|
||||
) {
|
||||
if (currenciesIds.isEmpty()) {
|
||||
Timber.d("Nothing to update: currencies ids are empty")
|
||||
TangemLogger.d("Nothing to update: currencies ids are empty")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue