// Code to execute when the application is launching (eg, from Start) // This code will not execute when the application is reactivated private async void Application_Launching(object sender, LaunchingEventArgs e) { ThemeManager.ToDarkTheme(); await ReviewNotification.InitializeAsync(); if (NetworkInterface.GetIsNetworkAvailable() && NetworkInterface.NetworkInterfaceType == NetworkInterfaceType.Wireless80211) { try { var upd = await CheckIsThereUpdate(); if (upd) { var msg = new MessagePrompt { Title = AppResources.UpdateTitle, Message = AppResources.UpdateMessage, IsCancelVisible = true }; msg.Completed += msg_Completed; msg.Show(); } } catch (Exception) { } } }
[HttpPost("review/notification")] //Needs endpoint -Larson public async Task <ActionResult <bool> > RetrieveNewReview([FromBody] ReviewNotification reviewNotification) { var review = _movieLogic.GetFollowersForReviewNotification(reviewNotification); if (review.Followers != null) { await Logic.ApiHelper.ApiProcessor.SendReviewNotification(review); return(StatusCode(200)); } else { return(StatusCode(404)); } }
/// <summary> /// Sends the review notification on to Users, with the list of users who follow the movie the new movie review belongs to. /// </summary> /// <param name="reviewNotification"></param /// <returns></returns> public static async Task <bool> SendReviewNotification(ReviewNotification reviewNotification) { HttpClientHandler clientHandler = new HttpClientHandler(); clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return(true); }; HttpClient client = new HttpClient(clientHandler); string path = $"{_userapi}notification/review"; var json = JsonConvert.SerializeObject(reviewNotification); var data = new StringContent(json, Encoding.UTF8, "application/json"); HttpResponseMessage response = await client.PostAsync(path, data); if (response.IsSuccessStatusCode) { return(true); } else { return(false); } }
// Code to execute when the application is launching (eg, from Start) // This code will not execute when the application is reactivated private async void Application_Launching(object sender, LaunchingEventArgs e) { await ReviewNotification.InitializeAsync(); }
/// <summary> /// Takes in a review with an empty follower list. /// Gets the follower list from the repo. /// Adds follower list to review. /// </summary> /// <param name="review"></param> /// <returns>ReviewNotification</returns> public ReviewNotification GetFollowersForReviewNotification(ReviewNotification review) { review.Followers = _repo.GetFollowingMoviesByMovieID(review.Imdbid); return(review); }
private async void MainPage_OnLoaded(object sender, RoutedEventArgs e) { await ReviewNotification.TriggerAsync("Enjoying this app? Not enjoying this app? Please leave a review :-)", "Time for a review?", 5); }
private async void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) { await ReviewNotification.TriggerAsync(AppResources.PleaseRateApp, AppResources.PleaseRateAppTitle, 5); }