fetchEncryptedPlaces static method

Future<List<Place>> fetchEncryptedPlaces({
  1. bool forceRefresh = false,
})

Fetch encrypted places from Pod. Returns empty list if not logged in or no security key available. NOTE: Will not prompt for security key - use EncryptedPlacesService directly if you need to prompt the user.

Implementation

static Future<List<Place>> fetchEncryptedPlaces({
  bool forceRefresh = false,
}) async {
  try {
    if (!authStateNotifier.value) return [];

    // Check if security key is available - don't try to load if not.
    final hasKey = await EncryptedPlacesService.isSecurityKeyAvailable();
    if (!hasKey) {
      debugPrint(
        'PlacesService.fetchEncryptedPlaces: no security key, skipping',
      );
      return [];
    }

    // Import and use EncryptedPlacesService.
    final encPlaces = await EncryptedPlacesService.fetchEncryptedPlaces(
      forceRefresh: forceRefresh,
    );
    return encPlaces;
  } catch (e) {
    debugPrint('PlacesService.fetchEncryptedPlaces error: $e');
    return [];
  }
}