Updated on 2026-08-14

This commit is contained in:
Tangem 2024-02-06 17:39:50 +03:00
parent 946d60c1c6
commit 11ad540d12
14 changed files with 77 additions and 126 deletions

View file

@ -1,18 +0,0 @@
package com.tangem.datasource.di
import com.tangem.datasource.local.AppPreferenceStorage
import com.tangem.datasource.local.AppPreferenceStorageImpl
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
internal interface AppPreferenceStorageModule {
@Binds
@Singleton
fun bindAppPreferenceStorage(appPreferenceStorageImpl: AppPreferenceStorageImpl): AppPreferenceStorage
}

View file

@ -1,13 +0,0 @@
package com.tangem.datasource.local
/**
* Application local storage
*
[REDACTED_AUTHOR]
*/
@Deprecated(message = "Use AppPreferencesStore", level = DeprecationLevel.WARNING)
interface AppPreferenceStorage {
/** Json config with feature toggles 'ToggleName: String - Availability: Boolean' */
var featureToggles: String
}

View file

@ -1,24 +0,0 @@
package com.tangem.datasource.local
import android.content.Context
import dagger.hilt.android.qualifiers.ApplicationContext
import hu.autsoft.krate.SimpleKrate
import hu.autsoft.krate.default.withDefault
import hu.autsoft.krate.stringPref
import javax.inject.Inject
import javax.inject.Singleton
/**
* Implementation of application local storage
*
* @param context application context
*
[REDACTED_AUTHOR]
*/
@Singleton
internal class AppPreferenceStorageImpl @Inject constructor(
@ApplicationContext context: Context,
) : SimpleKrate(context = context), AppPreferenceStorage {
override var featureToggles: String by stringPref().withDefault("")
}

View file

@ -48,6 +48,8 @@ object PreferencesKeys {
val IS_WALLET_SWAP_PROMO_SHOW_KEY by lazy { booleanPreferencesKey(name = "isWalletSwapPromoShown") }
val IS_TOKEN_SWAP_PROMO_SHOW_KEY by lazy { booleanPreferencesKey(name = "isTokenSwapPromoShown") }
val FEATURE_TOGGLES_KEY by lazy { stringPreferencesKey(name = "featureToggles") }
}
/** Preferences keys set that should be migrated from "PreferencesDataSource" to a new DataStore<Preferences> */