m7c: Play Billing and a complete deletion path
- billing module with a testable seam: models (product ids, purchase events), StoreClient + PlayStoreClient over in_app_purchase, Entitlements persisted in SharedPreferences, BillingService orchestrating query/buy/restore/grant. - rules encoded: grant before completePurchase (Play refunds unacknowledged purchases after three days), pending purchases are shown but never granted, restorePurchases on start so a reinstall keeps the purchase, and Remove Ads only hides interstitials - rewarded video stays available. - ads gate: AdsService.adsRemoved stops both the counter and the preload, so an owner never requests an interstitial. - settings sheet: shop section (price from the store, never hardcoded), "restore purchases", and "delete local data" with confirmation; the existing mail-based deletion request stays the account-deletion path since the app has no accounts. - 9 new tests with a fake store cover purchase, restore, pending, cancel, error, restart persistence, missing store and a store that throws. 17 total. - verified on device: the app talks to the real Play Billing service (IInAppBillingService in logcat) and degrades to "no products created" without a crash; com.android.vending.BILLING is in the merged manifest. - docs: monetization 7c (rules + verification), decision D6 (local entitlement until purchases affect the server), compliance rows for billing/restore/ deletion, blocked.md 3c (create remove_ads in the Console). - release 0.9.0 (13).
This commit is contained in:
@@ -230,6 +230,40 @@ unter der Oberfläche → entfernt; Boden pro Frame → `ui.Picture` je Terrain-
|
||||
- Terrain-Cache braucht die Terrain-Version, sonst friert der Boden nach dem ersten Krater ein
|
||||
(gleiche Klasse Fehler wie das HUD-`onLoad`-Problem aus M3a).
|
||||
|
||||
## M7c — Play Billing + Löschpfad (erledigt 2026-10-25)
|
||||
|
||||
**Umfang:** `remove_ads` (Non-Consumable) ist der erste echte Kauf; der Rest des Katalogs aus
|
||||
monetization.md §3 wartet auf eine Ökonomie, die IDs stehen aber schon in `ProductIds`.
|
||||
|
||||
| Datei | Aufgabe |
|
||||
|---|---|
|
||||
| `billing/models.dart` | Produkt-IDs, `StoreProduct`, `PurchaseEvent`/`PurchaseState` |
|
||||
| `billing/store_client.dart` | Schnittstelle + `PlayStoreClient` über `in_app_purchase` |
|
||||
| `billing/entitlements.dart` | Besitzstand, persistiert, `ChangeNotifier` |
|
||||
| `billing/billing_service.dart` | Ablauf: Query, Kauf, Restore, Grant+Complete, Fehlerzustände |
|
||||
| `main.dart` | Shop-Bereich im Einstellungen-Sheet, Ads-Gate, lokale Löschung |
|
||||
| `test/billing_test.dart` | 9 Tests mit Fake-Store |
|
||||
|
||||
**Regeln, die den Unterschied machen**
|
||||
- Erst Entitlement schreiben, **dann** `completePurchase` — Play erstattet nach drei Tagen
|
||||
nicht bestätigte Käufe automatisch.
|
||||
- `pending` wird angezeigt, aber nie freigeschaltet.
|
||||
- `restorePurchases` beim Start, sonst verliert eine Neuinstallation den Kauf.
|
||||
- Remove Ads schaltet nur Interstitials ab; Rewarded bleibt freiwillig verfügbar.
|
||||
- Kein Play-Dienst → kein Crash, sondern „Play Store nicht erreichbar“ bzw. „Keine Produkte
|
||||
im Play Store angelegt“.
|
||||
|
||||
**Verifikation:** 17 Tests grün (9 neu), `flutter analyze` sauber, `com.android.vending.BILLING`
|
||||
im gemergten Manifest. Auf dem Gerät spricht die App den echten Dienst an
|
||||
(`IInAppBillingService`-Transaktionen im Logcat) und degradiert ohne angelegte Produkte sauber —
|
||||
der Screenshot der Einstellungen zeigt genau diese Meldung.
|
||||
|
||||
**Entscheidung:** [D6](decisions.md) — lokal freigeschaltet, serverseitige Belegprüfung erst
|
||||
wenn käufliche Vorteile den Server berühren.
|
||||
|
||||
**Löschpfad:** keine Accounts → Play-Anforderung über Datenlöschung (E-Mail vorausgefüllt)
|
||||
plus „Lokale Daten löschen“ (Warteschlange, Replays, Geräte-ID) erfüllt.
|
||||
|
||||
## Nächste Schritte (aktualisiert)
|
||||
|
||||
1. `bundletool build-apks --connected-device` aus `~/exports/iron-arc-0.7.0.aab` → Install → Smoke.
|
||||
|
||||
Reference in New Issue
Block a user