Performance fix

This commit is contained in:
Arkadiusz Fal 2023-04-22 17:14:15 +02:00
parent 9936d9dd9e
commit c48301c788

View File

@ -7,7 +7,9 @@ struct KeychainModel {
var keychain = Keychain(service: "stream.yattee.app") var keychain = Keychain(service: "stream.yattee.app")
func updateAccountKey(_ account: Account, _ key: String, _ value: String) { func updateAccountKey(_ account: Account, _ key: String, _ value: String) {
keychain[accountKey(account, key)] = value DispatchQueue.global(qos: .background).async {
keychain[accountKey(account, key)] = value
}
} }
func getAccountKey(_ account: Account, _ key: String) -> String? { func getAccountKey(_ account: Account, _ key: String) -> String? {
@ -19,8 +21,10 @@ struct KeychainModel {
} }
func removeAccountKeys(_ account: Account) { func removeAccountKeys(_ account: Account) {
try? keychain.remove(accountKey(account, "token")) DispatchQueue.global(qos: .background).async {
try? keychain.remove(accountKey(account, "username")) try? keychain.remove(accountKey(account, "token"))
try? keychain.remove(accountKey(account, "password")) try? keychain.remove(accountKey(account, "username"))
try? keychain.remove(accountKey(account, "password"))
}
} }
} }