53 lines
1.9 KiB
C#
53 lines
1.9 KiB
C#
using System;
|
|
using Microsoft.Services.Store.Engagement;
|
|
using Windows.UI.Popups;
|
|
|
|
namespace FoxTube.Core.Helpers
|
|
{
|
|
public static class Feedback
|
|
{
|
|
public static bool HasFeedbackHub => StoreServicesFeedbackLauncher.IsSupported();
|
|
|
|
public static async void OpenFeedbackHub()
|
|
{
|
|
if (HasFeedbackHub)
|
|
await StoreServicesFeedbackLauncher.GetDefault().LaunchAsync();
|
|
}
|
|
|
|
public static async void PromptFeedback()
|
|
{
|
|
if (!HasFeedbackHub)
|
|
{
|
|
Settings.PromptFeedback = false;
|
|
return;
|
|
}
|
|
|
|
MessageDialog dialog = new MessageDialog("Have some thoughts to share about the app or any suggestions? Leave feedback!");
|
|
dialog.Commands.Add(new UICommand("Don't ask me anymore", (command) => Settings.PromptFeedback = false));
|
|
dialog.Commands.Add(new UICommand("Maybe later"));
|
|
dialog.Commands.Add(new UICommand("Sure!", (command) =>
|
|
{
|
|
Settings.PromptFeedback = false;
|
|
OpenFeedbackHub();
|
|
}));
|
|
dialog.DefaultCommandIndex = 2;
|
|
dialog.CancelCommandIndex = 1;
|
|
await dialog.ShowAsync();
|
|
}
|
|
public static async void PromptReview()
|
|
{
|
|
MessageDialog dialog = new MessageDialog("Like our app? Review it on Microsoft Store!");
|
|
dialog.Commands.Add(new UICommand("Don't ask me anymore", (command) => Settings.PromptReview = false));
|
|
dialog.Commands.Add(new UICommand("Maybe later"));
|
|
dialog.Commands.Add(new UICommand("Sure!", (command) =>
|
|
{
|
|
StoreInterop.RequestReview();
|
|
Settings.PromptReview = false;
|
|
}));
|
|
dialog.DefaultCommandIndex = 2;
|
|
dialog.CancelCommandIndex = 1;
|
|
await dialog.ShowAsync();
|
|
}
|
|
}
|
|
}
|