|
|
|
@ -30,6 +30,7 @@ class Preferences { |
|
|
|
PATCH_SESSION_SETS("patchSessionSet"), |
|
|
|
PATCH_SESSION_SETS("patchSessionSet"), |
|
|
|
PATCH_TRANSACTION_TYPES_NAMES("patchTransactionTypesNames"), |
|
|
|
PATCH_TRANSACTION_TYPES_NAMES("patchTransactionTypesNames"), |
|
|
|
PATCH_BLINDS_FORMAT("patchBlindFormat"), |
|
|
|
PATCH_BLINDS_FORMAT("patchBlindFormat"), |
|
|
|
|
|
|
|
SHOW_STOP_NOTIFICATIONS("showStopNotifications"), |
|
|
|
ADD_NEW_TRANSACTION_TYPES("addNewTransactionTypes") |
|
|
|
ADD_NEW_TRANSACTION_TYPES("addNewTransactionTypes") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -90,13 +91,6 @@ class Preferences { |
|
|
|
editor.apply() |
|
|
|
editor.apply() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// private fun removeKey(key: Keys, context: Context) { |
|
|
|
|
|
|
|
// val preferences = PreferenceManager.getDefaultSharedPreferences(context) |
|
|
|
|
|
|
|
// val editor = preferences.edit() |
|
|
|
|
|
|
|
// editor.remove(key.identifier) |
|
|
|
|
|
|
|
// editor.apply() |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun getString(key: Keys, context: Context): String? { |
|
|
|
fun getString(key: Keys, context: Context): String? { |
|
|
|
val preferences = PreferenceManager.getDefaultSharedPreferences(context) |
|
|
|
val preferences = PreferenceManager.getDefaultSharedPreferences(context) |
|
|
|
return preferences.getString(key.identifier, null) |
|
|
|
return preferences.getString(key.identifier, null) |
|
|
|
@ -131,10 +125,6 @@ class Preferences { |
|
|
|
return getString(Keys.ACTIVE_FILTER_ID, context) |
|
|
|
return getString(Keys.ACTIVE_FILTER_ID, context) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// fun removeActiveFilterId(context: Context) { |
|
|
|
|
|
|
|
// removeKey(Keys.ACTIVE_FILTER_ID, context) |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun getCurrencyCode(context: Context): String? { |
|
|
|
private fun getCurrencyCode(context: Context): String? { |
|
|
|
return getString(Keys.CURRENCY_CODE, context) |
|
|
|
return getString(Keys.CURRENCY_CODE, context) |
|
|
|
} |
|
|
|
} |
|
|
|
@ -157,12 +147,19 @@ class Preferences { |
|
|
|
return null |
|
|
|
return null |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun setShowStopNotifications(show: Boolean, context: Context) { |
|
|
|
|
|
|
|
setBoolean(Keys.SHOW_STOP_NOTIFICATIONS, show, context) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun showStopNotifications(context: Context): Boolean { |
|
|
|
|
|
|
|
return getBoolean(Keys.SHOW_STOP_NOTIFICATIONS, context, true) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun setStopShowingMessage(message: FeedMessage, context: Context) { |
|
|
|
fun setStopShowingMessage(message: FeedMessage, context: Context) { |
|
|
|
setBoolean(message.key, true, context) |
|
|
|
setBoolean(message.key, true, context) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun feedMessageToShow(context: Context): FeedMessage? { |
|
|
|
fun feedMessageToShow(context: Context): FeedMessage? { |
|
|
|
// return FeedMessage.DISCORD |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!getBoolean(Keys.STOP_SHOWING_DISCLAIMER, context)) { |
|
|
|
if (!getBoolean(Keys.STOP_SHOWING_DISCLAIMER, context)) { |
|
|
|
return FeedMessage.DISCLAIMER |
|
|
|
return FeedMessage.DISCLAIMER |
|
|
|
|