Skip to content

Commit

Permalink
Merge branch 'dev' into fix/window_resize_called
Browse files Browse the repository at this point in the history
  • Loading branch information
tisfeng authored Apr 13, 2024
2 parents a776ccc + 126faaa commit 6bd6c23
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Easydict/objc/Service/Youdao/EZYoudaoTranslate.m
Original file line number Diff line number Diff line change
Expand Up @@ -489,14 +489,11 @@ - (void)queryYoudaoDict:(NSString *)text from:(EZLanguage)from to:(EZLanguage)to

BOOL enableDictionary = self.queryTextType & EZQueryTextTypeDictionary;

// Youdao dict can query word, phrase, even short text.
BOOL shouldQueryDictionary = [text shouldQueryDictionaryWithLanguage:from maxWordCount:1];

NSString *foreignLangauge = [self youdaoDictForeignLangauge:self.queryModel];
BOOL supportQueryDictionaryLanguage = foreignLangauge != nil;

// If Youdao Dictionary does not support the language, try querying translate API.
if (!enableDictionary || !supportQueryDictionaryLanguage || !shouldQueryDictionary) {
if (!enableDictionary || !supportQueryDictionaryLanguage) {
completion(self.result, [EZError errorWithType:EZErrorTypeNoResultsFound]);
return;
}
Expand All @@ -522,6 +519,7 @@ - (void)queryYoudaoDict:(NSString *)text from:(EZLanguage)from to:(EZLanguage)to

NSURLSessionTask *task = [self.jsonSession GET:url parameters:params progress:nil success:^(NSURLSessionDataTask *_Nonnull task, id _Nullable responseObject) {
NSString *message = nil;

if (responseObject) {
@try {
EZYoudaoDictModel *model = [EZYoudaoDictModel mj_objectWithKeyValues:responseObject];
Expand Down

0 comments on commit 6bd6c23

Please sign in to comment.