Updated on 2026-08-14
This commit is contained in:
parent
26f476bcd0
commit
7913e52216
12 changed files with 181 additions and 1430 deletions
|
|
@ -0,0 +1,25 @@
|
|||
package com.tangem.tap.persistence
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import androidx.core.content.edit
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
class DisclaimerPrefStorage(
|
||||
private val preferences: SharedPreferences,
|
||||
) {
|
||||
|
||||
var hasTangemTosAccepted: Boolean
|
||||
get() = preferences.getBoolean(KEY_TANGEM_TOS, false)
|
||||
set(value) = preferences.edit { putBoolean(KEY_TANGEM_TOS, value) }
|
||||
|
||||
var hasSaltPayTosAccepted: Boolean
|
||||
get() = preferences.getBoolean(KEY_SALT_PAY_TOS, false)
|
||||
set(value) = preferences.edit { putBoolean(KEY_SALT_PAY_TOS, value) }
|
||||
|
||||
companion object {
|
||||
private const val KEY_TANGEM_TOS = "tangem_tos_accepted"
|
||||
private const val KEY_SALT_PAY_TOS = "saltPay_tos_accepted"
|
||||
}
|
||||
}
|
||||
|
|
@ -7,15 +7,16 @@ import androidx.core.content.edit
|
|||
import com.tangem.common.json.MoshiJsonConverter
|
||||
import java.util.*
|
||||
|
||||
|
||||
class PreferencesStorage(applicationContext: Application) {
|
||||
|
||||
private val preferences: SharedPreferences = applicationContext.getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE)
|
||||
private val preferences: SharedPreferences =
|
||||
applicationContext.getSharedPreferences(PREFERENCES_NAME, Context.MODE_PRIVATE)
|
||||
|
||||
val appRatingLaunchObserver: AppRatingLaunchObserver
|
||||
val usedCardsPrefStorage: UsedCardsPrefStorage
|
||||
val fiatCurrenciesPrefStorage: FiatCurrenciesPrefStorage
|
||||
val saltPayActivationStorage: SaltPayActivationStorage
|
||||
val disclaimerPrefStorage: DisclaimerPrefStorage
|
||||
|
||||
init {
|
||||
incrementLaunchCounter()
|
||||
|
|
@ -25,6 +26,7 @@ class PreferencesStorage(applicationContext: Application) {
|
|||
fiatCurrenciesPrefStorage = FiatCurrenciesPrefStorage(preferences, MoshiJsonConverter.INSTANCE)
|
||||
fiatCurrenciesPrefStorage.migrate()
|
||||
saltPayActivationStorage = SaltPayActivationPrefStorage(applicationContext, MoshiJsonConverter.INSTANCE)
|
||||
disclaimerPrefStorage = DisclaimerPrefStorage(preferences)
|
||||
}
|
||||
|
||||
var chatFirstLaunchTime: Long?
|
||||
|
|
@ -38,14 +40,6 @@ class PreferencesStorage(applicationContext: Application) {
|
|||
return usedCardsPrefStorage.wasScanned(cardId)
|
||||
}
|
||||
|
||||
fun saveDisclaimerAccepted() {
|
||||
preferences.edit { putBoolean(DISCLAIMER_ACCEPTED_KEY, true) }
|
||||
}
|
||||
|
||||
fun wasDisclaimerAccepted(): Boolean {
|
||||
return preferences.getBoolean(DISCLAIMER_ACCEPTED_KEY, false)
|
||||
}
|
||||
|
||||
fun saveTwinsOnboardingShown() {
|
||||
preferences.edit { putBoolean(TWINS_ONBOARDING_SHOWN_KEY, true) }
|
||||
}
|
||||
|
|
@ -61,12 +55,10 @@ class PreferencesStorage(applicationContext: Application) {
|
|||
|
||||
companion object {
|
||||
private const val PREFERENCES_NAME = "tapPrefs"
|
||||
private const val DISCLAIMER_ACCEPTED_KEY = "disclaimerAccepted"
|
||||
private const val TWINS_ONBOARDING_SHOWN_KEY = "twinsOnboardingShown"
|
||||
private const val APP_LAUNCH_COUNT_KEY = "launchCount"
|
||||
private const val CHAT_FIRST_LAUNCH_KEY = "chatFirstLaunchKey"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class AppRatingLaunchObserver(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue