fix: since loggedIn is determined by state we control, cache the value to avoid expensive lookups
This commit is contained in:
parent
d3ccb51df4
commit
ac8e2f5443
@ -16,11 +16,13 @@ object SDCredentials {
|
||||
.run { this?.userName to this?.getPasswordAsString() }
|
||||
set(value) {
|
||||
PasswordSafe.instance[createCredentialAttributes("httpAuth")] = Credentials(value.first, value.second)
|
||||
loggedIn = value.first != null && value.second != null
|
||||
}
|
||||
|
||||
fun logOut() {
|
||||
PasswordSafe.instance[createCredentialAttributes("httpAuth")] = null
|
||||
PasswordSafe.instance[createCredentialAttributes("teamId")] = null
|
||||
loggedIn = false
|
||||
}
|
||||
|
||||
var url: String
|
||||
@ -34,4 +36,7 @@ object SDCredentials {
|
||||
set(value) {
|
||||
PasswordSafe.instance[createCredentialAttributes("teamId")] = Credentials(value)
|
||||
}
|
||||
|
||||
var loggedIn: Boolean = credentials.first != null && credentials.second != null
|
||||
private set
|
||||
}
|
@ -291,8 +291,7 @@ object SDom {
|
||||
baos.toByteArray()
|
||||
}))
|
||||
|
||||
val loggedIn: Boolean
|
||||
get() = SDCredentials.credentials.first != null && SDCredentials.credentials.second != null
|
||||
val loggedIn: Boolean get() = SDCredentials.loggedIn
|
||||
|
||||
init {
|
||||
if (loggedIn) {
|
||||
|
Loading…
Reference in New Issue
Block a user