Skip to content

Commit

Permalink
Remove the limitation to the defaultTTSServiceType
Browse files Browse the repository at this point in the history
  • Loading branch information
NeverAgain11 committed Jan 17, 2024
1 parent c4226a7 commit 3e248a5
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions Easydict/Feature/Configuration/NewConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,8 @@ class Configuration: NSObject {
@DefaultsWrapper(.languageDetectOptimize)
var languageDetectOptimize: EZLanguageDetectOptimize

@available(macOS 13, *)
var defaultTTSServiceType: TTSServiceType {
get {
Defaults[.defaultTTSServiceType]
}
set {
Defaults[.defaultTTSServiceType] = newValue
}
}
@DefaultsWrapper(.defaultTTSServiceType)
var defaultTTSServiceType: TTSServiceType

@DefaultsWrapper(.showGoogleQuickLink)
var showGoogleQuickLink: Bool
Expand Down Expand Up @@ -208,11 +201,9 @@ class Configuration: NSObject {
didSetLanguageDetectOptimize()
}.tieToLifetime(of: self)

if #available(macOS 13, *) {
Defaults.observe(.defaultTTSServiceType) { [unowned self] _ in
self.self.didSetDefaultTTSServiceType()
}.tieToLifetime(of: self)
}
Defaults.observe(.defaultTTSServiceType) { [unowned self] _ in
didSetDefaultTTSServiceType()
}.tieToLifetime(of: self)

Defaults.observe(.showGoogleQuickLink) { [unowned self] _ in
didSetShowGoogleQuickLink()
Expand Down Expand Up @@ -360,10 +351,8 @@ private extension Configuration {
}

func didSetDefaultTTSServiceType() {
if #available(macOS 13, *) {
let value = defaultTTSServiceType
logSettings(["tts": value])
}
let value = defaultTTSServiceType
logSettings(["tts": value])
}

func didSetShowGoogleQuickLink() {
Expand Down

0 comments on commit 3e248a5

Please sign in to comment.