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
FoxTube/FoxTube.Core/Controllers/StoreInterop.cs
T
2019-11-10 21:34:01 +03:00

39 lines
1.2 KiB
C#

using System;
using System.Threading.Tasks;
using Windows.Services.Store;
namespace FoxTube.Core.Controllers
{
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;
}
}
}
}