feat(session): swap the AI export button for a per-session switch
The end-of-session dialog no longer carries a second "finish" button. "TERMINER TOUT" is now the only way out, and what it does with the target depends on the AI training setting: - setting on: the target is always sent, with a discreet reminder saying so; - setting off: a "CONTRIBUER À L'IA" switch (off by default, never remembered) decides whether the target is sent or kept on the device; - banned account or failed analysis: neither switch nor upload. Turning the switch on for the first time shows the full program disclaimer (what is sent, pseudonymity, banning rules); refusing leaves it off. That text moved to a shared showAiConsentDialog() so the settings switch and the session switch cannot drift apart, and a new is_ai_terms_accepted flag remembers the acceptance without silently enabling the global setting. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
a9651588bb
commit
ba58cf8efc
@@ -6,6 +6,7 @@ import 'package:crypto/crypto.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import '../../core/theme/app_theme.dart';
|
||||
import '../../core/theme/theme_provider.dart';
|
||||
import '../../core/widgets/ai_consent_dialog.dart';
|
||||
import '../../core/widgets/glass_container.dart';
|
||||
import '../../services/wallet_identity_service.dart';
|
||||
import '../garage/weapon_list_screen.dart';
|
||||
@@ -392,9 +393,8 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
void _showOptInDisclaimer(bool value) {
|
||||
Future<void> _showOptInDisclaimer(bool value) async {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final primary = Theme.of(context).colorScheme.primary;
|
||||
|
||||
if (_isBanned) {
|
||||
showDialog(
|
||||
@@ -433,126 +433,17 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
return;
|
||||
}
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => AlertDialog(
|
||||
backgroundColor: isDark ? AppTheme.darkSurface : AppTheme.lightSurface,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
||||
title: const Text('Participer à l\'entraînement IA', textAlign: TextAlign.center),
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Center(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: primary.withValues(alpha: 0.15),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(Icons.psychology, size: 40, color: primary),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const Text(
|
||||
'En activant cette option, vous acceptez d\'envoyer vos photos de cibles au serveur d\'entraînement IA.',
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
const Text(
|
||||
'📤 Ce qui est envoyé : la photo de la cible, la position des '
|
||||
'impacts que vous avez placés, la distance de tir, le calibre et '
|
||||
'le nombre de coups prévus.',
|
||||
style: TextStyle(fontSize: 13),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const Text(
|
||||
'🚫 Ce qui ne l\'est pas : la géolocalisation de la photo (retirée '
|
||||
'avant l\'envoi), le nom de votre arme, et le modèle de votre appareil.',
|
||||
style: TextStyle(fontSize: 13),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const Text(
|
||||
'🔒 Pseudonymat : votre identité est remplacée par un hash '
|
||||
'cryptographique. Il reste le même d\'un envoi à l\'autre, afin de '
|
||||
'rattacher vos contributions à votre compte (récompenses, '
|
||||
'modération, suppression sur demande).',
|
||||
style: TextStyle(fontSize: 13),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const Text(
|
||||
'🎁 Récompenses : Vos contributions sont enregistrées pour vous donner accès à des fonctionnalités exclusives.',
|
||||
style: TextStyle(fontSize: 13),
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: AppTheme.errorColor.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(color: AppTheme.errorColor.withValues(alpha: 0.4)),
|
||||
),
|
||||
child: const Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.warning_amber_rounded, color: AppTheme.errorColor, size: 20),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
'Règles strictes & Bannissement',
|
||||
style: TextStyle(
|
||||
color: AppTheme.errorColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 6),
|
||||
Text(
|
||||
'Vous vous engagez à n\'envoyer que de réelles cibles de tir conformes. '
|
||||
'Tout envoi de photos non conformes, fausses cibles, images floues ou contenu inapproprié '
|
||||
'entraînera le bannissement immédiat et définitif de votre compte. '
|
||||
'L\'application perdra définitivement la possibilité d\'envoyer des photos.',
|
||||
style: TextStyle(fontSize: 12, height: 1.4),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text('Refuser', style: TextStyle(color: Colors.grey)),
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: primary,
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
),
|
||||
onPressed: () {
|
||||
_walletService.setUploadEnabled(true);
|
||||
setState(() {
|
||||
_isUploadEnabled = true;
|
||||
});
|
||||
Navigator.pop(context);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Merci pour votre contribution !'),
|
||||
backgroundColor: AppTheme.successColor,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: const Text('J\'accepte les règles'),
|
||||
),
|
||||
],
|
||||
final accepted = await showAiConsentDialog(context);
|
||||
if (!accepted || !mounted) return;
|
||||
|
||||
_walletService.setUploadEnabled(true);
|
||||
setState(() {
|
||||
_isUploadEnabled = true;
|
||||
});
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Merci pour votre contribution !'),
|
||||
backgroundColor: AppTheme.successColor,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user