Skip to content

Commit

Permalink
fix: validate Bing service always fails (#422)
Browse files Browse the repository at this point in the history
* fix: validate Bing service always fail

* perf: use from instead of self.queryModel.queryFromLanguage

* perf: enable new SwiftUI Settings by default
  • Loading branch information
tisfeng authored Feb 25, 2024
1 parent de0be3f commit 401bba0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
4 changes: 0 additions & 4 deletions Easydict/Feature/Service/Bing/EZBingService.m
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,6 @@ - (BOOL)isEnglishWordToChinese:(NSString *)text from:(nonnull EZLanguage)from to
}

- (void)bingTranslate:(NSString *)text useDictQuery:(BOOL)useDictQuery from:(nonnull EZLanguage)from to:(nonnull EZLanguage)to completion:(nonnull void (^)(EZQueryResult *, NSError *_Nullable))completion {
if ([self prehandleQueryTextLanguage:text from:from to:to completion:completion]) {
return;
}

self.isDictQueryResult = NO;
if (useDictQuery) {
[self.request translateTextFromDict:text completion:^(NSDictionary * _Nullable json, NSError * _Nullable error) {
Expand Down
4 changes: 2 additions & 2 deletions Easydict/Feature/Service/Model/EZQueryService.m
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ - (BOOL)prehandleQueryTextLanguage:(NSString *)text
}
}

NSString *fromLanguage = [self languageCodeForLanguage:self.queryModel.queryFromLanguage];
NSString *toLanguage = [self languageCodeForLanguage:self.queryModel.queryTargetLanguage];
NSString *fromLanguage = [self languageCodeForLanguage:from];
NSString *toLanguage = [self languageCodeForLanguage:to];

BOOL unsupportedLanguage = NO;

Expand Down
2 changes: 1 addition & 1 deletion Easydict/NewApp/Configuration/Configuration+Defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ extension Defaults.Keys {
static let clearInput = Key<Bool>("EZConfiguration_kClearInputKey", default: true)
static let keepPrevResultWhenEmpty = Key<Bool>("EZConfiguration_kKeepPrevResultKey", default: true)
static let selectQueryTextWhenWindowActivate = Key<Bool>("EZConfiguration_kSelectQueryTextWhenWindowActivate", default: false)
static let enableBetaNewApp = Key<Bool>("EZConfiguration_kEnableBetaNewAppKey", default: false)
static let enableBetaNewApp = Key<Bool>("EZConfiguration_kEnableBetaNewAppKey", default: true)

static let enableBetaFeature = Key<Bool>("EZBetaFeatureKey", default: false)

Expand Down

0 comments on commit 401bba0

Please sign in to comment.