loadEncryptedPlaces method

Future<void> loadEncryptedPlaces({
  1. bool skipKeyVerification = false,
})

Load encrypted places with optional key verification.

Implementation

Future<void> loadEncryptedPlaces({bool skipKeyVerification = false}) async {
  if (!isLoggedIn || !mounted) return;

  final result = await loadEncryptedPlacesData(
    context: context,
    widget: widget,
    isLoggedIn: isLoggedIn,
    skipKeyVerification: skipKeyVerification,
  );

  if (result.cancelled && mounted) {
    safeSetState(this, () {
      mapSettings = mapSettings.copyWith(showEncryptedPlaces: false);
    });
    MapSettingsService.saveSettings(mapSettings);
    return;
  }

  if (mounted && result.encryptedPlaces.isNotEmpty) {
    safeSetState(this, () {
      allPlaces = mergeEncryptedPlaces(
        allPlaces: allPlaces,
        encryptedPlaces: result.encryptedPlaces,
      );
    });
  }
}