reloadFromPod method

Future<void> reloadFromPod()

Reloads data from POD after app folders are initialized.

Implementation

Future<void> reloadFromPod() async {
  try {
    final isPodReady = await isPodAvailable();
    if (isPodReady) {
      // Re-initialise MovieList IDs if they're not set yet.
      // This is crucial after app folders are ready.

      if (_toWatchListId == null || _watchedListId == null) {
        await _userProfileService.initializeProfileIfNeeded();

        _toWatchListId ??=
            await _movieListService.getOrCreateStandardMovieList('to_watch');
        _watchedListId ??=
            await _movieListService.getOrCreateStandardMovieList('watched');
      }

      // Load data without triggering encryption key validation.
      await _loadFromPodWithoutKeyValidation();
    }
  } catch (e) {
    debugPrint('Failed to reload from POD: $e');
  }
}