feat(iap): add freemium unlock via one-time in-app purchase
Adds a permanent, non-consumable premium unlock (EstadoEntitlement + PuertoCompras/ServicioComprasPlayBilling) that removes ads and unlocks alarm vacations, alarms past a 5-alarm free cap, recording start, and full Android Auto browsing. The phone equalizer stays free for everyone. - Entitlement is prefs-backed (compra_premium_v1), fail-open, and resolvable headlessly via esPremiumPersistido() for the Android Auto audio handler, which registers before runApp. - Android Auto reduced mode keeps the real root folder labels for free users; browsing into any of them (and playFromMediaId/playFromSearch/ skipToNext/skipToPrevious) is blocked at the getChildren/servicio_audio choke points, with a locked "Función Premium" item as the backstop. Current-station play/pause/stop stays untouched. A free -> premium transition actively invalidates the head unit's cached browse tree. - Ads (top banner + capped interstitial before adding a station or an alarm) are gated behind entitlement via ServicioAnuncios, using official Google test ad unit IDs pending AdMob provisioning. - Alarm cap UX shows an explanatory message with a secondary unlock action rather than a bare paywall jump; existing data is grandfathered. - 4 new localization keys translated across all 13 supported locales. Co-located tests use strict TDD (RED test before implementation) for every new pure-logic unit; full existing suite passes unchanged.
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../estado/estado_ecualizador.dart';
|
||||
import '../estado/estado_entitlement.dart';
|
||||
import '../estado/estado_grabacion.dart';
|
||||
import '../estado/estado_idioma.dart';
|
||||
import '../estado/estado_radio.dart';
|
||||
@@ -10,6 +11,7 @@ import '../l10n/gen/app_localizations.dart';
|
||||
import '../modelos/archivo_grabacion.dart';
|
||||
import '../modelos/emisora.dart';
|
||||
import '../tema/pluriwave_tokens.dart';
|
||||
import '../widgets/hoja_premium.dart';
|
||||
import '../widgets/pluri_layout.dart';
|
||||
import '../widgets/pluri_push_scaffold.dart';
|
||||
import '../widgets/pluri_root_header.dart';
|
||||
@@ -99,6 +101,9 @@ class _AjustesContent extends StatelessWidget {
|
||||
final idioma = context.select<EstadoIdioma, Locale?>(
|
||||
(e) => e.localeSeleccionado,
|
||||
);
|
||||
final esPremium = context.select<EstadoEntitlement, bool>(
|
||||
(e) => e.esPremium,
|
||||
);
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
@@ -256,6 +261,18 @@ class _AjustesContent extends StatelessWidget {
|
||||
GrupoAjustes(
|
||||
titulo: l10n.settingsGroupApplicationTitle,
|
||||
filas: [
|
||||
// freemium-gating spec "Settings always shows a premium row":
|
||||
// a persistent buy row (free tier) or a premium-active state
|
||||
// with restore access (premium tier) — both open the same
|
||||
// paywall sheet, which adapts its own body to the tier.
|
||||
FilaAjuste(
|
||||
key: const ValueKey('ajustes-fila-premium'),
|
||||
icon: Icons.workspace_premium_rounded,
|
||||
iconColor: PluriWaveTokens.brand,
|
||||
titulo: l10n.funcionPremium,
|
||||
valor: esPremium ? l10n.equalizerActive : null,
|
||||
onTap: () => mostrarHojaPremium(context),
|
||||
),
|
||||
FilaAjuste(
|
||||
icon: Icons.language_rounded,
|
||||
titulo: l10n.languageSectionTitle,
|
||||
|
||||
Reference in New Issue
Block a user