recordConsent method

Future<void> recordConsent(
  1. String version
)

Record the user's acceptance of the cloud-sync disclaimer at version.

Implementation

Future<void> recordConsent(String version) async {
  final userId = _client.auth.currentUser?.id;
  if (userId == null) {
    throw StateError('Cannot record consent: not signed in.');
  }
  await _client
      .from('profiles')
      .update({
        'ai_sync_consent_at': DateTime.now().toUtc().toIso8601String(),
        'ai_sync_consent_version': version,
      })
      .eq('id', userId);
}