|
|
|
|
@ -6,13 +6,17 @@ import java.util.* |
|
|
|
|
|
|
|
|
|
class Preferences { |
|
|
|
|
|
|
|
|
|
private val ONCE_PREFIX = "singleExecution_" |
|
|
|
|
|
|
|
|
|
enum class Keys(var identifier: String) { |
|
|
|
|
CURRENCY_CODE("CurrencyCode"), |
|
|
|
|
LOCALE_CODE("LocaleCode"), |
|
|
|
|
FIRST_LAUNCH("firstLaunch"), |
|
|
|
|
STOP_SHOWING_DISCLAIMER("stopShowingDisclaimer"), |
|
|
|
|
ACTIVE_FILTER_ID("ActiveFilterId"), |
|
|
|
|
LATEST_PURCHASE("latestPurchase") |
|
|
|
|
LATEST_PURCHASE("latestPurchase"), |
|
|
|
|
PATCH_BREAK("patchBreaks"), |
|
|
|
|
PATCH_TRANSACTION_TYPES_NAMES("patchTransactionTypesNames") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
companion object { |
|
|
|
|
@ -99,6 +103,13 @@ class Preferences { |
|
|
|
|
return !getBoolean(Keys.STOP_SHOWING_DISCLAIMER, context) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun executeOnce(key: Keys, context: Context, executable: () -> Unit) { |
|
|
|
|
if (!getBoolean(key, context)) { |
|
|
|
|
executable.invoke() |
|
|
|
|
setBoolean(key, true, context) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|