Updated on 2026-08-14

This commit is contained in:
Tangem 2025-02-12 17:35:12 +05:00
parent 69754e4159
commit 34cfc843ab
31 changed files with 322 additions and 170 deletions

View file

@ -127,10 +127,7 @@ interface TangemTechApi {
suspend fun getHotCrypto(@Query("currency") currencyId: String): ApiResponse<HotCryptoResponse>
@GET("stories/{story_id}")
suspend fun getStoryById(
@Path("story_id") storyId: String,
@Query("language") language: String,
): ApiResponse<StoryContentResponse>
suspend fun getStoryById(@Path("story_id") storyId: String): ApiResponse<StoryContentResponse>
companion object {
val marketsQuoteFields = listOf(

View file

@ -119,7 +119,7 @@ object PreferencesKeys {
val WAS_LOG_FILE_CLEARED by lazy { booleanPreferencesKey(name = "wasLogFileCleared") }
val SHOULD_SHOW_SWAP_STORIES_KEY by lazy { booleanPreferencesKey("shouldShowSwapStories") }
fun getShouldShowStoriesKey(storyId: String) = booleanPreferencesKey("shouldShowStories_$storyId")
// region Permission
fun getShouldShowPermission(permission: String) = booleanPreferencesKey("shouldShowPushPermission_$permission")

View file

@ -2,6 +2,7 @@ package com.tangem.datasource.local.promo
import com.tangem.datasource.api.promotion.models.StoryContentResponse
import com.tangem.datasource.local.datastore.core.StringKeyDataStore
import kotlinx.coroutines.flow.Flow
internal class DefaultPromoStoriesStore(
private val dataStore: StringKeyDataStore<StoryContentResponse>,
@ -10,6 +11,10 @@ internal class DefaultPromoStoriesStore(
return dataStore.getSyncOrNull(storyId)
}
override fun get(storyId: String): Flow<StoryContentResponse?> {
return dataStore.get(storyId)
}
override suspend fun store(storyId: String, item: StoryContentResponse) {
dataStore.store(storyId, item)
}

View file

@ -1,9 +1,12 @@
package com.tangem.datasource.local.promo
import com.tangem.datasource.api.promotion.models.StoryContentResponse
import kotlinx.coroutines.flow.Flow
interface PromoStoriesStore {
suspend fun getSyncOrNull(storyId: String): StoryContentResponse?
fun get(storyId: String): Flow<StoryContentResponse?>
suspend fun store(storyId: String, item: StoryContentResponse)
}