public GetClientAttributesRespose checkForApplicationUpdates(string token) { GetClientAttributesRespose respose = null; try { using (var client = new HttpClient()) { client.BaseAddress = new Uri(ConstantData.ApiURL.ToString() + "RegistrationMobile/GetClientAttributes"); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); var response = client.GetAsync(client.BaseAddress).Result; if (response.IsSuccessStatusCode) { var responseStream = response.Content.ReadAsStringAsync().Result; respose = JsonConvert.DeserializeObject <GetClientAttributesRespose>(responseStream); } } } catch (Exception ex) { throw ex; } return(respose); }
public bool checkForApplicationUpdates(string token, string currentVersion, string v) { bool isUpdateAvailable = false; GetClientAttributesRespose response = null; try { response = commonService.checkForApplicationUpdates(token); } catch (Exception ex) { throw ex; } finally { if (response != null) { if (response.nameValues != null) { foreach (NameValueModel nv in response.nameValues) { if (v == "Android") { if (nv.Name == "CustomerMobileAppVersionAndroid") { if (float.Parse(currentVersion) < float.Parse(nv.Value)) { isUpdateAvailable = true; } } } if (v == "iOS") { if (nv.Name == "CustomerMobileAppVersionIOS") { if (float.Parse(currentVersion) < float.Parse(nv.Value)) { isUpdateAvailable = true; } } } } } } } return(isUpdateAvailable); }