Skip to content

Commit

Permalink
TTSServiceType get rid of limitation to more than macOS 13
Browse files Browse the repository at this point in the history
  • Loading branch information
CanglongCl committed Jan 17, 2024
1 parent 068203e commit 153ed92
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
1 change: 0 additions & 1 deletion Easydict/NewApp/Configuration/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ extension Defaults.Keys {
static let autoCopySelectedText = Key<Bool>("EZConfiguration_kAutoCopySelectedTextKey", default: false)
static let autoCopyFirstTranslatedText = Key<Bool>("EZConfiguration_kAutoCopyFirstTranslatedTextKey", default: false)
static let languageDetectOptimize = Key<EZLanguageDetectOptimize>("EZConfiguration_kLanguageDetectOptimizeTypeKey", default: EZLanguageDetectOptimize.none)
@available(macOS 13, *)
static let defaultTTSServiceType = Key<TTSServiceType>("EZConfiguration_kDefaultTTSServiceTypeKey", default: TTSServiceType.youdao)
static let showGoogleQuickLink = Key<Bool>("EZConfiguration_kShowGoogleLinkKey", default: true)
static let showEudicQuickLink = Key<Bool>("EZConfiguration_kShowEudicLinkKey", default: true)
Expand Down
17 changes: 9 additions & 8 deletions Easydict/NewApp/Model/TTSServiceType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@
import Defaults
import Foundation

enum TTSServiceType: String, CaseIterable {
case youdao
case bing
case google
case baidu
case apple
}

@available(macOS 13, *)
enum TTSServiceType: String, CaseIterable, CustomLocalizedStringResourceConvertible {
extension TTSServiceType: CustomLocalizedStringResourceConvertible {
var localizedStringResource: LocalizedStringResource {
switch self {
case .youdao:
Expand All @@ -25,15 +33,8 @@ enum TTSServiceType: String, CaseIterable, CustomLocalizedStringResourceConverti
"setting.tts_service.options.apple"
}
}

case youdao
case bing
case google
case baidu
case apple
}

@available(macOS 13, *)
extension TTSServiceType: Defaults.Serializable {
// while in the future, ServiceType was deleted, then you can safely delete this struct and `bridge`
struct TTSServiceTypeBridge: Defaults.Bridge {
Expand Down

0 comments on commit 153ed92

Please sign in to comment.