Skip to content

Commit

Permalink
Merge branch 'dev' into perfect_menu
Browse files Browse the repository at this point in the history
  • Loading branch information
AkaShark committed Feb 18, 2024
2 parents c02c803 + 1c228a8 commit c3b8a12
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 62 deletions.
30 changes: 0 additions & 30 deletions .github/workflows/objective-c-xcode.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/swift.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Easydict/Feature/Configuration/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ let kHideMenuBarIconKey = "EZConfiguration_kHideMenuBarIconKey"
)

cancellables.append(
Defaults.publisher(.launchAtStartup)
Defaults.publisher(.launchAtStartup, options: [])
.removeDuplicates()
.sink { [weak self] change in
self?.didSetLaunchAtStartup(change.oldValue, new: change.newValue)
Expand Down
9 changes: 4 additions & 5 deletions Easydict/Feature/Service/Gemini/GeminiService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ public final class GeminiService: QueryService {
return orderedDict
}

override public func ocr(_: EZQueryModel) async throws -> EZOCRResult {
NSLog("Gemini Translate does not support OCR")
throw QueryServiceError.notSupported
}

override public func needPrivateAPIKey() -> Bool {
true
}
Expand All @@ -56,6 +51,10 @@ public final class GeminiService: QueryService {
return true
}

override public func totalFreeQueryCharacterCount() -> Int {
100000 * 1000
}

private let defaultAPIKey = "" /* .decryptAES() */

// easydict://writeKeyValue?EZGeminiAPIKey=xxx
Expand Down
1 change: 1 addition & 0 deletions Easydict/Feature/Service/Model/EZQueryService.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ NS_SWIFT_NAME(QueryService)

- (BOOL)needPrivateAPIKey;

/// Default is 100 * 10000
- (NSInteger)totalFreeQueryCharacterCount;

/// 获取文本的语言
Expand Down
2 changes: 1 addition & 1 deletion Easydict/Feature/Service/Niutrans/EZNiuTransTranslate.m
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ - (BOOL)hasPrivateAPIKey {
}

- (NSInteger)totalFreeQueryCharacterCount {
return 800 * 10000;
return 1000 * 10000;
}

#pragma mark - NiuTrans API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -691,9 +691,13 @@ - (void)selectTextTranslate {
[self.eventMonitor getSelectedText:^(NSString *_Nullable text) {
self.actionType = self.eventMonitor.actionType;

// Clear query if text is nil and user don't want to keep the last result.
if (!text && !Configuration.shared.keepPrevResultWhenEmpty) {
text = @"";
/**
Clear query if text is nil and user don't want to keep the last result.
!!!: text may be @"" when no selected text in Chrome, so we need to handle it.
*/
if (text.length == 0) {
text = Configuration.shared.keepPrevResultWhenEmpty ? nil : @"";
}
self.selectedText = [text trim];

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,7 @@ Easydict 作为一个免费开源的非盈利项目,目前主要是作者个
| 2024-01-28 || 7 | |
| 2024-01-29 | 大帅ㅤ | 5 | 还没有,但是感受到了用心。|
| 2024-02-04 | ll | 20 | |
| 2024-02-10 | 盒子哥 | 100 | |

</p>

Expand Down
1 change: 1 addition & 0 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ If you don't want your username to be displayed in the list, please choose anony
| 2024-01-28 || 7 | |
| 2024-01-29 | 大帅ㅤ | 5 | 还没有,但是感受到了用心。|
| 2024-02-04 | ll | 20 | |
| 2024-02-10 | 盒子哥 | 100 | |

</p>

Expand Down

0 comments on commit c3b8a12

Please sign in to comment.