This commit is contained in:
Mguy13 2022-12-26 19:39:47 +01:00
parent 78fe9e7b09
commit c7324a6b19
458 changed files with 93141 additions and 47 deletions

View file

@ -3,14 +3,13 @@ import 'dart:math';
import '/features/core/data/constants/const_values.dart';
import '/features/core/data/extensions/random_extensions.dart';
import '/features/core/services/logging_service.dart';
import '/l10n/generated/l10n.dart';
import '/locator.dart';
import '../abstracts/images_api.dart';
import '../data/dtos/image_model_dto.dart';
class UnsplashImagesApi extends ImagesApi {
final LoggingService _loggingService = LoggingService.locate;
//final LoggingService _loggingService = LoggingService.locate;
final random = Random();
UnsplashImagesApi({required super.token});
@ -44,7 +43,7 @@ class UnsplashImagesApi extends ImagesApi {
// Emulating serialization
fetchedImageModelDtos = dummyImageModels.map((final dummyModel) => dummyModel.toJson());
} on Exception catch (ex, stackTrace) {
_loggingService.handleException(ex, stackTrace);
loggingService.handleException(ex, stackTrace);
return const Iterable.empty();
}
@ -84,7 +83,7 @@ class UnsplashImagesApi extends ImagesApi {
// Emulating serialization
searchImageModelDtos = dummyImageModels.map((final dummyModel) => dummyModel.toJson());
} on Exception catch (ex, stackTrace) {
_loggingService.handleException(ex, stackTrace);
loggingService.handleException(ex, stackTrace);
return List.empty();
}
@ -94,8 +93,8 @@ class UnsplashImagesApi extends ImagesApi {
Uri _imageUrlGenerator({required int imageSide}) => Uri(
scheme: ConstValues.httpsScheme,
host: ConstValues.backendHost,
pathSegments: [...ConstValues.backendUrlPathSegments, '${imageSide}x$imageSide'],
host: ConstValues.imagesHostServer,
pathSegments: [...ConstValues.imagesHostUrlPathSegments, '${imageSide}x$imageSide'],
);
static UnsplashImagesApi get locate => Locator.locate();