diff --git a/Easydict/Feature/ViewController/Storage/EZLocalStorage.m b/Easydict/Feature/ViewController/Storage/EZLocalStorage.m index 44b9735e3..92d3f1663 100644 --- a/Easydict/Feature/ViewController/Storage/EZLocalStorage.m +++ b/Easydict/Feature/ViewController/Storage/EZLocalStorage.m @@ -62,12 +62,26 @@ - (void)setup { EZWindowType windowType = [number integerValue]; for (EZServiceType serviceType in allServiceTypes) { EZServiceInfo *serviceInfo = [self serviceInfoWithType:serviceType windowType:windowType]; + + // New service. if (!serviceInfo) { serviceInfo = [[EZServiceInfo alloc] init]; serviceInfo.type = serviceType; - serviceInfo.enabled = NO; // disable new service + serviceInfo.enabled = YES; + serviceInfo.enabledQuery = YES; - // Mini type should keep concise, services <= 4 + /** + Fix https://github.com/tisfeng/Easydict/issues/269 and https://github.com/tisfeng/Easydict/issues/372 + + If there is a new service, we enable it but disable auto query, and add it to the end of the array. + + If it is the user's first time, auto query should be all allowed. + */ + if (self.queryCount > 0) { + serviceInfo.enabledQuery = NO; + } + + // Mini window should keep concise, so default enabled services should <= 4 if (windowType == EZWindowTypeMini) { NSArray *defaultEnabledServices = @[ EZServiceTypeAppleDictionary, @@ -78,10 +92,6 @@ - (void)setup { serviceInfo.enabled = [defaultEnabledServices containsObject:serviceType]; } - // There is a very small probability that Volcano webView translator will crash. - if (serviceType != EZServiceTypeVolcano) { - serviceInfo.enabledQuery = YES; - } [self setServiceInfo:serviceInfo windowType:windowType]; } } @@ -100,10 +110,6 @@ - (void)setup { NSMutableArray *array = [NSMutableArray arrayWithArray:allStoredServiceTypes]; if (![allStoredServiceTypes isEqualToArray:allServiceTypes]) { for (EZServiceType type in allServiceTypes) { - /** - If there is a new service, add it to the end of the array. - Fix https://github.com/tisfeng/Easydict/issues/269 - */ if ([allStoredServiceTypes indexOfObject:type] == NSNotFound) { [array addObject:type]; }