Fix unavailable Play subscription handling

This commit is contained in:
livio committed 2026-09-30 20:59:24 +02:00
1 parent 6a675ce635
commit 0e0476a5f2
4 files changed
+26 -7

No files matched your search

+2 -2
View File
@@ -28,8 +28,8 @@
<ApplicationId>it.liviomerola.lmemappecatastali.pro</ApplicationId>
<!-- Versions -->
<ApplicationDisplayVersion>1.0.4</ApplicationDisplayVersion>
<ApplicationVersion>104</ApplicationVersion>
<ApplicationDisplayVersion>1.0.5</ApplicationDisplayVersion>
<ApplicationVersion>105</ApplicationVersion>
<Version>$(ApplicationDisplayVersion)</Version>
<!-- To develop, package, and publish an app to the Microsoft Store, see: https://aka.ms/MauiTemplateUnpackaged -->
+1 -1
View File
@@ -4,7 +4,7 @@
- Nome: LME Mappe Catastali Pro.
- Package name Android: `it.liviomerola.lmemappecatastali.pro`.
- Versione corrente Play: `1.0.4` / version code `104`.
- Versione corrente da pubblicare: `1.0.5` / version code `105`.
- Formato Release Android: Android App Bundle (`.aab`).
- Target SDK Release: Android 16 / API 36.
+13 -4
View File
@@ -92,12 +92,20 @@ public sealed class AndroidPlayBillingService : Java.Lang.Object, IPlayBillingSe
{
try
{
if (string.IsNullOrWhiteSpace(basePlanId))
{
return PlayBillingResult.Failed("Piano LME Pro non valido.");
}
var details = await GetProductDetailsAsync(cancellationToken);
var offer = details?.GetSubscriptionOfferDetails()?
.FirstOrDefault(item => item.BasePlanId == basePlanId && string.IsNullOrEmpty(item.OfferId));
.FirstOrDefault(item => item.BasePlanId == basePlanId
&& string.IsNullOrEmpty(item.OfferId)
&& !string.IsNullOrWhiteSpace(item.OfferToken));
if (details is null || offer is null)
{
return PlayBillingResult.Failed("Piano LME Pro non disponibile. Verifica prodotto e base plan nella Play Console.");
return PlayBillingResult.Failed(
$"Piano {basePlanId} non disponibile su Google Play. Verifica che l'abbonamento lme_pro e il piano siano attivi per il tuo Paese.");
}
var productParams = BillingFlowParams.ProductDetailsParams.NewBuilder()
@@ -113,7 +121,8 @@ public sealed class AndroidPlayBillingService : Java.Lang.Object, IPlayBillingSe
var completion = new TaskCompletionSource<PlayBillingResult>(TaskCreationOptions.RunContinuationsAsynchronously);
_purchaseCompletion = completion;
using var registration = cancellationToken.Register(() => completion.TrySetCanceled(cancellationToken));
var launchResult = _client.LaunchBillingFlow(activity, flow);
var launchResult = await MainThread.InvokeOnMainThreadAsync(() =>
_client.LaunchBillingFlow(activity, flow));
if (launchResult.ResponseCode != BillingResponseCode.Ok)
{
_purchaseCompletion = null;
@@ -182,7 +191,7 @@ public sealed class AndroidPlayBillingService : Java.Lang.Object, IPlayBillingSe
throw new InvalidOperationException(ToMessage(result.Result));
}
return result.ProductDetailsList.FirstOrDefault();
return result.ProductDetailsList?.FirstOrDefault();
}
private async Task EnsureConnectedAsync(CancellationToken cancellationToken)
+10
View File
@@ -4,6 +4,16 @@ App .NET MAUI Blazor Hybrid per Android, iOS, Mac Catalyst e Windows, pensata pe
Informativa privacy: [PRIVACY_POLICY.md](PRIVACY_POLICY.md).
## Versione Pro 1.0.5 test
- Il flusso di acquisto Google Play gestisce correttamente prodotti o offerte non restituiti dal catalogo, senza mostrare eccezioni tecniche.
- L'apertura della schermata di acquisto viene eseguita sul thread principale Android.
## Versione Pro 1.0.4 test
- I prezzi mensile e annuale vengono letti direttamente dal catalogo Google Play.
- Il piano Base consente fino a 15 oggetti disegnati; LME Pro non applica limiti.
## Versione Pro 1.0.3 test
- I pannelli mobili rispettano la barra di navigazione Android e mantengono il pulsante Help completamente raggiungibile tramite scorrimento.