Skip to content

Commit

Permalink
Show shielding notice once per app start
Browse files Browse the repository at this point in the history
  • Loading branch information
Radiokot committed Jun 25, 2024
1 parent 7090124 commit efb8f96
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class Session(context: Context) {
val isLoggedIn: LiveData<Boolean>
get() = _isLoggedIn

// The notice must be shown once per app start.
private var isShieldingNoticeShown = false

fun setHasShowRewards(id: Int, value: Boolean) {
filterPreferences.setHasShowRewards(id, value)
}
Expand All @@ -39,12 +42,11 @@ class Session(context: Context) {
}

fun shieldingNoticeShown() {
authPreferences.setShieldingNoticeShown(true)
isShieldingNoticeShown = true
}

fun isShieldingNoticeShown():Boolean {
return authPreferences.getShieldingNoticeShown()
}
fun isShieldingNoticeShown(): Boolean =
isShieldingNoticeShown

fun hasSetupPassword(passcodeUsed: Boolean = false) {
_isLoggedIn.value = true
Expand Down Expand Up @@ -118,14 +120,6 @@ class Session(context: Context) {
return authPreferences.setShieldingEnabled(accountAddress, value)
}

fun isShieldedWarningDismissed(accountAddress: String): Boolean {
return authPreferences.isShieldedWarningDismissed(accountAddress)
}

fun setShieldedWarningDismissed(accountAddress: String, value: Boolean) {
return authPreferences.setShieldedWarningDismissed(accountAddress, value)
}

init {
authPreferences = AuthPreferences(context)
hasSetupPassword = authPreferences.getHasSetupUser()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,9 @@ class AuthPreferences(val context: Context) :
const val PREFKEY_BIOMETRIC_KEY = "PREFKEY_BIOMETRIC_KEY"
const val PREFKEY_TERMS_HASHED = "PREFKEY_TERMS_HASHED"
const val PREFKEY_SHIELDING_ENABLED_ = "PREFKEY_SHIELDING_ENABLED_"
const val PREFKEY_SHIELDED_WARNING_DISMISSED_ = "PREFKEY_SHIELDED_WARNING_DISMISSED_"
const val PREFKEY_IDENTITY_PENDING_ACKNOWLEDGED = "PREFKEY_IDENTITY_PENDING_ACKNOWLEDGED_"
const val SEED_PHRASE = "SEED_PHRASE"
const val SEED_PHRASE_ENCRYPTED = "SEED_PHRASE_ENCRYPTED"
const val PREFKEY_SHIELDING_NOTICE_SHOWN = "SHIELDING_NOTICE_SHOWN"
}

fun setShieldingNoticeShown(value: Boolean) {
setBoolean(PREFKEY_SHIELDING_NOTICE_SHOWN, value)
}

fun getShieldingNoticeShown(): Boolean {
return getBoolean(PREFKEY_SHIELDING_NOTICE_SHOWN, false)
}

fun setHasSetupUser(value: Boolean) {
Expand Down Expand Up @@ -135,14 +125,6 @@ class AuthPreferences(val context: Context) :
return setBoolean(PREFKEY_SHIELDING_ENABLED_ + accountAddress, value)
}

fun isShieldedWarningDismissed(accountAddress: String): Boolean {
return getBoolean(PREFKEY_SHIELDED_WARNING_DISMISSED_ + accountAddress, false)
}

fun setShieldedWarningDismissed(accountAddress: String, value: Boolean) {
return setBoolean(PREFKEY_SHIELDED_WARNING_DISMISSED_ + accountAddress, value)
}

fun setIdentityPendingWarningAcknowledged(id: Int) {
return setBoolean(PREFKEY_IDENTITY_PENDING_ACKNOWLEDGED + id, true)
}
Expand Down

0 comments on commit efb8f96

Please sign in to comment.