NTP-29566 | OTP auto read changes (#15387)

Co-authored-by: shaurya-rehan <shaurya.rehan@navi.com>
This commit is contained in:
Hardik Chaudhary
2025-03-18 16:10:35 +05:30
committed by GitHub
parent 444d2d3eab
commit ed9bb9a792
43 changed files with 1480 additions and 289 deletions

View File

@@ -291,6 +291,20 @@ object PreferenceManager {
} else setIntPreference(key, value)
}
fun setBooleanSecurely(key: String, value: Boolean) {
if (shouldUseEncryptedSharedPref()) {
val editor = secureSharedPreferencesForSession?.edit()
editor?.putBoolean(key, value)
editor?.apply()
} else setBooleanPreference(key, value)
}
fun getBooleanSecurely(key: String, defValue: Boolean = false): Boolean {
return if (shouldUseEncryptedSharedPref()) {
secureSharedPreferencesForSession?.getBoolean(key, defValue) ?: defValue
} else getBooleanPreference(key, defValue)
}
fun getSecureString(key: String): String? {
return if (shouldUseEncryptedSharedPref()) {
secureSharedPreferencesForSession?.getString(key, null)