Skip to content

Commit

Permalink
fix: mini window intelligent query mode was enabled by mistake (#533)
Browse files Browse the repository at this point in the history
* fix: mini window intelligent query mode was enabled by mistake

* docs: update README
  • Loading branch information
tisfeng authored May 5, 2024
1 parent 5800e14 commit 26971e0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 18 deletions.
7 changes: 1 addition & 6 deletions Easydict/Swift/Feature/Configuration/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
9 changes: 1 addition & 8 deletions Easydict/objc/Configuration/EZConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 表示开启。

Expand Down
4 changes: 2 additions & 2 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 26971e0

Please sign in to comment.