diff --git a/mobile/lib/domain/models/time_range.model.dart b/mobile/lib/domain/models/time_range.model.dart new file mode 100644 index 0000000000..bb46c01c75 --- /dev/null +++ b/mobile/lib/domain/models/time_range.model.dart @@ -0,0 +1,15 @@ +import 'package:immich_mobile/utils/option.dart'; + +class TimeRange { + final Option from; + final Option to; + + const TimeRange({this.from = const None(), this.to = const None()}); + + TimeRange copyWith({Option? from, Option? to}) { + return TimeRange(from: from ?? this.from, to: to ?? this.to); + } + + TimeRange clearFrom() => TimeRange(to: to); + TimeRange clearTo() => TimeRange(from: from); +} diff --git a/mobile/lib/infrastructure/repositories/timeline.repository.dart b/mobile/lib/infrastructure/repositories/timeline.repository.dart index 610fcc9c39..0278367246 100644 --- a/mobile/lib/infrastructure/repositories/timeline.repository.dart +++ b/mobile/lib/infrastructure/repositories/timeline.repository.dart @@ -5,6 +5,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:immich_mobile/constants/constants.dart'; import 'package:immich_mobile/domain/models/album/album.model.dart'; import 'package:immich_mobile/domain/models/asset/base_asset.model.dart'; +import 'package:immich_mobile/domain/models/time_range.model.dart'; import 'package:immich_mobile/domain/models/timeline.model.dart'; import 'package:immich_mobile/domain/services/timeline.service.dart'; import 'package:immich_mobile/infrastructure/entities/local_asset.entity.dart'; @@ -12,7 +13,6 @@ import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.dart'; import 'package:immich_mobile/infrastructure/entities/remote_asset.entity.drift.dart'; import 'package:immich_mobile/infrastructure/repositories/db.repository.dart'; import 'package:immich_mobile/infrastructure/repositories/map.repository.dart'; -import 'package:immich_mobile/presentation/widgets/map/map.state.dart'; import 'package:maplibre_gl/maplibre_gl.dart'; import 'package:stream_transform/stream_transform.dart'; diff --git a/mobile/lib/presentation/widgets/map/map.state.dart b/mobile/lib/presentation/widgets/map/map.state.dart index d3ae23200d..fef25411f3 100644 --- a/mobile/lib/presentation/widgets/map/map.state.dart +++ b/mobile/lib/presentation/widgets/map/map.state.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:immich_mobile/domain/models/events.model.dart'; import 'package:immich_mobile/domain/models/metadata_key.dart'; +import 'package:immich_mobile/domain/models/time_range.model.dart'; import 'package:immich_mobile/domain/utils/event_stream.dart'; import 'package:immich_mobile/infrastructure/repositories/timeline.repository.dart'; import 'package:immich_mobile/providers/infrastructure/map.provider.dart'; @@ -10,20 +11,6 @@ import 'package:immich_mobile/providers/map/map_state.provider.dart'; import 'package:immich_mobile/utils/option.dart'; import 'package:maplibre_gl/maplibre_gl.dart'; -class TimeRange { - final Option from; - final Option to; - - const TimeRange({this.from = const None(), this.to = const None()}); - - TimeRange copyWith({Option? from, Option? to}) { - return TimeRange(from: from ?? this.from, to: to ?? this.to); - } - - TimeRange clearFrom() => TimeRange(to: to); - TimeRange clearTo() => TimeRange(from: from); -} - class MapState { final ThemeMode themeMode; final LatLngBounds bounds; diff --git a/mobile/lib/presentation/widgets/map/map_settings_sheet.dart b/mobile/lib/presentation/widgets/map/map_settings_sheet.dart index 9a88c6c55c..51c0d31363 100644 --- a/mobile/lib/presentation/widgets/map/map_settings_sheet.dart +++ b/mobile/lib/presentation/widgets/map/map_settings_sheet.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:immich_mobile/domain/models/time_range.model.dart'; import 'package:immich_mobile/extensions/translate_extensions.dart'; import 'package:immich_mobile/generated/translations.g.dart'; import 'package:immich_mobile/presentation/widgets/map/map.state.dart'; diff --git a/mobile/lib/widgets/map/map_settings/map_custom_time_range.dart b/mobile/lib/widgets/map/map_settings/map_custom_time_range.dart index a0507e87db..c2dc5879a6 100644 --- a/mobile/lib/widgets/map/map_settings/map_custom_time_range.dart +++ b/mobile/lib/widgets/map/map_settings/map_custom_time_range.dart @@ -1,7 +1,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; +import 'package:immich_mobile/domain/models/time_range.model.dart'; import 'package:immich_mobile/generated/translations.g.dart'; -import 'package:immich_mobile/presentation/widgets/map/map.state.dart'; import 'package:immich_mobile/utils/option.dart'; class MapTimeRange extends StatelessWidget {