Esempio n. 1
0
        public async Task <bool> IsEnabled()
        {
            try
            {
                using (var client = await restClient.CreateAuthenticatedClient())
                {
                    var header = Xamarin.Essentials.Preferences.Get("HomeManagementAppHeader", string.Empty);
                    client.DefaultRequestHeaders.Add("HomeManagementApp", header);
                    var result = await client.GetAsync(Endpoints.TwoFactor.IS_ENABLED);

                    if (result.StatusCode != System.Net.HttpStatusCode.OK)
                    {
                        throw new AppException();
                    }

                    var json = await restClient.ReadJsonResponse <bool>(result);

                    return(json);
                }
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                throw;
            }
        }