From a0cb61e70f40249853e10301b583a92e74d274e4 Mon Sep 17 00:00:00 2001 From: Lava <34743145+CanglongCl@users.noreply.github.com> Date: Wed, 17 Jan 2024 03:33:54 -0800 Subject: [PATCH] TTSServiceType get rid of limitation to more than macOS 13 (#336) --- .../NewApp/Configuration/Configuration.swift | 1 - Easydict/NewApp/Model/TTSServiceType.swift | 17 +++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Easydict/NewApp/Configuration/Configuration.swift b/Easydict/NewApp/Configuration/Configuration.swift index 9ecdff830..976ab72f5 100644 --- a/Easydict/NewApp/Configuration/Configuration.swift +++ b/Easydict/NewApp/Configuration/Configuration.swift @@ -33,7 +33,6 @@ extension Defaults.Keys { static let autoCopySelectedText = Key("EZConfiguration_kAutoCopySelectedTextKey", default: false) static let autoCopyFirstTranslatedText = Key("EZConfiguration_kAutoCopyFirstTranslatedTextKey", default: false) static let languageDetectOptimize = Key("EZConfiguration_kLanguageDetectOptimizeTypeKey", default: EZLanguageDetectOptimize.none) - @available(macOS 13, *) static let defaultTTSServiceType = Key("EZConfiguration_kDefaultTTSServiceTypeKey", default: TTSServiceType.youdao) static let showGoogleQuickLink = Key("EZConfiguration_kShowGoogleLinkKey", default: true) static let showEudicQuickLink = Key("EZConfiguration_kShowEudicLinkKey", default: true) diff --git a/Easydict/NewApp/Model/TTSServiceType.swift b/Easydict/NewApp/Model/TTSServiceType.swift index 6eda5cf16..c28ef5938 100644 --- a/Easydict/NewApp/Model/TTSServiceType.swift +++ b/Easydict/NewApp/Model/TTSServiceType.swift @@ -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: @@ -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 {