setMovieComments method

Future<void> setMovieComments(
  1. Movie movie,
  2. String comments
)

Sets the personal comments for a movie and saves to POD.

Implementation

Future<void> setMovieComments(Movie movie, String comments) async {
  try {
    // Immediately update cache and mark as having file to prevent any reads.

    _cachedComments ??= {};
    _cachedComments![movie.id.toString()] = comments;
    _moviesWithFiles.add(movie.id);

    // Create/update the single movie file with the new comment - this is the primary storage now.

    await _createOrUpdateMovieFile(movie, comment: comments);

    // Skip backward compatibility saves to avoid encryption warnings.
    // The movie files are now the primary storage.

    notifyListeners();
  } catch (e) {
    debugPrint('❌ Failed to save comments: $e');
    // Let the UI handle error feedback.
  }
}