Updated on 2026-08-14

This commit is contained in:
Tangem 2026-07-09 18:02:52 +05:00
parent 7832fae9f3
commit e2026ec410
5 changed files with 527 additions and 30 deletions

View file

@ -121,8 +121,8 @@ internal class DefaultNFTRuntimeStore(
},
)
}
val assetsCount = when (assets) {
is NFTCollection.Assets.Value -> assets.items.size
val assetsCount = when {
assets is NFTCollection.Assets.Value && assets.items.isNotEmpty() -> assets.items.size
else -> data.count
}
data.copy(

View file

@ -3,6 +3,7 @@ package com.tangem.datasource.local.nft
import android.content.Context
import androidx.datastore.core.DataStore
import androidx.datastore.core.DataStoreFactory
import androidx.datastore.core.handlers.ReplaceFileCorruptionHandler
import androidx.datastore.dataStoreFile
import com.squareup.moshi.Moshi
import com.tangem.blockchain.nft.models.NFTCollection
@ -58,6 +59,7 @@ class NFTPersistenceStoreFactory @Inject constructor(
types = types,
defaultValue = defaultValue,
),
corruptionHandler = ReplaceFileCorruptionHandler { defaultValue },
produceFile = { context.dataStoreFile(fileName = fileName) },
scope = appScope,
)