// code based on this: https://docs.microsoft.com/en-us/windows/uwp/monetize/request-ratings-and-reviews private async static void ShowRatingReviewDialog() { try { _alreadyPromptedForRatingThisSession = true; StoreSendRequestResult result = await StoreRequestHelper.SendRequestAsync( StoreContext.GetDefault(), 16, String.Empty); if (result.ExtendedError == null) { JObject jsonObject = JObject.Parse(result.Response); if (jsonObject.SelectToken("status").ToString() == "success") { // The customer rated or reviewed the app. Statistics.UserHasRatedApp = true; } else if (jsonObject.SelectToken("status").ToString() == "aborted") { // The customer chose not to rate the app Statistics.UserHasRatedApp = false; } } else { // There was an error rating the app } } catch { // don't crash app due to failure with rating / review Analytics.LogEvent(AnalyticsEvent.RatingReviewError); } }
public async Task <bool> ShowRatingReviewDialog() { if (ApiInformation.IsMethodPresent(typeof(StoreRequestHelper).FullName, nameof(StoreRequestHelper.SendRequestAsync), 3)) { logger.Log("Review.SendRequest"); StoreSendRequestResult result = await StoreRequestHelper.SendRequestAsync( StoreContext.GetDefault(), 16, string.Empty); if (result.ExtendedError == null) { JObject jsonObject = JObject.Parse(result.Response); if (jsonObject.SelectToken("status").ToString() == "success") { // The customer rated or reviewed the app. return(true); } } // There was an error with the request, or the customer chose not to // rate or review the app. return(false); } else { logger.Log("Review.LaunchUri"); bool reviewResult = await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-windows-store://review/?ProductId=9PCZBVLLDSX4")); return(reviewResult); } }
//public DelegateCommand<Kudos> GetKudoCommand { get; set; } //public async void KudosGridView_OnItemClick(object sender, ItemClickEventArgs e) //{ // if (!(e.ClickedItem is Kudos kudo)) return; // //if (ApiInformation.IsTypePresent("Microsoft.Services.Store.Engagement.StoreServicesCustomEventLogger")) // // StoreServicesCustomEventLogger.GetDefault().Log($"{kudo.Title} Kudos Item Selected"); // if (!string.IsNullOrEmpty(kudo.StoreId)) // { // await PurchaseKudosAsync(kudo.StoreId); // } // if (kudo.Title == "Store Rating") // { // await ShowRatingReviewDialog(); // } // if (kudo.Title == "Video Ad") // { // // Wait for ad to be ready // //if (kudo.IsBusy) // //{ // // await new MessageDialog("Ad is being fetched right now, wait for busy indicator disappear and try again.").ShowAsync(); // // return; // //} // //// double check the ad is ready using the State value // //if (_myInterstitialAd.State == InterstitialAdState.Ready) // //{ // // _myInterstitialAd.Show(); // //} // } //} public async Task ShowRatingReviewDialog() { try { IsBusy = true; IsBusyMessage = "rating and review in progress (you should see a separate window)..."; var result = await StoreRequestHelper.SendRequestAsync(StoreContext.GetDefault(), 16, ""); IsBusyMessage = "action complete, reviewing result..."; if (result.ExtendedError != null) { return; } var jsonObject = JObject.Parse(result.Response); var status = jsonObject.SelectToken("status").ToString(); IsBusyMessage = "action complete, showing result..."; if (status == "success") { await new MessageDialog("Thank you for taking the time to leave a rating! If you left 3 stars or lower, please let me know how I can improve the app (go to About page).", "Success").ShowAsync(); } else if (status == "aborted") { var md = new MessageDialog("If you prefer not to leave a bad rating but still want to provide feedback, click the email button below. I work hard to make sure you have a great app experience and would love to hear from you.", "Review Aborted"); md.Commands.Add(new UICommand("send email")); md.Commands.Add(new UICommand("not now")); var mdResult = await md.ShowAsync(); if (mdResult.Label == "send email") { FeedbackHelpers.Current.EmailFeedbackMessage(); } } else { await new MessageDialog($"The rating or review did not complete, here's what Windows had to say: {jsonObject.SelectToken("status")}.\r\n\nIf you meant to leave a review, try again. If this keeps happening, contact us and share the error code above.", "Rating or Review was not successful").ShowAsync(); } } catch (Exception ex) { await ex.LogExceptionWithUserMessage(); } finally { IsBusy = false; IsBusyMessage = ""; } }
public async Task <bool> ShowRatingReviewDialog() { StoreSendRequestResult result = await StoreRequestHelper.SendRequestAsync( StoreContext.GetDefault(), 16, String.Empty); if (result.ExtendedError == null) { return(true); } return(false); }
public static async Task TryRequestReviewAsync() { StoreSendRequestResult result = await StoreRequestHelper.SendRequestAsync( StoreContext.GetDefault(), 16, String.Empty); if (result.ExtendedError == null) { JObject jsonObject = JObject.Parse(result.Response); if (jsonObject.SelectToken("status").ToString() == "success") { // The customer rated or reviewed the app. } } }
public static async Task <bool> ShowRatingReviewDialog() { StoreSendRequestResult result = await StoreRequestHelper.SendRequestAsync( StoreContext.GetDefault(), 16, String.Empty); if (result.ExtendedError == null) { JObject jsonObject = JObject.Parse(result.Response); if (jsonObject.SelectToken("status").ToString() == "success") { // The customer rated or reviewed the app. return(true); } } // There was an error with the request, or the customer chose not to // rate or review the app. return(false); }
public static async Task <bool> ShowRatingReviewDialog() { if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Services.Store.StoreRequestHelper")) { StoreSendRequestResult result = await StoreRequestHelper.SendRequestAsync(StoreContext.GetDefault(), 16, String.Empty); if (result.ExtendedError == null) { JObject jsonObject = JObject.Parse(result.Response); if (jsonObject.SelectToken("status").ToString() == "success") { // The customer rated or reviewed the app. return(true); } } } return(false); }
public void StoreReview() => StoreRequestHelper.SendRequestAsync(StoreContext.GetDefault(), 16, string.Empty).WatchForError();
/// <summary> /// Requests an app review. /// </summary> public async Task RequestReview(bool testMode) => _ = await StoreRequestHelper.SendRequestAsync(StoreContext.GetDefault(), 16, string.Empty).AsTask();