dotnet / dotnet/maui-samples

BillingService Refresh Does Not Update the UI

Open
#733 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
3.7k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

Tapping the "Restore Purchases" button correctly gets the new status but it doesn't seem to update the UI, my fix was to add a call on `LoadProductsAsync` in `ProductsViewModel.RestorePurchasesAsync` so it now reads

```
private async Task RestorePurchasesAsync()
{
try
{
IsLoading = true;

var success = await _billingService.RestorePurchasesAsync();

if (success)
{
await (Application.Current?.Windows[0].Page?.DisplayAlertAsync("Success", "Purchases restored successfully!", "OK") ?? Task.CompletedTask);
await LoadProductsAsync(); // refresh product states
_logger.LogInformation("Purchases restored successfully");
}
else
...
```

Note that an Android you may have to refresh fairly quickly if you want to see a change after making a purchase because unacknowledged purchases by license testers are revoked after 3-5 minutes (normally it takes 3 days for an unacknowledged purchase to be revoked).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.