2024-01-15 17:26:13 +02:00
|
|
|
import 'package:immich_mobile/mixins/error_logger.mixin.dart';
|
|
|
|
import 'package:immich_mobile/modules/map/models/map_marker.dart';
|
2023-08-27 07:07:35 +02:00
|
|
|
import 'package:immich_mobile/shared/services/api.service.dart';
|
|
|
|
import 'package:logging/logging.dart';
|
|
|
|
|
2024-01-15 17:26:13 +02:00
|
|
|
class MapSerivce with ErrorLoggerMixin {
|
2023-08-27 07:07:35 +02:00
|
|
|
final ApiService _apiService;
|
2024-01-15 17:26:13 +02:00
|
|
|
@override
|
|
|
|
final logger = Logger("MapService");
|
2023-08-27 07:07:35 +02:00
|
|
|
|
2024-01-15 17:26:13 +02:00
|
|
|
MapSerivce(this._apiService);
|
2023-08-27 07:07:35 +02:00
|
|
|
|
2024-01-15 17:26:13 +02:00
|
|
|
Future<Iterable<MapMarker>> getMapMarkers({
|
2023-08-27 07:07:35 +02:00
|
|
|
bool? isFavorite,
|
2023-10-04 15:51:07 +02:00
|
|
|
bool? withArchived,
|
2023-08-27 07:07:35 +02:00
|
|
|
DateTime? fileCreatedAfter,
|
|
|
|
DateTime? fileCreatedBefore,
|
|
|
|
}) async {
|
2024-01-15 17:26:13 +02:00
|
|
|
return logError(
|
|
|
|
() async {
|
|
|
|
final markers = await _apiService.assetApi.getMapMarkers(
|
|
|
|
isFavorite: isFavorite,
|
|
|
|
isArchived: withArchived,
|
|
|
|
fileCreatedAfter: fileCreatedAfter,
|
|
|
|
fileCreatedBefore: fileCreatedBefore,
|
|
|
|
);
|
2023-08-27 07:07:35 +02:00
|
|
|
|
2024-01-15 17:26:13 +02:00
|
|
|
return markers?.map(MapMarker.fromDto) ?? [];
|
|
|
|
},
|
|
|
|
defaultValue: [],
|
|
|
|
);
|
2023-08-27 07:07:35 +02:00
|
|
|
}
|
|
|
|
}
|