Archived
1
0
This repository has been archived on 2026-04-22. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Michael Gordeev 787a6e9f48 Refactored core
UI navigation framework

Related Work Items: #408, #414, #416
2020-06-15 15:46:38 +03:00

90 lines
2.4 KiB
C#

using System;
using FoxTube.Services;
using Microsoft.AppCenter.Crashes;
using Microsoft.Services.Store.Engagement;
using Windows.Services.Store;
using Windows.UI.Xaml.Controls;
namespace FoxTube.Utils
{
public static class FeedbackInterop
{
public static bool HasFeedbackHub => StoreServicesFeedbackLauncher.IsSupported();
public static async void OpenFeedbackHub()
{
if (HasFeedbackHub)
await StoreServicesFeedbackLauncher.GetDefault().LaunchAsync();
}
public static async void RequestStoreReview()
{
StoreRateAndReviewResult result = await StoreContext.GetDefault().RequestRateAndReviewAppAsync();
if (result.Status == StoreRateAndReviewStatus.Error)
Metrics.SendReport(result.ExtendedError, new[] { ErrorAttachmentLog.AttachmentWithText(result.ExtendedJsonData, "extendedJsonData.json") },
("Status", result.Status.ToString()),
("WasReviewUpdated", result.WasUpdated.ToString()));
Metrics.AddEvent("Store review request has been received");
}
public static async void PromptFeedback()
{
if (!HasFeedbackHub)
{
StorageService.PromptFeedback = false;
return;
}
ContentDialog dialog = new ContentDialog
{
Title = "Have some thoughts?",
PrimaryButtonText = "Sure!",
SecondaryButtonText = "Don't ask me anymore",
CloseButtonText = "Maybe later",
DefaultButton = ContentDialogButton.Primary,
Content = "Would you like to share something you like or dislike in the app? Or perhaps you have some ideas? Leave feedback!"
};
ContentDialogResult result = await dialog.ShowAsync();
if (result != ContentDialogResult.None)
StorageService.PromptFeedback = false;
if (result == ContentDialogResult.Primary)
OpenFeedbackHub();
}
public static async void PromptReview()
{
ContentDialog dialog = new ContentDialog
{
Title = "Like our app?",
PrimaryButtonText = "Sure!",
SecondaryButtonText = "Don't ask me anymore",
CloseButtonText = "Maybe later",
DefaultButton = ContentDialogButton.Primary,
Content = new TextBlock
{
Text = "Could you leave a feedback on Microsoft Store page? It's very important for me :)"
}
};
ContentDialogResult result = await dialog.ShowAsync();
if (result != ContentDialogResult.None)
StorageService.PromptFeedback = false;
if (result == ContentDialogResult.Primary)
RequestStoreReview();
}
}
}