feat(m7b): ump consent flow with fail-safe ad gating and privacy options
This commit is contained in:
+48
-1
@@ -1,4 +1,5 @@
|
||||
import 'package:flame/game.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
@@ -117,7 +118,52 @@ class _MatchScreenState extends State<MatchScreen> {
|
||||
_toast('Replay läuft');
|
||||
}
|
||||
|
||||
/// Settings sheet: privacy options (UMP requirement) and ad status.
|
||||
void _openSettings() {
|
||||
showModalBottomSheet<void>(
|
||||
context: context,
|
||||
backgroundColor: const Color(0xFF0B1220),
|
||||
builder: (sheetContext) => SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.privacy_tip_outlined),
|
||||
title: const Text('Datenschutz-Optionen'),
|
||||
subtitle: Text(_ads.consentLabel),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await _ads.showPrivacyOptions();
|
||||
if (mounted) _toast('Consent: ${_ads.consentLabel}');
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.campaign_outlined),
|
||||
title: const Text('Werbe-Status'),
|
||||
subtitle: Text(_ads.statusLabel),
|
||||
),
|
||||
if (kDebugMode)
|
||||
ListTile(
|
||||
leading: const Icon(Icons.restart_alt),
|
||||
title: const Text('Consent zuruecksetzen (Debug)'),
|
||||
onTap: () async {
|
||||
Navigator.pop(sheetContext);
|
||||
await _ads.resetConsent();
|
||||
if (mounted) _toast('Consent zurueckgesetzt - App neu starten');
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _showRewardedAd() async {
|
||||
if (!_ads.isAdsAllowed) {
|
||||
_toast('Anzeigen erst nach Zustimmung');
|
||||
return;
|
||||
}
|
||||
final reward = await _ads.showRewarded();
|
||||
if (!mounted) return;
|
||||
_toast(reward == null ? 'Keine Anzeige verfügbar' : 'Belohnung: +$reward');
|
||||
@@ -163,7 +209,8 @@ class _MatchScreenState extends State<MatchScreen> {
|
||||
const SizedBox(height: 6),
|
||||
AnimatedBuilder(
|
||||
animation: _session,
|
||||
builder: (context, _) => StatusBar(session: _session),
|
||||
builder: (context, _) =>
|
||||
StatusBar(session: _session, onSettings: _openSettings),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user