Refactor auto-translations and add caching

Changelog-Added: Add auto-translation caching to ruduce api usage
Closes: #843
This commit is contained in:
2023-03-30 11:15:35 -04:00
committed by William Casarin
parent 5a238502cb
commit ae82114a33
12 changed files with 225 additions and 115 deletions

View File

@@ -280,17 +280,6 @@ class UserSettingsStore: ObservableObject {
private func clearDeepLApiKey() throws {
try Vault.deletePrivateKey(keychainConfiguration: DamusDeepLKeychainConfiguration())
}
func can_translate(_ pubkey: String) -> Bool {
switch translation_service {
case .none:
return false
case .libretranslate:
return URLComponents(string: libretranslate_url) != nil
case .deepl:
return deepl_api_key != ""
}
}
}
struct DamusLibreTranslateKeychainConfiguration: KeychainConfiguration {