fix(compras): revocar el PRO tras un reembolso sin penalizar a quien pago
Build & Deploy PluriWave / Análisis de código (push) Successful in 41s
Build & Deploy PluriWave / Build APK + AAB release (push) Successful in 4m8s

Verificacion silenciosa en segundo plano con queryPastPurchases, al abrir o
volver a la app y al cargar Android Auto. Solo revoca tras dos respuestas
validas de Play sin la compra separadas 12h; sin red o con error no toca nada.
Reactiva el PRO automaticamente si Play confirma la compra.
This commit is contained in:
Javier Bautista Fernández
2026-09-18 11:45:43 +02:00
parent d7366bbf99
commit 0b7919e72e
14 changed files with 1163 additions and 17 deletions
+12 -2
View File
@@ -20,6 +20,7 @@ import 'servicios/servicio_compras.dart';
import 'servicios/servicio_consentimiento.dart';
import 'servicios/servicio_ecualizador.dart';
import 'servicios/servicio_presets_personalizados.dart';
import 'servicios/verificacion_licencia.dart';
import 'tema/pluriwave_tokens.dart';
const _anchoMinimoLandscape = 600.0;
@@ -146,6 +147,16 @@ Future<void> main() async {
// injected into every state/service below.
final prefs = await SharedPreferences.getInstance();
// Silent license re-verification (refund revocation) for the Android Auto
// path: this engine may be the headless one, with no widget tree and so no
// `EstadoEntitlement`. The browse root triggers it fire-and-forget; the
// shared in-flight guard in `verificarLicencia` keeps it to one query at a
// time even when the phone UI checks too.
registrarVerificacionLicenciaAuto(
() =>
verificarLicencia(consultar: compras.consultarPropiedad, prefs: prefs),
);
// User-saved EQ presets for the car's Ecualizador folder, same
// injectable-prefs DI convention and same pre-init placement as the two
// registrations above (neither depends on the AudioHandler). Passed as a
@@ -354,8 +365,7 @@ bool debeInvalidarArbolAutoAlReanudar({
required AppLifecycleState estado,
required bool hayCocheSuscrito,
required bool yaInvalidado,
}) =>
!yaInvalidado && hayCocheSuscrito && estado == AppLifecycleState.resumed;
}) => !yaInvalidado && hayCocheSuscrito && estado == AppLifecycleState.resumed;
/// Root wrapper that keeps the orientation policy applied and owns the
/// Android Auto browse-tree recovery hook.