From 26971e0c3b1323fc5548de6ddb4ae06aa4def355 Mon Sep 17 00:00:00 2001 From: Tisfeng Date: Sun, 5 May 2024 20:15:58 +0800 Subject: [PATCH] fix: mini window intelligent query mode was enabled by mistake (#533) * fix: mini window intelligent query mode was enabled by mistake * docs: update README --- Easydict/Swift/Feature/Configuration/Configuration.swift | 7 +------ Easydict/objc/Configuration/EZConfiguration.m | 9 +-------- README.md | 4 ++-- README_EN.md | 4 ++-- 4 files changed, 6 insertions(+), 18 deletions(-) diff --git a/Easydict/Swift/Feature/Configuration/Configuration.swift b/Easydict/Swift/Feature/Configuration/Configuration.swift index 5d6419610..399916d86 100644 --- a/Easydict/Swift/Feature/Configuration/Configuration.swift +++ b/Easydict/Swift/Feature/Configuration/Configuration.swift @@ -632,12 +632,7 @@ extension Configuration { func intelligentQueryModeForWindowType(_ windowType: EZWindowType) -> Bool { let key = EZConstKey.constkey("IntelligentQueryMode", windowType: windowType) - let defaultValue = "0" - // Turn on intelligent query mode by default in mini window. - if windowType == .mini { - return true - } - return UserDefaults.standard.string(forKey: key) ?? defaultValue == "1" + return UserDefaults.standard.bool(forKey: key) } } diff --git a/Easydict/objc/Configuration/EZConfiguration.m b/Easydict/objc/Configuration/EZConfiguration.m index 5eaefafda..e74c6e1d0 100644 --- a/Easydict/objc/Configuration/EZConfiguration.m +++ b/Easydict/objc/Configuration/EZConfiguration.m @@ -625,14 +625,7 @@ - (void)setIntelligentQueryMode:(BOOL)enabled windowType:(EZWindowType)windowTyp } - (BOOL)intelligentQueryModeForWindowType:(EZWindowType)windowType { NSString *key = [EZConstKey constkey:EZIntelligentQueryModeKey windowType:windowType]; - - NSString *defaultValue = @"0"; - // Turn on intelligent query mode by default in mini window. - if (windowType == EZWindowTypeMini) { - defaultValue = @"1"; - } - - NSString *stringValue = [NSUserDefaults mm_readString:key defaultValue:defaultValue]; + NSString *stringValue = [NSUserDefaults mm_readString:key defaultValue:@"0"]; return [stringValue boolValue]; } diff --git a/README.md b/README.md index 2e62f526a..4e510ca6e 100644 --- a/README.md +++ b/README.md @@ -598,10 +598,10 @@ easydict://writeKeyValue?Google-IntelligentQueryTextType=5 easydict://writeKeyValue?Youdao-IntelligentQueryTextType=2 ``` -默认情况下,只有【迷你窗口】启用了智能查询模式,用户也可以手动对【侧悬浮窗口】启用智能查询模式: +默认情况下,所有窗口都未开启智能查询模式,用户可手动启用此功能: ```bash -easydict://writeKeyValue?IntelligentQueryMode-window2=1 +easydict://writeKeyValue?IntelligentQueryMode-window1=1 ``` window1 代表迷你窗口,window2 代表侧悬浮窗口,赋值 0 表示关闭,1 表示开启。 diff --git a/README_EN.md b/README_EN.md index eb0779f6f..e09490732 100644 --- a/README_EN.md +++ b/README_EN.md @@ -590,10 +590,10 @@ Similarly, for some services that support looking up vocabulary and translating easydict://writeKeyValue?Youdao-IntelligentQueryTextType=2 ``` -By default, only [Mini Window] is enabled for Smart Query Mode, users can also enable Smart Query Mode manually for [Hover Window]: +By default, all Windows are not enabled for smart query mode, users can enable this feature manually: ```bash -easydict://writeKeyValue?IntelligentQueryMode-window2=1 +easydict://writeKeyValue?IntelligentQueryMode-window1=1 ``` window1 represents the mini window, while window2 represents hover window, value 0 represents disabled, while 1 represents enabled.