Skip to content

Commit 0f8a95d

Browse files
john doyleLamparter
authored andcommitted
associate apps too
1 parent d249d70 commit 0f8a95d

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

Fire.Browser/Services/Notifications/NotificationMessenger.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,29 @@ public async Task InstallUpdatesAsync(FireNotification notification)
9090

9191
NotificationReceived(notification);
9292
}
93-
9493

94+
public async Task<List<StoreProduct>> GetAssociatedStoreProductsAsync()
95+
{
96+
List<string> productKinds = new List<string> { "Durable", "Consumable", "UnmanagedConsumable", "Subscription" };
97+
98+
StoreProductQueryResult result = await _storeContext.GetAssociatedStoreProductsAsync(productKinds);
99+
100+
if (result.ExtendedError != null)
101+
{
102+
// Handle error
103+
throw new Exception(result.ExtendedError.Message);
104+
}
105+
106+
List<StoreProduct> products = new List<StoreProduct>();
107+
108+
foreach (var product in result.Products.Values)
109+
{
110+
products.Add(product);
111+
Console.WriteLine($"Product ID: {product.StoreId}, Title: {product.Title}, Price: {product.Price.FormattedPrice}");
112+
}
113+
114+
return products;
115+
}
95116
public async Task PromptUserToRateApp(FireNotification notification)
96117
{
97118
await InitializeStoreContext();
@@ -100,6 +121,7 @@ public async Task PromptUserToRateApp(FireNotification notification)
100121

101122
WinRT.Interop.InitializeWithWindow.Initialize(_storeContext, WinRT.Interop.WindowNative.GetWindowHandle((Application.Current as App)?.m_window as MainWindow));
102123
StoreRateAndReviewResult result = await _storeContext.RequestRateAndReviewAppAsync();
124+
103125
if (Application.Current is App app && app.m_window is MainWindow window)
104126
{
105127

0 commit comments

Comments
 (0)