markTooltipSeen method

Future<void> markTooltipSeen(
  1. String key
)

Mark a tooltip as seen by upserting its key into seen_tooltips JSONB.

Implementation

Future<void> markTooltipSeen(String key) async {
  final userId = _client.auth.currentUser?.id;
  if (userId == null) return;

  final current = await _client
      .from('profiles')
      .select('seen_tooltips')
      .eq('id', userId)
      .maybeSingle();

  final seen = Map<String, dynamic>.from(
    current?['seen_tooltips'] as Map<String, dynamic>? ?? {},
  );
  seen[key] = true;

  await _client
      .from('profiles')
      .update({'seen_tooltips': seen})
      .eq('id', userId);
}