From c48301c78809e5f42d819aaa9bb4e467850333c9 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sat, 22 Apr 2023 17:14:15 +0200 Subject: [PATCH] Performance fix --- Model/KeychainModel.swift | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Model/KeychainModel.swift b/Model/KeychainModel.swift index 127f0267..438a7277 100644 --- a/Model/KeychainModel.swift +++ b/Model/KeychainModel.swift @@ -7,7 +7,9 @@ struct KeychainModel { var keychain = Keychain(service: "stream.yattee.app") 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? { @@ -19,8 +21,10 @@ struct KeychainModel { } func removeAccountKeys(_ account: Account) { - try? keychain.remove(accountKey(account, "token")) - try? keychain.remove(accountKey(account, "username")) - try? keychain.remove(accountKey(account, "password")) + DispatchQueue.global(qos: .background).async { + try? keychain.remove(accountKey(account, "token")) + try? keychain.remove(accountKey(account, "username")) + try? keychain.remove(accountKey(account, "password")) + } } }