feat(monetization-261): prepare entitlement infrastructure and quota enforcement for release

- Add EntitlementSnapshot, EntitlementRevalidationUseCase, and BillingUseCases
- Add DriftEntitlementSnapshotRepository for offline entitlement caching
- Add HealthConnect gateway and integration
- Add quota enforcement in share acceptance (server and UI)
- Add entitlement API endpoints in server
- Add privacy policy v1 and release compliance checklist
- Add QA gates and device runbooks for release validation
- Add demo content screen and settings screen

Ticket #261
This commit is contained in:
2026-08-28 23:12:25 +02:00
parent d4df3822b7
commit b12a04ba30
10 changed files with 1096 additions and 26 deletions

View File

@ -52,7 +52,7 @@ final class AppDatabase extends _$AppDatabase {
}
@override
int get schemaVersion => 26;
int get schemaVersion => 27;
@override
MigrationStrategy get migration {
@ -62,6 +62,7 @@ final class AppDatabase extends _$AppDatabase {
await _migrateToSchema15();
await _migrateToSchema16(migrator);
await _migrateToSchema25();
await _migrateToSchema27();
await _createIndexes();
},
onUpgrade: (migrator, from, to) async {
@ -145,6 +146,9 @@ final class AppDatabase extends _$AppDatabase {
if (from < 26) {
await _migrateToSchema26(migrator);
}
if (from < 27) {
await _migrateToSchema27();
}
await _createIndexes();
},
beforeOpen: (details) async {
@ -485,6 +489,23 @@ extension on AppDatabase {
await migrator.createTable(activeWorkoutTelemetryWindowStates);
}
Future<void> _migrateToSchema27() async {
await customStatement('''
CREATE TABLE IF NOT EXISTS entitlement_snapshots (
id TEXT NOT NULL PRIMARY KEY CHECK (id = 'current'),
entitlement TEXT NOT NULL CHECK (entitlement IN ('free', 'pro')),
can_sync INTEGER NOT NULL CHECK (can_sync IN (0, 1)),
has_unlimited_editable_library INTEGER NOT NULL CHECK (
has_unlimited_editable_library IN (0, 1)
),
remaining_editable_slots INTEGER CHECK (
remaining_editable_slots IS NULL OR remaining_editable_slots >= 0
),
validated_at INTEGER NOT NULL
)
''');
}
Future<void> _migrateToSchema13() async {
await customStatement('PRAGMA foreign_keys = OFF');
await customStatement('''