hasConsent method

Future<bool> hasConsent()

Whether the user has accepted the cloud-sync disclaimer at any version. Returns false on transient network errors so the caller treats absence of consent as "not yet consented" — the screen will re-prompt next save.

Implementation

Future<bool> hasConsent() async {
  final userId = _client.auth.currentUser?.id;
  if (userId == null) return false;
  final row = await _client
      .from('profiles')
      .select('ai_sync_consent_at')
      .eq('id', userId)
      .maybeSingle();
  return row?['ai_sync_consent_at'] != null;
}