Updated on 2026-08-14
This commit is contained in:
parent
d3f3e86fa3
commit
c118781f5a
30 changed files with 561 additions and 6 deletions
|
|
@ -0,0 +1,18 @@
|
|||
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
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.tangem.datasource.local
|
||||
|
||||
/**
|
||||
* Application local storage
|
||||
*
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
interface AppPreferenceStorage {
|
||||
|
||||
/** Json config with feature toggles 'ToggleName: String - Availability: Boolean' */
|
||||
var featureToggles: String
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
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("")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue