mirror of
https://gitlab.com/foxixus/neomovies_mobile.git
synced 2025-10-28 03:58:50 +05:00
Fix API auth flow and poster URLs
- Fix authorization issues by improving error handling for unverified accounts - Enable auto-login after successful email verification - Fix poster fetching to use NeoMovies API instead of TMDB directly - Add missing video player models (VideoQuality, AudioTrack, Subtitle, PlayerSettings) - Add video_player and chewie dependencies for native video playback - Update Movie model to use API images endpoint for better CDN control Resolves authentication and image loading issues.
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:neomovies_mobile/data/models/reaction.dart';
|
||||
import 'package:neomovies_mobile/data/models/auth_response.dart';
|
||||
import 'package:neomovies_mobile/data/models/user.dart';
|
||||
import 'package:neomovies_mobile/data/api/neomovies_api_client.dart'; // новый клиент
|
||||
import 'package:neomovies_mobile/data/exceptions/auth_exceptions.dart';
|
||||
|
||||
class ApiClient {
|
||||
final NeoMoviesApiClient _neoClient;
|
||||
@@ -116,12 +117,22 @@ class ApiClient {
|
||||
).then((_) {}); // старый код ничего не возвращал
|
||||
}
|
||||
|
||||
Future<AuthResponse> login(String email, String password) {
|
||||
return _neoClient.login(email: email, password: password);
|
||||
Future<AuthResponse> login(String email, String password) async {
|
||||
try {
|
||||
return await _neoClient.login(email: email, password: password);
|
||||
} catch (e) {
|
||||
final errorMessage = e.toString();
|
||||
if (errorMessage.contains('Account not activated') ||
|
||||
errorMessage.contains('not verified') ||
|
||||
errorMessage.contains('Please verify your email')) {
|
||||
throw UnverifiedAccountException(email, message: errorMessage);
|
||||
}
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> verify(String email, String code) {
|
||||
return _neoClient.verifyEmail(email: email, code: code).then((_) {});
|
||||
Future<AuthResponse> verify(String email, String code) {
|
||||
return _neoClient.verifyEmail(email: email, code: code);
|
||||
}
|
||||
|
||||
Future<void> resendCode(String email) {
|
||||
|
||||
Reference in New Issue
Block a user