mirror of
https://gitlab.com/foxixus/neomovies_mobile.git
synced 2025-10-27 17:58:50 +05:00
1. Fix Downloads screen gray screen issue: - Add DownloadsProvider to main.dart providers list - Remove @RoutePage() decorator from DownloadsScreen - Downloads screen now displays torrent list correctly 2. Fix movie detail screen gray screen issue: - Improve Movie.fromJson() with better error handling - Safe parsing of genres field (handles both Map and String formats) - Add fallback 'Untitled' for movies without title - Add detailed logging in MovieDetailProvider - Better error messages with stack traces 3. Add automatic version update from CI/CD tags: - GitLab CI: Update pubspec.yaml version from CI_COMMIT_TAG before build - GitHub Actions: Update pubspec.yaml version from GITHUB_REF before build - Version format: tag v0.0.18 becomes version 0.0.18+18 - Applies to all build jobs (arm64, arm32, x64) How versioning works: - When you create tag v0.0.18, CI automatically updates pubspec.yaml - Build uses version 0.0.18+18 (version+buildNumber) - APK shows correct version in About screen and Google Play - No manual pubspec.yaml updates needed Example: - Create tag: git tag v0.0.18 && git push origin v0.0.18 - CI reads tag, extracts '0.0.18' - Updates: version: 0.0.18+18 in pubspec.yaml - Builds APK with this version - Release created with proper version number Changes: - lib/main.dart: Add DownloadsProvider - lib/presentation/screens/downloads/downloads_screen.dart: Remove @RoutePage - lib/data/models/movie.dart: Safe JSON parsing with error handling - lib/presentation/providers/movie_detail_provider.dart: Add detailed logging - .gitlab-ci.yml: Add version update script in all build jobs - .github/workflows/release.yml: Add version update step in all build jobs Result: ✅ Downloads screen displays properly ✅ Movie details screen loads correctly ✅ Automatic versioning from tags (0.0.18, 0.0.19, etc.) ✅ No more gray screens!
79 lines
2.2 KiB
Dart
79 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:neomovies_mobile/data/models/movie.dart';
|
|
import 'package:neomovies_mobile/data/repositories/movie_repository.dart';
|
|
import 'package:neomovies_mobile/data/api/api_client.dart';
|
|
|
|
class MovieDetailProvider with ChangeNotifier {
|
|
final MovieRepository _movieRepository;
|
|
final ApiClient _apiClient;
|
|
|
|
MovieDetailProvider(this._movieRepository, this._apiClient);
|
|
|
|
bool _isLoading = false;
|
|
bool get isLoading => _isLoading;
|
|
|
|
bool _isImdbLoading = false;
|
|
bool get isImdbLoading => _isImdbLoading;
|
|
|
|
Movie? _movie;
|
|
Movie? get movie => _movie;
|
|
|
|
String? _imdbId;
|
|
String? get imdbId => _imdbId;
|
|
|
|
String? _error;
|
|
String? get error => _error;
|
|
|
|
Future<void> loadMedia(int mediaId, String mediaType) async {
|
|
_isLoading = true;
|
|
_isImdbLoading = true;
|
|
_error = null;
|
|
_movie = null;
|
|
_imdbId = null;
|
|
notifyListeners();
|
|
|
|
try {
|
|
print('Loading media: ID=$mediaId, type=$mediaType');
|
|
|
|
// Load movie/TV details
|
|
if (mediaType == 'movie') {
|
|
_movie = await _movieRepository.getMovieById(mediaId.toString());
|
|
print('Movie loaded successfully: ${_movie?.title}');
|
|
} else {
|
|
_movie = await _movieRepository.getTvById(mediaId.toString());
|
|
print('TV show loaded successfully: ${_movie?.title}');
|
|
}
|
|
|
|
_isLoading = false;
|
|
notifyListeners();
|
|
|
|
// Try to load IMDb ID (non-blocking)
|
|
if (_movie != null) {
|
|
try {
|
|
print('Loading IMDb ID for $mediaType $mediaId');
|
|
_imdbId = await _apiClient.getImdbId(mediaId.toString(), mediaType);
|
|
print('IMDb ID loaded: $_imdbId');
|
|
} catch (e) {
|
|
// IMDb ID loading failed, but don't fail the whole screen
|
|
print('Failed to load IMDb ID: $e');
|
|
_imdbId = null;
|
|
}
|
|
}
|
|
} catch (e, stackTrace) {
|
|
print('Error loading media: $e');
|
|
print('Stack trace: $stackTrace');
|
|
_error = e.toString();
|
|
_isLoading = false;
|
|
notifyListeners();
|
|
} finally {
|
|
_isImdbLoading = false;
|
|
notifyListeners();
|
|
}
|
|
}
|
|
|
|
// Backward compatibility
|
|
Future<void> loadMovie(int movieId) async {
|
|
await loadMedia(movieId, 'movie');
|
|
}
|
|
}
|