Archived
1
0

Core update. Base core features are done (main app doesn't compile)

Related Work Items: #416, #422, #423, #424
This commit is contained in:
Michael Gordeev
2020-06-11 21:17:18 +03:00
parent b3212738e8
commit c58d846057
18 changed files with 386 additions and 281 deletions
+89
View File
@@ -0,0 +1,89 @@
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)
{
Storage.SetValue(Storage.Settings.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)
Storage.SetValue(Storage.Settings.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)
Storage.SetValue(Storage.Settings.PromptReview, false);
if (result == ContentDialogResult.Primary)
RequestStoreReview();
}
}
}