FUS: Add method to read dictionary service URL

This commit is contained in:
Marat Khabibullin
2018-10-05 17:30:03 +03:00
parent ac39e30b08
commit 4aa8ef5500
@@ -6,6 +6,7 @@ import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.application.impl.ApplicationInfoImpl;
import com.intellij.util.ArrayUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.Set;
@@ -20,6 +21,7 @@ import java.util.Set;
*/
public class FUStatisticsSettingsService extends StatisticsConnectionService {
private static final String APPROVED_GROUPS_SERVICE = "white-list-service";
private static final String DICTIONARY_SERVICE = "dictionary-service";
public static FUStatisticsSettingsService getInstance() {return new FUStatisticsSettingsService();}
private FUStatisticsSettingsService() {
@@ -29,7 +31,7 @@ public class FUStatisticsSettingsService extends StatisticsConnectionService {
@NotNull
@Override
public String[] getAttributeNames() {
return ArrayUtil.mergeArrays(super.getAttributeNames(), APPROVED_GROUPS_SERVICE);
return ArrayUtil.mergeArrays(super.getAttributeNames(), APPROVED_GROUPS_SERVICE, DICTIONARY_SERVICE);
}
@NotNull
@@ -41,6 +43,11 @@ public class FUStatisticsSettingsService extends StatisticsConnectionService {
return FUStatisticsWhiteListGroupsService.getApprovedGroups(getProductRelatedUrl(approvedGroupsServiceUrl));
}
@Nullable
public String getDictionaryServiceUrl() {
return getSettingValue(DICTIONARY_SERVICE);
}
@NotNull
public String getProductRelatedUrl(@NotNull String approvedGroupsServiceUrl) {
return approvedGroupsServiceUrl + ApplicationInfo.getInstance().getBuild().getProductCode() + ".json";