Cleanup duplicated code (#678)

This commit is contained in:
Mingshen Sun 2025-02-08 14:26:45 -08:00 committed by GitHub
parent b0a971507f
commit 1e79e12593
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 10 deletions

View file

@ -113,14 +113,6 @@ public class PasswordStore {
fileManager.fileExists(atPath: Globals.repositoryURL.path)
}
public func passwordExisted(password: Password) -> Bool {
PasswordEntity.exists(password: password, in: context)
}
public func getPasswordEntity(by path: String, isDir: Bool) -> PasswordEntity? {
PasswordEntity.fetch(by: path, isDir: isDir, in: context)
}
public func cloneRepository(
remoteRepoURL: URL,
branchName: String,
@ -236,7 +228,7 @@ public class PasswordStore {
}
private func addPasswordEntities(password: Password) throws -> PasswordEntity? {
guard !passwordExisted(password: password) else {
guard !PasswordEntity.exists(password: password, in: context) else {
throw AppError.passwordDuplicated
}