private async void TokenKill()
 {
     if (App.CurrentUser == null)
     {
         return;
     }
     await ClientService.SendAsync(HttpMethod.Post, "api/user", "PostAuthTokenKill");
 }
        public async Task <List <ApplicationUserSelection> > GetAsync()
        {
            var models   = new List <ApplicationUserSelection>();
            var response = await ClientService.SendAsync(HttpMethod.Get, ControllerName, "getasync");

            if (response != null)
            {
                var jsonResult = response.Content.ReadAsStringAsync();
                models = JsonConvert.DeserializeObject <List <ApplicationUserSelection> >(jsonResult.Result);
            }

            return(models);
        }
Exemple #3
0
        public async Task <YoutubeConfiguration> GetAsync()
        {
            var model    = new YoutubeConfiguration();
            var response = await ClientService.SendAsync(HttpMethod.Get, ControllerName, "getasync");

            if (response != null && response.StatusCode == HttpStatusCode.OK)
            {
                var jsonTask = response.Content.ReadAsStringAsync();
                jsonTask.Wait();
                model = JsonConvert.DeserializeObject <YoutubeConfiguration>(jsonTask.Result);
            }

            return(model);
        }
Exemple #4
0
        public async Task <bool> TrackerSkipPhotos()
        {
            var response = await ClientService.SendAsync(HttpMethod.Get, "constants", "trackerskipphotoonsteps");

            if (response != null)
            {
                var json = response.Content.ReadAsStringAsync();
                return(json.Result.ToLower().Contains("yes"));
            }
            return(false);

            //var response = await ClientService.GetStringAsync(new Uri(ClientService.GetRequestUri("constants", "trackerskipphotoonsteps")));
            //if (response != null)
            //    return response.ToLower().Contains("yes");
            //return false;
        }
        public async Task <AppInfoModel> GetAsync()
        {
            var platform = DeviceInfo.GetPlatform;
            var response =
                await ClientService.SendAsync(HttpMethod.Get, ControllerName, $"get?platform={platform}");

            if (response != null && response.IsSuccessStatusCode && response.StatusCode == HttpStatusCode.OK)
            {
                Task <string> jsonTask = response.Content.ReadAsStringAsync();
                jsonTask.Wait();
                var model = JsonConvert.DeserializeObject <AppInfoModel>(jsonTask.Result);
                return(model);
            }

            return(null);
        }
        private async Task <AuthenticationResult> Authenticate(string authenticationUrl, string applicationId,
                                                               string username, string password)
        {
            var request = new HttpRequestMessage()
            {
                RequestUri = new Uri(authenticationUrl),
                Method     = HttpMethod.Post,
            };
            var userPasswordEncrypt  = Convert.ToBase64String(Encoding.UTF8.GetBytes(username + ":" + password));
            var baseWithUserPassword = HttpConstants.BASIC + " " + userPasswordEncrypt;

            request.Headers.Add(HttpConstants.AUTHORIZATION, baseWithUserPassword);
            request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(HttpConstants.MEDIA_TYPE_TEXT_PLAIN));
            var response = await ClientService.SendAsync(request);

            return(await GetTokenAsync(response));
        }
 public async Task WriteDebug(string debugLog)
 {
     var methodWithParam = "postdebuglog?debugLogstring=" + debugLog;
     await ClientService.SendAsync(HttpMethod.Post, ControllerName, methodWithParam);
 }