feat: align iOS client safety and consent experience

This commit is contained in:
MingNian
2026-07-29 13:30:34 +08:00
parent 3b5cec10a6
commit 01f4955e0e
11 changed files with 290 additions and 374 deletions

View File

@@ -32,7 +32,15 @@ class AiConsentDetailsPage extends ConsumerWidget {
);
if (confirmed != true || !context.mounted) return;
await ref.read(aiConsentProvider.notifier).revoke(userId);
final revoked = await ref.read(aiConsentProvider.notifier).revoke(userId);
if (!revoked) {
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Authorization could not be revoked.')),
);
}
return;
}
await ref.read(authProvider.notifier).logout();
}
@@ -59,6 +67,7 @@ class AiConsentDetailsPage extends ConsumerWidget {
color: AppColors.textPrimary,
),
),
centerTitle: true,
),
body: SafeArea(
child: SingleChildScrollView(
@@ -91,8 +100,11 @@ class AiConsentDetailsPage extends ConsumerWidget {
SizedBox(
width: double.infinity,
child: OutlinedButton(
onPressed: () => _revoke(context, ref),
onPressed: consent.isSaving
? null
: () => _revoke(context, ref),
style: OutlinedButton.styleFrom(
backgroundColor: Colors.white,
foregroundColor: AppColors.error,
side: BorderSide(
color: AppColors.error.withValues(alpha: 0.4),