Anyway, I am the only one who reads this, right?
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Services.Store;
|
||||
|
||||
namespace FoxTube.Core.Helpers
|
||||
{
|
||||
public static class StoreInterop
|
||||
{
|
||||
public static bool AdsDisabled { get; private set; } = true;
|
||||
public static string Price { get; private set; }
|
||||
|
||||
public static async Task UpdateStoreState()
|
||||
{
|
||||
StoreProductQueryResult requset = await StoreContext.GetDefault().GetAssociatedStoreProductsAsync(new[] { "Durable" });
|
||||
|
||||
if (requset.Products["9NP1QK556625"].IsInUserCollection)
|
||||
return;
|
||||
|
||||
Price = requset.Products["9NP1QK556625"].Price.FormattedPrice;
|
||||
AdsDisabled = false;
|
||||
}
|
||||
|
||||
public static async Task<bool> PurchaseApp()
|
||||
{
|
||||
StorePurchaseResult request = await StoreContext.GetDefault().RequestPurchaseAsync("9NP1QK556625");
|
||||
|
||||
switch (request.Status)
|
||||
{
|
||||
case StorePurchaseStatus.AlreadyPurchased:
|
||||
case StorePurchaseStatus.Succeeded:
|
||||
AdsDisabled = true;
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static async void RequestReview()
|
||||
{
|
||||
StoreRateAndReviewResult result = await StoreContext.GetDefault().RequestRateAndReviewAppAsync();
|
||||
|
||||
string attachedPackageId = result.Status == StoreRateAndReviewStatus.Error ? await Metrics.SendExtendedData("StoreReviewRequestError", result.ExtendedJsonData) : "Success";
|
||||
Metrics.AddEvent("Store review request has been recieved",
|
||||
("Result", result.Status.ToString()),
|
||||
("ErrorData", attachedPackageId));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user