/// <summary> /// Fetch freshg remote config from server and store locally. /// </summary> /// <returns></returns> public async Task <CountlyResponse> Update() { var requestParams = new Dictionary <string, object> { { "method", "fetch_remote_config" } }; var url = BuildGetRequest(requestParams); var response = await Task.Run(() => _requestCountlyHelper.GetAsync(url, false)); if (response.IsSuccess) { _configDao.RemoveAll(); var configEntity = new ConfigEntity { Id = _configDao.GenerateNewId(), Json = response.Data }; _configDao.Save(configEntity); Configs = Converter.ConvertJsonToDictionary(response.Data); if (_config.EnableConsoleLogging) { Debug.Log("[Countly] RemoteConfigCountlyService UpdateConfig: " + response.ToString()); } } return(response); }
public async Task <CountlyResponse> InitConfig() { var requestParams = new Dictionary <string, object> { { "method", "fetch_remote_config" } }; var url = BuildGetRequest(requestParams); var response = await Task.Run(() => _requestCountlyHelper.GetAsync(url)); if (response.IsSuccess) { _configDao.RemoveAll(); var configEntity = new ConfigEntity { Id = _configDao.GenerateNewId(), Json = response.Data }; _configDao.Save(configEntity); Configs = Converter.ConvertJsonToDictionary(response.Data); } else { var allConfigs = _configDao.LoadAll(); if (allConfigs != null && allConfigs.Count > 0) { Configs = Converter.ConvertJsonToDictionary(allConfigs[0].Json); Debug.Log("Configs: " + Configs.Count); } } return(response); }