Skip to content

BillingService Refresh Does Not Update the UI #733

@david-maw

Description

@david-maw

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions