diff --git a/FlowCrypt/Functionality/DataManager/DataService.swift b/FlowCrypt/Functionality/DataManager/DataService.swift index ade0e370a..c98224b40 100644 --- a/FlowCrypt/Functionality/DataManager/DataService.swift +++ b/FlowCrypt/Functionality/DataManager/DataService.swift @@ -68,14 +68,14 @@ extension DataService: DataServiceType { } var isSetupFinished: Bool { - isLoggedIn && isAnyKeysForCurrentUser + isLoggedIn && doesAnyKeyExistForCurrentUser } - private var isAnyKeysForCurrentUser: Bool { + private var doesAnyKeyExistForCurrentUser: Bool { guard let currentUser = currentUser else { return false } - return encryptedStorage.isAnyKey(for: currentUser.email) + return encryptedStorage.doesAnyKeyExist(for: currentUser.email) } var isLoggedIn: Bool { @@ -115,7 +115,7 @@ extension DataService: DataServiceType { func validAccounts() -> [User] { encryptedStorage.getAllUsers() - .filter { encryptedStorage.isAnyKey(for: $0.email) } + .filter { encryptedStorage.doesAnyKeyExist(for: $0.email) } .filter { $0.email != currentUser?.email } .map(User.init) } diff --git a/FlowCrypt/Functionality/DataManager/Encrypted Storage/EncryptedStorage.swift b/FlowCrypt/Functionality/DataManager/Encrypted Storage/EncryptedStorage.swift index b26defba5..6759af52f 100644 --- a/FlowCrypt/Functionality/DataManager/Encrypted Storage/EncryptedStorage.swift +++ b/FlowCrypt/Functionality/DataManager/Encrypted Storage/EncryptedStorage.swift @@ -17,7 +17,7 @@ protocol EncryptedStorageType: KeyStorageType { func getAllUsers() -> [UserObject] func saveActiveUser(with user: UserObject) var activeUser: UserObject? { get } - func isAnyKey(for email: String) -> Bool + func doesAnyKeyExist(for email: String) -> Bool func cleanup() } @@ -181,7 +181,7 @@ extension EncryptedStorage { .first } - func isAnyKey(for email: String) -> Bool { + func doesAnyKeyExist(for email: String) -> Bool { keysInfo() .map(\.account) .map { $0.contains(email) } diff --git a/FlowCrypt/Functionality/DataManager/UserAccountService.swift b/FlowCrypt/Functionality/DataManager/UserAccountService.swift index 6a3ef9c71..05cc1bbd0 100644 --- a/FlowCrypt/Functionality/DataManager/UserAccountService.swift +++ b/FlowCrypt/Functionality/DataManager/UserAccountService.swift @@ -98,13 +98,13 @@ extension UserAccountService: UserAccountServiceType { func cleanupSessions() { encryptedStorage.getAllUsers() - .filter { !encryptedStorage.isAnyKey(for: $0.email) } + .filter { !encryptedStorage.doesAnyKeyExist(for: $0.email) } .map(\.email) .forEach(logOut) let users = encryptedStorage.getAllUsers() - if !users.contains(where: { $0.isActive }), let user = users.first(where: { encryptedStorage.isAnyKey(for: $0.email ) }) { + if !users.contains(where: { $0.isActive }), let user = users.first(where: { encryptedStorage.doesAnyKeyExist(for: $0.email ) }) { switchActiveSession(for: user) } }